From 69b17abf38eda6e02bc208cb779c948b13f2ad90 Mon Sep 17 00:00:00 2001 From: Terry Heo Date: Thu, 28 Jul 2016 06:52:04 -0300 Subject: [PATCH 001/591] [media] cx231xx: reset pipe endpoint when it is stalled Sometimes, the USB pipe could enter into a stalled state, and may need a reset to rework. Add such logic. [mchehab@osg.samsung.com: ported from Android's source: https://android.googlesource.com/kernel/x86_64/+/3a322adc0084fd277b43070712c7dc0dc9245435%5E%21] Signed-off-by: Terry Heo Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-core.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index 630f4fc5155f..3e304bac3a70 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -799,7 +799,7 @@ static void cx231xx_isoc_irq_callback(struct urb *urb) case -ESHUTDOWN: return; default: /* error */ - cx231xx_isocdbg("urb completition error %d.\n", urb->status); + cx231xx_isocdbg("urb completion error %d.\n", urb->status); break; } @@ -842,8 +842,11 @@ static void cx231xx_bulk_irq_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: return; + case -EPIPE: /* stall */ + cx231xx_isocdbg("urb completion error - device is stalled.\n"); + return; default: /* error */ - cx231xx_isocdbg("urb completition error %d.\n", urb->status); + cx231xx_isocdbg("urb completion error %d.\n", urb->status); break; } @@ -867,6 +870,7 @@ void cx231xx_uninit_isoc(struct cx231xx *dev) struct cx231xx_dmaqueue *dma_q = &dev->video_mode.vidq; struct urb *urb; int i; + bool broken_pipe = false; cx231xx_isocdbg("cx231xx: called cx231xx_uninit_isoc\n"); @@ -886,12 +890,19 @@ void cx231xx_uninit_isoc(struct cx231xx *dev) transfer_buffer[i], urb->transfer_dma); } + if (urb->status == -EPIPE) { + broken_pipe = true; + } usb_free_urb(urb); dev->video_mode.isoc_ctl.urb[i] = NULL; } dev->video_mode.isoc_ctl.transfer_buffer[i] = NULL; } + if (broken_pipe) { + cx231xx_isocdbg("Reset endpoint to recover broken pipe."); + usb_reset_endpoint(dev->udev, dev->video_mode.end_point_addr); + } kfree(dev->video_mode.isoc_ctl.urb); kfree(dev->video_mode.isoc_ctl.transfer_buffer); kfree(dma_q->p_left_data); @@ -918,6 +929,7 @@ void cx231xx_uninit_bulk(struct cx231xx *dev) struct cx231xx_dmaqueue *dma_q = &dev->video_mode.vidq; struct urb *urb; int i; + bool broken_pipe = false; cx231xx_isocdbg("cx231xx: called cx231xx_uninit_bulk\n"); @@ -937,12 +949,19 @@ void cx231xx_uninit_bulk(struct cx231xx *dev) transfer_buffer[i], urb->transfer_dma); } + if (urb->status == -EPIPE) { + broken_pipe = true; + } usb_free_urb(urb); dev->video_mode.bulk_ctl.urb[i] = NULL; } dev->video_mode.bulk_ctl.transfer_buffer[i] = NULL; } + if (broken_pipe) { + cx231xx_isocdbg("Reset endpoint to recover broken pipe."); + usb_reset_endpoint(dev->udev, dev->video_mode.end_point_addr); + } kfree(dev->video_mode.bulk_ctl.urb); kfree(dev->video_mode.bulk_ctl.transfer_buffer); kfree(dma_q->p_left_data); From 609afe6b49ef3b4b58886f7b82013a2f35f59a57 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 10 Aug 2016 18:54:07 +0300 Subject: [PATCH 002/591] Documentation/sphinx: build the media intermediate rst files for all outputs This is a stopgap measure to allow building outputs other than html. Signed-off-by: Jani Nikula Acked-by: Mauro Carvalho Chehab Acked-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/Makefile.sphinx | 3 +-- Documentation/media/Makefile | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx index 857f1e273418..d24a9f12a280 100644 --- a/Documentation/Makefile.sphinx +++ b/Documentation/Makefile.sphinx @@ -38,10 +38,9 @@ ALLSPHINXOPTS = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(B I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . quiet_cmd_sphinx = SPHINX $@ - cmd_sphinx = BUILDDIR=$(BUILDDIR) $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2 + cmd_sphinx = $(MAKE) BUILDDIR=$(BUILDDIR) $(build)=Documentation/media all; BUILDDIR=$(BUILDDIR) $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2 htmldocs: - $(MAKE) BUILDDIR=$(BUILDDIR) -f $(srctree)/Documentation/media/Makefile $@ $(call cmd,sphinx,html) pdfdocs: diff --git a/Documentation/media/Makefile b/Documentation/media/Makefile index 39e2d766dbe3..a7fb35291f6c 100644 --- a/Documentation/media/Makefile +++ b/Documentation/media/Makefile @@ -10,7 +10,8 @@ FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \ TARGETS := $(addprefix $(BUILDDIR)/, $(FILES)) -htmldocs: $(BUILDDIR) ${TARGETS} +.PHONY: all +all: $(BUILDDIR) ${TARGETS} $(BUILDDIR): $(Q)mkdir -p $@ From f907ba930780d73e87791c73a4fdc1998e59db75 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 10 Aug 2016 18:54:08 +0300 Subject: [PATCH 003/591] Documentation: switch to pdflatex for pdf generation Looks like rst2pdf is not robust enough, especially for large documents. Use recursive make on the Sphinx generated makefile to convert latex to pdf. The ugly detail is that pdf is generated into Documentation/output/latex. Unfortunately, the pdflatex build generates huge amounts of build log noise, and also fails in the end. We'll fix that next. Signed-off-by: Jani Nikula Acked-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/Makefile.sphinx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx index d24a9f12a280..fc29e08085aa 100644 --- a/Documentation/Makefile.sphinx +++ b/Documentation/Makefile.sphinx @@ -25,8 +25,8 @@ else ifneq ($(DOCBOOKS),) else # HAVE_SPHINX -# User-friendly check for rst2pdf -HAVE_RST2PDF := $(shell if python -c "import rst2pdf" >/dev/null 2>&1; then echo 1; else echo 0; fi) +# User-friendly check for pdflatex +HAVE_PDFLATEX := $(shell if which pdflatex >/dev/null 2>&1; then echo 1; else echo 0; fi) # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 @@ -44,12 +44,13 @@ htmldocs: $(call cmd,sphinx,html) pdfdocs: -ifeq ($(HAVE_RST2PDF),0) - $(warning The Python 'rst2pdf' module was not found. Make sure you have the module installed to produce PDF output.) +ifeq ($(HAVE_PDFLATEX),0) + $(warning The 'pdflatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.) @echo " SKIP Sphinx $@ target." -else # HAVE_RST2PDF - $(call cmd,sphinx,pdf) -endif # HAVE_RST2PDF +else # HAVE_PDFLATEX + $(call cmd,sphinx,latex) + $(Q)$(MAKE) -C $(BUILDDIR)/latex +endif # HAVE_PDFLATEX epubdocs: $(call cmd,sphinx,epub) From 3eb6cd6834c356f40e1633a0ced4ff9a4c59936b Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 10 Aug 2016 18:54:09 +0300 Subject: [PATCH 004/591] Documentation: exclude media documentation from pdf generation Although pdflatex is more robust than rst2pdf, building media documentation pdf still fails. Exclude media documentation from pdf generation for now. Signed-off-by: Jani Nikula Acked-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/conf.py b/Documentation/conf.py index 96b7aa66c89c..827dafc515b1 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -268,7 +268,9 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'TheLinuxKernel.tex', 'The Linux Kernel Documentation', + ('kernel-documentation', 'kernel-documentation.tex', 'The Linux Kernel Documentation', + 'The kernel development community', 'manual'), + ('gpu/index', 'gpu.tex', 'Linux GPU Driver Developer\'s Guide', 'The kernel development community', 'manual'), ] From 606b9ac81a63ab3adb7e61206b9ae34ee186a89d Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 13 Aug 2016 16:12:42 +0200 Subject: [PATCH 005/591] doc-rst: generic way to build only sphinx sub-folders Add a generic way to build only a reST sub-folder with or without a individual *build-theme*. * control *sub-folders* by environment SPHINXDIRS * control *build-theme* by environment SPHINX_CONF Folders with a conf.py file, matching $(srctree)/Documentation/*/conf.py can be build and distributed *stand-alone*. E.g. to compile only the html of 'media' and 'gpu' folder use:: make SPHINXDIRS="media gpu" htmldocs To use an additional sphinx-build configuration (*build-theme*) set the name of the configuration file to SPHINX_CONF. E.g. to compile only the html of 'media' with the *nit-picking* build use:: make SPHINXDIRS=media SPHINX_CONF=conf_nitpick.py htmldocs With this, the Documentation/conf.py is read first and updated with the configuration values from the Documentation/media/conf_nitpick.py. Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/DocBook/Makefile | 9 +++++- Documentation/Makefile.sphinx | 43 ++++++++++++++++++++++++----- Documentation/conf.py | 7 +++++ Documentation/sphinx/load_config.py | 32 +++++++++++++++++++++ 4 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 Documentation/sphinx/load_config.py diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 64460a897f56..a91c96522379 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -22,8 +22,14 @@ ifeq ($(DOCBOOKS),) # Skip DocBook build if the user explicitly requested no DOCBOOKS. .DEFAULT: @echo " SKIP DocBook $@ target (DOCBOOKS=\"\" specified)." - else +ifneq ($(SPHINXDIRS),) + +# Skip DocBook build if the user explicitly requested a sphinx dir +.DEFAULT: + @echo " SKIP DocBook $@ target (SPHINXDIRS specified)." +else + ### # The build process is as follows (targets): @@ -221,6 +227,7 @@ silent_gen_xml = : echo "") > $@ endif # DOCBOOKS="" +endif # SPHINDIR=... ### # Help targets as used by the top-level makefile diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx index fc29e08085aa..ea0664cece12 100644 --- a/Documentation/Makefile.sphinx +++ b/Documentation/Makefile.sphinx @@ -5,6 +5,9 @@ # You can set these variables from the command line. SPHINXBUILD = sphinx-build SPHINXOPTS = +SPHINXDIRS = . +_SPHINXDIRS = $(patsubst $(srctree)/Documentation/%/conf.py,%,$(wildcard $(srctree)/Documentation/*/conf.py)) +SPHINX_CONF = conf.py PAPER = BUILDDIR = $(obj)/output @@ -33,30 +36,50 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter KERNELDOC = $(srctree)/scripts/kernel-doc KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC) -ALLSPHINXOPTS = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src) +ALLSPHINXOPTS = $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -quiet_cmd_sphinx = SPHINX $@ - cmd_sphinx = $(MAKE) BUILDDIR=$(BUILDDIR) $(build)=Documentation/media all; BUILDDIR=$(BUILDDIR) $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2 +# commands; the 'cmd' from scripts/Kbuild.include is not *loopable* +loop_cmd = $(echo-cmd) $(cmd_$(1)) + +# $2 sphinx builder e.g. "html" +# $3 name of the build subfolder / e.g. "media", used as: +# * dest folder relative to $(BUILDDIR) and +# * cache folder relative to $(BUILDDIR)/.doctrees +# $4 dest subfolder e.g. "man" for man pages at media/man +# $5 reST source folder relative to $(srctree)/$(src), +# e.g. "media" for the linux-tv book-set at ./Documentation/media + +quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4); + cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media all;\ + BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \ + $(SPHINXBUILD) \ + -b $2 \ + -c $(abspath $(srctree)/$(src)) \ + -d $(abspath $(BUILDDIR)/.doctrees/$3) \ + -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \ + $(ALLSPHINXOPTS) \ + $(abspath $(srctree)/$(src)/$5) \ + $(abspath $(BUILDDIR)/$3/$4); htmldocs: - $(call cmd,sphinx,html) + @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var))) pdfdocs: ifeq ($(HAVE_PDFLATEX),0) $(warning The 'pdflatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.) @echo " SKIP Sphinx $@ target." else # HAVE_PDFLATEX - $(call cmd,sphinx,latex) + @$(call loop_cmd,sphinx,latex,.,latex,.)) $(Q)$(MAKE) -C $(BUILDDIR)/latex endif # HAVE_PDFLATEX epubdocs: - $(call cmd,sphinx,epub) + @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var))) xmldocs: - $(call cmd,sphinx,xml) + @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var))) # no-ops for the Sphinx toolchain sgmldocs: @@ -76,3 +99,9 @@ dochelp: @echo ' epubdocs - EPUB' @echo ' xmldocs - XML' @echo ' cleandocs - clean all generated files' + @echo + @echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2' + @echo ' valid values for SPHINXDIRS are: $(_SPHINXDIRS)' + @echo + @echo ' make SPHINX_CONF={conf-file} [target] use *additional* sphinx-build' + @echo ' configuration. This is e.g. useful to build with nit-picking config.' diff --git a/Documentation/conf.py b/Documentation/conf.py index 827dafc515b1..43e41ed74584 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -19,6 +19,7 @@ import os # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('sphinx')) +from load_config import loadConfig # -- General configuration ------------------------------------------------ @@ -421,3 +422,9 @@ pdf_documents = [ # line arguments. kerneldoc_bin = '../scripts/kernel-doc' kerneldoc_srctree = '..' + +# ------------------------------------------------------------------------------ +# Since loadConfig overwrites settings from the global namespace, it has to be +# the last statement in the conf.py file +# ------------------------------------------------------------------------------ +loadConfig(globals()) diff --git a/Documentation/sphinx/load_config.py b/Documentation/sphinx/load_config.py new file mode 100644 index 000000000000..301a21aa4f63 --- /dev/null +++ b/Documentation/sphinx/load_config.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8; mode: python -*- +# pylint: disable=R0903, C0330, R0914, R0912, E0401 + +import os +import sys +from sphinx.util.pycompat import execfile_ + +# ------------------------------------------------------------------------------ +def loadConfig(namespace): +# ------------------------------------------------------------------------------ + + u"""Load an additional configuration file into *namespace*. + + The name of the configuration file is taken from the environment + ``SPHINX_CONF``. The external configuration file extends (or overwrites) the + configuration values from the origin ``conf.py``. With this you are able to + maintain *build themes*. """ + + config_file = os.environ.get("SPHINX_CONF", None) + if (config_file is not None + and os.path.normpath(namespace["__file__"]) != os.path.normpath(config_file) ): + config_file = os.path.abspath(config_file) + + if os.path.isfile(config_file): + sys.stdout.write("load additional sphinx-config: %s\n" % config_file) + config = namespace.copy() + config['__file__'] = config_file + execfile_(config_file, config) + del config['__file__'] + namespace.update(config) + else: + sys.stderr.write("WARNING: additional sphinx-config not found: %s\n" % config_file) From b32febad77068b4a28daf7b7e063438d0cca8a42 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 13 Aug 2016 16:12:43 +0200 Subject: [PATCH 006/591] doc-rst: add stand-alone conf.py to media folder With the media/conf.py, and media/index.rst the media folder can be build and distributed stand-alone. Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/index.rst | 7 +------ Documentation/media/conf.py | 3 +++ Documentation/media/index.rst | 12 ++++++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 Documentation/media/conf.py create mode 100644 Documentation/media/index.rst diff --git a/Documentation/index.rst b/Documentation/index.rst index e0fc72963e87..bdd9525e05aa 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -6,18 +6,13 @@ Welcome to The Linux Kernel's documentation! ============================================ -Nothing for you to see here *yet*. Please move along. - Contents: .. toctree:: :maxdepth: 2 kernel-documentation - media/media_uapi - media/media_kapi - media/dvb-drivers/index - media/v4l-drivers/index + media/index gpu/index Indices and tables diff --git a/Documentation/media/conf.py b/Documentation/media/conf.py new file mode 100644 index 000000000000..62bdba237917 --- /dev/null +++ b/Documentation/media/conf.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8; mode: python -*- + +project = 'Linux Media Subsystem Documentation' diff --git a/Documentation/media/index.rst b/Documentation/media/index.rst new file mode 100644 index 000000000000..e85c557eeea3 --- /dev/null +++ b/Documentation/media/index.rst @@ -0,0 +1,12 @@ +Linux Media Subsystem Documentation +=================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + media_uapi + media_kapi + dvb-drivers/index + v4l-drivers/index From 482941aa84a6224b3e45f8d52de75c0c0de51391 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 13 Aug 2016 16:12:44 +0200 Subject: [PATCH 007/591] doc-rst: add media/conf_nitpick.py The media/conf_nitpick.py is a *build-theme* wich uses the nit-picking mode of sphinx. To compile only the html of 'media' with the nit-picking build use:: make SPHINXDIRS=media SPHINX_CONF=conf_nitpick.py htmldocs With this, the Documentation/conf.py is read first and updated with the configuration values from the Documentation/media/conf_nitpick.py. The origin media/conf_nitpick.py comes from Mauro's experimental docs-next branch:: https://git.linuxtv.org/mchehab/experimental.git mchehab/docs-next BTW fixed python indentation in media/conf_nitpick.py. Python indentation is 4 spaces [1] and Python 3 disallows mixing the use of tabs and spaces for indentation [2]. [1] https://www.python.org/dev/peps/pep-0008/#indentation [2] https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/media/conf_nitpick.py | 93 +++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/media/conf_nitpick.py diff --git a/Documentation/media/conf_nitpick.py b/Documentation/media/conf_nitpick.py new file mode 100644 index 000000000000..11beac2e68fb --- /dev/null +++ b/Documentation/media/conf_nitpick.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8; mode: python -*- + +project = 'Linux Media Subsystem Documentation' + +# It is possible to run Sphinx in nickpick mode with: +nitpicky = True + +# within nit-picking build, do not refer to any intersphinx object +intersphinx_mapping = {} + +# In nickpick mode, it will complain about lots of missing references that +# +# 1) are just typedefs like: bool, __u32, etc; +# 2) It will complain for things like: enum, NULL; +# 3) It will complain for symbols that should be on different +# books (but currently aren't ported to ReST) +# +# The list below has a list of such symbols to be ignored in nitpick mode +# +nitpick_ignore = [ + ("c:func", "clock_gettime"), + ("c:func", "close"), + ("c:func", "container_of"), + ("c:func", "determine_valid_ioctls"), + ("c:func", "ERR_PTR"), + ("c:func", "ioctl"), + ("c:func", "IS_ERR"), + ("c:func", "mmap"), + ("c:func", "open"), + ("c:func", "pci_name"), + ("c:func", "poll"), + ("c:func", "PTR_ERR"), + ("c:func", "read"), + ("c:func", "release"), + ("c:func", "set"), + ("c:func", "struct fd_set"), + ("c:func", "struct pollfd"), + ("c:func", "usb_make_path"), + ("c:func", "write"), + ("c:type", "atomic_t"), + ("c:type", "bool"), + ("c:type", "buf_queue"), + ("c:type", "device"), + ("c:type", "device_driver"), + ("c:type", "device_node"), + ("c:type", "enum"), + ("c:type", "file"), + ("c:type", "i2c_adapter"), + ("c:type", "i2c_board_info"), + ("c:type", "i2c_client"), + ("c:type", "ktime_t"), + ("c:type", "led_classdev_flash"), + ("c:type", "list_head"), + ("c:type", "lock_class_key"), + ("c:type", "module"), + ("c:type", "mutex"), + ("c:type", "pci_dev"), + ("c:type", "pdvbdev"), + ("c:type", "poll_table_struct"), + ("c:type", "s32"), + ("c:type", "s64"), + ("c:type", "sd"), + ("c:type", "spi_board_info"), + ("c:type", "spi_device"), + ("c:type", "spi_master"), + ("c:type", "struct fb_fix_screeninfo"), + ("c:type", "struct pollfd"), + ("c:type", "struct timeval"), + ("c:type", "struct video_capability"), + ("c:type", "u16"), + ("c:type", "u32"), + ("c:type", "u64"), + ("c:type", "u8"), + ("c:type", "union"), + ("c:type", "usb_device"), + + ("cpp:type", "boolean"), + ("cpp:type", "fd"), + ("cpp:type", "fd_set"), + ("cpp:type", "int16_t"), + ("cpp:type", "NULL"), + ("cpp:type", "off_t"), + ("cpp:type", "pollfd"), + ("cpp:type", "size_t"), + ("cpp:type", "ssize_t"), + ("cpp:type", "timeval"), + ("cpp:type", "__u16"), + ("cpp:type", "__u32"), + ("cpp:type", "__u64"), + ("cpp:type", "uint16_t"), + ("cpp:type", "uint32_t"), + ("cpp:type", "video_system_t"), +] From 666756252deede35014e9ffd4bda70127d7dddf1 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 13 Aug 2016 16:12:45 +0200 Subject: [PATCH 008/591] doc-rst: add stand-alone conf.py to gpu folder With the gpu/conf.py, the gpu folder can be build and distributed stand-alone. To compile only the html of 'gpu' folder use:: make SPHINXDIRS="gpu" htmldocs Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/gpu/conf.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Documentation/gpu/conf.py diff --git a/Documentation/gpu/conf.py b/Documentation/gpu/conf.py new file mode 100644 index 000000000000..d60bcd0db040 --- /dev/null +++ b/Documentation/gpu/conf.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8; mode: python -*- + +project = "Linux GPU Driver Developer's Guide" From a55a51da7a8d6e306a025adc1fb21cd2379ca9bd Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 13 Aug 2016 16:12:46 +0200 Subject: [PATCH 009/591] doc-rst: add docutils config file To stop the sphinx-build on severe errors and exit with an exit code (to stop make) the halt_level must be set. The halt_level can't be set from sphinx, it is a docutils configuration [1]. For this a docutils.conf was added. [1] http://docutils.sourceforge.net/docs/user/config.html Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/docutils.conf | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/docutils.conf diff --git a/Documentation/docutils.conf b/Documentation/docutils.conf new file mode 100644 index 000000000000..2830772264c8 --- /dev/null +++ b/Documentation/docutils.conf @@ -0,0 +1,7 @@ +# -*- coding: utf-8 mode: conf-colon -*- +# +# docutils configuration file +# http://docutils.sourceforge.net/docs/user/config.html + +[general] +halt_level: severe \ No newline at end of file From 6203a642785a7979ec64406da0b452037df31e75 Mon Sep 17 00:00:00 2001 From: Andi Shyti Date: Fri, 12 Aug 2016 14:41:25 +0200 Subject: [PATCH 010/591] Documentation: clk: update file names containing referenced structures Commit 'b09d6d991' removes include/linux/clk-private.h and re-arranges the clock related structures contained in it in different files. The documentation has not been updated accordingly, thus it wasn't anymore consistent. Place the structures referenced by Documentation/clk.txt in the correct files and update their contents to the latest status. Signed-off-by: Andi Shyti [geert: Fix path to clk.c, whitespace, more clk_core, ...] Signed-off-by: Geert Uytterhoeven Signed-off-by: Jonathan Corbet --- Documentation/clk.txt | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/Documentation/clk.txt b/Documentation/clk.txt index 5c4bc4d01d0c..22f026aa2f34 100644 --- a/Documentation/clk.txt +++ b/Documentation/clk.txt @@ -31,24 +31,25 @@ serve as a convenient shorthand for the implementation of the hardware-specific bits for the hypothetical "foo" hardware. Tying the two halves of this interface together is struct clk_hw, which -is defined in struct clk_foo and pointed to within struct clk. This +is defined in struct clk_foo and pointed to within struct clk_core. This allows for easy navigation between the two discrete halves of the common clock interface. Part 2 - common data structures and api -Below is the common struct clk definition from -include/linux/clk-private.h, modified for brevity: +Below is the common struct clk_core definition from +drivers/clk/clk.c, modified for brevity: - struct clk { + struct clk_core { const char *name; const struct clk_ops *ops; struct clk_hw *hw; - char **parent_names; - struct clk **parents; - struct clk *parent; - struct hlist_head children; - struct hlist_node child_node; + struct module *owner; + struct clk_core *parent; + const char **parent_names; + struct clk_core **parents; + u8 num_parents; + u8 new_parent_index; ... }; @@ -56,16 +57,19 @@ The members above make up the core of the clk tree topology. The clk api itself defines several driver-facing functions which operate on struct clk. That api is documented in include/linux/clk.h. -Platforms and devices utilizing the common struct clk use the struct -clk_ops pointer in struct clk to perform the hardware-specific parts of -the operations defined in clk.h: +Platforms and devices utilizing the common struct clk_core use the struct +clk_ops pointer in struct clk_core to perform the hardware-specific parts of +the operations defined in clk-provider.h: struct clk_ops { int (*prepare)(struct clk_hw *hw); void (*unprepare)(struct clk_hw *hw); + int (*is_prepared)(struct clk_hw *hw); + void (*unprepare_unused)(struct clk_hw *hw); int (*enable)(struct clk_hw *hw); void (*disable)(struct clk_hw *hw); int (*is_enabled)(struct clk_hw *hw); + void (*disable_unused)(struct clk_hw *hw); unsigned long (*recalc_rate)(struct clk_hw *hw, unsigned long parent_rate); long (*round_rate)(struct clk_hw *hw, @@ -84,6 +88,8 @@ the operations defined in clk.h: u8 index); unsigned long (*recalc_accuracy)(struct clk_hw *hw, unsigned long parent_accuracy); + int (*get_phase)(struct clk_hw *hw); + int (*set_phase)(struct clk_hw *hw, int degrees); void (*init)(struct clk_hw *hw); int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); @@ -91,7 +97,7 @@ the operations defined in clk.h: Part 3 - hardware clk implementations -The strength of the common struct clk comes from its .ops and .hw pointers +The strength of the common struct clk_core comes from its .ops and .hw pointers which abstract the details of struct clk from the hardware-specific bits, and vice versa. To illustrate consider the simple gateable clk implementation in drivers/clk/clk-gate.c: @@ -107,7 +113,7 @@ struct clk_gate contains struct clk_hw hw as well as hardware-specific knowledge about which register and bit controls this clk's gating. Nothing about clock topology or accounting, such as enable_count or notifier_count, is needed here. That is all handled by the common -framework code and struct clk. +framework code and struct clk_core. Let's walk through enabling this clk from driver code: @@ -139,22 +145,18 @@ static void clk_gate_set_bit(struct clk_gate *gate) Note that to_clk_gate is defined as: -#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, clk) +#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) This pattern of abstraction is used for every clock hardware representation. Part 4 - supporting your own clk hardware -When implementing support for a new type of clock it only necessary to +When implementing support for a new type of clock it is only necessary to include the following header: #include -include/linux/clk.h is included within that header and clk-private.h -must never be included from the code which implements the operations for -a clock. More on that below in Part 5. - To construct a clk hardware structure for your platform you must define the following: From 35db7e94cdee495673360f449cdae726d5576ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20A=2E=20Holm?= Date: Tue, 26 Jul 2016 15:21:33 +0200 Subject: [PATCH 011/591] README: Delete obsolete i386 info + update arch/i386/ paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support for i386 was removed in v3.8, delete the paragraph that says processor types above 386 won't work on that architecture. It's obsolete information and potentially confusing. Also change a couple of "arch/i386/" paths to one that exists now, using "arch/x86/" instead. Signed-off-by: Øyvind A. Holm Signed-off-by: Jonathan Corbet --- README | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README b/README index e8c8a6dc1c2b..09f34f78f2bb 100644 --- a/README +++ b/README @@ -229,10 +229,6 @@ CONFIGURING the kernel: under some circumstances lead to problems: probing for a nonexistent controller card may confuse your other controllers - - Compiling the kernel with "Processor type" set higher than 386 - will result in a kernel that does NOT work on a 386. The - kernel will detect this on bootup, and give up. - - A kernel with math-emulation compiled in will still use the coprocessor if one is present: the math emulation will just never get used in that case. The kernel will be slightly larger, @@ -289,7 +285,7 @@ COMPILING the kernel: LOCALVERSION can be set in the "General Setup" menu. - In order to boot your new kernel, you'll need to copy the kernel - image (e.g. .../linux/arch/i386/boot/bzImage after compilation) + image (e.g. .../linux/arch/x86/boot/bzImage after compilation) to the place where your regular bootable kernel is found. - Booting a kernel directly from a floppy without the assistance of a @@ -391,7 +387,7 @@ IF SOMETHING GOES WRONG: - Alternatively, you can use gdb on a running kernel. (read-only; i.e. you cannot change values or set break points.) To do this, first compile the - kernel with -g; edit arch/i386/Makefile appropriately, then do a "make + kernel with -g; edit arch/x86/Makefile appropriately, then do a "make clean". You'll also need to enable CONFIG_PROC_FS (via "make config"). After you've rebooted with the new kernel, do "gdb vmlinux /proc/kcore". From 865a1caa4b6b886babdd9d67e7c3608be4567a51 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 25 Jul 2016 14:29:06 +0200 Subject: [PATCH 012/591] CodingStyle: Clarify and complete chapter 7 Chapter 7 (Centralized exiting of functions) of the coding style documentation is unclear at times, and lacks some information (such as the possibility to indent labels with a single space.) Clarify and complete it. Signed-off-by: Jean Delvare Cc: Markus Elfring Cc: Jonathan Corbet Signed-off-by: Jonathan Corbet --- Documentation/CodingStyle | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index a096836723ca..784226e396fe 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle @@ -396,9 +396,13 @@ locations and some common work such as cleanup has to be done. If there is no cleanup needed then just return directly. Choose label names which say what the goto does or why the goto exists. An -example of a good name could be "out_buffer:" if the goto frees "buffer". Avoid -using GW-BASIC names like "err1:" and "err2:". Also don't name them after the -goto location like "err_kmalloc_failed:" +example of a good name could be "out_free_buffer:" if the goto frees "buffer". +Avoid using GW-BASIC names like "err1:" and "err2:", as you would have to +renumber them if you ever add or remove exit paths, and they make correctness +difficult to verify anyway. + +It is advised to indent labels with a single space (not tab), so that +"diff -p" does not confuse labels with functions. The rationale for using gotos is: @@ -425,20 +429,29 @@ The rationale for using gotos is: goto out_buffer; } ... - out_buffer: + out_free_buffer: kfree(buffer); return result; } A common type of bug to be aware of is "one err bugs" which look like this: - err: + err: kfree(foo->bar); kfree(foo); return ret; The bug in this code is that on some exit paths "foo" is NULL. Normally the -fix for this is to split it up into two error labels "err_bar:" and "err_foo:". +fix for this is to split it up into two error labels "err_free_bar:" and +"err_free_foo:": + + err_free_bar: + kfree(foo->bar); + err_free_foo: + kfree(foo); + return ret; + +Ideally you should simulate errors to test all exit paths. Chapter 8: Commenting From a78a136fa9337fdc25fdbaa2d253f9b4dc90ad44 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 12 Jul 2016 17:18:28 -0700 Subject: [PATCH 013/591] CodingStyle: Remove "Don't use C99-style comments" Because Linus may still be reading source code on greenbar paper instead of color terminals with code syntax highlighting and appropriate font decorations. Link: http://lkml.kernel.org/r/CA+55aFyQYJerovMsSoSKS7PessZBr4vNp-3QUUwhqk4A4_jcbg@mail.gmail.com Signed-off-by: Joe Perches --- Documentation/CodingStyle | 3 --- 1 file changed, 3 deletions(-) diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 784226e396fe..0f1dbd87eb48 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle @@ -474,9 +474,6 @@ When commenting the kernel API functions, please use the kernel-doc format. See the files Documentation/kernel-documentation.rst and scripts/kernel-doc for details. -Linux style for comments is the C89 "/* ... */" style. -Don't use C99-style "// ..." comments. - The preferred style for long (multi-line) comments is: /* From 7a9011db32b5a24f29e725220d0ba9e970412f47 Mon Sep 17 00:00:00 2001 From: "David A. Long" Date: Fri, 12 Aug 2016 16:24:44 -0400 Subject: [PATCH 014/591] Documentation: kprobes: Document jprobes stack copying limitations Some architectures (i.e.: sparc64 and arm64) make reasonable partial stack duplication for jprobes problematic. Document this. Signed-off-by: David A. Long Acked-by: Catalin Marinas Acked-by: Masami Hiramatsu Signed-off-by: Jonathan Corbet --- Documentation/kprobes.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt index 1f9b3e2b98ae..1f6d45abfe42 100644 --- a/Documentation/kprobes.txt +++ b/Documentation/kprobes.txt @@ -103,6 +103,16 @@ Note that the probed function's args may be passed on the stack or in registers. The jprobe will work in either case, so long as the handler's prototype matches that of the probed function. +Note that in some architectures (e.g.: arm64 and sparc64) the stack +copy is not done, as the actual location of stacked parameters may be +outside of a reasonable MAX_STACK_SIZE value and because that location +cannot be determined by the jprobes code. In this case the jprobes +user must be careful to make certain the calling signature of the +function does not cause parameters to be passed on the stack (e.g.: +more than eight function arguments, an argument of more than sixteen +bytes, or more than 64 bytes of argument data, depending on +architecture). + 1.3 Return Probes 1.3.1 How Does a Return Probe Work? From 5021bb933ae299ed494da7350303700077de20fc Mon Sep 17 00:00:00 2001 From: Ricardo Ribalda Delgado Date: Thu, 18 Aug 2016 10:54:19 +0200 Subject: [PATCH 015/591] Documentation: rs485: Do not define manually the ioctl It is not a very good practice to define the IOCTL manually instead of using the header file. Fix it on the documentation example. Signed-off-by: Ricardo Ribalda Delgado Signed-off-by: Jonathan Corbet --- Documentation/serial/serial-rs485.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt index 2253b8b45a74..389fcd4759e9 100644 --- a/Documentation/serial/serial-rs485.txt +++ b/Documentation/serial/serial-rs485.txt @@ -45,9 +45,8 @@ #include - /* RS485 ioctls: */ - #define TIOCGRS485 0x542E - #define TIOCSRS485 0x542F + /* Include definition for RS485 ioctls: TIOCGRS485 and TIOCSRS485 */ + #include /* Open your specific device (e.g., /dev/mydevice): */ int fd = open ("/dev/mydevice", O_RDWR); From 00445edff345b654a074733d5a41c79d5fe33be3 Mon Sep 17 00:00:00 2001 From: Icenowy Zheng Date: Sat, 13 Aug 2016 18:01:13 +0800 Subject: [PATCH 016/591] Documentation: sunxi: Update Allwinner SoC documentation Now, the A83T and A64 SoC user manuals are available. Update the documentation to add the links. An updated version of A83T datasheet is also included now. Signed-off-by: Icenowy Zheng Acked-by: Chen-Yu Tsai Signed-off-by: Jonathan Corbet --- Documentation/arm/sunxi/README | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/arm/sunxi/README b/Documentation/arm/sunxi/README index e5a115f24471..c7a0554523da 100644 --- a/Documentation/arm/sunxi/README +++ b/Documentation/arm/sunxi/README @@ -73,4 +73,13 @@ SunXi family * Octa ARM Cortex-A7 based SoCs - Allwinner A83T + Datasheet - http://dl.linux-sunxi.org/A83T/A83T_datasheet_Revision_1.1.pdf + https://github.com/allwinner-zh/documents/raw/master/A83T/A83T_Datasheet_v1.3_20150510.pdf + + User Manual + https://github.com/allwinner-zh/documents/raw/master/A83T/A83T_User_Manual_v1.5.1_20150513.pdf + + * Quad ARM Cortex-A53 based SoCs + - Allwinner A64 + + Datasheet + http://dl.linux-sunxi.org/A64/A64_Datasheet_V1.1.pdf + + User Manual + http://dl.linux-sunxi.org/A64/Allwinner%20A64%20User%20Manual%20v1.0.pdf From 22c6bbe41ecf7606c3effc92b54d5e939e806866 Mon Sep 17 00:00:00 2001 From: "baolex.ni" Date: Mon, 11 Jul 2016 09:57:37 +0800 Subject: [PATCH 017/591] Update the maximum depth of C-state from 6 to 9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Jon, This patch is an old one, we have corrected some minor issues on the newer one. Please only review the newest version from my last mail with this subject "[PATCH] ACPI: Update the maximum depth of C-state from 6 to 9". And I also attached it to this mail. Thanks, Baole On 7/11/2016 6:37 AM, Jonathan Corbet wrote: > On Mon, 4 Jul 2016 09:55:10 +0800 > "baolex.ni" wrote: > >> Currently, CPUIDLE_STATE_MAX has been defined as 10 in the cpuidle head file, >> and max_cstate = CPUIDLE_STATE_MAX – 1, so 9 is the right maximum depth of C-state. >> This change is reflected in one place of the kernel-param file, >> but not in the other place where I suggest changing. >> >> Signed-off-by: Chuansheng Liu >> Signed-off-by: Baole Ni > > So why are there two signoffs on a single-line patch? Which one of you > is the actual author? > > Thanks, > > jon > From cf5f8aa6885874f6490b11507d3c0c86fa0a11f4 Mon Sep 17 00:00:00 2001 From: Chuansheng Liu Date: Mon, 4 Jul 2016 08:52:51 +0800 Subject: [PATCH] Update the maximum depth of C-state from 6 to 9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, CPUIDLE_STATE_MAX has been defined as 10 in the cpuidle head file, and max_cstate = CPUIDLE_STATE_MAX – 1, so 9 is the right maximum depth of C-state. This change is reflected in one place of the kernel-param file, but not in the other place where I suggest changing. Signed-off-by: Chuansheng Liu Signed-off-by: Baole Ni Signed-off-by: Jonathan Corbet --- Documentation/kernel-parameters.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 46c030a49186..20557efa8bce 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1688,7 +1688,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. intel_idle.max_cstate= [KNL,HW,ACPI,X86] 0 disables intel_idle and fall back on acpi_idle. - 1 to 6 specify maximum depth of C-state. + 1 to 9 specify maximum depth of C-state. intel_pstate= [X86] disable From cfd7c612baa61af61b2c57b7b8321adf2d1b5d90 Mon Sep 17 00:00:00 2001 From: Eugeniu Rosca Date: Wed, 3 Aug 2016 00:40:34 +0200 Subject: [PATCH 018/591] kconfig-language: improve menuconfig usage description Improper menuconfig usage leads to empty menu entries. zconfdump() is able to reveal some real-life examples: - menuconfig VFIO_NOIOMMU - menuconfig RESET_CONTROLLER - menuconfig SND_ARM To avoid future occurrences of those, improve the menuconfig syntax description. Signed-off-by: Eugeniu Rosca Signed-off-by: Jonathan Corbet --- Documentation/kbuild/kconfig-language.txt | 39 ++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index db101857b2c9..069fcb3eef6e 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt @@ -274,7 +274,44 @@ menuconfig: This is similar to the simple config entry above, but it also gives a hint to front ends, that all suboptions should be displayed as a -separate list of options. +separate list of options. To make sure all the suboptions will really +show up under the menuconfig entry and not outside of it, every item +from the list must depend on the menuconfig symbol. +In practice, this is achieved by using one of the next two constructs: + +(1): +menuconfig M +if M + config C1 + config C2 +endif + +(2): +menuconfig M +config C1 + depends on M +config C2 + depends on M + +In the following examples (3) and (4), C1 and C2 still have the M +dependency, but will not appear under menuconfig M anymore, because +of C0, which doesn't depend on M: + +(3): +menuconfig M + config C0 +if M + config C1 + config C2 +endif + +(4): +menuconfig M +config C0 +config C1 + depends on M +config C2 + depends on M choices: From 505f711174b03f42bdfae1aa6cc191b26c157e94 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 15 Aug 2016 17:15:59 +0200 Subject: [PATCH 019/591] doc-rst: add index to sub-folders Add a index if only a sub-folder is build e.g.:: make SPHINXDIRS=media cleandocs htmldocs BTW: removed dead search link in the top-index file Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/gpu/conf.py | 2 ++ Documentation/gpu/index.rst | 7 +++++++ Documentation/index.rst | 1 - Documentation/media/conf.py | 2 ++ Documentation/media/index.rst | 7 +++++++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Documentation/gpu/conf.py b/Documentation/gpu/conf.py index d60bcd0db040..6314d1708230 100644 --- a/Documentation/gpu/conf.py +++ b/Documentation/gpu/conf.py @@ -1,3 +1,5 @@ # -*- coding: utf-8; mode: python -*- project = "Linux GPU Driver Developer's Guide" + +tags.add("subproject") diff --git a/Documentation/gpu/index.rst b/Documentation/gpu/index.rst index fcac0fa72056..5ff3d2b236af 100644 --- a/Documentation/gpu/index.rst +++ b/Documentation/gpu/index.rst @@ -12,3 +12,10 @@ Linux GPU Driver Developer's Guide drm-uapi i915 vga-switcheroo + +.. only:: subproject + + Indices + ======= + + * :ref:`genindex` diff --git a/Documentation/index.rst b/Documentation/index.rst index bdd9525e05aa..a15f81855b39 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -19,4 +19,3 @@ Indices and tables ================== * :ref:`genindex` -* :ref:`search` diff --git a/Documentation/media/conf.py b/Documentation/media/conf.py index 62bdba237917..77cb2bbd9461 100644 --- a/Documentation/media/conf.py +++ b/Documentation/media/conf.py @@ -1,3 +1,5 @@ # -*- coding: utf-8; mode: python -*- project = 'Linux Media Subsystem Documentation' + +tags.add("subproject") diff --git a/Documentation/media/index.rst b/Documentation/media/index.rst index e85c557eeea3..7f8f0af620ce 100644 --- a/Documentation/media/index.rst +++ b/Documentation/media/index.rst @@ -10,3 +10,10 @@ Contents: media_kapi dvb-drivers/index v4l-drivers/index + +.. only:: subproject + + Indices + ======= + + * :ref:`genindex` From 59058a7adc4b10f357cc5e7cbcda0b2d45940258 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Tue, 16 Aug 2016 09:30:31 -0700 Subject: [PATCH 020/591] mm, kasan: Update kasan docs to indicate arm64 support KASAN has been supported on arm64 since 39d114ddc682 ("arm64: add KASAN support"). Update the docs to indicate this. Signed-off-by: Laura Abbott Acked-by: Andrey Ryabinin Signed-off-by: Jonathan Corbet --- Documentation/kasan.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/kasan.txt b/Documentation/kasan.txt index 7dd95b35cd7c..d167220324c4 100644 --- a/Documentation/kasan.txt +++ b/Documentation/kasan.txt @@ -12,7 +12,7 @@ KASAN uses compile-time instrumentation for checking every memory access, therefore you will need a GCC version 4.9.2 or later. GCC 5.0 or later is required for detection of out-of-bounds accesses to stack or global variables. -Currently KASAN is supported only for x86_64 architecture. +Currently KASAN is supported only for x86_64 and arm64 architecture. 1. Usage ======== From 16dbe8042eb5df72ee761c24a383e4a5e11d540b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:35 -0300 Subject: [PATCH 021/591] docs-rst: fix a breakage when building PDF documents changeset 606b9ac81a63 ("doc-rst: generic way to build only sphinx sub-folders") accidentally broke PDF generation by adding an extra ")". Remove it. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/Makefile.sphinx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx index ea0664cece12..fdef3a4bc8c7 100644 --- a/Documentation/Makefile.sphinx +++ b/Documentation/Makefile.sphinx @@ -71,7 +71,7 @@ ifeq ($(HAVE_PDFLATEX),0) $(warning The 'pdflatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.) @echo " SKIP Sphinx $@ target." else # HAVE_PDFLATEX - @$(call loop_cmd,sphinx,latex,.,latex,.)) + @$(call loop_cmd,sphinx,latex,.,latex,.) $(Q)$(MAKE) -C $(BUILDDIR)/latex endif # HAVE_PDFLATEX From a69ab10869941f45b5f1291ec482df1e9bd7895f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:36 -0300 Subject: [PATCH 022/591] docs-rst: remove a rst2pdf left over code The usage of rst2pdf was replaced by pdflatex on a previous patch. Remove the left-over code at conf.py. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Documentation/conf.py b/Documentation/conf.py index 43e41ed74584..1c6d9da5d1b5 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -31,13 +31,6 @@ from load_config import loadConfig # ones. extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include'] -# Gracefully handle missing rst2pdf. -try: - import rst2pdf - extensions += ['rst2pdf.pdfbuilder'] -except ImportError: - pass - # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] From caee5cdede9c9b3562abd6a93c71e791577802ad Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:37 -0300 Subject: [PATCH 023/591] docs-rst: allow generating some LaTeX pages in landscape Portrait is too small for some tables used at the media docs. So, allow documents to tell Sphinx to generate some pages in landscape by using: .. raw:: latex \begin{landscape} .. raw:: latex \end{landscape} Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Documentation/conf.py b/Documentation/conf.py index 1c6d9da5d1b5..38b240073336 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -246,16 +246,19 @@ htmlhelp_basename = 'TheLinuxKerneldoc' latex_elements = { # The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', +'papersize': 'a4paper', # The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', +'pointsize': '10pt', # Latex figure (float) alignment #'figure_align': 'htbp', + +# Additional stuff for the LaTeX preamble. + 'preamble': ''' + % Allow generate some pages in landscape + \\usepackage{lscape} + ''' } # Grouping the document tree into LaTeX files. List of tuples From 60459774659267569b4d944fcecb372ad0c48629 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:38 -0300 Subject: [PATCH 024/591] docs-rst: improve output for .. notes:: on LaTeX The output for those notes are bad in pdf, as they're not in a box with a different color. Also, it causes the output to not build if the note is inside a table. Change its implementation to avoid the above troubles. The logic there came from: https://stackoverflow.com/questions/606746/how-to-customize-an-existing-latex-environment-without-interfering-with-other-en Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Documentation/conf.py b/Documentation/conf.py index 38b240073336..429183a03b92 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -258,6 +258,29 @@ latex_elements = { 'preamble': ''' % Allow generate some pages in landscape \\usepackage{lscape} + + % Put notes in gray color and let them be inside a table + + \\definecolor{MyGray}{rgb}{0.80,0.80,0.80} + + \\makeatletter\\newenvironment{graybox}{% + \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\columnwidth}}{\\end{minipage}\\end{lrbox}% + \\colorbox{MyGray}{\\usebox{\\@tempboxa}} + }\\makeatother + + \\makeatletter + \\renewenvironment{notice}[2]{ + \\begin{graybox} + \\bf\\it + \\def\\py@noticetype{#1} + \\par\\strong{#2} + \\csname py@noticestart@#1\\endcsname + } + { + \\csname py@noticeend@\\py@noticetype\\endcsname + \\end{graybox} + } + \\makeatother ''' } From a682ec4ba10c88231cdbb8bb9823b2cc749d6364 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:39 -0300 Subject: [PATCH 025/591] docs-rst: Don't mangle with UTF-8 chars on LaTeX/PDF output pdflatex doesn't accept using some UTF-8 chars, like "equal or less than" or "equal or greater than" chars. However, the media documents use them. So, we need to use XeLaTeX for conversion, and a font that accepts such characters. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/Makefile.sphinx | 6 +++--- Documentation/conf.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx index fdef3a4bc8c7..16a3502c9e40 100644 --- a/Documentation/Makefile.sphinx +++ b/Documentation/Makefile.sphinx @@ -29,7 +29,7 @@ else ifneq ($(DOCBOOKS),) else # HAVE_SPHINX # User-friendly check for pdflatex -HAVE_PDFLATEX := $(shell if which pdflatex >/dev/null 2>&1; then echo 1; else echo 0; fi) +HAVE_PDFLATEX := $(shell if which xelatex >/dev/null 2>&1; then echo 1; else echo 0; fi) # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 @@ -68,11 +68,11 @@ htmldocs: pdfdocs: ifeq ($(HAVE_PDFLATEX),0) - $(warning The 'pdflatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.) + $(warning The 'xelatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.) @echo " SKIP Sphinx $@ target." else # HAVE_PDFLATEX @$(call loop_cmd,sphinx,latex,.,latex,.) - $(Q)$(MAKE) -C $(BUILDDIR)/latex + $(Q)$(MAKE) PDFLATEX=xelatex -C $(BUILDDIR)/latex endif # HAVE_PDFLATEX epubdocs: diff --git a/Documentation/conf.py b/Documentation/conf.py index 429183a03b92..06e6db916d2f 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -254,6 +254,10 @@ latex_elements = { # Latex figure (float) alignment #'figure_align': 'htbp', +# Don't mangle with UTF-8 chars +'inputenc': '', +'utf8extra': '', + # Additional stuff for the LaTeX preamble. 'preamble': ''' % Allow generate some pages in landscape @@ -281,6 +285,13 @@ latex_elements = { \\end{graybox} } \\makeatother + + % Use some font with UTF-8 support with XeLaTeX + \\usepackage{fontspec} + \\setsansfont{DejaVu Serif} + \\setromanfont{DejaVu Sans} + \\setmonofont{DejaVu Sans Mono} + ''' } From 85c21e5c3ee74fb75d690c57f7066bae7e2dca55 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:40 -0300 Subject: [PATCH 026/591] docs-rst: better adjust margins and font size As we have big tables, reduce the left/right margins and decrease the point size to 8pt. Visually, it is still good enough, and now less tables are too big to be displayed. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/conf.py b/Documentation/conf.py index 06e6db916d2f..61b71ae60ad0 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -249,7 +249,7 @@ latex_elements = { 'papersize': 'a4paper', # The font size ('10pt', '11pt' or '12pt'). -'pointsize': '10pt', +'pointsize': '8pt', # Latex figure (float) alignment #'figure_align': 'htbp', @@ -260,6 +260,9 @@ latex_elements = { # Additional stuff for the LaTeX preamble. 'preamble': ''' + % Adjust margins + \\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry} + % Allow generate some pages in landscape \\usepackage{lscape} From 999d998eee3dc1a4942b56f178be363844ea3729 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:41 -0300 Subject: [PATCH 027/591] docs-rst: parse-heraders.pl: escape LaTeX characters Let's escape the LaTeX characters, to avoid troubles when outputing them. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/sphinx/parse-headers.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/sphinx/parse-headers.pl b/Documentation/sphinx/parse-headers.pl index 34bd9e2630b0..74089b0da798 100755 --- a/Documentation/sphinx/parse-headers.pl +++ b/Documentation/sphinx/parse-headers.pl @@ -220,7 +220,7 @@ $data =~ s/\n\s+\n/\n\n/g; # # Add escape codes for special characters # -$data =~ s,([\_\`\*\<\>\&\\\\:\/\|]),\\$1,g; +$data =~ s,([\_\`\*\<\>\&\\\\:\/\|\%\$\#\{\}\~\^]),\\$1,g; $data =~ s,DEPRECATED,**DEPRECATED**,g; From 8b8bbf8fe5cfd9aada5f29dc6f6e5b8e4320d058 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:42 -0300 Subject: [PATCH 028/591] docs-rst: Don't go to interactive mode on errors When building for LaTeX, it stops and enters into interactive mode on errors. Don't do that, as there are some non-fatal errors on media books when using Sphinx 1.4.x that we don't know how fix yet. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/Makefile.sphinx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx index 16a3502c9e40..ba4efb1f68f3 100644 --- a/Documentation/Makefile.sphinx +++ b/Documentation/Makefile.sphinx @@ -72,7 +72,7 @@ ifeq ($(HAVE_PDFLATEX),0) @echo " SKIP Sphinx $@ target." else # HAVE_PDFLATEX @$(call loop_cmd,sphinx,latex,.,latex,.) - $(Q)$(MAKE) PDFLATEX=xelatex -C $(BUILDDIR)/latex + $(Q)$(MAKE) PDFLATEX=xelatex LATEXOPTS="-interaction=nonstopmode" -C $(BUILDDIR)/latex endif # HAVE_PDFLATEX epubdocs: From d4fe7e14e4ff5d90286397180831a35df502969e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:25:43 -0300 Subject: [PATCH 029/591] docs-rst: enable the Sphinx math extension This extension will be used by the media books. The name of the math image extension changed on Sphinx 1.4.x, according with: http://www.sphinx-doc.org/en/stable/ext/math.html#module-sphinx.ext.imgmath Let's autodetect, to keep building with versions < 1.4. Suggested-by: Markus Heiser Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/conf.py b/Documentation/conf.py index 61b71ae60ad0..23e2f0bbcfc8 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -14,6 +14,11 @@ import sys import os +import sphinx + +# Get Sphinx version +major, minor, patch = map(int, sphinx.__version__.split(".")) + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -31,6 +36,12 @@ from load_config import loadConfig # ones. extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include'] +# The name of the math extension changed on Sphinx 1.4 +if minor > 3: + extensions.append("sphinx.ext.imgmath") +else: + extensions.append("sphinx.ext.pngmath") + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] From 059c5e918f6613d7062f27705488e5bd72cd09bd Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 8 Aug 2016 16:00:25 -0600 Subject: [PATCH 030/591] docs: create a new dev-tools directory This directory will be a collecting point for documentation oriented around development tools. As a step toward ordering Documentation/ it's a small one, but we have to start somewhere... Signed-off-by: Jonathan Corbet --- Documentation/dev-tools/tools.rst | 16 ++++++++++++++++ Documentation/index.rst | 1 + 2 files changed, 17 insertions(+) create mode 100644 Documentation/dev-tools/tools.rst diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst new file mode 100644 index 000000000000..60ddb9ea6ef9 --- /dev/null +++ b/Documentation/dev-tools/tools.rst @@ -0,0 +1,16 @@ +================================ +Development tools for the kernel +================================ + +This document is a collection of documents about development tools that can +be used to work on the kernel. For now, the documents have been pulled +together without any significant effot to integrate them into a coherent +whole; patches welcome! + +.. class:: toc-title + + Table of contents + +.. toctree:: + :maxdepth: 2 + diff --git a/Documentation/index.rst b/Documentation/index.rst index e0fc72963e87..643fb3205540 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -14,6 +14,7 @@ Contents: :maxdepth: 2 kernel-documentation + dev-tools/tools media/media_uapi media/media_kapi media/dvb-drivers/index From 4b9033a33494ec9154d63e706e9e47f7eb3fd59e Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 8 Aug 2016 16:03:14 -0600 Subject: [PATCH 031/591] docs: sphinxify coccinelle.txt and add it to dev-tools No textual changes have been made, but the formatting has obviously been tweaked. Cc: Michal Marek Cc: Gilles Muller Acked-by: Nicolas Palix Acked-by: Julia Lawall Signed-off-by: Jonathan Corbet --- .../coccinelle.rst} | 359 +++++++++--------- Documentation/dev-tools/tools.rst | 1 + MAINTAINERS | 2 +- 3 files changed, 192 insertions(+), 170 deletions(-) rename Documentation/{coccinelle.txt => dev-tools/coccinelle.rst} (56%) diff --git a/Documentation/coccinelle.txt b/Documentation/dev-tools/coccinelle.rst similarity index 56% rename from Documentation/coccinelle.txt rename to Documentation/dev-tools/coccinelle.rst index 01fb1dae3163..4a64b4c69d3f 100644 --- a/Documentation/coccinelle.txt +++ b/Documentation/dev-tools/coccinelle.rst @@ -1,10 +1,18 @@ -Copyright 2010 Nicolas Palix -Copyright 2010 Julia Lawall -Copyright 2010 Gilles Muller +.. Copyright 2010 Nicolas Palix +.. Copyright 2010 Julia Lawall +.. Copyright 2010 Gilles Muller +.. highlight:: none - Getting Coccinelle -~~~~~~~~~~~~~~~~~~~~ +Coccinelle +========== + +Coccinelle is a tool for pattern matching and text transformation that has +many uses in kernel development, including the application of complex, +tree-wide patches and detection of problematic programming patterns. + +Getting Coccinelle +------------------- The semantic patches included in the kernel use features and options which are provided by Coccinelle version 1.0.0-rc11 and above. @@ -22,24 +30,23 @@ of many distributions, e.g. : - NetBSD - FreeBSD - You can get the latest version released from the Coccinelle homepage at http://coccinelle.lip6.fr/ Information and tips about Coccinelle are also provided on the wiki pages at http://cocci.ekstranet.diku.dk/wiki/doku.php -Once you have it, run the following command: +Once you have it, run the following command:: ./configure make -as a regular user, and install it with +as a regular user, and install it with:: sudo make install - Supplemental documentation -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Supplemental documentation +--------------------------- For supplemental documentation refer to the wiki: @@ -47,49 +54,52 @@ https://bottest.wiki.kernel.org/coccicheck The wiki documentation always refers to the linux-next version of the script. - Using Coccinelle on the Linux kernel -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Using Coccinelle on the Linux kernel +------------------------------------ A Coccinelle-specific target is defined in the top level -Makefile. This target is named 'coccicheck' and calls the 'coccicheck' -front-end in the 'scripts' directory. +Makefile. This target is named ``coccicheck`` and calls the ``coccicheck`` +front-end in the ``scripts`` directory. -Four basic modes are defined: patch, report, context, and org. The mode to -use is specified by setting the MODE variable with 'MODE='. +Four basic modes are defined: ``patch``, ``report``, ``context``, and +``org``. The mode to use is specified by setting the MODE variable with +``MODE=``. -'patch' proposes a fix, when possible. +- ``patch`` proposes a fix, when possible. -'report' generates a list in the following format: +- ``report`` generates a list in the following format: file:line:column-column: message -'context' highlights lines of interest and their context in a -diff-like style.Lines of interest are indicated with '-'. +- ``context`` highlights lines of interest and their context in a + diff-like style.Lines of interest are indicated with ``-``. -'org' generates a report in the Org mode format of Emacs. +- ``org`` generates a report in the Org mode format of Emacs. Note that not all semantic patches implement all modes. For easy use of Coccinelle, the default mode is "report". Two other modes provide some common combinations of these modes. -'chain' tries the previous modes in the order above until one succeeds. +- ``chain`` tries the previous modes in the order above until one succeeds. -'rep+ctxt' runs successively the report mode and the context mode. - It should be used with the C option (described later) - which checks the code on a file basis. +- ``rep+ctxt`` runs successively the report mode and the context mode. + It should be used with the C option (described later) + which checks the code on a file basis. -Examples: - To make a report for every semantic patch, run the following command: +Examples +~~~~~~~~ + +To make a report for every semantic patch, run the following command:: make coccicheck MODE=report - To produce patches, run: +To produce patches, run:: make coccicheck MODE=patch The coccicheck target applies every semantic patch available in the -sub-directories of 'scripts/coccinelle' to the entire Linux kernel. +sub-directories of ``scripts/coccinelle`` to the entire Linux kernel. For each semantic patch, a commit message is proposed. It gives a description of the problem being checked by the semantic patch, and @@ -99,15 +109,15 @@ As any static code analyzer, Coccinelle produces false positives. Thus, reports must be carefully checked, and patches reviewed. -To enable verbose messages set the V= variable, for example: +To enable verbose messages set the V= variable, for example:: make coccicheck MODE=report V=1 - Coccinelle parallelization -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Coccinelle parallelization +--------------------------- By default, coccicheck tries to run as parallel as possible. To change -the parallelism, set the J= variable. For example, to run across 4 CPUs: +the parallelism, set the J= variable. For example, to run across 4 CPUs:: make coccicheck MODE=report J=4 @@ -115,44 +125,47 @@ As of Coccinelle 1.0.2 Coccinelle uses Ocaml parmap for parallelization, if support for this is detected you will benefit from parmap parallelization. When parmap is enabled coccicheck will enable dynamic load balancing by using -'--chunksize 1' argument, this ensures we keep feeding threads with work +``--chunksize 1`` argument, this ensures we keep feeding threads with work one by one, so that we avoid the situation where most work gets done by only a few threads. With dynamic load balancing, if a thread finishes early we keep feeding it more work. When parmap is enabled, if an error occurs in Coccinelle, this error -value is propagated back, the return value of the 'make coccicheck' +value is propagated back, the return value of the ``make coccicheck`` captures this return value. - Using Coccinelle with a single semantic patch -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Using Coccinelle with a single semantic patch +--------------------------------------------- The optional make variable COCCI can be used to check a single semantic patch. In that case, the variable must be initialized with the name of the semantic patch to apply. -For instance: +For instance:: make coccicheck COCCI= MODE=patch -or + +or:: + make coccicheck COCCI= MODE=report - Controlling Which Files are Processed by Coccinelle -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Controlling Which Files are Processed by Coccinelle +--------------------------------------------------- + By default the entire kernel source tree is checked. -To apply Coccinelle to a specific directory, M= can be used. -For example, to check drivers/net/wireless/ one may write: +To apply Coccinelle to a specific directory, ``M=`` can be used. +For example, to check drivers/net/wireless/ one may write:: make coccicheck M=drivers/net/wireless/ To apply Coccinelle on a file basis, instead of a directory basis, the -following command may be used: +following command may be used:: make C=1 CHECK="scripts/coccicheck" -To check only newly edited code, use the value 2 for the C flag, i.e. +To check only newly edited code, use the value 2 for the C flag, i.e.:: make C=2 CHECK="scripts/coccicheck" @@ -166,8 +179,8 @@ semantic patch as shown in the previous section. The "report" mode is the default. You can select another one with the MODE variable explained above. - Debugging Coccinelle SmPL patches -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Debugging Coccinelle SmPL patches +--------------------------------- Using coccicheck is best as it provides in the spatch command line include options matching the options used when we compile the kernel. @@ -177,8 +190,8 @@ manually run Coccinelle with debug options added. Alternatively you can debug running Coccinelle against SmPL patches by asking for stderr to be redirected to stderr, by default stderr is redirected to /dev/null, if you'd like to capture stderr you -can specify the DEBUG_FILE="file.txt" option to coccicheck. For -instance: +can specify the ``DEBUG_FILE="file.txt"`` option to coccicheck. For +instance:: rm -f cocci.err make coccicheck COCCI=scripts/coccinelle/free/kfree.cocci MODE=report DEBUG_FILE=cocci.err @@ -186,7 +199,7 @@ instance: You can use SPFLAGS to add debugging flags, for instance you may want to add both --profile --show-trying to SPFLAGS when debugging. For instance -you may want to use: +you may want to use:: rm -f err.log export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci @@ -198,24 +211,24 @@ work. DEBUG_FILE support is only supported when using coccinelle >= 1.2. - .cocciconfig support -~~~~~~~~~~~~~~~~~~~~~~ +.cocciconfig support +-------------------- Coccinelle supports reading .cocciconfig for default Coccinelle options that should be used every time spatch is spawned, the order of precedence for variables for .cocciconfig is as follows: - o Your current user's home directory is processed first - o Your directory from which spatch is called is processed next - o The directory provided with the --dir option is processed last, if used +- Your current user's home directory is processed first +- Your directory from which spatch is called is processed next +- The directory provided with the --dir option is processed last, if used Since coccicheck runs through make, it naturally runs from the kernel proper dir, as such the second rule above would be implied for picking up a -.cocciconfig when using 'make coccicheck'. +.cocciconfig when using ``make coccicheck``. -'make coccicheck' also supports using M= targets.If you do not supply +``make coccicheck`` also supports using M= targets.If you do not supply any M= target, it is assumed you want to target the entire kernel. -The kernel coccicheck script has: +The kernel coccicheck script has:: if [ "$KBUILD_EXTMOD" = "" ] ; then OPTIONS="--dir $srctree $COCCIINCLUDE" @@ -235,12 +248,12 @@ override any of the kernel's .coccicheck's settings using SPFLAGS. We help Coccinelle when used against Linux with a set of sensible defaults options for Linux with our own Linux .cocciconfig. This hints to coccinelle -git can be used for 'git grep' queries over coccigrep. A timeout of 200 +git can be used for ``git grep`` queries over coccigrep. A timeout of 200 seconds should suffice for now. The options picked up by coccinelle when reading a .cocciconfig do not appear as arguments to spatch processes running on your system, to confirm what -options will be used by Coccinelle run: +options will be used by Coccinelle run:: spatch --print-options-only @@ -252,219 +265,227 @@ carries its own .cocciconfig, you will need to use SPFLAGS to use idutils if desired. See below section "Additional flags" for more details on how to use idutils. - Additional flags -~~~~~~~~~~~~~~~~~~ +Additional flags +---------------- Additional flags can be passed to spatch through the SPFLAGS variable. This works as Coccinelle respects the last flags -given to it when options are in conflict. +given to it when options are in conflict. :: make SPFLAGS=--use-glimpse coccicheck Coccinelle supports idutils as well but requires coccinelle >= 1.0.6. When no ID file is specified coccinelle assumes your ID database file is in the file .id-utils.index on the top level of the kernel, coccinelle -carries a script scripts/idutils_index.sh which creates the database with +carries a script scripts/idutils_index.sh which creates the database with:: mkid -i C --output .id-utils.index If you have another database filename you can also just symlink with this -name. +name. :: make SPFLAGS=--use-idutils coccicheck Alternatively you can specify the database filename explicitly, for -instance: +instance:: make SPFLAGS="--use-idutils /full-path/to/ID" coccicheck -See spatch --help to learn more about spatch options. +See ``spatch --help`` to learn more about spatch options. -Note that the '--use-glimpse' and '--use-idutils' options +Note that the ``--use-glimpse`` and ``--use-idutils`` options require external tools for indexing the code. None of them is thus active by default. However, by indexing the code with one of these tools, and according to the cocci file used, spatch could proceed the entire code base more quickly. - SmPL patch specific options -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +SmPL patch specific options +--------------------------- SmPL patches can have their own requirements for options passed to Coccinelle. SmPL patch specific options can be provided by -providing them at the top of the SmPL patch, for instance: +providing them at the top of the SmPL patch, for instance:: -// Options: --no-includes --include-headers + // Options: --no-includes --include-headers - SmPL patch Coccinelle requirements -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +SmPL patch Coccinelle requirements +---------------------------------- As Coccinelle features get added some more advanced SmPL patches may require newer versions of Coccinelle. If an SmPL patch requires at least a version of Coccinelle, this can be specified as follows, -as an example if requiring at least Coccinelle >= 1.0.5: +as an example if requiring at least Coccinelle >= 1.0.5:: -// Requires: 1.0.5 + // Requires: 1.0.5 - Proposing new semantic patches -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Proposing new semantic patches +------------------------------- New semantic patches can be proposed and submitted by kernel developers. For sake of clarity, they should be organized in the -sub-directories of 'scripts/coccinelle/'. +sub-directories of ``scripts/coccinelle/``. - Detailed description of the 'report' mode -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Detailed description of the ``report`` mode +------------------------------------------- + +``report`` generates a list in the following format:: -'report' generates a list in the following format: file:line:column-column: message -Example: +Example +~~~~~~~ -Running +Running:: make coccicheck MODE=report COCCI=scripts/coccinelle/api/err_cast.cocci -will execute the following part of the SmPL script. +will execute the following part of the SmPL script:: - -@r depends on !context && !patch && (org || report)@ -expression x; -position p; -@@ + + @r depends on !context && !patch && (org || report)@ + expression x; + position p; + @@ - ERR_PTR@p(PTR_ERR(x)) + ERR_PTR@p(PTR_ERR(x)) -@script:python depends on report@ -p << r.p; -x << r.x; -@@ + @script:python depends on report@ + p << r.p; + x << r.x; + @@ -msg="ERR_CAST can be used with %s" % (x) -coccilib.report.print_report(p[0], msg) - + msg="ERR_CAST can be used with %s" % (x) + coccilib.report.print_report(p[0], msg) + This SmPL excerpt generates entries on the standard output, as -illustrated below: +illustrated below:: -/home/user/linux/crypto/ctr.c:188:9-16: ERR_CAST can be used with alg -/home/user/linux/crypto/authenc.c:619:9-16: ERR_CAST can be used with auth -/home/user/linux/crypto/xts.c:227:9-16: ERR_CAST can be used with alg + /home/user/linux/crypto/ctr.c:188:9-16: ERR_CAST can be used with alg + /home/user/linux/crypto/authenc.c:619:9-16: ERR_CAST can be used with auth + /home/user/linux/crypto/xts.c:227:9-16: ERR_CAST can be used with alg - Detailed description of the 'patch' mode -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Detailed description of the ``patch`` mode +------------------------------------------ -When the 'patch' mode is available, it proposes a fix for each problem +When the ``patch`` mode is available, it proposes a fix for each problem identified. -Example: +Example +~~~~~~~ + +Running:: -Running make coccicheck MODE=patch COCCI=scripts/coccinelle/api/err_cast.cocci -will execute the following part of the SmPL script. +will execute the following part of the SmPL script:: - -@ depends on !context && patch && !org && !report @ -expression x; -@@ + + @ depends on !context && patch && !org && !report @ + expression x; + @@ -- ERR_PTR(PTR_ERR(x)) -+ ERR_CAST(x) - + - ERR_PTR(PTR_ERR(x)) + + ERR_CAST(x) + This SmPL excerpt generates patch hunks on the standard output, as -illustrated below: +illustrated below:: -diff -u -p a/crypto/ctr.c b/crypto/ctr.c ---- a/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200 -+++ b/crypto/ctr.c 2010-06-03 23:44:49.000000000 +0200 -@@ -185,7 +185,7 @@ static struct crypto_instance *crypto_ct + diff -u -p a/crypto/ctr.c b/crypto/ctr.c + --- a/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200 + +++ b/crypto/ctr.c 2010-06-03 23:44:49.000000000 +0200 + @@ -185,7 +185,7 @@ static struct crypto_instance *crypto_ct alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_MASK); if (IS_ERR(alg)) -- return ERR_PTR(PTR_ERR(alg)); -+ return ERR_CAST(alg); - + - return ERR_PTR(PTR_ERR(alg)); + + return ERR_CAST(alg); + /* Block size must be >= 4 bytes. */ err = -EINVAL; - Detailed description of the 'context' mode -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Detailed description of the ``context`` mode +-------------------------------------------- -'context' highlights lines of interest and their context +``context`` highlights lines of interest and their context in a diff-like style. -NOTE: The diff-like output generated is NOT an applicable patch. The - intent of the 'context' mode is to highlight the important lines - (annotated with minus, '-') and gives some surrounding context + **NOTE**: The diff-like output generated is NOT an applicable patch. The + intent of the ``context`` mode is to highlight the important lines + (annotated with minus, ``-``) and gives some surrounding context lines around. This output can be used with the diff mode of Emacs to review the code. -Example: +Example +~~~~~~~ + +Running:: -Running make coccicheck MODE=context COCCI=scripts/coccinelle/api/err_cast.cocci -will execute the following part of the SmPL script. +will execute the following part of the SmPL script:: - -@ depends on context && !patch && !org && !report@ -expression x; -@@ + + @ depends on context && !patch && !org && !report@ + expression x; + @@ -* ERR_PTR(PTR_ERR(x)) - + * ERR_PTR(PTR_ERR(x)) + This SmPL excerpt generates diff hunks on the standard output, as -illustrated below: +illustrated below:: -diff -u -p /home/user/linux/crypto/ctr.c /tmp/nothing ---- /home/user/linux/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200 -+++ /tmp/nothing -@@ -185,7 +185,6 @@ static struct crypto_instance *crypto_ct + diff -u -p /home/user/linux/crypto/ctr.c /tmp/nothing + --- /home/user/linux/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200 + +++ /tmp/nothing + @@ -185,7 +185,6 @@ static struct crypto_instance *crypto_ct alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_MASK); if (IS_ERR(alg)) -- return ERR_PTR(PTR_ERR(alg)); - + - return ERR_PTR(PTR_ERR(alg)); + /* Block size must be >= 4 bytes. */ err = -EINVAL; - Detailed description of the 'org' mode -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Detailed description of the ``org`` mode +---------------------------------------- -'org' generates a report in the Org mode format of Emacs. +``org`` generates a report in the Org mode format of Emacs. -Example: +Example +~~~~~~~ + +Running:: -Running make coccicheck MODE=org COCCI=scripts/coccinelle/api/err_cast.cocci -will execute the following part of the SmPL script. +will execute the following part of the SmPL script:: - -@r depends on !context && !patch && (org || report)@ -expression x; -position p; -@@ + + @r depends on !context && !patch && (org || report)@ + expression x; + position p; + @@ - ERR_PTR@p(PTR_ERR(x)) + ERR_PTR@p(PTR_ERR(x)) -@script:python depends on org@ -p << r.p; -x << r.x; -@@ + @script:python depends on org@ + p << r.p; + x << r.x; + @@ -msg="ERR_CAST can be used with %s" % (x) -msg_safe=msg.replace("[","@(").replace("]",")") -coccilib.org.print_todo(p[0], msg_safe) - + msg="ERR_CAST can be used with %s" % (x) + msg_safe=msg.replace("[","@(").replace("]",")") + coccilib.org.print_todo(p[0], msg_safe) + This SmPL excerpt generates Org entries on the standard output, as -illustrated below: +illustrated below:: -* TODO [[view:/home/user/linux/crypto/ctr.c::face=ovl-face1::linb=188::colb=9::cole=16][ERR_CAST can be used with alg]] -* TODO [[view:/home/user/linux/crypto/authenc.c::face=ovl-face1::linb=619::colb=9::cole=16][ERR_CAST can be used with auth]] -* TODO [[view:/home/user/linux/crypto/xts.c::face=ovl-face1::linb=227::colb=9::cole=16][ERR_CAST can be used with alg]] + * TODO [[view:/home/user/linux/crypto/ctr.c::face=ovl-face1::linb=188::colb=9::cole=16][ERR_CAST can be used with alg]] + * TODO [[view:/home/user/linux/crypto/authenc.c::face=ovl-face1::linb=619::colb=9::cole=16][ERR_CAST can be used with auth]] + * TODO [[view:/home/user/linux/crypto/xts.c::face=ovl-face1::linb=227::colb=9::cole=16][ERR_CAST can be used with alg]] diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index 60ddb9ea6ef9..ae0c58c784db 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -14,3 +14,4 @@ whole; patches welcome! .. toctree:: :maxdepth: 2 + coccinelle diff --git a/MAINTAINERS b/MAINTAINERS index 20bb1d00098c..1e5460cfc196 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3124,7 +3124,7 @@ L: cocci@systeme.lip6.fr (moderated for non-subscribers) T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git misc W: http://coccinelle.lip6.fr/ S: Supported -F: Documentation/coccinelle.txt +F: Documentation/dev-tools/coccinelle.rst F: scripts/coccinelle/ F: scripts/coccicheck From d228af5bcb60fda50f8b3a100c0539c4994df040 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 7 Aug 2016 15:09:14 -0600 Subject: [PATCH 032/591] docs: sphinxify sparse.txt and move to dev-tools Fold the sparse document into the development tools set; no changes to the text itself beyond formatting. Signed-off-by: Jonathan Corbet --- .../{sparse.txt => dev-tools/sparse.rst} | 39 ++++++++++++------- Documentation/dev-tools/tools.rst | 1 + 2 files changed, 25 insertions(+), 15 deletions(-) rename Documentation/{sparse.txt => dev-tools/sparse.rst} (82%) diff --git a/Documentation/sparse.txt b/Documentation/dev-tools/sparse.rst similarity index 82% rename from Documentation/sparse.txt rename to Documentation/dev-tools/sparse.rst index eceab1308a8c..8c250e8a2105 100644 --- a/Documentation/sparse.txt +++ b/Documentation/dev-tools/sparse.rst @@ -1,11 +1,20 @@ -Copyright 2004 Linus Torvalds -Copyright 2004 Pavel Machek -Copyright 2006 Bob Copeland +.. Copyright 2004 Linus Torvalds +.. Copyright 2004 Pavel Machek +.. Copyright 2006 Bob Copeland + +Sparse +====== + +Sparse is a semantic checker for C programs; it can be used to find a +number of potential problems with kernel code. See +https://lwn.net/Articles/689907/ for an overview of sparse; this document +contains some kernel-specific sparse information. + Using sparse for typechecking -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +----------------------------- -"__bitwise" is a type attribute, so you have to do something like this: +"__bitwise" is a type attribute, so you have to do something like this:: typedef int __bitwise pm_request_t; @@ -20,13 +29,13 @@ but in this case we really _do_ want to force the conversion). And because the enum values are all the same type, now "enum pm_request" will be that type too. -And with gcc, all the __bitwise/__force stuff goes away, and it all ends -up looking just like integers to gcc. +And with gcc, all the "__bitwise"/"__force stuff" goes away, and it all +ends up looking just like integers to gcc. Quite frankly, you don't need the enum there. The above all really just boils down to one special "int __bitwise" type. -So the simpler way is to just do +So the simpler way is to just do:: typedef int __bitwise pm_request_t; @@ -50,7 +59,7 @@ __bitwise - noisy stuff; in particular, __le*/__be* are that. We really don't want to drown in noise unless we'd explicitly asked for it. Using sparse for lock checking -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------------ The following macros are undefined for gcc and defined during a sparse run to use the "context" tracking feature of sparse, applied to @@ -69,22 +78,22 @@ annotation is needed. The tree annotations above are for cases where sparse would otherwise report a context imbalance. Getting sparse -~~~~~~~~~~~~~~ +-------------- You can get latest released versions from the Sparse homepage at https://sparse.wiki.kernel.org/index.php/Main_Page Alternatively, you can get snapshots of the latest development version -of sparse using git to clone.. +of sparse using git to clone:: git://git.kernel.org/pub/scm/devel/sparse/sparse.git -DaveJ has hourly generated tarballs of the git tree available at.. +DaveJ has hourly generated tarballs of the git tree available at:: http://www.codemonkey.org.uk/projects/git-snapshots/sparse/ -Once you have it, just do +Once you have it, just do:: make make install @@ -92,7 +101,7 @@ Once you have it, just do as a regular user, and it will install sparse in your ~/bin directory. Using sparse -~~~~~~~~~~~~ +------------ Do a kernel make with "make C=1" to run sparse on all the C files that get recompiled, or use "make C=2" to run sparse on the files whether they need to @@ -101,7 +110,7 @@ have already built it. The optional make variable CF can be used to pass arguments to sparse. The build system passes -Wbitwise to sparse automatically. To perform endianness -checks, you may define __CHECK_ENDIAN__: +checks, you may define __CHECK_ENDIAN__:: make C=2 CF="-D__CHECK_ENDIAN__" diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index ae0c58c784db..d4bbda319e79 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -15,3 +15,4 @@ whole; patches welcome! :maxdepth: 2 coccinelle + sparse From 758f726e7f7c5a09d8627e6e6ad914e568b31a5c Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 7 Aug 2016 15:13:00 -0600 Subject: [PATCH 033/591] docs: sphinxify kcov.txt and move to dev-tools Another document added to the dev-tools collection. Cc: Dmitry Vyukov Signed-off-by: Jonathan Corbet --- .../{kcov.txt => dev-tools/kcov.rst} | 74 +++++++++---------- Documentation/dev-tools/tools.rst | 1 + 2 files changed, 38 insertions(+), 37 deletions(-) rename Documentation/{kcov.txt => dev-tools/kcov.rst} (78%) diff --git a/Documentation/kcov.txt b/Documentation/dev-tools/kcov.rst similarity index 78% rename from Documentation/kcov.txt rename to Documentation/dev-tools/kcov.rst index 779ff4ab1c1d..aca0e27ca197 100644 --- a/Documentation/kcov.txt +++ b/Documentation/dev-tools/kcov.rst @@ -12,38 +12,38 @@ To achieve this goal it does not collect coverage in soft/hard interrupts and instrumentation of some inherently non-deterministic parts of kernel is disbled (e.g. scheduler, locking). -Usage: -====== +Usage +----- -Configure kernel with: +Configure the kernel with:: CONFIG_KCOV=y CONFIG_KCOV requires gcc built on revision 231296 or later. -Profiling data will only become accessible once debugfs has been mounted: +Profiling data will only become accessible once debugfs has been mounted:: mount -t debugfs none /sys/kernel/debug -The following program demonstrates kcov usage from within a test program: +The following program demonstrates kcov usage from within a test program:: -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include -#define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) -#define KCOV_ENABLE _IO('c', 100) -#define KCOV_DISABLE _IO('c', 101) -#define COVER_SIZE (64<<10) + #define KCOV_INIT_TRACE _IOR('c', 1, unsigned long) + #define KCOV_ENABLE _IO('c', 100) + #define KCOV_DISABLE _IO('c', 101) + #define COVER_SIZE (64<<10) -int main(int argc, char **argv) -{ + int main(int argc, char **argv) + { int fd; unsigned long *cover, n, i; @@ -83,24 +83,24 @@ int main(int argc, char **argv) if (close(fd)) perror("close"), exit(1); return 0; -} + } -After piping through addr2line output of the program looks as follows: +After piping through addr2line output of the program looks as follows:: -SyS_read -fs/read_write.c:562 -__fdget_pos -fs/file.c:774 -__fget_light -fs/file.c:746 -__fget_light -fs/file.c:750 -__fget_light -fs/file.c:760 -__fdget_pos -fs/file.c:784 -SyS_read -fs/read_write.c:562 + SyS_read + fs/read_write.c:562 + __fdget_pos + fs/file.c:774 + __fget_light + fs/file.c:746 + __fget_light + fs/file.c:750 + __fget_light + fs/file.c:760 + __fdget_pos + fs/file.c:784 + SyS_read + fs/read_write.c:562 If a program needs to collect coverage from several threads (independently), it needs to open /sys/kernel/debug/kcov in each thread separately. diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index d4bbda319e79..9dcd0236a1ff 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -16,3 +16,4 @@ whole; patches welcome! coccinelle sparse + kcov From 2584bab2f990281244d3f39dc15cd9bd6d69f51d Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 7 Aug 2016 15:26:20 -0600 Subject: [PATCH 034/591] docs: sphinixfy gcov.txt and move to dev-tools No textual changes beyond formatting. Cc: Peter Oberparleiter Signed-off-by: Jonathan Corbet --- Documentation/dev-tools/gcov.rst | 256 +++++++++++++++++++++++++++++ Documentation/dev-tools/tools.rst | 1 + Documentation/gcov.txt | 257 ------------------------------ MAINTAINERS | 2 +- 4 files changed, 258 insertions(+), 258 deletions(-) create mode 100644 Documentation/dev-tools/gcov.rst delete mode 100644 Documentation/gcov.txt diff --git a/Documentation/dev-tools/gcov.rst b/Documentation/dev-tools/gcov.rst new file mode 100644 index 000000000000..19eedfea8800 --- /dev/null +++ b/Documentation/dev-tools/gcov.rst @@ -0,0 +1,256 @@ +Using gcov with the Linux kernel +================================ + +gcov profiling kernel support enables the use of GCC's coverage testing +tool gcov_ with the Linux kernel. Coverage data of a running kernel +is exported in gcov-compatible format via the "gcov" debugfs directory. +To get coverage data for a specific file, change to the kernel build +directory and use gcov with the ``-o`` option as follows (requires root):: + + # cd /tmp/linux-out + # gcov -o /sys/kernel/debug/gcov/tmp/linux-out/kernel spinlock.c + +This will create source code files annotated with execution counts +in the current directory. In addition, graphical gcov front-ends such +as lcov_ can be used to automate the process of collecting data +for the entire kernel and provide coverage overviews in HTML format. + +Possible uses: + +* debugging (has this line been reached at all?) +* test improvement (how do I change my test to cover these lines?) +* minimizing kernel configurations (do I need this option if the + associated code is never run?) + +.. _gcov: http://gcc.gnu.org/onlinedocs/gcc/Gcov.html +.. _lcov: http://ltp.sourceforge.net/coverage/lcov.php + + +Preparation +----------- + +Configure the kernel with:: + + CONFIG_DEBUG_FS=y + CONFIG_GCOV_KERNEL=y + +select the gcc's gcov format, default is autodetect based on gcc version:: + + CONFIG_GCOV_FORMAT_AUTODETECT=y + +and to get coverage data for the entire kernel:: + + CONFIG_GCOV_PROFILE_ALL=y + +Note that kernels compiled with profiling flags will be significantly +larger and run slower. Also CONFIG_GCOV_PROFILE_ALL may not be supported +on all architectures. + +Profiling data will only become accessible once debugfs has been +mounted:: + + mount -t debugfs none /sys/kernel/debug + + +Customization +------------- + +To enable profiling for specific files or directories, add a line +similar to the following to the respective kernel Makefile: + +- For a single file (e.g. main.o):: + + GCOV_PROFILE_main.o := y + +- For all files in one directory:: + + GCOV_PROFILE := y + +To exclude files from being profiled even when CONFIG_GCOV_PROFILE_ALL +is specified, use:: + + GCOV_PROFILE_main.o := n + +and:: + + GCOV_PROFILE := n + +Only files which are linked to the main kernel image or are compiled as +kernel modules are supported by this mechanism. + + +Files +----- + +The gcov kernel support creates the following files in debugfs: + +``/sys/kernel/debug/gcov`` + Parent directory for all gcov-related files. + +``/sys/kernel/debug/gcov/reset`` + Global reset file: resets all coverage data to zero when + written to. + +``/sys/kernel/debug/gcov/path/to/compile/dir/file.gcda`` + The actual gcov data file as understood by the gcov + tool. Resets file coverage data to zero when written to. + +``/sys/kernel/debug/gcov/path/to/compile/dir/file.gcno`` + Symbolic link to a static data file required by the gcov + tool. This file is generated by gcc when compiling with + option ``-ftest-coverage``. + + +Modules +------- + +Kernel modules may contain cleanup code which is only run during +module unload time. The gcov mechanism provides a means to collect +coverage data for such code by keeping a copy of the data associated +with the unloaded module. This data remains available through debugfs. +Once the module is loaded again, the associated coverage counters are +initialized with the data from its previous instantiation. + +This behavior can be deactivated by specifying the gcov_persist kernel +parameter:: + + gcov_persist=0 + +At run-time, a user can also choose to discard data for an unloaded +module by writing to its data file or the global reset file. + + +Separated build and test machines +--------------------------------- + +The gcov kernel profiling infrastructure is designed to work out-of-the +box for setups where kernels are built and run on the same machine. In +cases where the kernel runs on a separate machine, special preparations +must be made, depending on where the gcov tool is used: + +a) gcov is run on the TEST machine + + The gcov tool version on the test machine must be compatible with the + gcc version used for kernel build. Also the following files need to be + copied from build to test machine: + + from the source tree: + - all C source files + headers + + from the build tree: + - all C source files + headers + - all .gcda and .gcno files + - all links to directories + + It is important to note that these files need to be placed into the + exact same file system location on the test machine as on the build + machine. If any of the path components is symbolic link, the actual + directory needs to be used instead (due to make's CURDIR handling). + +b) gcov is run on the BUILD machine + + The following files need to be copied after each test case from test + to build machine: + + from the gcov directory in sysfs: + - all .gcda files + - all links to .gcno files + + These files can be copied to any location on the build machine. gcov + must then be called with the -o option pointing to that directory. + + Example directory setup on the build machine:: + + /tmp/linux: kernel source tree + /tmp/out: kernel build directory as specified by make O= + /tmp/coverage: location of the files copied from the test machine + + [user@build] cd /tmp/out + [user@build] gcov -o /tmp/coverage/tmp/out/init main.c + + +Troubleshooting +--------------- + +Problem + Compilation aborts during linker step. + +Cause + Profiling flags are specified for source files which are not + linked to the main kernel or which are linked by a custom + linker procedure. + +Solution + Exclude affected source files from profiling by specifying + ``GCOV_PROFILE := n`` or ``GCOV_PROFILE_basename.o := n`` in the + corresponding Makefile. + +Problem + Files copied from sysfs appear empty or incomplete. + +Cause + Due to the way seq_file works, some tools such as cp or tar + may not correctly copy files from sysfs. + +Solution + Use ``cat``' to read ``.gcda`` files and ``cp -d`` to copy links. + Alternatively use the mechanism shown in Appendix B. + + +Appendix A: gather_on_build.sh +------------------------------ + +Sample script to gather coverage meta files on the build machine +(see 6a):: + + #!/bin/bash + + KSRC=$1 + KOBJ=$2 + DEST=$3 + + if [ -z "$KSRC" ] || [ -z "$KOBJ" ] || [ -z "$DEST" ]; then + echo "Usage: $0 " >&2 + exit 1 + fi + + KSRC=$(cd $KSRC; printf "all:\n\t@echo \${CURDIR}\n" | make -f -) + KOBJ=$(cd $KOBJ; printf "all:\n\t@echo \${CURDIR}\n" | make -f -) + + find $KSRC $KOBJ \( -name '*.gcno' -o -name '*.[ch]' -o -type l \) -a \ + -perm /u+r,g+r | tar cfz $DEST -P -T - + + if [ $? -eq 0 ] ; then + echo "$DEST successfully created, copy to test system and unpack with:" + echo " tar xfz $DEST -P" + else + echo "Could not create file $DEST" + fi + + +Appendix B: gather_on_test.sh +----------------------------- + +Sample script to gather coverage data files on the test machine +(see 6b):: + + #!/bin/bash -e + + DEST=$1 + GCDA=/sys/kernel/debug/gcov + + if [ -z "$DEST" ] ; then + echo "Usage: $0 " >&2 + exit 1 + fi + + TEMPDIR=$(mktemp -d) + echo Collecting data.. + find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \; + find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \; + find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \; + tar czf $DEST -C $TEMPDIR sys + rm -rf $TEMPDIR + + echo "$DEST successfully created, copy to build system and unpack with:" + echo " tar xfz $DEST" diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index 9dcd0236a1ff..404d044c8518 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -17,3 +17,4 @@ whole; patches welcome! coccinelle sparse kcov + gcov diff --git a/Documentation/gcov.txt b/Documentation/gcov.txt deleted file mode 100644 index 7b727783db7e..000000000000 --- a/Documentation/gcov.txt +++ /dev/null @@ -1,257 +0,0 @@ -Using gcov with the Linux kernel -================================ - -1. Introduction -2. Preparation -3. Customization -4. Files -5. Modules -6. Separated build and test machines -7. Troubleshooting -Appendix A: sample script: gather_on_build.sh -Appendix B: sample script: gather_on_test.sh - - -1. Introduction -=============== - -gcov profiling kernel support enables the use of GCC's coverage testing -tool gcov [1] with the Linux kernel. Coverage data of a running kernel -is exported in gcov-compatible format via the "gcov" debugfs directory. -To get coverage data for a specific file, change to the kernel build -directory and use gcov with the -o option as follows (requires root): - -# cd /tmp/linux-out -# gcov -o /sys/kernel/debug/gcov/tmp/linux-out/kernel spinlock.c - -This will create source code files annotated with execution counts -in the current directory. In addition, graphical gcov front-ends such -as lcov [2] can be used to automate the process of collecting data -for the entire kernel and provide coverage overviews in HTML format. - -Possible uses: - -* debugging (has this line been reached at all?) -* test improvement (how do I change my test to cover these lines?) -* minimizing kernel configurations (do I need this option if the - associated code is never run?) - --- - -[1] http://gcc.gnu.org/onlinedocs/gcc/Gcov.html -[2] http://ltp.sourceforge.net/coverage/lcov.php - - -2. Preparation -============== - -Configure the kernel with: - - CONFIG_DEBUG_FS=y - CONFIG_GCOV_KERNEL=y - -select the gcc's gcov format, default is autodetect based on gcc version: - - CONFIG_GCOV_FORMAT_AUTODETECT=y - -and to get coverage data for the entire kernel: - - CONFIG_GCOV_PROFILE_ALL=y - -Note that kernels compiled with profiling flags will be significantly -larger and run slower. Also CONFIG_GCOV_PROFILE_ALL may not be supported -on all architectures. - -Profiling data will only become accessible once debugfs has been -mounted: - - mount -t debugfs none /sys/kernel/debug - - -3. Customization -================ - -To enable profiling for specific files or directories, add a line -similar to the following to the respective kernel Makefile: - - For a single file (e.g. main.o): - GCOV_PROFILE_main.o := y - - For all files in one directory: - GCOV_PROFILE := y - -To exclude files from being profiled even when CONFIG_GCOV_PROFILE_ALL -is specified, use: - - GCOV_PROFILE_main.o := n - and: - GCOV_PROFILE := n - -Only files which are linked to the main kernel image or are compiled as -kernel modules are supported by this mechanism. - - -4. Files -======== - -The gcov kernel support creates the following files in debugfs: - - /sys/kernel/debug/gcov - Parent directory for all gcov-related files. - - /sys/kernel/debug/gcov/reset - Global reset file: resets all coverage data to zero when - written to. - - /sys/kernel/debug/gcov/path/to/compile/dir/file.gcda - The actual gcov data file as understood by the gcov - tool. Resets file coverage data to zero when written to. - - /sys/kernel/debug/gcov/path/to/compile/dir/file.gcno - Symbolic link to a static data file required by the gcov - tool. This file is generated by gcc when compiling with - option -ftest-coverage. - - -5. Modules -========== - -Kernel modules may contain cleanup code which is only run during -module unload time. The gcov mechanism provides a means to collect -coverage data for such code by keeping a copy of the data associated -with the unloaded module. This data remains available through debugfs. -Once the module is loaded again, the associated coverage counters are -initialized with the data from its previous instantiation. - -This behavior can be deactivated by specifying the gcov_persist kernel -parameter: - - gcov_persist=0 - -At run-time, a user can also choose to discard data for an unloaded -module by writing to its data file or the global reset file. - - -6. Separated build and test machines -==================================== - -The gcov kernel profiling infrastructure is designed to work out-of-the -box for setups where kernels are built and run on the same machine. In -cases where the kernel runs on a separate machine, special preparations -must be made, depending on where the gcov tool is used: - -a) gcov is run on the TEST machine - -The gcov tool version on the test machine must be compatible with the -gcc version used for kernel build. Also the following files need to be -copied from build to test machine: - -from the source tree: - - all C source files + headers - -from the build tree: - - all C source files + headers - - all .gcda and .gcno files - - all links to directories - -It is important to note that these files need to be placed into the -exact same file system location on the test machine as on the build -machine. If any of the path components is symbolic link, the actual -directory needs to be used instead (due to make's CURDIR handling). - -b) gcov is run on the BUILD machine - -The following files need to be copied after each test case from test -to build machine: - -from the gcov directory in sysfs: - - all .gcda files - - all links to .gcno files - -These files can be copied to any location on the build machine. gcov -must then be called with the -o option pointing to that directory. - -Example directory setup on the build machine: - - /tmp/linux: kernel source tree - /tmp/out: kernel build directory as specified by make O= - /tmp/coverage: location of the files copied from the test machine - - [user@build] cd /tmp/out - [user@build] gcov -o /tmp/coverage/tmp/out/init main.c - - -7. Troubleshooting -================== - -Problem: Compilation aborts during linker step. -Cause: Profiling flags are specified for source files which are not - linked to the main kernel or which are linked by a custom - linker procedure. -Solution: Exclude affected source files from profiling by specifying - GCOV_PROFILE := n or GCOV_PROFILE_basename.o := n in the - corresponding Makefile. - -Problem: Files copied from sysfs appear empty or incomplete. -Cause: Due to the way seq_file works, some tools such as cp or tar - may not correctly copy files from sysfs. -Solution: Use 'cat' to read .gcda files and 'cp -d' to copy links. - Alternatively use the mechanism shown in Appendix B. - - -Appendix A: gather_on_build.sh -============================== - -Sample script to gather coverage meta files on the build machine -(see 6a): -#!/bin/bash - -KSRC=$1 -KOBJ=$2 -DEST=$3 - -if [ -z "$KSRC" ] || [ -z "$KOBJ" ] || [ -z "$DEST" ]; then - echo "Usage: $0 " >&2 - exit 1 -fi - -KSRC=$(cd $KSRC; printf "all:\n\t@echo \${CURDIR}\n" | make -f -) -KOBJ=$(cd $KOBJ; printf "all:\n\t@echo \${CURDIR}\n" | make -f -) - -find $KSRC $KOBJ \( -name '*.gcno' -o -name '*.[ch]' -o -type l \) -a \ - -perm /u+r,g+r | tar cfz $DEST -P -T - - -if [ $? -eq 0 ] ; then - echo "$DEST successfully created, copy to test system and unpack with:" - echo " tar xfz $DEST -P" -else - echo "Could not create file $DEST" -fi - - -Appendix B: gather_on_test.sh -============================= - -Sample script to gather coverage data files on the test machine -(see 6b): - -#!/bin/bash -e - -DEST=$1 -GCDA=/sys/kernel/debug/gcov - -if [ -z "$DEST" ] ; then - echo "Usage: $0 " >&2 - exit 1 -fi - -TEMPDIR=$(mktemp -d) -echo Collecting data.. -find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \; -find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \; -find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \; -tar czf $DEST -C $TEMPDIR sys -rm -rf $TEMPDIR - -echo "$DEST successfully created, copy to build system and unpack with:" -echo " tar xfz $DEST" diff --git a/MAINTAINERS b/MAINTAINERS index 1e5460cfc196..bb5377957d84 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5118,7 +5118,7 @@ GCOV BASED KERNEL PROFILING M: Peter Oberparleiter S: Maintained F: kernel/gcov/ -F: Documentation/gcov.txt +F: Documentation/dev-tools/gcov.rst GDT SCSI DISK ARRAY CONTROLLER DRIVER M: Achim Leubner From 2757aafad9ee7b8740042e5540b59422337344ab Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 7 Aug 2016 15:31:03 -0600 Subject: [PATCH 035/591] docs: sphinxify kasan.txt and move to dev-tools No textual changes beyond formatting. Acked-by: Andrey Ryabinin Acked-by: Alexander Potapenko Cc: Dmitry Vyukov Signed-off-by: Jonathan Corbet --- Documentation/dev-tools/kasan.rst | 173 ++++++++++++++++++++++++++++++ Documentation/dev-tools/tools.rst | 1 + Documentation/kasan.txt | 171 ----------------------------- MAINTAINERS | 2 +- 4 files changed, 175 insertions(+), 172 deletions(-) create mode 100644 Documentation/dev-tools/kasan.rst delete mode 100644 Documentation/kasan.txt diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst new file mode 100644 index 000000000000..948d243bed86 --- /dev/null +++ b/Documentation/dev-tools/kasan.rst @@ -0,0 +1,173 @@ +The Kernel Address Sanitizer (KASAN) +==================================== + +Overview +-------- + +KernelAddressSANitizer (KASAN) is a dynamic memory error detector. It provides +a fast and comprehensive solution for finding use-after-free and out-of-bounds +bugs. + +KASAN uses compile-time instrumentation for checking every memory access, +therefore you will need a GCC version 4.9.2 or later. GCC 5.0 or later is +required for detection of out-of-bounds accesses to stack or global variables. + +Currently KASAN is supported only for x86_64 architecture. + +Usage +----- + +To enable KASAN configure kernel with:: + + CONFIG_KASAN = y + +and choose between CONFIG_KASAN_OUTLINE and CONFIG_KASAN_INLINE. Outline and +inline are compiler instrumentation types. The former produces smaller binary +the latter is 1.1 - 2 times faster. Inline instrumentation requires a GCC +version 5.0 or later. + +KASAN works with both SLUB and SLAB memory allocators. +For better bug detection and nicer reporting, enable CONFIG_STACKTRACE. + +To disable instrumentation for specific files or directories, add a line +similar to the following to the respective kernel Makefile: + +- For a single file (e.g. main.o):: + + KASAN_SANITIZE_main.o := n + +- For all files in one directory:: + + KASAN_SANITIZE := n + +Error reports +~~~~~~~~~~~~~ + +A typical out of bounds access report looks like this:: + + ================================================================== + BUG: AddressSanitizer: out of bounds access in kmalloc_oob_right+0x65/0x75 [test_kasan] at addr ffff8800693bc5d3 + Write of size 1 by task modprobe/1689 + ============================================================================= + BUG kmalloc-128 (Not tainted): kasan error + ----------------------------------------------------------------------------- + + Disabling lock debugging due to kernel taint + INFO: Allocated in kmalloc_oob_right+0x3d/0x75 [test_kasan] age=0 cpu=0 pid=1689 + __slab_alloc+0x4b4/0x4f0 + kmem_cache_alloc_trace+0x10b/0x190 + kmalloc_oob_right+0x3d/0x75 [test_kasan] + init_module+0x9/0x47 [test_kasan] + do_one_initcall+0x99/0x200 + load_module+0x2cb3/0x3b20 + SyS_finit_module+0x76/0x80 + system_call_fastpath+0x12/0x17 + INFO: Slab 0xffffea0001a4ef00 objects=17 used=7 fp=0xffff8800693bd728 flags=0x100000000004080 + INFO: Object 0xffff8800693bc558 @offset=1368 fp=0xffff8800693bc720 + + Bytes b4 ffff8800693bc548: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ + Object ffff8800693bc558: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk + Object ffff8800693bc568: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk + Object ffff8800693bc578: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk + Object ffff8800693bc588: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk + Object ffff8800693bc598: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk + Object ffff8800693bc5a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk + Object ffff8800693bc5b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk + Object ffff8800693bc5c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkkkkkkkkkk. + Redzone ffff8800693bc5d8: cc cc cc cc cc cc cc cc ........ + Padding ffff8800693bc718: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ + CPU: 0 PID: 1689 Comm: modprobe Tainted: G B 3.18.0-rc1-mm1+ #98 + Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014 + ffff8800693bc000 0000000000000000 ffff8800693bc558 ffff88006923bb78 + ffffffff81cc68ae 00000000000000f3 ffff88006d407600 ffff88006923bba8 + ffffffff811fd848 ffff88006d407600 ffffea0001a4ef00 ffff8800693bc558 + Call Trace: + [] dump_stack+0x46/0x58 + [] print_trailer+0xf8/0x160 + [] ? kmem_cache_oob+0xc3/0xc3 [test_kasan] + [] object_err+0x35/0x40 + [] ? kmalloc_oob_right+0x65/0x75 [test_kasan] + [] kasan_report_error+0x38a/0x3f0 + [] ? kasan_poison_shadow+0x2f/0x40 + [] ? kasan_unpoison_shadow+0x14/0x40 + [] ? kasan_poison_shadow+0x2f/0x40 + [] ? kmem_cache_oob+0xc3/0xc3 [test_kasan] + [] __asan_store1+0x75/0xb0 + [] ? kmem_cache_oob+0x1d/0xc3 [test_kasan] + [] ? kmalloc_oob_right+0x65/0x75 [test_kasan] + [] kmalloc_oob_right+0x65/0x75 [test_kasan] + [] init_module+0x9/0x47 [test_kasan] + [] do_one_initcall+0x99/0x200 + [] ? __vunmap+0xec/0x160 + [] load_module+0x2cb3/0x3b20 + [] ? m_show+0x240/0x240 + [] SyS_finit_module+0x76/0x80 + [] system_call_fastpath+0x12/0x17 + Memory state around the buggy address: + ffff8800693bc300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc + ffff8800693bc380: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 fc + ffff8800693bc400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc + ffff8800693bc480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc + ffff8800693bc500: fc fc fc fc fc fc fc fc fc fc fc 00 00 00 00 00 + >ffff8800693bc580: 00 00 00 00 00 00 00 00 00 00 03 fc fc fc fc fc + ^ + ffff8800693bc600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc + ffff8800693bc680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc + ffff8800693bc700: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb + ffff8800693bc780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb + ffff8800693bc800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb + ================================================================== + +The header of the report discribe what kind of bug happened and what kind of +access caused it. It's followed by the description of the accessed slub object +(see 'SLUB Debug output' section in Documentation/vm/slub.txt for details) and +the description of the accessed memory page. + +In the last section the report shows memory state around the accessed address. +Reading this part requires some understanding of how KASAN works. + +The state of each 8 aligned bytes of memory is encoded in one shadow byte. +Those 8 bytes can be accessible, partially accessible, freed or be a redzone. +We use the following encoding for each shadow byte: 0 means that all 8 bytes +of the corresponding memory region are accessible; number N (1 <= N <= 7) means +that the first N bytes are accessible, and other (8 - N) bytes are not; +any negative value indicates that the entire 8-byte word is inaccessible. +We use different negative values to distinguish between different kinds of +inaccessible memory like redzones or freed memory (see mm/kasan/kasan.h). + +In the report above the arrows point to the shadow byte 03, which means that +the accessed address is partially accessible. + + +Implementation details +---------------------- + +From a high level, our approach to memory error detection is similar to that +of kmemcheck: use shadow memory to record whether each byte of memory is safe +to access, and use compile-time instrumentation to check shadow memory on each +memory access. + +AddressSanitizer dedicates 1/8 of kernel memory to its shadow memory +(e.g. 16TB to cover 128TB on x86_64) and uses direct mapping with a scale and +offset to translate a memory address to its corresponding shadow address. + +Here is the function which translates an address to its corresponding shadow +address:: + + static inline void *kasan_mem_to_shadow(const void *addr) + { + return ((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT) + + KASAN_SHADOW_OFFSET; + } + +where ``KASAN_SHADOW_SCALE_SHIFT = 3``. + +Compile-time instrumentation used for checking memory accesses. Compiler inserts +function calls (__asan_load*(addr), __asan_store*(addr)) before each memory +access of size 1, 2, 4, 8 or 16. These functions check whether memory access is +valid or not by checking corresponding shadow memory. + +GCC 5.0 has possibility to perform inline instrumentation. Instead of making +function calls GCC directly inserts the code to check the shadow memory. +This option significantly enlarges kernel but it gives x1.1-x2 performance +boost over outline instrumented kernel. diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index 404d044c8518..0500e6500255 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -18,3 +18,4 @@ whole; patches welcome! sparse kcov gcov + kasan diff --git a/Documentation/kasan.txt b/Documentation/kasan.txt deleted file mode 100644 index 7dd95b35cd7c..000000000000 --- a/Documentation/kasan.txt +++ /dev/null @@ -1,171 +0,0 @@ -KernelAddressSanitizer (KASAN) -============================== - -0. Overview -=========== - -KernelAddressSANitizer (KASAN) is a dynamic memory error detector. It provides -a fast and comprehensive solution for finding use-after-free and out-of-bounds -bugs. - -KASAN uses compile-time instrumentation for checking every memory access, -therefore you will need a GCC version 4.9.2 or later. GCC 5.0 or later is -required for detection of out-of-bounds accesses to stack or global variables. - -Currently KASAN is supported only for x86_64 architecture. - -1. Usage -======== - -To enable KASAN configure kernel with: - - CONFIG_KASAN = y - -and choose between CONFIG_KASAN_OUTLINE and CONFIG_KASAN_INLINE. Outline and -inline are compiler instrumentation types. The former produces smaller binary -the latter is 1.1 - 2 times faster. Inline instrumentation requires a GCC -version 5.0 or later. - -KASAN works with both SLUB and SLAB memory allocators. -For better bug detection and nicer reporting, enable CONFIG_STACKTRACE. - -To disable instrumentation for specific files or directories, add a line -similar to the following to the respective kernel Makefile: - - For a single file (e.g. main.o): - KASAN_SANITIZE_main.o := n - - For all files in one directory: - KASAN_SANITIZE := n - -1.1 Error reports -================= - -A typical out of bounds access report looks like this: - -================================================================== -BUG: AddressSanitizer: out of bounds access in kmalloc_oob_right+0x65/0x75 [test_kasan] at addr ffff8800693bc5d3 -Write of size 1 by task modprobe/1689 -============================================================================= -BUG kmalloc-128 (Not tainted): kasan error ------------------------------------------------------------------------------ - -Disabling lock debugging due to kernel taint -INFO: Allocated in kmalloc_oob_right+0x3d/0x75 [test_kasan] age=0 cpu=0 pid=1689 - __slab_alloc+0x4b4/0x4f0 - kmem_cache_alloc_trace+0x10b/0x190 - kmalloc_oob_right+0x3d/0x75 [test_kasan] - init_module+0x9/0x47 [test_kasan] - do_one_initcall+0x99/0x200 - load_module+0x2cb3/0x3b20 - SyS_finit_module+0x76/0x80 - system_call_fastpath+0x12/0x17 -INFO: Slab 0xffffea0001a4ef00 objects=17 used=7 fp=0xffff8800693bd728 flags=0x100000000004080 -INFO: Object 0xffff8800693bc558 @offset=1368 fp=0xffff8800693bc720 - -Bytes b4 ffff8800693bc548: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ -Object ffff8800693bc558: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk -Object ffff8800693bc568: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk -Object ffff8800693bc578: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk -Object ffff8800693bc588: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk -Object ffff8800693bc598: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk -Object ffff8800693bc5a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk -Object ffff8800693bc5b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk -Object ffff8800693bc5c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkkkkkkkkkk. -Redzone ffff8800693bc5d8: cc cc cc cc cc cc cc cc ........ -Padding ffff8800693bc718: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ -CPU: 0 PID: 1689 Comm: modprobe Tainted: G B 3.18.0-rc1-mm1+ #98 -Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014 - ffff8800693bc000 0000000000000000 ffff8800693bc558 ffff88006923bb78 - ffffffff81cc68ae 00000000000000f3 ffff88006d407600 ffff88006923bba8 - ffffffff811fd848 ffff88006d407600 ffffea0001a4ef00 ffff8800693bc558 -Call Trace: - [] dump_stack+0x46/0x58 - [] print_trailer+0xf8/0x160 - [] ? kmem_cache_oob+0xc3/0xc3 [test_kasan] - [] object_err+0x35/0x40 - [] ? kmalloc_oob_right+0x65/0x75 [test_kasan] - [] kasan_report_error+0x38a/0x3f0 - [] ? kasan_poison_shadow+0x2f/0x40 - [] ? kasan_unpoison_shadow+0x14/0x40 - [] ? kasan_poison_shadow+0x2f/0x40 - [] ? kmem_cache_oob+0xc3/0xc3 [test_kasan] - [] __asan_store1+0x75/0xb0 - [] ? kmem_cache_oob+0x1d/0xc3 [test_kasan] - [] ? kmalloc_oob_right+0x65/0x75 [test_kasan] - [] kmalloc_oob_right+0x65/0x75 [test_kasan] - [] init_module+0x9/0x47 [test_kasan] - [] do_one_initcall+0x99/0x200 - [] ? __vunmap+0xec/0x160 - [] load_module+0x2cb3/0x3b20 - [] ? m_show+0x240/0x240 - [] SyS_finit_module+0x76/0x80 - [] system_call_fastpath+0x12/0x17 -Memory state around the buggy address: - ffff8800693bc300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc - ffff8800693bc380: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 fc - ffff8800693bc400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc - ffff8800693bc480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc - ffff8800693bc500: fc fc fc fc fc fc fc fc fc fc fc 00 00 00 00 00 ->ffff8800693bc580: 00 00 00 00 00 00 00 00 00 00 03 fc fc fc fc fc - ^ - ffff8800693bc600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc - ffff8800693bc680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc - ffff8800693bc700: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb - ffff8800693bc780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb - ffff8800693bc800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb -================================================================== - -The header of the report discribe what kind of bug happened and what kind of -access caused it. It's followed by the description of the accessed slub object -(see 'SLUB Debug output' section in Documentation/vm/slub.txt for details) and -the description of the accessed memory page. - -In the last section the report shows memory state around the accessed address. -Reading this part requires some understanding of how KASAN works. - -The state of each 8 aligned bytes of memory is encoded in one shadow byte. -Those 8 bytes can be accessible, partially accessible, freed or be a redzone. -We use the following encoding for each shadow byte: 0 means that all 8 bytes -of the corresponding memory region are accessible; number N (1 <= N <= 7) means -that the first N bytes are accessible, and other (8 - N) bytes are not; -any negative value indicates that the entire 8-byte word is inaccessible. -We use different negative values to distinguish between different kinds of -inaccessible memory like redzones or freed memory (see mm/kasan/kasan.h). - -In the report above the arrows point to the shadow byte 03, which means that -the accessed address is partially accessible. - - -2. Implementation details -========================= - -From a high level, our approach to memory error detection is similar to that -of kmemcheck: use shadow memory to record whether each byte of memory is safe -to access, and use compile-time instrumentation to check shadow memory on each -memory access. - -AddressSanitizer dedicates 1/8 of kernel memory to its shadow memory -(e.g. 16TB to cover 128TB on x86_64) and uses direct mapping with a scale and -offset to translate a memory address to its corresponding shadow address. - -Here is the function which translates an address to its corresponding shadow -address: - -static inline void *kasan_mem_to_shadow(const void *addr) -{ - return ((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT) - + KASAN_SHADOW_OFFSET; -} - -where KASAN_SHADOW_SCALE_SHIFT = 3. - -Compile-time instrumentation used for checking memory accesses. Compiler inserts -function calls (__asan_load*(addr), __asan_store*(addr)) before each memory -access of size 1, 2, 4, 8 or 16. These functions check whether memory access is -valid or not by checking corresponding shadow memory. - -GCC 5.0 has possibility to perform inline instrumentation. Instead of making -function calls GCC directly inserts the code to check the shadow memory. -This option significantly enlarges kernel but it gives x1.1-x2 performance -boost over outline instrumented kernel. diff --git a/MAINTAINERS b/MAINTAINERS index bb5377957d84..2ffd7ed40162 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6587,7 +6587,7 @@ L: kasan-dev@googlegroups.com S: Maintained F: arch/*/include/asm/kasan.h F: arch/*/mm/kasan_init* -F: Documentation/kasan.txt +F: Documentation/dev-tools/kasan.rst F: include/linux/kasan*.h F: lib/test_kasan.c F: mm/kasan/ From 1ead009cd622bc4c3c2cf1036d8e71d7f063838e Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 7 Aug 2016 15:35:42 -0600 Subject: [PATCH 036/591] docs: sphinxify ubsan.txt and move it to dev-tools Acked-by: Andrey Ryabinin Signed-off-by: Jonathan Corbet --- Documentation/dev-tools/tools.rst | 1 + .../{ubsan.txt => dev-tools/ubsan.rst} | 42 ++++++++++--------- 2 files changed, 24 insertions(+), 19 deletions(-) rename Documentation/{ubsan.txt => dev-tools/ubsan.rst} (78%) diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index 0500e6500255..2d1129789753 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -19,3 +19,4 @@ whole; patches welcome! kcov gcov kasan + ubsan diff --git a/Documentation/ubsan.txt b/Documentation/dev-tools/ubsan.rst similarity index 78% rename from Documentation/ubsan.txt rename to Documentation/dev-tools/ubsan.rst index f58215ef5797..655e6b63c227 100644 --- a/Documentation/ubsan.txt +++ b/Documentation/dev-tools/ubsan.rst @@ -1,7 +1,5 @@ -Undefined Behavior Sanitizer - UBSAN - -Overview --------- +The Undefined Behavior Sanitizer - UBSAN +======================================== UBSAN is a runtime undefined behaviour checker. @@ -10,11 +8,13 @@ Compiler inserts code that perform certain kinds of checks before operations that may cause UB. If check fails (i.e. UB detected) __ubsan_handle_* function called to print error message. -GCC has that feature since 4.9.x [1] (see -fsanitize=undefined option and -its suboptions). GCC 5.x has more checkers implemented [2]. +GCC has that feature since 4.9.x [1_] (see ``-fsanitize=undefined`` option and +its suboptions). GCC 5.x has more checkers implemented [2_]. Report example ---------------- +-------------- + +:: ================================================================================ UBSAN: Undefined behaviour in ../include/linux/bitops.h:110:33 @@ -47,29 +47,33 @@ Report example Usage ----- -To enable UBSAN configure kernel with: +To enable UBSAN configure kernel with:: CONFIG_UBSAN=y -and to check the entire kernel: +and to check the entire kernel:: CONFIG_UBSAN_SANITIZE_ALL=y To enable instrumentation for specific files or directories, add a line similar to the following to the respective kernel Makefile: - For a single file (e.g. main.o): - UBSAN_SANITIZE_main.o := y +- For a single file (e.g. main.o):: - For all files in one directory: - UBSAN_SANITIZE := y + UBSAN_SANITIZE_main.o := y + +- For all files in one directory:: + + UBSAN_SANITIZE := y To exclude files from being instrumented even if -CONFIG_UBSAN_SANITIZE_ALL=y, use: +``CONFIG_UBSAN_SANITIZE_ALL=y``, use:: - UBSAN_SANITIZE_main.o := n - and: - UBSAN_SANITIZE := n + UBSAN_SANITIZE_main.o := n + +and:: + + UBSAN_SANITIZE := n Detection of unaligned accesses controlled through the separate option - CONFIG_UBSAN_ALIGNMENT. It's off by default on architectures that support @@ -80,5 +84,5 @@ reports. References ---------- -[1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html -[2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html +.. _1: https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html +.. _2: https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html From ca90a7a38741adf5ce450572952fbbda35055ea4 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 7 Aug 2016 15:46:10 -0600 Subject: [PATCH 037/591] docs: sphinxify kmemleak.txt and move it to dev-tools Acked-by: Catalin Marinas Signed-off-by: Jonathan Corbet --- .../{kmemleak.txt => dev-tools/kmemleak.rst} | 89 ++++++++++--------- Documentation/dev-tools/tools.rst | 1 + MAINTAINERS | 2 +- 3 files changed, 50 insertions(+), 42 deletions(-) rename Documentation/{kmemleak.txt => dev-tools/kmemleak.rst} (73%) diff --git a/Documentation/kmemleak.txt b/Documentation/dev-tools/kmemleak.rst similarity index 73% rename from Documentation/kmemleak.txt rename to Documentation/dev-tools/kmemleak.rst index 18e24abb3ecf..1788722d5495 100644 --- a/Documentation/kmemleak.txt +++ b/Documentation/dev-tools/kmemleak.rst @@ -1,15 +1,12 @@ Kernel Memory Leak Detector =========================== -Introduction ------------- - Kmemleak provides a way of detecting possible kernel memory leaks in a way similar to a tracing garbage collector (https://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29#Tracing_garbage_collectors), with the difference that the orphan objects are not freed but only reported via /sys/kernel/debug/kmemleak. A similar method is used by the -Valgrind tool (memcheck --leak-check) to detect the memory leaks in +Valgrind tool (``memcheck --leak-check``) to detect the memory leaks in user-space applications. Kmemleak is supported on x86, arm, powerpc, sparc, sh, microblaze, ppc, mips, s390, metag and tile. @@ -19,20 +16,20 @@ Usage CONFIG_DEBUG_KMEMLEAK in "Kernel hacking" has to be enabled. A kernel thread scans the memory every 10 minutes (by default) and prints the number of new unreferenced objects found. To display the details of all -the possible memory leaks: +the possible memory leaks:: # mount -t debugfs nodev /sys/kernel/debug/ # cat /sys/kernel/debug/kmemleak -To trigger an intermediate memory scan: +To trigger an intermediate memory scan:: # echo scan > /sys/kernel/debug/kmemleak -To clear the list of all current possible memory leaks: +To clear the list of all current possible memory leaks:: # echo clear > /sys/kernel/debug/kmemleak -New leaks will then come up upon reading /sys/kernel/debug/kmemleak +New leaks will then come up upon reading ``/sys/kernel/debug/kmemleak`` again. Note that the orphan objects are listed in the order they were allocated @@ -40,22 +37,31 @@ and one object at the beginning of the list may cause other subsequent objects to be reported as orphan. Memory scanning parameters can be modified at run-time by writing to the -/sys/kernel/debug/kmemleak file. The following parameters are supported: +``/sys/kernel/debug/kmemleak`` file. The following parameters are supported: - off - disable kmemleak (irreversible) - stack=on - enable the task stacks scanning (default) - stack=off - disable the tasks stacks scanning - scan=on - start the automatic memory scanning thread (default) - scan=off - stop the automatic memory scanning thread - scan= - set the automatic memory scanning period in seconds - (default 600, 0 to stop the automatic scanning) - scan - trigger a memory scan - clear - clear list of current memory leak suspects, done by - marking all current reported unreferenced objects grey, - or free all kmemleak objects if kmemleak has been disabled. - dump= - dump information about the object found at +- off + disable kmemleak (irreversible) +- stack=on + enable the task stacks scanning (default) +- stack=off + disable the tasks stacks scanning +- scan=on + start the automatic memory scanning thread (default) +- scan=off + stop the automatic memory scanning thread +- scan= + set the automatic memory scanning period in seconds + (default 600, 0 to stop the automatic scanning) +- scan + trigger a memory scan +- clear + clear list of current memory leak suspects, done by + marking all current reported unreferenced objects grey, + or free all kmemleak objects if kmemleak has been disabled. +- dump= + dump information about the object found at -Kmemleak can also be disabled at boot-time by passing "kmemleak=off" on +Kmemleak can also be disabled at boot-time by passing ``kmemleak=off`` on the kernel command line. Memory may be allocated or freed before kmemleak is initialised and @@ -63,13 +69,14 @@ these actions are stored in an early log buffer. The size of this buffer is configured via the CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE option. If CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF are enabled, the kmemleak is -disabled by default. Passing "kmemleak=on" on the kernel command +disabled by default. Passing ``kmemleak=on`` on the kernel command line enables the function. Basic Algorithm --------------- -The memory allocations via kmalloc, vmalloc, kmem_cache_alloc and +The memory allocations via :c:func:`kmalloc`, :c:func:`vmalloc`, +:c:func:`kmem_cache_alloc` and friends are traced and the pointers, together with additional information like size and stack trace, are stored in a rbtree. The corresponding freeing function calls are tracked and the pointers @@ -113,13 +120,13 @@ when doing development. To work around these situations you can use the you can find new unreferenced objects; this should help with testing specific sections of code. -To test a critical section on demand with a clean kmemleak do: +To test a critical section on demand with a clean kmemleak do:: # echo clear > /sys/kernel/debug/kmemleak ... test your kernel or modules ... # echo scan > /sys/kernel/debug/kmemleak -Then as usual to get your report with: +Then as usual to get your report with:: # cat /sys/kernel/debug/kmemleak @@ -131,7 +138,7 @@ disabled by the user or due to an fatal error, internal kmemleak objects won't be freed when kmemleak is disabled, and those objects may occupy a large part of physical memory. -In this situation, you may reclaim memory with: +In this situation, you may reclaim memory with:: # echo clear > /sys/kernel/debug/kmemleak @@ -140,20 +147,20 @@ Kmemleak API See the include/linux/kmemleak.h header for the functions prototype. -kmemleak_init - initialize kmemleak -kmemleak_alloc - notify of a memory block allocation -kmemleak_alloc_percpu - notify of a percpu memory block allocation -kmemleak_free - notify of a memory block freeing -kmemleak_free_part - notify of a partial memory block freeing -kmemleak_free_percpu - notify of a percpu memory block freeing -kmemleak_update_trace - update object allocation stack trace -kmemleak_not_leak - mark an object as not a leak -kmemleak_ignore - do not scan or report an object as leak -kmemleak_scan_area - add scan areas inside a memory block -kmemleak_no_scan - do not scan a memory block -kmemleak_erase - erase an old value in a pointer variable -kmemleak_alloc_recursive - as kmemleak_alloc but checks the recursiveness -kmemleak_free_recursive - as kmemleak_free but checks the recursiveness +- ``kmemleak_init`` - initialize kmemleak +- ``kmemleak_alloc`` - notify of a memory block allocation +- ``kmemleak_alloc_percpu`` - notify of a percpu memory block allocation +- ``kmemleak_free`` - notify of a memory block freeing +- ``kmemleak_free_part`` - notify of a partial memory block freeing +- ``kmemleak_free_percpu`` - notify of a percpu memory block freeing +- ``kmemleak_update_trace`` - update object allocation stack trace +- ``kmemleak_not_leak`` - mark an object as not a leak +- ``kmemleak_ignore`` - do not scan or report an object as leak +- ``kmemleak_scan_area`` - add scan areas inside a memory block +- ``kmemleak_no_scan`` - do not scan a memory block +- ``kmemleak_erase`` - erase an old value in a pointer variable +- ``kmemleak_alloc_recursive`` - as kmemleak_alloc but checks the recursiveness +- ``kmemleak_free_recursive`` - as kmemleak_free but checks the recursiveness Dealing with false positives/negatives -------------------------------------- diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index 2d1129789753..3b6382a58301 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -20,3 +20,4 @@ whole; patches welcome! gcov kasan ubsan + kmemleak diff --git a/MAINTAINERS b/MAINTAINERS index 2ffd7ed40162..b235e0d53449 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6812,7 +6812,7 @@ F: mm/kmemcheck.c KMEMLEAK M: Catalin Marinas S: Maintained -F: Documentation/kmemleak.txt +F: Documentation/dev-tools/kmemleak.rst F: include/linux/kmemleak.h F: mm/kmemleak.c F: mm/kmemleak-test.c From 9c296b46c67ed323538bca80a8be1f0b10e570a0 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 7 Aug 2016 16:12:28 -0600 Subject: [PATCH 038/591] docs: sphinxify kmemcheck.txt and move to dev-tools Cc: Vegard Nossum Cc: Pekka Enberg Signed-off-by: Jonathan Corbet --- Documentation/dev-tools/kmemcheck.rst | 733 +++++++++++++++++++++++++ Documentation/dev-tools/tools.rst | 1 + Documentation/kmemcheck.txt | 754 -------------------------- MAINTAINERS | 2 +- 4 files changed, 735 insertions(+), 755 deletions(-) create mode 100644 Documentation/dev-tools/kmemcheck.rst delete mode 100644 Documentation/kmemcheck.txt diff --git a/Documentation/dev-tools/kmemcheck.rst b/Documentation/dev-tools/kmemcheck.rst new file mode 100644 index 000000000000..7f3d1985de74 --- /dev/null +++ b/Documentation/dev-tools/kmemcheck.rst @@ -0,0 +1,733 @@ +Getting started with kmemcheck +============================== + +Vegard Nossum + + +Introduction +------------ + +kmemcheck is a debugging feature for the Linux Kernel. More specifically, it +is a dynamic checker that detects and warns about some uses of uninitialized +memory. + +Userspace programmers might be familiar with Valgrind's memcheck. The main +difference between memcheck and kmemcheck is that memcheck works for userspace +programs only, and kmemcheck works for the kernel only. The implementations +are of course vastly different. Because of this, kmemcheck is not as accurate +as memcheck, but it turns out to be good enough in practice to discover real +programmer errors that the compiler is not able to find through static +analysis. + +Enabling kmemcheck on a kernel will probably slow it down to the extent that +the machine will not be usable for normal workloads such as e.g. an +interactive desktop. kmemcheck will also cause the kernel to use about twice +as much memory as normal. For this reason, kmemcheck is strictly a debugging +feature. + + +Downloading +----------- + +As of version 2.6.31-rc1, kmemcheck is included in the mainline kernel. + + +Configuring and compiling +------------------------- + +kmemcheck only works for the x86 (both 32- and 64-bit) platform. A number of +configuration variables must have specific settings in order for the kmemcheck +menu to even appear in "menuconfig". These are: + +- ``CONFIG_CC_OPTIMIZE_FOR_SIZE=n`` + This option is located under "General setup" / "Optimize for size". + + Without this, gcc will use certain optimizations that usually lead to + false positive warnings from kmemcheck. An example of this is a 16-bit + field in a struct, where gcc may load 32 bits, then discard the upper + 16 bits. kmemcheck sees only the 32-bit load, and may trigger a + warning for the upper 16 bits (if they're uninitialized). + +- ``CONFIG_SLAB=y`` or ``CONFIG_SLUB=y`` + This option is located under "General setup" / "Choose SLAB + allocator". + +- ``CONFIG_FUNCTION_TRACER=n`` + This option is located under "Kernel hacking" / "Tracers" / "Kernel + Function Tracer" + + When function tracing is compiled in, gcc emits a call to another + function at the beginning of every function. This means that when the + page fault handler is called, the ftrace framework will be called + before kmemcheck has had a chance to handle the fault. If ftrace then + modifies memory that was tracked by kmemcheck, the result is an + endless recursive page fault. + +- ``CONFIG_DEBUG_PAGEALLOC=n`` + This option is located under "Kernel hacking" / "Memory Debugging" + / "Debug page memory allocations". + +In addition, I highly recommend turning on ``CONFIG_DEBUG_INFO=y``. This is also +located under "Kernel hacking". With this, you will be able to get line number +information from the kmemcheck warnings, which is extremely valuable in +debugging a problem. This option is not mandatory, however, because it slows +down the compilation process and produces a much bigger kernel image. + +Now the kmemcheck menu should be visible (under "Kernel hacking" / "Memory +Debugging" / "kmemcheck: trap use of uninitialized memory"). Here follows +a description of the kmemcheck configuration variables: + +- ``CONFIG_KMEMCHECK`` + This must be enabled in order to use kmemcheck at all... + +- ``CONFIG_KMEMCHECK_``[``DISABLED`` | ``ENABLED`` | ``ONESHOT``]``_BY_DEFAULT`` + This option controls the status of kmemcheck at boot-time. "Enabled" + will enable kmemcheck right from the start, "disabled" will boot the + kernel as normal (but with the kmemcheck code compiled in, so it can + be enabled at run-time after the kernel has booted), and "one-shot" is + a special mode which will turn kmemcheck off automatically after + detecting the first use of uninitialized memory. + + If you are using kmemcheck to actively debug a problem, then you + probably want to choose "enabled" here. + + The one-shot mode is mostly useful in automated test setups because it + can prevent floods of warnings and increase the chances of the machine + surviving in case something is really wrong. In other cases, the one- + shot mode could actually be counter-productive because it would turn + itself off at the very first error -- in the case of a false positive + too -- and this would come in the way of debugging the specific + problem you were interested in. + + If you would like to use your kernel as normal, but with a chance to + enable kmemcheck in case of some problem, it might be a good idea to + choose "disabled" here. When kmemcheck is disabled, most of the run- + time overhead is not incurred, and the kernel will be almost as fast + as normal. + +- ``CONFIG_KMEMCHECK_QUEUE_SIZE`` + Select the maximum number of error reports to store in an internal + (fixed-size) buffer. Since errors can occur virtually anywhere and in + any context, we need a temporary storage area which is guaranteed not + to generate any other page faults when accessed. The queue will be + emptied as soon as a tasklet may be scheduled. If the queue is full, + new error reports will be lost. + + The default value of 64 is probably fine. If some code produces more + than 64 errors within an irqs-off section, then the code is likely to + produce many, many more, too, and these additional reports seldom give + any more information (the first report is usually the most valuable + anyway). + + This number might have to be adjusted if you are not using serial + console or similar to capture the kernel log. If you are using the + "dmesg" command to save the log, then getting a lot of kmemcheck + warnings might overflow the kernel log itself, and the earlier reports + will get lost in that way instead. Try setting this to 10 or so on + such a setup. + +- ``CONFIG_KMEMCHECK_SHADOW_COPY_SHIFT`` + Select the number of shadow bytes to save along with each entry of the + error-report queue. These bytes indicate what parts of an allocation + are initialized, uninitialized, etc. and will be displayed when an + error is detected to help the debugging of a particular problem. + + The number entered here is actually the logarithm of the number of + bytes that will be saved. So if you pick for example 5 here, kmemcheck + will save 2^5 = 32 bytes. + + The default value should be fine for debugging most problems. It also + fits nicely within 80 columns. + +- ``CONFIG_KMEMCHECK_PARTIAL_OK`` + This option (when enabled) works around certain GCC optimizations that + produce 32-bit reads from 16-bit variables where the upper 16 bits are + thrown away afterwards. + + The default value (enabled) is recommended. This may of course hide + some real errors, but disabling it would probably produce a lot of + false positives. + +- ``CONFIG_KMEMCHECK_BITOPS_OK`` + This option silences warnings that would be generated for bit-field + accesses where not all the bits are initialized at the same time. This + may also hide some real bugs. + + This option is probably obsolete, or it should be replaced with + the kmemcheck-/bitfield-annotations for the code in question. The + default value is therefore fine. + +Now compile the kernel as usual. + + +How to use +---------- + +Booting +~~~~~~~ + +First some information about the command-line options. There is only one +option specific to kmemcheck, and this is called "kmemcheck". It can be used +to override the default mode as chosen by the ``CONFIG_KMEMCHECK_*_BY_DEFAULT`` +option. Its possible settings are: + +- ``kmemcheck=0`` (disabled) +- ``kmemcheck=1`` (enabled) +- ``kmemcheck=2`` (one-shot mode) + +If SLUB debugging has been enabled in the kernel, it may take precedence over +kmemcheck in such a way that the slab caches which are under SLUB debugging +will not be tracked by kmemcheck. In order to ensure that this doesn't happen +(even though it shouldn't by default), use SLUB's boot option ``slub_debug``, +like this: ``slub_debug=-`` + +In fact, this option may also be used for fine-grained control over SLUB vs. +kmemcheck. For example, if the command line includes +``kmemcheck=1 slub_debug=,dentry``, then SLUB debugging will be used only +for the "dentry" slab cache, and with kmemcheck tracking all the other +caches. This is advanced usage, however, and is not generally recommended. + + +Run-time enable/disable +~~~~~~~~~~~~~~~~~~~~~~~ + +When the kernel has booted, it is possible to enable or disable kmemcheck at +run-time. WARNING: This feature is still experimental and may cause false +positive warnings to appear. Therefore, try not to use this. If you find that +it doesn't work properly (e.g. you see an unreasonable amount of warnings), I +will be happy to take bug reports. + +Use the file ``/proc/sys/kernel/kmemcheck`` for this purpose, e.g.:: + + $ echo 0 > /proc/sys/kernel/kmemcheck # disables kmemcheck + +The numbers are the same as for the ``kmemcheck=`` command-line option. + + +Debugging +~~~~~~~~~ + +A typical report will look something like this:: + + WARNING: kmemcheck: Caught 32-bit read from uninitialized memory (ffff88003e4a2024) + 80000000000000000000000000000000000000000088ffff0000000000000000 + i i i i u u u u i i i i i i i i u u u u u u u u u u u u u u u u + ^ + + Pid: 1856, comm: ntpdate Not tainted 2.6.29-rc5 #264 945P-A + RIP: 0010:[] [] __dequeue_signal+0xc8/0x190 + RSP: 0018:ffff88003cdf7d98 EFLAGS: 00210002 + RAX: 0000000000000030 RBX: ffff88003d4ea968 RCX: 0000000000000009 + RDX: ffff88003e5d6018 RSI: ffff88003e5d6024 RDI: ffff88003cdf7e84 + RBP: ffff88003cdf7db8 R08: ffff88003e5d6000 R09: 0000000000000000 + R10: 0000000000000080 R11: 0000000000000000 R12: 000000000000000e + R13: ffff88003cdf7e78 R14: ffff88003d530710 R15: ffff88003d5a98c8 + FS: 0000000000000000(0000) GS:ffff880001982000(0063) knlGS:00000 + CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 + CR2: ffff88003f806ea0 CR3: 000000003c036000 CR4: 00000000000006a0 + DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 + DR3: 0000000000000000 DR6: 00000000ffff4ff0 DR7: 0000000000000400 + [] dequeue_signal+0x8e/0x170 + [] get_signal_to_deliver+0x98/0x390 + [] do_notify_resume+0xad/0x7d0 + [] int_signal+0x12/0x17 + [] 0xffffffffffffffff + +The single most valuable information in this report is the RIP (or EIP on 32- +bit) value. This will help us pinpoint exactly which instruction that caused +the warning. + +If your kernel was compiled with ``CONFIG_DEBUG_INFO=y``, then all we have to do +is give this address to the addr2line program, like this:: + + $ addr2line -e vmlinux -i ffffffff8104ede8 + arch/x86/include/asm/string_64.h:12 + include/asm-generic/siginfo.h:287 + kernel/signal.c:380 + kernel/signal.c:410 + +The "``-e vmlinux``" tells addr2line which file to look in. **IMPORTANT:** +This must be the vmlinux of the kernel that produced the warning in the +first place! If not, the line number information will almost certainly be +wrong. + +The "``-i``" tells addr2line to also print the line numbers of inlined +functions. In this case, the flag was very important, because otherwise, +it would only have printed the first line, which is just a call to +``memcpy()``, which could be called from a thousand places in the kernel, and +is therefore not very useful. These inlined functions would not show up in +the stack trace above, simply because the kernel doesn't load the extra +debugging information. This technique can of course be used with ordinary +kernel oopses as well. + +In this case, it's the caller of ``memcpy()`` that is interesting, and it can be +found in ``include/asm-generic/siginfo.h``, line 287:: + + 281 static inline void copy_siginfo(struct siginfo *to, struct siginfo *from) + 282 { + 283 if (from->si_code < 0) + 284 memcpy(to, from, sizeof(*to)); + 285 else + 286 /* _sigchld is currently the largest know union member */ + 287 memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld)); + 288 } + +Since this was a read (kmemcheck usually warns about reads only, though it can +warn about writes to unallocated or freed memory as well), it was probably the +"from" argument which contained some uninitialized bytes. Following the chain +of calls, we move upwards to see where "from" was allocated or initialized, +``kernel/signal.c``, line 380:: + + 359 static void collect_signal(int sig, struct sigpending *list, siginfo_t *info) + 360 { + ... + 367 list_for_each_entry(q, &list->list, list) { + 368 if (q->info.si_signo == sig) { + 369 if (first) + 370 goto still_pending; + 371 first = q; + ... + 377 if (first) { + 378 still_pending: + 379 list_del_init(&first->list); + 380 copy_siginfo(info, &first->info); + 381 __sigqueue_free(first); + ... + 392 } + 393 } + +Here, it is ``&first->info`` that is being passed on to ``copy_siginfo()``. The +variable ``first`` was found on a list -- passed in as the second argument to +``collect_signal()``. We continue our journey through the stack, to figure out +where the item on "list" was allocated or initialized. We move to line 410:: + + 395 static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, + 396 siginfo_t *info) + 397 { + ... + 410 collect_signal(sig, pending, info); + ... + 414 } + +Now we need to follow the ``pending`` pointer, since that is being passed on to +``collect_signal()`` as ``list``. At this point, we've run out of lines from the +"addr2line" output. Not to worry, we just paste the next addresses from the +kmemcheck stack dump, i.e.:: + + [] dequeue_signal+0x8e/0x170 + [] get_signal_to_deliver+0x98/0x390 + [] do_notify_resume+0xad/0x7d0 + [] int_signal+0x12/0x17 + + $ addr2line -e vmlinux -i ffffffff8104f04e ffffffff81050bd8 \ + ffffffff8100b87d ffffffff8100c7b5 + kernel/signal.c:446 + kernel/signal.c:1806 + arch/x86/kernel/signal.c:805 + arch/x86/kernel/signal.c:871 + arch/x86/kernel/entry_64.S:694 + +Remember that since these addresses were found on the stack and not as the +RIP value, they actually point to the _next_ instruction (they are return +addresses). This becomes obvious when we look at the code for line 446:: + + 422 int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) + 423 { + ... + 431 signr = __dequeue_signal(&tsk->signal->shared_pending, + 432 mask, info); + 433 /* + 434 * itimer signal ? + 435 * + 436 * itimers are process shared and we restart periodic + 437 * itimers in the signal delivery path to prevent DoS + 438 * attacks in the high resolution timer case. This is + 439 * compliant with the old way of self restarting + 440 * itimers, as the SIGALRM is a legacy signal and only + 441 * queued once. Changing the restart behaviour to + 442 * restart the timer in the signal dequeue path is + 443 * reducing the timer noise on heavy loaded !highres + 444 * systems too. + 445 */ + 446 if (unlikely(signr == SIGALRM)) { + ... + 489 } + +So instead of looking at 446, we should be looking at 431, which is the line +that executes just before 446. Here we see that what we are looking for is +``&tsk->signal->shared_pending``. + +Our next task is now to figure out which function that puts items on this +``shared_pending`` list. A crude, but efficient tool, is ``git grep``:: + + $ git grep -n 'shared_pending' kernel/ + ... + kernel/signal.c:828: pending = group ? &t->signal->shared_pending : &t->pending; + kernel/signal.c:1339: pending = group ? &t->signal->shared_pending : &t->pending; + ... + +There were more results, but none of them were related to list operations, +and these were the only assignments. We inspect the line numbers more closely +and find that this is indeed where items are being added to the list:: + + 816 static int send_signal(int sig, struct siginfo *info, struct task_struct *t, + 817 int group) + 818 { + ... + 828 pending = group ? &t->signal->shared_pending : &t->pending; + ... + 851 q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN && + 852 (is_si_special(info) || + 853 info->si_code >= 0))); + 854 if (q) { + 855 list_add_tail(&q->list, &pending->list); + ... + 890 } + +and:: + + 1309 int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group) + 1310 { + .... + 1339 pending = group ? &t->signal->shared_pending : &t->pending; + 1340 list_add_tail(&q->list, &pending->list); + .... + 1347 } + +In the first case, the list element we are looking for, ``q``, is being +returned from the function ``__sigqueue_alloc()``, which looks like an +allocation function. Let's take a look at it:: + + 187 static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags, + 188 int override_rlimit) + 189 { + 190 struct sigqueue *q = NULL; + 191 struct user_struct *user; + 192 + 193 /* + 194 * We won't get problems with the target's UID changing under us + 195 * because changing it requires RCU be used, and if t != current, the + 196 * caller must be holding the RCU readlock (by way of a spinlock) and + 197 * we use RCU protection here + 198 */ + 199 user = get_uid(__task_cred(t)->user); + 200 atomic_inc(&user->sigpending); + 201 if (override_rlimit || + 202 atomic_read(&user->sigpending) <= + 203 t->signal->rlim[RLIMIT_SIGPENDING].rlim_cur) + 204 q = kmem_cache_alloc(sigqueue_cachep, flags); + 205 if (unlikely(q == NULL)) { + 206 atomic_dec(&user->sigpending); + 207 free_uid(user); + 208 } else { + 209 INIT_LIST_HEAD(&q->list); + 210 q->flags = 0; + 211 q->user = user; + 212 } + 213 + 214 return q; + 215 } + +We see that this function initializes ``q->list``, ``q->flags``, and +``q->user``. It seems that now is the time to look at the definition of +``struct sigqueue``, e.g.:: + + 14 struct sigqueue { + 15 struct list_head list; + 16 int flags; + 17 siginfo_t info; + 18 struct user_struct *user; + 19 }; + +And, you might remember, it was a ``memcpy()`` on ``&first->info`` that +caused the warning, so this makes perfect sense. It also seems reasonable +to assume that it is the caller of ``__sigqueue_alloc()`` that has the +responsibility of filling out (initializing) this member. + +But just which fields of the struct were uninitialized? Let's look at +kmemcheck's report again:: + + WARNING: kmemcheck: Caught 32-bit read from uninitialized memory (ffff88003e4a2024) + 80000000000000000000000000000000000000000088ffff0000000000000000 + i i i i u u u u i i i i i i i i u u u u u u u u u u u u u u u u + ^ + +These first two lines are the memory dump of the memory object itself, and +the shadow bytemap, respectively. The memory object itself is in this case +``&first->info``. Just beware that the start of this dump is NOT the start +of the object itself! The position of the caret (^) corresponds with the +address of the read (ffff88003e4a2024). + +The shadow bytemap dump legend is as follows: + +- i: initialized +- u: uninitialized +- a: unallocated (memory has been allocated by the slab layer, but has not + yet been handed off to anybody) +- f: freed (memory has been allocated by the slab layer, but has been freed + by the previous owner) + +In order to figure out where (relative to the start of the object) the +uninitialized memory was located, we have to look at the disassembly. For +that, we'll need the RIP address again:: + + RIP: 0010:[] [] __dequeue_signal+0xc8/0x190 + + $ objdump -d --no-show-raw-insn vmlinux | grep -C 8 ffffffff8104ede8: + ffffffff8104edc8: mov %r8,0x8(%r8) + ffffffff8104edcc: test %r10d,%r10d + ffffffff8104edcf: js ffffffff8104ee88 <__dequeue_signal+0x168> + ffffffff8104edd5: mov %rax,%rdx + ffffffff8104edd8: mov $0xc,%ecx + ffffffff8104eddd: mov %r13,%rdi + ffffffff8104ede0: mov $0x30,%eax + ffffffff8104ede5: mov %rdx,%rsi + ffffffff8104ede8: rep movsl %ds:(%rsi),%es:(%rdi) + ffffffff8104edea: test $0x2,%al + ffffffff8104edec: je ffffffff8104edf0 <__dequeue_signal+0xd0> + ffffffff8104edee: movsw %ds:(%rsi),%es:(%rdi) + ffffffff8104edf0: test $0x1,%al + ffffffff8104edf2: je ffffffff8104edf5 <__dequeue_signal+0xd5> + ffffffff8104edf4: movsb %ds:(%rsi),%es:(%rdi) + ffffffff8104edf5: mov %r8,%rdi + ffffffff8104edf8: callq ffffffff8104de60 <__sigqueue_free> + +As expected, it's the "``rep movsl``" instruction from the ``memcpy()`` +that causes the warning. We know about ``REP MOVSL`` that it uses the register +``RCX`` to count the number of remaining iterations. By taking a look at the +register dump again (from the kmemcheck report), we can figure out how many +bytes were left to copy:: + + RAX: 0000000000000030 RBX: ffff88003d4ea968 RCX: 0000000000000009 + +By looking at the disassembly, we also see that ``%ecx`` is being loaded +with the value ``$0xc`` just before (ffffffff8104edd8), so we are very +lucky. Keep in mind that this is the number of iterations, not bytes. And +since this is a "long" operation, we need to multiply by 4 to get the +number of bytes. So this means that the uninitialized value was encountered +at 4 * (0xc - 0x9) = 12 bytes from the start of the object. + +We can now try to figure out which field of the "``struct siginfo``" that +was not initialized. This is the beginning of the struct:: + + 40 typedef struct siginfo { + 41 int si_signo; + 42 int si_errno; + 43 int si_code; + 44 + 45 union { + .. + 92 } _sifields; + 93 } siginfo_t; + +On 64-bit, the int is 4 bytes long, so it must the union member that has +not been initialized. We can verify this using gdb:: + + $ gdb vmlinux + ... + (gdb) p &((struct siginfo *) 0)->_sifields + $1 = (union {...} *) 0x10 + +Actually, it seems that the union member is located at offset 0x10 -- which +means that gcc has inserted 4 bytes of padding between the members ``si_code`` +and ``_sifields``. We can now get a fuller picture of the memory dump:: + + _----------------------------=> si_code + / _--------------------=> (padding) + | / _------------=> _sifields(._kill._pid) + | | / _----=> _sifields(._kill._uid) + | | | / + -------|-------|-------|-------| + 80000000000000000000000000000000000000000088ffff0000000000000000 + i i i i u u u u i i i i i i i i u u u u u u u u u u u u u u u u + +This allows us to realize another important fact: ``si_code`` contains the +value 0x80. Remember that x86 is little endian, so the first 4 bytes +"80000000" are really the number 0x00000080. With a bit of research, we +find that this is actually the constant ``SI_KERNEL`` defined in +``include/asm-generic/siginfo.h``:: + + 144 #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ + +This macro is used in exactly one place in the x86 kernel: In ``send_signal()`` +in ``kernel/signal.c``:: + + 816 static int send_signal(int sig, struct siginfo *info, struct task_struct *t, + 817 int group) + 818 { + ... + 828 pending = group ? &t->signal->shared_pending : &t->pending; + ... + 851 q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN && + 852 (is_si_special(info) || + 853 info->si_code >= 0))); + 854 if (q) { + 855 list_add_tail(&q->list, &pending->list); + 856 switch ((unsigned long) info) { + ... + 865 case (unsigned long) SEND_SIG_PRIV: + 866 q->info.si_signo = sig; + 867 q->info.si_errno = 0; + 868 q->info.si_code = SI_KERNEL; + 869 q->info.si_pid = 0; + 870 q->info.si_uid = 0; + 871 break; + ... + 890 } + +Not only does this match with the ``.si_code`` member, it also matches the place +we found earlier when looking for where siginfo_t objects are enqueued on the +``shared_pending`` list. + +So to sum up: It seems that it is the padding introduced by the compiler +between two struct fields that is uninitialized, and this gets reported when +we do a ``memcpy()`` on the struct. This means that we have identified a false +positive warning. + +Normally, kmemcheck will not report uninitialized accesses in ``memcpy()`` calls +when both the source and destination addresses are tracked. (Instead, we copy +the shadow bytemap as well). In this case, the destination address clearly +was not tracked. We can dig a little deeper into the stack trace from above:: + + arch/x86/kernel/signal.c:805 + arch/x86/kernel/signal.c:871 + arch/x86/kernel/entry_64.S:694 + +And we clearly see that the destination siginfo object is located on the +stack:: + + 782 static void do_signal(struct pt_regs *regs) + 783 { + 784 struct k_sigaction ka; + 785 siginfo_t info; + ... + 804 signr = get_signal_to_deliver(&info, &ka, regs, NULL); + ... + 854 } + +And this ``&info`` is what eventually gets passed to ``copy_siginfo()`` as the +destination argument. + +Now, even though we didn't find an actual error here, the example is still a +good one, because it shows how one would go about to find out what the report +was all about. + + +Annotating false positives +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a few different ways to make annotations in the source code that +will keep kmemcheck from checking and reporting certain allocations. Here +they are: + +- ``__GFP_NOTRACK_FALSE_POSITIVE`` + This flag can be passed to ``kmalloc()`` or ``kmem_cache_alloc()`` + (therefore also to other functions that end up calling one of + these) to indicate that the allocation should not be tracked + because it would lead to a false positive report. This is a "big + hammer" way of silencing kmemcheck; after all, even if the false + positive pertains to particular field in a struct, for example, we + will now lose the ability to find (real) errors in other parts of + the same struct. + + Example:: + + /* No warnings will ever trigger on accessing any part of x */ + x = kmalloc(sizeof *x, GFP_KERNEL | __GFP_NOTRACK_FALSE_POSITIVE); + +- ``kmemcheck_bitfield_begin(name)``/``kmemcheck_bitfield_end(name)`` and + ``kmemcheck_annotate_bitfield(ptr, name)`` + The first two of these three macros can be used inside struct + definitions to signal, respectively, the beginning and end of a + bitfield. Additionally, this will assign the bitfield a name, which + is given as an argument to the macros. + + Having used these markers, one can later use + kmemcheck_annotate_bitfield() at the point of allocation, to indicate + which parts of the allocation is part of a bitfield. + + Example:: + + struct foo { + int x; + + kmemcheck_bitfield_begin(flags); + int flag_a:1; + int flag_b:1; + kmemcheck_bitfield_end(flags); + + int y; + }; + + struct foo *x = kmalloc(sizeof *x); + + /* No warnings will trigger on accessing the bitfield of x */ + kmemcheck_annotate_bitfield(x, flags); + + Note that ``kmemcheck_annotate_bitfield()`` can be used even before the + return value of ``kmalloc()`` is checked -- in other words, passing NULL + as the first argument is legal (and will do nothing). + + +Reporting errors +---------------- + +As we have seen, kmemcheck will produce false positive reports. Therefore, it +is not very wise to blindly post kmemcheck warnings to mailing lists and +maintainers. Instead, I encourage maintainers and developers to find errors +in their own code. If you get a warning, you can try to work around it, try +to figure out if it's a real error or not, or simply ignore it. Most +developers know their own code and will quickly and efficiently determine the +root cause of a kmemcheck report. This is therefore also the most efficient +way to work with kmemcheck. + +That said, we (the kmemcheck maintainers) will always be on the lookout for +false positives that we can annotate and silence. So whatever you find, +please drop us a note privately! Kernel configs and steps to reproduce (if +available) are of course a great help too. + +Happy hacking! + + +Technical description +--------------------- + +kmemcheck works by marking memory pages non-present. This means that whenever +somebody attempts to access the page, a page fault is generated. The page +fault handler notices that the page was in fact only hidden, and so it calls +on the kmemcheck code to make further investigations. + +When the investigations are completed, kmemcheck "shows" the page by marking +it present (as it would be under normal circumstances). This way, the +interrupted code can continue as usual. + +But after the instruction has been executed, we should hide the page again, so +that we can catch the next access too! Now kmemcheck makes use of a debugging +feature of the processor, namely single-stepping. When the processor has +finished the one instruction that generated the memory access, a debug +exception is raised. From here, we simply hide the page again and continue +execution, this time with the single-stepping feature turned off. + +kmemcheck requires some assistance from the memory allocator in order to work. +The memory allocator needs to + + 1. Tell kmemcheck about newly allocated pages and pages that are about to + be freed. This allows kmemcheck to set up and tear down the shadow memory + for the pages in question. The shadow memory stores the status of each + byte in the allocation proper, e.g. whether it is initialized or + uninitialized. + + 2. Tell kmemcheck which parts of memory should be marked uninitialized. + There are actually a few more states, such as "not yet allocated" and + "recently freed". + +If a slab cache is set up using the SLAB_NOTRACK flag, it will never return +memory that can take page faults because of kmemcheck. + +If a slab cache is NOT set up using the SLAB_NOTRACK flag, callers can still +request memory with the __GFP_NOTRACK or __GFP_NOTRACK_FALSE_POSITIVE flags. +This does not prevent the page faults from occurring, however, but marks the +object in question as being initialized so that no warnings will ever be +produced for this object. + +Currently, the SLAB and SLUB allocators are supported by kmemcheck. diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index 3b6382a58301..43f7deeccae4 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -21,3 +21,4 @@ whole; patches welcome! kasan ubsan kmemleak + kmemcheck diff --git a/Documentation/kmemcheck.txt b/Documentation/kmemcheck.txt deleted file mode 100644 index 80aae85d8da6..000000000000 --- a/Documentation/kmemcheck.txt +++ /dev/null @@ -1,754 +0,0 @@ -GETTING STARTED WITH KMEMCHECK -============================== - -Vegard Nossum - - -Contents -======== -0. Introduction -1. Downloading -2. Configuring and compiling -3. How to use -3.1. Booting -3.2. Run-time enable/disable -3.3. Debugging -3.4. Annotating false positives -4. Reporting errors -5. Technical description - - -0. Introduction -=============== - -kmemcheck is a debugging feature for the Linux Kernel. More specifically, it -is a dynamic checker that detects and warns about some uses of uninitialized -memory. - -Userspace programmers might be familiar with Valgrind's memcheck. The main -difference between memcheck and kmemcheck is that memcheck works for userspace -programs only, and kmemcheck works for the kernel only. The implementations -are of course vastly different. Because of this, kmemcheck is not as accurate -as memcheck, but it turns out to be good enough in practice to discover real -programmer errors that the compiler is not able to find through static -analysis. - -Enabling kmemcheck on a kernel will probably slow it down to the extent that -the machine will not be usable for normal workloads such as e.g. an -interactive desktop. kmemcheck will also cause the kernel to use about twice -as much memory as normal. For this reason, kmemcheck is strictly a debugging -feature. - - -1. Downloading -============== - -As of version 2.6.31-rc1, kmemcheck is included in the mainline kernel. - - -2. Configuring and compiling -============================ - -kmemcheck only works for the x86 (both 32- and 64-bit) platform. A number of -configuration variables must have specific settings in order for the kmemcheck -menu to even appear in "menuconfig". These are: - - o CONFIG_CC_OPTIMIZE_FOR_SIZE=n - - This option is located under "General setup" / "Optimize for size". - - Without this, gcc will use certain optimizations that usually lead to - false positive warnings from kmemcheck. An example of this is a 16-bit - field in a struct, where gcc may load 32 bits, then discard the upper - 16 bits. kmemcheck sees only the 32-bit load, and may trigger a - warning for the upper 16 bits (if they're uninitialized). - - o CONFIG_SLAB=y or CONFIG_SLUB=y - - This option is located under "General setup" / "Choose SLAB - allocator". - - o CONFIG_FUNCTION_TRACER=n - - This option is located under "Kernel hacking" / "Tracers" / "Kernel - Function Tracer" - - When function tracing is compiled in, gcc emits a call to another - function at the beginning of every function. This means that when the - page fault handler is called, the ftrace framework will be called - before kmemcheck has had a chance to handle the fault. If ftrace then - modifies memory that was tracked by kmemcheck, the result is an - endless recursive page fault. - - o CONFIG_DEBUG_PAGEALLOC=n - - This option is located under "Kernel hacking" / "Memory Debugging" - / "Debug page memory allocations". - -In addition, I highly recommend turning on CONFIG_DEBUG_INFO=y. This is also -located under "Kernel hacking". With this, you will be able to get line number -information from the kmemcheck warnings, which is extremely valuable in -debugging a problem. This option is not mandatory, however, because it slows -down the compilation process and produces a much bigger kernel image. - -Now the kmemcheck menu should be visible (under "Kernel hacking" / "Memory -Debugging" / "kmemcheck: trap use of uninitialized memory"). Here follows -a description of the kmemcheck configuration variables: - - o CONFIG_KMEMCHECK - - This must be enabled in order to use kmemcheck at all... - - o CONFIG_KMEMCHECK_[DISABLED | ENABLED | ONESHOT]_BY_DEFAULT - - This option controls the status of kmemcheck at boot-time. "Enabled" - will enable kmemcheck right from the start, "disabled" will boot the - kernel as normal (but with the kmemcheck code compiled in, so it can - be enabled at run-time after the kernel has booted), and "one-shot" is - a special mode which will turn kmemcheck off automatically after - detecting the first use of uninitialized memory. - - If you are using kmemcheck to actively debug a problem, then you - probably want to choose "enabled" here. - - The one-shot mode is mostly useful in automated test setups because it - can prevent floods of warnings and increase the chances of the machine - surviving in case something is really wrong. In other cases, the one- - shot mode could actually be counter-productive because it would turn - itself off at the very first error -- in the case of a false positive - too -- and this would come in the way of debugging the specific - problem you were interested in. - - If you would like to use your kernel as normal, but with a chance to - enable kmemcheck in case of some problem, it might be a good idea to - choose "disabled" here. When kmemcheck is disabled, most of the run- - time overhead is not incurred, and the kernel will be almost as fast - as normal. - - o CONFIG_KMEMCHECK_QUEUE_SIZE - - Select the maximum number of error reports to store in an internal - (fixed-size) buffer. Since errors can occur virtually anywhere and in - any context, we need a temporary storage area which is guaranteed not - to generate any other page faults when accessed. The queue will be - emptied as soon as a tasklet may be scheduled. If the queue is full, - new error reports will be lost. - - The default value of 64 is probably fine. If some code produces more - than 64 errors within an irqs-off section, then the code is likely to - produce many, many more, too, and these additional reports seldom give - any more information (the first report is usually the most valuable - anyway). - - This number might have to be adjusted if you are not using serial - console or similar to capture the kernel log. If you are using the - "dmesg" command to save the log, then getting a lot of kmemcheck - warnings might overflow the kernel log itself, and the earlier reports - will get lost in that way instead. Try setting this to 10 or so on - such a setup. - - o CONFIG_KMEMCHECK_SHADOW_COPY_SHIFT - - Select the number of shadow bytes to save along with each entry of the - error-report queue. These bytes indicate what parts of an allocation - are initialized, uninitialized, etc. and will be displayed when an - error is detected to help the debugging of a particular problem. - - The number entered here is actually the logarithm of the number of - bytes that will be saved. So if you pick for example 5 here, kmemcheck - will save 2^5 = 32 bytes. - - The default value should be fine for debugging most problems. It also - fits nicely within 80 columns. - - o CONFIG_KMEMCHECK_PARTIAL_OK - - This option (when enabled) works around certain GCC optimizations that - produce 32-bit reads from 16-bit variables where the upper 16 bits are - thrown away afterwards. - - The default value (enabled) is recommended. This may of course hide - some real errors, but disabling it would probably produce a lot of - false positives. - - o CONFIG_KMEMCHECK_BITOPS_OK - - This option silences warnings that would be generated for bit-field - accesses where not all the bits are initialized at the same time. This - may also hide some real bugs. - - This option is probably obsolete, or it should be replaced with - the kmemcheck-/bitfield-annotations for the code in question. The - default value is therefore fine. - -Now compile the kernel as usual. - - -3. How to use -============= - -3.1. Booting -============ - -First some information about the command-line options. There is only one -option specific to kmemcheck, and this is called "kmemcheck". It can be used -to override the default mode as chosen by the CONFIG_KMEMCHECK_*_BY_DEFAULT -option. Its possible settings are: - - o kmemcheck=0 (disabled) - o kmemcheck=1 (enabled) - o kmemcheck=2 (one-shot mode) - -If SLUB debugging has been enabled in the kernel, it may take precedence over -kmemcheck in such a way that the slab caches which are under SLUB debugging -will not be tracked by kmemcheck. In order to ensure that this doesn't happen -(even though it shouldn't by default), use SLUB's boot option "slub_debug", -like this: slub_debug=- - -In fact, this option may also be used for fine-grained control over SLUB vs. -kmemcheck. For example, if the command line includes "kmemcheck=1 -slub_debug=,dentry", then SLUB debugging will be used only for the "dentry" -slab cache, and with kmemcheck tracking all the other caches. This is advanced -usage, however, and is not generally recommended. - - -3.2. Run-time enable/disable -============================ - -When the kernel has booted, it is possible to enable or disable kmemcheck at -run-time. WARNING: This feature is still experimental and may cause false -positive warnings to appear. Therefore, try not to use this. If you find that -it doesn't work properly (e.g. you see an unreasonable amount of warnings), I -will be happy to take bug reports. - -Use the file /proc/sys/kernel/kmemcheck for this purpose, e.g.: - - $ echo 0 > /proc/sys/kernel/kmemcheck # disables kmemcheck - -The numbers are the same as for the kmemcheck= command-line option. - - -3.3. Debugging -============== - -A typical report will look something like this: - -WARNING: kmemcheck: Caught 32-bit read from uninitialized memory (ffff88003e4a2024) -80000000000000000000000000000000000000000088ffff0000000000000000 - i i i i u u u u i i i i i i i i u u u u u u u u u u u u u u u u - ^ - -Pid: 1856, comm: ntpdate Not tainted 2.6.29-rc5 #264 945P-A -RIP: 0010:[] [] __dequeue_signal+0xc8/0x190 -RSP: 0018:ffff88003cdf7d98 EFLAGS: 00210002 -RAX: 0000000000000030 RBX: ffff88003d4ea968 RCX: 0000000000000009 -RDX: ffff88003e5d6018 RSI: ffff88003e5d6024 RDI: ffff88003cdf7e84 -RBP: ffff88003cdf7db8 R08: ffff88003e5d6000 R09: 0000000000000000 -R10: 0000000000000080 R11: 0000000000000000 R12: 000000000000000e -R13: ffff88003cdf7e78 R14: ffff88003d530710 R15: ffff88003d5a98c8 -FS: 0000000000000000(0000) GS:ffff880001982000(0063) knlGS:00000 -CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 -CR2: ffff88003f806ea0 CR3: 000000003c036000 CR4: 00000000000006a0 -DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 -DR3: 0000000000000000 DR6: 00000000ffff4ff0 DR7: 0000000000000400 - [] dequeue_signal+0x8e/0x170 - [] get_signal_to_deliver+0x98/0x390 - [] do_notify_resume+0xad/0x7d0 - [] int_signal+0x12/0x17 - [] 0xffffffffffffffff - -The single most valuable information in this report is the RIP (or EIP on 32- -bit) value. This will help us pinpoint exactly which instruction that caused -the warning. - -If your kernel was compiled with CONFIG_DEBUG_INFO=y, then all we have to do -is give this address to the addr2line program, like this: - - $ addr2line -e vmlinux -i ffffffff8104ede8 - arch/x86/include/asm/string_64.h:12 - include/asm-generic/siginfo.h:287 - kernel/signal.c:380 - kernel/signal.c:410 - -The "-e vmlinux" tells addr2line which file to look in. IMPORTANT: This must -be the vmlinux of the kernel that produced the warning in the first place! If -not, the line number information will almost certainly be wrong. - -The "-i" tells addr2line to also print the line numbers of inlined functions. -In this case, the flag was very important, because otherwise, it would only -have printed the first line, which is just a call to memcpy(), which could be -called from a thousand places in the kernel, and is therefore not very useful. -These inlined functions would not show up in the stack trace above, simply -because the kernel doesn't load the extra debugging information. This -technique can of course be used with ordinary kernel oopses as well. - -In this case, it's the caller of memcpy() that is interesting, and it can be -found in include/asm-generic/siginfo.h, line 287: - -281 static inline void copy_siginfo(struct siginfo *to, struct siginfo *from) -282 { -283 if (from->si_code < 0) -284 memcpy(to, from, sizeof(*to)); -285 else -286 /* _sigchld is currently the largest know union member */ -287 memcpy(to, from, __ARCH_SI_PREAMBLE_SIZE + sizeof(from->_sifields._sigchld)); -288 } - -Since this was a read (kmemcheck usually warns about reads only, though it can -warn about writes to unallocated or freed memory as well), it was probably the -"from" argument which contained some uninitialized bytes. Following the chain -of calls, we move upwards to see where "from" was allocated or initialized, -kernel/signal.c, line 380: - -359 static void collect_signal(int sig, struct sigpending *list, siginfo_t *info) -360 { -... -367 list_for_each_entry(q, &list->list, list) { -368 if (q->info.si_signo == sig) { -369 if (first) -370 goto still_pending; -371 first = q; -... -377 if (first) { -378 still_pending: -379 list_del_init(&first->list); -380 copy_siginfo(info, &first->info); -381 __sigqueue_free(first); -... -392 } -393 } - -Here, it is &first->info that is being passed on to copy_siginfo(). The -variable "first" was found on a list -- passed in as the second argument to -collect_signal(). We continue our journey through the stack, to figure out -where the item on "list" was allocated or initialized. We move to line 410: - -395 static int __dequeue_signal(struct sigpending *pending, sigset_t *mask, -396 siginfo_t *info) -397 { -... -410 collect_signal(sig, pending, info); -... -414 } - -Now we need to follow the "pending" pointer, since that is being passed on to -collect_signal() as "list". At this point, we've run out of lines from the -"addr2line" output. Not to worry, we just paste the next addresses from the -kmemcheck stack dump, i.e.: - - [] dequeue_signal+0x8e/0x170 - [] get_signal_to_deliver+0x98/0x390 - [] do_notify_resume+0xad/0x7d0 - [] int_signal+0x12/0x17 - - $ addr2line -e vmlinux -i ffffffff8104f04e ffffffff81050bd8 \ - ffffffff8100b87d ffffffff8100c7b5 - kernel/signal.c:446 - kernel/signal.c:1806 - arch/x86/kernel/signal.c:805 - arch/x86/kernel/signal.c:871 - arch/x86/kernel/entry_64.S:694 - -Remember that since these addresses were found on the stack and not as the -RIP value, they actually point to the _next_ instruction (they are return -addresses). This becomes obvious when we look at the code for line 446: - -422 int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) -423 { -... -431 signr = __dequeue_signal(&tsk->signal->shared_pending, -432 mask, info); -433 /* -434 * itimer signal ? -435 * -436 * itimers are process shared and we restart periodic -437 * itimers in the signal delivery path to prevent DoS -438 * attacks in the high resolution timer case. This is -439 * compliant with the old way of self restarting -440 * itimers, as the SIGALRM is a legacy signal and only -441 * queued once. Changing the restart behaviour to -442 * restart the timer in the signal dequeue path is -443 * reducing the timer noise on heavy loaded !highres -444 * systems too. -445 */ -446 if (unlikely(signr == SIGALRM)) { -... -489 } - -So instead of looking at 446, we should be looking at 431, which is the line -that executes just before 446. Here we see that what we are looking for is -&tsk->signal->shared_pending. - -Our next task is now to figure out which function that puts items on this -"shared_pending" list. A crude, but efficient tool, is git grep: - - $ git grep -n 'shared_pending' kernel/ - ... - kernel/signal.c:828: pending = group ? &t->signal->shared_pending : &t->pending; - kernel/signal.c:1339: pending = group ? &t->signal->shared_pending : &t->pending; - ... - -There were more results, but none of them were related to list operations, -and these were the only assignments. We inspect the line numbers more closely -and find that this is indeed where items are being added to the list: - -816 static int send_signal(int sig, struct siginfo *info, struct task_struct *t, -817 int group) -818 { -... -828 pending = group ? &t->signal->shared_pending : &t->pending; -... -851 q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN && -852 (is_si_special(info) || -853 info->si_code >= 0))); -854 if (q) { -855 list_add_tail(&q->list, &pending->list); -... -890 } - -and: - -1309 int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group) -1310 { -.... -1339 pending = group ? &t->signal->shared_pending : &t->pending; -1340 list_add_tail(&q->list, &pending->list); -.... -1347 } - -In the first case, the list element we are looking for, "q", is being returned -from the function __sigqueue_alloc(), which looks like an allocation function. -Let's take a look at it: - -187 static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags, -188 int override_rlimit) -189 { -190 struct sigqueue *q = NULL; -191 struct user_struct *user; -192 -193 /* -194 * We won't get problems with the target's UID changing under us -195 * because changing it requires RCU be used, and if t != current, the -196 * caller must be holding the RCU readlock (by way of a spinlock) and -197 * we use RCU protection here -198 */ -199 user = get_uid(__task_cred(t)->user); -200 atomic_inc(&user->sigpending); -201 if (override_rlimit || -202 atomic_read(&user->sigpending) <= -203 t->signal->rlim[RLIMIT_SIGPENDING].rlim_cur) -204 q = kmem_cache_alloc(sigqueue_cachep, flags); -205 if (unlikely(q == NULL)) { -206 atomic_dec(&user->sigpending); -207 free_uid(user); -208 } else { -209 INIT_LIST_HEAD(&q->list); -210 q->flags = 0; -211 q->user = user; -212 } -213 -214 return q; -215 } - -We see that this function initializes q->list, q->flags, and q->user. It seems -that now is the time to look at the definition of "struct sigqueue", e.g.: - -14 struct sigqueue { -15 struct list_head list; -16 int flags; -17 siginfo_t info; -18 struct user_struct *user; -19 }; - -And, you might remember, it was a memcpy() on &first->info that caused the -warning, so this makes perfect sense. It also seems reasonable to assume that -it is the caller of __sigqueue_alloc() that has the responsibility of filling -out (initializing) this member. - -But just which fields of the struct were uninitialized? Let's look at -kmemcheck's report again: - -WARNING: kmemcheck: Caught 32-bit read from uninitialized memory (ffff88003e4a2024) -80000000000000000000000000000000000000000088ffff0000000000000000 - i i i i u u u u i i i i i i i i u u u u u u u u u u u u u u u u - ^ - -These first two lines are the memory dump of the memory object itself, and the -shadow bytemap, respectively. The memory object itself is in this case -&first->info. Just beware that the start of this dump is NOT the start of the -object itself! The position of the caret (^) corresponds with the address of -the read (ffff88003e4a2024). - -The shadow bytemap dump legend is as follows: - - i - initialized - u - uninitialized - a - unallocated (memory has been allocated by the slab layer, but has not - yet been handed off to anybody) - f - freed (memory has been allocated by the slab layer, but has been freed - by the previous owner) - -In order to figure out where (relative to the start of the object) the -uninitialized memory was located, we have to look at the disassembly. For -that, we'll need the RIP address again: - -RIP: 0010:[] [] __dequeue_signal+0xc8/0x190 - - $ objdump -d --no-show-raw-insn vmlinux | grep -C 8 ffffffff8104ede8: - ffffffff8104edc8: mov %r8,0x8(%r8) - ffffffff8104edcc: test %r10d,%r10d - ffffffff8104edcf: js ffffffff8104ee88 <__dequeue_signal+0x168> - ffffffff8104edd5: mov %rax,%rdx - ffffffff8104edd8: mov $0xc,%ecx - ffffffff8104eddd: mov %r13,%rdi - ffffffff8104ede0: mov $0x30,%eax - ffffffff8104ede5: mov %rdx,%rsi - ffffffff8104ede8: rep movsl %ds:(%rsi),%es:(%rdi) - ffffffff8104edea: test $0x2,%al - ffffffff8104edec: je ffffffff8104edf0 <__dequeue_signal+0xd0> - ffffffff8104edee: movsw %ds:(%rsi),%es:(%rdi) - ffffffff8104edf0: test $0x1,%al - ffffffff8104edf2: je ffffffff8104edf5 <__dequeue_signal+0xd5> - ffffffff8104edf4: movsb %ds:(%rsi),%es:(%rdi) - ffffffff8104edf5: mov %r8,%rdi - ffffffff8104edf8: callq ffffffff8104de60 <__sigqueue_free> - -As expected, it's the "rep movsl" instruction from the memcpy() that causes -the warning. We know about REP MOVSL that it uses the register RCX to count -the number of remaining iterations. By taking a look at the register dump -again (from the kmemcheck report), we can figure out how many bytes were left -to copy: - -RAX: 0000000000000030 RBX: ffff88003d4ea968 RCX: 0000000000000009 - -By looking at the disassembly, we also see that %ecx is being loaded with the -value $0xc just before (ffffffff8104edd8), so we are very lucky. Keep in mind -that this is the number of iterations, not bytes. And since this is a "long" -operation, we need to multiply by 4 to get the number of bytes. So this means -that the uninitialized value was encountered at 4 * (0xc - 0x9) = 12 bytes -from the start of the object. - -We can now try to figure out which field of the "struct siginfo" that was not -initialized. This is the beginning of the struct: - -40 typedef struct siginfo { -41 int si_signo; -42 int si_errno; -43 int si_code; -44 -45 union { -.. -92 } _sifields; -93 } siginfo_t; - -On 64-bit, the int is 4 bytes long, so it must the union member that has -not been initialized. We can verify this using gdb: - - $ gdb vmlinux - ... - (gdb) p &((struct siginfo *) 0)->_sifields - $1 = (union {...} *) 0x10 - -Actually, it seems that the union member is located at offset 0x10 -- which -means that gcc has inserted 4 bytes of padding between the members si_code -and _sifields. We can now get a fuller picture of the memory dump: - - _----------------------------=> si_code - / _--------------------=> (padding) - | / _------------=> _sifields(._kill._pid) - | | / _----=> _sifields(._kill._uid) - | | | / --------|-------|-------|-------| -80000000000000000000000000000000000000000088ffff0000000000000000 - i i i i u u u u i i i i i i i i u u u u u u u u u u u u u u u u - -This allows us to realize another important fact: si_code contains the value -0x80. Remember that x86 is little endian, so the first 4 bytes "80000000" are -really the number 0x00000080. With a bit of research, we find that this is -actually the constant SI_KERNEL defined in include/asm-generic/siginfo.h: - -144 #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */ - -This macro is used in exactly one place in the x86 kernel: In send_signal() -in kernel/signal.c: - -816 static int send_signal(int sig, struct siginfo *info, struct task_struct *t, -817 int group) -818 { -... -828 pending = group ? &t->signal->shared_pending : &t->pending; -... -851 q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN && -852 (is_si_special(info) || -853 info->si_code >= 0))); -854 if (q) { -855 list_add_tail(&q->list, &pending->list); -856 switch ((unsigned long) info) { -... -865 case (unsigned long) SEND_SIG_PRIV: -866 q->info.si_signo = sig; -867 q->info.si_errno = 0; -868 q->info.si_code = SI_KERNEL; -869 q->info.si_pid = 0; -870 q->info.si_uid = 0; -871 break; -... -890 } - -Not only does this match with the .si_code member, it also matches the place -we found earlier when looking for where siginfo_t objects are enqueued on the -"shared_pending" list. - -So to sum up: It seems that it is the padding introduced by the compiler -between two struct fields that is uninitialized, and this gets reported when -we do a memcpy() on the struct. This means that we have identified a false -positive warning. - -Normally, kmemcheck will not report uninitialized accesses in memcpy() calls -when both the source and destination addresses are tracked. (Instead, we copy -the shadow bytemap as well). In this case, the destination address clearly -was not tracked. We can dig a little deeper into the stack trace from above: - - arch/x86/kernel/signal.c:805 - arch/x86/kernel/signal.c:871 - arch/x86/kernel/entry_64.S:694 - -And we clearly see that the destination siginfo object is located on the -stack: - -782 static void do_signal(struct pt_regs *regs) -783 { -784 struct k_sigaction ka; -785 siginfo_t info; -... -804 signr = get_signal_to_deliver(&info, &ka, regs, NULL); -... -854 } - -And this &info is what eventually gets passed to copy_siginfo() as the -destination argument. - -Now, even though we didn't find an actual error here, the example is still a -good one, because it shows how one would go about to find out what the report -was all about. - - -3.4. Annotating false positives -=============================== - -There are a few different ways to make annotations in the source code that -will keep kmemcheck from checking and reporting certain allocations. Here -they are: - - o __GFP_NOTRACK_FALSE_POSITIVE - - This flag can be passed to kmalloc() or kmem_cache_alloc() (therefore - also to other functions that end up calling one of these) to indicate - that the allocation should not be tracked because it would lead to - a false positive report. This is a "big hammer" way of silencing - kmemcheck; after all, even if the false positive pertains to - particular field in a struct, for example, we will now lose the - ability to find (real) errors in other parts of the same struct. - - Example: - - /* No warnings will ever trigger on accessing any part of x */ - x = kmalloc(sizeof *x, GFP_KERNEL | __GFP_NOTRACK_FALSE_POSITIVE); - - o kmemcheck_bitfield_begin(name)/kmemcheck_bitfield_end(name) and - kmemcheck_annotate_bitfield(ptr, name) - - The first two of these three macros can be used inside struct - definitions to signal, respectively, the beginning and end of a - bitfield. Additionally, this will assign the bitfield a name, which - is given as an argument to the macros. - - Having used these markers, one can later use - kmemcheck_annotate_bitfield() at the point of allocation, to indicate - which parts of the allocation is part of a bitfield. - - Example: - - struct foo { - int x; - - kmemcheck_bitfield_begin(flags); - int flag_a:1; - int flag_b:1; - kmemcheck_bitfield_end(flags); - - int y; - }; - - struct foo *x = kmalloc(sizeof *x); - - /* No warnings will trigger on accessing the bitfield of x */ - kmemcheck_annotate_bitfield(x, flags); - - Note that kmemcheck_annotate_bitfield() can be used even before the - return value of kmalloc() is checked -- in other words, passing NULL - as the first argument is legal (and will do nothing). - - -4. Reporting errors -=================== - -As we have seen, kmemcheck will produce false positive reports. Therefore, it -is not very wise to blindly post kmemcheck warnings to mailing lists and -maintainers. Instead, I encourage maintainers and developers to find errors -in their own code. If you get a warning, you can try to work around it, try -to figure out if it's a real error or not, or simply ignore it. Most -developers know their own code and will quickly and efficiently determine the -root cause of a kmemcheck report. This is therefore also the most efficient -way to work with kmemcheck. - -That said, we (the kmemcheck maintainers) will always be on the lookout for -false positives that we can annotate and silence. So whatever you find, -please drop us a note privately! Kernel configs and steps to reproduce (if -available) are of course a great help too. - -Happy hacking! - - -5. Technical description -======================== - -kmemcheck works by marking memory pages non-present. This means that whenever -somebody attempts to access the page, a page fault is generated. The page -fault handler notices that the page was in fact only hidden, and so it calls -on the kmemcheck code to make further investigations. - -When the investigations are completed, kmemcheck "shows" the page by marking -it present (as it would be under normal circumstances). This way, the -interrupted code can continue as usual. - -But after the instruction has been executed, we should hide the page again, so -that we can catch the next access too! Now kmemcheck makes use of a debugging -feature of the processor, namely single-stepping. When the processor has -finished the one instruction that generated the memory access, a debug -exception is raised. From here, we simply hide the page again and continue -execution, this time with the single-stepping feature turned off. - -kmemcheck requires some assistance from the memory allocator in order to work. -The memory allocator needs to - - 1. Tell kmemcheck about newly allocated pages and pages that are about to - be freed. This allows kmemcheck to set up and tear down the shadow memory - for the pages in question. The shadow memory stores the status of each - byte in the allocation proper, e.g. whether it is initialized or - uninitialized. - - 2. Tell kmemcheck which parts of memory should be marked uninitialized. - There are actually a few more states, such as "not yet allocated" and - "recently freed". - -If a slab cache is set up using the SLAB_NOTRACK flag, it will never return -memory that can take page faults because of kmemcheck. - -If a slab cache is NOT set up using the SLAB_NOTRACK flag, callers can still -request memory with the __GFP_NOTRACK or __GFP_NOTRACK_FALSE_POSITIVE flags. -This does not prevent the page faults from occurring, however, but marks the -object in question as being initialized so that no warnings will ever be -produced for this object. - -Currently, the SLAB and SLUB allocators are supported by kmemcheck. diff --git a/MAINTAINERS b/MAINTAINERS index b235e0d53449..810723537aa5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6803,7 +6803,7 @@ KMEMCHECK M: Vegard Nossum M: Pekka Enberg S: Maintained -F: Documentation/kmemcheck.txt +F: Documentation/dev-tools/kmemcheck.rst F: arch/x86/include/asm/kmemcheck.h F: arch/x86/mm/kmemcheck/ F: include/linux/kmemcheck.h From 5f0962748d46c63aaf5c46dcb1c8f52dfb7b717f Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Mon, 8 Aug 2016 15:55:49 -0600 Subject: [PATCH 039/591] docs: Sphinxify gdb-kernel-debugging.txt and move to dev-tools Acked-by: Jan Kiszka Signed-off-by: Jonathan Corbet --- .../gdb-kernel-debugging.rst} | 77 +++++++++++-------- Documentation/dev-tools/tools.rst | 1 + 2 files changed, 46 insertions(+), 32 deletions(-) rename Documentation/{gdb-kernel-debugging.txt => dev-tools/gdb-kernel-debugging.rst} (73%) diff --git a/Documentation/gdb-kernel-debugging.txt b/Documentation/dev-tools/gdb-kernel-debugging.rst similarity index 73% rename from Documentation/gdb-kernel-debugging.txt rename to Documentation/dev-tools/gdb-kernel-debugging.rst index 7050ce8794b9..5e93c9bc6619 100644 --- a/Documentation/gdb-kernel-debugging.txt +++ b/Documentation/dev-tools/gdb-kernel-debugging.rst @@ -1,3 +1,5 @@ +.. highlight:: none + Debugging kernel and modules via gdb ==================================== @@ -13,54 +15,58 @@ be transferred to the other gdb stubs as well. Requirements ------------ - o gdb 7.2+ (recommended: 7.4+) with python support enabled (typically true - for distributions) +- gdb 7.2+ (recommended: 7.4+) with python support enabled (typically true + for distributions) Setup ----- - o Create a virtual Linux machine for QEMU/KVM (see www.linux-kvm.org and - www.qemu.org for more details). For cross-development, - http://landley.net/aboriginal/bin keeps a pool of machine images and - toolchains that can be helpful to start from. +- Create a virtual Linux machine for QEMU/KVM (see www.linux-kvm.org and + www.qemu.org for more details). For cross-development, + http://landley.net/aboriginal/bin keeps a pool of machine images and + toolchains that can be helpful to start from. - o Build the kernel with CONFIG_GDB_SCRIPTS enabled, but leave - CONFIG_DEBUG_INFO_REDUCED off. If your architecture supports - CONFIG_FRAME_POINTER, keep it enabled. +- Build the kernel with CONFIG_GDB_SCRIPTS enabled, but leave + CONFIG_DEBUG_INFO_REDUCED off. If your architecture supports + CONFIG_FRAME_POINTER, keep it enabled. - o Install that kernel on the guest. +- Install that kernel on the guest. + Alternatively, QEMU allows to boot the kernel directly using -kernel, + -append, -initrd command line switches. This is generally only useful if + you do not depend on modules. See QEMU documentation for more details on + this mode. - Alternatively, QEMU allows to boot the kernel directly using -kernel, - -append, -initrd command line switches. This is generally only useful if - you do not depend on modules. See QEMU documentation for more details on - this mode. +- Enable the gdb stub of QEMU/KVM, either - o Enable the gdb stub of QEMU/KVM, either - at VM startup time by appending "-s" to the QEMU command line - or + + or + - during runtime by issuing "gdbserver" from the QEMU monitor console - o cd /path/to/linux-build +- cd /path/to/linux-build - o Start gdb: gdb vmlinux +- Start gdb: gdb vmlinux - Note: Some distros may restrict auto-loading of gdb scripts to known safe - directories. In case gdb reports to refuse loading vmlinux-gdb.py, add + Note: Some distros may restrict auto-loading of gdb scripts to known safe + directories. In case gdb reports to refuse loading vmlinux-gdb.py, add:: add-auto-load-safe-path /path/to/linux-build - to ~/.gdbinit. See gdb help for more details. + to ~/.gdbinit. See gdb help for more details. + +- Attach to the booted guest:: - o Attach to the booted guest: (gdb) target remote :1234 Examples of using the Linux-provided gdb helpers ------------------------------------------------ - o Load module (and main kernel) symbols: +- Load module (and main kernel) symbols:: + (gdb) lx-symbols loading vmlinux scanning for modules in /home/user/linux/build @@ -72,17 +78,20 @@ Examples of using the Linux-provided gdb helpers ... loading @0xffffffffa0000000: /home/user/linux/build/drivers/ata/ata_generic.ko - o Set a breakpoint on some not yet loaded module function, e.g.: +- Set a breakpoint on some not yet loaded module function, e.g.:: + (gdb) b btrfs_init_sysfs Function "btrfs_init_sysfs" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (btrfs_init_sysfs) pending. - o Continue the target +- Continue the target:: + (gdb) c - o Load the module on the target and watch the symbols being loaded as well as - the breakpoint hit: +- Load the module on the target and watch the symbols being loaded as well as + the breakpoint hit:: + loading @0xffffffffa0034000: /home/user/linux/build/lib/libcrc32c.ko loading @0xffffffffa0050000: /home/user/linux/build/lib/lzo/lzo_compress.ko loading @0xffffffffa006e000: /home/user/linux/build/lib/zlib_deflate/zlib_deflate.ko @@ -91,7 +100,8 @@ Examples of using the Linux-provided gdb helpers Breakpoint 1, btrfs_init_sysfs () at /home/user/linux/fs/btrfs/sysfs.c:36 36 btrfs_kset = kset_create_and_add("btrfs", NULL, fs_kobj); - o Dump the log buffer of the target kernel: +- Dump the log buffer of the target kernel:: + (gdb) lx-dmesg [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu @@ -102,19 +112,22 @@ Examples of using the Linux-provided gdb helpers [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved .... - o Examine fields of the current task struct: +- Examine fields of the current task struct:: + (gdb) p $lx_current().pid $1 = 4998 (gdb) p $lx_current().comm $2 = "modprobe\000\000\000\000\000\000\000" - o Make use of the per-cpu function for the current or a specified CPU: +- Make use of the per-cpu function for the current or a specified CPU:: + (gdb) p $lx_per_cpu("runqueues").nr_running $3 = 1 (gdb) p $lx_per_cpu("runqueues", 2).nr_running $4 = 0 - o Dig into hrtimers using the container_of helper: +- Dig into hrtimers using the container_of helper:: + (gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next (gdb) p *$container_of($next, "struct hrtimer", "node") $5 = { @@ -144,7 +157,7 @@ List of commands and functions ------------------------------ The number of commands and convenience functions may evolve over the time, -this is just a snapshot of the initial version: +this is just a snapshot of the initial version:: (gdb) apropos lx function lx_current -- Return current task diff --git a/Documentation/dev-tools/tools.rst b/Documentation/dev-tools/tools.rst index 43f7deeccae4..824ae8e54dd5 100644 --- a/Documentation/dev-tools/tools.rst +++ b/Documentation/dev-tools/tools.rst @@ -22,3 +22,4 @@ whole; patches welcome! ubsan kmemleak kmemcheck + gdb-kernel-debugging From 1bf0907b59ad02ea1b547609e6c0ece5f71e356a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 15 Aug 2016 11:01:30 -0300 Subject: [PATCH 040/591] [media] pixfmt-nv12mt.rst: use PNG instead of GIF pdflatex doesn't like gif images: None:None: WARNING: no matching candidate for image URI u'media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.*' None:None: WARNING: no matching candidate for image URI u'media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.*' But it works fine with png. So, convert them. As a plus, PNG images are smaller. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-nv12mt.rst | 4 ++-- .../uapi/v4l/pixfmt-nv12mt_files/nv12mt.gif | Bin 2108 -> 0 bytes .../uapi/v4l/pixfmt-nv12mt_files/nv12mt.png | Bin 0 -> 1920 bytes .../v4l/pixfmt-nv12mt_files/nv12mt_example.gif | Bin 6858 -> 0 bytes .../v4l/pixfmt-nv12mt_files/nv12mt_example.png | Bin 0 -> 5261 bytes 5 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.gif create mode 100644 Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.png delete mode 100644 Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.gif create mode 100644 Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.png diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst b/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst index 6198941bb814..1e6fdf0194f5 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst @@ -36,7 +36,7 @@ Layout of macroblocks in memory is presented in the following figure. .. _nv12mt: .. figure:: pixfmt-nv12mt_files/nv12mt.* - :alt: nv12mt.gif + :alt: nv12mt.png :align: center V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout @@ -53,7 +53,7 @@ interleaved. Height of the buffer is aligned to 32. .. _nv12mt_ex: .. figure:: pixfmt-nv12mt_files/nv12mt_example.* - :alt: nv12mt_example.gif + :alt: nv12mt_example.png :align: center Example V4L2_PIX_FMT_NV12MT memory layout of macroblocks diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.gif b/Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.gif deleted file mode 100644 index ef2d4cf8367b97293eb9139de0f33d0a2ac236be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2108 zcmb`E`9IT-1IOQ+qvdLI6(2NWh4B$mqGFB~bIqI`Ov+J?J|;e;^kHT0IblWJ*`TR@ettFfwykFz0RpGX8Qtpc((LKc?crMQAH8KYFSWD99Kv!>_lN%eRo>u79&dGsPn{QY=Bb|r;(6+q+1bsx zxvy`8-AZ)6z3Cv$DzebNmJoNG&VJ}9=Ei%vD-U3yExrFy-&D({S>>SJpRz|$mrO(VC>MdmlKl{FQ#T@ zCtuCI77p1x0NyMM-@RX*TKTvp_`JS33@mZJb^Yl4*&(_Qd{8V%hZ`riKuxi}>Dopq zO>kaLJV^(c{>X$am`p2!XESZ86${gJ4af*Lx;d*6=Zrn{WpL(bjDYWP)L~JMrG&#! zZ2o(6K~22}jLiEO-~AJugyFU8Rq!!S$RJQc{tKru;GgjkKx^ zFd&lbg)hGK?p7)LCkp@qeX0;<>RU3>!h8W=eg6o&nE4(8Lhkxx8flHs7RsrkEkc^-X~TW61OE-h+0@5963qk?9WuDbC$zlK*#au5C* zD7^%Y9A^IR@P6g`?lm+1UAyC0%O5K)1Eptk8flOMvr(_T6UzQ|!ub`Li=XY=jd?Fy zzsv*}SJoRT^iEPbz9CSR>R!~+@%|b3CiB=5scaWqd0YZwBduRfHnEOJD<`ds=vt`@ zeULk`X^@`eESxaj_5qFpprApz!pV#Yqh{V-zud5;!cfY#{VvN;21&&*dK_lxwQS=+ ziKn#L6o;W2dSyL_s^*P@;0<8OtZscq2{U@#F5lP`yda|x8LVOKT5yNB52{bOZtUP$1Q7!Q+vgdTu|H9S$!C_Y|k6eM|{7L(qs&a9y!lH8$KYht*s zdB3FxvecONvQarrk5td@Rjh6BatJqiJQZ$bsPpWT6V7Ylo?&DIF_&N1=BJiZ$6oP% zZdB_r>>SnEGHX@sIdQyb%;**PicwdGuC4T`AN|5lI#Olt9yND}Ncbdfi1})?vD7K# z1N>KFf}O11Omvp4_5j@U#Fv_kEIHkw5)9wCB^f)sM(s`-JjBc}voaUYxX8gtrqP!8Be^mPojpej9Pxfrk6fJ-Gg%2H%yFF&E(qV zI@>pHuJyjEb5^X}(|8k&G2GLkt(BPaVpGp+l(!+;QpmQ}o?*W2G+0RaobVQuEze%) z3UG`306VfGT7f(rwcgs~{Qh~pBRRlO@YHBs-w?L=Y;arWuky}%5=;^azquvIH*o=* zsQiS2LGh4%yDO~Jt@9DQHJ}X>awdgTA}L#H>6nX`$g2WD4to?$A8`b0(d^~rw-5@d zLH6q~{K2&*`1UU*bgGn?Xx^Y9IYtLz2DJ6^o|L+7M?-B^dEk@-eW*%z7^E<}3J%)$ zJrpIQY2tSA4%y)h`Kh(yc)_l3U^>((>&RtHDeOyrue4eiOrH80Aq_2QIUgju8)EmH z9tf^vzW{5uLP@gPO9gK)bJB?Pnd&Sc3Uctpwby8(|-de8|dI~ZDJ4}ij z;^wQqme2^??d-!|%xvb;9XmE$*v*1W$FZ{g^6v|5Xg&L9b94b~_X|DG$E8T`4+QHp zp$)J$n)>?P&I9hKv}N$a{x-(7yg|1+SgtA#PEyJnpoSQ{Q}P}|V2~Sf!AS=xaGOz8 zN1C)dg|5kp(>VCifsAqDmK)F^-R{ubEBeo6ifzvR6d@A zfm{|NR0~nPzz@brvSP1yYuepvZ&BuG776h#+R()pe)ez@b)6-jzTZcay JfkA-P{{T*w8|nZ6 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.png b/Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt.png new file mode 100644 index 0000000000000000000000000000000000000000..41401860fb737739658c354c0cb7ca12313a0265 GIT binary patch literal 1920 zcmb7EX*ApU8vfCysc20nwM-SI6L*H2RD!CDUQKUQa@5*TTZ>exLB#Tpph&N!EvA&V ziixV}W*4MJ?ORc4Ev2=UqGR7Rh+r}?^XY!L=iK|{eSXjTyw7{y^ZW3`*;tt$L?|Nw z00&7#f*k--ijue2{ymbqnvq#3fxTXMOFRH2NwV7>FbP+`LbS64Anb1d+=u}{Bx&84 z27rkLVAdS~qci}N{5h4jCX!`_Hs{G^VzD?qJ)O;FGZ+lXuvlCNNdQ1~VleYcFC>=)z$sU{uFl=2oNQvoz2aq_uWJy=nM&Nr~9n*^+{GtH`F(~I`t*p*<4(l zZE5)scWX-^7=HYy(Sbb9EgsFwUHdYgaoTuedb&F@yoKU6|CUb#pn`O+)`Hj(47E_) zdt#zGm{5|T!EY~l1qA%p;o*h$c0S#EzWojMFmkf0awsF+QcbnZi~2UmKgG{4-_`l9 zKcm9NGJ(nDUbMdz67s_BQX1`AVo(t8g6%U8H)AEG=6c6Toels^o3}he(!Y@X`I>z;SvV_>B7iz*I>DJUL`=fpgtu$Uwfue$wXLV_pG` zqp2k~`duk%u@om=bvK1x!&*pXKD^ADs}-MeF1Eo}cD#oS!1mTi%;|KVZD_cu7AzEeq)7+Fh{t;b?Y~7nmJ8kRoe2qX)|9JQ% z)%pKuy!VjhcT6b66gIBj%Fm%GsG8%V2zBL)1g0hnee~iJon>D9!(#d`TzS*V4y-8P zfdSr;+N9`LP+B?;B@fx9+ikQ`q|_V+xZO`Dt=<-1YqcBP?hjCW#z4- zFQNSO`dP2C@`?ulI$3kG!Q0+6cdiM!)*1W*jaBI}PxWx>kiQxGz%O7cm77suef>^n zm}^92aD97sxm4{^nt(N)KRTK~5dUk8*)=Ehs&gYRR0a-Al>a?$_Lz)PWtVXWmeO)* z_Muw@Mp<~19XifrtxhKmnr!V^G7x7LkagEhi$uCLp9L`q2{P#G4fRuN>A9W@S)<6l zEEK~`Y?`{v>p=)ePx^0lE!6K)PW zS!iC_Vdgtal1ZDq0$H7aAYGXO0T$TAS(=t&clV>ht zQTJ^k9XBaj#@RSpDfcu*VINEJh3=}x54@VXYcez-8WU-=%WjGTv6s8%OMgMv!PCy32GRJXN-iOq1Qa2 z7`^M|pvSjA=SkCRUQm=1ir`1FE?(r@?r(N*-?e@G388=vHPw&pkGIu`)|@h*2QC5H z5cjvOf1eL_QBgSS7`P*}^3LZVeI{~$T+4GWQsEDVDb}=U#Ao5-V3>qG6Rk3VGV z_PnUp)83BEq__FLQm}X3+}y_Y>d$H=?8_;095qA5tP-^KBD}kjwE}BC49e2J9@Wv* z`ibvjY6lNbLQ$(3O=*^(WerDOl{2&SSEX2&H?8jLx;Z((W#pL7OGR=)t(i_ zbGe*ZNj-I?B4{5voV=1`nxFUddnM?6nZomF^ElpQu5ofadn_5bW}-s+}8`dwmzNmtiq^yjnah^MXOEJ zHXRFzh=Xk&Uxl0Nu3*+)TC#};kdP-MN@}}g=Q1|rK^7b1cn06PEXY!9-?G25>#q>BiWwbB^2@ym(Bt-!c z495Gu_h-C&&i&<{&;9Y9bD`Q=a`Mkg?(72gI|2VE7y#h^pJ4zP4B*eq%Bl90REqm}hES zZK&U;3v1Tbt1vPsH8$*cs@tQd)A>|qKo^G7(|N0}`^Hdz&`7`E#Bjjeq}S4X*xVH6 zkL$LzM!j?$u(2LRSasXmc0GSKZf_eD6g2K&H|}7Mb9&z4;ym%f3Fi-J^K@_Z_QJcl zw)pwrJ=}2Ko>Lw#8$v_g`+3)ghb1H=;DQ3C{e5Qw{AU9FlarHiVIea?0Uv?`Ymmt5 z!~__2V=gkh8kJm`k+Fb`t;oa-WTY=9Cl(YGlok|}V6jUXX~o6G%UPKN1qI95nV(-} zZD3&oMTK7q@^R(mYb8av+S>KX^7i(2TuX~T?zXeD6N|%c*46g*_TqYawp*HaJ3DYV z+y>77Yk%J@&i`O&@MwJe1V8x=k3V@oh26NtZD7C8&uwgA&z6=pH#cuLuor7<1dooFq8 zm+?>o#ird>F_{H1sY6V*RZiuKKgVOW+pDHu%lRFxPPSKnC{~T5c%ai!Ggl7F612g0 z)GkyTmg^Mibk>)K?%#x2?7qdh;-DIDA-zhFG{QGC+c5mD+ z3P2XT8okZwV(UX-IN0o zHx<-2sij z2Q@$>cR3-(m!7M(HCAAi&)^AHie`{)-^=>;9Qaf%>zG7B5hty#TaC09g`3C+XL@pm z7X-&*wm;m%Eb3)1V&&Z(6VIf2P_xJYQ z%Ws_NbwK7FePXX!!EV*vZIQAbo%aM*jcD{+3g)t$L+`wV%9{GPLlxW{&$XuTsc3$m zCnA?0O$}~Fz%aJb%TI_PWuS(DP=sWTLxC%Z-QBeD*UDql)~=5>Y-;g*G@9>0AHCXb z#t2|t#N6cuLM#^DcDi2Jz2YI}Gs@uspy^@k7u@Yw7PU3~^`5el7XK9+bQ-d+0GT80 zr3_Jz7qDkSTxjJc+UW8-d7uA2Y2UZM`wh$COTvEd5sAM>!H#|yjkA)3f)q#3ffE1>@a32Ru5q4gaV?s80~$uIjOXsRF_+8Xod zXq&}~X#AmswlYF$ht!5obsa%TJv*t7PL&ll(nN z;&aZo7)vc=eTZjfAI;4EOMdU4{X6)I@hgRpF*?*lfz5eat_;uK{TJsbuI2H3U3F)D znV7rI4(%9Oi80nt{%MvqM>-Akw5$PbF`a#>*blZ8)}Qv|)UZ-=6d|cv1y>dmbV^s0 zBsWaI{xC_~y|VaL??COQb~d7pljOS;iOPKn1L_~8T&&Tlt}=DZjP@l&G?r>)ays*) z%&O(Q($qBRszh`EPSS@i038$feAfKWDq%|ivD{`XW<9%{43;M2m5CBood*Wx@#+2m zh<{AuqJ0dDy>;x!DjTq;8Ao!n`WYub&Pyk2!)QubBkA;lFOgzDMl2_nvzk6dlYgy` zxBT2^h84f`7i$^enrT78+`;^smpn(&`QTw&WG$>w6Y^`tqVLF!-#~7d{m2^$5#Ek0 z?9gUpH&+?49c^bwcE8u)jeLao)f~_{2}u`E&-?Aa^J0M=e#C5#>oWA`7N-<5=Qc{C6Rk|4HP#z zN@OIFI`(%pyC!&SEv+TxDNEM<55XDIDwAnG*w1W~pZNIL&olN@w)0*ca%%9ksnYU- zWh2PLCs_0Hn)EPGvrPFJN4s&JK4>!d6>3iLF+Z1SSLRmlj)@Mt zMw##)d{f6lUMQyYO-XBNO&yIavn3}_i9#~lic`dT<#DVlM&(ApFzD!&`gH@_Uy0HA zWg_Xq#JXoHeAC13Dn9DN(oKT(R&XtlhSxL}0Fw&kl09zpwUj>`eklNd8rG?How^n0 z9!n9%+@$_z@%W!)9`|&PTb)@Wnjtfb(*a+k_Ud5`eLEnc z5#yp=d&`aXHtzW(eOdkS;;ecI z@zNuO^%L7&xgnNOO6LNpbx#%P0dUNI)J3m`ej4Up?|rBHcJgyO=!@6TE*dv8b~U!h z^9T)|C`$SGi-e&5)UpL1FQWAKl-M=tlT_McrcR1e!l?CZdcHWY=?@Xu z)kf2=rr)lek_2R6Ij#d4MXj1`glbcKfmsn_3W~W|T zd?)(5b1RCT`u(^4aEqA%pzOPtrm~67P0D*GJOy`eiK7Oak0C78K> zv4mgJ`z-wUEe-gtw(&68AW*%6aLac}_xMW6dG7q#yg29X9ez1v3noPgZG_#T3RU2{ z?u3K*)mM0p5We)d@HHmJ3L1Z69b4!_4jJ9!ecO|zfEy?*4;f7kGrzESuoK`T{56^p z7&8+X&1@M%RucpJEm=c*5YErA2(|RFki4!Q?gnst2|7RDl?pL45YuzssXHF&eEDeq=u$qNwwSOUzVf{mJ!~_O{cHMMDx1@o`*{_XXct?;>$x@62WDB zAnZ0l08E~FcL)>mi#NZ@gEj;#bBHPakx3+<(qI8{gJyMhD`oj*lHYM3&dk;c$$ouT zaB4n7Z$~tSDcf%;s5>Yl!&0=n>(#nkHZjJ-k_G&gOX^#jr@`mo>CdzqcmFpbh)_fOi8|Zm#B2FqBqSy0Ix_$1AB~N!t_Np7nq{q1F2f20R7ieh9z08LJXI>OmT0B-Fabdo;J-6NFYv`&~}$03%vU|lnW%K zAP;7Hq{7@-{X&1bP zCc%Y%!98(-OF3ZMqrfq`D#%&Y46*Y3g|oq7r41$1O7Wwx2a(YUx^&o}}$POn67vo?xuHR36nmXGScUe{@vH+>Cl zT3E?ng47g_X|FISYYMBw&=ZTfpzWdWC9^CS$uZ84mOV$w> zNzr=P7ekwZ`B+ESTcLjqPsx&M1}LVxh*B9J(<(w>R05R2Mg z8*i&sXN%3W94+SZZg3093p7xEvw_u`&I&*rJ=?YeH`Cf9pS(;H^s&$U>tuL-i*FQtW=@}NUTvKwyJhYz4f2ae#lNJ>du@@rXK}LJ3uSC)OtIAN zv<$E8hbXp5fUUC3tg6i#AzR&rl|5xbbY+_Gs`#2F0%b_k#f==ePMQ>`hF>40iONxT_&bdsc+ zIv`F}C~5shQi&FuGa{23t*h585IAbU)}oe*X6$yV(RQCubJER4JA5j+cLsUjfawIN za^!=eSc)66Gw6@dHw7g&4l?w;FW~=1KZSt^VeU>fR--m-U{wK7N=`VN#aPR4S1$4_ z6csoz$3^t_L{jQ_SdRDII_*S62?j9+n#%%m6}CDL^mSu~9l-2=Mi0kxxpjt}PEUem|n#~hXw^g zN$EVZoTsd*v@d$yS(wVF1;DG$o*I*oRU*K<_n^J;U@g-+f#)Sg*r~4E@H4UpKb^hW z&SCddb ztrrWjX(4r4*c&Bq>F4phhI!pTzT!av!=WEN5O}2CJoOFwfEe%(0zxKMm6lY^j8us| z1!-zm_gn<}?2ppl2tF5Wwv zDHdK%Jev02Carx}rnehXwN%tOs}P?Cs@#A4PT)nuVGzR>zRA6uj5Dm`%5R{y2z!N( zodz)!JaQxoB+5XmzTZA{q9anR zKvWcz&y7oi!dD<{^`Zo$$o(L?!^F{Fc`2uNqqGszkJKB)F;S)n(3^rbHntW(@Vefc z{)bcR)}aFs#Ke!awa*VW5Nt!rCnKd{>E9YRZXPTXZq^NjH?JDke=BcXdTfw2ZBnI= zVP7|s|JxvrY#&eC`1!W!j{YX)=^D6c>wfwcizsRWyUAm_{psZvpXWM9vh| z7!6hS5I&uBn9h*bEI$2vsdIa_1I+g9Uy~%hIz}=(M}GC7OyWM>f!OZQM(!{*Z7Zwn z_zi5FD(^lP-6wdn?~B;(MzMeJWIu?s-49ebkek_0@;nG;-&V8zs7kY?-n8>?dWTKr zFr#QcyXi3Bb_?0GkBU4Kn?olRXoz=$56+8jMOIjEaCY(71#_B@QBIr0)c@{in) zS2^w?9KIGk?$bXmS2-D_IY^E?9-leJ>F?GI>`$zplop)~tsm1w()olp*mgPkq^>Rh z_df`o4N1d`naz>xH8FqiOf)#jd!& zuL#bW(aNWbwywtHyaD@=?F)$|7R($DB>96hHm~j?v;GL=czG* zWj(vuvI7Sy7uIHcFE7p`gV*Y)m!Q%n0GuUeBC({@>`yGw#$fSgS{39$ym~`y$CKGw zGt?k|(gQc6P~VAXjZD!>MLZCU!;sZo@v@)5b2L?!xMH1fo&W%v#^#}pSpKoEfxTDA%H*RD-76Cx@ z7DGK&ejTpX(ovFASs$M+4LWT7sf5e6z`Npqn+F8g3(gOd6iU8DShcH}K3Cc!tg#ie zzZfnP3L=Dyw;vAHsI}943zc@CZueNJvSAK7ZRihqe0dY*;=T1anF$*5uhe&!Jzv(Y zi79k`f5A+*JMw06QnsJu5qh^ zxHm@s)Kq8eM2o8N3FCsFj{@`a1_>NX`4=!JOISEHjDY+n3I(JoWlnI$XwdfFcXP{B z!ec+%h9#%5##15-{zlV-t0&*|RyG}5Y4sE&{LV;( zg}2%b9^aBk8LHjo^*5ycB`js6$@KK6p%zE{Pa`OIWykzu{!S?q9f`#b6HVz&ZXsE& zni5kJ15If&GYh9qGjooIi)L0YD$UF--NvLX5MGO&7IsE^mln^$r~@sZzlhibi|0CZ zS-mKZmw~%hS9ZbOn#W|UJ-YY0ti5ogvIw7dyxj=D51O(z0ZUHZHbEQlvbG`nmEE>s V-^XO_BChtj?V@hK$vy-q{tq)sSegI; diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.png b/Documentation/media/uapi/v4l/pixfmt-nv12mt_files/nv12mt_example.png new file mode 100644 index 0000000000000000000000000000000000000000..7775f5d7cc4661b7ec082e7ed5542eddb7dc65de GIT binary patch literal 5261 zcma)=c{r4B+s7yC7-VT=&)A7HwnD|s7-j}Bma=Bw##)Rlk!5BumMl?{>>od%VwcJog{heO~wZJ! z(hLANmQS~5fsFL^`&GbW`isc}ei;q`)TXfSJ2BJu5Er!BWdI;d1^|d60sy=8Pf-g1 zKoArF_~8fuXk`Ha{MU1uO)mlf3=&u)3%#SGqp7K>rluw;mHPDQ)78~gV`F1EIXM^% zCL|;j8yoBB=$Mz6cXUL>({ufK@YJIt005msJEG;FkNzxwZK!y<WU3jpwvpUd^rb__mE)Tc<+u@sEXMVhS({a^es{F~vkel7U-ko;V6ZyGl zG+=9C;S(|DjkCj2&wCdK2YT*>_O{`aWSqVIAUQ6=+WOgLgEAtq(a3-j7Fum=^xVZM z#MY+C>Z<=Wy9P)5QmpYyLp0UMU?d~GHwfQmYW&90e)4fq?@jz0XGgN-)mE(W&xwiU z?(X-#UQ6BYN)yQA*$*nhZ;fW&&9X3?sj1GiFmEx(&OWPmcW@}k&Yo*&PQPNFpOfI_hiQ&L_S z83GZkffUEOjFDiNjUp{t9A!)+B6e6C%i z(f-u4&d;azxf(9^0HxVZYV+Cff3>u@4i zKUn|$C3Cr{4iY=Rl3nBV>AwxwaGZAQ<-iD}CEV808xo%3+xPbQYM-6h@Rh!kBSOGD zM`5)!%*1^Da|VfcCP0xm!*w+z;7%;Ct)KgthL8jRrOPzs84nQQ~eQUkf zY&;3NE&c-)l^Pcn?{dp8jb1Ps(&i){OnybxCyZ3v6RaBXsykx-nr=@JH|9(I`c=!e zzuU6c@yTfvwNjyP;ugT-NC6R{^&eAWrJ3bMPD^cQC+aNPQpIy^>axUicZe@ymr3B0 zYCHsOnGdzjE3Y|EJ1V+eZq64XsqlpksbtoCfpNp6P*YzCLr`m`^{a zIi?*}ilwS4et+7#RQuIAdU_%*K)DQCHW}nx2NIUN2fncEs|>z3LE7^q?G>RCG838VR6qBRQ)GrmGjEiy zHwbYFsKrBmNu3H`aAJW6t=r8yT%FKtexK$6!z(9PU9=bTU*|^OPrj0tVHIAiZ2tI^ z{_3kKY^+jhSa9p2?&u<9KAf^QU^gpGT#}9gi*HEGM&nQvsIusIY0Mh0rrb<_rh0oy z;>Iw%mz22pE0VlI*a}eDBpE-SNUM6b`$O75{P#ZQsfsvM^v7w9ip@<9=LrcVyP+}W zSj1dJjWbqZT?o;hmjqOdLolyizftEIl-PH{NDwr-)gB8!p<0<0lb~bGBXFDaqQ zWbi_wo+H4EjhPV9xiC&NICRxVYcVZlU!YthA;;zUZoJIcY))zZ ze2P{FW1g>&d`DEXo1t+{O}I7IyL)&h+Ir?tZm z)_qO9mtPI~*KjtMpVvP8;J>{6J23F@MGlap3Zi`3P&poqJ~Rn?64!z zW^av>sk}cIUJ&%_ZT2#p(Wz=VD0AcUfT4FcFU!s7rB`k5!y+aJG(95<1{>$(E$XQ6 z{h6Fx3O;SIRxRw`UcLs|TkF=FNqM6^q8u;M&N$!eqh#{!>4jOrCC!XIy$-waMae6b z5j8H@3E$x_mLDyG)atqC9(ERd;Vf?%Hfellv*-9azwW}*vF0-$C#sQ(P5Nw*=k<%R%uEZ(EPAXx$Gm&_Pe>5DR;@iF;}bub!V_zTS5$$ z!d3HjpDb5XLUChUFt)xrp8MkBG1(m4iQDt!p6V`r0cIfl4ooFAY8+L5k$GCb?DEKg ztEERc`Jd-xrWA(HHVJ8GKO2-HY)q)gMM-L?Q!_p z8=D#}CyabAb3l%$*3oo(;Zg0{xYT8vj5#z(+(VL*pTBb<(d<_18$Y|uTaUrk4_pwl;uzLTHP;H?d*~Ni3{GjG#PcX(ZXXYltp?={3ZLR zpoTdlpQ0dGxb20waIL$EwRy`YS0H6Qmhx`fch(?X-EHO4@606GfhCsLz3}tJEj9gF zdBxx*0SkjXS1@HHV{_yqh`iWFZ2R^zsJ|hANYb3G?T|2#+<^N(fsf?m!1pFh z)~;7-cwGA*T>|$`m6&12MeP%i?xf!3MlSa}ouzx#ByOMl9l^n>LabJD473NKgdGdr zOLb0U=h(<)EG#l=eUXd2*d@^tbA_N`;-}Mtu7a>VMMq)z?=rp^b%rz$ik=D@-l=g)W((v@`r+5v z*q@?mx#zrE(>ZLwL0sy_suXyF=y1}tu$zk6O_*H>U46j#n>pGk8YR| z5z4O?AzD51SO{6AFmd*EODG$I(@q^E@ouSmH-eP6CEXRn=U$%yL^R7Ly2=onZdv0D z@ad)!J@R@yhNWM=eX2vs6m$+eaSNW-wwXRu+!}|va4YmIEP+Ic8JZeuj2#57OFfYM zyGguG#`1Jb_8JBnDAaDF3CC@Enz^1&CIcQ{I1L z@Le<4Jr0|SYWqSkI3`&2FZxM!qkcYWXw|9+lTOB8XPCFSt zlK6GpJT|6DyO1y!C#c7l5mTWm0Tls(Ejn`c{}=aU#l6~Rta;Lp!}l(Bxr!;1O9b|F z1;wYip@gL0JOt13_WeOFC*R`F2l}8QK1TChwke?Aq{trhN*wx$xZ@GI zH>0Xa!teJU9Ecrm%K|Zy9}hzJ?(o3b* zF753Iq>I>+0P@aMbfCw%`=uMBq8l8)MY<18`&BJ(rj-xTnOC;*+L=Tno5Yz2*w*gIBbkD|g7r zZJW*6LRAgRw`;?4YS{fqSru^ONBa-vGjG>$0XRYaS01dgwNd*kE4{z`+5>#dU#Ua} z>gb+eHmv6Tw92SK2x|yqcETF34*xDlkprRpUbDZ-x6@u+~c zSC3jxiB=`;oiL3zv5r#~D;(|l13GZDs=Gbg3i!-ro{z!AR!3-DP}IxH{3@ajLkbPt>%O<-<-y=LKxh zmQBj(vf0Wm&eJQ2OVmN8NI;hck(m#G6gu?uXm(uFL4gQQ zX1JKR&ZFc_-lGD8Pz5srop6JaF54$8^Ghh^EY=opn{8MCfxNamXJ0K3}iyE)!hVz#!`h6hF%YCct;*elte8HY2T*tFGlA-=SUq;t4`Mm4I zC32b++wY8~tr5#vC)w9(PC7o3`zKg48v^L(5Ki8Cmlb0(X^;)MugD|#E92RbhzQS{ zcVHH!yy~AXGe7Y_=GFv6Hb%gfTDpZsh&0&sZ_+)s7&(on$&;9_$TF|Vgo|^MiSS<; zK~fb+i^);G$p!y-74d>#c2uKryhtiT)+`|T-&d5OC=Xm3Vw1;M&X(z zl4O(duhbWcdA!md+1h<&klM4!?cZ&OoFhx^UPp8LpezUz2mPj>~#`EoCxz3LTk|-10g47 zjN&>%4#8X(#&aA)er*0}WdoNRE8ACbS-eXEx$qowlQTRDmJhy^d>TB>#<8mHIs!2R zXR398(luH-*b3tP3|B{RDk_jh&66)-XK_e+7>xT^aar`NVn)~*;{sq9e~$pNHvvC@ z4$z!W5#?7v_bVMddgwCE{wrPIit51Y%ELkesvI}_+^0#156h_s)^RvU(Qk}t`Bvr2 zFiZ&qBV>KyHy26~f)+|+wkGPur|S=VhBZ?b6lKm9GCHX(dr^d|+NBqnFvSMnr%qAN znC3ggw;2khv04*B`;1c8I2%st@oV7{w&%Hz5GV^muY#iv8nLLZme!@-)dAxS(<8Fe z68CiU07?J-*ns}4z)s2}!{Ad=$@`16W=sd3= Date: Mon, 15 Aug 2016 13:05:05 -0300 Subject: [PATCH 041/591] [media] vidioc-enumstd.rst: fix a broken reference Somehow, the conversion broke a reference here. Re-add it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-enumstd.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index 6699b26cdeb4..a936fe32ce9c 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -269,7 +269,7 @@ support digital TV. See also the Linux DVB API at .. _video-standards: -.. flat-table:: Video Standards (based on []) +.. flat-table:: Video Standards (based on :ref:`itu470`) :header-rows: 1 :stub-columns: 0 From 187594418d37b29d02a22f5d15db51ea4df70957 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 15 Aug 2016 13:37:54 -0300 Subject: [PATCH 042/591] [media] vidioc-enumstd.rst: remove bullets from sound carrier The items at the sound carrier had a bullet. Those are not needed. So, get rid of them. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/vidioc-enumstd.rst | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index a936fe32ce9c..f61f0c6b0723 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -330,8 +330,7 @@ support digital TV. See also the Linux DVB API at - 4433618.75 ± 1 - - :cspan:`3` f\ :sub:`OR` = 4406250 ± 2000, f\ :sub:`OB` = 4250000 - ± 2000 + - :cspan:`3` f\ :sub:`OR` = 4406250 ± 2000, f\ :sub:`OB` = 4250000 ± 2000 - .. row 5 @@ -363,27 +362,27 @@ support digital TV. See also the Linux DVB API at - Sound carrier relative to vision carrier (MHz) - - + 4.5 + - 4.5 - - + 4.5 + - 4.5 - - + 4.5 + - 4.5 - - + 5.5 ± 0.001 [#f4]_ [#f5]_ [#f6]_ [#f7]_ + - 5.5 ± 0.001 [#f4]_ [#f5]_ [#f6]_ [#f7]_ - - + 6.5 ± 0.001 + - 6.5 ± 0.001 - - + 5.5 + - 5.5 - - + 5.9996 ± 0.0005 + - 5.9996 ± 0.0005 - - + 5.5 ± 0.001 + - 5.5 ± 0.001 - - + 6.5 ± 0.001 + - 6.5 ± 0.001 - - + 6.5 + - 6.5 - - + 6.5 [#f8]_ + - 6.5 [#f8]_ Return Value From b6b6e67824ec0593878afbee5958d80205606210 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 15 Aug 2016 17:49:50 -0300 Subject: [PATCH 043/591] [media] docs-rst: better use the .. note:: tag Change multi-line note tags to be more symetric, e. g. not starting the text together witht the tag. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/cec/cec-func-close.rst | 4 +++- Documentation/media/uapi/cec/cec-func-ioctl.rst | 4 +++- Documentation/media/uapi/cec/cec-func-open.rst | 4 +++- Documentation/media/uapi/cec/cec-func-poll.rst | 4 +++- Documentation/media/uapi/cec/cec-intro.rst | 4 +++- .../media/uapi/cec/cec-ioc-adap-g-caps.rst | 4 +++- .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst | 4 +++- .../media/uapi/cec/cec-ioc-adap-g-phys-addr.rst | 4 +++- Documentation/media/uapi/cec/cec-ioc-dqevent.rst | 4 +++- Documentation/media/uapi/cec/cec-ioc-g-mode.rst | 4 +++- Documentation/media/uapi/cec/cec-ioc-receive.rst | 4 +++- .../media/uapi/dvb/dvb-fe-read-status.rst | 4 +++- Documentation/media/uapi/dvb/dvbapi.rst | 4 +++- Documentation/media/uapi/dvb/dvbproperty.rst | 4 +++- Documentation/media/uapi/dvb/examples.rst | 4 +++- Documentation/media/uapi/dvb/fe-get-info.rst | 4 +++- Documentation/media/uapi/dvb/fe-read-status.rst | 4 +++- Documentation/media/uapi/dvb/frontend.rst | 4 +++- .../media/uapi/rc/lirc-set-wideband-receiver.rst | 4 +++- Documentation/media/uapi/v4l/audio.rst | 4 +++- Documentation/media/uapi/v4l/buffer.rst | 13 ++++++++++--- Documentation/media/uapi/v4l/crop.rst | 12 +++++++++--- Documentation/media/uapi/v4l/dev-codec.rst | 4 +++- Documentation/media/uapi/v4l/dev-osd.rst | 4 +++- Documentation/media/uapi/v4l/dev-overlay.rst | 8 ++++++-- Documentation/media/uapi/v4l/dev-rds.rst | 4 +++- .../media/uapi/v4l/extended-controls.rst | 4 +++- Documentation/media/uapi/v4l/func-mmap.rst | 4 +++- Documentation/media/uapi/v4l/pixfmt-006.rst | 4 +++- Documentation/media/uapi/v4l/pixfmt-007.rst | 12 +++++++++--- Documentation/media/uapi/v4l/pixfmt-sbggr16.rst | 4 +++- Documentation/media/uapi/v4l/pixfmt-y16-be.rst | 4 +++- Documentation/media/uapi/v4l/pixfmt-y16.rst | 4 +++- Documentation/media/uapi/v4l/standard.rst | 4 +++- Documentation/media/uapi/v4l/tuner.rst | 4 +++- Documentation/media/uapi/v4l/userp.rst | 4 +++- .../media/uapi/v4l/vidioc-dv-timings-cap.rst | 4 +++- .../media/uapi/v4l/vidioc-enum-dv-timings.rst | 4 +++- Documentation/media/uapi/v4l/vidioc-enum-fmt.rst | 9 ++++++--- .../uapi/v4l/vidioc-enum-frameintervals.rst | 4 +++- .../media/uapi/v4l/vidioc-enum-framesizes.rst | 4 +++- .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 4 +++- .../media/uapi/v4l/vidioc-enumaudioout.rst | 4 +++- .../media/uapi/v4l/vidioc-g-audioout.rst | 4 +++- Documentation/media/uapi/v4l/vidioc-g-edid.rst | 4 +++- .../media/uapi/v4l/vidioc-g-ext-ctrls.rst | 8 ++++++-- .../media/uapi/v4l/vidioc-g-modulator.rst | 4 +++- .../media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 4 +++- Documentation/media/uapi/v4l/vidioc-g-tuner.rst | 8 ++++++-- Documentation/media/uapi/v4l/vidioc-qbuf.rst | 4 +++- .../media/uapi/v4l/vidioc-query-dv-timings.rst | 4 +++- .../media/uapi/v4l/vidioc-queryctrl.rst | 16 ++++++++++++---- Documentation/media/uapi/v4l/vidioc-querystd.rst | 4 +++- Documentation/media/uapi/v4l/vidioc-streamon.rst | 4 +++- .../media/uapi/v4l/vidioc-subscribe-event.rst | 4 +++- Documentation/media/v4l-drivers/bttv.rst | 1 + 56 files changed, 206 insertions(+), 69 deletions(-) diff --git a/Documentation/media/uapi/cec/cec-func-close.rst b/Documentation/media/uapi/cec/cec-func-close.rst index bb94e4358910..bdbb9e545ae4 100644 --- a/Documentation/media/uapi/cec/cec-func-close.rst +++ b/Documentation/media/uapi/cec/cec-func-close.rst @@ -32,7 +32,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. Closes the cec device. Resources associated with the file descriptor are diff --git a/Documentation/media/uapi/cec/cec-func-ioctl.rst b/Documentation/media/uapi/cec/cec-func-ioctl.rst index d0279e6d2734..170bdd56211e 100644 --- a/Documentation/media/uapi/cec/cec-func-ioctl.rst +++ b/Documentation/media/uapi/cec/cec-func-ioctl.rst @@ -38,7 +38,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. The :c:func:`ioctl()` function manipulates cec device parameters. The diff --git a/Documentation/media/uapi/cec/cec-func-open.rst b/Documentation/media/uapi/cec/cec-func-open.rst index 38fd7e0cfccd..c83989acfc83 100644 --- a/Documentation/media/uapi/cec/cec-func-open.rst +++ b/Documentation/media/uapi/cec/cec-func-open.rst @@ -45,7 +45,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. To open a cec device applications call :c:func:`open()` with the diff --git a/Documentation/media/uapi/cec/cec-func-poll.rst b/Documentation/media/uapi/cec/cec-func-poll.rst index fcab65f6d6b8..5d1e0525056e 100644 --- a/Documentation/media/uapi/cec/cec-func-poll.rst +++ b/Documentation/media/uapi/cec/cec-func-poll.rst @@ -29,7 +29,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. With the :c:func:`poll()` function applications can wait for CEC diff --git a/Documentation/media/uapi/cec/cec-intro.rst b/Documentation/media/uapi/cec/cec-intro.rst index afa76f26fdde..4a19ea5323a9 100644 --- a/Documentation/media/uapi/cec/cec-intro.rst +++ b/Documentation/media/uapi/cec/cec-intro.rst @@ -3,7 +3,9 @@ Introduction ============ -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. HDMI connectors provide a single pin for use by the Consumer Electronics diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst index eaedc63186e6..2516d4c3a4c8 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst @@ -31,7 +31,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. All cec devices must support :ref:`ioctl CEC_ADAP_G_CAPS `. To query diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index 04ee90099676..359f7b3aa91a 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst @@ -35,7 +35,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. To query the current CEC logical addresses, applications call diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst index b955d044b334..c50aa3ee1e0d 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst @@ -34,7 +34,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. To query the current physical address applications call diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index 7a6d6d00ce19..36eb4f907d30 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -32,7 +32,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. CEC devices can send asynchronous events. These can be retrieved by diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst index f0084d892db6..c0e851f357d0 100644 --- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst @@ -30,7 +30,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. By default any filehandle can use :ref:`CEC_TRANSMIT`, but in order to prevent diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index ae5a39ade45f..7167a90209df 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -33,7 +33,9 @@ Arguments Description =========== -.. note:: This documents the proposed CEC API. This API is not yet finalized +.. note:: + + This documents the proposed CEC API. This API is not yet finalized and is currently only available as a staging kernel module. To receive a CEC message the application has to fill in the diff --git a/Documentation/media/uapi/dvb/dvb-fe-read-status.rst b/Documentation/media/uapi/dvb/dvb-fe-read-status.rst index fcffaa7e1463..76c20612b274 100644 --- a/Documentation/media/uapi/dvb/dvb-fe-read-status.rst +++ b/Documentation/media/uapi/dvb/dvb-fe-read-status.rst @@ -17,7 +17,9 @@ using :ref:`FE_READ_STATUS`. Signal statistics are provided via :ref:`FE_GET_PROPERTY`. -.. note:: Most statistics require the demodulator to be fully locked +.. note:: + + Most statistics require the demodulator to be fully locked (e. g. with FE_HAS_LOCK bit set). See :ref:`Frontend statistics indicators ` for more details. diff --git a/Documentation/media/uapi/dvb/dvbapi.rst b/Documentation/media/uapi/dvb/dvbapi.rst index 48e61aba741e..37680137e3f2 100644 --- a/Documentation/media/uapi/dvb/dvbapi.rst +++ b/Documentation/media/uapi/dvb/dvbapi.rst @@ -8,7 +8,9 @@ Part II - Digital TV API ######################## -.. note:: This API is also known as **DVB API**, although it is generic +.. note:: + + This API is also known as **DVB API**, although it is generic enough to support all digital TV standards. **Version 5.10** diff --git a/Documentation/media/uapi/dvb/dvbproperty.rst b/Documentation/media/uapi/dvb/dvbproperty.rst index cd0511b06c2c..a5a859a45381 100644 --- a/Documentation/media/uapi/dvb/dvbproperty.rst +++ b/Documentation/media/uapi/dvb/dvbproperty.rst @@ -20,7 +20,9 @@ Also, the union didn't have any space left to be expanded without breaking userspace. So, the decision was to deprecate the legacy union/struct based approach, in favor of a properties set approach. -.. note:: On Linux DVB API version 3, setting a frontend were done via +.. note:: + + On Linux DVB API version 3, setting a frontend were done via :ref:`struct dvb_frontend_parameters `. This got replaced on version 5 (also called "S2API", as this API were added originally_enabled to provide support for DVB-S2), because the diff --git a/Documentation/media/uapi/dvb/examples.rst b/Documentation/media/uapi/dvb/examples.rst index bf0a8617de92..9a4ae4b0f3d7 100644 --- a/Documentation/media/uapi/dvb/examples.rst +++ b/Documentation/media/uapi/dvb/examples.rst @@ -9,7 +9,9 @@ Examples In this section we would like to present some examples for using the DVB API. -..note:: This section is out of date, and the code below won't even +..note:: + + This section is out of date, and the code below won't even compile. Please refer to the `libdvbv5 `__ for updated/recommended examples. diff --git a/Documentation/media/uapi/dvb/fe-get-info.rst b/Documentation/media/uapi/dvb/fe-get-info.rst index bb6c32e47ce8..dfc7644f9dac 100644 --- a/Documentation/media/uapi/dvb/fe-get-info.rst +++ b/Documentation/media/uapi/dvb/fe-get-info.rst @@ -144,7 +144,9 @@ struct dvb_frontend_info - Capabilities supported by the frontend -.. note:: The frequencies are specified in Hz for Terrestrial and Cable +.. note:: + + The frequencies are specified in Hz for Terrestrial and Cable systems. They're specified in kHz for Satellite systems diff --git a/Documentation/media/uapi/dvb/fe-read-status.rst b/Documentation/media/uapi/dvb/fe-read-status.rst index 624ed9d06488..defe30d036ec 100644 --- a/Documentation/media/uapi/dvb/fe-read-status.rst +++ b/Documentation/media/uapi/dvb/fe-read-status.rst @@ -40,7 +40,9 @@ used to check about the locking status of the frontend after being tuned. The ioctl takes a pointer to an integer where the status will be written. -.. note:: The size of status is actually sizeof(enum fe_status), with +.. note:: + + The size of status is actually sizeof(enum fe_status), with varies according with the architecture. This needs to be fixed in the future. diff --git a/Documentation/media/uapi/dvb/frontend.rst b/Documentation/media/uapi/dvb/frontend.rst index 48c5cd487ce7..e051a9012540 100644 --- a/Documentation/media/uapi/dvb/frontend.rst +++ b/Documentation/media/uapi/dvb/frontend.rst @@ -29,7 +29,9 @@ The frontend can be accessed through ``/dev/dvb/adapter?/frontend?``. Data types and ioctl definitions can be accessed by including ``linux/dvb/frontend.h`` in your application. -.. note:: Transmission via the internet (DVB-IP) is not yet handled by this +.. note:: + + Transmission via the internet (DVB-IP) is not yet handled by this API but a future extension is possible. On Satellite systems, the API support for the Satellite Equipment diff --git a/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst b/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst index cffb01fd1042..b9d582fd7df1 100644 --- a/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst +++ b/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst @@ -42,7 +42,9 @@ that prevents them to be used with some remotes. Wide band receiver might also be more precise. On the other hand its disadvantage it usually reduced range of reception. -.. note:: Wide band receiver might be implictly enabled if you enable +.. note:: + + Wide band receiver might be implictly enabled if you enable carrier reports. In that case it will be disabled as soon as you disable carrier reports. Trying to disable wide band receiver while carrier reports are active will do nothing. diff --git a/Documentation/media/uapi/v4l/audio.rst b/Documentation/media/uapi/v4l/audio.rst index 4dd11345866c..b8059fb05372 100644 --- a/Documentation/media/uapi/v4l/audio.rst +++ b/Documentation/media/uapi/v4l/audio.rst @@ -37,7 +37,9 @@ The :ref:`VIDIOC_G_AUDIO ` and :ref:`VIDIOC_G_AUDOUT ` ioctls report the current audio input and output, respectively. -.. note:: Note that, unlike :ref:`VIDIOC_G_INPUT ` and +.. note:: + + Note that, unlike :ref:`VIDIOC_G_INPUT ` and :ref:`VIDIOC_G_OUTPUT ` these ioctls return a structure as :ref:`VIDIOC_ENUMAUDIO` and :ref:`VIDIOC_ENUMAUDOUT ` do, not just an index. diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index 5deb4a46f992..f75f959b960b 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -166,12 +166,15 @@ struct v4l2_buffer output device because the application did not pass new data in time. - .. note:: This may count the frames received e.g. over USB, without + .. note:: + + This may count the frames received e.g. over USB, without taking into account the frames dropped by the remote hardware due to limited compression throughput or bus bandwidth. These devices identify by not enumerating any video standards, see :ref:`standard`. + - .. row 10 - __u32 @@ -299,7 +302,9 @@ struct v4l2_plane ``bytesused`` will be set to the size of the plane (see the ``length`` field of this struct) by the driver. - .. note:: Note that the actual image data starts at ``data_offset`` + .. note:: + + Note that the actual image data starts at ``data_offset`` which may not be 0. - .. row 2 @@ -371,7 +376,9 @@ struct v4l2_plane field when ``type`` refers to a capture stream, applications when it refers to an output stream. - .. note:: That data_offset is included in ``bytesused``. So the + .. note:: + + That data_offset is included in ``bytesused``. So the size of the image in the plane is ``bytesused``-``data_offset`` at offset ``data_offset`` from the start of the plane. diff --git a/Documentation/media/uapi/v4l/crop.rst b/Documentation/media/uapi/v4l/crop.rst index 0913822347af..4622884b06ea 100644 --- a/Documentation/media/uapi/v4l/crop.rst +++ b/Documentation/media/uapi/v4l/crop.rst @@ -15,7 +15,9 @@ offset into a video signal. Applications can use the following API to select an area in the video signal, query the default area and the hardware limits. -.. note:: Despite their name, the :ref:`VIDIOC_CROPCAP `, +.. note:: + + Despite their name, the :ref:`VIDIOC_CROPCAP `, :ref:`VIDIOC_G_CROP ` and :ref:`VIDIOC_S_CROP ` ioctls apply to input as well as output devices. @@ -38,7 +40,9 @@ support scaling or the :ref:`VIDIOC_G_CROP ` and :ref:`VIDIOC_S_CROP ` ioctls. Their size (and position where applicable) will be fixed in this case. -.. note:: All capture and output devices must support the +.. note:: + + All capture and output devices must support the :ref:`VIDIOC_CROPCAP ` ioctl such that applications can determine if scaling takes place. @@ -144,7 +148,9 @@ reopening a device, such that piping data into or out of a device will work without special preparations. More advanced applications should ensure the parameters are suitable before starting I/O. -.. note:: On the next two examples, a video capture device is assumed; +.. note:: + + On the next two examples, a video capture device is assumed; change ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` for other types of device. Example: Resetting the cropping parameters diff --git a/Documentation/media/uapi/v4l/dev-codec.rst b/Documentation/media/uapi/v4l/dev-codec.rst index dfb20328e34d..d9f218449ddd 100644 --- a/Documentation/media/uapi/v4l/dev-codec.rst +++ b/Documentation/media/uapi/v4l/dev-codec.rst @@ -21,7 +21,9 @@ for both capture and output to start the codec. Video compression codecs use the MPEG controls to setup their codec parameters -.. note:: The MPEG controls actually support many more codecs than +.. note:: + + The MPEG controls actually support many more codecs than just MPEG. See :ref:`mpeg-controls`. Memory-to-memory devices can often be used as a shared resource: you can diff --git a/Documentation/media/uapi/v4l/dev-osd.rst b/Documentation/media/uapi/v4l/dev-osd.rst index fadda131f020..4e1ee79ec334 100644 --- a/Documentation/media/uapi/v4l/dev-osd.rst +++ b/Documentation/media/uapi/v4l/dev-osd.rst @@ -16,7 +16,9 @@ this interface, which borrows structures and ioctls of the The OSD function is accessible through the same character special file as the :ref:`Video Output ` function. -.. note:: The default function of such a ``/dev/video`` device is video +.. note:: + + The default function of such a ``/dev/video`` device is video capturing or output. The OSD function is only available after calling the :ref:`VIDIOC_S_FMT ` ioctl. diff --git a/Documentation/media/uapi/v4l/dev-overlay.rst b/Documentation/media/uapi/v4l/dev-overlay.rst index 92b4471b0c6e..d47a6bbc2e98 100644 --- a/Documentation/media/uapi/v4l/dev-overlay.rst +++ b/Documentation/media/uapi/v4l/dev-overlay.rst @@ -19,7 +19,9 @@ video into a window. Video overlay devices are accessed through the same character special files as :ref:`video capture ` devices. -.. note:: The default function of a ``/dev/video`` device is video +.. note:: + + The default function of a ``/dev/video`` device is video capturing. The overlay function is only available after calling the :ref:`VIDIOC_S_FMT ` ioctl. @@ -236,7 +238,9 @@ exceeded are undefined. [#f3]_ :ref:`VIDIOC_S_FBUF `, :ref:`framebuffer-flags`). - .. note:: This field was added in Linux 2.6.23, extending the + .. note:: + + This field was added in Linux 2.6.23, extending the structure. However the :ref:`VIDIOC_[G|S|TRY]_FMT ` ioctls, which take a pointer to a :ref:`v4l2_format ` parent structure with padding bytes at the end, are not affected. diff --git a/Documentation/media/uapi/v4l/dev-rds.rst b/Documentation/media/uapi/v4l/dev-rds.rst index cd6ad63cb90b..fa32538d4c1f 100644 --- a/Documentation/media/uapi/v4l/dev-rds.rst +++ b/Documentation/media/uapi/v4l/dev-rds.rst @@ -14,7 +14,9 @@ at devices capable of receiving and/or transmitting RDS information. For more information see the core RDS standard :ref:`iec62106` and the RBDS standard :ref:`nrsc4`. -.. note:: Note that the RBDS standard as is used in the USA is almost +.. note:: + + Note that the RBDS standard as is used in the USA is almost identical to the RDS standard. Any RDS decoder/encoder can also handle RBDS. Only some of the fields have slightly different meanings. See the RBDS standard for more information. diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 71071d73747d..782f7f3c2209 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -184,7 +184,9 @@ Codec Control Reference Below all controls within the Codec control class are described. First the generic controls, then controls specific for certain hardware. -.. note:: These controls are applicable to all codecs and not just MPEG. The +.. note:: + + These controls are applicable to all codecs and not just MPEG. The defines are prefixed with V4L2_CID_MPEG/V4L2_MPEG as the controls were originally made for MPEG codecs and later extended to cover all encoding formats. diff --git a/Documentation/media/uapi/v4l/func-mmap.rst b/Documentation/media/uapi/v4l/func-mmap.rst index c156fb7b7422..639fef5b4f78 100644 --- a/Documentation/media/uapi/v4l/func-mmap.rst +++ b/Documentation/media/uapi/v4l/func-mmap.rst @@ -78,7 +78,9 @@ Arguments ``MAP_SHARED`` allows applications to share the mapped memory with other (e. g. child-) processes. - .. note:: The Linux ``videobuf`` module which is used by some + .. note:: + + The Linux ``videobuf`` module which is used by some drivers supports only ``MAP_SHARED``. ``MAP_PRIVATE`` requests copy-on-write semantics. V4L2 applications should not set the ``MAP_PRIVATE``, ``MAP_DENYWRITE``, ``MAP_EXECUTABLE`` or ``MAP_ANON`` diff --git a/Documentation/media/uapi/v4l/pixfmt-006.rst b/Documentation/media/uapi/v4l/pixfmt-006.rst index 987b9a8a9eb4..1c8321f9b1fb 100644 --- a/Documentation/media/uapi/v4l/pixfmt-006.rst +++ b/Documentation/media/uapi/v4l/pixfmt-006.rst @@ -19,7 +19,9 @@ colorspace field of struct :ref:`v4l2_pix_format ` or struct :ref:`v4l2_pix_format_mplane ` needs to be filled in. -.. note:: The default R'G'B' quantization is full range for all +.. note:: + + The default R'G'B' quantization is full range for all colorspaces except for BT.2020 which uses limited range R'G'B' quantization. diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index 8c946b0c63a0..39753f6f7b83 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -538,7 +538,9 @@ projectors that use the DCI-P3 colorspace. The default transfer function is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is ``V4L2_YCBCR_ENC_709``. -.. note:: Note that this colorspace does not specify a +.. note:: + + Note that this colorspace does not specify a Y'CbCr encoding since it is not meant to be encoded to Y'CbCr. So this default Y'CbCr encoding was picked because it is the HDTV encoding. The default Y'CbCr quantization is limited range. The chromaticities of the @@ -754,7 +756,9 @@ reference are: - 0.316 -.. note:: This colorspace uses Illuminant C instead of D65 as the white +.. note:: + + This colorspace uses Illuminant C instead of D65 as the white reference. To correctly convert an image in this colorspace to another that uses D65 you need to apply a chromatic adaptation algorithm such as the Bradford method. @@ -888,7 +892,9 @@ reference are identical to sRGB. The transfer function use is with full range quantization where Y' is scaled to [0…255] and Cb/Cr are scaled to [-128…128] and then clipped to [-128…127]. -.. note:: The JPEG standard does not actually store colorspace +.. note:: + + The JPEG standard does not actually store colorspace information. So if something other than sRGB is used, then the driver will have to set that information explicitly. Effectively ``V4L2_COLORSPACE_JPEG`` can be considered to be an abbreviation for diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst index 14446ed7f650..7f295b48748c 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst @@ -19,7 +19,9 @@ This format is similar to has a depth of 16 bits. The least significant byte is stored at lower memory addresses (little-endian). -..note:: The actual sampling precision may be lower than 16 bits, +..note:: + + The actual sampling precision may be lower than 16 bits, for example 10 bits per pixel with values in tange 0 to 1023. **Byte Order.** diff --git a/Documentation/media/uapi/v4l/pixfmt-y16-be.rst b/Documentation/media/uapi/v4l/pixfmt-y16-be.rst index 37fa099c16a6..b16874951f0f 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y16-be.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y16-be.rst @@ -17,7 +17,9 @@ Description This is a grey-scale image with a depth of 16 bits per pixel. The most significant byte is stored at lower memory addresses (big-endian). -.. note:: Tthe actual sampling precision may be lower than 16 bits, for +.. note:: + + The actual sampling precision may be lower than 16 bits, for example 10 bits per pixel with values in range 0 to 1023. **Byte Order.** diff --git a/Documentation/media/uapi/v4l/pixfmt-y16.rst b/Documentation/media/uapi/v4l/pixfmt-y16.rst index 4c41c042188b..10e2824da147 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y16.rst @@ -17,7 +17,9 @@ Description This is a grey-scale image with a depth of 16 bits per pixel. The least significant byte is stored at lower memory addresses (little-endian). -.. note:: The actual sampling precision may be lower than 16 bits, for +.. note:: + + The actual sampling precision may be lower than 16 bits, for example 10 bits per pixel with values in range 0 to 1023. **Byte Order.** diff --git a/Documentation/media/uapi/v4l/standard.rst b/Documentation/media/uapi/v4l/standard.rst index c4f678f545ec..5dd341f18839 100644 --- a/Documentation/media/uapi/v4l/standard.rst +++ b/Documentation/media/uapi/v4l/standard.rst @@ -41,7 +41,9 @@ output applications call the :ref:`VIDIOC_G_STD ` and *received* standard can be sensed with the :ref:`VIDIOC_QUERYSTD` ioctl. -..note:: The parameter of all these ioctls is a pointer to a +..note:: + + The parameter of all these ioctls is a pointer to a :ref:`v4l2_std_id ` type (a standard set), *not* an index into the standard enumeration. Drivers must implement all video standard ioctls when the device has one or more video inputs or outputs. diff --git a/Documentation/media/uapi/v4l/tuner.rst b/Documentation/media/uapi/v4l/tuner.rst index 37eb4b9b95fb..c3df65c2e320 100644 --- a/Documentation/media/uapi/v4l/tuner.rst +++ b/Documentation/media/uapi/v4l/tuner.rst @@ -28,7 +28,9 @@ struct :ref:`v4l2_tuner ` returned by :ref:`VIDIOC_G_TUNER ` does not switch the +.. note:: + + :ref:`VIDIOC_S_TUNER ` does not switch the current tuner, when there is more than one at all. The tuner is solely determined by the current video input. Drivers must support both ioctls and set the ``V4L2_CAP_TUNER`` flag in the struct :ref:`v4l2_capability diff --git a/Documentation/media/uapi/v4l/userp.rst b/Documentation/media/uapi/v4l/userp.rst index 1d8b14bd4cdc..0371e068c50b 100644 --- a/Documentation/media/uapi/v4l/userp.rst +++ b/Documentation/media/uapi/v4l/userp.rst @@ -88,7 +88,9 @@ To start and stop capturing or output applications call the :ref:`VIDIOC_STREAMON ` and :ref:`VIDIOC_STREAMOFF ` ioctl. -.. note:: ref:`VIDIOC_STREAMOFF ` removes all buffers from +.. note:: + + ref:`VIDIOC_STREAMOFF ` removes all buffers from both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything "now" on a multitasking system, if an application needs to synchronize with another event it should examine diff --git a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst index 6e05957013bb..c390412d5aa9 100644 --- a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst @@ -39,7 +39,9 @@ initialize the ``pad`` field to 0, zero the reserved array of struct ``VIDIOC_DV_TIMINGS_CAP`` ioctl on a video node and the driver will fill in the structure. -.. note:: Drivers may return different values after +.. note:: + + Drivers may return different values after switching the video input or output. When implemented by the driver DV capabilities of subdevices can be diff --git a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst index 3ba75d3fb93c..764d6cea601c 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst @@ -49,7 +49,9 @@ error code 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 ``EINVAL``. -.. note:: Drivers may enumerate a different set of DV timings after +.. note:: + + Drivers may enumerate a different set of DV timings after switching the video input or output. When implemented by the driver DV timings of subdevices can be queried diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index 90996f69d6ae..4715261631ab 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -40,7 +40,9 @@ fill the rest of the structure or return an ``EINVAL`` error code. All formats are enumerable by beginning at index zero and incrementing by one until ``EINVAL`` is returned. -.. note:: After switching input or output the list of enumerated image +.. note:: + + After switching input or output the list of enumerated image formats may be different. @@ -51,7 +53,6 @@ one until ``EINVAL`` is returned. :stub-columns: 0 :widths: 1 1 2 - - .. row 1 - __u32 @@ -113,7 +114,9 @@ one until ``EINVAL`` is returned. Several image formats are already defined by this specification in :ref:`pixfmt`. - .. attention:: These codes are not the same as those used + .. attention:: + + These codes are not the same as those used in the Windows world. - .. row 7 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst index ceae6003039e..9c22a3a6938f 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst @@ -73,7 +73,9 @@ the device supports. Only for the ``V4L2_FRMIVAL_TYPE_DISCRETE`` type does it make sense to increase the index value to receive more frame intervals. -.. note:: The order in which the frame intervals are returned has no +.. note:: + + The order in which the frame intervals are returned has no special meaning. In particular does it not say anything about potential default frame intervals. diff --git a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst index 8b268354d442..6e2adf6c23a3 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst @@ -72,7 +72,9 @@ the ``type`` field to determine the type of frame size enumeration the device supports. Only for the ``V4L2_FRMSIZE_TYPE_DISCRETE`` type does it make sense to increase the index value to receive more frame sizes. -.. note:: The order in which the frame sizes are returned has no special +.. note:: + + The order in which the frame sizes are returned has no special meaning. In particular does it not say anything about potential default format sizes. diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index 00ab5e19cc1d..ccf308bd9423 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -129,7 +129,9 @@ of the corresponding tuner/modulator is set. - :cspan:`2` The supported modulation systems of this frequency band. See :ref:`band-modulation`. - .. note:: Currently only one modulation system per frequency band + .. note:: + + Currently only one modulation system per frequency band is supported. More work will need to be done if multiple modulation systems are possible. Contact the linux-media mailing list diff --git a/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst b/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst index cde1db55834f..3112b43242f2 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst @@ -41,7 +41,9 @@ structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all audio outputs applications shall begin at index zero, incrementing by one until the driver returns ``EINVAL``. -.. note:: Connectors on a TV card to loop back the received audio signal +.. note:: + + Connectors on a TV card to loop back the received audio signal to a sound card are not audio outputs in this sense. See :ref:`VIDIOC_G_AUDIOout ` for a description of struct diff --git a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst index b1c1bfeb251e..c9e9a550e86d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst @@ -51,7 +51,9 @@ return the ``EINVAL`` error code when the index is out of bounds. This is a write-only ioctl, it does not return the current audio output attributes as ``VIDIOC_G_AUDOUT`` does. -.. note:: Connectors on a TV card to loop back the received audio signal +.. note:: + + Connectors on a TV card to loop back the received audio signal to a sound card are not audio outputs in this sense. diff --git a/Documentation/media/uapi/v4l/vidioc-g-edid.rst b/Documentation/media/uapi/v4l/vidioc-g-edid.rst index 1a982b68a72f..b881098b8964 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-edid.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-edid.rst @@ -67,7 +67,9 @@ total number of available EDID blocks and it will return 0 without copying any data. This is an easy way to discover how many EDID blocks there are. -.. note:: If there are no EDID blocks available at all, then +.. note:: + + If there are no EDID blocks available at all, then the driver will set ``blocks`` to 0 and it returns 0. To set the EDID blocks of a receiver the application has to fill in the diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index 39e24ad4b825..c91039b16d49 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -127,7 +127,9 @@ still cause this situation. to a value large enough to store the payload result and ``ENOSPC`` is returned. - .. note:: For string controls, this ``size`` field should + .. note:: + + For string controls, this ``size`` field should not be confused with the length of the string. This field refers to the size of the memory that contains the string. The actual *length* of the string may well be much smaller. @@ -265,7 +267,9 @@ still cause this situation. control and ``V4L2_CTRL_WHICH_DEF_VAL`` will return the default value of the control. - .. note:: You can only get the default value of the control, + .. note:: + + You can only get the default value of the control, you cannot set or try it. For backwards compatibility you can also use a control class here diff --git a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst index a2e8c73f0678..fcb2e4896d4d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst @@ -130,7 +130,9 @@ To change the radio frequency the shall be modulated. It contains a set of flags as defined in :ref:`modulator-txsubchans`. - .. note:: The tuner ``rxsubchans`` flags are reused, but the + .. note:: + + The tuner ``rxsubchans`` flags are reused, but the semantics are different. Video output devices are assumed to have an analog or PCM audio input with 1-3 channels. The ``txsubchans`` flags select one or more channels diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index f1f661d0200c..f3db6f677650 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -40,7 +40,9 @@ output device, applications initialize the ``type`` field of a struct driver fills in the remaining fields or returns an ``EINVAL`` error code if the sliced VBI API is unsupported or ``type`` is invalid. -.. note:: The ``type`` field was added, and the ioctl changed from read-only +.. note:: + + The ``type`` field was added, and the ioctl changed from read-only to write-read, in Linux 2.6.19. diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index 614db06b8b4b..d209736d6a53 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -391,7 +391,9 @@ To change the radio frequency the carrier for a monaural secondary language. Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this capability. - .. note:: The ``V4L2_TUNER_CAP_LANG2`` and ``V4L2_TUNER_CAP_SAP`` + .. note:: + + The ``V4L2_TUNER_CAP_LANG2`` and ``V4L2_TUNER_CAP_SAP`` flags are synonyms. ``V4L2_TUNER_CAP_SAP`` applies when the tuner supports the ``V4L2_STD_NTSC_M`` video standard. @@ -502,7 +504,9 @@ To change the radio frequency the - The tuner receives a Second Audio Program. - .. note:: The ``V4L2_TUNER_SUB_LANG2`` and ``V4L2_TUNER_SUB_SAP`` + .. note:: + + The ``V4L2_TUNER_SUB_LANG2`` and ``V4L2_TUNER_SUB_SAP`` flags are synonyms. The ``V4L2_TUNER_SUB_SAP`` flag applies when the current video standard is ``V4L2_STD_NTSC_M``. diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst b/Documentation/media/uapi/v4l/vidioc-qbuf.rst index 3b927f36fb5b..31c360d7d1a6 100644 --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst @@ -137,7 +137,9 @@ EIO ``VIDIOC_DQBUF`` failed due to an internal error. Can also indicate temporary problems like signal loss. - .. note:: The driver might dequeue an (empty) buffer despite returning + .. note:: + + The driver might dequeue an (empty) buffer despite returning an error, or even stop capturing. Reusing such buffer may be unsafe though and its details (e.g. ``index``) may not be returned either. It is recommended that drivers indicate recoverable errors by setting diff --git a/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst index 416d8d604af4..6a87f44cdf3f 100644 --- a/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst @@ -39,7 +39,9 @@ similar to sensing the video standard. To do so, applications call :ref:`v4l2_dv_timings `. Once the hardware detects the timings, it will fill in the timings structure. -.. note:: Drivers shall *not* switch timings automatically if new +.. note:: + + Drivers shall *not* switch timings automatically if new timings are detected. Instead, drivers should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support this) and expect that userspace will take action by calling :ref:`VIDIOC_QUERY_DV_TIMINGS`. diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index 8d6e61a7284d..937ce9e32a79 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -84,7 +84,9 @@ fills the rest of the structure or returns an ``EINVAL`` error code when the :ref:`v4l2_queryctrl ` ``minimum`` to ``maximum``, inclusive. -.. note:: It is possible for ``VIDIOC_QUERYMENU`` to return +.. note:: + + It is possible for ``VIDIOC_QUERYMENU`` to return an ``EINVAL`` error code for some indices between ``minimum`` and ``maximum``. In that case that particular menu item is not supported by this driver. Also note that the ``minimum`` value is not necessarily 0. @@ -188,7 +190,9 @@ See also the examples in :ref:`control`. ``_BITMASK``, ``_MENU`` or ``_INTEGER_MENU`` control. Not valid for other types of controls. - .. note:: Drivers reset controls to their default value only when + .. note:: + + Drivers reset controls to their default value only when the driver is first loaded, never afterwards. - .. row 8 @@ -306,7 +310,9 @@ See also the examples in :ref:`control`. ``_BOOLEAN``, ``_BITMASK``, ``_MENU``, ``_INTEGER_MENU``, ``_U8`` or ``_U16`` control. Not valid for other types of controls. - .. note:: Drivers reset controls to their default value only when + .. note:: + + Drivers reset controls to their default value only when the driver is first loaded, never afterwards. - .. row 8 @@ -728,7 +734,9 @@ See also the examples in :ref:`control`. case the hardware calculates the gain value based on the lighting conditions which can change over time. - .. note:: Setting a new value for a volatile control will have no + .. note:: + + Setting a new value for a volatile control will have no effect and no ``V4L2_EVENT_CTRL_CH_VALUE`` will be sent, unless the ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` flag (see below) is also set. Otherwise the new value will just be ignored. diff --git a/Documentation/media/uapi/v4l/vidioc-querystd.rst b/Documentation/media/uapi/v4l/vidioc-querystd.rst index b4a4e222c7b0..cb03d249417c 100644 --- a/Documentation/media/uapi/v4l/vidioc-querystd.rst +++ b/Documentation/media/uapi/v4l/vidioc-querystd.rst @@ -43,7 +43,9 @@ will return V4L2_STD_UNKNOWN. When detection is not possible or fails, the set must contain all standards supported by the current video input or output. -.. note:: Drivers shall *not* switch the video standard +.. note:: + + Drivers shall *not* switch the video standard automatically if a new video standard is detected. Instead, drivers should send the ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support this) and expect that userspace will take action by calling diff --git a/Documentation/media/uapi/v4l/vidioc-streamon.rst b/Documentation/media/uapi/v4l/vidioc-streamon.rst index bb23745ebcaf..7fa4362f9a81 100644 --- a/Documentation/media/uapi/v4l/vidioc-streamon.rst +++ b/Documentation/media/uapi/v4l/vidioc-streamon.rst @@ -76,7 +76,9 @@ then 0 is returned. Nothing happens in the case of ``VIDIOC_STREAMON``, but ``VIDIOC_STREAMOFF`` will return queued buffers to their starting state as mentioned above. -.. note:: Applications can be preempted for unknown periods right before +.. note:: + + Applications can be preempted for unknown periods right before or after the ``VIDIOC_STREAMON`` or ``VIDIOC_STREAMOFF`` calls, there is no notion of starting or stopping "now". Buffer timestamps can be used to synchronize with other events. diff --git a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst index 3f28e8c47960..86b16faa41bb 100644 --- a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst +++ b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst @@ -54,7 +54,9 @@ using the :ref:`VIDIOC_DQEVENT` ioctl. - Type of the event, see :ref:`event-type`. - .. note:: ``V4L2_EVENT_ALL`` can be used with + .. note:: + + ``V4L2_EVENT_ALL`` can be used with :ref:`VIDIOC_UNSUBSCRIBE_EVENT ` for unsubscribing all events at once. diff --git a/Documentation/media/v4l-drivers/bttv.rst b/Documentation/media/v4l-drivers/bttv.rst index f78c135b40e7..7abc1c9a261b 100644 --- a/Documentation/media/v4l-drivers/bttv.rst +++ b/Documentation/media/v4l-drivers/bttv.rst @@ -586,6 +586,7 @@ Cards ----- .. note:: + For a more updated list, please check https://linuxtv.org/wiki/index.php/Hardware_Device_Information From 806da2986f08756c8ee8831e39237dddc96afc38 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 15 Aug 2016 17:52:13 -0300 Subject: [PATCH 044/591] [media] docs-rst: get rid of code-block inside tables There are two tables with a C code-block inside it. Unfortunately, that causes LaTeX output to break. Yet, there's nothing special there, so let's remove the code-block from them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-enum-fmt.rst | 5 +---- Documentation/media/uapi/v4l/vidioc-querycap.rst | 12 +++--------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index 4715261631ab..13d5b509a829 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -105,11 +105,8 @@ one until ``EINVAL`` is returned. - :cspan:`2` - .. _v4l2-fourcc: - .. code-block:: c - - #define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) + ``#define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))`` Several image formats are already defined by this specification in :ref:`pixfmt`. diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index b10fed313f99..f37fc3badcdf 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -117,17 +117,11 @@ specification the ioctl returns an ``EINVAL`` error code. - :cspan:`2` + ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))`` - .. code-block:: c + ``__u32 version = KERNEL_VERSION(0, 8, 1);`` - #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) - - __u32 version = KERNEL_VERSION(0, 8, 1); - - printf ("Version: %u.%u.%u\\n", - (version >> 16) & 0xFF, - (version >> 8) & 0xFF, - version & 0xFF); + ``printf ("Version: %u.%u.%u\\n", (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);`` - .. row 6 From 48f6993793a0cf75db4b8c6e2f060629ab8ada54 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 12:07:10 -0300 Subject: [PATCH 045/591] [media] vidioc-querycap.rst: Better format tables on PDF output Both tables on this rst file were not shown right, as they miss the proper tag (tabularcolumns) to specify the column widths required for PDF and LaTeX output. Also, the second table is too big to fit into one page. So, it should use the longtable class to allow it to be split into two pages. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-querycap.rst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index f37fc3badcdf..05d86b2b87dd 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -43,11 +43,12 @@ specification the ioctl returns an ``EINVAL`` error code. .. _v4l2-capability: +.. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}| + .. flat-table:: struct v4l2_capability :header-rows: 0 :stub-columns: 0 - :widths: 1 1 2 - + :widths: 3 4 20 - .. row 1 @@ -121,7 +122,9 @@ specification the ioctl returns an ``EINVAL`` error code. ``__u32 version = KERNEL_VERSION(0, 8, 1);`` - ``printf ("Version: %u.%u.%u\\n", (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);`` + ``printf ("Version: %u.%u.%u\\n",`` + + ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);`` - .. row 6 @@ -169,12 +172,15 @@ specification the ioctl returns an ``EINVAL`` error code. .. _device-capabilities: +.. tabularcolumns:: |p{6cm}|p{2.2cm}|p{8.8cm}| + +.. cssclass:: longtable + .. flat-table:: Device Capabilities Flags :header-rows: 0 :stub-columns: 0 :widths: 3 1 4 - - .. row 1 - ``V4L2_CAP_VIDEO_CAPTURE`` From 1d80b03e52fe54c46ccfe59c107c92f0e52129ff Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 07:21:15 -0300 Subject: [PATCH 046/591] [media] docs-rst: re-generate typical_media_device.pdf There are some texts there on the wrong place. Re-generate it from the svg file. Signed-off-by: Mauro Carvalho Chehab --- .../media_api_files/typical_media_device.pdf | Bin 134268 -> 52895 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Documentation/media/media_api_files/typical_media_device.pdf b/Documentation/media/media_api_files/typical_media_device.pdf index eb30458138157e452e701af0bce24d00dd2e17f6..d000d802b20f0b958a0f965ffa435cbb06a371f8 100644 GIT binary patch literal 52895 zcmbTdWmH>j*EJg4A-EI?UMTMF#T|;f6n81^5~O%>cXxL!P~3~V6nB@8-jBTRH_kbK zPDVyT)?WKsbImocj6K*hl!{{F^vn!wh?ET{l~0JQASRHVktHG@ABa)b)Yi<|9K`k> zQbq)UK#bxR*3PDm@9)-z&Zc6f#&#yAhyntLPR@>|hBk<9>7RCJcUV-J03yH=t86n9 z6B7fY!kF}tf-Ljw7`^greZ$g?xCw0dAi%USLMWoCt;xU7eE;ij&A)~IzQ31Z=B7al<-K(;x zlbwsBv8fa2FK^2KtH-}>|K;<44VLS_u>Ri$`?t)$;QgDxe|l1JF>?NgA#poLn|~rA z|3d}`$2+}Dod0hBf3R@=2g`qzGN3yWN5tv4x?a^hve#c7bl2AwEADDeh&Y15uQyaT z$);@?)h2~PV)%5HLG4dV(W>2!poy%4q-&y{DPo%A7br${aTm{@R*`=4aH6n3;ls3_ zwU(h%kw$Y$*uGrqu>Vx|$?&Ry5F_a@5lYu^WKWLJbh{~G=D{N=U6S2~`{`=cA$G*J zE{8CiVUIqpdA$L*YJ$0WY-bXNS_B+hJ?$Vh>WV~4>?hH(e)$-4eABv2S(JCkyZ37T zqt6fL9NFOp*Sm$C9Q8TSCx*{DJ+O1;4nv#5a5Y8W7Xv=QaDvS$V zN^a@egygm2^}9!BEi(E=t;62Ck<_MvIH0ZWd%lS^Zu&R}IxYX#z9pFxwaK%94wi4C z(^kt63WGDpO)DczlcG>D?#PRiowU3iZ9NKurkhMdT0^hMQhnbg4l+S%CGCOQtL7Yz1zTF$b z*!ZNN=WA6w_gfg#tLx({WA)F6U7GYRfj1(#_*c)Uw~LH3g%)f48yeS7i@k^b%iRpk zywKMNg^r6CX4i`L7(7kU4uWs15BdrrX9{SS4-uH`6sjCeJSUV2`WJig7uT8|(V3uK z4<85L$K%2MJ#O7^J{Q}6p2`Hh+#U|c9(KoW(vmpsvR-xvvgGwU?_I>7z)FNJh^je# zR2^Q){Zk7wBV!b3Fhx0zPw=XCG4(K6#`#s8CT#I|SH=;~51QrbReEb)%4OM}g$xv* z7s^FW-heA7klH1@k(wMoLgV5mTfL#%r&Y^~eg-H7WYV`0PBS+ANLz^iva~VJd+4Hl zFa4un{_J3TeBe?;gL-&1X0jR!qcg#Li;f#*D#!H+x_OB#Q=H9;2`k1%XG`sB2$bdP z_Vzk)l z+jJfmpvZ0H)v{kp+=r?n2wOR*!%|?>2HSKZtzz!Dds<2kTkEMAhdNzHc+`SrYRi{D zk$q4Bd7sd>6&W`V7`NtXf-*UX6#fM7P>6*RM5>^g1 z;Yk=0Lj9!>_3JjcD8ug~6zdQyaR>7Q{tYG~6A(EKPHu4q-k5arkO;#gYlYrJhLsXG^c{9vYLR9P z_N2&nTY_F_F*!=EuYkc-*Qppn%O-`{r#EZjOaquqgBKz-7B}7>dx;Zii>(8Y9UKx3 z?!(l{twI~~{!;|U@i4y$b_VrAMZ{BZ$bN_I;)yXx|w$ssRQ=Godh@I3Sz zE2VzgzQ8bB*kdjv-iDDwT-vu`gH*ghR$eZ1f*ye!QAZvz(UV&Q`xoniICeRdjdVOH zYp>C&&aTJpv6s*{VycIVu3e7hZZI}&8kOG_%S{0{)g7Ch5au_dr4C<54uQnebmb?A}@DPaNKX_&Cz= zA0W}Y1Z!~j%pp`#gq~*xt6Ng7y^W%72htW8^*elT_HNL=?VB;{zHB}|?ya_6ElfPm zr6rM^+6n|qKznnmN9+3qmsJr4wCVc!x1VA*;$4#WNFA&Q{M5Yw&tjOzVTu3Usps@*P~0auel>mepNG@g}rO74K4zCjVSnu8@!Z zEOK%iChZ%C8k*|#6qUP5o6Z+2a0|8zc~xxT#K$0*PgBV5Z1Kmqmd3z6#8MOrOG@7e+52Xu?Cth*T- zcea3o3P7-ZwL3=^X=aI*UDW5Y}bx+P1>h%U|yc9dhyKlDB`s zSD$YlLp>KA3cmi)-}KA#;mlJn@rQR=eRAD$Z`-kztaj|Pp>azM2x6fqBISACX8`@| z&)6so#vKC}x!TeS*P83?-hpe+b4OXN8G=L-hjrt}Egyh&yU=0j<%J>&{9_(y!xmuI z3h&Al|6sL?ryz$UgNE!!hpHLlSj9H)-1)50sjceb&u5G+zj?2P_|3ChL~2{^O6Y2A zhJm^cg_Zjsg<|$+m{p6DyB1}@b| z@@(aIjdPT2Rcn07rhQlK^J;fbCj(ZeL&5}YK}A1ii*Rk-PsqxBuPBKe8PD$8iR1LD z+H@UxEIR{F(HhskF*dPZ!Tr2%h{)*LP#HunIIm?zDNa0@4*%vkMH1D%5vKopFkq(A z;R&d8CPmGIu7hfV%p#JlY3!3b*Y39WG8ej#;mcpNABi_`kWySV20M$=w8ZJ~O~c*_z?43{aFg^9Dc=p8m3>Eani5V+kOptg6r^QW;5Fa>{*#WSmC z$=SL#g7?{Ih5ZjI+W_~;P{r>6ko~@1=kn3qNXIylrAIC%XHzKJFe5N=qz&QfEgr!; z$7g_;Dqq6S*Gv7RVAZ6fUC>Nr)doZ#RHT-6u#NLLMxdFkS3g;w?~J6xZP=;PQn-tJ zXz=g@^Ip%=CemY7?bL>Dvf~NH{4?c=WXJ58lXn8S1c|fUBguEjBBB;-&kuRLcbB?V zYK*4}lQD(+_;RuWTXyUHJ_Qg{vXG@&IkJ3|7fms)Ru zxkEfEM(&6KW--bFfd8iq)o!q3=gwJfYGtksDi!Qb#3%Bv^ z^&8xSWaew$-pP~b-uXQxygxu-=cC^rOIMlFQb(wBl!$nL^X}!uVvsS5rIe04O}ya9 z*~i7{?%q1c`65ZEMd;Ltaf=#X6t|*;?wrP$q@r*LdJH{d^I@e2O`l*+A~_ND`=v-? zrW>$$gTu6Xj9DJ~p3>Ud)Xyv|-JM=9&q(xMycFVxu5j)2x_qDZPM=BC*A0Chc5&Y> ztQTEgO>no+noIPPF3~65OWO0O+LHJ)h*eMSga}AR{+LyctIH7( z&UkfmdfVGAa*ogApAIzc<>*Y`a&sg8o=iotRy1`=lAs`x=gUoWHCg@h&L;<{cw$&{ zC1B*T51-)u8emBxYmeq$kh{0W8AW39#XSj{K)TelQ0ItIviQh+-Ft?cC}5e|kAxj@ z5tuoGvqgB1FxGeQ6dawaT=W$5bnxkJ;K9j@kYsJj%yCsPxy#3GLGXwEGlLD8hbl9( zzu-r)+AmJM$m+_$xU@Pi4=Hl$`@UW>zd5TuBeho>n63uGd}5Iy-P#@ahSx+;O)iT0BDwBbZUX-jTABKm7Jewon^UZI5 zHNrI~v-7}(h2hr%T19Q>W>!9h4heJ0^?QfT+$LK zb6r?8)XIU_W{zC0TD}|D>#oRiB`VFNSblAMplmigMowR|um~6x?snsLcGa*UIq!?P zD-rf24iVj`f!2au%acey4GxVpQoX`hg@GIXNKWX?@4o6ZzqK?JuysytK_f&F@)8+J z4*E7Jvjanq`@sf@Q&P^K%kC&|=u>uIM3nN6>TGMj%3x3&RdnR|&3(ekAVl_aR$ z6LNE*Y{rZESDUeeZk3$(pGniNC0*>gQN@KhsE|2!4lvhZUPmzf;&!g7%Enh?ij2rb zYE@}yTc_9`9Ir#ll7E5iGQL{t`CbuliFlezh^v&%xEbt>g@G$pGC~9vx9HmM#NR3~ zVNBG60q4h+3s8y^$raE-`6;Us@-p$fR(DEsm#PXqeg}`?8@QsFAnhe^w9+bpTj8a^ zP9C1_$^+m+_V9+?*y)7#Y_jGjESf;Ts$C|$A@!$^WWOp|@vTr8f0!o&y<&0vBUjMB zQNak)xfW@%ZByd>{G7#yE2=iT#%>8^7i1Mb_Y;CtlKB*R%4qBZba{;gR$$>}W*~LN zcX-kEv)MVv(I&W~{$tDm< znz}##u{tN7w@yIa59DA^zX$yIMR7x*OGqU*f+0`kgE0vZg*mZeZJ(2(o0f`75ZjX< zMdir*YyVVic#^aiwxLL(=pTsal$0tuNl-rgn7J?GY4W5}i3iNd9X;(ZPdV$r-j_WD zN@yBlCpp?_#c21Ba%|05So&oOggqVlzGzEYay-zuyqF3UE7%agYL>lgfS66q;uk*F$_^g3z0fUa3Ry8&&b)2i)k& zA1>@+PaT@|k&;7!coEz*No4pgv4KTn7CHFj$xG5mz_K6UBnatc5uXEfy>j&<+(X8W zdH`W95}G2PT?6K0&Pkv;RDG;6VCNlkxAPrOj;?AYfAI^TxDln)60lIb0D#BbGWGj? zFba@tXUm7nz7UXn;epUAEQB2wwt$*kF~W&7_`dxS4*{J@5k_nWpn~9kKZ_kSdi02q zK>ng32F=!5upex5gKa86e61)_nQUw|CupCX!afn zrxYqb37W*@KR_2zfM)@HJs7bs0cHnAO+b}OaF3O*8=y@?y^Y?GP!I-aQ$3K89Zx> zGDtNF0tnO?))ofS6YG-Q8>i+3!5^0;039H|2vLm2P>5`f_|t-ZC6jZ)=cXE#OngcdC86veZNvidE5-VO+t*zo0zwFRJJ5}a2ddb{ zl{t=~v4P;!#!p%B7s~s6(9BK@Fwl*cvhZRpYHM(}PyNFf;5RKYjo(|`F73amX=xTd z!<)78Dhf5f)3n+2hdbs)SeXF^(xuKNWN0}Y>1RrBL_LOKp-vKM`Q`=&1Vq-suj47r zu7}}>O>ku*c1Z9wj_Kib`T+50fmXsE9Tw09vIBY3oJvrR938!Gwh}0=NUZ{V8T~{8 z?}%7XG9fxn)wZST2!>0>OC*0xQKL#2Purs+2HHn4$nFz97sQ((w3$)tDht(n(PEG( zyz|~J*NML`{0?7&DP2-n$N+5vBVgMZ<1Z*g@K72bh1k}MArg@Ak_!D1F^YgRwb9o@ zNNl7{5En#fb{z{ed>@OL9#bL^b6**>)7j(!QbmoQ6YZAak)zd3z9fBRXok^e`LN?IPu z5K2^g1w!^STAaY%di!EOu+2oapQOZb!n@9nR{e@G4@}|RR9;LF$tp}OR6{r$WE+YN zwYXJ<#Kxs5NvGeNGGA1r?3e9e5CM?}>s*Q3Cuh9V74@w{5}e{m1KO%TKmoJ8Plv^9 z_y_PeN*x9{Z1mx*E_6`BBer&TUMiI~$aE2LZmZt*s|PuU&8M|JKYbChThJctNrY=u;<2oE}_|QYK`hX^@nn12e6I5bk zpF%xEaH7Ak2*o&GH6XUg?LE(eSbaq?hk6_c6cbGffX`u)Ko8ki=!F-BSNTl>del?k z7fU6311J^FiNc84EC#@erI#$c5Bm#smW$A1;*ah$K+$161J;&o2Nuvm>j73QMGXxb z*f4O81~!?8L@HVE0&3#LWxe;lDQs^jg!q6Rg{kZT)WZXZq+)-=!g_}YIW<}Ev9G&` zTF#E5t%0jgsNDsX4OvXIPx=7GtWer%lHH*S+gBB|rbSg4eC3tcivq=0hB<>cP!aqA zwpoqZ7mLMO>a@U560H|Sboj5__`saVbF%1aNu)77PG7a=Dh56{1{~5@!<6(TLZVvW zT!1#1X8GPp`-MdawtsFcP(^_V=5f!@b+AGYox11ViV10K0E?z`uu2e4lTf{{{c+}y z6LeS)cEg8Un;Ry@rgu$YU>hH5%b*IX#&N*g)U9BJc1^2Hen0vUY`{A?&46;e?_Mp} zSMixpyjguegTQw0o&9^z7SmRCbHNyaH}4Ojgr8}Ul4&gfi%En$0Fpsc$8zzBYj9{u|_ zhj{g%{T~k)FZAx6!pA+zAxUrKj*A7ZFdR9#E6>56j$O;doqV z#P;l9?}+qULJQ`U3L|4<8w(b9+u&EY7Op%yD<&NGA*=_c>~8!-OiyR~&`Bd&`e}bp zhB|#*@627Y8MhA)>2L!mWC{m18$ZT91&HD$Q2N!~tqwifKTocWB2c{iT0<%jZ=O_|XJ`wy#;Z-U`pX7Nh zWcn_Y;cf+sn^Hj9fIIzDDW$2rmoot?O**IB%8X5Re}0Q}n9e>ORMEIyWWEtiPt-pz8xB&({mUHA8!|4nW~DY<$M3-pL(yx7V?YwrxUCMmkl6 zqB#B?O9I&#W;rcDxIjIwK?wlvv?@bQ*_9CLI8fi>2H$AezY0=y8s60QOe z$m~clA7eW}9^NJ_Fj6<{k9{#D>S%dw9@T)W2GU5} z4GT3L7Fi!Ad;^W^R$KIkFjPzqJ`JJkykEkCMwx{NK>Sp~}_hTzT&j`DULVNq03Qy!S}g-3 zb?p(zc2Yq$9ke03yD(Iy_alO^8mYF}ur|joGC$-uf!qPAv!$ni(~`Dpp<iU zzMLFP*3vZe*11s@!KEWHy4hLt5YoobM7;Z{rZ&$=sRcV}y%cD!W=EjTRFFW~_%f(w zjF1Tq)s&IO-X`K`@ygDKVBEo~WuK>$>tZl89olaKLkVJ1o*xsyzaK)7oz=|`NEcHD z{Kna52Y3*Fpa<*^TtNDHp!ydBBOEoKwP zppmW{0^eB@RkaG028__iA4Y)A5yLDX$~ZT)Gu980#KFeD7!IK9unY5&*=BJth_hb- zYffE+0ANJN21Iq3imspcY-znHdLq^kf$V9UV7yZylWA{^BOcVDK&0hK06j8VfKJ3N zF+iM*c0SrNLP-!1Gc<9y4xv^q634M27J$T&ee~TcLPKLanT1`5w?YA+5mpRfvKj1! z@S}@z?}6oR>NkV}u`?zSWItKJ`6Yo7{Z6Hb0f~48oxFXPEOzYNfS7?9#@~L0eV<*; z{OiCB?ZLAdk5Jt*VlYDb8hC(4_uE;(_f8Z*?k=PfdUedQPboyql4TeHh$EZ}poO8$ zFQosK0HF4c^ig>M0!Y=F4{tzYur05I|TEEYn-rIMJzK zgep(`VoJ00wjmA>cWDQH6!c&hu@*aXu0}90JZL;-=QJHKy^#KH;k6fGw#)Gn5&V3rLoXhs@5v=DiMtRy_z!tTY1D=Sf}z8iU(W-etfDl|Vf54FI&;fuUs=il!z6 zD7~{Fa+Qe;pne~)x4SRk8XiC|bXt=ECp7+7ciS>>-Tf(8fSd;}Sig8MBH(G`KHmCP zMcx@uayppq4A}Y(`JNVKjr-41OT&AR23xX-ey&_;fP z4}1E%B|!4W8B@SIX9yuc>;ugESnTBS0hsSu{fRZU|IV^n1DJ1JM11R2?I1p}wGRT!h1T3(yq5?j>w_A8}!2_`G91Fl4nhE~QLa}Zfc@0>d69jl6 z4XZ(23td7mDN(`rS$Mvp0`ed94J8ZVX3_kJovL6Do@n5NV&2(UcLbyOg|X5AJb=rn zemiKc{$!+WLGi?f6xouW*D+!@$%;x~h2J^$(hmHW5iqAbT9lz+UlxfA7I<*BLjvLupYfdcXAX=m>GfOa9O5_RNcd>Nd54O z)d5M5-uuN`UHdTj09)%40auv0Fh$t z$Qza;Q{I5)FbW#LG*!oB)V4m3?1sl{F~r7>bQ)wfr83?l=I7ROJ8iC6fDpxCxX<1U zQ}Anl3>H9`0q$QrdgLp|HFbcqCP}302ik>Xhx z4jMqriP70~s4hLf39cl043b8q(rg@s8_@o)(raW{sP10?G8mzWHg~`d+56_{R-jQ= zw$3zU`dF;=714WKy(Fw(mi`73{=+o)?NK5-bLn+mI;z$ zlgc^Um1Y8z>lmm2t|Qywgvw=NorZ=5KaZ1I`RXLEY-;$?IHFR+X|x#x9+;+o_;)7s z7@Sb?dnQ*-kCYkOxc$(lM+emOK4y$hPHgEa%rN7d#}Ty~M>YMF5ftKF^2U_*sQWI^ z_?AZAS_tWNokdfGkHV0&fM-Ik(0Ii|NY>t)X}N&9FIxdcaG_0N!;$u#BLPX!`-2+X zgMH|%pZuM;`o1Ej_t9{=`r}``DlfuX3*su3*+oP;wb`|i;fk9sN3-HR8q(OKY7-Q7 zb6YFw7<~O*bwJs%Z!D?~j-_Gwb&}bH83MzJ*7zYL3@@b`i*vB3S)OqUzA#_0$r0v0 z^BZC+jFD;?vO}97xwhz(psx*g6WU1_h3-76Q#&Ds+5z>!+<1?p%a#Q0oXn4rPA|0; z>3kgvvsJ<+2O3$_Q%QWv(0WRbGEAp*k)0S$Q^WgTUqb3Gxc!m7Oq?|5iE=Xx{M^la zep9@YiFN1)6?Jo&OlX1x?ZtjobM2f>skph3QeFr{<^;zy&qlBE%)TfK=~$X65-y47 z>duC|IV^orZ2WI^?o_WX5MJyFc8>WOMh=Ck~n4Q z#bqP+NR6iSvy{}&j`{vX_&7}$$(z+_CoKzaVz;224%Y#llr-sQDv!lyxX|Pt_ch5@ zA(i@sYQfVJg;~i@ZAV-}FuW&_6OEaeE~58K%V}59UA&tss)x<27OjN289<{kuO*NO zrtrz*vj?}tQj+Ka9rbjXA++mt(`fsU#Z*+9Wlj^C);^XhE(Pibu)vdS2mhzL~}B9rqb z{AF|IwDZM1p#~Ikh~@fIxR=+QH2a(QO&_9otu9u0F%vCZE-ydiDx!)fhgk2L!YtY| z0Y;?^uM!?3gz->rqr=brw)IyJ0^E$0)U6rSiiJBZ=(u}y#? z;kR|CP~flQ|5e#Ro~C6J8y)-@9aIqkBL_c-74pjlcdfa@i@tQ8;snJdkX*W?krPY% z%LA_zIDa#|UIW$e#fSLT@C7r_q$#4hex$+a1QB;RqeX`szW2_AWg(Ap`}Zk=i04l7y-55Czd{{D8krNC6SZuOOg;_mUBuni)lyDWXcooFHJ9?3L+FNf ztBhY>Pkm9<;26g3m$;PMOP8jW;$IiZ^kb1;=e-aP-zsp0)ww7%61jev1E~sBp2Fkz zZQ;rJdY`od_capx1LlL4ZjG;r;N`doh`WDt&Dd3bOe@iZmrOAopk3BkNY{6!b4cOlYy5% zbtGAB`ys{a5hM!h`ra2~UHnfY5rP?n`=(KdyUS z%$-fV-5$4eJ)T~zXLUX8eR_U=d3e7ScQ&!yctOHY=@xt=a;tX3KS23j(}I4~vGec|D1*WZx>G8>?kOBpdwxDC zOA=hIuE`{afOs|a;3K&DlO@>Y=HANlc5x)g=Xt@Yaiy>DhBTyRLH+;qoBs7b{@ZWL z%*4w6U(4xVyW+pBlK&VS|9@Cc#owKu|I6k1m7a;73B>&$yX9YJJ|6HT}Ols?7gmg#E8Gm-&B;rTB7U?XIQ%c+Ym@-3=M#VJm2WY&?61HZ8PazX^oa%QVdt9i$QJqhRVC*$ftvmm>Kl z=bAyDajM0!2t!*;=N%rG*#33KS}CF155lW-dOPb7`5wAB#KGALQSzWOZ*&&~z>@X} z$lasUuUO8($Q2O=!ovtD`sV<4p9NlcH-tZga`?YyoNkr~fpH%Ec;OQuxR7b!-D9_e zD~%ZUO9!J!Ms}@T6*N5jxdPgCibqL zpd4f7eijbiNyu>V#^~!(xYNp9z6@(M5R`p+5^1nRD_J`uOYw=``KTp^Y1vN4fU_?X zA;Pbf)hw;GsYCP_=T_pZX&%pJ{oAnP%L?g9^%?SNE+0q$v})!Fau(ww<3HlX@c8^( zbDg&lE!u^#9wPu;k6%N2k$Wz?ZrWHEvB+!gSD+yU>tn!&h(P3hIsdQ<5xqX9lAiT# zG2LfjFXm&3@<*U~t(5$-AIcKNlqFG~-n@LQ&Ub=f%yiTRcOu>iO zmfilO^%r30wTFVvu)|dG$Ne)Vo%7+2rt}f9ypZxlJve$*lgkBwkdRzfKJ_17;e=lc zC6h!8C$5$-XzmfgS`c!UkY}aFGg*gJN@4}TN{J_Gmr#nFxajnQI=FN9+nPUJ#QjA% zz3XUOP{sC-K!GV@_fqk()-O@DRCBa-J@s?_7hq>p{3(QXfTLYe)E6osebT3CXflIm zs;B}1Z#6)$7|Np>C$;eB(x!6UY-$JU7mIG^#TbHaAL`wNEfv#Y8JBytW9CYZ5vil zV|@>O;5yzDdDfZ3Lb)`y&pZVRu^ryT?bjeu^_Wc0GP{-7!sG$N?E$ADRU%M?d6{#0 zu2qaiO?N!vgtJW2;zVrrlBn3&KZyp3%JT$odtJGML8Uxgvkk~oMQoZxVtB!lI4Y-N z-#rQtR<62ay%68xq#Jhjt*0n`h3a9%^Z}9_U0BF|SP8Al3;JlK)v1R^fgDB4y5=@_ zOq&=ZA!$Z6aTRzG4wNWFAL|<%@;cnY^cXE|DQzk&OwvgUiO)8jRacav1DRX6l!Chms*gbbwXKY0| zw(pE6$j~{&$7ssJ13{_GEeQOr2t>KWJPwr@OR6OV=zFzNj;QWjt}r8ewLzy*1&2GF zQ6EufmY3&f3FzTZKiL^O@y3Jbr_D`oG<%CkmFP@f<&`fe!llv|u{D;AZ zl)c!8YA&3=D+GQLZR%Na47f?Gtk|G&@3jUveESB%N-xVEkqxPjXlJKHnXw4wpy|#} zL3miweK|F}6X2|9mRL!63N&GiSd=2u?th3!l0Hs9PA8}-R34$C3N1~RpF%@F><4<7 zeAu!H5*MZ?4?2t}K=$Gz*p8=_#8-^l$fdRZIxUGPBpJSjN411{EeekWy9xZc*xC6p zXGwWV&-^9{f4&^JTdftF#ZOV_x9HW#)FVO8xp6NY9^3`=pFxJ_7o6YbL8w zRBOHPxN_)jB~hi}`R6$$tNor#r}}uxSMwmg7b>g$gfRSu znoDekYEq28bm|%%D4azv$uuLvG?$D1IBOzXmMU8K-FU{A2aJG^Ee~}59K3+AmfPD! z^3&`CJxi{KBM$9zR66DM%!Ow0IS+)f=78AgpD7N@Wp*vAC9s>YAd+SVGQ~5!J(M-( zkx=fyQHkn}#utw^t)eI6234L%3=zS|U+2gt+N!)%=HK(1GXiB2XOUJ{8v;&k?99{; z=%9~@6MH#72Y$ACcVk@$%tPHv=P_e6DmI(soKIHAK=@}JV+otJ_>VV-WY^J2^xkax zUo>+VD6X#ysBwqbGX^uGCMTr^snt)g^7BRW84QD0of~FlXdJ=vwX;HXKn9)z{ zSh;gaJMtghVDFj?)ie*sAur;FHZ(VBqgXhN>D3uS^GoCVQL*kUuRn6GZuGpT8OOj z&~7c-8y$Z9t}}!ysgV=kLPT<4X`9JhAXoZn#9y+1p#f6QSzYTUJQhNv=_;n(K4=Y2 z446OaLWjyVMpsC~+M{|625*hV4F@S_LClZ|fRS3E)Cqr>;Od z?YQ3>;yzbCRX=^cue~romm{}&3k2X2?6;`5*aqlxo?@+EJB6=lv3zs_?ypsJC+RRg zebn`jxEHrOhJ8L!c2y}D1h_!)Ma}4mb{Tdv8R4;4hoFt|@D!(gOQX3;pG>EOo(KVE zez~C5Wl81o9X3B}vC3o$#o^Dv!^vp+dQ;cU$B&9^u2MLNE`Kwo`GR~tRnZMdcRqTW zetNBQrOprQe1sxBw+a;YoF&N1^-l(x8gopQ1c0tfCT+whQ$#64KP%^CiHD8sDETJ| zBao)CPJcc0;DTmuLFuJUuhVMM71iyt#ctGUTH3j5q0mW@49%8W?(cDS3SxB7ZGFVpn0^E|y<_s#bt zx5~!>qT{TG=&AC_`95d)^`y+Vt+DNLL*0k%CXHW^>*dBr)=CDwB10h>k{W(``LI55 zV^toPDFU49_rpX@#7<3J4^9!r-I++a@}nR6;HH?_rk!csq9Q`_v(g7RuCP2VFFgJ4 zNTKKMlEb2s;WEYN+tf9q2IkBulb-SgQDo1eUO0g=4O&n=O)A?h#@ku3mXqwrw|+`O z+YASi859}CtFeQeQ{;F}6!N>`-1*kGPJJuH@%kBE-f_nZYI;Ww zV|~&EZ)Z2!1@5L#ZyV-o?Lo+g)#cT;mHMap8Sc?OKEYlUcOTq0R0SC?xgNY-g>$;M zrX=j0CJzjL6d7o#6p7~lh!g&S7wjV8z zcloDY#Ftg+buG4BH32&xAa?ZJ%bi^EMZ1WHKU_`S>qWYS!M@d!C`ow-l_gX$45e9# z@S~rvDoqXDSV0jK#G*$8VbXJPyb$2mybHF^tshpqIynl?y1}u2T(x>`8^IG#@bJr6 z3K_hy(Vd1GvubzEioJl7KwG-@i9XQ=gDD4dpMeJNfv*yOWhS7@Eb_!2LWiabz8vXp z)J`e7l;in?AU^>Z7=eH8ov zNoy?Lcj7Y?v2m^$-ec427^)NMaQxfkZ=|sC@$g&Mfe=gq0CU20fVhsZ|6t|i>PDW2 zw|x`Z<4=&0bW!yrWeshbnM}Z^Oaf4%A)5#kiW~9iCq(7_6-n`fl!~JyvcB?y zI^Qwl0u;gwe>4k?=u!g{tHS3hzGZ7?RfH?C-n^N$9(cYHb=Ht?7Gzy$?=~NjvhQQH zKd@hqy9pEO16cgF<~Of9V$_ms6_26ibb2oW32ZFD~>$X9%ZC8_3HF6w7lLd=MPje17S3BHCrJGtZL{m()Gu; z0^hNu@cXO3=TUbuck;^*Vy0Uc#wIu+59iJySYY(Iv{VWj-OGPB=GNk&&9GU8-`+Di zSo;3+MEn<+AVzamr5DXw%%$JE9~KAa+g7v~&d*@#3+B%j^7E#fO;S&ir~#xqN}5VB_qx1q*<+D8^O6BX$jRNR1u5gcuJ%44Eu{;hC{oa-H-Z!xlClE z(wL%{U-GAfSLp2%6?xg`dY4=vlyeLR6Z@r@V2;qaFUCapa5`Qs*wINXoP2&hoX!3Do@;b-!J;vb^kh$N zS7J2=Pi!}}rCzZ#MP`OO?ufH^bIW&8P)Xk6S|yYGa;8)1#E$T)_*>N({vMNOkTJ1w z=ZL^B{=LV_G+Wvb$0v28qYg=KWlA@SY<^_ zHRx5R>jhUwDmCQh^s$rB)v_pY3{&0*ecJpA=uP44P1z<;DXIokTb6FzwxproZPVSO zzo;b!5>{!@JiC-m??f-X_cU{wh$3$ZJApf#i-VE;;9 zq5pV&SATLSTWu1ciUk~Hff9P->@A19x#IciF5OR@M$K0foUf+mOdfJ8!5?wg+anoA zjrS81c^e_*;uOAf^n^T-$>_zAQxOH*M>K(jQ@jCBU=<}`XA5NUQ8E>t%5+66PDmFc zjTk(PaWGb@MnFZ8j`D_q`8%dHWo=3I96>usSv!E zG$MtGN#gUdBO~=5PNzI6>^pXkF%-Fqnc`({`iDLuANJ#L9AzpZ^O6QeaW}|hK4yw@ zx}TD3a*@`y%DYsJ`b{5dvO(OelC%Lk1~GgeYx>yBQH#%~;_o9(YE_?+4URC}DvCf! zeTgkR(?*DwM;VkIE&WN=G+g?J^fyVc(&Us>fwSVu#NwWLl&x-9D_Ev;Rp^&|B~+t7e#qp= z2a*bWP&*pM6hcw<&&R(esyhHlUPoy%m5QrsDkH}w_^2Hqyw)V$wqX++O&0b(?yk?O zUjEJS88nt#!IYocI$0V_e{7+=|L8pVH&oRs$9+SI!5op8UzY)t&g-NI39Kgp8-#%y zuAw)4z7Sl4+(Z?Gl?ZPSeNIO3lh+%@`qA5~Qaql)VnIS6qs>wOIk7qImd+bmQjx}F1DkYvj!_x0e0Dzx-T3#>@2A%t2>Q|O zU+%pVSj7xxr)j4c=Fgl$-W~tFKPDQ-Bj^|^1IjwAw!W!wAV_9>+DMi3-51)o-_Mj^ zOS)^gh1A;eidF1QW39#_x(xC_Y!W+-Zr9wHmG7u)a^i2uJT-gN%n#V*tWkfcyhIDC zjMBkgPi>CvSoC!=S2t|F8fjd4MD~1zt2y#BZ*H5u*EE1)ng;+w46=05Q zDZp?jR-lWpr9j8gpn`cOTL95uQvrlp=~4kgfT+LgYzs^C_1D)1!_W|tlLyb3UjUYz z-F4FmCjIuBu`V1gX{~5Hp!z7bM`M>C86<9EQ6YL4NALfq`4^jQ*fndlpE?+teZfs%II<$z79OIn_^OtU z%8@6pz2sXW$5pmm3(&i=5N{Np%^X2YxtN=S9(=Zbx4yNPI6Q zGhq*Amjf~mQgjeb;b^!39hl$XPv*epIl{RdCO$2?o#<2h_XEfxsd)1EvE0PbI_|$c zF1?f^zLYZ<@AVLLcazk0RvBp+?-5k?H40u-(1|}~zywXAAG*Higo~Vz+)fWb7Tw$A zhYW#thCn?-V4rc+m>WxaN@QtN_&c#HI~>8lSx`@`ES1UQ)#|u(OgdU^SYXiyMf7Gt z9q2Zf*THoZRSDi_yU+Wa>pAzB_dPGSI|z6BkjmC$S!Z5n`HPHj(j~`b+U=6PJ{sc0 z>E8osSH9j`I!{rMHJ5Ow-LJadasAmvyT0J`{{)!E;D>rzMS^%X7aR>zK>(q_z(kzA z4mj+9*!fp;{hh$hzrf==>&9e^=J>CA8tEYu*jEiIlPB>=kS5TflMspG0Bv@}xUl_U zaHxt@I_&5xxWaXxUZLUX3zyo6PkQm|uNM;9EL%K0JU6?#`5Wz5Wjsm4^HV>cKl#1B zS;@r3>kI4FQ}B3S*gJ2Vedhfi4;kT)W z^uyF)VRZH}@M~}!zDB)He*iv!r{G_NQ|6B>vb*3e7F+YhbgbOV6p>*e{PGoLR4Xeo9x z^YWm(Xy~*+%4`yh9A_P{K4+z@G0wnoZnt-@+%;oHA`ze2*_lkn_Qqw8hh>>K#qeEs z7_9kx&M?ft0R}Q-REKWXExi_M*aAl_&@x8-O;6`U0?Hx*Ws!ig*rbHWhz^m;5D_y& z56+$U4D2G%>}^0Z!sbbwVhY55XF`G}L8T(qigltqdj~5WIrOg3KSUc2r@%5l4yHhP zUE)VV;b+2reFw|@LrB~h9GZh<{9GZ^otvGRW2p93v0*|N+GMw-BB;)C>)7-OB=+l) z6`LpC+ixucRI}gOFjj!Gj1>f^`-tbT3hNOV1cT!ci!2^@p(eD{k-LW7F08P!E?ZkW zXeZE(>yYZma?}QR`nvC}n!K*F;3!R{ErOcLXD7d(UmlY!f|AbXsoB|FT9KXCz~n4{ zbE^VBN-w-@srwLhYD&DWkBvs-vK%YISErU-s(I~lG}@wWrLVZONycT5q;HtI$Z-Xf z)+R!pa5M_tmHEyiHQi!rK7E?L6SPuIbv$<(jj3iDY>vZt(9SxEx6z5j_ro?)wBaH} ziWDxkl42_=J^@&4BAQ5ji2f?MV^#dAa-W&QL&g*cI&IX}R@e&cEMUW1@jXPRvj9M` zP%3d&Cz@b-*@z$-lsUnej5=i{49o>;0FdH}hMB zE#7N=SNk`ocM3bb_kw$k_xSEkJq?Z*f6s=EMn08FH#ZBAr$W%-b%q=u-5LUR!4|T| zc-8Ck<(ma3Iw74(MU1=?y*YGAv(IP{_%zDBf|2LL4!a#e4;v?zRn*&fE?f?ZMUThl z9fQ2?-zC6zgi`|5FANBO7HDA`2BvjJ+PIA$gH}D5dRi5mG5RyZ$6c9>_RcXI z$2X;5b2K3vy;HZf?K^kI()PSoP6(j|k?yG{Ma?UD3iO@PcrZS1sulh{nXns8mT1%< zYu3uAU%u&wIm!)D1$=$D>8NzGzzN7DOwx)Ct1D3`V&oFAj(x`m>h z6h+ejP|yU%prSifI#2i01N0vH1kKVXpVH?pZAyVzB zSyQfF_yKeK-&Zn^)p!*mS86l134!PJjT(`AG#z7|rYA~X?IOgUc*Rd?O|s&*YfWCo z54EsS@!Pbp-G&%AFMBDBon8{5;x*t)y-mgeewaVO)6>}H(98Gp^g4c=KhD#24W6JW zkL4(QEhjO}a$a>*msv^1PX z{|}gQ)nSaH8xjTp>#M z!j2|rzbW=&_{9vpDDvG5B`conB@x;PjnPVe{JJiFGeVOMnZ{+`+na)`3zzuzrJ%Mzimd zT~6Y9xqgnuZYGKY{=I?X82pAVwkCqX03}+jXl(O#V&Pj|3wfN^Qv%vPjq1_%Xq0wH zYJ+;)K-=*)x~<3)rpc4{z!Rp)H@RJeX}UP!l2 zGr5{Jlf&A~XR(G8NNhulawwO=T+{25CeDm?d)X(~Sz>C3#B4(ZE+e%jkZB2pm1riM zE5MczO0rGq0tiR)YHI-kq$ky5WpIEDQc|kK*Azv3(Tw@xsr}A!0`pC0nUcJ?cyDq=UF3BYKTt5VLl35>&grwLguomyQfM8)e@2dv8AQS zrwc2it^m?#;Gf<&w(HxEL%ILfji1hR1dK1dxcdgA>29SUoZ2+3q@&ReRhw3IFV~sdQ905tx8WL1yA%SCbB4syNSzjZt(Ik82Y}DG;$8vFE1p~wi1|SD; z^Bk3q<~|ogb_BFee|iY(AFTpbo=6~=Ak64Qy(21%gD5c$ zwPu53ai{*I`$;UBiq1-~);NG(E9#61_Xc+WM+_idODt3HjQ99>-F=+GcI>YTGq888 zEG?4ON;_?ao6~Scx-w%)dTshkwlAfx;&& zDW+zy!o*#yxvePZi!IpIbL$0zw+uYCxGmA@DKD8)z3p*_OA3eNC@dPSSDwFN*0~qx ztMj=CT^@RU%SBh*_}at++g)O2>ir7~AuO<&S~k!Z_vK~l_Nm7E{?@RLUTBQ|&<+Lc~9%XJlZkk~IL zQN$hSG61-G3@)KrXsAWyHjJv~npK(Ly$gAGoV z`9+-To#h!t=-F@C(AMjLx~JFE?-}rnc=n(ZIdd|^EpCFz5E~CW;LSt7ZqSbbaQjLIM-SL`0&mJ|A(_ za86z4EiRar;2={(4T z5K7Bn8J*V^DGxX1cjb5I>AZ~Xhc!PzzEsZA!^`1v{A?CP@u=|QgOZaJenUudIfh)p zf@pGiR7t=DerUJHSKO6=J&A$Dc;a}%kg(!26AhP20^_e8kEFyk>e~ETeeE9f&Y89N z(tycaTx;ER_k1{C!WYeNQQc5<54c}-({402Ykp<783!rVY+G(@t#{m4ft8j#-Ahxw zG?IQLn!xehpSYi2`p1qt0=?gqm!$1Rv&y-dq<LI*PR&sfKF%_91>iZka|7V~B)EP@S(>+uULnXWc%hq^C!>Ww8Ug9 zaqEhyGITB8Ft^yd^x}DislVp(og1D#_;{gs|8LscHzMAVP~xD zw5gndW{j4B^9I*{b5(1bEJtS>*DEbb_(E#OrmYXInmx32_nO(CUSC)p%|~W!Us!az z4J>-6%>Wn0(EnZ_5af+}d7j-{;kI)W4h8GsXw=rbdM{~fQ+97UrDSsG(kpy>Rln|k$4~pu z?=20K_LS%nkccQQ5vf}uqPWx)jSx{hLMkIf6puVuJaGi>Ad|YV3|<$+KdvHu@#N&k zcqDX5WVX+TNCrXK6q)XWSQTOnnA)X@4}tWT6s+f%L*U60(5B&tg@P?iBBnILCy48- zy+GIGyxz`d~f>UfcjMy*!+c`K$~ml7TCUUgZ1R(Il>Pd>=!Q>w=oS)Mnz z#JH=_n)m`kO}-b-UOkmq9|$L=y4S=#YHrrHslC`Dw4NTkK9q<~{qpi&msr!;u>UJX z^x8Dsd<10CXSt)Zl*?WtU+up-@Rh_s_O1Z8MSe2!RN`0uUj^QZu->?oO~lI4a(qT2 zpIsCGVtgPwoHe}!pf8XNED8M5`zt^5NCN&i@}}pl$eZyu5+6j^fF2Gec&p;)wI-VJaNvT+InIU?`sB?Z77?eNOic_!!@!EGCy(l@iE8Jv*AE zc4x=4$Fp=c4aow}r>7`*m?cG3F(VU1iSVTS&3bs5&L zVm19LR@bi@zM<*_!LNpwGZ0C70&+AFOL}4j7zv;x?rko>s6Sk2NRroI4;C%oqD!GB zO$pC1G=^~8)g1c%5R8uVv8Grf&H4bN_w#%R6ts^1yR{+xcbY@~MqeuT8x&bs4-JcELG6d1BFyN2Z>c zI(Xm~*bKYj1&`lS_f4=Lp>dIiFYE7#GPDBTWA$1RVp4220m$d$2|m9Tk&ZW) zZBo^z~)L~ ztRxdA`K(L|a_xI#0lPYget;Mwbbn4lq9d#&QdyR5Wf`$&z{_Q%2^>GRS|a}+MAmk z&#wx*C;wu&=F?5vl;&u(s1DJa)+B=Q=qJB2kljyjJ#*mJPj17sH9Y-W1B1q02enG~ z+V4t35sH+F2BIMWl1!=x_E1J!=NO!?A8+eu^U;38I(eOUoo}6=Wh{&pG>>;0t~On5 zx!Sr(90(041G$0xPX1=o4$BVfjpB~fBZfx`lHF3U6fLD-Ay^ES(5Iv_1~sHA$z-N5 z3(le{hP*c)$}4$oW^ra|p=Dw7a??u7DrseMWh$sZh4L4alD}=ayxhCo*VlSM;ez4? zr3>2Dv|DMDDd{lzlVOwEIU||x9I_8Nc1G^y?#JGginDndWmi+-QN=M2RADIQ0S>3t|@x&cQzw1Hd~!$vo&RIwi;qalCfbp ziAG|gg$^g2MrtqALrp~p6&!#7!@88SJ!hldu|d_g&-RXuwvACco>caRQj!rG@d?WA zEPO8e=j=3M7W#sco_!VV&>*X3^N58Qvd_TzpbY1e00InG)zlyYDkRb3XqU+$qyjXF%CY*V%ytU!YOQ6B&uMjiv3vYO_x|MmDZ=Q9}7>?0E4xe7-o|! zmJNBaT*!-c+0+)sQ`U%B=?PJdpjsR&5VjRURE?X&W0Ba|_IvvAsJ*)Pg3E46&3ga) zw=MbeGc$_H4}9Jr7mfN>AG%`OH`+VnQ{TB`>4|^4VoQg|rwIs4Q#*Jb;r>@~+A~w6V5)Whx$Hzs@U{5h{3j?oUAQR0Y zGHd3%*M{Kw5DZ0CAM8gW1m&}vK;jVj)xqerV1>8Ks6N~lxV{+2YRy=lsB&+4XfI$1b7tXLR>s=mWgZF|M?iuGvZX!Mui*CTJH-!;4&emC-d+GMY! ztLZOiwxxH$UDPgm*fs1M_74YkW_D#Q7&6G0?Dk05Vls$vk})CpLy*liw*Y`&s_&~_uZ+Xv zo$efdvD8oO5ZbY_`DbiPpq;vDK!p9`fH)%3;uz9Jym6m5tMHId?~X$}!+JPQtMPoC zia&*fgjT3Nv7`}rjK?+!Wt+rvE~YhD?JMWd7}`G#Q4x>zlc#Z15SeXv@~lCR#-9)g zha(n~(_%3-AfT^?0o9?;p#Un@i0EKeHCl=w)mM`n6G=stY%HhPv;bt2d;s7j3ILa2 z0^BqZX2zFPP0hP$cV^lsDrmJ!#8Z^Si3sP<}F8RlW4-V%#6cj9p$v_sI_IUwIw2DU$>)M*vo0vj;}eTiy}Hr zEYp$&-N%9(IHlVy=sp&74%!g!#@pwnn*75Ld)`SXI8vQr4Pf&$W(y$ZjbN=IBuCM|XT_ zai$}Y%r02}uiNem2|l>s>$jgM2huh8*1xfQTy#l{ueSI{d~vI|<|XxhYerJ35C&|D7Bn5d?XNt5IF*N6?q zM&W-f)=kkV5-Xe{`AcMO@@LTAg_=jLn>dDBzG5XOw=A#`i?mH8Gb+>+i4abax>S2N z+3O~I-Ah$Gx1u&Ze|0-{%;M_yTBI8(d_<16x36A`W65yk(uRc_75++&E?wHU`s@`X zNQ#$_ARBrFK%V(nrGhPSNcbJKELpz#IWT|vJunY#Ike@c-#g@!kH89+Q`7KCW5c)hG zpJa<@c@++*qbjA2!ICbvC$p(YN4^~nw2!t^?YPdpY*lw;=~87`?=ot5*~l^qER&W| z%Mf@RcDjqp`d9ajQELw1Acrxy;U=Q1pP4Um8i%f(tYuyGfCsWDK!yA-o510mb;K@% zGoi_KwcXhiF^iUHI2JJ@__c~n)@UOUQ_Bs{t8AA^+Z(@o+;lHxp{ z+4;{@li4Z%+kEQ+?A>6`Tvk~571yP=FIhCGxh+E5%&9KN49z1L{PC5g%a>A=t8@NT z%hIxm(b7F_rSmgh9Nb)K^^v*Rwdm##H;A$34eK^9S+b(@D^r_Rs%|9`@sK$zw+>|W z(n3>eYRQFJR2hlb&O>!AdNAESDB?s&DXHNhmmK^rMri<494;OjehLft<7#cyniGh{S=R!%) zrmTd1hj-;!_8J_MTOBNX-UOo>>@JC8wK(D>*xZ0QO#$hG*dt9PU>?qVe(&>B*ZgYx z%J*RF)W4rvb5*omyNbSIyPA&PI`#dZPyPP;uU#BK3Wf)I;oM+N2KEC$|AD>}bkHBw z`G+|s$iYKHc%l(WY>hB0eTRLX0C!n-S$ElX z#C8;4H@)t8EB;o&C}v|q)D$rf3D=n3ZRG-;S#eF9AzNW8QpMI0t0cQC|q-DrAu= z68BY0@iYBvOqRW9%*Bhvl7M(fLB^qs-dM3zER>@5UGAI>+DeE<+~(jmZ!ePbbJ30A z?O`gsD-6TlXf|6eWIjqJA13T7lO$VRiL z5RZCI9l4k+(B>jn5(6-xpf8cj;?EEQcAE_cb7c(~n8}1fLBTu*=N;PUhVE>13|bGU zUg*VCZI(*9chq~rd&+CT6$eCn(fc&j1`2?Km+miR<71FN01B}1H1#|vgHCGM0qq!Z z&s34nC{3o2{#lPn!tuFv(};wZK9R^eJ!B3R3D2!7qC2eHYN1`Y0A+i5TTcE^I$6c< z_#}DJIEJ!{Y9z8NedR+`;&`dc+O@+fb!|I(6lX{Iqa4b3R9lOktm5#mK`=-{KTJph z6v`&dzKmrLmJLz)y#pwBVKKlMuvIL&U#iHs7VY3%cX+H720QmS86|DFgeONliSlGZ z#I2n=ES96HSQhZSRuRv;I)O40l4(H)ETjg@lra@=HdJTB*S)ddgs(Y)q)w9ANT&NO zWeL3i8`?Zb0F@-MY(raGca?EC_kLH|UCZobsWL3Fp3)tzavSd|C-Tm65^Xl#T{e=& z+~uThLz}DIiZ^s;557Cv@a0d~%Aa!_efImGaxDDZ0TNHw5MOHnp*WllaShHQ! z1o6);_|=Y?h#&4tYGISRd&$D47;I~aw5-^6a{0pYRBy)X&~LtDZYDGJi-!?8N7D-(<|Bu zHZ7k1Eh93Qg9xPb*~Sny9OdYoa<_P2=-cAA?T1D5{rC`cd*C+uI@f0RKhd|k|AoHW zx0ikzsgktSKm`}leKeEfkvQN7V~{yS`RkUS!|MG^B0$42>YYQj)TjidF}nNEF3WBU zWf`M$dJbE708-#vrM>%XP_b2Pl+CBdV9eO1%21RQnUV=>kQYVk24({K=SbC$@x0~J zgJ|ST4xX-_ez!8wu+2y>*MdM?e%8!IeKAwa9cBH-3^2P;!h4wv6g-y9{|EvhaZk`u z(>5rV(_WwVZV0Pby|71W`UUzphMy|Rtarb)fxPJue~!i_0h=SBhEvQ{Qap(AR8E1i`vQY(`)WGNa#QlNpX zgoW3{sEM+vW4TG}>3uDA42kH+>MLW7zm4Vb*J`#EeWNLGYk{(#-v;ffQXZ~6VmvI+ z_LO}a*jBh1+-AD1#0Kr|PN_0nF&G0&nWgMJbzalbPQ9`-$O~3Z1x<_K5@C^PQE5s0 zoX$lvSD7v~-DJE`xX~moci-Tql*+ma)z23|u`8R*6rYBEV8&~z97dXL!c?vWcyyK| zbFZ1wQPOXwRg!Ho8_ZoYo?4$Ym3!oM@*%rFT*2u?I5487fmk z?+sfiYz9+y9Px$zC@5IW=3=pc0I3 z0f;_L%>f*6Aw*KjE*$t2^5@DeoNg_vTrW4w(Gmwwaj=(z+?-i+&di|3tH_+5NMV+N zWS_3dR3mc!V?3MV^d!RjiNVSQjLZn^4lpb_FoT z)l8Q)=X$ESxtX}rF)M+CL)eV5zhZ|~93V)X>jzuVlV&lBOC&pNEw`&yyhy-%`^`8z zp_@!)Sv4W}HI)OH+IL~9_LxH z%S6VnMR2vdY9Wg($JUqoTJTSiwwdd$3ngFqaMk&hXpG9mqPfxCThEyhunQhhGP}A4 zE@|n6_oRE~uIyNP=nM6(UjU_zDn`LhC|%LWa;&R06oCKdkBW_1VLy^#kgLYRxTvx{6(Ni3o_o;oSj{N<;K9Si8D651Mv-X(6;Nkkb?dKn`#_RCI4^d z7``ROOb+GJ<k`GqTufq?PQ9=^(%JsW>4ulZV75B0xB$+oz1MF{ zpM)F13%~?YdI0FGiPnvJXUV8nO6!bpw{f45GTvnV(pLOTWSK31U6j$Y*3W_ z7zHx;83ZJ(pnAF%V}tL8J-}x#*md^JHGE67rE}f0aZZocdXep(bj+@mX4luap#O`x z9kfxq>YO9kL2OczU=xT1Ns!4zaM@R12=1?qh2T!qrsT;kX)gm+gV-(5zXSH#yl;>|TO1VW-|1qB zL==|VK-?Bg8?dzpn>|t!WGeXQXMy9zF7dHvX zkhD0gB}1{=bnj9;+g%Km=0Y{z2FO#Q!DF*Yf>(|hM+7)3Kv5VFb_=fx27xRLngLoQ zt7LjJ{h5J`VK_6Ap+++hhuDl~j%N&+{`T5b@9O{iRBxv*!0>F;9}6(v0OWWd7d+dV zGDrd&2FYA++y7!n`E1#av+O19p9_~YWCAcuxu>?+q`gzX;f|`u&dC>i(oHQVf2FJ?~$W7p7|3^&s| z3=h+f^V|XscJhtDSlMF+2EQ9f8a&gJ7KIsMsD5Uc*~ie#2WB_Iv546$S$Zu4mJy3# z7$u_?8dxNYYRRMGxaGKovtW&{t7PeqzEEEc>x?z85xYHs0}YW%``I#{39m|&BxjN>id<06pBvlEAwbi1MNQ!Fk!a;7F#_()qT!{;M zss^}i@vH*tP)n@s8nL!(S%RfmHwNEq19P(t%*{5IY% zl?N!}2cZdt8a7^UeTjZae4lz>oUr}b&R1*|xuSHamGXRXNVrDib5ygWM%7rZ+yOfz z&LypY=Sj;|Ls(h`SBdXRf039)wuQq4_!^GzzRYZZ@M^*Et1Q zh)>I6e8BtJ#+>nNW6pRsTkbe({Uuz)yx~~2z6O(rum``sLJ}cmvpXD;SMi0sSp@s> zCV?`B1dRIea9cdrT?)0$1vy}HNK!;qoGPSL1@YNDq?`~^Pz9>ufQC3F3X&uXNSXKG z+2KoN^G{4Bfkhm`>y-sl-aKrkPMP6x^9eIGU>?WohIu@@k$&e>%CL;s1c>BvAS-1@ zNr)ZOn}x&Kkt~(%?j3aK1UkDQ9U?zqB_`h)~qCKhV|k{ z#=&!laHOs-VyLn<;(Krb;Ms`vIUBWUO0~t%@v);EM{H3;gLql7Ay`|!2Q-XQ5}xF5 zH&v8`y$sP7)Dht<%>QEVp~-)}36wai${%x9Ty8YJ6?wGkV!>=)|``e0)WnF-fe zW1U3wd;XUNr+VIBZ05BXy#2f@yFd8g;--AWJ8NoA%%7P0gEzZuDmy>yGKp5z=W4b= ziMjpLfnUtEo6XK3rK(hR#+y^WyiUtmg-8Ut9G(Kabn19thYTYTo5`b{OV8fDz;DCs z3fqjQf6Hw{`aziv)v)HU5q2bFPCPXio5-j*6)@)g29upK@tDYPcmr9Q>dfL)UL$Ma z%)DUa1R>9sIlEPMl+ASy?g8Fd^y5`LP>!^$Vf{T+Xfu{_i;aDT)yD4{*%+JR)24(u z;Yj$B{^mryrHw87iuncXTyBYJp?^8Mnp@5H39HSk|G)CSJU*%-YxGpr?Jb>7I_WH( zbdtW^H=T6S9nuMFLQ6VJM@Y~F2$;qt2@nX2CJIIr*`i{&F%hIu{rPb=yn$>YP>Tij^CG$qh+N>MpRmJP1yS05;>xdzxSNgp4I=D zeO9jPC~o(3l-#A0CRvu{bXspHlG-)x+72D7*G;!hb=DV40n1gzGd!$O)2N-RXE@1> zV|sm7T5(}kfwe?arXM}PpAE^A%Pk&VmZVRL)~qF2tI-p^wk$uHAKv#?@J+tYKQAuB zirrOa@ws(bSz4VgE-TBDos**lHL-vxGsR+Z78h8Y$?=#!{?E-sGmo=df4AtI|dTdTG6y?CDD5>!Y|$?}w7u*8&{ z?{s3H0;-RT(`q%k$vf1$OR&vCzVRi|YgxoKD|tnpah{Uil1(M7p`@jxwWLb~PL-S~ z(UyFs{ZuzoZ#kT)KT2iDB>(j3`RkAq@hpCC`Q#zGWH5U5*7w(bbvna%+H4&8Rvbfg zjeK&xkH=m)@UyexHMA=B8anFHuD$4Xu77_$*QLjg6TJKYvc@RhLXY0q1=osqb41)K z=u2@r(+m|k+>$+LS^4W_h#k(yuAFL*UC)LxVkjYWJt!Tvcpp_wr9jjzgXi*cWM)2 z_k7uK4q?T9T|^28oW(;V$2ZZjV1iE4#RZGmR@YJ23$AzB8?Mi#&*RQX=i+o-sxEbp zrbpYW>Q(n^`my=rbcIx7i;o{7c|L>IqRHkrM%dLhN;#%LWl<-H9iKT?OP)<}xt(#^ zcu7SmQSiZ^UIa=WIE_x~s z!HhAGAYLZKc3DU7-nHjsi$ zmzpNd@v4a?CwBTSfzR#4cL!qo(8c|038P!t(DQ>hY?q)q8a-_1GitKci8;xN!>ld{ zB4qFQOtiw{sryQ0-aTQKtX3iWVBSm5pfNaihETX=m z-l9jHyNV=FrpH!MILXyu^kw>N4TV!(&54bfft*I$+`<-Dr*U59JX>es8sqZJo}A^j z9@o0ejjrv9TQaxjY_V-E+~L}nwkPvI*5j@tX}?7Y-gABFI_D~si@F`%&VJMVru$Qd zi!`%L#I8*!$kF7-&fHndi8)rLWEK!!EX9#+)@alT77JLd3H+^RF<8kaLR(2MIYe0O zyB%NTl^9bSQ|YnPU4 zx#@W_I8A6d(iEBGr|=I1L^oXVqdt5$#r{?7^Bv+vk~m|MirP=d8(|_&WGD`BIh3xszkSnoQu_TZ zJFc{4)~yY9I;JoDCFy&UOdydP3TwU$Z+ZUhLw$Q6KpDoM40D7GWxm`3sZcvr#W3?E z6v6}q=fEgH^x9aa?oDle^uG&1t~HIv4w;;41P#ufl5zTk)5opt{oBLG|8dLCD{L9{ zYg7vg>lfY|{@GjMm&4=+hyM$*^!c}feS01d_233z2UH!9Lpppv*O>KX>E^7<#+iL+ zWpFDoCoQc&0mip#HB0Q;Vt7 z)MJuNLqy{<`LIx#Ap7KAnYGHhWGZJoP0j)?mWj`o(n33F5ACPN=y7_I{*7vBhV>}9 zhmhEw&7ICXBA0HTYyHoxpbnxBPgDv=Mp7 z4GVVWIWms_diS3_b$iZEA@i19Rhvmv;d2gBMYcY6+n!a+kG$~arbUY$J{&$X$yic^ zMZY0@fNX^qAsuG<@&h!G{<}1$OK;6Mk->BXG?J94O@=3veers!JTcXp+KXL%h!pzt z*2I=XnwVkU{%EWwMy?fGG?SxyGNZ?CP0=a3SkaHZ)8{WxZ&Oc;sg1|@_)!vdlRBJfmp4U44b`B z+yr9cmpdsLW-~r_sl#c|6&4Idz8<|t^OMngG(U;mqluF}qfV#w#g}P)72{>CM@zNh z6E-RQK&*I(XvL=%IQGftRUtysnu_tbB<%9+@&rAnJd(#Mi>I_4{mM=BC4@aWxyM90 zO~e$viY-Ch(I&p;WXdT1_TkZo^|gFiC!W__`(h_Z#de$6r6REp21VZq*3Y$VFgG%8M^3BKkO+(NP3Wy@Q|UA+i4v@jLOv-H@=HD|c-V(P6KXQ)3%lsWZNM^@C45vY%glH?Ao+BYS#($GSgWk(Gai zD&OI#wk{ue@6`_sIkQV zvAqAE{_uGU{C|50S!^@k{}uTV;WWZ$;kw9=s->WWmqbo6elG9v7y#D%7TAe(euk95 zb1)2bum>uk5jMl+a2yU{JKjWI!4^@V2KIr2Sg{pqA)TmT8@vnGzzX;nPGP&(!v`c8 z)A2(W>OooLbF}MWedGvo#X&Xv29Aoe=2no7v|g_8Ak1JMqZ1&gP{lEW0D&g zfT`&F1a&AM`@}C%bC$r%ksndgT$l%Y$r|!GYEmm~kj6=Uk)<#h4#Qid9(`B9O{#Zv zhhZ7UdW58t;mFCzr|?^eKs%=Nb6AfOhhUhFVb!W#sB?L68C(f%NWBH##hFhD^F{I_ zRgrCo-3#AP7kzBwzZ!UeD$PQdFZ#|K#N-@y;05Y315R@xJ}DzY!~G0LLF zzBmbHz+C8r)$lWT7+du@_#J#r&QTq59+#e1-K;tjxfkm;52{f12IQWFX>Y(*3c(PX zx3QE-M8;A~B3I(LvxxMQEo6wiOWvhwYNN~PUs#a6!rqrAs8o@1Oeqcfr4_a0D(Ju# zxD{*rUM%lEcphFNsU(jSVTse1wv3qED~{W@HK*&nj6H3$XQUGkcN!L0Talkls^GQ?;oM zXxhRzgkO);M}7f(WKyGC`8a-!gNdj=3sIYvqI_LwR=^s#4f^07)R%i<7aYKHAA^_R zE%-Bhi7f!chB7b4+^_<&}5?+8;;ZH)=ZwMtS)Oa&dP#fIX zY8B*iG7ZfYWCohqXs#l2(X^3yqytS4E`fedZYRGW8_BPP*@|V`O&%jpqIrrOMe`Op zNj@QeA>U9`V#-jP9WS@-l{&N z{!INNP7E70^E7KTZ)zf12aZ<1$8sOOWXLO4A1B?a6zN8K68nXjb*b(ov$4k1w23Wa z_pm>z7LqeeChw6xwwNuAJi=<}53G~Sp~r}wSykn1A>576-2?PP`YrubN+nJ7bK;bK zNuHveteT1^qv{PQRk~gE87|EK1m$!s8K%#(+u7}r|A2DU4suepgT4;3bc&kbB=+h% z>HQe#4|Flz0L{`k)j3#<_5PUZMy&5CbUi6#Z%RAhW2Vr*lQU!sjvB9#Iw_Z4N6W|o z9C1fT4tzzHLl^lK_{h`b&twRfMElrYGM&a_YXzx+OvDMqYs^O8WN{GSGLk%+N*d`I zI-5PCKEcN0wEhJA5pKpst_O8z^cRL3um^0W`8cNeaWr{@l;ZRGejM+=4L`$2Y}Gre z4X9@iF*nQvT5ZMNVfVE1 z*%&}(>|3{Ui>jB}H7GND8k?BCE13EHqb<(crbt~+Or4<@qX9w0Y!WnE11;DFmTCeRZiAjXc!=8ia7d~3y>|0r6;Op`$S?lfuJ5p zbjnnznbTEOfM&1MEbr2(%F;Zj%CN(Dx_wbC{`3lBASub+Yw-0)c^9CG_ctQds%1k9 z8RrBNCZNPfihL-S15+0B_#Sdv>t_k866_HR7zwwbnId8C((eS>KM92_$WUY(A47N2uv3AzNQ zpLc+ezk?!ECKb)x`C&-FB;pTXztn+r_F;^^V1|yOlG}rcUwazqz{eHqWlL6mtQ{aN zEQd80V!imJgSmhY*AVo0g3H*|qN4f)XvDwFGRi-Py6#5YNWYe%_b^&8isqZ-YVUNJ zj;2UcI&PyweW|CrmTqr5AGRA>#A*!&m?RR#X|DNb&al;71$ksLn1rT{W(phQl$13x z+&PR)quso@mo!IWFIS*Mf#W5qQKirL=u3Y|s!7f??Lur1$@pxqt61|1N<}U1qo(xS zN64$u7Bl*8G7~Kc3VS&8*z8%(s3`Qy9xU3M?->OU8G3td56OE+@wOpxW`(f)Zf#*P z%v5Um;y=tYfW0os2(VrNfek>=^gO6x4~sP)!*+t%F7Ei_y9)=r)&T0-FJ==HKP`Pi zukF6Wv89`jx%?VI}o79cxJQOMOZ+T$7?hEiJu1E-YNw5Q1mDh|zH zXW6pFjSc!<4;R$8l_@1hA7fWtV4cbt#P@r=VxTBRQ4L3)OPoEgdx@|6lfT+x9%!xG z-Ya6b8L5w`TU72d-1ZH5t9OC|pMiDF@u@}ltd-X^Nfx=+l$*wgXf|-^S>|>}N=km_ z;b_|O2*O=~{S4(xZ<%6MNmdxYq7zfi#K##?8Y$v{2anPFIJZoWZv`YAGXk$@&}QEY zI{*c@molrI%x7SG7A;?cq5}y{T&Xv-f>EgyD}Okdxn7WLNcM!D8jx4Ui5{iy-dy); z3zYPB7FSfLL|Z&+JT3(iwq7DH7GB}#kCrx846ku6JqbqVU{QB2H3O*y!zx4+OJ|vX zBsemGz8iQ@cSwy~Z&KA+o59ZZSE*M40kw~w^AzekSJ$KHw?GEXm%?7wYE+0wyULD)YMETbcO+S7x zJO8jNowNh@VUGI4vV@kcH$;>Vd`C!`jvUZ>SM602{^vdG&*zOFkfL0s>ObtLS*;p< zK*1po#L}bOJfi>cIea3xBr0F$^J0TUn&15x1}JzMK!Y*%$0OR$Amrl$WFNsUXhdFm zlWwLg;B9+7{D?Jj(AzrI$IZ2{)&i-uIV0P3Cy#IG!U5Z zA0Wtp8yUyHfIUXx_K-xOAdm@~q4MA3D=DK~N+ls*L!+X`e=7|$!0T9pCx85$-g6KZ z%(9QI=$=3I8NACnKqyUHLm%yt2^fL=Zo$K^(JhZFvPw1jh0z1T#GZRel0Z;_g7nVg z2Du!rtO1Y{I|mzAN{ljK$l6i^u-i1_BYS`?D8H{v9hy7*0|G38SX6KwN)~$77lQ== z=MOtS!q1T=X+`#h_C=#ILw<@rDOlHdSwhGRmL6NzVHB9C)O}eY`yo0xDs-#gv(**P zv+U<5m5 z1Pli#xMqB1)mOYc!h&SwEBV!kumHeOav)zYChl+W(0WyT!?>*-axP|;B&!*vOYP&Jz_K+LRCnxv=DW~x$ji)#McRwoZ@jskuBR7rZnHE z$Qj@sQoWUL0*}zQ1T*>rp9z2hp$D9NUxE=aCle4b5t2I61wNMXd&KRAOll&`__nmC-7-~^nG(j4X~*6(R20dkU|Dd+4lA}YF_W;rsX1y6J>gYjLDvL5xCZ)<(oZhj`l^EqJ&Qh5p>mr|rtb_i1ybRh}snfJorgZ7;SAK{_ z?!2yAt_BbGxM+1whAMkT9{*l5eh;!PabQrD@1Y2k@SF(5?%-BbUf5NUL^pP(A5Hn? z^uzk^&wT4xM7HkIefzx9WazS(sP8)E?iT`wII-IJs0d0gmm|?pCtjp1NcR$^xLZN`ufNO(OvX7Pf#)2m?E~)s_`U`?1riSiPI-_`D zkMg@mHF^ccC{g9+Z7`8=h+C90Pr1$j04jp-z^!t zP8h3MGie!bomW?$Vw!%fy#7I|>90+8%$>1n?%HYIFl3%&%A$lh0PEW*7+>k&Z?(aC zzZ=q%A~eAx-S!1jD#X79L?ulVB1lMJRl>20;B;p{%)fA^djo$^K$)iIOd!HBcVzuucuk#L0?@qtcg5yv@7(>7*l|b=1aHJo^lhV=sbR?foBE_H=>;eB0}Qv=DAkW%1%q z!Du@zm!15L#M1^GGQDw$Ssrf8)qLB#Rpzdsg1MZzahb8>d7gpf6Xex3fynX$mU2Rf z>Y3nKH0$uzfa1tqShga4+E!wXFpBbg8|+rkLAPc)ws#T4fzE1t?x4eLV1BQ{`2nzM zx_n(FRE9h!xP%d8Wj=D>>UcA_gm(Q)yH5yc5F;9c$T=)=IwW8T=}2TX;2P1?@l=7G z>V1_g57So(k1FCD=d56%gG%cgGd4bTT&rzzh`}}#s1(LD2Y-YRChXcuKKr!@l3kNfLY|3-uG8@K^m#G&e7bNE-XC;?nlu%3! zq*zKPkP4@kvX~=%KVM=mQz@B~&?pA6g5+!8MAR)(2&Jgj*sLRd5*f0>OqWv3&RcNt zB~_6W%uhgg}6~I3!i>%-*IR} zaWWl8gYg)wby3DF_Kyr4@C18VVlFwnmb7+Xc7eoc8J|&vrQY<9mk9Pu+9w%<=i9p} z9d4{?hb{zIu8rM`pq*oj9WtOG%Z{Ca=H|Ea&`eSm1aBPdNO(%ad(z8wmdV5&FWV12#HZ-44*f za6U=u2bm_G2e|}}%cvqN>JB;OuS11LWz;M=SjFgAs>#7fHh`j&-WVG^{_XfrNc_DL z>P2Fn%1RbMD-%Bn$$8h{+G8|V%HubOPyJPIhpZE!nsSmm&)BO$0AKr85 z{>lB#oBJFGM|&fED@fNgZN*{hEqdsdBPvHrxBwjWNK|@2 zqU>C)C0~HEN|pv4h{NyKbmm+2p;Rfsf^Ech<+ljkmggamxSNJ!063M6gvmQujqSA-{Ull46MHd zg8H^%MrJ0aj=!q;B~o-WvQoik|E>IcMC^~qd&k~x0V78IUv8ol-W@&te&f7*o%+q0 z6+YdciutWRr%#T*RHbC^Wb~f)ODdr6VDw(!f2Slfdk05BQ+@kC^dP1Gdz^vsw=VsC z0Pq>!hv=8DD>`9o0~jHP-b1W!`QN4QCkOLy?f9ea-@cjOr0?zc>-TRhdzb#!o`j42_`e>Ce;sUwKV6so`ILNjbM~9w|LH0D?s)7E zCt(bX%O+1j@bJ`&SM%8m{V ztJwi6Ac#tz%N!yONwbJAp0$WIMJVYH4j!_+%_5$PoYKbnUHl94_tD*t%fwzV3+^W6 z*x;u-9&3-SKC5`AI%AA)aQZY32jej<4EzsKzfL zPk7t+C0G*R>Y?rBs66t!_94zk3y z_}GA06p0>xukII^`#F>-ng~yHK99CmcW+f2oeI8OQav!>Q4x2*m0Ec@wKUeD^I&GU zaZpBe%utfiDZ#|VZ&f4BU@+d^%vw&jmFdIu$VBf0VljIN`AX^8t@)Qz>Py)WO2vGs}G&HH97z52vI@+m09}H?P zr1-nyASTU0CclUxXI3noCn0WUhHpu02~7&jkV z&qkM4KrvV{z8ooRG=IxG8}N`*4HIEy}u{%Q{@ zmizk|v!gs2!<7a_fvvJ*s~g0)E~SQ;mhut%P!UP5=tt*noL(-dH*0`V2og?)H}O^7 zK|vuoOG~q?EZzj%y?#a8lsv9Dm-T@5S>@C(kSsLAl9AHtJ{;B|OB+}vXIK^rHAPa2 z|0JT6+rmq(N(BsMJolsAU@UyzGEg3WSFd~t4}2Iyc+9ti{M>x7DSN6@wq$!raz%-J zV70Iva#FxHird6}4erJS*3}-2Cs~ zoe41!nKj2N|7rTXU*KfW)`V=~G+0=>q{>*DC+)xmmrD^tw0?wnU37FJIfLtqFS8te zvZbF$1>)I8YpE9gk(4|r?vNs{0S&C_T+2SU*|uB1L9a#1-h6tRaftHSJRm|89xiJL zc(Y-oLUR9(Y6vKnd!*=5Vo(r|w04rB=w_BqX1<)_n+C?yWGWL_f==yyQF#AetyZ(q z{gTa^E9VcM)_enFVQtYWPr-~F_vf7D8@1{R6S%Sz1v&X<*FEg4I(i?*^is=K^HhVO zxDrV+*(a6(BajE6wh+-%JG$?%VUlc8nbI*^KhHjXuDi^}NcQPKWW6 za%U3TuvxRoqhLr!VGx1EOJ$2o8XVNiXUB)deg) zIaH3%IX`s|ytJDTLAP6);{y&XxCZx_g_Zosl!HG<(GSuOTOyyPXRj|nzp3u_zmCaldZz(8IX1#42H|=)RU8FaG4JS9{pw=bgm6BpP$s+S9-fEqXf0bolrR0@=+505eST4-QqEz__QL-5e&A5rh?5chN8Y0L(*!aMFqdyD22UqT-Q(14Y`=vLae<%sLs-Om zlg3<5$R|p__Od3WJpDBBQKo&EXT;WyPDE z>KvnX>PNvv)8wl5u(;X$1Dpqv2dpd1;)+?_qIPkg0`JHdi06`rwF4Ltuevtf@u^aG zV>S`U1lanzhAIft)E1 z3MUnaQR0zj(agT4K&4V!4@$4#0mh*p!lXjeVKOr!rm!~}YzGrkc6Q<``||K(dQzt6 znp`fTI3myV*NE4_QT9q`9H8AL=+LAgnHFV&;|N4%A}|(g=0`+RXd-rBlkT9MNozolC{e_BTs?X8j>56+>eGv}Tw!_HG8t1G%o(J7TIFY&X+ zQ)jALlfKd73OFgJ$VM{ z3xv!YZeuJZ4NRm7g#rO=3FYr9+36R=~yfbNt9mC{hUKMGAq&B zc~Ardkby&$h0QGtS=u|oZJ<^x5q}s44!_>!%iGz{bM)M~zebCt_i#dx?dsU$!#Ry5 zO>2i9#|9*euo#DAZ%nVvX2It|F$r?$DWVV#jN#jNL^GwW8g9&X#NVc-yj~}r?jRehia~4KSK@0cIsk~=VHLzy)mW$U8*N{{7 ztKLwe39|<(brs7ja^x)X{H}?5Sm+6~j@2c&YJ`u=w0Y3=Q_z#|o{X&X(jzklOU(&U z2@)^D)+r>yRfyjrI178(Qyv+k(yn2I2oWm|k;}Wj*yPWnsGI{EfRAg)2>ejuS@@>Bo z%@d)wsStVwm~=3)`+R@pm%QZre)Kv(39v^Qt=y6?mKTuZ=l%_$Li(l~ARW~;mb14M;NlnZb@M*>(2v)3r z`bM?~`tdyBn!qezvEUqUZ$8oC&||6eX87HoQ87kpA&q}A ztAu3j0y+a?hcp?$F%%-|@yNtR?ZnI`D$4zA6~YIi+y&8HbDp@>Z~U@y%Z4}fy4s2@)UgSOsR7oH5C<+PYtlz``zMAp zX_BkWZ#?0TcK)3HNL`J0(sxefDS^dx}zC>P7 zZ7_TyE9#GZDfAF+?*H#xg2|Ff}KKMY)*KI!(&d1^+}l`Dzoq z1_K)wZ>{D_lh|!liSo_Q;7s%mTtpnTj=D49I@j-qbX{!X0fRG3>iEetdCDX6BQxKu z7QBLgM#QW66SI5zts*3WXLA;uwSaE_nHPk&Eczg++rqRGBaVm0$AJgt9}`DzP(09b2-3=Bk{>ZHoV9;OFV z8f23lX)O@R=O0~zM`#PI6EHt{+rMt*Dq5S^j<+u1328td!Nv}t%hLw2ENN$yLa*UI zfT*?H^s89A9-*W@Vrq}Zg3~c9Yfsnlhey>LtZ>okOtb0IiI(hpl(81+BvNX4 z_W-LdIDgTA3`jn-F>t$|GCzryl5V`TW6A~QvrkMs5LURF8oUwv6v4~ro`x9e zW3_T9vbe<3`fOL}CY+AZu5hbQt7C1!Y1E*hOv7;U;MS`Bo}+mL>-7N5RC*Q9kv(v} z1W;Pe5D^+TYs*E1F9$J3n!pkctj5rYukF;e$?NBC0 zdda^BO%r~_LkgTID7zwF4B~L(6uE$K4a5DSU5SjSy!n`4eF!E&46eNqbmt4V6AW1adPc$ibVoXJI$O) zBHXFI$#M{X=Fx^5w#Bu78sCc4ha1j?73@eNb7h_AxngH1&QzQ{{*8pCVVC z+**UR3&W@lP`A@tNrK)Gd%xdXTaYg>Z8f$sQa+u z(VnkB#7UJMaU%N17az~kaQIVKzwm7hBB=hPB&^NFP_00F>AYo(kOROmM0dF0FYJ?A z9MK8ldl7w907MZ^N8}HpW>0ZMR5t`Fp$v;MIK3PXsG9Em#;XkOWW{4R9?%E zwBu4Ku2*;I+Wg=I!VO{}7GZrf;OJhm`F$!9zZ481sk-dIuiBHmk zuaHq;S)Or{?`oJxK#kTY&4!dJQ$7C34;m=6ATDF4I%X3tZ0%lQ{i&HF4P;PNgN02+ z!X4vnq@8uKRTTy2{YV=*@1s)b6^}u?0Gm zDhCV2y`Q@A#x+@}kBrG^L4nqZ-5w@R-pYsT4JA;I9d$D+OH4Cg1=j*(EHj98q;Y- z8+eyzYb!ZS*kJ;VZGw#{?RR%#Hna5^NH!KW42OXY7=7Z^?d9|Bi#hj}OmwfPH&7e% z^*{RW=wQ$sIBujBvuh}T2(~I02Fjv!s%-Q&5Ds?*=6@ro3Y@>Z(eI>b+RhsPK-9tV zaK6I=MP~lp`kZN8;k22?CRXX2P7mc%Kh}PE1t&xLxgd$~;9q^tIGoo!5y`o`1_>wxusr0jpEB zC1>ZPWxfOh`JS%QZh(xU+E$;B21_AYzoUDYL~Y`+3ArhwY8CD;fq@#@_D6E#6J2Vaw$YNP+JZr6 zO^jxR?Rk5{DB-tFr;IY7*x38Wha1%>y_!fhhLRF3LQl}`2G%D2h)Xlm z3oL1o)nkH;pR?ztLTg)yFA=@j^>alFbx@4(6h43|7m1X~4Yx7?ny0@Ea{{(9q!c2} za(aH9tu;xwzufd{SJx|gl*%YlJ%x*GQC%H6kOg&7`PS}mOp9=}Q)ux~%rly3j-yX= z-5gb0yy7Ek87Q5%anSzsIzK1gFz*WkttU`^j#k=)Ziu$lM+3ko zo0+?;7e?;|zQ`4+&*$u~nk>XGC(mq!ezUF>c?(UzOceXp1$0}|iMWA{=Lj&Nb>Hve z(G}JV<3%7LpMx6kW8$~?z8;vOc`J#l@e^V!76TK8ha*V|EBl7Hhdviz#!PJ2fGhdw zmM0y~s!aM0zBtf*O0Kl4gzvIg3@A(r%&Dp>B$=&X4nEG9`0|lpBv2ptOPBc#hNVDe zVH=+UcK}?^jc9DlGvQ$d2!=lVmrk7?AsQ-htyfEC7C)EQ#9$I(D;G)yOfh=-$&*u4 zF@w`go{B2Aa|4a8qk~k}tf&PlF^A}vuvSRp*|Gj?)JeYJEuOE3k<~DA!JGYy((9rR z$jiYl0OdE$V)mcX)`THjUIK}4h?|9#)rUdPD2c1$EromN21OSPOpCgBBQV2$v_%qq zYI=RcpOt-Pp5gS&rNEAvGJ=8aXG(YrY{rLRJlVG6X4o)7`_P%5otBU(U+xD{j# z#(PHO>SNuyR`?`aLlf<2whjImRD8p63exXEoK3eyY%X&X$&9{0L=IEap4I=FA8}(g zqqq|U3fBxJfk4iA&9l9_)!EIZv&iNBEO%bFA0i9M4Buy|=jSu7yp^m5}*cOvt z&cXwpd@gYloF~`?U+%cd|8+H7jenmXU1%Yc-q#kEAFN-EAwn^1DK8idp$ohKp1A>E z*i;l@s8lMDfm@qoLCA%I#SqDoFm<1_PP|5Zf!JDNl4|FKu)R7hXAm0&zxbHp3JVmb zbS4v>6IzOS0CecpF}s9f%g49U++xTZ?}7eGI9Q#^#nfegzX}vd{EH&E2?9EHcg5$o zKuF<_u?P@Zka5t(s)?eBMR+dfislfx|(m zZ1oP68fi zHj(vn^2P$Jmg~Dmt%kU2cF8=2#%N<8=>sdL6Wt~~U;uv)my(PU2~lul$qtTrBbZ&g zh6=n(VH%Vj#U8xY!u+Yc4g5JQaC!eQZBJfH*m@VylZ)DXq$?O;Ub~`wTHd_`FUsYP z=hrpKy^F!~xBc>&)A(X!MKR6yA!dh=On2U|3m5*JHxS2Y9KdKAj|s)MsE4h2hphqb zX^%}!xINF51^6d&9B7*gW0UoS~-v>#i*Hjn}R5PPn{OJ-wwSoZybQJT0o ziw5}6bDD{8xxu5^k%;N|?UfKmM=t10D<@VKcC3%>*_^v15e0bYdPVok#hB(-P?A&d zS&RxWDH)XQ6`ec1fgza?PURcls->*govqTM4noLKY4q;#psUl&v`5^eTV`y+TGJj- z-gZ+~Neu>?5>j1Yt{#?)7c-ApVG+RH}eH8CprNv+pI$ush6 zg-Vq$L(|BsWAbaSk@u95wOIBv0ba>?(H#&9oodYG=;>anPlAm%^V*YG+da4&TpGD8 zxw_0{M%peP`{+2ws4UkgSNiU~%q4Zfy#(25@drctX|0ICTFNnb%j$byOK(-yR{_>` z%2Xfx)Mi76@UX*enLbi@pYf(;;Ng6CLz1Y#f+))p8BR!`CFn)05P0xVtPp$ftJoO~ z@i1X0Q_F#qVUnI50;dOb({j4T_CO=1~v;>x)nyrd|JK-NUZm8GEN2IlwNVj_*tBD4@r zd6i-ay#mB82)$^;s@)`+DV;tkQ2{IGC=lwDlZdobUjZ@*WGopVx(=N9O`+d-@S+o~ z1&isDGw_6ny^?>lmwRCUF7`l<+-*^IMPR+*1(v5+=*}2i`YCSp{9E+uiGu{+ZFXP` zP3vwtb?f#belKK%*rePy=CHRvEm6fEA7^mAk2{SK4vKuyNfz8~*5aptbTS;<$@;AB za4FZu`a2@(+}Xr5xl{A7=#l3FPU7a=9r9j$E%J6iJn>V%k8o*fd_`)6U8X*0meJUM zGu7itP<4;I1XC2t$Ff>w(ykQeR&e$PbRnu?SrOT^pY_5C!3>?PP# zeBt(0JqenyRG#!G;*j+a^FUgDO}uxfE!`^yGxF8bn&iJ@y=PXt~qDZjAc{N9r{)vzL8z$KC!g=g_KdBTn=D= zWUE%L)aki07Z)e~z6W=YR+c1%m8B<^LKDDx=0{o{=Zw>81?#)E8;S!5 zR?0gi1HH<|VbAP>D2AZw zEP>reQ7JZeE@wSH*OT?aEoVHw&Fre|ulQ=Bjfh6v!zU5!)6>f!Ksz|h17QKxkrT0= z1yZ>6sOy=)`~rs=y+3nZ!g&v8%Tt~}0?xBxb(FZ&?H6k3<~sWjqPxq@6Y8F5-()N9 z+G-*0;2K||j{9xto@G;p_S>O3Zs1r#V|sV`P|WUtl973+g}#HTW8ZG^m*Kvq%S|=q z)b{+E(UuxY-npCTP3)@a79HG64WbnZz)?_UB$gw&|eJzyLPuN97xKT7Y* zW{nG23bk(FiL#fio{640`(SS{uby2lh@H8fIYx#1M+C{_oD6P}$z~W5_4bF#qSXvR zK;6k{1Jkrzt*&c&bZcDuloZt{?}hg|wbk;onah=4Q{Rx1Lu9b@k-v_nUW)Q4U1eFB0%ainFbBXVE zPKbQfFBV8-qObUKsHUG#!-gR>6_uPw-y`LyJuVN`0Jo)NPh^b2b>hoU&r2AXLUYybpz8do0e7zvG7Oj4!;AM-H z%X3PWjFH*c6b;e;j>OpM1}1P6k)`}q|MpbX*shu zK%w%NnSWRLFE#$Ia>hS3&dBilNN{ui6}0uAqS-{G6(wcV{}s(fBVc1`_n#j3#5&a<$n%odj~cB4dwJc`Tjp*+WrTs`p1=#j$wEmC4w%>qW|NHAZ z5beJ%^$uP84Yc-8`Tl^I{g(Dy><`e~AK!nLdk3feI|%Ll@$lE-`PHO9hUbsx#XDB+ ze+EKhVrFOl8wTyCvX@ev5o-JRqX!-+y0NPXIz6ysu*fA)C%^mzB+Pt;y>ek@ybw+_ zwQ4voa{{xp^fY~Z(ZI}*ljNw{d|dVlFLiCO6En;n$i~ylD8g)04Ke)F@9K)Xp0*d~n!#c5)z)dwdp~uWI7os9p5nyp z7Sk|lc3~SFNag(}zFYN`T@KIPmxvB~HxKYpX7G~exwLww4AjZEF79;MT7Dlzd9cc& zqsnl4Y;jGLCwEMpm@BI(kVaUG4JHgA9xtW1+)Z*I65^X8`tCAjHN6L2-(#6RF+uh1?VIKuY=ZXQh-xE!4b+8n9ljb}~fA@oL3T&fw*^Jk!ad>g0@- z{_%?y^CC*MhvaWdjQ6CgBM%(V%svvcK}orfK6c@10K?RiYJEj7lAQ!JVhcrRyLP_mM`&Jw!r z;+|+bJ0wDwv|I<6dqd<+^Ek=aJZdD<^!2m6bz_v&?q3SG;yZiGex^U4XIMGyfEyOC ztZWr;vG!#V(+=;5gBNTJL9&S~)zsMaug*I&U&z1s%U;N@OnHlHIyhkAnr8Hf-bEdj z(L#-Xj`3mTj%F~#+}d6Vr`}*U18^z?WDy=!ye(wut4%mJMGdSd-j?0EH>d4wh%8KeeLuNFZ9Oe4xsRh zl5Dtd#gvLhMIE>@>2YJ%qTz8aiDQuM+kXhPKg7^hQO$FVC$&Vv7tCWY1=YJq+;y=W zRZymA&!cm=Df?0NV>rfs7|AdnjVc-=!7x&dkk-tU%Bj05=vLGZ40U3?d3`uNQL2bg z0BH@L9_W%ZZac`$G3`>}q>z_7UlW`Co=i!C7MUUq6((VjZF_S>T8xrLb3vLsWjuHy zT$`k^kC4UlsfKZ5{lh4sxXf{hx>g!x&BmW9CaF0rL_r>-mH4O}T+$pfJ3+6}5HlfP zF4ih6nc!x#Q-wqsX|(TS3PrQT5}=b^CC zF2(`NpfV!yl0oPMDYURxt4jI?7Ea-Cs@yh@Tw2QNt*%&w(dFFa9cRC%jhATu-P=wt zX!8f#oOgsrQo2i3cu2UCr(DjS(e)=?!B3|x5#*z2I{eX=-Eoxxe1z?asIVFZUKd!} z8hhy~C))aDV#C_{(&N(Yt{UjQkveMIp~=`>S5$|qZhTYCryS-l_b(4}k1S)Gg+z|$ z7cH)B1JkUbiot15*I5(5Cg*TtIEtj-rNE4EQx2rP)ZE<=E{sCxSSUOrT{M!(b9t3$ z$*KrU&T=-$ja#DeZE9B4lE_rS1#q9bgKVDeID;KzJbT%P@0#IsInRaRt$01#J|(@R z*^vg1`@s8QMRmozC{lbdX_`cfQ^`;QD$dH96cpHFz#y>zhl~x4Rb;FF=PfgcQ#;q zX3eR>TD{nk?rS5VZKcDoAzpXt)9JGaQ^lyD*D-$ja_-S583x)HO50L7Q=qFib80qm z9mdlvdG!tSSl#r*d$qtNaob7H<=cG=Tr+w*)F-m7`Y_HuhcFxf?xUU?E8bR~&sLf% z?x}E^E3P6j-lYBo814F&`cF&YqhST#91jbgT&F_F02hcUQ+*c(7S3G5Ry$m|L67hx zXO4heOXsE{NwVj zI}QVkul;znwS5n{FZuCQ7*u#CWGf80C*Y`ZM^L&epS+uOPCB2Rsge4sKO{&LBs^61 z1U#aLqBUN9>LWxuF`_o4*4uXap{Sg9s;{KHp$edc+IJ*@cVawZGUBjVj{XB9oD01^ zNDiUPieLmrAJ%|%D=|z{(GJQW-=g80`sY-P9pxkfAq)dfqK>4#q@kpk&?$K9ulx{O zXkl0wy~2}C?EcxNKcb=vZO*pb`NV9M88x!c9JCRcltBfxdR%s;P9D*HP20L zq0ehH1Tv@)8(LO~W(bcl^aU-AX?b2dIf)7{JG; z`G)CXIXYQ?J{i_fqA-N6P8!kweG;$`IR4 z*h_B<>Hlg;^fwbquGzW=AO86MD-B&Q#0l+5RNnqn!+@aO1pqoK7zOC}zJOO=3(qDo z3O$p>b~YlmOf$1mE!ATljZZ)m3QXFUsyhG)%=f5qF+nwzpl9%{@G&ut-}9?=JTKE=07!q z*neyKzgj{6YkJS0cE$fC#LDsh+Tx!NR{B3FI&4e~|8Bedx-b8x$KUVYKMij=eG{YK zW{aem;X5noS3iFra6ucVH=-27U+7khe`VkZzOfJAxM%p}2Kr|9Huwy*49v8w_~fRJ zj<%e1biafq_WHJ_W(E$lHufeIzfC+jdmBS11Ec>Hby5!1QJ${!6|$s?op682_z4hPS)zO{IS;`zCuI*uTk`*qPqAcYl{L zvoq2EYgrZsR+hJi@!!faFfg#ajq2ZIOl&L+|61Rh?49%V_k8U1tp6bUf3v_a&%(kC z80;u|P0Yn58AUKTIq@r4X7r3-E9Nie6J-_@Ubi6f;4OBU3|TQ}j3j ziebdLsgZ#Rx?4<*49$_uD=A6@ZbdBO0;Ry<%&JsSx&oDTLHYS53gGk!83^#qOUnoD bbAzSD;*!Lo5^zd1H8KL0m#V6+{%%|V+l^JL literal 134268 zcmV)SK(fCjP((&8F)lR4?5av(28Y+-a|L}g=dWMv9IJ_>Vma%Ev{3V58fy}OPrxzZ-)=TnqDfJ&LX)0HDY zfDFkMWC$h9G=$y8j10ZL^1B4dRo#G$A36=3+7T<0Nd|*)V+8qMujlLj9$(MbfBP?A z|NZ}QfBl#L`$}_u-y?mMoW9%m`ui)5@}1`hL~8T9=NEj&`&{1eoxe*hUq6Al-Z$HK zt5M6TcOJJH(P*m$zPW#H%QDeZgCh4}OJ)cT$8$B66e zY5BX|H5v<0A43C1M0fsdjQi^ruQi_dX277(ZxXx&y1(cB%mym`{>MwR_sQp-mU_Rm z?;z=uU#gFVxWDiF9sA7R{Ye3h`@0p)s^F)U?>je;%!vAaqD{3`-aq|&^c3F;@Evr1 zXYM6ZVBSH$1R3q+u|Pd9Q_Orc8L+;IMvRGG{n;4w`hK~et@dXPD!v;qdFwYJ$XoY! z4Vu+Ov->;U8Ek&PE2rJ0QX4Jx`t`s5k6_08{onKT|6KRi|Ma%;e_j9E{|>@@{hwF) z`k%l4D;W0u@4v$zeXh^?GSS~xA8&u(i5<_|-HOR5?~v+3{8@5KsbT>-+!>_ zmuuf~rPKvZf}EEZ1Vw%p;_cFSDDK||@&iobn)^VMf^}QkFW@C-Cw)tQJJpG(O|5N= zX0a45+z$i=FXp5SA)xoz>MI;y@R^U8t-VX#DB6<>{REhMiFXl#2b5S(n z3-p9=AqGHy+?`j5Vpwk6-(MAWfcau{fKT>}y}hgN9B5&uJYhbh zckpWxuCG_z%}vr5$_Mz;WWK~aNIuqL!fIRKD+AKo*w2ZXeqc1N@0togk{pz7U61EJ ziD|`LwD%s z3t*e-JGcknP+MIS^&+}j8%@7=2?}uI0yCKXisyw%lTa&!N+v|s%k1dSiGVe7fFsrG zgeQgSLWIhBX_1-`=@$&r!LWTrB-Ge1%puTfTf9}(=tf9U`Ucmo11V0xoR?EGW3uVZQC|KKA^n<_08h>pVfYZu{ zi|GeE6%uhaa$IP45VFc_2#_2n4dUOW*(tH+yWU?|&sQ(UdMK#(2XI``?++L@uihmZ z;@6tDCup8E9xR}|g$2N_?>$ynv#NiETuB#)OW^5hkNxv_408Bdf&TrLwuMek1hxKd zNXSdG0iz2TisYEeNpbgUs%e%_FOzq~nEV5#{CdGAg9EcQDNX=(a{b$$e}0wSMVJue zf3>MrO03uUofF{<(o9V(Kz&F9Eg&^#{*_f-#!kYL8n1-X^RNwGP_jcHACJEIcM$qI zUeCQo`+7drvA;jQpW1fsUOC&+(fRB3C!;$YU8k7W$N@#?M3@)8>!w?Ox#bC>UMEZ+ z?SNBD`)#a|z8ilnTQRM_4K+E~ntE1W*;9AdD~-gTJ+w+DTm!FKQ9+nj5+&1JEczng znFL*5@D5t zwo}@aK6)1~l=0i!K)i2PK)FiNzN2oQrtHDK@Z+H(=+gSKX|T#$U1~vMv4!RB-(RWs z*h+oB*j|-6-1t+#GcRU+{1rPdD8sK&YAtZsj97?QTD{uTZ(opFYuXo}m7c|HA z+D2o>xCuTdSwh*0Xjzu1D0-c+c_OZs4npjs@1Jtzu$?xYoSI>utGSZeH^qpYPj< zLg&mh>inh0d*6dI!^O~p9~W(cT}``SW>WV0`o-;70ApKalAPnUKn|Y?0k6Yndck!1 zOg(Hy`%Eu<_(XlI!HbQ0TV6PSuPfvLpJ{>1XF4#`4;((z3-%A6sY8HlpXvSDbNWoZ z$;(|nQ*Uckz-Q`RX1IN(-j~a1pQ$5=ynLn?YKPDC4n2MNOfRAyK2x{T96r;qlf8VV zaVsKWp9vGOeWsYFmQgyIgh+}OX~YTNW+gu5v9{-dMEk*@R=4u zJ`;H2@R@oS|A)`?!uj->z%$!tdZGT|Gj-T|+h^*w=j=1RVEOc!`dASS*jO)F?!#w# z!TjMffozA*G;WH*?sDMGp7_E2G&?t+5iC0xjT>m)oxK_OWUTFoG9U z(5bRJKR`s#k?VGRTUBwshof!;xr&DbVmvUd8v#~;UO|&#xH0WBgIyZHSU)fGU4SEs zjVRvF*F=Cos`T{;CISTND}vGUUR{@Po)&LF%-6(uVKXBP*m*B4u8}T8A&>mw^VUlf zK)W@PdaJS6O;AX2-b=4#b_RP!)LR_`p_2xP#?XtXb;UQJJ3kmQmr^#GRhC(OF=i_LPEZP}X(d4Q>z}LLG^t><<9MB|daI(PvUTf8e7cAjC zzVq{fjPOI2N<+hSd}OVFw;>vuq#cZ-5FLnnH;WEg@VC}Bwqs?W`|XzrFTyF>f4rf@ z?>9^LchQgM1hwTkB7{F<-}S)o4GZsRF9Oc%ds8#u{@|q&z10${AH&)4>vD*yAjT`m zN;#=DsA{f7PVnod{;$b^te;?}xdh7JUoRqD=L(VXGGEc}<^A#t_TnuOGSt|sbiTIq z3upV`a4)7zL)#kf<9o{wt916Y+XPMfg4s^F`Kc>kfD+|vHieBWFQ# zUNB^xBx_llOA;uvSTq;T9JZ`2zFvtsW8GfCdz*d1VJ_BA(%TuDJap*+Q7~f}4=ih#crqwj z=0G*&800(FM;0(wd|B4FHbbXkOO!R(RGv`DV~L`d=BH%(0U{zh{Jp~xmNC!CZapmb zOWYEhm-P`dE$jV@872~QVy%F0?*9G3<6!#h0~7vvWuOWCc6;RN4!ITU17vjXV3uWU zKF)A$9%_Cv*j&p4gYD;PnFs;ypX;~HvH`PnLgqimT6_@>WuVtDrKcA%2n=R)&lP5T z5j9CL45-IhZ1ue=9ICp=hRZXo45XV3Ieq;3c@%+y0d#=DUxDdlm}0Tkxhsptivw*m z*YNSItw_#O(X3}!ee+mJl>wz64NkfiOA;%uXsJ+bR7cmUg&LS@h6VmALJ+!bdu)ca z7Y6+7%Ocayu`A3;>rj5zVX%SkdIT4mWKdb&0(i!o#-`-(*J-a^;4-gs1Pxwrq;Nj; zG%|l;M<3GCPd|-3ENNO{LtT`x&prH1MAJ5gk&(r<2% zbH_HH8=`l^c;S@}<$NO96k>SudJ(TSY4tFcp8H;1cr6Kl_AS`HJn5uaA)=>kExE zeOrc!3Q6;`>6Dn)VLD!f?|RUA!@*{O>7Ku6L7_Z<;`-XbzUYL5fvbm(6?za~I}*Bv zsc7T1>ELMOqST63E?PRAxrpufr>Emuh@U-U>k-fBYJ!vg@ey%_dU0*8aa45i)iDyW z-5P3hWFtsHzWpRtaCXo$I6vt9xi+|7p6Y3h;OHwuEdLc91soy@;ZeYL&t(KZPln+t z`arG%apsXcPg*kEoc6pHb2^^5r>B5X((6D(AmhY9aRBE2nggXw_UD46A`D>RDGDdBd;PKl}R6}1Kt zJAAs~Y#aK-KnFZBt`$Iar?9$L2=&AuhI+ySBIbZ)D;T4gsKThARxd{!^+YIa`aDfJ z!vDZrJCynwP>ThtTizH2#_;*j#=>C1JYJ{~P2CuUQ^_?EejuMcS}<*Kz$=2aU>H&r zTYW`D6;PXJNEMhREV#fza5AWR5mBBMRyAL?xx=cU()~nSOiY(Q>@w2v?$_~1S(XRw zhQ~U6#a1aA+77N#bfgx>;lTqdzPji5Srbu~{v7#`H=){|5Wg$NimpzFWbi$}k?5kH zdT=Ys3UbuG!mL`!bM8PZiJn%Z)kIHKMo{L0h-p@+)$sLo23wzWzjJ>^TThI+YGD*_ zC0uvF74W0x>BGw$)^o55*4xWYt6;Z;X2lzzH zwG_fKuT~HisA_7!Mg`ox8~RQOz+oFAMjjZ3O)kz+iNr~i3?y&jD-^4b`h}9BiBO}t za2S*M8;ZsP?hbb<91F}!1urJm*zs7BGOd8@Woq}nL$ZMDvqL0+Q#mtcF{QPgPu#m( z`pQk8aEDQVi7A9qd>*B#C^AcMv5m4RfV%sR&7#gi`=tub0`3xj#S3dlJS#j)SeB^c zvqpUF0PV&oLd$OyJ19flq7lDiv>b>PbB?hedif<5>AUrEQUvyV;%)m{dYDsWkHz)^ zxVK1CBUY- z7~A%^$|?I6abEUG<@z9C+M12skQKS7;B%6wQ1Y`ff5DX~EDFp`;q!+WZ47M8z4!`6 zX@4%F;^RO8F3z^eD&=wT%!X~gS9Ds8H(i+mUWLP+B4zCf-JX4@uD(fQgWrzrzU*%(mg)KE77|na^g_X~dx-$*=tr0KgxErILuCFju209=UCYW z|AAt!|Lrpa$6J5>v*pinuB_dfge1}%KOcz18qil? z!BYkToA#=sdSz;Y<569#g*CGgN$E`cm85i`-ROb9XWup+?)w^XePaBMwyi%p0uMZu z2~R^sVxZ^oL`56dIhuNYN7?p?`*SEy9h~0-(NT1hR0I2huf_*w3_-92 z*9ngvk5_XJibvz^L92GPuG##FuV270xjs5Kxb?Ss55uZ!u)*A5zcuzjS6#Fbw}1hD zf_gweJTBVGFk7@2__OC`C|0zl&acPZuI6Lz{r%t!_bxbxy*Dd}wLHAwJP$st-kCbV zxTc=i`dY;O3hZE-zc6#stpjCrOFG@Shn_i9ogK;I35dz6##vmU4qTkrGelNv;Zi5m0`q zX3pk?lzI+0bMLP-k_R1NPxNx38HNr)B3A_&FkbSRd-MYgwpWwu%u%C8`a>A91P$rh z0jeU7J@xOCyNVZIf0twNlmjH+qv)kJAs*6Qj9aOlW10X;h5$3_#{*DgcwJCaV`aEL zsaG|J0w87^0qCx6GKd7#p9MEsFMx`qBUCp)F8{`U{+x({9ft$1{W(EQ;PL!$<-S!< zs?!=rh>IA|PGw`9oZpDG9BN+cLknghxTaWqpu*3+%HFlwXmJI*{rz!!$qQ_EV*<UFBs2jEmm26`W|PhCjCC&(ZxKWThgLy=1LI# z)^LCrTUKC2J^UW&U5gJdC{yulVmj-#QdN8GpT}d6!`B-0?@B=i$f9Cwn9hrfyXUIe z7&Q@rn$nocL}B-9s#z#gxiQnD6)+8MO(nKnq5Jb#Qx9!5o`Vyh z+$yBaeqeDzWAT&txRWLzmBf+^%15`5TK(!{EtFq17(4WotZGfvxNZn!DrXm6p%m zS%=IKG6|-A&VT zfzP+fCVBqi^$P?$m$oYMYclC=DYrAbV%N6Qn?of z56ZVt!72y;IS~*aw5DQ&#hzfSTO;5gSfFLr*bV(=CEb_}CUOo+0V&2p<0xbZ`hQ!7 zARUa;f!`~0(`fv>!-g;_GL>Fa&ElzdBAR4bwk4JN1|M3FBKCL|;!hy1^+rfGt1@15fbCddH=S-y>hNI8um@QG8Cy#VzClpr?IS?s%`eNZ(zgYcLf^x_QOIh zCOfWm+|vI114u$ek+T5Z_n(bO43+C;Q4{M_t;^OGtNQC$mzi~5u}rZLTcs7V*5$PZ z7Y_{2CC@uSrQr~9WdVY8kER+5dQn%cPZisdwaASV_@)_G++ALxJ?@KThC|Cw zO1!tVB49$Iq|8nN-0tqhTg{*-3d=GPcobViVl9|ZB-Qd^QJ{#brt^1f7KhV4ZfoNz z2UA5~#Sc7uVA_j@XA~2)ylx zU*UHTZI*1m`#>O-=K$e$3shtB3DyJQccTU~qj%wV9|(EbC@bXTOc`h!v;6Ln&0OJk zFGP6RC^YQz>vX#@>FsNK-5Z9ThQhVySxz^q3d#QAba&=++vQf3;b_a}Mw#KLhtG{N z!x1ibR|ZD7+^DI$OL*K-WazaC*QZZA^zx(nTtZ1iMUmm$KKQu9myq0f;dowaaX1cR zmm3TJNz3JqDU!?mr6NO3TDaWcP%WoAwxqDO8DZgu$Bm-LD(%H;e{{EOk2;34JZ@C+ zw*B+)!IW~iLD^ddbC)xLsgc2n0!&Y$-0jaPc6njCx4F#nLLtK2J`gatNAm)ayN#Nj zo3WPZ-U8F|a<_*?ja_ck2-!380%%M(2$vh>g~+av&&`S?YYe%es8|Z8wy>rKR_~hW zL0dXPEv&(z9E{(mm7zTDG0nu`aibu}GY?0N&{ z<7VNj=L$M%R3ql7p!-t|;{SC(^!oemfYn|r?tM44efoJep+iueUeESnXee9({}%SRpUyKWyA^5zx@GO*@Qc9Q*V2(T(g zs7ajJHisZtU^v{Mb^qG_cEEg`HG&e|YHV6Fhr10#?z=N8;$2;}bE}bf2}WSzImDIS zZSchznZS|@Jws7g90%q;^RG#8ePOP3i4@fr+NOosK4o)o$-VP~avO`cN1QacNGT8B zCg+a1fnTSsLYow-{h1EZHP!|dLy46`8R=P+2Vx`@fDr*{+L(17^5O+sdJcJl!lir3 z6V`l5+)1FIF3Q4K0)Y>2YtP(f+zr4+gP!ZLn`LNukb9rpJO&x<~!%d~ozEsR5(sE@-@0ukF}t>HL>n<)6PgS%tK>@l~aFhBs0B zq>YPsBH1irfK%0mNCR7T6G{bFFCLW=&JtX);T4=R=K6{-=W4-W&h?2E=UlyTpp(5! zOQfjWP=Vx-F)>mjND04jtJpAE!e!TGLT)>BU1!@U zLjBs<0&6kC()A!QH`w*USaFS2VaH2^ za71#EX@x8oAr%lcp}!*Hxz{9NCV$3ktw%hY(SoP@_=GuPb%GpoMHe?y9fL62tzkCD zID!o3ToLN}ic;or5HpzHwEkQjQEeEx35t;db30apAStVVG!_I&Rs3U{aID&&=lY7w zB*5hejH1#VTHmxu@VJtQrJ7mhTG3Q0R>QW_2%^Nu8X4HK>D{iVHuW?8@)IF7Ld5K!w(>))V z5gHw?<{T?{`sJdow1cNC>Z&U`s-mvsaIWH~#MGVEMA#A1Y%re@RAQ35#S+N6(ymy4 ze!z;NZj7R+f}bzPQQfQijHI3zgi=o!vD6cm#bAum9DV=Dlf8i%;nWkOcq*$4`@dkW z#ptdsbOK>^(|z%!B4zmg%3^R(m2BZvrLgLWVI?r&xg)DAT;rOViwlr?uH`>jqT}RE z2Uh`i!+A!D;&jHrqk_Xo%yRi$TG<@3aDeGv+A8kU@#tZFah+Pu1+}wtvezSJWlhj_ zc*=SumU3CSRqz4Hn{!244=z}-);-H*%|u!HvyLrtLb0*T(Z;{xt*nI1E8wc0r=8QZ z#eLXQ{W>*&~ zQgyq)<`n?f*ABq4OsB|(qnJsST@JwlZuN}80>i8X1z}Zg_}rGUkBW<|qU74M{K%os zqEeW2?>H=L-RjPCQt=G$Sz1rz%`8pzH<48*i=HJsa|L5vZ0IFO7DcgPKf|#sHtfr) zX91V9bh^p_sgid{7AWNrDJ08+F85-nP%x77V%!_!>ycP~`0ThW+blaS%g@#`Fss5c zCqE6naaTu%??;7bE1_4$848@HFp#LMXL2-E9nUL!nHMd&y0bXN3C9PZ-f-*yEX$Xk zGeV0=RlZw1@kGDkD>@)=2UW-i?T&eh1DJu0;>(6aIOLYQxaXch!=aeeY-&k`NZ7jCM6U`nc>E;?Cf^38v+p7Sr4^@O`Go(qZY$WRhbf@GQ;k4Vr%p?U3#KZ z09a_~ndWH#D4+9==IE<@?#@cVq1})ipn>+KpdbE74*xeW+kitydpoN)j5;m2)MN?& z3ue8Qy0RXQw$n~1RN2RRt(L`VZ5i1r^I&D61E(9)?fE~oN3Ee_y-9_Fv31NUP~OQ^ z!#WCD)i7?l$l1Meq4Zc7>NGUfRdG_Yt17xCz1{V4SH&g~z-6!-tQ4tdFy^z)QCqSw zKlUuw4wq{Uk3|3fzlsgft)#6+)*6Ca4gWFxAi^&4vaawSi0gReuYWZ9k6Ys)Z?UVE zd`p_)%=c4OM%2F{@P;b}Au6Y8ym)CG&k((JFd*v?c?R4@IEQz?qRJ- zJS@-J2xw1~!%cl=#5HmcK}5E7xmYI5TMk%xI|*Zt0o7;+sLICloWIkf;E}1kjZ!lN zrN$6WQ2{zJC=D$76zUyxIv+p~wO%yJMgvP6Q1^OiU_5Fg}4cbyr*qE<|l-mfeOgq^==z&t&Sr?7}Ms z0oB5SJWaCyYC+#aBZWd#5bAPgkfG0>!LzkY$yu{D) zjrguEhGUK)K9yWL8Kl60S1*WT=hbx*@N^*=b->95}e4#_MMS4o=8A0M?xFiQwfre>U3(C-BO+Vp@Y2cx9YdEzTr?ZE}lr z*xO>bTfdgamq2k>R;1^Zam_P>Yi%AcMM5m@na_etU&{!~Y=K4fz&{&PbzPS(4+6+S zC=ptRB&l$S9ElBIUMEMjj{_y!%gb~CDq#dQSeT>+hAtSKsv*Tz&dZ9t3QV*^5kBjn zV0T}@^vuF34Q1%EtVc5`h?iZdum0JA=BdaLw_+)i2b~Vmk!4IgbT{iRFU=FK5{o&~ zk-xm^t9<^9EKa^W1wMr4*1|uaH$@S!bKFlv`+-c_UEhm)LJ2~joHF0N+6c>IuH_8 z+}Umif;Yu!ZIIb?Q=AZ)7FBV2`_!o}#a7Qup5LO>iwl_Yutt_UuQSohLD^j>l;pBI z##zAYmA4UwLg~EwtfKu+87+NcHgl`eO=hCnj=)d;AGwV=BYD?Avf7E zCHt;2oGEqRy75a(onT`r3=FaWRggA5e&<<2di&BnUBj*GaULQaAMZSrK6<9i_oL@M zy3&z_RCSWI$4xMQki|!P2idv~>o!d{lyw)tfq`H--iC9tT7PsO`TF=nu^wG}lXSX32rDS+cse&5|~)mJ0PRE4PHms>IUK^^~`j)feHgR*jdTVzVLO zs>{@p@^m1u5b{ye5^%}YHv06S?rl0#F|3GIm%OAFy7sXAKv%Jj&$({Hc0;$a2Gx>` zAXx2-rf=`+_4SM9EZXW8$ZHw`QKN{4iE2}~x3uo5ZJd=K71wOzcsccSJ{T3%(YhdCu4|{XsB1>?p$rgMpk`lT;Sid(5 zGLhl$uLB`zxDd+G0B8w?EdQ=MZmy6FteimL5kZKo(g`{wIbUqA2;(ax75~mdi2<`}Ql<_!Tu%`+;DKo5g2}+-RGQB_&}c;w1bL zF0gkU$GxI7a8yr_4kqUHy&|tj5Xk!E)$E5 zBvf<&3Tuz5loU({-UKHo1{2W*?9&V(8B#7wJif#sW9h6}FLWN1B0RNhS`fXwlj-41To z9v@ZHcvM%Em*VO}R1EjIEAiO~-IFH4&2kD?IL%>Se%$s^2SeuLUI8!OQTD9I?;3ae zaSI#08@#R$$Ny5ei$6n)&1Qy^mX$aMILWS+gg4B9V{+A<5E31Z@{X;U{@&|V2$ZNj z(M8s?DSp-M!grqjdU`a*svjrb7^)IuTv6j z=cQHDPqiNq3^-A{_l5Wqh$~)T1>9V%VFAq%pHl-Ozq&INwu{c9o-W(#)M!Qo)jZm{ zlrKl)!lF$qUA=5#l6jacv1xrw1*_C5tu3}tcm-%xJ}3QO>Q+xWBtGs%{5)%Im1Jb2Hyho+zVdb%bFj4enizyRSU%H1HHDU-}=kas65)}9nfO0ktgfuWnGuNKO^@-6t!+UwF)rDvdLLCU`<-tSd z#D2O`uzDp)9}J(*#LH+j9bTE9opOLbtT>b?TMyh3(qLU0i!qj%96o#sh{j9I6yWIM zh7m@Ta#YrxX6(%%v)$?FT&RF<&mLuNiB^*~R#00uJ!75E7q2tgsR1wA>7e{g-Rr=3 zO0s+KF9^>_SqQgEgu_fTpYMdvcp&5<4qaY#x{L^KTA2>+q#*!$ds`#dm4)wuHLORQ zryA@Wt~H%XXkrvgqeq~B^5&ix7fS-Fb8!71 zzxy~8iCtbGCJSfSnVzncw&12=6%w-UDWH` z`W^8n-W#T_rykdkNlv!7jgEO)D6}JVI}RX^0Zg3b1Ebmu>@{R!Jjj$?aPZlN%{k2e zW0@USh%{_?UikPeUyJ#cvv}@x{Bf+P#Hh%R#%A9ulX2ACL-TKj=wZm*6>d`TaBN6- zCJx!R;?m!~m@3@1>jjG0*}+npp+Lg-n!4mSe6QJUM{8$*7K&Z9W;VmeukgL54^e_w zpj#TN964k*uX%fO5AZK8GR-CPBvUkM)`&bQcgoa^)M}_wIu(Ib#NmIby@%?;CS{ zMW}AKpitfZM8xWLFBGg}C-dR7U>Hx@n}9#ZIE5i0{0dYKN!4@c`!7`(nDTjBmA&%xn7_$%|R@#)_TQ zOH~Om=WLH7F{@{dGc8diIy|1DO{zyVCySVm5}FpV1K!LQn5;Q`m_Vw~)OCC!f>*l} zif*kwD)zO<@GM5dC><_J<)DJ1Ynx6Hep`gR)un6?=vGPMxg-_d+mj{Co=mq8v%SAi zHNM@6;F#!Su+$z#FkK9^Ip*l#=4RYYs$gve`ZnvE)}L!bbw|bYj;#?^5H`? zR^VNLY>!BWSS3lyhENp~3(}Pjp$eofwpR>=HAu0yoArd4R2dPvm&!>C=40GEWzQIj z5`)Zh?^m$OqdunqWDU|GB6&B{PK;my(%6w6RaY>5&~}$@mHG+?)^n#`$;Vk09Oon6 zb@trNa^^?qPP;GVM_gZVPgP_{oUm-@6GO=l_}MuUf|WvHF;2`^q)8ZzJc$z=eLwC* ziOY3GH657}2SS+=s49Y`{!h&Ev@TW^1=q! zM`Nc>a9O7LwXHFh=R|&_pBNUVk1KxSjVJEgD`lrpkR#{Hp}6*BJBwn$kwpTLVQKp$3%cRj>_;i~PNv{;c0!aaN6uJU*%W(% z>$)Fth)_GB0>uvUIAWLN!~{PDM*Adym$m*FmV+DidR)&GdnLN}M+z?wr|-9Ow}k2a zRYdQ@mk0595p9^TPq`lZBvBW5FX%Hz4fq07CN)Krl>dPjIv;xr3>dq3dbI?qU1Y~9I#2Q zAW}Hsmeg|@Of|~I32Cei6J3dP=+yK?1o2T#Nasm?>jM#vjL->LGsab>>xmqLG^+;J z=%_f}E#{3g7L}tIC@Wy{Bo!D{i@nyOz-UEKZWS119{KK_6(hcubGs4RTj4jJwYkDx zr3e!Cb1onmJ0b}F>h61VLwb2}~luFV!BzV>d*#_a8ubG(mlT8!mx#{mK%VkNxA z@758TE8s!?dF*;2#J_6)lG4WP+1>MnhU)yX7!|&I|;qo|7zO$&)P`=;UjQW{86W|VB++^RAv7H7H%aXN8oI3JQznq>fS0$ECy zqFdsUvHb?U5fNG#pIHY{EP0qC=hm)DaHytClx3CC+YCyE-v9rP)D~s#$Vg3K!|v~| zgyY=~%%6>^VoF@bQ5B^M%(YSLwZHzQ@n4sjJ4@{x=2bfjfDB?jO1I$Mx z(7f≥6C_*k1#Zb?8yDF10j0vSA05kJn^U! zK)vP~x%KN*Rt|Xux;HgmPY*u8MoZH66<}6YrAEU~FX#(60(@`=c}qGFFef?5a3xt* zIz7p>_7g9g+g#GM%0Br>qA=gCRZhBU`DLyHQ&oU;>r!P7w)7K|b%yDmYrmEoiy{7e zV4xqgBB`1_Fx*fzhFtY{p?4GJRvW=(k7bAQGjg1{f$t`-g=yg-en9LXOCA*wl7xi- zgIs{mO)*fJyz@g0ZE6cez?l+Jwbz0P!Y2CJh|JRo_`F3mKlxIGO4=rx`s-C{{I)RSEg zY4LPRM&gdzqe<+Dk>yBAoqerdaW|G)SVO&W11ZG=f55XTB8FpWnS0_N343CA&F z(#DczNdoa1zGw;p?$IOMl7vXaHR_LZ0S*5U!_|$#~bN3eJT&O z$Z-Hil9!Z|l@_k-t+X_RxvY|@P||IIk!X&bn9LajCQ0-EMqsWhBe@xF^AsUVF269g zQSkNo{Kh0JA2_8#1!vJD(+%8`zXH3}mse2o8Q!Q7$HGsyju|GWE8*Z&$*d-!hs&U4 zmjq@r%_HmgV48)=N}l<%SIuIZcWptyl)k9)t}XVXY&wB?TUra2W{PN%MOZL`jS)YP zy*62Ve84tN0+SQd!N6la08W_e7Ygd|k6y!U99-YDX5k8W@i+lWnCkEm~sV}J%#OjO3^u$m=iRL2= zU7AZ4TuEZc_sRhS2GX78OO7QiwCU9krn3H*v5woQ;#U57@I6n1hk#KUsVJW^H;gAFK@v=aaQ*M}4yPLhaY` zZ`NLz)uZ*+?opsNYabZ0c78rs8?^moZCHXItew**Yv=Tvwdr=APvl>$o%3(jh6#JJ zcFrHHoy*DEhJv->v!1MtcTd*N`8R97m=D&@`4?;F{F}9N{$%Z(K3E$P`xk55IbW=u z(y)v9S$KdQf4!Fv2;chfP>I)8p}E_B zi6@$(Go&C+lJH&kGJxnNf?J~>B(l$@OI@LX1<&wqgt3YK>=xiRz#xxr#VH!FX z2_gq~al_rqzG|D?TQ@5h{vqZ`^*SE0=2}fyvmGDlGU7aOm^Q`Tk^~wMJY8*%BsVR| z7;E-5mO+Xa)-)|@<*=TDpxL+K2Eh+F7%nin7t&1-eo%(6z5>0}g5%haqyqz2KVcA* zJrD>_^Bc!1qYj^4#K1~{L!GxFFcdAx+Z0f@hN@~)mE*bB08T)$zo!BPKYQAYS<||j zn9IVAkAO9<-Hl+K=w>k29*McnBQ3twr)Uu#6`rpmg9xa1a1 zE=^|}W^L8yxMDr)It9Qy!VWsc3%0qS8X_4^VX=t7F#EUVfq4L@pe?PLi_1Cz4}ud6 znsQ#!VCXbqV7P3(g|g&{k9*t_hsWNQLnswxTA>A){WxSI+XRsRiNj&;Fbdu$a9FCJ zpp4?3*z;O;#1Bynp@B-!s5k}Ni;~@XVRb9Tz~gdv=ywF&fRJ_YtXBdS%LGEcCKPLZ zJcG;C6vm2Do@E)!S^g)+ui-3>?Z$45mh=342*w=z(YWe6YpV}%gsyH0p5n_oZ~z%> z0nV0VRhm78VFDIEaMSsCf;&qzYAWH(+$$hjun>dVz#xQEe8Y%UNahvdRw>$Mz`fyW zGm{~Fy1BY37WWHTLbtT_30g2O%-VpgQ|h^FnmNKT9icu*x&zih_Kk_D$qsY=Mt!_i z7ABf5YXtU7S3}z|jfS>~T70+p>6hZDg|7&^zUzO%4&I`0yC}@c2=9yWk(3xaVbpJU z3=RwPB3?^Og^mx5$JxR`-Ea1VZhVHeY0cmt%_Q#Tz>+vySKB!vz66*iN__esN zcsDJ~b&ft>+Y~x54rVv6)8ClugRo&vY{CZS4iBRFa-HKDoXeO#8!Fc3@wInWyN^$V ztjDY#u!p}eL-CXTXlbUwv=+jY#Wo;c7Vlvo>q02NGRnKcm_7aW(q2piVG6Q7fY63W zlPl1(xGSw4z84cgEyi(r{&r-Dg0`0kl`ik5`?|H`5g7%QNh%@eyw%j}@_l&paqe}+ zo^YT#U`il+K6<4`m*6;bZ<^Bq!XTPY>rORvVs9(F2aN$(qegxxps-?M)NQ#$+*SLd zS2PNoXU`T5%cA~&N9GMr21$Nif0uhM=%xsKQ-0g50iYk;u z?HXRv)FVv73Rk5Uhn<%*^UffPBGwae0L%JHTKdUhN-(FVFpC$xsTQpIc%9Dis8>#I zOid!aM}S!O4+56)ls%=l6=3%$BE0}XmK3nokM?*2123fe3y<`9hojz=&u2Y##VG9R zc-(Dl%cVO?ye$`yvZUjQ;tPFXx{y$H874WVTxLkth6txzhFB8M+_u%auJI6Key!~# zFj>_T=43fV4>gURm;Yu*fR*L3ufxe`=DHctfCG~(jbf-Nv`nn>aB3h2rhAHAmY%j< zdN+#_9jZnGOWK4EOkDP9X>o@Ly6-W-6!{75OFuebkBCQz$6t9AbBCY9e)y<>tZNb% zjM2)r=rsh=48_}hL)v<&>gK-HXkCU?e70&ypY#_D-pD)(NzGVS%HQ|K+~6yLja zP_XD!fkor8Ed7{+bC&2IpmIKZP3Dn|q-1F(m?Ap}7@CDVmi{5kG*BFV{eCzP>>ZLo zSs4XG@r8t~l%WT-2a$N1U|g4*bQC3C(0#e-QRWU{R&yjB9GrQ62|>pxaO42Bj8bZI z_o>p@VX1;0UV4_qnclS6k4O?e@&RxHi$CI+70(?gfw_p_&3cK6MSgCj;q(RMBMQDuD;6Iek4#V4qv>GodRqB0I3OZx#*u*txbi}nq+{kY??6_s zV#c*OnY8H?m#bqOY~ayJ&6zWPiK&?0mAv&noN0)><|(eKjt|<#AI@0hR#%Xwee4k8 zlpc$iSlWSEHZ{1p)PG_=O!0BAuup5#t4954>zSf@<^A~)*`Y^6&JI1k=8N(E1ru*! z9d}z*D?}ex=o<6B$GUnYO!#ZlCvykpV(wYB1dx^dHic~8`jIGdU~F#AkP^mRAEX?fCw`Vr(|YICkm^4wm+|EHg|iPnJG5YT2g}x8|*WpO`f` z$1M&DY)lMyt{8g^*O()nhAETtqvIQ+!QuN-bQ@E&V2lB5?WxN;%I#|$5KyCf046eU zU~m?c;&nBV_(pTS#p8?=IEA{;Sl1Ox#;PHwR^SZ*IQaxl_do<=az#)xa!+3mJonrv=km_>CS zy7!73q-IEJBTxbyX)|Zbjwl;0?HnRyPtp zNd@}`nXc4D1U zG4~363mZ#z1~APVASqA6c3N?mRP_1Tc#Pva(44voa=E z>qlT{$K@(&JRw1Sh651V%Bd`s`5}fDP*z?O;OcInDZs@Uc-qVaMwZy|2otuBCTR2= zAE`Q3L;WDkag?OM~^nn?Z}Zx*61h8=kL&pgK!q(R+awY=MB>j@KO7Rs^-M1P0YrGDpOlWQ&zK{cp@J=WzXDqgF$nIj^*Fw1(wTeOnH47(0g*lK&B?ucwb;bM`{ z(4I_5X}Nz8)__GX?a2UE3U=(t6sD=|Eg8T}rqs4ffh*=ngSID1T%YES0Pfy*LCn0c zKG3@;{)AI2y)#qd;xb1s3X2lgK8)Yc-rRbm>f9D@%>a(1cWuoS#_f!Ox=21iKwC2x z5fQ032dAC01>YHPjZBdwxOvky#@>8HnD%Cf7~c5x8wTlT1-vIe^_8p66A?a9W-QR_ zWULR2`6|`5&+qiYg4+0QqlDc;}#W_Tpjx|_)zb5BoF}OTs?c&g|mCW;s+H; z>?dlsnN`IP5lkp8IB4xUa*FH=%l z-$2k4FmH0tzS);+Cu%c_2J)<6ZOoQ0R5{4LF>B4wm5~yHVPoR8dtsvKdyRln;Am)h zV;i%iK#KJ0QwsR>W;X>X;NzcnOAE7Ff`xh_E@E=~il~mB2^yhpyD$tDQA2{V`?I4{ z!00B#tm^`RP(r_NQy}Nr2h~L7*wpR#x0k3yMnN0?eMDElRTP z?OvO_g*o{3_()m%#AXC0@q3sJ-Kv&fNw*Qe7`Rsv4@F$ADBKr#bX{>QUO z)gsHC8DE5_GS;b14_Nuq8#AbQqXlLo&iF(mtosE8*clX)s#LSQ4CJmR)wKVXBNv9U@_?Y zid^GjLp)O47w4vBE#}BzC?<}M22`6*!0whA@pb~c{2anfAJG(U*v=rGJaxPjQtMvn zS`bGk9CNrayddg?bAalWCGvXWQFRl@r73ur{QZfMpNHiRR=NI(I$jI85iP%>1e~81 z&;9*%AT(9Q8AbPE2WiNt&jO~}&*A-A*?0A3-BtitYw1~ZFRI_nx_*!hWs@Z#F3lC3 zc9N2K&b|^aje>Xz0eCkFi90P=ESDpt-%mtBLgjLObVraizgTW*Ewc5q3@cVbt$E4G zLDfA|GSL5+PrV(5Cy48;gla-@`xP1HTXOhjj`(pcqQ01!O9bCOM|&+ zUDX~J5fYWE_SkS#do0Z68YZ}&8vw>!A2yfQ%xS$9pA5g^?FFe&y&seu-e6)%d_f*m z)bg0H-SN1jq2i(kS2+^0;7oRxJ*Sbz7=ali0$Z0mY+RmV{fNZvW))UDVX~Zj=ue(f<%l|qq zyC2|-_E^~~6>Gzh$!pBYGY^@AIx*+r>wDtTLxnIm4_eg z%dxZr)kb6?D3^ax+`0U}=Y-tVEOd`~+8AUE08Uf8FT7y2MMh|3rvsxpU+1j=aX&km zA7hDABVwK+1zySgfLHG7!+C11-i}0jkjOb0$ixR&b}s*7g_TcHTJh>zj}*(9?zVs*uS zqIlMM<_i!pG;Qeiu-?1GVUKFHu5d;VU#Qz8?McUvQ5y1W5Td$@C2;5f;HW}JR0wdG zdUlSw&#H$tNcKb`YL{cfAXSf&xE7&jUV)Pr<_`&09eL3^T{~g4$k>m*{5U(#eOPa)BeFCSa()Cdwu9!J2jf6O?<-RVXUwY$Q>iu4Nwt_FMiuv5B{}PW zHD}89AQw2M;9~0%w*xt$svtA5=n=RYpx*HBc0IaJN?cDQU-pJ3Zq1prUZgLT?rXUD z-AcG9M8bvHqdfkJWX94XRP!j3iJVLi6&qsRCy9X+5{=y#3nB6hH=^?}Ls3iIczaFc zHIR*A^ao9NN~&652o~{j-Mz!lHlYwXV6WOvkOQo7mJp`hcT^+7#9rX66KBX$)Anca ziSr_Qz zxVb|z7>RR`X}NHQ?5CN&5v=q%6-3=yXH-v%T+LtIuyta$=bnZQK=KBQ*iPox7GpBCk>(vT$EpU*vj<=s4QTJneh>5VfmgYe}CM_o+ptSDgZ#6oUKvYh#L7 zq3MX%wOSkZ$`Eq)`sOu1_PVga*yE@Nhq}A70oHjh;Eh<{PH2Hrb9{YdX|On|qgN}z zTMx7pO7C{CrVK6cC1%P98F5+tSVDLpOvVBHOiMEHc$4UJ&QRAz2!$c{JGyslruGbJ3VcO6s|GFqb+JHN>BYBf0|xoh z6C1`o?9zt`7JwtBPFG*b?OF&eqU`KoJyLvd*rTxNDl$nC^IBCUNyj&DEvufF?xXN| zOmQ%cA86T3WjYlxnWN14Q0yaFQ?;*?Z(Gh^zxi0a9mgN(oY}u6F=km9+JMD|eiNK! zR6687wlmq=TpQuV>dkLkizBPluBzG#%m))ok$&UOvQ#3QC>FLv{*_j z&ag+JnB%lTn!JZ6KLl_c?fT#kow~*|x&Gx4vTMkgEl&oOgb8;1WLPrs z&N*MF(AfLSH31-Jd5yQ%kLqd9X znwrG%hzcR6wvA_ zu~N!L>_bJ?nJMAixJ9XzwicvxUfb|ivh&`qJsT@EZq1id=tgi& zbn;nQfH98Xycp>t%_2%%2lH-X1$#R}9^7wge=LqzFX0Y}AU>v{gV+C6x zN#;PsYxmmPar`zgds79M!A8oK6XOzp?GrDMm=Y0Tm3N0(DK+C9VhEvbbKGRoRYVQ65K z->|oTjFJ~tP_g==CC>%Vt{p4T3{2FcL6WQta;?{*t-mZaE%bacL%-Jdv-^wtF4F0Zh`1$KXw^3Oops4F5p5LY@8!HIQ+ zsDrJhkDK9sIpC>Cqdj(fR?Dz+21i>b>oT`tt-==e&`<0^IGDh^}y`2*E5PfdUG!L!&{n+xi)IO_Se5O{`>58-5~rR ztjcf!581?RB)vuTUtoq(<^SxrhO!Y*`E{UN9+nhn_%}>Bj!Hz}bzv@^=ZLlQjOL@X z8J!c{bgZO+E-3joosL5lG>P$PthyhG2%b|~7!f6`vh<|OL5blxgNh#zt^}!~4F3>= z5*r}~VO+dHxakc9`~%i`uCNe|S?8w`mAv1clddcI#9$xb8NA-cw1Da`=K4V0QFORo zJ27fn(dqN^kG7f)RB!8RitK%2Q1BEO(ypfuxXgF01w!OS5h^iV-M!uBh;u*<>tu+e zD+GYinHPzhT!c|doOI1JVZETOEFu~~*cb$d4lXr^Pn{p0oxbs)Y}&^$>T=spjQUmM zG{&`5YD^*yN*xU5AL|D)AD1ib^%I!Ae&VfT{TwK-7M%3e{|&KLPgd>ViD|t1Z7-gz zE4^d&z%ZX_ub-?N437nrWvT52#B#Z3FCh9}=laPCxUTiX)aAL>5AST4=laPqvex=R zJ!LG>rZ;c}+_8QfRXEqrLao)3RRQ>k!5-1Eewd)V5Z8fOYh}H3V$|?jJ?rDfTpP95 z3erw%|AiUHVgcb=`G5(?aeoW2`w+B6A(!i)sPh$;d3-c!%oelA2YzXGEjhbThg2 z(+gXuKD6&amLY@ILi$BiOH`ipR6FYoDL-+LX0^>H`O03ko43Lp^W0P%aqz;zY~LN5kf#Hl9{xRoop1Hq4;BIDNf;SUiay{)^dVEoc;wV3^ue$&GH&~L};1Y2q4 z$?Mvf$|~x>@Wb=*gtBYCGtiPoqY+7xPd05#d!Y7uw0O_~z(?n60d=|;WI?}?;1YGNcGPGg9i-HO%rtrge8L7E}PoA&D-grgDL1p*D42>h4CLqV4Uf|~C?*79WF{V@@@~3` zdFhP0a!~t#w#Lt?s^+edU(Lh@^X?((5p-xVXHm9f?UQA_zi`cRXnl5dLmYTY2y)Rk z-E2>x2ye6Lc>b`X)Wzj2W_F7qOlfKpM)t*0vaMO_$xZ`2r(m9;8SBNc*2|D^jz<(> zUrmrD#`zKQQH_3x6}Km?1O7t3dnnjvFV7xqXVLSb1=3Z=2e~>9Vxa&uMX@72#-{j! z_lgP3EeBCea2b*(*H>`Xnvb7TH*g5te0DE;mmeGBKyp%xRmqcSm#Z7JVA{yDsnypN zNI_4iS#s}i7%6UnSTbxKmWsq>3O!*ki^;H>2)VgGf=rlt?S5bd+N3#&v&rCa^ zzcAPNwK43suO0c3+4Yt4MInv-$0f42O&W1x)8FYM%0 z#5=oeU&DU@Ll!|SHi586F>~)y>^ij#G7)RIE0Q~Oee4flELgZYFH3;huNc7$zYlfo z(?K7mre`7DG21ZHx~sKvD=>7Ck#uYcp|eA207Dyn zd=`2dJD-Wa4rF6ur>z9|#ck8!hXo@c3uz*~1DdbzBmddkW$MG*5Vpr|b{MDM@fgL5 zu|SLY=6Q|{M(=!hNG1{<-ez$R{mVCn9N~y9vjPCZY^s#YQgS{)U=sOw-D8ShUxWuFK4yov#hI94k2Unp{M5#AS6E~w#<70@XB?C^m80b&XeTz% z+gDc{VCLvW;W$7Gb9DVbO1YW7l z9>3E(b$J{|cb5zpH{4U6c0h;^fG~y6n$_sGye*AyaV>1Wsk6_)v+p`L#Hm9{Y5Y2Q z$pKz$oOFaiucQh8b=+zxgvc2z z%S3++lTt|y!xf%|cb|7%bvX+~gE}$EoDis8cgfAdoH$6igf(2qeqxM=j6JfX+yDgc z1Pc*MSZB|WXoWwTqP*p4W}b1|S(OZE@laE{sN7{n9G2RYphM_*%E2ZFaVK)BvOrNk zK!|2Km_1Xlo20_j2|Nr1P>eukK?VR|(C`N^l-1P5F++C*Lzcaw!4QO=gy4d)_6JKI zhA%@HI@x8!@?eG;RS?W{8&*S$65T~ReRo#^pYc_SQ)&at<+r~hxIt-G(EYPfLJD}u zt1sIK;Dk+_PUIgu&(&o@358|SlfgBp7aA(pB5(3n^RXVKM?=Ab<)rRF(j@k+NKzsO zgl^x@mQjFTbk}AbbC6zs2<_fHyMJ9wUK*f0MBLwB8&0$#3=bVEFm$@aP{J)XWh!lh zTQyLOI~LAOW0#P30WmitGwXvO>8W$-zGAZ!rWZeS|N~&1o7?L?2jZmzD)pd~>WvyT;#|%T~ zDOADk?L+(ig|Wea-oHGFG%9_T71mQXl&_%$ETQy=j}MZo%@*3-0Y4|p(1K2vhJc(c z(6X>sIGbdsRtc$rV$)2mh~?7=bBzrtfrdVcPK}JAA%KjJU@W;ofhVRODuoG-AG*>? z;DwH=3mE!P8Nq1Qi3ombg@Gq4{bX2Q;;fi)STk>rRInmj5)c6qjKzbruAA^)8aBYQL#dYQZ=|)|ISa$kIx4 zDt|edZz^$hLlQj!Yth3i*dv1C`P&Q5pj|HZioEzTDs&RJ5Qj=ZNH_^TWY|uXe0kAB z@iZ^`n;=)NuKR+j!OUwHZpvT0I0Hi}gJ0FPCon>>Iu-=&Orqu#;GYdvYz2VgGp~jw zxy9f42~#_IF)3oAhe|0{_b*K}>FLo?xM<{DG3`0%g5udlGhOE@dR||j)P@*-|Cwdb z!ruLx+|fx!Y=_Kc!a`q9W%AAv;zof$uuw0u*Pu(WN@UmGHOvh@JoKwgpq7kuqECd{+lqQI$Ji4G8&aduhG*e)aK-~nP;Q&3Os1KF~hN~*)4H4AA&oFY3y z{Ix37NE0yw?B$SYv+`cJsapxA5+ML}LbRhZ)f}I_v2zK8%vaj}IgHn?hb#FPQ>lir z$p~JPom$0tIjK+bm4!G6Rk>%g>9}AM`jHDP_&O1OAqDIPQ}lJFqXDcJN(aGLtbsqW zzBl;S_1ukVs#xII+dE)bX8^4R@I`>|U!bZe;(>t2d^ubII1Eq367MFPRp~Bx9@)1! z6eB?N1X>-bJ2>ha?u99U=dEaTz7#-f(g(fKVX2{?0XtaYU!P$E6``v;g=Hz#00aW= zHcJ7PC*(LFFB{48=YAA}waVj{x0qum(Zww+tO^@Dmtn zR89>Lh#?$^L^s#TnH3t5R~PruT`#os3k6?%e+Cgg$)iI z5L$|q#1)E(>ewvyrOcbYTP?1QY%satUXQk96u z%sq-uLEc?}>C@xhqVjcs`*|ZoZC%FAkds(fmH`i3(c_GZ$v7kHC#meJ-XkVF%dxO1 zVRdjPi2=(SVuvdyeak{p3|xh;1Tqz@jD%D2uiE@c?o&&|VRBX>)|?qgd1L%w_`hamCuq=A9%~N{gTifjfZ+ zb{Y_7i(fXj0)7c-Cs+hfp3u#T}s3$l@Nry&Vj$B)fSiz&nDkR&U2>}Aw)Xm%8*mi-)ID_o{kp`m?thtgL?fur z3K#w(^#@WxNDL{%+~wE!*)Bil|K;snb}h$wHNm-`BE|(&!jddmdY%9Z{~&YFqkjEf z--VRcj;uxj2d736c4V^MG1kdBMCwW%Z_fHYUdt@MML`Eg2Ksj{+w zBe?eJOE^cy%3#x#bTYdP%HIb7|@f4ez&? zjuv*)*UU68>ZLU}x-f$e0ir-dItZHrnBfEL-_P}o$n_^Rd@t9HxJ6iX`bI*G`RD4#Dqjq@~~d^=Qv zJ4gs0$8{8}BE~l55{R)|0r{PCgXN7hp_!B7Ypx8`C&rXqUOOsGGZ!}0p?$in*?MF0 z@7gv#d~r|n&9UG4glm1dO*hz3|v$;xY`plpl*_ zdT`ivDXDiDLC~Fq>)dOYR{+|W5z?=!a4N64+|%OWi2{1trVb!p+X4}Y@BRcM3>%Uiuw z|1#?T8*5ZwrIhY9szbNMzYol!MzJTCnCn30V_v0r_3_wzX!$uXubgUlQG6{>8MCe`A%@HVKQ=Rh5XH!EVkZG0Rr5X02^wu8oSvkjPs0n~$fE>iF~%Q(31wKXv_q zIUf4YpJViDThxHyUD2zhsJb|tPiN=33vmu8+*;(cWC$F~SCmCFDZ+YC z-mfew)3>UpLL-Cg<94*Y7r9IeCu2Zr<7b0}cqX}50>DWYX&_jtZQ8px8HNfBMX;|C&cPP4ae|Ptb#C7b6 zG9Z@pQ%!1%Qt76PCKhFp&L`@5;L87b{F=>6^T?X7%9lk60W&-E6&rwEy+x)I#ncRf zND;@jxK*M$v!T`$>Z#&R))^LtDszQR*+2wdNA(?fUB0a#iRg2HnEvqrt74i~)Z8qp zIrqx84X`TQkex|O;k?+kToWy_!y+yl#g#s)&QdfEN2Zco27j}cErdh-{a(EE^5M>I zxU2D9uF&jb_PSUL%s2}BVe?j1ImXc4fA^&eoQ>Vp6_{oDT_;Q}fV(59{Cm<+p~H`j zi*-8K6(PXtM6oL|P4&=k2gfwksJTStWye(&ONR#B|12CEpiXs;~S5#rpq_)~!*x=VvFxVCpz1ild$ z^vkjR?1_AHt63QfWc3-UK`kcsJpNu-s|F7bHiK1NH+;+o%EpwNRtbPSj<@+>@rhEQ zn}ULOU*5+^e>)3YBwBqVk3hPk+v+JA9oSTYmbG2U8|4)eHc*WWr)^>LS*Vd72b9B>(#A z&kG6rX3%J|=%}M;@yJ}Ush;70ER4|2FrcgtD+F0AD|g~y1uCj*rA!efZND7BeKJ}D ztRmhPV?jjgyR!Z0P5J`Qt@=G=6q&BXGWZI@;KlY}8hIH#%D@f4=9;Vk4bUNvPqejV z5ne>ts$gqXN$u65Og$>9%T$W;*|mh%h=t@(Zni7-#zoYtZmzVc4fet;`n?*iHW_x3 z$Wi=Pk?X8KRoUlFq3dkns!nh#n`&3Jii0EM*57Gyb{Q{&bNRptzQP|$ST;l+xoT;; zLTYRTE83}84g-#c+nl}%M{?CXU`7w`0l|kBO;)$7v@apzsK#i}N_JW%)koFh;VMRL zMmGec{nIPyC^@n54J%`pO;hFUg-E=Fp_;ZBzril6jR8}jh5+I1eWS;!5o(ay=rp;O zn!dP1J(fDQ%6q|XK~<^Z@Myj2wmRvljsC6F1}?eGnnv$GGf?e3KEC<9q;`87)@05QNQ6gkmjzWoc#|j2uV8$HDBIzw3 zC!BSKgJ;s;4<*=46R^(FZ4Z04lo3w`BG_uBdyhFX9u_ugMbXUa?3qQ)H`wSx9EE2E zU^8(92CzJidh9Z2(8pK;1EA~MVQ*F<{@#e?R5wZ_aEcG+Rrz`BMdx_f8s!T&bGyl?9L$WsL& zPR%P;_dPBF`PcXw%Ird#jc_{H!Q( zbB9?#(fP5vHafgMO}!^IM>rR)6k7W1lL0e^1H_=~6xHbE{>yBk?XJgtV>xf5kc%jy&QkZ`oqNu>9?Y;!qh{V>g!=JuQd0( z4zmog{4KbtW2Xqzk^JWniqqZfBf##JUR{=>8QJkJ-`);|d96O0_y*8t1R$A)_{iW}S6@{ZGvKBA2r|UNkKX zrpa;ULu`IhST9?VINMlw5mRk1Y*S$z>;!$lA<&IMsKxRxMnsJ?3E#%}m^=CVQn)M_ zm2H+);S*sXt%hsbUni=51WG!=ax4o~-doS7-sRwpP-mJ(7`M`*0E}Bb?t_5J9p<>u zkzft-)saF|D$>@mJ`#+*!cqxaYVUFotrYxkBG%=x)9lMojzz*Q%IgTs-#SxIO$^2T zQt;4fIzNq0{>C&O=@^XJQLGQZWw>rSFA9+gbFbpa#yvzsRARwZmJ}bdeXxu^lSUMY z#$F~#07Gjf_#y%qfZty~37a;#O;JACrkR&va()8ZHKx<8SF(l%?9K0U(9oMRmmR)f zlEq}iwNphN!Vua(Anemh{v;ykkhN7XXIlthTP*sSwZvx{ahVKX2IwrtFD36O)-I&} z@{=v}ch=j%s7zTZm50MSr>Rr(iU%|eI)e$4@L%8BZ=bH0$?QRlh;J?`2#~~A+{X8S zy`_oiDyS|)i^7U99gVVzaB3dODO!D(oNbCzv*=eJX~66lC{m;FL=;q$YoT)KR7#%A z|Iy!ZxVB{r7%5*v4WEHvS2;?lp0MRHDtF{BYJOBkoZ^_brjuhUB*UPZd8E~=qOg<= z59;&3zc3p4t$btBH`P9MASOM}&|Juxi<>i+;%#G7K`KIzDDhc2EX^c{v$7itDeaY} zI(cSR9?a%bwU`e{vtv~RP=Bm8tN^W*J64JwKpC|9n^XNKRj}d~oHaQFvxuxoW;MEh| z%oW!SEwDlcg%H zh-1LDw7&U?qH4eBncB2k+`|e-moFgX&Q(qwdlhh(MPq`Zsk1N>O8S~#P&=>tloj>i z04gpmto>KT`ng(AHxN%SVtvW;n?lNSwb1-&y~k=bwYAx+)!ctGRtHTQ*7$;vi*l|O zT0I0)f@ul8A<8^HS`S*|0=6c}gMmZ2P#X>3ZXp(03+aXBsrt#(7O;XbYFgjEJwsNZ z=CviJn@|B2UQ-0B5|-PP>nqTv8&H-Imaw32)Q^6pcZVHKs4q+*1)q}+6enlO2dhMB0bR*m?I zw&hMDtxVM~Yzh4Si?K1PhiOclR-*pPSv4(SJuSA`jBnAB3$UiXb(J}W^*AEo;w!ZOLZ0#3@ zTWd^iEjo(K_sY!$ySe+`U1GZV3Ae6>rW(9t??juD#uLEA3U+d3LR>$2cFGkSbM3F#H~ZNUCqOV=fMAZNAo3>CTn0*T*pw z;@GNcQF`u-9WTGf2Ov}Ap_-k<@QThEeC!F=Cgm#!wf4~-^kAY1@qF!^o@}+p{Nsl zxX2@K?f982Z{t(#(XJuVdOTqXT{Dhn@#<`n=WY6ff~F*^oPHvcs=QHL@qC2*tSj{V zVWLluEs{JucTswdvywW*tAo67B@s-kGlRDaj}Hx6x8Aw5Q?QDWZS>n7ohLubbuW*< zaMO@w!?Jf@Q+ZUMnzNtMO|@0H{-tWFz3t+PQ#-4`u>@;a4+(P*<333?du*$3!cRBb zTDk`y6!S2*pp5$n=Lf^jKtH7TxP7Bk`8Nok({Vk2-UuNJkmu2e=wzj} zVQdQdBA~D>l3zWA5h(v~pnR(_T7O7|r!ha`Z$;$H6LSHjQkbZgo)O@V_!8SN2KG#S+f z*asz8Vy{}qn=bH+2oaPj`~)oRQ`@(H!E1J}HtaGEg5P**TyI&~wwJt>@NU#gYAoEE zUV;)*n{Tmw&)4rl`qenE#KJQWOO+GDs+75%60S?4x;CCW(dfY%+>JI2*0| zs7wCH&d&RsVcSja^A`{-MfnqQz}Yp~)w55>?eT_3a zauSG$D7f>ZQIL_t!W{*T4f=abWKg^G)Gs1b5h%>8JwgeWIaasZZps7NyDQ{SuonGd zu-Q4xu5g<6ZsX3I>1!%ylj^uJC(%64pD>ABf1>ixd`05C7E6y>CdSk59N@>yDnh!B$ z(iqO|7vWyS;9VJTGZ-%Z1*`hX#!Qw2$dDZDP(<~R{f{UYoFO@5v14{bTY>4x`(Z(9Kcl|4L+bfZ@J6OgZiXRQD}nH`lHJe&#@5J@erC5mj9yw)C1U3htg7-HXgKqqr$#s@=mz`@$DD?@bN+r^-3NHz+G z>5OnlTTj;xU#4Dq({RSdJm~vey<>1~UC=dpV%xTDaI{`39sCLCc%>}K za757ySmVl*oOqWz+6U~joj%O7oC+sS?NPu^kT(g_oOq!Vb5noPkIo7LftwcE{uGe7 zt!sPoxMa#fUoq5qd+8PH{UI%=xUE4r|7I+>a~3=J?#^K3LFX`ycUguA-R|>S+X`Hx z4A=&0>{ps#F{&218u@x)VECSsUCrZ(av@92Wfwd0`c;rAAAtLH$+|mTT*Xna?1M5O zb$u!x@l0oC1=(=Y`;B#R>sK);9MvW(BuHjW$u`K}n8e&zr!+Uz-4q1RX-!H0lB`l2rJwt5e6izJ|?@|i`V%I3ZAD=xUbBH}ep#DtK`_$t@|20!{%da`NiUDw85jOlQGUVQt)KN~TfIjw6$D6c@ zB#vQ=#(;8N@}aLn9%qHNq~hqs$MI;tRky<$7{4+zJpyhbCIt!L%ZKv?<&4dIYSXZp zTzwG9Ji`g}Bv_>k0?lG_QOm}B4Rqw&eOT1Ue$xr#&fZ?nl~Ou}{u>oJpOa%S-hV-_ zc$iO{rZse(z#|2v2YPYj(O^Y}^EwL z>&)q4U7p&0fx6rrqYB>#vdNRH6^f@RpJ#?1q&Dqub{?C%+>s0%P7RkHvHhW%$~}{- zwqwgGJDcIqBL2mJ0CG;NA6{;B?dJ#0@VmdF%gn}Z&s2e9lJ%oJ$JN2y@J%ZCs5OqY zN|+*0UZKYOSJLNwFDhFv;iLfqi?*1Qo|es(dC?0PMmG29C6}5?zkvSLKdTdlY(8?Y zgV%`!&<6CPe=tc41EN)09l1+|8RJ6EA7=$Q{eAr@P4)^VPxk`Oy{tTzlJ?kmc%7NO zr+%~05|gB+^KMf%u^=QT5hKY91tk~bZnX8+ijQ`yc|Z(4=@Awh5fSfmUqL*~D0_3h zTge!P&6Ko^jVN^jz`gk>~SOTxI7|kW#ukXl!xC6E_cm> zpXSr8ODr*oS>$lKnTYLAvy_wyd7AGep{5YH(9^NwAbadV1|z%W=S99}ZN^+gDABB` zZ?(UuW5SY}UvVkmFcP|_6V(1lzJ81?)~?}orPmn1?pH1O7nj30;c=rfE9r{l7F#QG z6W}Yv601XhLTDEl?ggB z1mz3*5`ok}y)UYF^%@EV;h2VeKkvJs?4xTrJ!{=9%ij)Poz~MrV^z- zn3IoGB@6V7`o=SrQ|HIFIEtu25q$t~_`fMHkflL<{HvSXA5f}C`d-zYiY>SQV>&n? zaz4dYxkWa0#873{x~t0ksKMn-a8Qh& z8`ej^`k-u@`1B+K1V!6}u(c_44UeVy8M%e(VN*M>q3d9EeI(u5a?=RT)#i$1V*M*D z-Gh|^`4$^{k&p^@Su66ct5Md*X>Le$qE(1SNUJOCzNkF^{wvT*)9rJR=CfnIztSL2 zhWn=3;aIW=G_8hXM;@{cL*=O=M%h(=zrS9?@MDK*yKEz1tAtS@Np1Ilh-J$Lw)lku z0+Tl(6~;f-q`NSwHh#-*7cCdg&cz%vh%u>a-moaWIc?s;ad&E{jFt{9R)9?F8a(Jc2yO~v#YVr*2yxRGbKwXv9wx)QvXbiOu+GRZ ze|Y+qwj*I@1fAcgKI??Q4rCv{I{UW6V zDCBxT^Y4Nuo$N2fOZN0z=q>I53ckAu`9!zP0F4#h{JB#sTU$? z^Tmm%Z;qTIffujiHb40KqSERdMDDMuWyb|Sf3n`1m?|l>~HZ;CV1LS1`9T= zP;K7wXe>JyF8Z}vDSvH!a{8mfM%pc$wqe8P%$Kw|ATROt8ZBKWXDZO9UbCa_TH5Eu z;hSCa_nA2Ao}YR%j(8Ad($}BvS9F)Yr?H1})W=f#?q$oNsHd{|x-`|un3SJdRL4=I z^bM<{)?;K_Z~+xDBWj!O9KrN_sQOVcKm7G))z=xtZ-5%;(+XnOn|GC>az?dLBEnVC z$s({r<(xO|^61Zj?nOIt4yKC3n^r-ur3mk1jt^GT%IWv4-t%_@;UhIW_gs&cu^*SG zu|iJRS&TJ3jsqDr!TU_k&DS1rg;a`p*W4i>=GvRHVpt*O%{Cg|sFihJOd@QBl}V82 z#vD_EV6;GQwAw^K?4~+Ngal=ekxLQdM)>I~okps8deR5$kusoN3;5SDgbFWd-;q1D z(5TVqk35ngNk2__+dctfCS2x2eoNNfUT%!I@tYlzhNKP*V4<$pkFziuCm)fBMik4Fy@ z=^tCXAt07;?$nOoW7f}-W9%=tB|B+V>APOrkc&7l*(u(f?@N2YMPq1+Voa?h*P3PD z^Z6();e>>eS>%x4&xV%Bo=}~Li=aa~K~&-t&ieyZWFkWSGt*GQ`+2#aS&q7q)Ra75 z{1+Odge!T|e9>%&%x}3;?o{0C4Nfk;^YGhwc!x8L;O2*D)07mZM?wFt`PDTn0nAHh zABu4fd$Yrxn5&SO^cy4ta={Ut7XXf>KL?wBI5AXdE5LN3@D*Brix+d}7J48+weuJq zNgxmsu5GGftzh_J7#2%9W6J^3%L`1{%$`7`aMVK7ocrW`{P4MRB*Xv^K%Yqv{5w1) z7dL(1;t3q9uoN3`O&rfkF~k@=RjeSwH3^d0c387NZTrh4?U+f;IptRWl-tdJz z{I{AkAvkg)aWq+=Y=~jOlIr!nn?0AZ7UREM90O^q_EdPb;Q^h|x)HpN#d55QH!@&yirw%(foB6a zL1c5rHKMN?%%YmEZVh88^*2EM7pf~{`Jqa zsfOJpnoF}>DS733fI1}&fvN+Od<~C01Wrgg#%FN#PlCSm_ag$)dnsv4lKlD}fAAII zo!e6n1n7s4-i2%qQ-*A@D01}BNS3SnebW4rpC)4W#|N~?o!&RH>jJyz#}C_wpFqmL zqjSpxRil|8|H%_e&=pf@ZC1oCVoxL?mmg;NAw zqQgvs>tmRWg?B#;BYuZM+q{`AbHaM*mOCx>7QRqG+Ke zuVZw>+6c&Mr}MFRDet`0B_5glKb9K(C%A_adZ#u$S)k96egaJEY0(J$k$S*I@1T*5 z;r^1%^e^nE*L+2t6lbGzJu%940i=48t&!62IMH)-<%73po+a6I<_>wLMJB4s(c+FV zvmXtIM6qP*2^JHMO)0p0-;-CE5O|?aV_zX+)9jF_xwHvw=9sYp)FDEBzFRfD3`u8s z06WbnWIX`f(V}wHa`phj>={R06RrJY~zIn}!_R`28QRJ9Ua^(j^gjV;|jUJ<} zb?G5H2Ip$71irR{1+!SMO+8~}2Z!Bau3m9&%AtLrmk}ApB{c-dY72a^jJZlX>d;zM zyE(Hn#M0PHBoLyaKOA|Iif1jQ5PhDjBJf95lQG# zGCcIVmfdTQQaIQd8Y^UT;K!(uw@+lhI(}jskIJsC>?wEG9I-tJ2T!~tGLuemc@+IO zoKR`8zj_O;lrH?cAR7b0&!@JbXXdIH9{>Y(w7$PH;<@O8BlA8kwnRnY@N_Oa&n$Gcmqt=2TOI9%>7F(`PQ_nu zqo>S(pTy^=k-AN&+)7kf?=nWnvcvk8;fBmF#EL2K*XVWABKI*7a0XEox9~g>5dZw~ zo9!e}Z%k`x-DUC;94{!tdGHy|G=06l)B)bzSM{CZ9Fp zj8SnJ56bkO*&70OTK)?_mQqY^N4LPW)h$DSeVX%m-#K+-pLQp66Cg5rExqk{?J^hTz1*6Ee(VF8- zNHs+MZO$YayI%)N67sUTnskT@(}v)S{`M|-8vDW)!p-y$jh5+R|bI@8K`}_m`_#guRRz# zM#mruP+YTx>_{>{(KjMEXSYF^d;%!~?(wwbABh~cas~wAS)tilOu6u zdXh7$=et9nfe5=mrB-W#jG30A<{o0GmzQq3N?@3)+c6+`HTi_maI<&&Adw4#ox#mz z(vcNdxpA136+__=97|LkGw!EUsc&OOjV_zuS_mjtwU9LlO5rWJ3y#o^A4@L z6Sj;J7+iiKY94M`#TFP^enHnhC|Sk!`7x3Ge{=t9{crBaUHK>C#}8TiAmo4jekKSE zEk1sn{$I?W`2R3}kbXRNeoTnk|L1Z)!T&$t{|0+T{13EE9orY`|3v*4kMT45-^l;I zD_(=XSq9beGH!GN|2+hivl$;A@`@4~0Cm7t5)S zqGf1F>r=EcADhj9AnoDFCv%6dqj7HZxRHGG8dRs(@IQciv91>_!a_73G#_wo=nF(h z8I3--N3o%@+XSvZnECNP*BIz1lkdYrDiSe5{YU^GMtY(#^7V5$c7(1Ht9bVlM1I$C zCBne6msfzEF_ciG0YQ-<{FT+fT_>ev)vtAH-2C)#u z|_*3pwl0@gWV+P zd;6wFE_dnVH=1#^S*VdPgTw_O5AndZX(#QNP@|eFzq>bvg;c9#f?9JmNu(4Qu*D=ITuj)mh7t=yf##Iufzj{d@zltZ7(@fXPI#$Xh8t2tH{+cfnX&0v&=g`VPY9LuA z_+{yMrPUQ{y8$hIpl}ZrOWV#OsY6C&i5I9?yQg6DYW_3b(mucgEn1doIU;^~hV+wl zZ*Hiz)&P#U0Vbw(s5$i-WB&VuifK_$D!Q~ zO3GsCjiT^!L#{!U9Z2{b7Na(-cD|C=wb(nE+R3~3(KCvz{y%K0W8Su%DegiLme5Qg z89GlI!q|*3W%Ts$YQOqAL--A^1^NL@F#`ciw%4nm9@Q;#MrHQ^sz`Qn5qS=eZR`QR z@R8u@DWa3ewdpNaYR`@pjPdGCOe4duf#>^hQ?FC{&y$rfyBxhma_pOL@By_r$_RqH z3VBDjF1-7U0^_AqwjM@4of7v@G_jk5sUCQdMm)9eK%bGpA7Y|i*1&If`C0%LT4$QF zi@v46M9HF`;L0Jw^o20|!e2Qdwnq-|p#@y*9klWfdDhA0VP~h#>NuJ_?{y}K7J}+a z{X>l{)iBI0)4Ox@B@>UWCkbi}O8zL%HS?f7laYNE*A#ie>dhW~icac@GF8ZCPCcA2 z*+^#YeT+OT4t#=TS~ei@o1rAdHESZBech^Ru!JFR+x5-wrL?(QNi;N}>gU}G{mVvt zRLkF1cj=r%hD_3EP81JmSH6EAx#TA8?QCt?{e?{gvg++RB&*+q6o{;_7jC!6wd9mM zMmJ)hKLwIa={+rm;IT-&= zwAX1D6*&lxXoF-ZoKJ{a{}GT4kskyn5)z79O3NXdG)at-k6CwJshY9SFE_ywazS7n zWTvvi?awL1w1fU*HG_bXPI*_iMCWa*y_b9N>jDeF3w9i)k2K5 z9M0VG&~)l!quQTT^zGcXTJ**$(K0G`u!TM{@<{&`B{gW>gBY4S)Z0m3{ggsVl@Z(k z{~I&^^MOg2wq40%0U_U{HCkUlD_B|waEY}&kfXOX?zy&iBR1Al*l2hlLF=>TLL9%n zZY^@9k5FUvK}uTXycm~#&zg??PvL6(6;1kqK?5a~4derwj=>^oNpH`Gl#Twx!cobB z2}WITW}uJ^2fAW(Z8B&pIbPXCo11?VXDi>FtIZ|CjLE@9gkmOs6K6?a`{ZytDz6>_ zV7({L3J{~I^_bA)QyMniE;Uku-;N5$>%#Bs*y@f=b*T^>=}TKt#~-#a9Dgy~UT7)Q z-&Q_SV}GdTF^F+$&_nByJf6Cix;Wfs>qnaEy0FcTX#+qwe?+EnXpQn6>2Fhd8y(cW z0fS~jkTaQXHlFn+H0bzdl?<>>EFrm)Cg|5@`icDQ*HOU+FM7*E9p zxX3>Q>2F7WAq-Epv#*SG)Oi8mO+j(*{W@_DYnR75GHm1wl*!h(nBzKeRJ4xAIzbxR zTpadyF~qF1rn)oA)4&1NqK9~!JR#|uI90cAb~nUK>p;ZEow!!DYk+az&=*mSFcmz! z@@_bfzU~s1A8x~pRrt?d2Ua`PVWBn0(9X;YN*F7|z>H>Cy^sd19lPPF81v zUH{>RGQ9B>0FgjHOP!DKB?O*5`DVPkmC`-7ucp6?bD%A3sGCjQuMALqrW3V`7-^Be z%5dmxvsndG88BOC58Yd?vI6MLh4SBo+H{46W{_!vHeD&h6XoK!tvAc1COz1195<^C zt1Apwd47`amo-|6i&V5&ag#pB$)1Jfer~o@6^t}rO;j{nnK+YM#>ppJoyEYJ3(Ces z^n+2+z)zX*%uoOuIo!{{CtcOJkL?kmkX>Yug!HB0FGI)N)AGHqHgHG$IhB=flyJlK zXF1M(yccmom(W$Jvw#m)iM*#}O)r17Tl{-Qt>kZ&e$oX6rnOz;p^T%)K@~656&>>^ z<3lHDT^D1C9-%}fcZ}M14J&y<0P=K7xoZic(rf{^^PGp-=&Y*#msApAvnHwGk7uYBb%7jNDfjp=Qsc^7bdKtLglXiE)>^(HSPfmc4p+60smPhHf>8LwaZMf;#x(Ekt&Tcrvz1WwY_=0Hy z9L}o?uSVK(fZzi+)Hq_FzGh+P3c+Au0apNv61TZwOr+BoXm;Fj+uH?8zIAs(3uNIv zY{erYle{h51DXnGX;72s}-S`f_Xed1)R` zQRfkY#Pl@-MyP0=RS{Osf3F|N0sx3417_TX1}M`~qUWEN3w)ut|LTW6j{k;>zYdd2 zQhu{q$W1D`mm(I3k$iT_0@v>c6mP6TAlc*wN2(@J^g@pvq(9j*q#im-=5#g)#0h7^ zLtk$??n+~Tb#N|sNw4v6hYY&hCt zWo8BANhQaO0=z6h!iCSQ*~r~~I1JMK3g1!@iQ+{(ItE5u_;^fTXgzw-QzSsmon-a0 zFA!o5`4;N1dv4xze{AMx84iiGb0}((>Qwk{lInT=sfq8Z!@*4h;UWn)JFA4Sz<2C# z;cJTJ1Nlyt9_=2>pzpq_#4#=14W&eUUK9YGB{AwCFg(N_A$-Z|8eOtoF*RwM4I?~; z{4r}W7rPIKAr~K_4wN;_)vbfwrPSs@uyZ}7m*U|5aKglr76WyII0F?I3#bBD_`CAT z20aJ5;WOO446XHrlyZNpnI+iZ^KhXRd^+F_8Zb@&Vr9+~aZWEDSez<()QNvFytDmc zPiyR7lDVF9tZ>&`7>aKmg&(rkoKU8`K#W(tx;1TbB-}^azYwm7D(InQPO~0c_LL<~ z9C?094k-eM9Yg(2N2mb0PM)_sdZ8PlTJ6ipLNy)p)~CdJqrVrLgKsm!sSxD>TjDkD z7}6Vm-nOKMIh)OJ>8-h9Qt?^X5?>CT%_kZ z%v^X&vT!xPW54pc7dEOmP@+10Hek$Gi+`Cf} z-8$1KTepaZig#{m2_DZ(fS{j55%hpjw95o3GX1pE9p#2Y3I8}y0wz<;1Xks54yF_gxE_K z5=yeQ6z7xJOX+@8!^o!-)wyL6!v`ek%yWPK; zE8;NJYY1HFPA1fAzRk$QYr`S=*p0{-iEWKemk{nC&loSc*KKLg6vbYYIod9&9Xpks zlf;`#!#^#aH)>*JyP{B2(daO)x3MLbKrwLjFU7ti=-k2m!1ztS#?gSYZ9DyVyDRcU z!(Fhqw&}Lt4+`GP#qr6m9HanWsaVqO1o7$npCPm*o&+`$%i3R^NRnq*BFyx{e)z13dk%iT=5I^Cm3=g2{A&L^}q zA2+|N2Wd}iVnb#}RwCdNd!F4-oVfl(I040c}~uPmC40h0M2kIhsZ8#p_HxP9=Z0o$ZV1pX4l7zJ}hl1{BiK z^_LvNSgTI(JTPaMba@DmWLEVLtuPxF8t>uc7RGI0Oa2`ZW)=_q=H^k0#Cy=#7`q6)wM0P@YY7cYpt<&-y|7En2>FUrXG*3pXNjS6q>5! z9FL9&O{n;cY`VWu&|;R{&XuKEcGq6lmlgR*Ns#UZl#faaiPr2u*;;Y}lQUQ>oEX42ta#f4g>GElk5zO3D$ z%%1A~fQjy+dVG3aoEi0Ym7Zp|F73|K(#2cwvG!reU)RvLxP&i=u=VF2-$O^&?}S*T zP8FtArX~5HdvwFnXXHPs{Qic@`bNmUw9Q{$WU-@S`wXF?B__ZoZse`#^AlzxX+>Km$|jqNKN7 zbdP@yLA0cZ^&_*7z^;YlEQVu>#KrM_1;@n_@nM_ z8?V(#MO0!mKy!wh-cHcN;X0NeTVXXYmh2e#aI*+I*Wyw=*set|PcZ@H`@?{P47Oea zXYRs18p|c(7zetx<)Ia*${3(2+u#6tSix?$IMR(yH-WIK3H!C4Q$wHG6ytU^n5Ht8 ziMt&SHIN|gj==-T>rIK=b&4|K?__bKzrt4kB*(vPd$yE`F?ue6A0R`KW2aWn1|nqQ zg!3HL+o;0ETrdlTI)m+2att9^p-&93M~WXuvm7!UZ^LN-`GwMPC{`AElz|VX;Jg@fWIw`DYx0p`qTdo|H8bl4(^#13i-0W5anCL`!pQOAfh=# z#c#)B(%p4Td-Hzn%0So;w>1iO{Ybybm#Vm>sBCPy1rHmj8n+{xQZyPv`5{uLc^GR= zK7R}()`~Hs##hi4I7U$`T5*kmF20DHW4RrVtJ;u76TF41*Lt!vKRYk?l|rMuP(%=+ z-l98Upz<`psrJ2@v$NTdJ?6`d{ay2Im!yYFW{vrp^DSjlvcdr|OQhs7_fSpt;nMr0 zn%3X5wgatoK#*!7@R%c@`(99yfNkdUh;TpP!!D$S8!pX=+8+N}jzm>Ya9*WL7^q2Q zWQ2J5#pU^q)J&T_B8`$au z$&(P5_Y%cii~wpa6)jegNSj2+p4X`GMZ>_Q?&RZ=(gzW`>y<15qEDl5kZG{g=c>Y4 zqV$U-N5&)vQW{ScBVP&&OoC_56^Pn#7H8ka$oS2I>S{eE+olU^Atk4)>i|2!Q+6cQ zrm6oa()#?6YlA1`@JJBJuS;uubf&3O6_FAB9qmhTmQPSbB@o}>mx7cV15?z z!4yvzLEt^BaZ2Gj)%ovx--wEU#;xRqC@h|7U1~Gruoi%kV@U0Ahb^{x)cDG{`x~%* z_R>7oO9I0j<_7_1a*Xqj_Be|*^`ib?;zcu+hGrH;(0lQv`sO|rB=?WV4df0cd%o&X zk_DVMVf6!+8{nV{NAX%lu0)_bdH*F6#Lwlkivl8W$t`(o)#wUY^@AP`t+O6zkx$uj z-x_J98uI`K6LL>{Maq{{id>NtGRJV*-^ZsDF^1&um*KL_@ZB4P6z7|-gf~QKEGaqO z63+k}H=MU%Z3l+oJm;QvUDYHjQE9L(WC8IN+FJQqDJo*YuV5&vk(D0U2Z&&<@*0=i z)p!vSD_9PBa%5cuYuySx0YuP;M4rm~ zgJp55YZ}zk{vMshuua zSJGE01pQRd$S>4j6uvK1mr^ba2&eQ!NV=`gMn*=FCQi69cl ztn@!bsDM9b#D$QX#o$$kg+C9?M>)1Qj#tSYSsTF?vov;xc-Q6CiKw?+BMY>%0;w6G z{NXM+@dVTLSHK- z)z|R+38+{m_w4J#%vei5rXbW>INvJW)T>Z>C1S6neiyj9fA+=xZ8R^%!RYHB666xg z_HMGgG>;R$D|!`p;}Yl5JPODyesI5VRQ7kHF*JtuY(X|a_LL0n z;SlPgt*O2R$>d25csJVGZ@%q6rNjBxheI2MSdY-X&S7#;)D$R6=)#NMk~^wluy&^8%^{0x$ljqC@KwXb`{bn$IoxdIe(={*Mmmzg&_>ViOVq zeY7-aPdo#F0kwyJ`^8WjTRx3U4u~c1@o3YKD{U4;*KP{9PHiT#ceoP_z5gA=%x`e4 z7GWQ8W@I!1K3N0M)#Xw-WoE<=Zw`;|SsxxEoYCU7aKx1z3Ng#TO`dIbQO(!7vZ0u{ zQqPPLscK>{0ScBXD7X4!%{o*D61bQqrGhjXjEABtl9V?On%?^n<`vI>`)?=e#EHW! znZI;9#z2y-3n`jrIE&m{)Zhh{UF=8&>Rox=gzWY;<~;Dv%gLRt2s-(N zLQTqbP|s6Z*t+v(b-mwNnstHZA=*ai`&YO*fhXwG$Dzq8Qo`6ceHQdG8rmo;TG}C_ zg&)p%bu%n3)zIX4i~N2+Lihvr#V-5BMGH3Xwwm%>wZc~=_UM^-zCa#`nF?j{!z(SD*s~IPXyhOoE(gtW zpYspz%GXn&&*-I5e_7^22y~nlkvIW00|(1`NMc>%K9NT7D$T5^Pp`7~CZqz-v+ssI zg^GIcLi>kFebT`u_Rj#41*Yn{z@E9VvPdipvcBGikRa(n)vW(6AQ!qclK_!?r^;R~ zta6s?L>9;VJd?8KVovHrWNG)gc$({MTQbWb8MiBuHIb}%ZkC%u%JThvmh1291P7@s z`|d2~-NTyFL1rXT=g%kaw)WnjnU-vj1N9OG>U3EuIZfs)OEI)iaQ`bc5|N`2?G`7h zT&1O?*8|+q26Rb)Nz3Z*kKJ`h%SMQSl%CD$DqHSbHneF39d+p-lqyg|6RMJJYcDlu z3aR{>IOvm$%BCvY_EUGW%usc2aq~>5;Ndh#^GuAL@9r`?L(T?#Y>HrkoJCGOGzI9h zr|F(%tK)es;#TJG>0`@0o9^zvh2309l8A4|i5+X_YHDw8?H6VhiJETq%?SqvVN4d-hZjZ zU`}guAf#S>zp|-z_%Xa7z9n`<#Gnc?XNt2gs8Hc3Vc*}M%q4*h$1D3&u+0E7pxP@R33I+u4J+*T4&i>*Wd5-DONKwPp1{AD-#74 z4Vm%#2%?#O<53?PgNRQjQMj(lOceE&n!<9q4#5F@!uzKA=NYo-d5)E>#COff=l`V^kc(MkTor2Qb71Ez| z?uC34IwJIl3ZA+;!cHUqA{@g58p~OEScmq5)B^CKvDdDB-zWWE+J?Ou!l}HkPXTZ< zZYPu@ec<$K&m-@(Am@>#SdeB*u8jKSQh;`mp96iLXi42e4(;aXLFRc}V!fUQOH0Nj zW`QX*VCSU~Th8Ub3%{-~EQ2=hy$)ERTjUNFdV|1suo_>vTQyl64oG{zLjHAyGhJ7l z^pV5!pBPV2@`+kxEJUl!mLBgB=p56_L$9QG7SZbK4`izW->n;howO`#r&I;jYQPvM zEt2*Jp?!)@A?EuPznX^}D^Qudr!*H5 z!$s2Y8M%;H3s3OiH487L#tfkL6hn5eX#laDm&$6#EyYre>VuvZ%0K@ef{#xJF)Or* zm+Zpbav|Yx$X~$Fq|2)i7;>Q?rB$OHX>_&kN+ zEt5Xi5~F(No+UgQdrCbU(>=iqxo!~J1Jw%OyCy*OtpRk>ah(BvFZklw@4zLIQX{4d1jD=wOK#oHb*6 zgSV$>7kA{~UC_6ZG5j?gRb%3u0Q?xDNzNz{RN)|C{=d&M)0A%5qKDEW) zCP~ZaBhsa|2Y}PtRq|fB}LZdL^9B353pVM;@85M10cUacr^Zt z4HS0BJ#5C!O^%d^zHrITK8y@nXBb8AfEwpOYZU8Ic@Oa0C8COPVd?+p`+HYrZ~-+~ zHG&RE5A&1GO15P!Kh(~S*;a+nID{$ZN4v<~mN~cux2H9QV>j-+9%&D32NP@=vDxFK z3bf4A*jN^+@BGrAE0HH(6;(Un_hvKGXdtkR8DnTQ)sb8ae*iYj(w&=*DU1^V6)s{z zs)Yz`TpLlVaZ*F9&t{~mh^Qjc@zl;18ZihmPHA7qQ9 zND9}34ZY0Z7FFTHAZ2ecs<`||7*f!MsEtw%y)lKD3%e&j-%WJKPmU=Kz&7k+aU7(W zIEVp*jvDUQ{J@%eckGl`q-Ds>HhojS>1)*6SDR~o;r7By>SI8~YJieS}|xq^rW&Gy2{MX6{l9SlRB8$Z|`Cs#UD^z>bW;b$Oi~kt8QV zj!4QGF{!1yBV2{z=9(orO2F^B?xw1O9wjP0G@470ZM74y;ph*pOa41_hC92+D%qWm z1*RXb>NfssDffFL#F<-4P6km~|B#x<(&{eFUqJjzVJVDjldLFReM}D+u}QRf02Fh` ze%8buiK&vwf&TP>QNBd7jO>$`_n>Jt&j`B|Ydp(XNp;}sLo$9$TmvY2mEot&L>8Xb zn;bo{~3cj{;2zg&#FKRdMb)|5uzriBjLJ?+7~_qeAuKx;JWd;S_^v z@Jv5H_C^|T>*5t{pZAovyD~J-Ev`T-p!N|dgJi)Gm^*?7%$QK0ih3%MJHh-smky$| zu2~t3aSHgk{Fn8y+rWr)ZbL+V^j@TzO>5=z47p?)N(W007^o=& ze&g@lK|5|OUnmD!wClG(c3Slaq@Mnj`n@YlE(#hK>FnoLRuwb~NM(rRi$5iG0Whmp zkil&MyvL#LlJtpk81+h|4CxAI8G>owg8z3H<;= z6@Dc={9VA3>G}l2K56s`CaT6FQd*#wy6$N9a<}4B!qri~0z`W^dX2TguwCiqMcc;- zxME`N-~LT_0n$%Qhl*v4dGE`S_kK{(wj*qXB?D4HpkQkx(<`N`Jvjj|#yw@^IXbj= zGT;>Z!;MY%pd+`am(`5^+T4Y}zII5Z^h6$HINx|0aV!VlfoFO#fd`!Kb8vFHqZjIg zZ}=nGQf0S_tvTKA;IITwHHs?sauL*XBSwcJggNC)8|5T1N@G#;1nr- zrYx@B1$F!LQmw6xLy(0)59h!YINKKW869D${6p{6-r+=kI~GhFzfe~~&1OF+5IP$$ z*>uf%;l?z#c-)%8ITrk^HXFh?3~>mIvSpet76I<3zi{6)RJNmf1%LmQnarH;c_db6EarogZ z35@)-H3%J!sm+B)3;LiyDwQ1#w-v4a-cJ|SgCsB(9sd-}l-KB5yJ0n?#mF2)gTBF) zZn=zdTPn}WIa1sR9kWdoRB#~%O$*hvl0X>7NrKQl0zd$l|2Bb=_h;^W5Clma!j%1% zBHB;(N$xI0h)Z*Num)A&a4dZwAW|5XR+m(D!Sl7h#=%v@JLq*}CRy|W5+T2lJ#!XO zZMvizNCS;m{-u}!*A7NYKfu<^h_Q-1GQdr9&7>}7cIN$J=Z)J4PWc8B&QEVm{R)N& zF54)7IL?Z3R#kr5?b1;G_jB8Z2tK^D-H6z@|#KC(2sDZNX4XwXb9Gq11%j$K^fL1xK9@IP+FDH?p?5g*3C z1W<(jswgKH3TKuTo#}?fYA3?<^6ZBBhL9nO^7~j}5oVY8fyc(HFD$6f8|2x+&-P+7 zQNqST61(f{RscjHW#Y@#-=-4HS6HiDd~c(Y+;QzX(Jk?E2s|sf1zSP_(imsKOULJf><= z24q-z+N(a1bZetu$~cUWXx=-Lcl_)?!GTqkDOEP!Lv#H%{aFl^Lfbd6gtGE~jV+}z=C8P$DAF8a-6$#-M7s{4gkwoNWB zZOA$h`a-1xOKmhoxJb%)*+{aee)%QZ6R%Y%aSRZW&^2AKJdY^b%dJ>oYMP>KSOj^@ zQ2I!{MS03zQ}%sJo23rYJ)t54Mu7J|H>~$#Hh{;aaw>KMn_GHZ{Vw$#nVr$mPoT>$RSgWZ# zpax5mH}(RpqpEC^g_tLoi`$xCK$QSp=Bj8B@fz((i7i`VLlDm;T4g^#%>^n0t9s|D zRz)n74VmNo`y?5={T3ZXR~!udUj6)tX#4^EMxju|HUZ?$HJJ=mp??Jendoo;0>J{6 z%{~nXS&+~pz3h%nmbo8@hqcNc>18)1TeAf2%a&qPiYd~i*h@}z%z0Q*KuZo#oMoA! z(M_)ebHIYYJr{~sQ$BuxBskvF;_nKC;=^!%q1&8)@5A`=6!Ckg6QyQ##l`+(gTOgh zgJo}NwcM^VB7%_sFMWcNc0aIUChQH=N`w8fA92LQEZ`j z+vCIM!lPXI%6sNRO)_^;1!sQjvRdu=ge+c6&}uIc?Ba=ABq7%8e8@|9t5RW{$M+@{ z!A9#1{vVR}X+F9$ifu5k6fg^^H0x!P7wD&XqEpp=`Sa)14Gs~rkDSv4**1`VuK@Y; z7#jbswq;j7F7Jci|BH29;9$@1%LbjJtMnu6!K12642QF;x`es-cg?|hT`H3Ra^2L$ z+>3ghu&fIQg3TQE<1D)puU|Gc#@AWwi?7qzmRe|g>{%q*b9-fxkD0@+(sE&5#?)W> zIZ5<&(G)N2>q@a+c!R%lWA@)Mmg{(&8>{#0_uP1YUPKW?3!2HHKUYrc$tybBNCqk9 znk1!i$u=2tK?z>Rii`B`L*}D8Oc^KN+z3_Nk%#*Se4S6!S|?6b*9GtKHAz0a&?aGGlK-H6^KM&uitAw?()i^8g~b}#P^4rL92Ut zC=~rpj!F6WJEs>vs5a!`@yXRGx|T>}bM>SSu`JFLimn>={#bn0520h}x(k--@!7w-)udPiZ$3c^&#Cvn)54?4LTzh-G-doSFCs}xCBAe?N zdyti;W}=IUCsD@AB++W+Hj!&#f6zRW`S0Y0Ak=?Yd&M?3nIN!(8y?XYejg{|x>B1+NM&A^$G7%$-8*{;qvxC>y6+Zk%plsag1pQ@=D{C&#)%4t$P zK}O=RVF?$485U_7g67KGu;;q$Vncy&CM?QE<{$T$TEr8%r~W|*eDn%f&!G_<2<4`| zzP?P?20svbVw$DJD+BiZ{tE#`YBGIaA^_}TDtKQGfU5PSF+`?1<`2GMr+b)CdVs%~ z6DW5?{s2+Dx^qBm$93r`pWN+IE%Y-rG?%fPaDgL`%f#2P}>5Iv%k~cYsph z=A-NRq0z0!LNuHzNR+BG5lH@deFl0580SexU=3amF1b~hXcj8YXX%#`KDJk7z3J9r zF3~F{Xv^&4jrclNeX06|{VMCtGXNd-0JZ3W@Csc@09xl6*a#)!nxYPv6q&viWjkGY ziFX@-aIUPb38o-jN~sR#3KAaY6V8>@)hl>=SCEI+dpcLvldo&c%<4XmQg7G8D7Eme zT*&+CTYYv8;Z~oKWmvX#Z`m4W@5-vjS}>`wGRrO8E32lq4eQ)0`7uwm=y=(?vJ@|W zg?nWcvzz7er9jwR!koGCmy`g^Edg(P`HN&A$I4RO?C`7LLsqopSHVDTsrm4$tRfSu z9V-|&ZwcvHaVBSYR$|)rtgM>11e16*7o%t8LsYU=!|A~^&R^+NS=2J*Qd!NHdihk4 z(b=Sl>mWQfe95V@p48i!tom3L4xh>zW=Cz)r4aI|TwfTb^(iAVd@2ARduFx7Bkecv zserB@@k%x^Smsw|hosckycB!T?UnYy?aU?HJ`Yg(_KEOyaaAg&^JjZdl#@8V{$3rU z0GEo>EB*RQE1eogw zRNk#@)A3RwWwOw377K+n_bOZ}_{~_qwohdRtCmkiIh^5A!3T#yxl~p&qm@gAoIoI4 zDp;N-g77J}^LBarBp3FNDiv zseR^lsbH@6I{zM58yLt}57S1tRG97D(xtN0m_A%8v9^ax1$kljyUi<116%cw3nxZ` zU?uB3;Opy=TW28TaUxR3kC&tg{Xj%~x`&n~bR-^BoA%>YzcIyWAH|je*;$zI;LBko z@i;;}EG@{93e!A8GST1R?uW2Is%6L`{bHn1ib>E&RHJP#%`HfW%W*K%^+`^x{KbId zu4at*-eN9Wyh1jY{74#IavZk0aGY-{>6fN5PESux)|kSQ5Kn66T(43>GyJ7g9I0bA zzU(EJ@#W{H{C3)qJW6|`?sSMjCK9$Qo&24tneu!`=F2VLTG%0&K{vD@FjFv@ZHiIH zMlG8rW$EB-LvJo!Id-UZvP~txcnKL~f6oj7WB#CNA=xq3m~|`mPeKukH@u>_;}at# z2)*6+NR{}3dJ06hpFSp{dbv4OL|e|Xm*O7Yrd%y%Le6V1C=lh{3!d<%xWLGK;8*;z zdEq*~5(bDp4p}JnIAy@dnWTZklfBXglB*#LNiJ6!P;xxt{D+~ znlJFCAD>uir<{W@-SnLVMatUKNZRv6OT;;GA+CddbFGrXWv$sKz{~yPjPTsl+t+q= z#rfygiMgH6LKy*hR+VlbOR9U!F-?T@Srit72+ck>=P9qfubEt3MoKOHLM3s{Q!gSk zw~|?7!(zXPBbLya3On4C(#^Y~iV!gEw(9CE#jfBPXuZq`+fGHg;?Z*CnTJbKZx!h< zAReF1AOWaBMTKbsR#MIM-bNC-G4rj;a6B`F1* zwFFO;GQJ9L)F?LGl$S#-4i#p_Bap^KkvUi(ScBlP={Zcjv1c-Zs?-5foX5m%bL%X? zJkID)=k%(gY=pv2(9kUBS|?2{*@IixitZCnILD5##X> zI4IP!c?qLt5cbM_r1;q)6kEf2*C#27Oz*5-}EALT=XeXkC<`5Lt` zk940BHz7z&<>HoR6Jh3J%dMc!m$@Yn)Kn*wF~0r!q-L2C2i1GACCycW3t2u$kp>`qG#Tm$;1q6){fRMYHvtJNNuRtIRP={1owcQ1$=$l(wEO;kBjutpy&=XD$|AtNr>(%(`oZ>qaHZ{*hdNp2UzNEGzoXEbgyW$R1O( zA&|lqX*>>lW)k%Q$F2tEVRAk|A56tcC5LcFC#{~@u~<+<{xa7xhSakziRE6{)wUiR zYdIx~#>iv(hGi-gU70I~D)DlmY9d1OwI54FF!FXBns5t0eF;kA0nSnMjA_;=dqyh6 zM0y(JG}CSilv`zyHMDguRb2F+JR!mL+6lJfh_O}_L&$19-r&sp{6x!n^t6LfBP}Wl z=gWvjHEsJ1BIyy_tQ*is%M0sMVXdZvk?&aD!6FnipXnzGh!48_rd+Y>m9}*i=Q$9O z$aeeu?@TshhRTW}+XuNMZ5=4)%sK!|$-B$>Jx)tPFnr__S=>zf>z$BR>gz}f#UTQg z3bCA){@ObG(*CCWT1JArYG$%AJAJh^Q2hS6OBdQ zbCnU~1aLl}%Y0))-z!mn2kL9b9~&ArRcwsoWlO)sX1%h=t2D*|X=oTZou`*s zkcjRomd$G4T+j<{Y|Q6lGcy(aRD135&Nl}p_mzpV^lR^}4$Lv22nIR_)NYv;pj7fj zuY%c+AB{g=G=6+cD-wA^JYE0me_U<48P)Z8|S=gp$wSi3Q>=o4LoO4Ekxpng?c0wz0RqB1oG0t|XnBm4wO{Xld9xl^xOm1ZzS#bLTf_2VNZ*z_opW zPfXbQCjn3to#=fP z&4&toBf6f!_Cu8!5V89x|8J@>c^%4SO6o$y=y-npq(5bPsDX5S2UqYPZ9d*&3}9~L z2Ywo-!h#5|(&jW$N;07Cs_(D_Iml;;s+l7H_I%_uK|MTZjX^J>VI;ydL~)>g$lDlx z^P3o!KYgoHAEx@Xyv3;v0pF}g{5vogrw=WWuV8ADN}T{^jftTOs2UdT`B-BpiGW3s zj=llnHln_<l^CEDN<0C*&(k3)|btShP#p{y$Ke9>fppLifS(l zz7C?_kK8IrpO4%ojYo+jIE%;?BD{QrCwiI$3WyvBmhTl+RbL75h^ufI1DM%X!)2m? z5Y6sKbm0li-v>s-@%Qmmr>Era<3(?$3^^WSAB6S;1G;4%2OR07qfV;$Q1^iWTOxex z%?~IMURcxudX?+=TNoJQ{y(4zmP!nHP$w|{@bGMu`h6)XOgCuU_wS;~FbOuV?Mv~P65Z5-bTnGoK z;(p5q#tTSlqoTB<2}ll-L?#od#|4Ub9?<64KWDvyAMZ~-113l9G9l{WXP#cxPq~KR zvLZ3YSNMB-3SM{c%+mWYqw;f2|bL3EXTT6=rGjn+>pCuD^4S zlbqO5t})W3o8lKPGQ#png>>;@(?8k-XqI7OIVJs~|B>p_sb~CE%aqoz7D?81>WYBF zEB5iEb70BvL(4}^e%L@jwJt1a_VZ1f)>KIRs^u@I55DPW0X+!l2?giVkNReJJ#;Fx zNcF(EH%SNAv~`j2EvvBW)r1)YEj`V(k?}^VdYNuI{et#nam)osb@kU-+Y|=!F(k zudD$_p|NFZc4x8yk(LHRh(bs*sp_kFXUl-%`i!wnpEGoXdaRf%iH}Af&YrBkKWZ}1 zzC{6LgY_S<1a3wH@E%wD_BN=T{SXXm%i)9Sqs7SMSbEno)FEM(-3$^*jIgv>RbusR|tM}r1d zX<=xnXC!O~uhiIk8!bBRSf-YTMiooVS5^%2b;x3`HgmC}+kI@K76Yg)VcH7u@WiTGSi1bZ~n7p^E zD-$tbSlyyB$D>Wd96Gq{7sAw3p8-?nd>n0rY*@o4V%lo!FgAyfy}A2*_z~4%85SxU zwEc)PxgS~5Lc2grxl>;KU3Tc+2#Sk-ejKsPZ+u@LZ<&|_Vp;VAY%kuLo~tHaE3#Ab zb*dA6&~eT;yRwS>FNT(?J5_-g#{bGxb(hKox`i4b4~{8Qez|CJpEj8}xYgug!1hN2 zk^AWyOo!gP>uwoC+oE`XzMdWlibOTpAEBgBA}44{(ZoQH-K&we>4uD8_?955)1}H% zj*#SOG;;V>mVrYg%el%FW(-Dur2Nj^U`8NTty{oLYn~Sjt?BiJA$+>shoM7xcQMX} zGm2p^RE)DT>A}-rS+LqQQ(Lp*Tv}M9J=HgTHkn)=L%_dBH(L}z`x{Q1{yyEninro! z$_ux0*S<^C4uVTK)*`-X-ic-_bc2&sWQ&A4F=PPqY^Sw7EpdV~fAX$`cK_w+xLcrw zkiI+}pnrNg*m8S1&~SM=K>qY}pyl#()VKfibX3%j_~Ge5%jM~)gdpFZ4v;@Q9cZ{c z9iT5yM}6BbPX}6VPY3AR(@{}9BmEdcy*(ZEtv@^+q~D*jRDXIp*l>9|Zdym%-7;&u z;dnaENBUMM>JLxH>80%dJq-H?Jj~r`HT^&AX)%?bsaz z_ZqmD#*F4_x!!tba0MG;CbVIK?u;_~J}nT|v$Jbc^-PEyeOh6_Fn)GS$|X_&b|-Ga9B zS54^{v78}$>T%=8Z&=r!(;w}=P++he8mbu!w<+wn^k%C%NIiJPXNX(D*wxL-=$Wb_ zfY$emr;odi%DaA1>cyx(S(%#>P`hv2)*IMcSjujw$pu-5QqVw4gq3h!A;OO6|74fS zhGnyquBxO2Xqu@~Q2`(t>P~B73RhV8w{moY%!Zg_5q zfO;7{-BM$>Y+-|;%wG+-9DdG~YE7y(xA|>uuR`G@3!sa4E5pHHn(`XCRv0WN7D}&1b+?PA?ZZ2bb-_AA z@E$c#b?Y4Ip~vQo(^AN7MU_^F zU_?u<4;z**pPLvf+d(CNIC+bKSQ9kk^tHxuMH+yafzn0%$d51Hi@MS9m`Jr2wL;Q z;;Z`!1;F_Ynya-b`y>9U#ufIKa6au+kg8HWh@{cYM;xqy%rr-=VJ-VhqiabY0f$zGo@4fZrI08PA7EWZh3zEDpQNPk2trCt%1dhMz<6Dyl4!vG@9JQ z-SX)*BiVLb0eZb#B50r%IkY2YU^fh51EPUJ*w3#fmMn4$U+cgXa#M*hv``j`gEJJ` z@~{D!plpC5R1!0%NNcYcN*jA&P+coYm6d-r*hpgNLIo7soBv}={0iY~tNd)x{PNR} zn^<6Vi0MH~8Y-|0^y^>9`BrQ&pk1O8%n!vDYPhns8LP&h-cl~frbDs4hm6Z zn4k<@4SY}YkXv_%lgl{2;3hA^3wFcbXn1}sx1ClOM?_2T?T3?)U$yRNr@KXQB%k@R z?2cHITIY_?ftm$ttxj7HZu+$73gZ4*(n)+?eYJ2^@gkp_*Fv9`_*qjasUJOJ{WT!9 z4!sBfS1H{OwfFanu9gUq!33~S%idi7`@fzv6VHald#r!H4vlny>CA6cbOniE-0-n4PEA#{5(D;JrZvC8x7CbptkjwKY@JO^rU}PB#6)deTc<>LkJ9>eCjx}*oKlB zF^-SMY{1hG_4({zB8HxY^p^I`8T%~N=Bn3@Kgn-!fxL*%p;7y%QgF};rw6>x{vn@O{3ILUH(DU98buKt0mKUrAbzG zv1phM8dn4763Ov-k5V;O67>PiiPw=Fm<8>jE`V%e0w~?zY+xw#M{5M@%`B}O1+>Uj zMMxk>8|LHM@yI*|Cj!(6;4r)?JroqZ@1P$nNSglb`kKlen=(Y_-U~vlm}GWPkaLPK zVXqrGG2W~wTP2)u#2r+y42Iab^E4mO={uz|XA?dFF#%>9#)T*{34%61EsdYTer^;N zqW_YHgcG)pXk=8Y+BztR4P+!DVF59Y`HR`3-=wfcMJb+Bne9aha#K1j5=r@}qMH@C ztjbAfqa7io>aHIRr1c@ zarOOh_Q0xx)lsI7S_8~anf8N2)Ox|s;j~GtUWb4~5-6gP5r2SKr50?k@K+}10QRil zO^ci^Y(1R%%g^FYUZorpVa`57R2fuboGGd4n=~worJTGexA;=6+D*lJRfQhF(a5?s z`YlePQueEH5~b*~ib^V#9^I1EK;i;A&041tGT-KVKF$p~ z`o`Bn3KulN$F1DKW0ejoPETCRi^?MYR0L~al~jvYI`e_ zdjFjXV@XxeICn$zo=m30Bq7OgvZWUwg9CDgiN-XU^thmMShEx)Yxt^K;&kS}LSf9i zg?u8`Wum2VH$;l3yeswtuOEPoV5|c$1(3Hw|CkC;GA;(NA^~pX?WWwxwKbtmgH8_1 z5P(z3$=Ij`r;L)yu!-T#m=gF?ip3PB1_c0i*9y*p{oxc^i#!AQPk{k_bdPrnC+u2E zj%7hHiaBgRFS3%dgpLvAssz#jR2*!XrRu1i7q5C4!5>{HtBB&QkX}r?H`PLrY?^rY z{OPBsRfqAC+EA}v;BtsAGj@sR3G*S*VH7do-hVVUB+3*eFq^-NxBm1Y7E3XS;`ced z<3xc2O^#0TF4XZYqHL-AyF)%|x|_+jxVnwQQd0nMs`{8s@k_#T?347h9w;HIG8bt& ze?^jD%E3^MK#(je78unBTgXA2{)L&u)CX2&P(`6=`{)Ckrd(ab4tHUUC18RQ><{2C z1b|_~J|fvGh#`QaA>uivaj9f&VJ!eqv<&H428Bcp&C{cYHRsF{16~+simA+i?`qAI zo@JQC{wuS9T!szUVR`t?csQ%(jlY|D#~*#licZ`;R$ea0^N7q#gC*70H4{SVi+Rda z0b&Y+!UR9xR|9pw{Zs0r@m}k?{%BQkPWPw^LOMEJX`g)W;Z&`(hgxMlc_M0Pqn;6|eeG*fg9+P8Se%sts1<`kyEvCYp zsA&o&)fC<=ET&eGq{GxfYek0FU8^-{A)K{@R&SM?2Myhhn!83Y z>ROKJwHDy~l|>rN)gyL5aJ7~;zN=-AK8Yz#hs83%)?}y6)xm6Q zcS5W<{a&%D=J00Xo2@4g)5F$Nwy)ncHiDY`%MnhomU{DH>i901Ai5+D+5Hv&a4?6br*JFG zdV3ngm-7b`$NU9_*?qpR1{!7ir?^{-_pUI}{MDu68t&3kN$TkE;$_=r>9zM22CD0{ zn1;308qLxI@aJLaMH@CIc!fpl=|6wP((tEy<$Nc1SUSF|MPFMcf+J3c#V^jt7cVUr z4l$#hnFuyqey=@PqksKmU{-TO&iN&`O=ES*!ehy0Sl{J%9W_kZrn*O3`1FAy0F6-}T;IlkN-s#2X&ESVZYs@TY zgxpNJK3KE9KVNpXzY3inw!lEcX(D4E6eg)NgXB;$r%XRz!aV0sCwv$THh6vYW_6gK zrE7#v{MQAAxQW@}k2Wrc3!nWep4?%-OrD~6kfc3di@M_Knp=iHI_}`5ahLb!n}RcR zcaJqop^bBWc{;Cn6gsoDak5RN(vKTM@fZ$KO|3)t&L0a8eS{Qk3O4TJhjI7q>2kOq zZ%hs)-_4;}HgQwD6u!v)ECycuQQY^rhJ8@E&HW@QeM6!=e>qkx|4SR-rr+uvhYj>E zGM?6kee^z6Fji?|@yI`4hXyZ#g4s4yQuQU$RyaCIrcUoTu1#M>m6nZj?o`qAP&}k6;FTo3nu_TE} zdg-(8k|)e&`{T_sth)PegeYuEFZi*D6wN8yRnmAFbZGE%QYNz^<3!49W3Ed{&~ON) zLqG{=V)tlilP)$u=IZC^r+>AvK@zsrHN{ zf}J&~nOPTm(#`*LvouB^=2XJ{QQ#*%v~J7tyR6&)pr7jpFAqz-@X*qI^n*1o)yJeY z9d+l~4d~%wphuzogB~u1ycN|YM!X~4T98ae7c7@VW?Ky{kDLrhmW7@J&~@S0RYihfCfsLQj=D7?ZenJMb?IRSVC)yd1xMNe+( z!bt8xi!eK+aGWma%%D$?pqDf{I$|~vb*0nBeA&3g1e6R4@_5OSm=qVWEa_7Z{SfyN zAf>cZc}yzxyj9DjTZZ`SuwL9Kp{Bpt6o^3%NTJ>)LOU<1ZD6XzE+k1K(MnbS%ZEFM z-oZ+0;JG|n{2fxz2eBjSru=Y;U@z0wFqwyHHS-se%CShZ=je`y9Hcbx_#?7%mRJb0 zL{k!%JC9~qA7yMwiqpPRsx%wFF}%iMPosKsUwSr?2PCcpvZ%YaLs=4v zY(jn1FY8w`12@Xh#xzttEdPkRQ0bdvL=Pi0o9`YyHk5fHTgN6U9C=QvbF=q_VsVQU zrX)pLr5T>=utkwt3OXWb!eE&wJUTgac=PowOJ3?Gov;az9=h7Ck~?y)cMolbH*|^( zp&J%rJcF9*Zyv#v3SiKFT-KKmm9#~l9A+P3n3Dtv|N9Y!fPb#xi_gY-F5(a%r&43m zO)O~ndK<2_LBg$HB*aWr`^4`}O`uU7-HHh(vqUlhLU zCw)GcBZ%ZDU45m0=&XMu074!pkhm?3Y0Np(-%=E8nRPOo3v%}TxmhGd{&q;>K~8icSiSRxN#z~g1>aCWfkF(b*L959aUtA%!~BHS%>e$iOpVnNIY<2 z(1ZfW&8tBHgBZ(kJpMT=(zgg@3gix(05P%y7WC*ECH}^fwlD}JXMt6fFz^API2qUj zBO(K0k!k{!-#lqImN14)Z>=N`=BaMAMD)##LWlZIZ#AbVzk91eo2H)h=!={KD^8#( z#afU_F&$mqeI1iD*qO;7lOjAeG|1$_O*<(5HSw2&p+be1je7K*n>)H!kvaGvnN@Aq zC1@_5?19{s%wq=VapxqxCM)bVoDx|fGroDsE$#?bJPbB3^5W#?E+JSc=W6k{2PgbK z*@&Pzqg%QkR%})*V|5$~QymaX%c~>WkDIcy$n;tA!qJ~44?0$u4E;kD1#D$$RyIC7 zZ+e7GB8cVuK^NN15D=m>01MOr^5qeYIV-{mnIU)pZ^;832V#+onRLEohV5b`jZRL` za`(bMC=sB=>%>xcY}qrM3pcw!yFpC(kUxk20}>l=J0eUU4p+k7;qai%(B=ITx4F+v z$K%Q-JFgSHmqU;5)e!mY)hGhkx#^+F^Ye0{s!|ZgN#{9=lW|HiqX*3Bm@xXWUr%nM z?#B&;dC$-bZN?VC0m^@h0P42I0@t_GH7#iiq);lZIJ`?l>rgXA)%$$(Rxp!XJ4(+3 zGXOM#ZDVdnQ zOGbmP+1UxkaPw6-tPtT{bgtsP_4U;st>5~_5kXVDzBad{DsB==@n1bH2CsUN49g)( z2XglD%}&gaVd!8X<)QkHU7n4y%=t)G^s9j@WXE;38QN61eEr zC?qgIVeQh^lTACjuL5vAz-ap!Oyy2qRSBASurM}2YnU3k>^vLH+d{u02YRx<@ zz4d3fTZ_Wyb&Eow!Mn(;X@*ic$OexV0gBhyOoA;qD4v7rTS_c1^(1Ut(0uywy!ZX8 zWm9_iOp>)8{aCsK&3;s)!4EA7fL0U3lZ3Iwi?z?=nwe=X(!5QoOq|o_>*thH9Ha7l zPnRe7G{C^BlA7VotRuqmeN0r{JU-zLtwZsRc9zy1@E7c**wgT~R#(WeFSbIyD_+sg zTC}`IgYsc8S zN+ZU|I|IV5sc}_>n7ZcZbWd!H&__FhPXm3H=hqVH`|Wlt>FZB8M5Ax^mb&lTo9dC- z*&4&PE4C_J@wjSZ*6an2NtL5F<~-cMu_XJipY?j~-*On|-Cptdw)r7?W`2o|KbxUq zVB)tJ^=8MImCdf2wav?nWckJH!T*Ta+>T%*0Rem^^tVl0-K&iq{zYGo;M%S9Tj4Xk z6~3yp+^z9#ni`%ui5^}0cPkD$!6-j{+%#{JTk%CK-JBnasfWJLY_hD1>dAsE3`xO> z+KQDNd&gQP=#5XyCQVc3H>i_N^5|h+$6^_p!h3yQx1_tuIIvqf7q_{+VNm0sN1_t% z;j9L&Hvsz*qYWi^b(Ri*O5^cLv&bvdBVzJt2Fiqu=G>WUQE{Z&Bv zRC4@mK`0iXXa4G4oZn3@Duedt00Cdx6@*56ZE$lFH(aEmQ{Ln4wXcmvN=v?jsGhZS zuKk*@pZzx$?kp;d$EDCGR`;^W>!u0L?k#;Nn~DwuJrEYop8~W&iO@}`6)h&MAw}64 z4Ip4(H-;;Kf?2G@l1KfOubs+R)8!763qjx`Ee<}6lr%Mr4}~<2W_7L!vbBZDf*Bjk zmcVJ&R9v%505_>B-Payi2zvCXV1ivlcptH-gSlfYMD#`ifP?x(S)9K9gxRz*ytWwD!Mn& z*dV_h&C-|^v@@5u#k$O~ruhx~3k2)dlJc^R-C#cREdtm~M&4naUgH+QvVzwLk}GoO zhbR%PfUm!LJpCZCJ@++&Iq&(XE?r+P)b+~TtTw}`(kS{>w}SoW#RpZ!mg0(G5Nwu% z=e+69f{~UartDE4Vv6C|n)GnGs>2i@#3A3kjX|p@5UB-k2;Hi953db$i_iqzGZbt{ zc4pckFMzmG%sZ6iY01iH@?s%qf5;$d%rxv&O}uirD^LL#P*4WD_Y`hNaaZ9Dr^8pp z$hfN!vyU*cCsv|w=E=Z0_l?jOFbpJIC#>NRxG;x(;%LBT3DPVDmQK+Z!97l!m%)e<5^;gKb zcC>-%B)pRzR`jT>3h*cUOKXhML$qrt5LElV8Im_qDw~T`4ra3+lS$rME_VQP|6sc}YYApwBQK&hjwI18!QCp5m8N zIKlDexx1|IE`?d3Dofhe?0^p0l!hlk#MR_zOYGdiD!3PRTFj&{(K{T8wOIXXfWX zZq>aw7ziVAU!xYC3;KThZM2Y#ynPLO-z>TXWPqgAXWoncuKmUC?V;YtvOHZ?SU?P< zD;e6(r><~`GYOrtF{VhX8q*h4FbL^~XII-lZ3=eri`yPux6V8a-Q9invOD}lNS=qI zvhFcd5z|DNA44SIN^{kL&`wXXLqU+>~;kC!=mvYg_uAJzF= z%VwS!o>=P)e#yL#xe-^!yxlxYE*>S^y1KR>N&@#52WpT`5dr^w?JIkrwoRT#MR-L_ z7xk6>h)gLv_D$~_@*#Zu-!#wAzvpfHN@X}zaNp36vYkvn8qP18Pj{kKoQCtsV$S_Z z?@Rkl3+QEE5(@xTQ64_fP%DYnDYeT{gKJ(<;u#prkj;uIuT8W zI%>LErjVc2yO_~*D4LbSJM>K&+NNC=vj`heBbbG2x1;IiPG`gj03lKK*$8Bdc8*3= zhB`;%6zq0fr2uLr&okqIR@uRHKvrRQ8H+Tfw!}@)eB;W4dg)lsDip@qqF~+8bO2D9 z5ljanw+N;)wS(z4&0soEw2z7@9ahnW2&6-qI0m{fKpu!Jx@xdz53nq~M0DUQD?AI>`dEdHiV;K^EyPZ$VOEa^}>uoRU8 zo4}@bC>^WC)gSa*spi@Uo)QF(rJK5zcP!m3R&yOmVkncvZ8Wor-ulFy`HG$s^OV)D zzv80R*8@Nwd9Q1gndFeO!aS1|bB24F(RMW5Ob-6zO&*q{B}LPT32~%`9XzFLJDLvE zMzT0m4z2{*#6A3BdLo(*@8x~4tv!4-7e~|0&g17FMN|Ei!!bqO$WiF zyJL>6I*x|XbRWthT3&TXFypaUNKq>o5^fTGJD6@I`_!yknwCC~x>qGxpGRS>T8=)y zWLt+mKXqdrV#%h{7Fr_`Tlv>P=pUaF0CpJl(&wiNv{;{?yl=HSFJdceBCX8(XJWx8 zUb~fff7Hr6I>dZ2ZS{Fk-yDpR@ubWXf}n*qzmhN6tj%MVNK>2l1X`QFr`PTbyo^ql znDL;gj)F>CRRz`ouNmU`74u@k}m0K)rjRe zp=u7~8H!YiiMU@5Au=Nf*MIe;@k@3azSTY}zw>oSDdk3eikn*Zc*b2V3j>oR-UO9; zfMc|L=3)wY(KF@M^(=16(;f|0PW@9Wu72^>YyDYky)!~b7*ORNhqmnDSe5ort<-xW z&UV*46{mT55~aC&hC{3O^!sni;T%-!y>Ri?C)U*;^_sgw=7{L6*+sg&S;?amqdjL5 z%!i&L^Qfoq2M3F%Yb1A4wO=(Znz83U)KsJqL=dV>F?iiVdkKg%Ty#qcq+N6?k}>U~ zLj@$dcZ5e03ukL(N{dL&Urr>+z&$7o_ z9HhZg5kO9OUJ7#;SWjM)2>hG*Su+FE!em2KSD`{dC+?a~y|t>gCetmJ#mI8fC*7@U zIm5R&D{3tp-PD6o{)5hX9*b*5>M%=WpqPkK2^I;(cv7%|RM?m10rZI^DJ+?1SLKIN zQI_yjf|mc0hEHL=y<`~)O4-dRo|P7ck%PjyO;=@kv!yBRmWK`U0w5d~L<=yrpdz0& z=`xA)N{Y$i8Gu+5D7z%`wDM2iunwB(z_h2&x^ z)id`dn7;MEZ2%~RnNWXPOyZqZ;8sKqXZ?xqe0d=$YG)ja+z!aKoTy+2<)-byTwRm7 z11NVx{9pt&gfi<#-16DAM5)5v*Z)6ZU_Q(d(y zIB3%W2Ebp=ZZH78mq3y_^!V9Y4F+d`3D-s6e}(xc_X=0}Kmw2}YZNB|PRzE>E?rWAG-^eZfozZ`nKAOQ~j zR&P6Oqkoa{G~ov^I!syrm!X^06AYkFwlM9Vb%^7 z9Co9MQ-+fPI(cmHqZ<=|%<&exPcX>EOutzDzJmJRQ*iz&!9+{|$_L%5mJz(7KSMq` zbzhhOG1Of&lgs&~#kO*xr&LUOmALap(1dkd1deA#f6K|RX-z@IK z{G&S&A0Vm$BhOLUDc($CNP-dFnFDB`40I=!6X%!)>B=~fIsn>4uyp#Tm{3R0HinV*TEx<^0N#Wf=E*g@c6{%VHw-&~k z185NV7%iPt0~HTG!z4_`NF69F2C2*ezLt`PbwX2fh?LhwB}0^J zlDhVxRgE+pUmAQgIN9;n=>%}7G@R=9z>afa-WHhyTs20PWwVMRRdn~k_1C3WG9yun zB69##Pvc|`pkdglMS?L>=%{PYk(VWndD|<59twM9{F}|bHVM|=8kSO z&N}(A`{LWe*oAOx=OqPSD^$O@tWgB=lg6Fs*z5szQ_4V4eT#?bHCD<%0Ea+$ztHjY zRMu_03cLLJ(6rN0-I#PVM;9k&2LizbytN zK+kzDa?#V8{zaeXc?0wOZn!>}|NQtq$+*?sWY#}VCN@atZ;GjruB@EX670 zmF+_U8PX>c8)S`4Y!Lm*#AbhYCN`+mjTZEgpbUlFnb@a6I}5Z_ZyMXVMC1-m5WJTv zvDNZieBkg>m)($NP~E|kip~B@W9Cd0)lHS&jg;;ZTKU77aCR-(A^SR5e06i3_^=uO z-nzi1tqYj8AkWgbtP3C&yR@SWfF=$AwE<-PGU1CSG4r(Z#g^T%N7M$KO&sb#?p{o9 z_&fr?loL4uA%SZ-9B>~?&BExR4&?b~qv)5NMr|pcr>i$m9mtbrlGTAcy;`9Ty|c<;iTHiKv32Na_9y)gYuHHLRA2t;3ij?>!Tiw z&;@dUGA9poGP>QmK%Rlm1`f+AgeP+_PoesSDv;*|$&ATmttxZRFs_?b0q2LuU%RRe zTNgkI_&BOSZpOsmp`DwVogzB7xR#TQ&M1|nOGYd~uF^4id}hUCY+WE%ra4*}$O?Xt zG7!`g%0P}3YbpbHEj>e226D4l^tv>KlX4w8H%<6{bHG9d7mai0#rcC~WnCZ}G{&kx zo`$U`xQ*4Kl~4upG7O?sfgA~JR0XoCwOAF%%lX!+x5p2|>t$UaEA-vUfT^twYr6J# zYaC1>I3XVLrnX9enJx3E1g4!usEKd;Rns|z!Ee(>vHCIX70iBCoz!u}~@CeDi$EfSve9 zpboZw3aH_DZvYX;SLOSTE*X+JIvfbcF`TtGmadSiU#z=nVKT=&8Iw6CQK-wF;ece0 z=|6vLf?exnubkd{v2=Vk`*u`a%D%ph4vSv|$sEjNOlEW1nTcRS%~PlH{;82j<-XfO2l;tbf zI4lA1(7R)QK*8P9{IIBqI|y3gKk-Y)^2eLwQZBx$@E`Q4ym8@=9v|vk7?a(FnT31 zS@%;W4V3Qr*(2aiyeC!(w2*!{7QiFS9nN1iT7u`nU?QF+FRW*9Q^6xkVO&&09MJWq=URo(Vpwi z%V{3$qU>n9e`=t;(fw1U{>%MSr>)j-|Lg|4f9kXbN%v2kz6PKWuG5}lz!SLwesffz%Ka+!yxqMOkz0^Bs zH#9{qFKewxkykZ5dCOaJ%oaTbNP1=nJ8$t@s56R}D=icl>Etb6Ijx`+*QSVe(5n4_ zs1i`>K2Jy_|JD*G;x`*kQY)yP)Jn<-v|9F7oM?;PR9bbPqz-tz6_rhR=0yo>VuqOZrxpDVt`0CSlbm!` zG6@NoHcl3wTjgrXm{5ok*{v!>iG=H>Oh2hor}P;#X2^RdI6BIwllR}5p=9|U6BxAT zx6Tk0LW(>M{y|;-fnR9)Tp(9PaPJFb(a*Urjy~NN$W5g%x6^pjb{dazE|^tx0g(Y22m}Zsjy?(?@_^LT%coOowe-s=dYopv9GI zY>7Zwlhe4ZfDvUUmakd8Mm;nbdX15%tgm1}kX^rUM8@hx7C8IPR}G!0>bG#R|tUI;a%kSEEsl1v`%W z>-!BljtwXfm&ll=bi#o!i78w>pi0`l;kLM4w`tR&W}t47n{L+ZIc~!fW7lyThRu=S z9zH1P%4^+=vo~dDo{e3{t@9qmzT*}V2q73$qR77E#@G?Mj-Q~yb1ce^Ce1>*n${p8n ze}xo6&v8#OTj)6MA(+B(j9h=haB!;v2_VgI9GlvX<4teJ@g9*K$8BC|Q{0h#Ux~Kq zLR0pRwrQa#$1(OcrM6_`FwBS@$88w0lTO(d^|*9Y47+nS4+!1Y-d>8I@EeQRZexND z9Ivs+a2j*UN4y4Gq0i$q2F=@G_5nhHa$Wsf9!ofl+lru64lca+I)Rq`%`q>_9Hd!O zm~yy{e@r-4I3!xvgDV?!;K+hbbzXEtVhL9kw4(~p0Fo#zz?B7|2nox{-h6c86z@^y zh5Xtp0mB1V7Br7e25t39)>c3!sCp`nf#m+-mG*~F3;}UvL8fwWWrN(X483q{^lg#~KKi*KSu%WAiGOA+-8CZ-YW#uNwH#e$XvJ44ETC(np za4sS#IU>j(Ju62MDoK}t<2909JipG}1GKD!g za#+spZ@7?W=HRm3s*L3u*%x*8Y>n(Fe;(u?D!&1|0!o#NyIj$xRdW5WeoF;{G0prA z)$epVRU!;@1eW_puX;S(FGn_bW=b3%qehANp$V7s5C$j{$Qg2>Om(g-FA~OPfTr39 zKiESIBMZ#>Bsk`cayZf+4{deQBmUh$yh`t*c;wYFGz4CiUY*k<8Gw>xv7d$)uoyuv z3e-dCeBNaDIt$y1x9*@6xg`hR$dMqOw2(ZW^ZBQ}$0N+c>;)HC2b5M&lNx{zvLR2i z9o(bX`OW<}ic9%fKfo@Tb^o;~e`R@Anomd{&Z9>~l|`Zv1Pl0TLB+C}ew-Z)QrbE( z97orUlf@EV%iLfJ^3ffoM`juf0B2Ns2^pZ&RyqMj3*h55Hk*~bYL%vAmMdmBk=y#> zD0XU`y;?T@AsK(}sC3Nm6_q~d#oJNo-kbsx;0mwEo591$iB4RMqUKQ zFm)#|bEqSL#5fWC67-lQ(!9d(1o{f&o?ay|^JO~;`=75v^JD65xoxq3gE%KK+B8Iu}HeqT{?)+smyh<{CH5~$aqyFx-+?Nd!V!m&o5itm`B$JsU%^Or#eyv5M+t#Zvpj?fNHRE|=L>83pE z(O_4+e`+_qU%b8eGj7P~<9DBwzZ^Y|y8#c!7Y81yZ!tU(+h5>$a{h8mqOK}D!*Pw_ z>G$87Q<8a&F+-R-e>v7QKB_g34v8anZ^bUU$uKL$C_AgVojK^v>DCN&7h%%u-TX_A zMk(|16@V}x6`8?}wjzd+_w}pzRzqD{0RTZjn1WjD@?${|uY7sAzDc(gB7Eh*z=wEW z`GUa5i_(RG59(kmfKnB3bLbM-M*Q`)OG3^Kq=3)MT@RQB#ou9V=Ze%4a_9;b%jPBQEzE&D=;F@xM&)HN`y%S&_HC@>YhrUf79#JA=#^aznl5r= zIr5u!pkwt%2}l_5hTI~Y;#C~9VCBVhK){fb*1Bja@&^)z+*G2@DS1f|5m}U!CWp3s z=$FaZxP@6sw?>wC7-20(8ZLm8??1i{HsF?Bk<)CGo;VmO5Mem40SFU}Huw1AzL)Gb z1EdZ~k)WXSJqCm!QwAOk2^W=}7bORlNo#zdSbL%BI9cph;K7hqj3s8_H5Lqe%8W#Z zT5%XvP%z#;ysb-O9sA{$=Su1l)6O`PJAij3YfpAEtgJdI@#k#8L1*lT(#8um%XVhc z8H=T!DhQv%35BTQ0)qjo=uI3~F*3|}MX3s#FFsa@>L1vN5NuiHp(NPGi9?4N6x4gC ztbiO`bh%94s(}Ni(^lJm&ZfTKYew|X9#q&h18KA(o< zL>%dxhqi)=6!x{8Bu6Q>5JBYpl{+(-IF8FsefXM~_ z4hpHbgntKtj|BWXMksT%O_hvHcgq~PC4t$=^$d)I+~ zkHSCVR?A#&rfkoqV757~Z0vUp8rUlWFW?S(5B59v*9h!)?!1Wh=e*AYd`A|W`+~1hW*zaUB zns`;6Ok0cL@U9xN9D6R$^=CmeW2HH5Wn;fn?kKJ|X@;Az-!JMF2zWFI`<=gh1N)uS z+Su=8*JbQ?v2rr>`{R{5*zc4EG7Y_0P&0-7&aq`aDA|df1rZ0BrZUR{@SSiqL!%Be~0_Ga}>AGO0s&d7RDh0|n zL|_o4oJXV(2vtMWu$M#Sk*dc$;RAmUdeLn8$Wju_m8C2&6_G+ghsIX(%jn6ifr>t% zL6v#@>p#%`0rI3TP^qAeSoB;Cltxb9*9B}$TwEV>VtFyd9n9=^UokyQy{Qq^qNCwVX@F_Rlm{J4Qe98_2mM?>2p3hnP;{V5 z9a>8ihm@A63is!%QMF~RHL5OtqD3g4%~+yxEg7ZIl*x|}_!Ky=^8Zq3`95w)p!MoY zSx~NKpc5oz<)P~?lEQJSPfdc8i>**m(C)FMs&2z6AhPdz+w|0D-yXzF74p%U$)IDZ zKNj8Ff7AEWCx?&53zP4fb#)yt2ov(qE>VCUZTxK+NJwU80tmS7b84XIZBM3a4%aZb zkU5!`^g)$gTC5D11gW1wa3I-}K6OCyL%*s+~^c#~}Frk`kWPGo)mTlFu*w#qT)w3{myW`a`%O582=+I830Aok+TQ@XV z6|#V}Hc;5soeomYVTFEYVVsLKJc=b$S8sUJ;J;5j1TPisEJ_w6|G(WzB=;84ynSwf zwQ$!Vyr;j>AS37|DLFy0EDbg@Ddoj^Dw{9_B}vJrZGfRjuo;Qx&S*3TuZzs zaaWZOZ*JzRzMg*dCh0gl|G~8z=~jbx)b>c`TGj{PFN@1~9G(`+l(xLgFZpL<`nT}L z;t0)S$v5_C$U8&t(951Eay_*=8VueMHnXyGNRQYmA>x`AR}dZ{@Qyg7R_#Rz%q~7L z<5KdkmRyO|UE_ka-x($diUG2SY1W5vCUu6#uwMi;p+-)>T1=I^Ir7_r!g16nYDgts z-n7`#;NvEtn+-0n{Vl3)Q5iIKKwxJy`dDzVvE%ZS>X^f@(*9$Oc-Jo3Rd>v)7)I#; zvZKIkEFHXn3+(Bu&T9BfXkn1IP1DbWmRHz9a^-_WSU3C*jTBs2A4!!GDMSdQeZm$M zvP%@{pm6!|5^xR_eCqFJDpj(>D@Z`XzB(pA!maRzO^LMp4rDhjjbK4vxqOf*KB}p2 z(uiYvbt4KA*MjF^u*Ll_Ci46hbHg%6BvKZd9Bj%glR+Vdpm0LGyek7W1Vrb3IJl!f z^weKr0<-F)Ueq`bwsB0S>%`;?2g&f&ua`ShG(wr4mv@dFE@uj7H7Hzcy`k`8syN5` z>xvbiG*sd0=iU6M@{zA40?d^p(VQo-au(Ue0X?yI+ed#y-Tt8U84%eMPEsV;o>;T9J zIP>?AecR6sz;hbn1J#jyziIv8v$<+^p=I699-7KQ&AwQoXAh+-&Id9wLK>-eT($->76__>(uNb@V5K1DQN^xx5Z9Iar^p#XShBAgGjV+w|*T(JSr(m*xh z?m6I}i%VV`n+X)M^OHp+k+q9=JYOxsW{-=Oiym&!kbgH^@qGIc#q*JzE#mpA(?xeY z-_^i)zMvJ)cPP0XH%YsilwGbQ`c6V4sqnd^byRwLzW%LvKCO7*vS1~$GR5G_tZ#st zchBw{UKxnv8nqDVu>pHu(M8-Tb^oy#HIC3=AnU2Y2T~#AP>Czu%;7IL6{{9Bb%aM` zP7deedx$pS%Ya&Zw+k5$3Rn8NdSVxt7ULR{XvnXD#w;=v^ENh{MLZw(eanvLBZIyr z5WDpFxrVCF!W2Ca;zpq23i3T{zlJdt887G*qv?%a>acmjpY z24y^fn(d&s)fy0475T3WU8GYV`L0Y-2z#mySDL0?hHTOn)mA{&$c_CbsW6@R<7m1i zX9uPiIaoG;20A;j%n(eJuFG*x0{Z~nl5XzViRG9iodh8oZHUw;+DNgAO2dN1g7(HL z#MSrh-$8#xx)YzK$xI;@o=2Tz%lDFbe@3P@Z!OWoFXcM1_YAeR?O2yF<6fQulW!GD z7AL97lzu#guEDl6+t6Nuo2NHI@cQ6#$6tpFHZI&DX^Fw!)~>S-&iFC6HItE7qn51Jp=&sxBq2 zd?!$fcXSwUb-ioF7SC!fdYt*}-_Z4~A?@8<7(le!D`!74%@zkc7MtehvIikR~hAko2Nf0@_NFCp+6IsJ?~7@qstW$)wz(~CN02Zy@^^N$my@kwZ@@dHr>i? z0DLs)I*v<(oV20*qR%#V`RA?V_NcT{NPYr+%qO+8aC1ro@OQf>~U7`e|v}XEUJqY+5k7DAJMyG=x2>76cE}ZtP3E!B) z9LcBQGzIZq@Wx!79Wn~)lJjl2T;hsH-@G#o$UHL{$v>-m+JwI+-#d1kg!sB_E|ITP zTr!RS%Peae9sVCt4(NOpRzbBt4vrOI%qzLQJ&@8|w zU7$i|>Wvf-WPsm`sp3w9FJh=9^-6!H{17@qxStX_)E8@cqWj^{Z-G-%wF8WXB8h@~ z97m3G>RJBJe{(SlxITU^A*FL~7BNai4LVX!LHGHC%qq=Nf@TE|HGov!A5u|k59n?y zvAy~R5RO|UQx0VpBvQJGlg9yBn7qT|6!z*XQihN9YTvWwr5D4CaDcr;5KD#Sfm-mq zi3-UkdS5s7T@F<@bes0=66?F)H{fcxevp5}PzJqyLVn(d-E%egbVK#}*?-VtaOIt9j`y-0x(()R~Mq2otMnG85^ct^YXp_e(>15+;&=+spYrIh{rteuw``GP) zLP62nm+ScQyhc&(D{l~MwTl>Q=^*!nGXYBTV%w_^qbAct>cbJ>REAN*Ue!RAs)hzb zWWqIqqUH3e(Dv%x86UPIx)SJYd-ZPcGy+Wo=|KG;ZF}`@fkfM@k3R=#Lfu_9y;#qD z$02qZ=38rIaq_*-#%o2E(sBf%pG~jv>cUMx6I!+urq@VLe3j)zPU>NKfj4L<(()RK zO79cZ3eW&6z?K&ZiW`G4Z)#g!o8Fe!9+FM3eplM$o*V(S3renFn;2O3w{Fv`PrKr2 zoOC1j`Vj3A8$_iUQesyNpakj77SUsolEPlXddv}~m#J-fjn~U;)5~<2ULaG6S7A3W z$Hk`CcpYfMZa^-y9qNSj3)}JW!&xB|-gevU)ZXdsnwe!D(!4EKA0yVp&nc%k9>dy! zL+Ce617s+~-&g-*I4DsH@QBz8h0qT}3h?+IyEKn_HM+ypxnG93z#;Ub8B;$(=tqkH zi9+H4YSy7Ft1S(XPrY+d>!^{p$~%rB-x@YGV_?8A$U)aPbUQb?{c@V%?(R~H-&FK~^rJX> zk#&dBkBD}SS&L{`oivSw-yBCjs8v2K%!ARKn!@;pp<-eRqaV^RcNjfDD(ViSAC8-D zn?DqvZ?nEy zJQSpR1*4HW9YjB}W9)e;uqmJ0A{|6Ol*{@|9orGOZ3o0CR*5B;3yoX{(vNbbF6r5i z?#I*NRSyN;M=uEGq+Wsa*kMW7BTdtLTo-@~QD}MJOMJNp#b{q^FXBp3j9$EBK;e`_ zTs#rvF}nRLN16-{$g%T;J4iq16jtEhU_IvQnZxPGqSsxlwj=3BQ@B4P>4$>Jd>{?Q zg9GUp2P1(ZkRB^XHz9Q$BD*9-(m$St)Er8$b!n z)>~>Sp=r88IJ^#hGmol9I*@*Jy@%n~SW)6x1XFhVoL;1B@~C0543vpDhjt*nPbmk| z`vh|!{e8aK0s(YFIZ$_pwgqC^7RV5b+5#D>*|05;A&c1-$XLdVm-4>|Jh)Ae`EvDa zg3Q-or!qn2%PPj(1etG?!ojr8v@4*HxT>Xr>_I;yb^X9Te5h3q(p{a|P-`?mX52E< z0GZjKY(~06gRno;hwLMr7Rby|Yg_C!jbthd1j+R8hPnfpX$EUMY|<9UEY7HdD4PM` z#B*V~Ou@E5*o%O=V-HI}-Ejc@K;40s`9c!}Q?WMG9p`Coj1f-i45&L$Wp1ToCKufLZG0`eUDAf?%@w z7MUOqSxv9SSf)^rY=X>yfcKd=v#uT}ZonMd0s-gDcIu^}K?oh(tDt6J-37HRkWFt3 zB*tR{WWK&Dpg^Cm`$*+rzMSo?X3sYQTWEkxhIxg8zKl3(17rlEx0HuPY}wHK7ejB4 z0b-n)FdLRZ0ce4k+7`&nUS(S#ro#f6O40YLK$U}b$KA04?T%Cqv^$E4$hCO1(yH&x z@y$r!qX9CLD=^2*Br}laEh#5R_QyTpl*I<1h^(gBZMib5Y4%-EWswrZdMtfsvPfh# z&2Hde-eAn(3hmBnnj?a_p!?4eB?+Kx%;8v($ZDE{+tQlK{Be6T=LPWiO}f=`{dIKN z;amX0Mr>EvT#i4bBW)@|&Ivs;E<{s2s>@W}1kXFC2g&^P_)X_>6jjknrA?59N$g7= zk|zVat~g`tt=zP|nRDDV<2UK20ZCD>w~;=HB0*9en$x8+B-EoEkM)AdB3@5KU`;vx z6*q&g_I03txpw3JtNr_AMO1)gk#iq3JCz6K>l|Wg+ETMe6q|QLzZ|JxH90!ep>8jT z&+*Rt=GY9~zG$7H-8T%u9;EMC8V_0SPvJ(8440aH0D{O0*AJm3jMc^p$=jt3TSO*`X+>zQqL6BP*#-yv=>tbhBW9k^Y z{xs--BmFXr22pmaItHA!`>KZdwmH5Gs4MJxkOJMT>YpO8UO(zw77na!V1lK{v(Tt8 z1t`d1l?v0dQN(_-98ZE(ueh&&zW(=rJyVsdn|u-fd=Zlg5!>E7&<&wX1U;1M*dj;~ zHpS=n&v~FT1m)1eO7I6hbfO2P(egi}a`^v#jCPp>yCLX!Ub%JWbzK#2n;(acQ296y z8a6<9sR1++3eMx5hsA!~tkGM3El75TZ<`$5?p@G+{=XmKx!`_M5fT4<9a#4onHxuc{8cv2RPabups=x!5OGL*V-e83y*&FD zG5;UH`@;*CIbEj6o`~0rzZR}2s4SktRpsk|0v$}aEAF)T+ zAs>?tM&P2|y;MoFt}uaDlU1l_gVn?tQ=8V*u-z4Ow=3);1U#abQsST3aHg>xffeTq zBoz}w_#IVl%*{xexXHbXbQgqYo=qRQRgef>Q;t7MvqXd$Qny}lmV!1OJ}l3MKKrWf z)kk-H$3@ASTB^@$`tL=5p62dl!CJqnie;wpqOdpS?naS+W`%g+k*5B0r%>W~bdoL_ zI(N;71<%Cj1|X(Qi65HM=j-Q;Xx9(aBI*WcU z$qSXfS&J9upfFWy?lDst4O&$u|LV7-an-dHj|2*mP@SsV3&kN!wj>tP)__Uw`Kbm* z#PprN<@h0S+CcL|)iL*6Yvz(r(r?CSUb!EP172FL%OQ>Rv!8WEfp{%y4M8g}_iv2* zH~qA1_h&qi#p$LJ^ZgE`gsej&GIFw*7fYyQQj(OGaGM4ftjVp%Vn2K>7_mj}m}pAQ z&MsJ7BV}RfS{S=YQg-n&6ptboUh4*tJIEiz*4rYPtoV+Q*jy?6SmK;~zK*cRY(sP2 ze=bL$1DOn9G<^nZ;(02~kSE-fieRb&zTadlof~*$VTC|fEj7;ZBut+gFrJ`!%vavi z;p3}Gsp8v<_i#k+qXm~QRbZXuoGb-H5~WHLmibGOz_iuRBx}bPdhmJLW1e)J`(Xu9 zpFc`hp}M5XDmBLew3L5b1yij^CkG<X%cjpNRVWqO1CjcipWSjLIcB_35t^dZ^ST(KM0At z$RU0-&C4tP6mDxRD@cxO+Es-HI=h!(6+lysjT1~>lWXe@Ygg3+wIv7*3iHB5i8n5R z&_c^C(b0%$r7aa3ecf7~)(ARS{2l%V>xej>vEDlGeS9W?SEJ#>2jnM-C?3{HwZ=f2 zy|U_J)oGs&TDUPzLy~)GIoFgtr&CisQt_ZjvT+ZQDM2|6npavxDHV^c&`2;`i(e@y zXlPq~0hM~_Hkdif-#GjkuW7}IQ;mDeMdv*^QvGg1jly)CC zVp$nJt|%RnAO3it{N=pq!(*GyU9Y3+2s6Fv?TiApKZ+kGw346#**6)kxZU2{soL44 z!O2#cN!yRfk5t4lPmCR}#VRmb817zpm(F<}VX%7Rw`0$u!A7h9JW*;_1}#>Yj;Jtc z$#pY@O)DW(!>A?0i1bV*z-p`~%v!RTwmRex$V}r|o@(;sD_gee&lU_Q{2+O%!=_lJ z1&R`aGPEZkW0gp=H_4Q9B+=XjiQ95)5y_GSe3rI?W01YM2eU^jTSm_7@- z_T#DG;KfJW18H(>HGFZLE4eEuodBaXnyhJ&$id@D$SnmpD_QLXQ%G`~xjQNKI4Nmx zgYG)6&?k_r%i|*@9fLomW|SQLrBS(oGZ;T>_kmZ9ULja2(6s4g{)41UIO7xG1Ub8s z^l&?dR}|Arhk(YXnu*wlNK-Zl9d>EGsaR+?=w6gRMnt?y-|}0DB0*kTHh?b(&JPNb zu?l5|J;%&P1OrD_)@Qa5{&@!8SpWzmWn14&tuTtJ(+Z?+a;XDzeyLVOj0Re!9zf1Z zN)DhJMA1oxv#Vo^0693TAj2OnHKtBL24n(AF-eg+d$%gsH4~k(k2|06?!^Wjd#z6r@=DM)9{=Y8wP*1 zS(1D~xp^n8a1F5sI#S~kT-j&aB|w_%<;cz-vQ^@itEG!y30rEgfjxu<#edRrC8s30 zegO`G?=||)diMf#35~8j*cd9|oM+BZCSS*dJ55zr=^&xbKlH_ExRiIz_8g~>xmPsO zNHV=mDn*d>+BVA1kW&ye>`k6+nm%64md)4W{B4A+sZ_m&P`>S;6>A~xtSTZ#vX?(c z+N`Iw>|2SHB_6;lyn{&Dh2fFHPHOvh21)a+vjkXE*+p8z;5mFLnlKP}~Al*~lZP*ZcKtM#a{d2H*Ke;>lwqZT|# zLRa~0{vx=rqpq9=YbYg!+y7q;YwTpq=Ga?A|m{F==x(mlQ zraalSgGvg1BKMso)HNfPINbD~h6i-lJYZC0h&eAg4LG1FZ(tFJ&=D+*5wKT$TxD{| ze|89x@Y{HjgIQmipE4}6ik*UnQjvYTuvBR|85jveWz;kus4LD({QTujD*gML+)Jp2 zA4~X#4ZK7w+Mm*dE!7%$#(4@sElT;CAfY&cWbD84QeU^m44^S0#qSIhmIYzr@5N}7NM z<@$kS;3va|KAs(ZlFKIW7-kR4-wn*N9O*& z|MTnr|N1=o`QQJ8|7$O^oS;j6|MRHcXJsJ<%*8)nc{(NAEq_l-tG?AFehcD7qUAYF z`)B|CA71`H{_E?1Juf@+>2-Of^g(nfGv%}>|By6}@DI&;AMYUlr_$y4Lqn!3sz`A` z1MV?EvuFt%VE%>c2ffO#{+!V&MFqbUJcMNkKfl0>l}NjO^(!t$3u|E$5}qVR2On<^ z3QzN1S~P23L_>>CzzTT_u~NPzB1#~QO*Fz`A_ zyHYi##xGT|BupN~sPIEMyG5sw>$G70vrfOok)IV~-B;1iUP9JYIpc-<=$}0SP)$_k z1H;Q~P%!^)=$J#$ybyf;)$-#vi3i^OTDN?r-c@qx#ZEX_hWAo5r80dhgyq0#d$%;9 zWw`}&2`3Ne48UkK=t~jOkC|vZ;)W`szp9HIeJStUT;@7F;n_tKtGK;Nb0_O!zr8v_ zKxeO@D%5a0pdu4o#o5~hVS1b1b*iowmYmveD0CN}Z$vt}d-1SIyr-}?YDgZ*X1wL0 z!;&ELRt=puoCTP1OMIq}r2P>kb5JEQzY|-`JcA`!|&bnh*{TW0dis~iyqnKYBr(*zA2KZ0+( zxNZTzEU5>~a0(YhJXXy;+$cp=@{-_fLApqp-8*Q};tAveG|LnwR&2He(*XgG4wy;F=~iiT8~TpXk7iwb<;Z4zBC_Xshqt(Tn7;-)?G5z>ja$c zIW0jn)>dP}9yZY42H&enT~3xcm4-GZ3?T#DayXHK7s@W{mRJMuIgcdy?cxndffUy_ zlE7VK-LPu#C8(DV>26y#_>G8kd!TR$_Hrg7O|Q|OD|!i^Gn+}^EPJ*$eYowka25Fm z8FJXB`x`lO1a>d7N;pI(v&xk2QREq{rg1*p6)Zm*6OmOjVoy~bQNZ4F38Bb$s@@`% zk=CATYmU$dV!_<97c^cGOMbo~u6Ry2f@`9i!B=M_!Fe&(Y=^(5;yK)VW-Itx6Z&=U zh~!t?JA}IiR{xOc`10T_3Yy@lftNr{Es{GdIa-7R5R&YhEi|0a#QhBCjYSoLsEaN) zeK6q%?;rn}rO(SN6|(DeECiX->s){l1E~51Pt5Gdr!74VNqnSdR%DA?9yY)uz?VWR z$-@|_-9|iGvRjC>p9LVHRV}1-2a$(w+0c}W4pgSjqi_OCuQRI`V-;sYX5I)-RTWvzx)0+aS~&feY+tr+S`-??>cO$FA1Oi;<Hzia;;Nr)z=2yr3fIkp(UPNLebEi-&z54vjram;3c2Z?k+-3fkoQkd1$K>={7N>n zI;`-nFUg#j56msR^V;HGPfW&I^A%k4=~IXX_u~o9b{(9vU~GCdM2-Fa-K zl(o4bXWDqIE)O;oD(>00PvmzUh6oJ<8REP2i+rP2&D|uvvWW=*@S#=70N=8lt|M9EUa71kOj=ezs+FSJ zjigmY8wsltV0^U8&{O4J^lI7?c=dyK z`1r*^g>hBAKx~2*cp=&Hdan97hau+jT|R;z&$d=nb+AAqZ+@S+bafnBD@x;QKhbxu z^o`~#w0+=~<`wMpFO?#sP#(C6Wbh233cuNuv^>N(DFRpEam!s>D-Q2kvgkvVe*zi10LR>K1^1B%8g}8#M$Tm|Yu2PLnwBRK)ADh)TFo&J(L! z!CzjHu*+Q)yy&K%XC8OuVn7bf;VdqQU*uRs-O#D4`pN8~d9VYx+e5JlUX=>JwSFLd z&#(_u(9%Yvn(da?0n3m{F}Mn#(}Rbf^I(2eX{3--d_L&73g{n*JEw*dl$D*yN+HH|p3{>x)?C1tG zgzS+FtkvapTVTRuguRJY}o2o5K zVN9~8qkn}v3iNgCaipeI4X&{6!LtQ%l^ZUsUBq#{KkQ-7f4`n+1P12sS-qMmUt{Y& zT0(ee*-Lnls_tcM{$6CvZSw*ORRT0`K=Rt39QGyHJ+Zll#U|JVYdyraArpo6D%G zmwl1V-bl+Nd0DQ7OqV2l-pz(A6i-JCc}CY6iBYWNxgw9g_eOZ<@Su3C>Ik44M|8Nv zf(xrekLF&Or}Afujc45+G5ui8IEFOJFyFGrROL|&?#O?98uX+|v3-bOD9+ksP)Kz$ z5chMo35k==B{uf?ij`XDy#4m#ZlhHEusy>|3=`hy6$};KpfOY9lFmjcqp_abC}oSJ zyev=#T-6^fO-_aqka6T>NogWSuphqVNfwWKM-7t+fmh20&@Hl13t`4R0zGrpjc+D=I;nGGIDERaU;4x+P8H z*4eRd)+b3DT*40xuGB>Mi$vAM3T^ju%Y887D0RCg3iSk%fN!p}-we*8V7Dw&*c%U$ zeEHkzy{ORh12 z4y+0%DWp|a{+AG^Tp!(rObYe`L!mGnog0$f*Z+rPAG{hnMEhut#jt319{eE~Mzc+3 z(LSpEVekL`V=Xh*7ApIdMv|Lhs3Xh&36>4$6|*LDVi$s%kkj2)2<^CHI~ z+n+Rc%!Z#-4?_MZ6=2JD#j|hO{#bTw+0I0ZE!*#$hzQ|MD=&n5V77E;FM$u?jv_Pl zL%1^vYRmRVw{9WahZXuQ+!34-+X(4C?DGoYJ&Kj9y^C;OA3q3Jbx8M7b>X|E`=|^`|%L)qc{S^0-o`W?U3-}O7R@TXY(>COT2mu_(w`#3i!uXObB@7HhswV zM+IO)zTYetu;u%me9_$Ewm7hSzkNv>^8Ho``9r?PFG9ZGj+hAfF7x`3?{{9BTflFZ zXZ4(V=^ql_PL2@qY8aFvelQl$9^X9Y(?&K${OM7~K0Ws--m$e;3VcyRu`xvPK3JM! zOZQQ81eESzU3Clhp~~{FL%JJv2=k%JEhk0=QV#JBI&OZ^MJ}qQT`Av3^-EH|k78xU z@*U@~q%r*>B9_+zo}sRXz0I-(GXy*XS?4L>8OrJl0Hr`$zgPNl8J1ZN0l(o*hQe6D zGlQ&!gnxZT;?hXk*nqOfFKbn_1CH!b|a)*Q;%`0aKKe`ux zOL$7-vL$>p_S zwy4Pmj0l`j34|54GaVl^mhbwbdowVj=_Pb04<`dQw`V~Qjb|mSCn#yopXf#@UNIdr zygxD(I-;_s0Cj5?!4qie!Nu7#nK>-Ybvhg_)?#{?d%2)+tk=A6T=MZ+A|6Ii@B0OV=Z1EG#tydsa$L+4}li^@Zdb+BN;e#AatcN#;;hbk=H2s%*@*c$8ZHEW39%pD>-AW4os+gImHOJLhx<1 z$5CY`-b0=aDO1JtHk-YJ;QxbgIEN*?(3fOMzEYQ;En`r)PP321$BDgwtI5B(s(E?%2uOo!- zz=(?6sO66cQPrHPSaO8$1**9p?1|w09TsugFU}>}o^;<2P5R0-Ki;fN-w`@SfO~tu zB8TCZ#xI(qF?BT2uI7r%hoB&72#ty;NG`%v8^Q4BtJnuHZ)3-!f=)IgWH3hAGI-NW ze75`q_{FR?&{=^0MTEptbZkt_u}_U{n2$Bz2=5A;p}hWqIiD#;?AMkZ?|7fj==8sS zp=<)q>bryE^eWj5BT##Y0d&-8YRYBiY=}U_UcWid7X3 zfY8w6ws|dInoosOtd$}I)nqn|5FjR@ohXKpE=Ju{2i2_Q_^%$P6lKzH<;GOp;w~|g zQdhXgT zZlbE|Y3vx2uA&|bFuHEWXECfx4hGws>+*$n%bUyAsGTA?N|q z^^Ti|;mX@0S*YtuijfYBW%2zF^`&*mZiu+K6=8?dWgLLHBDI1UGV5~Cgvzh*mDXDn zORzHbj8lCf5xy!u z@D(|xKN?84Z)TO(eh8sC^>~T7;`axJUZ|yNGxBR_J>L?_arrVh*}2CF0_c4ldji#9 z>J@iHcWqjB%=uvK92r#q%6s}?a{DG9WlNiH7N9z>dipAO#3Wv}Vziq4e#cLyuQw1z z#a=jfYFawRmq#I&40=u2;R4~iwl z_)h`)ZJ{cME)xPIQv)GVn7-;p6AGUrmdy@Vl~;W=+Jhot)kD2bW`r)|}5MM!aT={hdV z7#0IfD;2^GHPEPS&Uk zlcxaVDr5*DWSx|>MvAw`T90FTt6GbQw6uJ!i+ry#wOm`WD5Zr#|k}%HrrxBdxpBiS#ADEPkmPzmR$jyT&^b(rk*GABZt^_ zgx7>Z98uBn5x8<+$1rLdVj5 zjMlibjtk%`v=^qb+#_`nD;D>#C&^~~8=hrb?SMtpIT6Irz0ynvTzp!2U4?cAu@n;e zfnmHkE#G^jaa@bXHLWwEF<%VR#niat*9nv?b2L=>G*c1lClCT|k7VHORdZ!fd)Ropm*lbnG?i-Ug zc}$Ouy|!nOn|*&oy58Xww|;y_ghbrs-OgM{_4vM>2x|2h^}>A+V3OQVI=rkNqhz=> zf12K?Z|$2XUa=({TYX~m_i54?v_??n`b%{{ZvR}W#?4~qfFmHDUVQX}d7_4oX8j!Z z^0!7!-)B{sPqLv1puRop;;3%6m;jIInFaOIsrZb8L}L`kTGCj-1~H8Iw_} zbNBQQ_v-uLJ=5x5xZnjv-U7x;Xe)(4$oh}JF!!kBaJv-5oyHnk)1~DVKiqEW0d{4ug64mNfn1Yr)mt> z!gt(ke6@_phWb2 zE*3Gmt#lso6XEjCBTjge+s5z$U9b4siNx`hof;eCh(zKTXJpsLOm_aQ=6Ylj$6{2c z@IIS`%NLXjT9@hTa!8U>iTCM@*s9z%V`5kH4duu?8zz)DW$aAiq#O@3X)9-v)aSXH zJYy|hn}Tz>lE$4$e4Yx8>+_WG zNUP{=$P$3z8&Lz*QqqUYYL~^%IOZ{-b{RWModOM*2-{~#Lzad<7-+dNDJhO7ZY$;v zFzhHkecO$LGO;ZGqL0X*+^?0AhFxG$d}q3z2YeO%TFG?XS`MX~>b`>j97%U5#d+E1 zmAS;gFz;8n#DdM0S(*EQ-99ccN+kxYTvnzMzx2&Zrs6amsJBq05(5@jk>S%>qUkv_ ztImqgW-^}o;|nY{G`)82uyjgbo(#phwcdAfer;l^siJ6>!`=y1z3jMc&;Sozcs5By z?^!1nB}Ql9*|T&Zja3x9&=i-AA?+KI$3!l8Y;c_~PBCkX)@t_XzS2vV-6;8vH{ zt*U>KNX-3nIsjXAUd#9E5!FRvcMV6}eD!N3|8Dbjz?%>^MpU&jwv+Aq@D0ah2G@)1 zCT9|JoKrlFJs|T8Mk2B1D&`A^HsHw2e1BZ46}sLqqkQBSb|x`5p!uo;wY$kXcEGdt z@UE}p7sZ#P%UfEqK!6&#f;z3Yvh_)EE`@SZU!vB&19(M@F$!_4nz^#zY2>56fYB`~ z8Es_GvJ*Ktu^(X@)`L|?B5^O%wX@{H0snr|zYnnh0^diqndCQy_tPk!XQrK3)+fe~ zp@K%=L5_M+H`TDb(+f|HD5}9;epP8Ap{yS;)%ng+AOC<~`vFuHcha$&E26wj#NKKc zUWLkv_a7K{Wz|!3|LhlUgg@=1(LW*lNLRzFb1+dD%cce%QZ1PH-WQO|p8V>yk_3yRW`>s%b z!1GAs>%3n$)A)dCJB_dN-g+xGfXkW2mxwzLh$~<1NPnQ7k2F4x^ho0a9GryRPP$hs zBK?7Rb{ZcRtL-#Cfa@cTPwPLAUrZ+?IQ$Zb=Oc};+ou|Rw#ysn=Fk}Y zk;cdOeWdYis$rBrhj6Cxk%&Ih_<$Kl8Xw?xr11g1&NM!(#C@jmbyharX?%d|k;d0q z%XFvlVWHQV#>cJsNaO3ZyBy=?c7CdY7E%5rx{owIlHE?@1K5u=KGNKo#z(5#X?&!y zBaP4S5$3;t(Y*FeF~<(`=NHa2J`UkXGmUyuk#Lgr}6PP9%+2NIt6yCgIJ#a`HL&l_{a=D()fTGXBuCx zap~VoR2z=<4UD4v`HG#!N2c?c#>Z{lX?$ctnZ~y_I70l%m5ww%p1mWDk6Zqc#>ew} zr16miGRU9%|Cz?u?MI9t|4xa!)A+b~A8CBOs?$sc`S%*3%9mOC?Ujxoe_-m7#zz5q zr14S2ex~tJ3Lj~FDWnzS|4WEdN2|`GkqBj_V1&gigtI_5eQyE&ahJEC82?uB;M%ye zymiBk-wK0C`uRo0Xvv%`%3e`c@i+kV$9q2O30#3sG5W`D{s!$SP z5HW=6c;GjH7d%xgmxo3H>`trthKuKHz`4%CbVyHXgxgR>L^efa7j9R_oUHZ)6hrjt z#oh)eKYi(m@>IfL#Dp7vubQAh;7$}U6Ag(#xpTDfT{GctVkXOa?q48hkMDddfa6i( zH-}K0Mm6&*kePr{evT6>7}g@+wLu{Mxmb=-ig2$hw48lJFvvyK#YUlK*oJXT*FP{2P zg-+Pa0L!BvprP3#_T55IXn8x!&_Ph#gfEr!gh=3qaX&`xM<;7-EGXYe0?fRk=n&Nm z*3lfik}_SfF5sYA3d*}(j}MJy9Nl1Z zgxIUTidMAGt+T^QYO@gGk6cqv2m!WLI{Axa?ujvVYjIvi4X;-<{npFtg@&b|-{#7G z)l=zSFZKw*ts(Elnz+=S{^nXzV)idw3ZHc>3t^~b{Ki}_FL6A=E-2gt4@(s7Pk(ygH4!@u<)`d0^8w9tN_2YmS>BYABM=-j88&<;R>M5#l~-+XYU4>v67=PTTiO zBN#$mp2NH(qNY!m#OgkN4=a*h{yoBxSaSDCS;8rlO;9pNfa#=B*xtt7$+B_2Ugrx+Yhut!Q}-c^TslBg=H!*FKp z`Cy`OXrhf5F6E;%n&aVO~(sMd zh#7>Ttp+Qr2=||r6>+?+^Yo_{x}v3mpo>3INQ_LK>X1$&hLukrf4*`cAAII za+%`%i_2YW0AqS2m#!b&x9O(`V(5w5?hr_#K)><6f~xQ4Rp;KqUh^x^SqiYWc3N8? z;ah}(Kg~;p`v^Cl9eoixjecG%6d{EO4@s+Me1P6oV_th-FBiMqTXbNwi`U3%=>I?j zE#U6=z7KjyL~iSW;kLT}bZ#sA*m$|Tv1lB<_O@QiOx&BMTD8Zvf(5n_m=}2@71*jo zeZbR{a6iLbba+*fUj$gn%%pq*%sBtp=x=iG#{>xxL2h33h*(SGjWFRc{6u_&O-F!G zadMqeN|4)Ub{0P(Os=T12hN@9ip@TDMp%?ldPM$W^6G{!y%ynPb@0HDO;Z%gH`z-? zTGd?^VUZGN{_-Q~Nr6(p?kw`=z`abkx5?k$3RtWc!6g23DkJ2VUOTLr46f#rvLCJ$o`^L*xN&)sb!u_c*~$z6Lx0Sa zWG|B`ndwweJP^}7hGNwH%C~XKL-O?F7fW?5e5J_+E#_MB6*VpVIBJ-&Qk;6zd8d-j(XWyxKIU*GJ%l^n%+Tektl^R+Xy>>*Bo&iGk~bVra?WJrSYK zz(*@gnf7`BHF0q6R89!XZJYLk?#Zm3=m{2Fq*{szLx;06ERVqS#W^uxQPm9Jp%c^b z8uZRANmR8aD2oBk(iXrETVcUrW+$ETva0XkBAWE&GuBjwQXy& z%yK@J8q$HVh6E3EAHOiztyd_9LN&XjaB(*sO+aP_iq<~z!!4H8jkrF%3@4V7Aw(gH^XG467A?StaRi*6m!C-TS7^rtrnk0N%9OSg0XY zf~ImM%_`rFE;dD$7e4!_S~?g0COj?B5!JHcLT%~$z{r#E!=Xujtnl)lC>*{YJvKhH z*>+i=KEYPm?4<|h^?}-t)#T~_#CSx=%}2y=l7Kzk7H~0E?sue8DnLX zF=#*)Z8}7AvlrRQDOao3)B^QU`f%y6dl4q*p^Qzx&TCnH)ekOfyJR9rTYapG z#xRQ%aeErMl-GSw>L)3ay!(|_6Wi_rK^g+vc)tvAU*R?!glkMyRz$z-;VWuDHQmdD zb6JHj{T`_#qf5g`)toTRea#K4qvjpw+-?~|Ik!7co#v+G(?fM{%MQN$$=2m@UI0^( z;jsC{kN_;YUzqHapi_$rvgtN;HqTmI(OqOOlU2pk`;O)sBUs8QfK|&uP0J7*G+VbG zk4TgI1GbHmnC_M8a{UkG2+Y>4l#e8|o_7K8o&%Og79x#vVlEPu%9ypq(_)!4ARfEn za20@c3csh74^{^h8zm_&dyvRBwS7!p-u^>Gb3TVZw%zu}S~qL<&1@fKJM3lprMgPT z$bRl3)Zq6?h|>lxr1%dpGM$DlgMawmH9|WT9PVe0>`C7;)!SpFR)Cvp#io)BTJ$v$ zmFSS4W;g3o2}hkoJ3^_cwW(4;YCzV!zUdF@Q#&y1FCy2R;V87$)wWW?@LcSnbh{y8 z$bPzVgz9o;w$M{lM2>LUJpsNxXmO;jEXuOEr}oSI#FPnH@978RBq{bpw`saiT6&&9 z-}Y-F!M*8AYcmy0%J{ZavWo)4q_u2^D#sph1S&`%+_uHG#JGK*MvUlHey__L`q&3_ z*^F$DZ{!&KD28Uu`4Y^EeIZixM2v#`s$VJi@Fu_^_;fE0%+LcJk;0^AKS7J};M8MS zadu0I!!d~Up@gN0h`zNDaIs!w}jQYm6@l4m=nSZY1gszJC}%`)ff%Phu@sqSm- zsxS$__mZw>??b;;qQ{=89(tBNQwgVMN|@6#g=)$cm{w;Gj5OXpx7-OtEMa)2TzWpK zqi=$vXR7b87JH_!f;05!hb#Qt_u-l9Qf0SeDk8GNG1cwhv16*+mwPy-x+^}1W2!6Q zFhv)7xp=CUZfL4e4lT4dT|%X2s<(4>@PxuY!ZF3pEoD2V(0*d9nE1<2$h%_4lsi_W zV+ws&d<^WeaC4V*OaZ?7;g}NQ>u^jZ#*V43^5p56!bhu3Uwfu7t|CT6&lI|UG>J`m zrriAH@JwN{w%X~M;#wS@DfDF+dSjf5rpseHrr5JYek3}kx>67h$5iim{ap#wa71-& zsH~T8O!b~2K~*%wjH7f+fo7IGTQyT(VmV z$HCn(>6XHAkgQ9$l-qZtTMFl+T7dd^m?c?W;(YkRS8ges4|5nwM9j5+$V@E9Jb!^G zskJ3;XK49{TgnZ2Qf{NWhsQy=jvb3@tvEqFoOpIi^@z<&w^U-%Ero;Ta1Oeqx;#he zm+D>Rqqkow_uhV~?lP{)qCc6q7<+7F`laxzC5$~&-4QtUOo5^tw59{zmH%{jrrZrA zJySj62JM-0N0h@e)x%{Fo~f>S@9CLx)0D$Ag>`+T2hbtXo2O^bRFCL}tr+J|?3qGW zla+oaZU1$Ka!mCp3C!zQM0=*#Kt{aDI#QqPft;SHK0~{wW2!r3`ol3b!WEy6sl@4snIgP$Brr2Pfy1b>Z?DY#bdssnFpq0YP1a2qho3~ z+|Pa~6m_41?UzEYh-V&tsZp(y*e^9|e#7LDn2^fD)#nb!)Pb@Tewg9(M}$Q=I!KJe z-}Ty<^i0K5>6tnZc2cOe{cp@;x4J!3n57LOdZtEo7gl?wMon#|#5z5vX9`Pi2RJ=b zW5}-7%ROuu^wvbQxSUT+m(Dem zyFk-p>J{PawY-j^^1See>M^D@ZsfERw2$=`KNya+#3m66lZ$r7NNqBsX5Ogb3tSo+ z<1sUh^?uCw(uAFtM;%t~R7-Sj+1t?P@_G!47Q_ZzN1PI1nGxD{Z=mTwC+v-yzkV{~ z(gJh=c-ge}9u^<$8zEUQBM7&CLe}0l0>_k~BOZ~MN4RU^Jkj3=O1}LQMt1ZG+rkP= zOGn^@zTFk-s=!sF)bW=o0drbs{U;_F&QuKP>tG&6ZT>Q)TqXjHd|6D1DF6Q2n97in z5w77X0$UazHMW27;zweOZjliYlPWh2xcW3cTIq4KU6SJ6^$V>NdJ?|~Kh?JsLLI~(3-J4EP*(NC{Co}4Hq=X_1`D71g*`xj z5w9@9WBN%1E0Dd%SYGB_{vz@1zhtYLR}cJn!FMLpcG4e*$*> zocA(zN5uX@y!Io1{o|#d`8`Wj$~sjVZ2WM#Ot zd=opt_eoo-#Q>1S`PSl<3gNfS^;(NT1cVFz3XKnt>JTknZ@v+Qdi48i2nYWI%qk=x zwtKQ_g)t{09zo@^x61N?fb|q#eItAIW^{o$77}?A^%I7<*4-M6 z2&D7?fecurWi0Q^{pDzPfT|Pt=tG?*Oaq9^W`Y+%?MYQ@Fs>@@V)^~XRUeuF?n1B! ze!Ca7Q1k!+XAic_gNHBcQI3p2?Qn~~k{qfAjy$8A*ModBkH?d%fJPj*GM+fjw+?#C zpSfpw-?@tGJswnKT_%l25Sk!2w=qNG)*TrzxK{>3y!)9gqrc<#G9tkn6tr!LE!{M*FM@04XSBSu)*$l z;<>ccEdNggkI|iv1YDWQxG`~9%cTM<`>-1GI*un6q?bP<;-N})?0j)xZe31(qK4Lt zr6Pvw&S8=Q5|lBf>g_#txw)+L zRMjc}(LI%}vU$hGe-?E?(Y3*2>_1Y;>)M6lYM5IQ}qsk||+DR-#=6q#hz zu%x>j3{2HqC|o@C>y&14=AF{)NeRhcfUsGkXS&;Hxl)?(4wHo2CC*q^4I6GLTpkg? zl#F-JB+^h9n`C{;!ks5?M>#+gXyY_)m-z>VRqNgu)II@7^MEZ9Yaj@#wEM=0^@tmJ zvQ#e`*-;#HVX!>bPjG(=a2Qr4Dz0C*j6u(A@D?-5PQkoVA{4LZvO;=WbT1V&f*gh} zMt;_XsQ$>JbvBkqv8;T#B>n-*+~W?2A1$+IqxM69$Jj3gY;o(a;uLaIVqiu7pd5LT zPxzP{NTIYn`(%1vo#KKI#{ze!} zQxvUjz*niSz!b!0x0$jP@bt;C0)>Q+X_aactV>g6-9aF(TW?^ItKt}GB2eP1OmFm~ z4((-Hh(ys?U|4E^s6rU#Ds{G@C-jNiYq2q@02CEOwJd-ALRrX`mgej~G1ePOmw~QV zzdlf*1>|F?2Amj4{Zdr@YXO`*as1P@=Xh zTtol;zg|nJZynJ_3#HZ*QQ2_l=WD5?e|M3n4+KhCy%8vd0DAp}IiFFfZfHgLeLmbMkRW51mP*A4aRY>uA@~+6?(1U^(#6eyhHDN>j8*4Kea(u!wDS|=QY1fLwd z8ym5FfDu+|?-A98`~~XVl>1Kzf8?=Et5LiTOwK2P`}6TAB?ARG6oo7^oyo$1C^z#Ar0o`be@loWyi><3K&E zOPPO(qNz?lhB16`^*NK5A&=cC_DaCFNldW`UbNiM%dg671A@KS0!Pp$dBd}8`r}X< z^ZG!=t`=7%{}U!(q;&R=7ZtT)jPDCG%?fZ~QHmU>!H59UN!*pEYr_FCAmT>1wcQcS zNS2-_3Gbiu;TG&@5WHd)mu$%u%XrsN5!bWVS)CjN%0A5po-k-DEWkkh1nOhUAMv?^ zEH*}j{3a({U+p9Hrlvsn1Qmzx?1N0z$xH?Tx5CsuUmvI@CUQLHmJs>oMC@IiJe;q8 zqK>DAu8=;)BbL_bCC8X+@){re!i47YJ&A}w2e1_Bc;u@Bs&<1IZpyIslZY38vsk~F(ARf-SKto^ zH3IZ_{hH6&yx2JA*93VphQ(X4itGR1RfJTAz3Np&yfyE3^r)d&HN!Do=eTMm&Qz||jPcBVuQoDv|21Q?|{Mo$M`U!YkbS9vd zYoSd2jd&f8Jj(C$JNGklQowSF@0&@BxibI(b=L6!n`*vopuIbl3nRJs-YX4 zH)cILGjuJXYKxzM1P9C>_Zur<{M z7#l;sV3-N}n&@<}9TF?|EHCbDjNWO- zte2ZtVJeT83)ETFTTMd)i#n$tEK3!^_b=`&VvP$$tf#t+EjBOJ3hN1VHK{JS%wb)6 zLbF|JNPro?xcd>u#m_1dzN)yHR!_N{5!Ai6Y4w)KTW2<9G&n4_i(n%xz)>uSm>06pG%q$L*>htY*CU{yxvr84RB z7DJj+A>pGD17frFOE<3MX$Z|n>$_WBm)rx_p(#a)=m1e!h)fp74`K1-$3F)Qt_=h8 zQlbc8T;&2*(=1K-#Q`)4Qufls_}CIse1J0;?r-G@qh_f3zv&=AzkLBAIdW+R*Cr^{ zAZ0(eXAy3E=cIV6?tN(Z<&&XN#ZMN`s#?m4?ip(cn4vKwAphVId9hpGHGNQKKA`Tm zG8lTW-e5@?esx-^ZM`Kv!e}z;kuJi6Jw`IN<`hMyi2a33QOL zt{GGBsXI=dy`D?Kq9~X0kV0$L6AV-18X;MQ)fsjE?^+Hx`-~o#Q8f-KSu94XZ_qhk zvhDpPQ(WEuDq-t|tQ>-gJklfGgBvpy;+bA5i8aLj5gcxo8AoC$dJoESYoTPk_}5v&{BdiK1`dC_8OEd zjDndHBY{$>GCN$%-dn;xXw$3juyY(t6Eh=*q)dw1@3AGHsC)VFb8&9#SY3U)X=UjF zwYOHwM9E&n(D8UYJ%uml>QBU|a3}Wp3q~dB4KJOKXPzJNU3=-C>C90`j;K=?V0Y1F zD9!UqRr`l1`kDWL8PSRUQq2T1OR9({OCj*qz<9Y-vSoa3{;=(|EP{hUe{yhf^}X3( zh=1!>qF5QVB$y@wL4|cvR1*d2bb}kY7pNlC8o7-Ps7FkO!5h9;;hJ@wtJnvWT+}bf z*Ac^HlMIQoJQ#XF!O$&2nl1(Ea*?O>1-MNGs*~hCYSCyD^o2L@@U#b5~z zcj8ni9Wd4Wbg({AQ@q0E`W6Q~wR(ZE=DIN$B2x&loj}iVb&whv0J5fg0~$b(v}*|*VSL!C&7ZEeamSV z5Di$5tY5!izKXmpFOI#~S7LHzxQ&0pD*H-;aWmDXqLBp0?cXo&V4?r9m1%v~Wg5%0 zu#)WOdR;SRtlq(}P;e~iMpHZ)2zCP)vcj(Eu2r1bu)0w6i(yi{wKPq`nmN!xYb*3u zEHEQ*l2$*dSro257h)hJ@IYLlJ{=gccEHQ7HCNoK&5dEz*pZpOm!x-%g1S{(k7zGe z6e;b4=pTjef>t7@o_IKHxJh*U#JMt;>hrVU z!073#`&M$N8#YTsqmxq**wQ1E1g56%FO}vx2#WmygQ8q2A>4UZO{z*F1iNAl2an@c zUi4Ewrk)5^aQV>_VI{acu9PxyP8Bvuiq$J>SR!2yC^GJvt~H@j`h@8~VtIyP^JZx3 z3?c=5xu4Pq-IETXDB41ltGqDyEl3iXuqQ<-gY@|OwMWHol*ep*+Jgj4>>(L|EgcA0 zQtQ3xMwvZ8G1@bPO|g~*YJ}xemRCOl9D$*B69zBq#!iXVHUrivlJcLJ>PqE{H9u+V zJQ@}qw1uS~UNMnngUdDdp0MGj=$XrFSgYG@#l$}sgmhRjt^;!^5pz#g zy5HaXxQ8~#G94bPD-K=yv(o6eepEBK#^O55=BNuXO7UsQav!CbK`|~-(m;-w%Vhzp z+$v9g0;N5;%ld%bx~v5jU~xlC9;wT&>BWFlqxLhEsig5jK-8-9i#UVp98;~kOP*O8 z!+rLwKn3mI^A4sL%Tk%?_BxlY7ORzB+oHSmT>8(=p&&tZft9BE-%RcAPd!cb#H3}8 zDzN1=-d`KFAKP~>_5uW^q^c25mD}#t{UVlsq+#SCCgMHn)_#o|B^f_QotPXodSv|? zb)xoT<@cxqvqv3I9ivWEj@m=~7`39B?VrV{6G5&CaLA>L?Q7+}cv?B>cBhn%c5+b;*U;mcl8^5`zYU*IMb~1x8xql+bT(xLo8N16=D$SWnOk zwtq5Z@5CFXndtt8l(piZjTYA^9Oa7$imYQIq07cpr?P2cC8h_t*J_60>eZa`$K_&g z*q2@hhE==u25$4k!r%FkJFJ8pg{~s^C~pSTN0c6wca1c<2z2wRX+~8LxPSI8<>62p<evTS4kB#bEohUnttAI$ zn|s|k%7?jkplpERF*`jxBNXNfrlE!CA-=W&nyCGlLzVx4*(0i{mgIp#jR8 zeuo8$ntpcknghun>yypk&uuL9W*23e6D$z-@q@=owro#C_>Owoo+zib%Cr+`@+djvf1ZGCpsi}^47q&e|Bw=pb^NrFWvF$lZk|1nP zgl_qbp8A0a>l4qIBx!vP=YEFuIZBeG%})%>MlsFLQNs0O^ApwFd>Lo+b6lo#o1f#d zlfkAT*0Z+{^Aq*ng63ei^~dhHph>q3-}YyBs$c%%-s9p|5T9h3U<0(T+(+*G%&{&LH%~(B=P@p@s>2G!*&H7;10}RQ^&UncdF#1Qqs4@TCPsflpzy zX_v2g79j>0T5tR&Ms7~Uy#Z!B7b3bIQ7~%idD97uSJ1`Gun%6#O*WtX5F>M%+#eU~ zYEu!TpBRlTjhZ|pGq&%2a@NrC9k@t+pBto8ULz1c8*w!+;d1^3+WRt`)|eMj-mMiX z^Pe#BShr4-Zx-U!FIDn9e>0g&O1NuQY@o5!ARDmtAYhgQZ=gOC@r0DtBM~6m{6KdI z2r7aDj{N|m!oaPEr$Vxtx5P^Es#c7wJFIGDKedY$T2F*)tSfgF#k$&b;h24IIUh&J z-ZI~&BX^+h;^tYfZ+ImD<0lL&SbW80Uo;is`B>W3<0EqLq2v$@gsFA~5w-@HQv>@} zcE{y+bcH&s%c88a^#*3@i|64oWk3!4uQ`lWlg6k#tjZnP+Qn+V<0R(g1@{wJ3#8~i zPih<5#qg1X?*LW^lFW8ffuo#4Y#^n2^<2TfzfKGdN6fD30-Ny>>k{!iA*|M={{sWT2XzbZ<;tyz3X6vKFI#?wXzs?HlsTXY;-xVXmcF zNk8rFx@1?xbsO_KonY^mRPT$`&cvjn=kD@R{zk~TMqT5cdA(}YA~7lBQ26mPC=lZ@ zqa8#3B9w!4j0r>$V1~6^@&w;i*KgNyVKiW<@m+Ez17=zJ_UAJvkJ3y984PJM6omSk$-U=#ScTlQI&lw>z*F5On_f8_3 zwPV0cG>I81y7ZHW=5(CiuB*E5NDhpaDI&Aw*1sPGpQhjcX6?3pM{+;^^3?+G4erO1 zC2tm@He+0opg7~BSL%x7jtkzrzPKaK&KDf_tr$jMf1rFLg>2rCpaA3Z`uN4i9m^Y* zggif?+dp5C+_xE5T#?+j4XHhmEkqrxE~41-D?$;Z8!Hp`C9GIv+?coawMU> zkIS>gh}mpnHdA%D<#7?3sLh>kMKSLCk-!|HVTw)WDSvI$76qQ?amrED_3rtmzgg6J zeaM(V0;^7PaO>=1bz6s>6a7ZJC0Rc58J6m~ll zPhdok)=i%sWlG%@DU2+{vDMpWI3Cyv@H0PEXr_(rkdbdMJXCXh+>6 z=cQ;3DYKp($_wTUSe6iCA>~6x){%2s$cBzA7?yB3PyU$@?21B9fIy>42^2 zBu3SX@)b->c;X`tD}DTg?mcc<-A~A{o0T9qld@w%HFq0*gDm?EUm4FixLV;Xx0FLN zRFQnX;hsd6(mJj^o(y(Pfz6Hm_yuVzE>50d%Q~-CKwNQ^@`$z~x8>%Jbg`MtJ0Zqy zY^_cImv0HFRua^hd@=R(j7LNXQyzdzpU@6&ScTDu@x+x80fdzb8tEroVjh7(r?ddM zKt{g}yOX!zmk?!qJQCgkq{ncs=|DIzb}~FAJP5y0=VRs_@n*1-xOx`N{rz=fv{x=_ zRcg}1W5Tu>#SAhBl+$s5113)?3QYs-Gt$3?pODYHNf~=qdN$Sj6X|qz8(R~7rv2`n zyFor+KFGA%M>W^CGxf>)g8d7f(9V_)SZ4*B_2eAgPG9@opYC)C#?Bx6jdAwpW3!an z{9{Tr<`P*=A290N`t0lQ!#q3Ww_iF95w{J~Ii_}Hddf4Mr%a4ETD=Y(G5gB!m|#ACk(ScG&w>KLgiCrX(dZa)LGTb>zRb{FTfe$*lORWUNz^ko zO9@Cl{BUxb0C9+~9+jBEz00GMB0tP9F9s%V&l@RTT{}Z2@N8Wv5%|QE6Mz3?9@%1I zcGZ_SByz5`1Hzu$P6wxc(Snra*uHl5F-=2XmK3?OSayoJ9D+m0=$e8|yTw`!dAzO= zy0eg@;yG6f`9G1$5xF`2 z%&k){d5p`M<4za3E+>X}yVs;x`sRhpQ{>%V$MK}=&dJ^*ey^&r$OrGrR+kg7G#;NIr2i=kr8a2@4O^6yi@tNqIrfkM9hdL+Fchd!INr#h%1i z{K$yR4f>rTNv072Aipqv$l5|XLmCsacQr9BZ`P$LxAfpwRUOD}g*H(4u3jp*l-o9Z zf0?`5T>t`z7vbA%p;GbM9z#h>GF4}@Rf>}Cf)L$a4(c|q+~{wzZe4wM%aXQlZo61} zxVt4Fs8~eGoFXimuWofl0q53tKT+GqYC6j4*rzDtc!2~S3V zNirhnygG;nAv+yy$Rbk>lvFpjl;gOwi$J?a;aqrvQ9;0C#BiRhm_u04KCxH`;3;W_|=EjnDM zAGraPPoOhbvv@?Q5#XY59bh621K~P^rC%vr$B3^Tu5)4>uCpf_;W~NRjiL9edaPn7 z^TS5s@=1kKObS_yvxSQTiZ3f9Ue9TxshK-Wc4*G17*#j1(&dlLGqQ$Y+vy)0j%Xe3 z0GU!o>ln2k0_*}rEDd>Wji3jI2_3@YdNOD#*xKDcX7;3TC@0^`r9m~+e&&pjd)jRj zPE(VLmj82uXj0YTOu{s&>iCz{Tv}As#$Q-e)j5&dqC&UN`!J~LObv?$m3!A7MuI!& zrjg+0fZIqw`@rkNNI+B2;gf{jsVnUxo+EYy-EKHM!Oo6{k$`5JkF73<1N6=`v$2s- zT~RiSgc?4yFcPY}B5fm~KB?+(8|%X+vS}sM$Ky&fp*|5UU^Af|q=82g4s|jRTbF1h z6Yj!HNK`5%=xlrSKVni%sdq++hNc>*txzV$3MCfO-VzG$8eaXDQinHCTb<)}Ia4gQ zuN<&w;<2T!UrePf^0pU>N{uA>ZdWV`tA!fcMR>#3#u6MC$TlzPh~P-u7d1+F#W;sz zPq%@A_O|{A1F~xHX=tq2Mw}pQJD?^uOKHW0w{@G+sbHGaWW+Kjua*f57Y!^%ST% zqMqUDJ|zdHxoR>ACW>sd?pW#YbOXauauKzrLd$Ebx~)5YKb2wRzI^;*n~2PJ0Aku< zBpwgU?P@d7c2W2KvgSoyx6RB#wrp=%gfa3RSS-J7U6e10)MZGCHu5T3PI+Kl3yS#; zfSo&!8x4TU366A!erEa<{UT$@Z!L~;B-1GmRH&U*E8dSHp79`T}SYID? zL7n`^Ot!wv`EM6(>dciW$1g&PDr$tA79X+g)op7P+1S|l$K!15bl^%+86?5R3J#;- zlJ&N;5_tZ*MGIBFYU0w)Nss|{)jn$L0U~`~wpU=B_`>IRY!`|3kq5*oMsGH#A5kM@ zyo+WOPb=IP_6zi`RLM)78MzP=c>Kc1kSy1;>s@zqA)f(Ty&}4=NE>Upe^;r;4;T>P z%a}`u@I+Y2?@zMc{+K9S{bI1mL=^T|5lPqklj%Z;h1LBfrc&Kwxh9`n@OIry*+C+q4nW-Oh$9Oi<%tr!3c(xMP=; zcp2`J;numlU)Cd+%%j+(+mTapJaeiJe&tC}Grg56ryjXhnBkAw>y#n{z2yjnw7=zBqj zbF5>*Hyq>^m`mHJSCBvz#}Qw-9tUXUIHImzjPr6gx=04OliG$03iEPjQ_J_u-6t@!T|Ha#Qma-uB}ow>w_tI7~V@Owrac5ffj`)M*4-h}Wjy zW39sFYY$W$fLQI110vqmrT3+e2>DR`a1t>Y=eTx9I*u)IJBg5Eb)VPn$j7lW>hU9w z(-chxNWY0YZ}!dHMbYFXn$ra^(n~bqNV5MGv^FC#&pc%=6GOAALNo^b#Ta5w`#H2jPd2e+b!I#SSE|x*LIoe~2kyaZM>$wKLK`1S-8EuCADndp(9Z z)b(-uhi1=@kV)ZaxOAZWLpVI)0TfFN%-$>HDAtcvH)3xLZN}F>Q6EpW#KenRj^B5V z`J(L|iWhAc$W-3Ohj(a2d9yT~SIZ(i)IE?rbVpnQ!7T3~>9G)Wu@3hTQ#|H&4;`=_ z9)a1;n5DX!r!(e2**%0zopRoq0u%LhtdFjig=xY)l&JmKu=xKcW{)VII!0vFb`KpG zIt?45|=u*N+RQ+ud41*|>`XR;-NN5ujzWi6r{Og>afM zfeB0Vw$m#t%{QF6ViKk|Yit~r<{cGTd^YZxu70cj_fUX&{-Q_yb{U$tqi?pMdDlG* z_Jyk~Js)8a!Be|$b-#tCkvNLZx-j11cxukNgPGilr=-#KjT-_;mxuOoI&lTTr&|6?^`REmg zof%)*wo{BF?93Rat*?7~5QE?%+c^xlSd1|6?&C&BHef7hSc&((z>%SuXEP1W*tRe< zy{q{KZ~O5LQpRCt2I=H5@76k(d-MPw__W+tftu$Le|4ePXg4WIh$;AdeSi^~W6JQ4exl)xt%s3;zDv zn2R?PgkAIeG3ad38e6Ls3tiYy=yn&|4 zD^haMto7P8v(S2Ium{e^db=$ZZVW~vTq5onjW`9rk_^6&pHyb8=PO_;KRv%u`Z20u zU%=x*ag=3Hp~-omhPp@PnHGi7r^pftg{ zt7@{me25g71$*W^ms*?8bNbD*yPVD$tqTWBLX5=x5EFd}mAo{vn}O0{2XBp{djUUv zxbBuV>alsN)`fsu*nFgo=QO@vek41;V8$L1E$H|EM>N*HqIKb5_Z4H%yAoH()3^CJ zDg#mdjyv_yDejbZ{Nl+JA@mZh_O52@!cjIeg~$ec+m#9T-e3s^hu2d;kD`{^(Yg?@ zQ}=IA#Wj(xXk9pX_va#PRWDVi0Tul?VWsXT#;prSc%a<6P#@JzyOdN8Yw5NFb{YrX ze1zd>!pxS`J6#6@Ahc?2o}3s zKDkRCA>7*rPW2PR)nd%p12OXldV!K2_a~x#;U0uZk?9)x1+FeRi%44+y(2vR3N}=9 zsCM^4uAHNmhY2xS`l)*%56H?KbDf5gQ3*lqmlXy5Btj+Bfd@pRb}a5+NV>Bgff7NZ zFo{8pE~DnzEz^YSNvkPYrHs_%UL_ozmRMy3Y0a|uVYCNmN8g5NwR`%gGkSM13X0l zWwE$@A*q}5+M3Lhtudjg5H9)!^v@G^0ga7P`$E3dZcbdC^Q*V753Uiz8v9m)<9-~V zd}|(&31j64C)cNlIt0$Pb89I7+55`=VT6I2JNPywHegvrc$)UGMAWl}1-5WG>e&pM zg~XzPA-S5b3pOh?rtk^Z4O0KYQL?7nWW!Y;boHnHg@bMn*{i6mF{qu0Z7Nn`6n8Om z1H*A<{82d-;wxJiCc+W=qwIS=C=4U6hOXlv_T8fdExJqeC=)vv;kUomK8Vq7L=PbO z*uE>tl$ym|Ojww*E1Q8iVLR?f4(Hms6=YNp)23$(0e|Ag2=+YkIJnqv==x6vdoD?S zT|79SoTU1k`Q#%q-8@igBzFH^)bj4k+I1hpWTuzWamjAu#(=DHrM?jzuLfdxtYD~s z<3LzbBoN=?L&jtQ$9!rRa6D0}=rHQA-TzNa6mSGa8O>S1@y#xy*oo>l0x?}69wj~i zcehWa;#qsv-uHPy#|#}?g}eZv^eCq505o52{#Xus!6u_>5)l;}_ai5! zIx9jY8~3M$c^#;0#g}U4FePF)4dtRe{RDg2MIg1R5xtCJ3LI!$E)a_Ljq(Bk6N%>w ziUtsoRfm8$z>ix4`CNg19H=VV82^ed;4CA0JL0RX0M=oGkAjUO;>tfTkrL&d5_O;V zaqqL!!hsZ5WTQ3L^)h29bLL#!RXTcjfgHCnO&jiQV#QsE{%y~bZJb~ z(WPF9uZS+qrAmznYk5SMa;=Z(Qtrk_bSW@nef;1#qDu#2l0TwLftg2i=|I@?5nT$n zeMFZ6GtcN!Af6+-bTsuB&FE4f#t~f#_&%abM~hl85nW2mM|3IQ@ey4LO#6&3AdPuMmjdo*bSV(^Bf1or>xeD|^*uYfG{KB6O^l2=J-?$%Nvt2yrNFcuUCJ?@ z(WRWmM|3GL?T9YrLS%F)SL!pm6sY@%E*(sH_=@0B68srmN_sz{OSyk%bSXBtd_c5x)hjoMwj9U zw2$agVCrXdDNxrDUCOr{(WU!45nalm9nqy2`#PgbIoFTqQnG{{T}qB|M3*K{+0mtB zJ4bXWcj<^O{VhePm9@v+AzHYo4$Q)Z=jg8YO)o3KC9f=fu)R3@b-QVM)IYT&x0iI7 z!q1DgCVXFdg3(K4r3dvzM0F-G4^`jQcCAbIni*%fm;f9#R%sLT8mA* z1J6G3ZdGi%&Dlakv`|s`ga{o~GVK7}ukG zlhXFYx99SWkw;)E42a9Q()Zb;ZCv_B+41G@p1$`_EIpV5_uGO+LODnv?;-F|XxOmo zu)}Uh#KYWO3bWklnZit(6k+;`drPZXi_=^{BfZUt+_#sO{^)*`ZsSLL1~yowK{u4> z=KJW0C`3Y&IN_r3pzi}^$9lXX9PjawgKYW{TRCEw5f5_AWc&YPu5m*UYY{gHv0PVA z?{chY+(X2I$34ZbbIP-eq=B}1#@}E6{l8vs-R7&j|NFoGk1vR-hAijI%2_0}>FlFL?)uK7A#!3t7* zgWqacPp_d-KY?PffApY!bZEOP(NWTO!KlA_IoG$ZaP2hrN;irylegV50`TykZ~vam zk1cjQP&&!kLt=3z)cpXv(W@J~7{j?T&tb!N%fG+8JkW#l7cM2-U2L?p9E8h@7G=_P z7n&_`sg1;lrcSsdf_|I-sW3PrZXD7 zblj%6NGx{VQohvH`PLlCkLl_X8F{5@mD`-0QcYBoGd6Xw?d(_G&t}LBBRGD-t06ZZ zW0zYqTQk1OMhIq=FT#|~!CT=yGBvv@FWg5%k3j2c)eZo5^qFj7S{O^t{$+e(=&lG; zLjmnNbnOOs=n3909#anttyMLK9(jydpR`&bz_Dt2Y4Ia7r$(pr8^hKPwV%gM2;R{! zdDBnO{E0II*IG06R&~6l_qb1%?9zg3Tc@NjT!KrWT4v|JwV^&v`eTugNpBZPR3Ax~ zOh#RrNAF{$@#@@GWJH=&lW0_tx;$>+(4+PIquWA|;#6;6E&d&4T%$G=nut-8cy!0i zK5z525jaG5d_|aQ(d9N913?q+VceABM#Yk6jIpJoQ$=QHUO0u`FkACfU$Ghfc4O~# z{KB`;fVEs*nkSSZcP#Jn1q^pkz>YV4gbWS!8vKMjElq_eULNWrGP5Su*&^8KT%$#y zT(~-?=04bP+%0g}z>7y{BV1NEF_-I!f-~(2OX$XN7lQm?#aO3$VmB?ZE26V{P>$VA z$qBJJMDU=CfZ`Mmw_DT+V+(MoH$w`~ z8$-9}aIdgdycVEqwv;W(86DmFODl?D#34a%!4_2GLj=R5Z}^)SHj+4h@@UxVmFv)s z(SxtHCXRw}q89EOW}UIoRT2@MrpY!(ld}qlILc%f&4%buZz8}kYLgO+c6hDWe%HBh zL)mkHd9!+~m6CmOsb=n|m&!@yd#UE;Ktqj&Wpl+kI1l4kD!95nmTLXWOT+Tj(E)fw z?N_wIts)6FFltfzfPzOYfv2}a7C11>3LbKj05)UQ7ajbBWMa>o#XUvcY6Sf##B|hr zBw!a&4op`jiJIW@)O8i+{=`^Kiq_44#4I6J>NI%q>p-D1;m2=A&ECr_O@Q+~S}d{{ zaEb2CN_ZM=w}f`iwMaC!Hm>&Bsk*L@U(ks;nhKB8A**GyP7ar2(-Uk=*<7(`GGB}dZd^r*(Wb9 zK86x{$m{)t%cY}a+2wJu|3!V|-SkPN09nhM?{A%1(N$h!EsLE`#0xxG$ zURLGCe#LMH*7(S#tr*A9B@xDXTPa{H5vCGyC^{~CvLQq;;wy!M*2@e~f(i>7`b%_i z)*cj@14x42?p(r-o|WmlM=N(S_0RNFju$74WSy5Suiu zp_9bfnfIEpS}!6PT$y@-N*jqR*~`}@->rrP8H5_fhT(EE`3K#iEuL?t;rxJVEqT8H zGH^8p*j)DHn1VZo<{a(a&NZmsoV`rJ^oo01cRO=(r32n{7Ve(M`xmVBVM>QTB8P)& zEay17F2Hk~JvuKpl}+fovA5?6{{jka#9ELJp1oE*+a<+na-UbMw%{^iJ6?(S-WzuO zgd3W#@QxoJF;Qq3uT3->XHwNM5tCg`)sDhk3R3RpYMHomK}Gwy-XCW}9d}1MF~BI% zad+4+J$a%52alq7A6>dR`%jY+aDcr$>KWY?QxZIDSa0534PME4{^Cl-jQIhHU<37N zSS*YjfNW4)1hX{^emP4BWj&y*&Qa9|{Yo{34U31%yNqlAIJQy2{$D6UG-~MLFLs%3 z_0+u~@E_^-6#QeGS7dQ`Q~gk-@vc%|A3vE^m2a=^OkrVty^0kBlUe-g(C`E4)qWMLX1^0mM7fuBY`3RCoC_vJKYbn2S;VAykZzN`2_pLj;)XO!p_}I ziRwLKp@4~(s2g}o&!x^z-}g!_$g;EA`SFvmXs9$qRUO}FX?Nt3Qvq@k=CZT%J}F>d z1mza@+=r3AE%w?8W)p&K1nV7fAIy;z%SzloVd&w)m}5_FM3D`i%0%cG)Bgxfx~rYM zPHhWUuWbwZr(@5HG~f>sc$tabABKhRXx|gZoRFRIej)yGzh%Pv9ska?ZEf^2e?8TH z{R&O6e%onlzu?#L04{pl9dF!^luNRAV;%<5!0J~ zRWL5C-xK|}R{;K}Iu`wO?>*S)S*AfEm2I{fTE@iTLXeFaEr~uGOXX(SG&9 zHg8NN?E|Lo63OOozFA>gG-dW8Sm~P>`7Uqun*)O6hD_c!G;{@X4<7b!V(1-3kJN%+ zIQ|FO>1dl!tD9lmYSe*8nhJz5uNR|mkorC87p&FMC5G|DC2Jy3KY?Po1n9}akc%uS zE`TX`0Jk^js~~`t5obU#Mo1{am*xw!>%&l zjR8#llCVRH1;4yDyxPm3*fp`#F{xHf=((B~pSK(fTv5C87S1ogZ~4N_>?F|iS$+$uljQJcybx~0MCOdGPTHQ|QmQeVc6Qjj!3?|0? zyVbZ0W9R+Wt)K=CRi#Xk@68pT(vWVoE5nDGn1hUQKe9|oa3f(sZduA8UN{?pV57Uc z^Md!A7^WTHje#_^x|r3i1m+DFs!-p7Q4tgrYXO2bz)~hSUda?WH@VeE7zDQzNDNrC zxKwTc1D{5;m`PA8Bsb=+H@vmlu7jv=s4<&pL9M@*^eL<`Z(UK+hRYY!CRp^T6BEC1 zV2R+D>3#pa$nMCW7ZJu9%n!kVW2hS8$LCgJ+bAGn3|u<20ni71(#s<=#F$!~_b2#0 zq~g5OTG*Fb}xE7KQSO$ap9)R8c^Z7$=){xtcbA4 zbi9u;!AsRAz;wTfQM@^rBv!78`{Bpc3|3jg-^AQvhL`>ho(YP6-lj5ObH))&p()3K zhhP$<%ECem1er)9P(Ro3fOxM9ZYDSzKVEbRf4pC9GWHNkvU84*>9((rDHM-LQ&diP z&b@eidwGg13N4_96e2_mykVco1M`$}ykfBtq(Ab?z5U+9(CzphBT}h)OoMPA{=KHj z>Rzv79hSsJu9QM;zK^9`5_GxLib?lgyb|$!?AHEC3@cs{Y%@L*6v1JS0*`}zR zNIPcfOrTtamLsHR_LoTNoc`Wk0at6eVj;^72B9RwYY|BePdn+ zYCl#izx3(@bL(PQFQUvullHsEi-cnG(9bbZBi^G%fF$`mToX`S1z$SF;bKJHD#+R% z19>P&zlpi%4rJ9S{N$1keX(g<#qG}30>sMRvZdqiw>EOAA;qi4t<+Mog`TKU$BGBR zrF)meT19rn&=ZKg_$Eg7JiD4}d7M14l>c7iVh6GZ8eiM8$YK?*rJjUPK!_{kXdvik zDUgpN9WCK+&Rq;wm>(_=b1dVT4t41zZN{+1p6XL~PCaGZO*lwqzSnKTxRYeI#fici z0+vqJS(k#Zq)OM=@=;GPQe)|Ehr?iDqSbPodSwkADx#lPl`7MVHx8kD1SPuP6oX=0 zSPQADm3}Y~0#D>BQlOf%Aq{_fJ=gIIwibE`aeL2hzw+@GNpGuk##LORx=bNoVDBEP z7S>zmdb*q)qQ7q%9JB>cO7MNw0N<`77aY^k|8ES`1j1B=Q0*vn72;2q3aj;adgnQGJXR8=g`LrO;(`ho5+P?irW2QEWRHGK|0!Fwmr zQPJYiSF}_?voeL_ks?)|S1j)(-o%+Z>tjtO7x0bdQ`d@bFz^PnJC-(pv1*I`2{q2H zN7@||(czY%#EI1>Eu1~|sX$CEmN>{{D(qgZ<*#nIiQL5x$RVut=#us&PB!L#2o>Lg zFbIn?et%#15le;m|h3n_Pk0fW-3cnTpQzM%N{Q4T3 z)3K^m@<#9%6tSY@bf)0l)su?+cg{fY5rpd|0wDM7*5xkXU@fl$Lvod?tr?=%Cq|jX|wwYRl<%kufKHn2mn0Q(?(`1T|n{# zL0kfH^-xdIK0wY*D(kEwjl?tvQ_pbC5_71@?2nFQI!M!G4AU1}6m0W!qemAWJ-)m* zphI9YRSlzvyYfr%RugfX-Q3KtB||V4lQ#CSt{rUGBtAy1#nU325Tn_)YshRM$>Nt= zwnGPw0=o-tswA&?0L{~d~ z|6>Sa`2Bj!VWT74L_|qF*<^K01%y=Wt7KCp*^Op`mXuP_7*HO__1*zVsLapu+4Gx((y`fu3l@9{)@0r&i=dCcmgBv)kFNJV>4xb6} z0-{8$$#U6B^QkuH*XDa``+eBV%+UkiyGWekQu8I}{1hL@DZ!LnOLn(0n#RQdhP727 z1a@s6S}U0-t<8pUpiOgF8&jeH&~&q_{nR7kI<`MQcCfg1`?POtJrqQ8yV*B#`?PPs zk9D(e>oYd9!2C?NZ_Ifx`^KE9X?mDbX~u~;)n>fVTHNd#bG6nZH~WUx`}UIh zVc+l#WA=@?qvnU~U)k>Vjk#BseZzON&t$vXH$INTJR*1d24WuW_Kn#y?HdT=_^@xx zuJyC>Y2WakW#7p8FZ;&qa{I>o&}H91B*Ks>6}#*jHNwGdMBH}>K?u=C7}%D3q57sO z7AlS5^}@E#1kcKB3-;lA^+41wbk-ppBn9s|KDw|ge(PsBY#&tQ;^V2*G$3=X_1Sam zUGrDzV_s&*9M1fW_Z+jUslv(jP*adjq_>q#Zkpn9Yc-|=H@b}RcBD(3D~*Xk+c%6) zRGd1bKjH2xI)`FO%Yh}n1IKZ54_9N`{a27W=~id6+0$2({wjz#nhf_(L2c#li`JXI zJWQ4e*P|GTXbyuuY)q%A&h(a8c-H0uz-JZnIut!ovKTG~|9u(P{tT-Jj&?GDt_2HV5@KxVKi!%7!-x%Q*VRdHX?K2;3lttS^u ztD#kP1s0>t5TH)`$iWV#i7s*E>LF%DS84~_U2Pohy$wu~Z|^yFj!>;4-{KmxXEK{& z`MtNE(CXTf>SEcxx#jvaCuE*x!<2`OLfg8loMf{an&@EWA@)?zFU*8-O3y)Rs_9n9 zI>%D=jV+>GlCOW&Pb}3FD-4aGRITpZ0d;j5F za^W)|S|Rj^iOK8BE#3rERU6wr6SPZ}Z1x@{^ywE&SZYn#fb5_RNkAQ|-Fie+d(!V4NlxAF>woGDMCQF;r%)pV3`+GHiks?^C5F;$kkSHEZy zUMXZF@aWVJkOIQlXO#;`w>Dc<9|Ge!^v)uWtrZR65>sDBTebznK=E{$r=J^x#+VZj zOx!n3^0L{&iAh4z4e zRGx@zijpm}Awjtcf+G@xGXb5DVtSIah0-m$6?#t9TTbINv?rG~U*f}R$_d_{U>v0= z96BTB#rC&UDHJ`~x7Ilhnp&`G$-czytm4M4=r()AP?;U?vnS1K*g{LYfK^G@EnKi! z^Snkg)!CbT`OQ>UnhAl7{k)^BCUNlzPeI(RIGeaD#~*@&nP9iFT0}hYFP1 zavZHAr$@w2K$H+H9;s5SguJyir+z6^O}kAZrGcPrXW=O(ix(^PC8>pbJDMohx5I-m z@Y}CdK!vEb3%=Fr#%*_z_spB8#uX>Po?~^bpIH#@cFkE&pHi6rsy8!UFG2w9mxO0S zoE_JwVbobc1Q_=0nGpibY}g(luzC=41i|oN7qi>Ei-ek~e&~s2KVlmjs`*D$ml_(w zFr+{79)P7Q+9ME&ys}hR$j>)>+_WuYZVO(Jp|iBp?C>~+2mzv$f9!E0uwUe@<3Nul zv%1xo1`VmIG#nx3Cu;(zuED^OHAm)fq`x%S=YiMr+OVHM1?!fwvy@vNwrq3M*rwC2 zGo$=qN3cn>>l-)XNZT}bS#-O$G7ggeKr`4ptgZSKHgjgJ^)`dmwkN#DH}18UMiH{Y zifr0?ENo;XW8gEiq>mYk14#>esrN54F&EkF;p(s|CH|{uSMj90^=MhIMf00;t@P^g zpA~^n+y+GCuGYzdL1;vIdDlZDd=lDvJRl~a$U>Jl2*T5!U$bYwKoS(u(TCmrt7CPIwso8#VlG;V-ukc0k1Pv%i2p+2v!X74v>HtbbvhZV}0 z1OunzPy~)qFO{o1&rPS*XtdLiPQzsDLR3p$n0@jK^boNHI~VYT=t%ZXCO}+m**L1{ zT$o#3$*LxXc1`R2aPH47obr1u*$lAUmlcLFp?^qR+Iv(i-lPh3x$yGQgJZsabZa|V z3Jly-!LW19H}~h)>WNfVe+z}@y!Tjn!Y23Ho-srGo~;N$t$P6daJO?_l^unaTRIFnZ#A zfrO6PGcQL%{Up;+bc0&getdu#7s@~OtX~BshwrqlPW7}n&7Zl&Y3nh=3Wf-|_qg{A zTa4m8R8G18<&%N=Q+6JLzGAWgUYxSclUdS}kRu$uscR9qSV1Jo>A9XmP6RCrD@Y&o}xzDXf$fPp2qJ`AQJf%Ktn?Ju+kHU8VT_9gjGhmH0-TS)t zfM%eqIjGByy%DD#OC$%mk6hCQp2u0XCkRApfe6vCnVP-CpsMN`24P34L>L7ft>&29 zpFMJB2%5<#Kx-m^mP_mK8-K4cbOE|^j4iME;%C%0C-i%Ls82Bfr<+!pM=VYgM`431^G5851MecMY0}9DOKP;)Uc62&@>Rq5rKQ-gPAAz8llN3C^=bB2Jt>LfxtV6!nQPBZ*GFA4H8O* zAxi#87$z}_06<`3+g}i@W-pfvEm_nxz5^X{)y+=;9PjAsBZ1S{!<2@K#ROst5W!(t-c+)V*q6OCuo-QmHan!9Wu3u` zA$B-cH%@iX52R2f-vQA8FLY-x^M3MXe%LV8C{I2x6j@=W0b;kDD~5;IEnzaBU*C@2 za%_(TyE2U5r!ciEyAhHVrt~W#S?HqJli*!wC^dhD@Dga8$6SH0B97PH9;ezG*Az2S z6xIk&9dT)78SioaqF7c%i~fUMK?c5yR*{$aaqF5lzN6jzL(h}}uFnZe_dfQn9!&XO zJyCd&z`z;ea)py*={FF1#C3${pbbHkGoUwAvy~B@ZOH#%ZNpv|_4b4b3=x-jih`SF zhbA7Is#p(1ZfrWgor2m-T9|e&^bj(TUA~daGU}ln{3qhLGp{5GXb~qPW)mvGsiKD& zB(vMkp0!-j5Mjk~}`TDuQe|4O*l9* z306x-7M9L0cg3LXw~)_~*Q{Poj4j;^!`1~n{e$RAc6HSxm?Qf9%|VzvMAAHjdz;FI zCZn3u@wB(-W|4=7uP_JTD8Cl6l01ZLo)*3b9fzY1<^(_IcV&yQg4C*c z3=jK3SPnu?WzX9Ny>DTGZWt;j4Z}j+SUq;mwjLPn**19|#$l8B=Rv=;y+6w=!?n>kKt!SwRHG(W%w6JMe%mmR?)hI!=uEe88F zAIYXO7~G=6Nz6cd^vujffwp8tVl`z#qHWu^8itDj_W4die9CD*7?EuYDy}XZAmGF_ zlPoBix%aw$(Jf%wKYjJ2sOv4uNl0Fp^jc2>C4MkoYd<-g6LH%!0_RgUUn5LK_$;L) z6u+_@ncGs_I9KLv)~F3ZjgCcTY)%B6rqFh@%g!+K@|l}(?fB~RiFj;p2*yu~#n7Y2 z*DnzIqq@1xh72?aq(ocdp2r9hKP8r>4 zH@n?G8h;3i0)}8$2uKr5PzdHGBQLa&Q;oy0Nno-|Tk|xJ1s6f~_S3}=b*o3|R!_l=oWiv;RS98Jw!w@W7FxD9WvNW9pSlv#{`;;fF;;78O2v@Dr75vZeza*y zhLtrnB?Q)3+JLY>qHrnJVJp7-+;CIU(vlGRQ{%2B6@%DyEeY{Oe!8=MAzu;YH6Ao# zVw9yNl|1u8G$zB!SXz>YM7WYvScdmlYErSfyh~5=o+Ta^13h0N^z5;;;@?6(nZa-6 z*0X+=Vr)`c&cGaIh=G;#3*C%amiQI`r3Z`Q&tH!!?mf1*lR zhV)o?UcFeh+p`>#m(@54_2CM1}>;7;i!(UAtL~5eDaGe1Al4KfsGrO>kH-CEx6EyFK@J z)y-lY>>8J^V$Z&Ts|6n#lVjV%2Ehc;HpjbNA2nJsN;jZEc8E_>VBgy2(A#=wFGo8o z0{v`0t|X<^c=^@?(Q0er7TDXS1E|L$uXP;iX>7-XCsvP#N+g6_aOpmJZtkI)Z5z&$ zHhbm)MOenztxiHAqF=yv=bvAD59O|6g~?mDz1F`hyV-B3t^`A>Sdh#L%RW=XQcKLl zGndh$goh@e$YSLLsfa_uqWnp3}{NReebTj!8Oh3&~x9Dmi7Od#1qdw~k+=HZ+ZpD-)g90y=KW@h6 z5S!}Xu$LI54)g#2IwlMgq^0W$O@EgW62f~Bm@)Por_b6}BN4?%@bAnA8(6{r{p-I! zp`K`^L8aJ})LE*B)w_SeT>C4C7beX|=*F8KQkTUQPK`ucoR*8_8R69@F9M7SV&(=r z0hdBF{AX`~0rHyEK(HUgvUI8jLHZ%Ao`|M7@h`@0DwO9j^-A@cB?bsbr64wXNDyGA zxay!(uEL86kW2B!8?u4)e5EAJ2E*4;I-(`aVo{L%#6V3T%#$}fd_$rf1yY?+hmqz_ z!ZHE!hVdyF27!N+!iPFDFTO#(&?qGAKbQj4&p?@0#73$(c~tHv5q7W|m$v=<1uESL zt9EA0-bq&l4dWSWjW9uA7*)17Nzm<|AA?|Jk038Xk7X4K)Tz0S1!)HQ5OJ8%LhL8N zQiwSC@C}`@Nq{yv;m8fL@+TnY@q{q?2C7s>t5R#fX6gAt2SI2M&t5NJ6OX{;`;G`q zwRxk0`|T|eq?Wfu1A088T;CA^IO8^wjHbbr z$CC;&b5egzMX?Nvio!_VQh@}wj|DN-<24n5Of4#K+P+>Rs0(>4Dpj@oUQ(glwvD9% ze&O}JRM=HFB8c95eTXVx=jukK6E5~G6}TAFqSBxyyxzJ^!q=jbNcAn1Oas88f~1+( zM4;^LLjksDeobZ2tTL%UKzsc?G=6S}$P~c0R8Zf3V=i#j<<~2OxW&3nOYfxmmdd#F zi)}39w903%s0_Gyws{%XEfrob(a44>;O#=HZ>dzG`z$J*_KCMtP|IZ7x#5J$^P1Cz zlV~109pyB>rjrS{ztKVZRgfTX$**UjMo%drv5Anp7oq^loCZYRvIJC6dTKzVYHBXf zpjl#ZX(yoKb9f=r493^uXM^Ig$zB1aIWPIq1T!={1T;x)0o4QJ8`~~ zB-#ZDG7>IBfE$uccv{gEAo61Y7NT4TGP3`1IXJMAX>lPrAXF1_rzGgWK-@QSI8spq zf;E}J!DLo63vs<@I0!8Hh%9obUg5fS@(W2{)xz;J7?%FHN)m#qo0`6YW&ymcl$pR% z?=QZiY40F%tx+16YK0D5DW-FwIiPoR<{t%Yxe}hgWzc>WSYwV$V(MWKdL8S#U*8ht zreHO9w&IHoj3_CLJSt2454GGRs+EzFbc6=&Ia7@R%A3j?1sgW95S54Whgy29>R=@h zDe!39ovivbZ|P)#S8jCTjqqbSIwOmW zJfE-0D4}noqlk^ybd)^2=pe^`gx7S6nMD>IpH=?+ zP|*Gd>^Z2){Z2@@CGQCpI_GyvbtnCtkgx-HLITErPf0-f8zp!N`VVF)D(rrzv?R)R zlrobcc1m}#@i`^oFYlB(L+9R88nl9Ml!$x&o(lvZk(b*%biHLjBt5V$jQis5?y$HF z?y@jA3k%EQ?(WXw?(Xici@UqKySsk#o^$X0_x+hvI!Pt{%+uBB?xd>FG5;e&x#-QY z*fE(TTg6Z(mj$`KnLvcqJp zmA@H`2V8%Y&MtJQoc=cyctg{CDAL00VLEKj4wW!Aqt2oPQ{WaI*5BfP#gq;HnX~fy zp1>0JNpA`cRs9>z!XJ*X*jqrEAlpq9{gcT|#nxDFV997(yOKHI$x&d!WfR=M9kab) zA?8%~a%QG-0p5oI6%6G?Ai_k{6+FDOS@C?Qx2|q@ajF`(s7ve}YvGR^5^ivIm_%?7 z1sT61KB~lRPX!q|cRng`udd<(&$GvID$1#|PYG~Q^%(f# zv)=M>r4mP0Nii^Y7^3vg9T=lX>8=W;sOHwil$6;|2^#(OG=`r8&4H-ZB-S*A>jx7@ z3FH)I&az>p-U_8GG5W=-UEZYEfb|Wa>AJK~kvQhk8plF=%S(oG0fl98!F&Ewf@+`p zf3-x5(XRB0=WG(PRq*8o*J&GV^FLD18PGR?vh9fJAS(ECUnYd~++@X|nz)Ffa`~|A z1lG07W3W7U=PXExCT$kMzhEAr6qRCdK1!BunhF)qrxbOmoFeIXDVWue_DY%wuX`$( ziu*&H2hK*`JIMMgZqdPm-3k+O!dr^(oHs3lR%uAw zCjy0fH+b=JSW4dVC+?l=Jm0Tdok2vRDpJ2nxV#0mkX2lzYfPtk=PjIs%ZWrMU-Qv* zkdsLj;wyCh?;6pM+{m2$z3T}q-OLmIg!40a*UhTXJ&>eB1pnfs>RVl=lYoBwSCjzv z)S^QFA4S!6Z7&j3>yHEqy%FJF^2b+5q*I1Zq3>UTbeo?0Q*?y_wEHORc`mb4@K{Av z7YT}GSFm$X4xa5yMEa{f+gG*gtC_P@X~iTVDbhX>-1!u93*Nepa*gZc;=-jHAVeuu zJ2K6`PtkYviSh%&<3506Kn+UK(?eu$yqkCoBxW=i5l-JAz|t{4Smdc zV=?N1*IQURrH(JxlLB;NdYh-f6J{sD;(2R7iX0AW;N4JyZnOd@Xj0(oXMkc0l*jwT zWr}3yj5kmw$AquY9fU^QsqAIKrT&qMEFShtdO|81&KD%zU7SpcU%Lu=@1TclP;1=( z)>NhloCTVp=DZ3}=^m^PV)jNp8px7uLIjA=ZDbry(H&@+vd}J6lYA@nf+8{r^!y?{ zp zq>8EZ3)W&s#0*a$9Y&Qyv8oLa1i>nk25v%N&|B8*bBNfa@5QSKseKb$IbUJ_c-&LM zEt4s3!f14FtV0#a%`op12{h#&@=F17-sJZAmlRZnw2dNorwwmZ?qt2hE=>{#x@O(c zql8l_UHhh6)+@S54^#W9qiFqj_HCwFt2FaA-id6LQCW{w+QjrF5RKdssbLDe!;3tD zW;j_6d_I^38CuUF%En|zB!P7K9Jeha$rVu_kS}p8K@VA=FdhAOS;}2Q^z{&$A3YpB z)INyn&Y+iu3A0P`Sv1B9FFlu%C(C!h(hYtPY!6z(HxgzU&BCKY36jrn>XQ_ov>Lq8 zjwtGr`R}wEFUpD5u@pJ;*2EwXUYYW6SEP?7j6M_4y}4&Il{+Lvg^Hp0dkAvnP^X^) zN11YPK}bd2@`6T72wrG+mnu{Q75_d_tSS1gRAaA~cM=(6tG$Im-|VWdXwIGe;voBh zt$-xECsjKNJrYl{Vs-PMME#Qfv%dd-%t>odl&^C8e|U(xpGC&_!s%f6OMDJ0Be1+| z)fdI>N|o5JD9ddr(Kp-bE0zf%s4KWMb2hQ# ztgzJrwD%D~JB(ovh6j-RyeOU1eJDy2QR ziR9fT4R?qvjPFrV8U+O||76sPQ|krk*XC7v4&B>U4;vAeBrB)lmv8v4*Un5rpShvC ztBTRDhp1L_C>e$b$eY#R9p=O}fay6wQ>4DHV2bZ5(xyODsJ0{@?LKFBl3PVpKE{5I*B$t3o*1U03AD)FWhU%!LuPM!u|_`oO^eJlTe zp?{qXw+Fhp#1xs`V4}kQ5%s0F-fiXTYBY0~!sc2{v8pd#CA8Jj_LT7HutCiXGw3o10B`&Q%^pm!EG+IHDKvxc7zKP;#s2h;pad zvF@~u8IW4aSv{gk+GnkraC(;(ab3m@7#47!@?aL}ys|*9NWJ#9&(U0OVsnhX_vVpV zZ~+zLcucXyZKFm^%B+(@*(nu(sVeQth+)*BH8i`#$?8+JSGx_7w?#i}Qi72&!b0!r z=dD8%&cquzY!3epDGg{ZZFLP6Hq&Jb>NYk!u{5p}jtGp8=N#S~euYSFy+6^e3oT~> z-GY-wEk*016FE6ZH_?}{f--gB2Y7hV20Z1S|0?kqgIxb|2CMa?*)~dvL=*Ve=C*Okn;rcbitIj_-wv z6TfahJ2IVJjX4Ln?x~FO^)gBSp{&PW_21wEshKIT3-- zFbWaVz8|{w?G7?PbiorSWc#LYZ-Xmda$UC9Dq>8FZ97{_Zd84uDnY{xkjU)-P4%hD zm;g#I#x^HVg_BGG7^J7TsJ#h!K#6w?oKUd}) z^vNZY2yBahRw_%me-|iDicX8bRd4Rv<|rjq~BbdeVTFZ{uWN59y1ENDXuI7}JRNUtv7_ zVCRes-_DU^9w{_-rb?*p_mle_HNpsBa{ogbFuuoShVH-8F#9;{%=-sOdZlj6a9PyO zel0-pd1O2?TK?7)a+$(XrrgGfAdO0bN7HdZt1{J3x=-J!6ti z!f;lJD5BXgE{K$oO$`^*=0roWKQA7-|1l{_MCm(#o9+grtA{8aIV?MP$xz=Vab!eQ zB(^S2lFfi<=w|<(3hPC^V6eSB`<2acKdOq}`{dAsf zg);qn41y3^t@(e+g8kWXT#|EP0l<#=cbxI(3fjgnz3}&lB>9@;6L03IXbu4pB8U5r zA^&5X%o2^~W=H?)Q|!$2gy$4s<8-ymQCu!Jh)f!%eR(P!^jmxYY@+644X_O@fD#>H z_+%@Fw;U{TOxu(~>qsc58o~sKRq!A*4nV$6WV)+tPWr1qAPk9i-@V-xwRtY*0>q>4 zKJE>}BYrzt+wVF6lJJ_2DUDqJ6&kdfgSh;>o9u{Qcl7uoXBpDnY03NkAp+ z?Y#KTQIA&8oy{p35xmYeiex<6NDm004SC)ihD`_sJihqFSN_Y+Hcf>LkMcj?jH{hr zk)Wo9d}Jc}ahU0-=zsICDzob7t;&K1=38eru|`{;pg=O|#?adZAtRabOl?Lg2w)n| zSrMXQl8PlWc(L$Fd1X(a6xIbdK=b4Z#187OJPg&29i~hNA^C1$e7>DxN3cvx7ZS+n z#8Zy}2wh<1=3u-F2rpdn{yYq*bI^0I5h4)q`z7%ENRG10Mse{{=A{Eb!if$9alTPR zwhRZ343XaTXF~r7@f5JQG_Rd!wEuZw%`|)_jR&&9#Wp*h{#@%q;4Ir(qW}ZTm?X$d zF9Ds`vH_j&(R=6{4(^CJX@(=SjQbq}$b@w{KX9>WUwqux6ug13rxft+R?g4y!%j`l zc}|gI2^^P!ja9!o5Eb?bUUT&aX9Ss@Cq;zm|1mqh7H#poiCqtI|^(1C#1x4xLU3?ME{)ngKHje<^fJEsc=v5!S~ zPl5*i^^Ga>+3Bs!f#xk^v=pjcCisNz$^`cDa$`1FALq#91gw#>ml+F&x}+mJ(>f;< zLml!{M*Uumt!&8pt(PNxx6#bL*5L*qk@1i}gXQHbxzVppHkb9L|>yyCt^*QQS>+!Q8wt4gQZ3W&eI^v_R;{JYfJlOC-YnUl+)Cbi* zyx?a>7sb>oJ$<6dyOcRHq=V>)xkZx+RR(fLbjpN3BlJ|y%6iI%_=}xYOO=kFw-Ah zih9cyMhPH1qSSSV;yuR6w!`0cv`b^^saO8=1($D`0>)$i;(w+(ANd|j3m;M6vZZUvTeR%)ep>< z?cvhOb(%#baQ1NVclV9Wn$|)DdDkK-s^zAmVU?vwE1o&Bg(j+&wC8+ zV6;%v{$UrPX!*qn|7d0oe6)Y#|G2IC7rZwx_34o513y;6q=e5F_*22;a8H8pL1$j1 z|64Sd6kL*t2^rW_YV^LQ~v z3I3Jvp%eR4(DAy8v$d0%UTY9=_*hmiRc_z`J;J3{u41aYYwAYMv$UKfkqGpvdjQ8v zAqzHML-uaJ^bxe5KwI4wDLZ+cIw^zHD?q&A7~t&T#eeOsg)_d<|{x zvP!!1V!3O-{&IYqwMG(=+grrI%sCTShBFxp23~T)T@z_P@x1wVOmFV!RR@ljiwx*> z3rV6_)ca-o&Ni)qjYcdyY`{<$S6S3+daPM4-c6AVuTeH4IKt}SE`e4koiu|ZfiJ-W z$@v+;Tg@Qt$uK{^$`b9qdy_pZ`pr696$E~HqscaF@O+JyzgPG3D59lA z=j>jue161s2i$&-j_CKe_>*-U#{Qg4v%1aywT7Xq_OX@KvPhro|gH{C6IYLi!n$ zTvKo#oM}eZt*RSsemEFe3vY~87{AreC()ZTFac6u(SR0LYRC7P=ay&3V1p#4;r@T< z@+MqHKRzC#Aj4eA4Rb#5O}G?JE4JC6`L{L!K_Vph97ktoR>#53T}RCmu=fYFXi(2M z6LNESACGQgXw&GPK$H%`*apE9dHkWLQ(HUSE-*n@y>*BYGV&I`g@Zq^I>B0>=3-&9 zqA|jaIO27-h8lm?>uWL+o9|Cre$Ct2TBA+`@S}+hi=>Tkx@*97L0daqlv;EUt$}fa z;=pERsfV9+%j*$k=zN_tmV{6_%|gC{jbaU8pTA`uxS`)pSTTTr# zMAqBO<12#ydQfXw+{2wY%$-f(bky=D1jToRPBbLo=6KIpdZ|H95MCI~nJ@2L;={zU zA%bp7v6UBxy?u0|Rv1jmUsc}Gc0Onz*RI>S^4swk*TpYidH%Gy;_*gH_*apQQUoJ+ z+t*yGGsPbEy{TvAX?YvP<}4mk$W)r@g}rMU;2nNwX&~-OrH*uT4X}2_hY^H}z_r&8 zB=`%KQ&}F$KsbcY*PVWbSeeg;-|t=d(kH_H`n&n<$W$2JCI0@(LdWw<%tQ!7xTNhSuLaB|DeXZsgFr zrB`8N`lSIR;{w@V&_98voBeZGWQRlUVD-)3>#1ceXvt!>ou1dSDFz02*F8Q{u!lzr z@pxR>7oRIdzK)7kgWyo@?U#=#5?I^q#kMH7G$tJo!B!lDFg!N5Hk>+vLll|scYg8U zqn{48aWmYfv_de0lgV$hMEGl#YtyCJ;28%Qe7=n$h(6`=768u;XO~?p4H0fT_ z)WL8lL3sv)v6@aNWU%h08DM|4cJI0=#V}m(5z78($xj9FTLR^KdFGS(^^mf6640M#PDA@QLi+KmeS!Cx%mKlIx9%-dJ~qQ(8UxG z*&?vdNRsOhF8XtsY$f74mIwF26k-jdGJR08bgQb7^k;}wU-5u>Za&3WbQK?2JHXPc zXT|(e^`4Mi2c*{ee-!{_2OV-tho5F+j7 z1{a>?`1IP3nXC?J;)>@H0VFS?kj*BGz+R*rKH3l-@NS%rMK-7jkI2n=w%>#=8Yoai zXkV>yxHxW>{_#+jK4eF624|~48tZpqwRew8DNn5=dlx1MzX>Ct|4+=J@O0nOlh1BIK3y5geoX^^T6MJUoh612lyCNpT9hCdCUB1!!4DzRxw-ANwK&Z zM>D9U={cN+rGwNl|CAWccM}e+s=I2CvWd7QR)s!{7(#3{gi+a}K|t!xqpCnDS*q;I z%bTu$GCrs2!!VwH1r+3Dn7gs-4Gplj6*Z&Ek>V9mc27CM_1M}P76v;Q>|_0KO4hRA>G0@uvk45gqm{o6--9$;ap%pb~m=xm<$W3)wV&%{^NbH(6Qif)=c&J z74M2=A>UI)S)ZRJRfT-U0i9XeZT$D6pd=874QaM!=)2}cnwQV(uR=(x6wjLr9@^_S z+dEzATrH8EVqTZCYxc?$!_p;ZTobS#6?L1jeXzS=eY@g+BX5c#w+w3SjQx?_!-)Ro zoo(aTIEc0jOg{3G1fxgm9q@cd(M>k?(QZ~d!iiBrqK{#324DK3lh&{1~0S$+?%;D5f=F{ z+5FI2{Bux-ztBWgu6!X623GPTOtx z>Jp-6^w0M|Vf)ZDHV0qBitsZa=?h!qDird@X-dMX1VbU*v8 z-^|fBPc^?cZLI@@7ht~DI$?2iE!H(&i3t(U!18(v`5UQ`7Yo8f_-3oD(3_B#aaex( zJrWf)m8Md~aRb@T-OQ7h4_*)wrdt0-8gD_~K>R*GIPIYp2NRit+;;kT$Dx21r9Jju zP8^JFLo{U5i8>bXM;B-BBPCZfTrk)L6o1138D)fXxTYOb&RZ+)m1Q?Kn)@tx*(DtT z8ZaGUp4g8q2PL=kvXwu!`X6fV|!PeL7Y5Wl-gXC=7{9l z8swI{kD>(zjHoybbp^G{6X2%3EAP#B5s;f2=5=vu*;~t=QyxGZB`fYDb3Zz$KIbOY zDFilT9`ERXSSrzIRuRW_G@L7A=#4*>z1m5?Z}y@Iv`#k%E~x?XubY0YM4L*)ygARZCkc%CoZNlR2%55# z^Zn>_iYb~mk@uLT{Rs=^2$~qAz|mg*l9fc%K7$d1I(yb7BE{S;@2Saw%3#zZ|A`}1 z8?g4$x;IB1p?AiGzfJYq?8q7VWOY)2*BkE9GDylJW%`H&PkeSu3D-=h2hk| z%*pf3Pi<-Bczo<%T8eGd=kEA2d5;iQ+>7D}yEm^^BW;BLD%!PldPPF1Dnsqa_9sz$?gT8@5C+5)YdXL{Y_U{FALcwCHCW@uIha3dV4 zx@c;0xLzSkbvRl`Bo;pDz#QGkoL19_Gruod(|q<8m?YNtz>u8)mf6cZ1d7foVsV<- zp9Us**hp*lDUo}0G73grwl z6X7GqR@;0(y@ex~Th-WAbTm}joh{_P`#4tt>XEKa7fh zl9{9fTiVy4Du{i^K@MJK)7j7z0!QS_$yh0XZj!teMO+Zgrs>8Eq3^vAQX)Bw?l5~ zc1*e8F;Pn~H_(+VeW-$76H63|$+~_O2?GDgeCKf}z6r{a;^0d~KN2_T`((GK zqM%Mne8mXo4b`*@(j5q0h57x4`05iv0L#I@Q$DesVP2~E^R100^EVoD@XKIWh@S4l zLXo;UQ|Ynlg2|1zm4igUoqJFLY6z})lN>HH=R`xV#q?(tzW%${;s$fnvg;n<7In~B z?5te>JVAcdgr4Wdqjlr+NBw9SpCPaPq=FS~$W^k#QgOnf5}j7v@t^2N8%hZynM~(o z7&_6urj~Pl>~#yN?!cAYjp7wN|9?A4D0Q46nsk#Bj*X;BeUW0~<@{>fLy-gfF}t}9 zNtid&mr4bOJq>N@L4Xuj3IPK+Wwf07&`zXPtG)AFR^%~XcSdKf51bIgX-!65%VU4o zt*Gy7a8U<0%wgKSbg1FFgESB#^(g|}v=9yYJViZmL4q_SyH&^tqABA{s%%dS%+8(* zb~O#uj-6Zlu!ibi(<&iyZBMG-HmfIugSUH-y?z^9HV{c8WBlq>~9T4283tp8=7Bd~KCoozyZc`%oOMu#M_gS?!c8 zh;rr`$oP})lTH>mq1jzUh$esJ48Wd<7vtsUK1VrfVlFt@eDmZLhN;b95w#N*N4cWz z&6C|u)uRvR@3pa$ncO^b+MZhgl&}P{0$ec+Pz%U%X-VqD-siX~RwF*O>&1DbY9EbS z@U%;rHNYOnLIi#7HPVwcoLS}$`e8jwn6kfWC43I`>rHd4@|jTdb!=y2izfnOwxO1t z=q^;QkAx~po8HEw4?_3a>>l#tl~N#2pPkQ%6VKv}@?>~o5q`}iT$V}8nE$qG!{ue} zl&6l#8Fz%|yr{qY z6;uU@(2UBI7j-LLrOHBrpK+Q1*4MFX04mxV(@Ov8OAT??}{XkY2&a zh?B6v<-_#AYB*OnfYS9#g@#c*hz~cL{k{j+vZ;LD-QtWzaX&+$`y()N0Bj3Oe7u>G z`_>KoEygKgWL`08B7zEk3BJg=B`L}vGRz_lA+B~y-@Fs|0I<-fA;!H1E`Ymw#p`r6 zEr9o%UQt1hzl|Vt#+gp~M+>V+e4FHHv{ADVF&s|(JIp{0T9}q{Fe`_<^m;G>Oz#OTU#{Kd@!#EyS4C^9>(IwCUTugm zQ<45L7={392j|g0wysmRIM+1yJi~fmVe{(a2HoSgys`*Yu}QZE?%!DCUa=-Dwl5C2 zma{_^4S%7p43NduC8wSF3e*C(z*oaola2q$2mNS|#a=P6`j#NgxCYo8E0RJpcAC_g z$B>(fO!W`E(1;wfa<(VWIpVN*s##%|Nm-JRo69mIH<7bWUU=nLIiQm(ZC!_3+cN9x zwQ<79ZdzVqBu=N$^Abt_qbk#%N9F@w@c>*S^9N-|16t zSH!7c<_rWo(_+fS4*Fg@3lFyir6BS(vnQ%ElqFIi^Dz%$MbhVK4j?pofOQnld%?sq`X z4b}-OB}HOPXz-^5(r_A;xfmbuJL)rX#nZ<%CKoyg=($Uy=hdzOUg9{Sj4n7VlR7Fg zvr>;1CpoSlo1J$<9<~>OnIdWQ>#L!Aa{`kg9^YV%*{yeNU6)lBH-FN8oU$%VT4kE0 z%$qk&TFmuhz05aguGy*_i7*m1d)fE+f;N8UYH?K_Jyp^SgC8~lw{E+VD>1a%0*%i4 z6_akGH`WBG6W8M(^4^S3`ejHARybcC+H=_(UxcyGrajZuV`9`~EE3jud$QesI|CWJ zO~)qTv6r0LX~0g3Q^gsEO$D3ni*`+>Co)C|U#$;2RwHce*o#-W*^7mCje#+^b^6MI zy+1Bc(=svo*w!E?GD`7(e!IhTw=7KMwX+RI%H?p_)%|HkzVK{s!OdWDdg#f z=C7Hc7F)_WxSRFyxCrvC*+~O|?k~VxN>4WRo1V8=j1zmRLqr>Re(p&d~z^MXugUStoYKBE0S6zmuv(>!Mmxzx1f}f3W+{e#_j?*4(1O&cHG< zC<5X*P`=V8@L>vT*oZtW?ua~@hFLKzBDa`PxCPc*%lChi+B;Wlt^90)-OSHSlR7;k z5>dxR{6|x^$|6RiUX^i&gOCk1zREI`eEF4Y8oP2?G5Svna3`@Y3WquQt{||XtfD?u z<5i05iFB~qV_XyezvK?dHq?ud!|g7}M!2v46E?V-8cyX@llcf3)0IXLMANeIY>p`xp@JY z_QqXA#Cg%ohRE&_f~(quh_g~_Pf21677Y24u4yaV7VoRKwV<5h0T@D?sCaH$ zc?69NY=Q_?R#RoS%72=cO*Gv@WfF68;oqc@zn~kz?rHnw*E);vCS^|CI97O4ywNzk6RoZjcEFy zRAPz8PK`EkAu-heJN*K_Z2#Hq=UW5x6RJ@2%D9c`UAk-s=TGSjcRA>EYJ$K14AN2h z@Q=BnJ;rsV*vC861RC*EpB8DB<~r^zsg~wk(2H_hJY>|xH}us;sjw|3VK=nR%g=6a zJh9x^^I^H( zVdzpoG{pEWdafJxNO6#6r?iTAE-BUyzu|L9-gSavmL&k3e&^yN!}(5@XPkJvPraZV z95vc_EYIb>#d2G-Q*^&F%E{~AFb}v`BvpBT(pSK|K9_tzOYQmy=`S{c0+9$S?L7m@ zODphLaUCfAzFoesSh!LTJwiC&mm@{0#*2gzShwmZi`QJ!#B9^6GeKioG#7&}iXVpM zpnpS{Oy!30WclJ(ghipSsvj{gsq@?UD8+?pj5!Y@e~9iju2sLvq)BN;zrk`4IZea8 z2DhBruM1Z8fqEC&S-dZ7r$;oZR#Tzo13*DlG=%&FhrT=~t1h07V4`HszRI9eSz{HO zWlFMc;JW=(XSD7PMZ@j*fu%_=GjGW;AHcW%Vwa|IPjmZw=`|(5G0UeX$`@ruv7`iCsF^Mnd({3II0DO%on#;)tn{3?Q^i!Tg#pX;hXMf;wB#M-sP%| z$qN_?(ylo&uZ+AC?016u3F5O}!X1m3M08iz*ebBQ zUo$jDn&}W1J-p}<*bO43-k_skX{8onct%pO3VKDshHOI|R^` zNvFsp21!ZPcgVD>OE!NPgk~SpPUG=EU=TT?YFyHsYH5Vz#0kxa_z2e?h=C*3Qe8sK z&%lM9HCig%_aDQk$kOM`^d^CgF1gmh?r#J@))sh?xO40kQ0LDunrf%25={6e?S-!B z2Y#NW=mlv_oxseEKPYaNvzkHOONwg zAe`8F60H~-%rH9fl^8GDFsm3kGt&^o4EK&%?)oZwoWcxDADe4AUOvmx&Zaf{ldOQ+ zU_jZrV#5zEH9z#R8LNYB2&t5?vKnN(|gD(?9GEA~P_{l7|KRkwcI*P@6LX z#_QT7-TN$tT-p-L#Y;2%)Gh?;Y}Ccy1oX`705u;1B|ju>?hEk#B{{De+6rDs(JoR7xH-^-dJjRhUxBU9r4~(tskVs7HG#;5v4!g(yG__NA z%1b&mz2}DJ8!Yv|7;(#I+%=o+-n>uu&)CiNvuc90k7%Xwq=5>EszUQ?Ep|6`(w;xX z_x0B~?V^sVLaYC?oLutj*r1u#-pl{$X+^O~bLGGKAN`a6yq5Y~KS1qi4Cnf1HaYFG zihpBdA6@K;pC*htMui#P+{4jmJpGg6Z>}Lqt4#jzg6_ktKx*S4v3Je^eK@J?^$h9= z>a*<%=HDaLWs43|Y~*;T%HGFAfWiV3pd+|Dwp2D=UoD2!$y|3USySAVBwdL-sFr5` zJ}niCdCwswv-7qrNNLC1*{mQReyp7fp z`@H%96}CbEJ+ibPxTXcjuU_H-5II_8gq^K*1>T$m`&4qVYHVeEgKoIG3*z`|B}x^& z5=f#ITs^W#Cb9)*DszN*i)}woa6~^9A_28h?X{O(>zw3MawU)rcRArzwfOmPau0H6 zaY3`~Eops3ot1qw=ziE5di1fL^I>O=O6SJMy|=d>(KR{o%)`BR_dilgcKVH-_28eQ zBA<-(Pdn?^|0B8mU+K}#dUfll$SWiLKM7R&pXBy`rT5?^$&rh%yc^;?$z`)ZL7DXB8N-c^h-C8L-~Dg>(4fu-61awq098=r~ggt zw)(q3IZ!h7M*Zou)&KUt$Cv(pilg7Cz1O*KuKqXK>kReT;JyJR*-!HCXPu!WprplS zck6$X|GK*RzskKgxo^DxNB>vn{~N{s>BjB*hQ44eFE`gX(Xn&jz7%6%rdv*a zPSV^Rf4-N2NyythzUv6EoOH*mE9Ay|Iuou%f8L=Kd_{l#1z<-tA+dO42e7HVOjQQ| zhzlQglurGdkdA0%-7v8k7ry6-TMx*KJwJTn@V%drrT# zjJN!+Kpj~konIcJ=1VNgC&bnSC)hlP4$kyIZVeu_M9GK+1 zA2l`JggQrsZRz7&N-%1)#jn!qat#P=abZ3t^SoW2bI1h~gr;&xY%ZQamSnlCB}zA#Hx^eeKW&1b)QD@Dw5mGbvh(nPo;oR!{A~W|nxfsw9;^ zT^y7Z>op00`HU9FTqS|M0l}P6-Qz8-1AzWXh%i4MqdpkJ278}z52=G zf;S(+w=%|(jA~e~-=wBel(?NN=u$^5SUD|B_O;5jSfl#kT>a(uTC}xHoJ!zCWcPk7 zFIJf8%ac(|7gdlP5BEUxwnHT=wh^)JtX>J+hiam5M}fnjB0!QL=VPHkS<)nqe8U~d zzzZ2QJT2R0=aD5$^VF{(T;=2_GCnFxOD-O;%Db1r#D>{5?otyeEF3wRHWuK_sq5yf zbx9GkJH1HJNso%m`{Pzu}N9` zqm+7<@vD;WK@Y1HX(2V`h7^vU5T;z{?4#65bwVt88oH7LUESTj@B(WqANS<}#y0QT zL;jZu>-`CFZ<*K5x~~+>jP>wUVPZ=Q`(yd-u?|i=u7fN@g1LV2eWT9I5SlJCH5vAXpbM4{c)+LGuVv zsCwj`@9)OJtlJCVs9Ks0D}I>G-mWOC!&%cs;)uL|OizY$czzu~OFtvdV;p`AwZpJ< zbhnGG=`RdWPoq769 zTjWTPoRz1ycJBBsO==sI$~tGD&}Y=rlx9~!o7!Ph%}#m)LtzGI)zoHd!a5fyp2>q= zX7yGA3zYXsk>%}6YgrhIynfBw&h(hPRs8i*`NmenBOI7-iWRP1>I@6#TTHlT#%)OsgKBr?g(IOr-e&^jf(o9LT)w44+*163y{P3A(I{Zjxd`{>>X>P5{r4uO2c4fDwYOp z(H2OOR^&F*xNc9Pyx5Vl6Rcx8CC@e5`oo5+&O4;XHxzuLW#JWiA@HSoDW4s-*W`sG z7<*xJ*ln}+XU>a{#M@A~4>w#_tt5kSk)1Dsmn`RL+{cOV&1SoGqcw3gUK3o0?;-MM zCGu!&*U^x?abbd@s)x2g&=}TiaUUU8o=Q$&;L8xA7IxL2V^cz;1%HGo(@Z^mY>NU{ zM1|n*zXM;-N_j)D2Tdl}#Kt;`(~=JhEM>3;*dT#nykmDLKgs$j1C)1Ph;ISxMb_7{ z_TSr27b946b#lH1)Z^EQP-!*2#gH|2z_%seAxzTX5o>Tal_HJRed?$(8smnARA1Qs zu0)t~LK1VXM*sac$Z!Qe^5o)YT*b%laE-D3Q`02l(?X%CIkQq|HG0UN0Lk==fZOVz zZLH*tdH!^8)%X>N z4a-YIpN|XP+-E_y{Didhgtw8oxD`LodeCd<+;?LUWFdZ;RTO-xz%i_DSl-$`=6Kfq3 z5nMUyap?k~I7%&c{jxFpjU9~jbVQ<8dP7bqkofzezpv%r0X)(}2!`|oo!}6p%8H90 zigFN}Y6()x;MCA@;)b*&n~OtZF}{yBz=cu>;HzJ6Va?c!ed*zH5DOB~Io(17OVhcI zA!Rc+&HdQvv?1rOAVri=jaGSlU6+XZ`2@?TX$f1W4jqY2PurZu_6_5SWnFGHLPRen z`73{B%evEtLo!==39)bOIP$g^n@~8@-3z`j>x7Ak^-GJ8N(cU!bVEUOnns6SbV_$< zSM5zW5b|!~9`&Tz@zodBJ>rz(GBsP2?d7C?HT=!M$L~7Z$G^L@ zEVc<{>53m5Ae9V(BO4)H5!R>O4GaanqtbHEdPE7Q6|JXL9d&dOV-xpPN_=-fFfXJs zyMxH(HR6eMZsZaZjcn7raRPilSr_DLyNouPc`5xnt3S~7Ze&RvJ@7D>@d4;RLzHK9 z-A(DD1ynAYM>#hFkhox)7W5QnZ~@Td3ht)GllsXON9;lx1itK4WHePDbY#J@f_Ohj zrHUJeH0Pk)tOgU9f(bZbMKjoD7buq;@lJ(N+=kqJ5!p+)n=AZN`}{GqjJx*~?EoBR zgfyzbH~Yu8iNwKcy#uXDYV@|W^;kUjueCu5SV=Uq#f19q#SwmnVgnU^-nQv@yb8_W zq-c`82_uJ$a5*D@batTmA@L7IPNLs>Me+bbW}dYodTyhekTvL{I`}uIL!68?^O+!J~&%8uKHXlA32R4UB~i0|cza&WJ8 z+rDA)oQ|y6?bQ(iEM@~!Pi^S_(+huDTHV&wp4c^yDW11e&=&S_@Q8GL$U~AJPMOGC z2r_nF`Q{4Jb?Mu3kNw>BW%_F(jZ6CJrf6uuEtiO48O5%Mog-UI499*QY~w`X)Q1@E zsHR*%VJS=5A%`KyatjlBZ)yC{hp9t)uTBlK=3a)sd>-yf>$dS|V|dipaW-bM9QaN! zrfvH7ciH|d8`)&ze2ZIsq{KAp z_LzTl4YiVUzkl~>!`lDKAt6!`zAsg=G8rCpUacFBrW4LP&gp#{p;53PYMRWQ>XO81 z|J_n?Aqg0bJ*bXqBjBwwxH;!^JRg2A>e;}5wa#go_tK&4C3M*JXQ%sKq(9;GYgrFh z;qfjv?J5uWRfw{w^CxBTyWrgM@8MU+Hp(Sx)R19R^`jn}F_2^bh^1z+(a`t)zrzX<)*{U?kqV44DhYyanPob z;?7#}0J_2X3qVxcbqo`1`$&kgTg*IVkC?1%HnpSqyTGqhHS_3=_eK>D@hl22+)v@O zRSM&L_RXb2*QWFa32KuE!z6kH(~apRV^Jvk7MLwbN7L_|2M5ZA8>!+IqVL zW@x;nI8QgvCX?-^%jB5GoGbz2-^HB1#a|+K0;kfShi0Vt$KA8C5XK&l!we)_irL|CxyZYgT;{U7cN`sm>!?21RiqEXxMMk;KggL!~HUv<}6B6vl!uBXr~tDu_}T3>2+{;DNw^ zXsDnF6@l@Hcz{TEgCe89`pwR_yU+W)=kxvBAKTuyVl6Z#5-69jTdIxXZ`%h@*ADJ_ z?>5;9kJTa*;;IzKoc6NLv_gu*b)H_)scQ4b?V~L2liSr>Rtewo-XE;hGubhsDSXm2 zu{%gVcYV)1X5NK0#)u%_zS33Ti1ZsRu~OgSID~Vsi1DNgjRESI1-5!ix5nj+3Xb{Y z=cxo23!19-_vS5Ack0$5){UxxkjBmDH7=@0w}v0C>(Z?B>rmcaV_CM-A#8eiz3~*1 z?l=BccHcmDW@xZvpD%3Fme^2{8j_SfeM85|zrpgLOE#p;G=A~#ozdu_NspG6?}O#7 z0arWf*W^W7u-*KvRu#Ii(RgVT0MFVxi*sPRz}0 z|48U}V)Gi#5oQ0Ow3dhL=&quq^6`q2l9ei*;i>M_D~#Z@Z$Fld~ba2f~;2J6GgDoyzLHwg06=~%Yq`T-vDYsxPtMn@WrED z>0gDg9g}-g;e`b(d3aUoE2r#ZyH%x*3yiE%jyD73o@m@hVNumu8~p0$ve!aKvCmT7 zyxthlaH9ZKmnkjWIHuhPjBFO^{Sz3=M^awurez*=zN7RGCr zW>G4)|NZOMBOxc2UrKGy*rZyUVNxL9f5$?SMVdTeogJGS}U2`_n1Y(~j} z_3q7k{2VJbfl_wp+EhK#pttKX z#WUuop5OEf&-#~b-%WAmxJ&c%)y;=&OZ{T6cQf~>5BE;*YhI}z{`w9mk73~P*P-ky z$s-18)Au~cN|Ya#T{yitky<`A{7pw-S-ZPkd6h%)Q_VJ;H&2_VO(zQ5)P|@yQifwF z98W$;B4P|#fDXtz0D!?{GTF?J2Imh34-e8t^HJcw0XU4KU^6`gvh88 zEXv7Ao5mlLM9LBL|G0h9h%+bsO#M6%;Dh}EQ&)htvCUq uA5fxXQf0nGf&;SgnWMKwER+CJ2Cc3#9L8{MhYTi*?#wc@xA)nx$?!iuo`7@! From 5bd4bb7817093e9e3fe2671832de3486cb58b28b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 08:14:19 -0300 Subject: [PATCH 047/591] [media] docs-rst: add tabularcolumns to all tables LaTeX doesn't handle too well auto-width on tables, and ReST markup requires an special tag to give it the needed hints. As we're using A4 paper, we have 17cm of useful spaces. As most media tables have widths, let's use it to generate the needed via the following perl script: my ($line_size, $table_header, $has_cols) = (17.5, 0, 0); my $out; my $header = ""; my @widths = (); sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) } while (<>) { if (!$table_header) { $has_cols = 1 if (m/..\s+tabularcolumns::/); if (m/..\s+flat-table::/) { $table_header = 1; $header = $_; next; } $out .= $_; next; } $header .= $_; @widths = split(/ /, $1) if (m/:widths:\s+(.*)/); if (m/^\n$/) { if (!$has_cols && @widths) { my ($tot, $t, $i) = (0, 0, 0); foreach my $v(@widths) { $tot += $v; }; $out .= ".. tabularcolumns:: |"; for ($i = 0; $i < scalar @widths - 1; $i++) { my $v = $widths[$i]; my $w = round(10 * ($v * $line_size) / $tot) / 10; $out .= sprintf "p{%.1fcm}|", $w; $t += $w; } my $w = $line_size - $t; $out .= sprintf "p{%.1fcm}|\n\n", $w; } $out .= $header; $table_header = 0; $has_cols = 0; $header = ""; @widths = (); } } print $out; Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/cec/cec-ioc-adap-g-caps.rst | 4 ++++ .../uapi/cec/cec-ioc-adap-g-log-addrs.rst | 10 ++++++++++ .../media/uapi/cec/cec-ioc-dqevent.rst | 10 ++++++++++ .../media/uapi/cec/cec-ioc-g-mode.rst | 6 ++++++ .../media/uapi/cec/cec-ioc-receive.rst | 6 ++++++ .../uapi/dvb/fe-diseqc-recv-slave-reply.rst | 2 ++ .../uapi/dvb/fe-diseqc-send-master-cmd.rst | 2 ++ Documentation/media/uapi/dvb/fe-get-info.rst | 2 ++ Documentation/media/uapi/dvb/fe-type-t.rst | 2 ++ Documentation/media/uapi/gen-errors.rst | 2 ++ .../uapi/mediactl/media-ioc-device-info.rst | 2 ++ .../uapi/mediactl/media-ioc-enum-entities.rst | 2 ++ .../uapi/mediactl/media-ioc-enum-links.rst | 6 ++++++ .../uapi/mediactl/media-ioc-g-topology.rst | 12 ++++++++++++ Documentation/media/uapi/rc/rc-tables.rst | 2 ++ Documentation/media/uapi/v4l/buffer.rst | 16 ++++++++++++++++ Documentation/media/uapi/v4l/dev-raw-vbi.rst | 4 ++++ Documentation/media/uapi/v4l/dev-rds.rst | 6 ++++++ Documentation/media/uapi/v4l/dev-sdr.rst | 2 ++ .../media/uapi/v4l/dev-sliced-vbi.rst | 18 ++++++++++++++++++ Documentation/media/uapi/v4l/field-order.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-002.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-003.rst | 4 ++++ Documentation/media/uapi/v4l/pixfmt-007.rst | 18 ++++++++++++++++++ Documentation/media/uapi/v4l/pixfmt-013.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-grey.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-m420.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-nv12.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-nv12m.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-nv16.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-nv16m.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-nv24.rst | 2 ++ .../media/uapi/v4l/pixfmt-packed-rgb.rst | 2 ++ .../media/uapi/v4l/pixfmt-reserved.rst | 4 ++++ .../media/uapi/v4l/pixfmt-sbggr16.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-sbggr8.rst | 2 ++ .../media/uapi/v4l/pixfmt-sdr-cs08.rst | 2 ++ .../media/uapi/v4l/pixfmt-sdr-cs14le.rst | 2 ++ .../media/uapi/v4l/pixfmt-sdr-cu08.rst | 2 ++ .../media/uapi/v4l/pixfmt-sdr-cu16le.rst | 2 ++ .../media/uapi/v4l/pixfmt-sdr-ru12le.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst | 2 ++ .../media/uapi/v4l/pixfmt-srggb10.rst | 2 ++ .../media/uapi/v4l/pixfmt-srggb10p.rst | 2 ++ .../media/uapi/v4l/pixfmt-srggb12.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-srggb8.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-uv8.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-uyvy.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-vyuy.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-y10.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-y10b.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-y12.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-y12i.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-y16-be.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-y16.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-y41p.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-y8i.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-yuv410.rst | 2 ++ .../media/uapi/v4l/pixfmt-yuv411p.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-yuv420.rst | 2 ++ .../media/uapi/v4l/pixfmt-yuv420m.rst | 2 ++ .../media/uapi/v4l/pixfmt-yuv422m.rst | 2 ++ .../media/uapi/v4l/pixfmt-yuv422p.rst | 2 ++ .../media/uapi/v4l/pixfmt-yuv444m.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-yuyv.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-yvyu.rst | 2 ++ Documentation/media/uapi/v4l/pixfmt-z16.rst | 2 ++ .../media/uapi/v4l/subdev-formats.rst | 2 ++ .../media/uapi/v4l/vidioc-create-bufs.rst | 2 ++ .../media/uapi/v4l/vidioc-cropcap.rst | 4 ++++ .../media/uapi/v4l/vidioc-dbg-g-chip-info.rst | 6 ++++++ .../media/uapi/v4l/vidioc-dbg-g-register.rst | 4 ++++ .../media/uapi/v4l/vidioc-decoder-cmd.rst | 4 ++++ .../media/uapi/v4l/vidioc-dqevent.rst | 18 ++++++++++++++++++ .../media/uapi/v4l/vidioc-dv-timings-cap.rst | 4 ++++ .../media/uapi/v4l/vidioc-encoder-cmd.rst | 6 ++++++ .../media/uapi/v4l/vidioc-enum-dv-timings.rst | 2 ++ .../media/uapi/v4l/vidioc-enum-fmt.rst | 4 ++++ .../uapi/v4l/vidioc-enum-frameintervals.rst | 4 ++++ .../media/uapi/v4l/vidioc-enum-framesizes.rst | 6 ++++++ .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 4 ++++ .../media/uapi/v4l/vidioc-enuminput.rst | 6 ++++++ .../media/uapi/v4l/vidioc-enumoutput.rst | 6 ++++++ .../media/uapi/v4l/vidioc-enumstd.rst | 6 ++++++ Documentation/media/uapi/v4l/vidioc-expbuf.rst | 2 ++ .../media/uapi/v4l/vidioc-g-audio.rst | 6 ++++++ .../media/uapi/v4l/vidioc-g-audioout.rst | 2 ++ Documentation/media/uapi/v4l/vidioc-g-crop.rst | 2 ++ Documentation/media/uapi/v4l/vidioc-g-ctrl.rst | 2 ++ .../media/uapi/v4l/vidioc-g-dv-timings.rst | 6 ++++++ Documentation/media/uapi/v4l/vidioc-g-edid.rst | 2 ++ .../media/uapi/v4l/vidioc-g-enc-index.rst | 6 ++++++ .../media/uapi/v4l/vidioc-g-ext-ctrls.rst | 6 ++++++ Documentation/media/uapi/v4l/vidioc-g-fbuf.rst | 6 ++++++ .../media/uapi/v4l/vidioc-g-frequency.rst | 2 ++ .../media/uapi/v4l/vidioc-g-jpegcomp.rst | 4 ++++ .../media/uapi/v4l/vidioc-g-modulator.rst | 4 ++++ Documentation/media/uapi/v4l/vidioc-g-parm.rst | 10 ++++++++++ .../media/uapi/v4l/vidioc-g-priority.rst | 2 ++ .../media/uapi/v4l/vidioc-g-selection.rst | 2 ++ .../media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 4 ++++ .../media/uapi/v4l/vidioc-g-tuner.rst | 8 ++++++++ .../media/uapi/v4l/vidioc-queryctrl.rst | 10 ++++++++++ .../media/uapi/v4l/vidioc-reqbufs.rst | 2 ++ .../media/uapi/v4l/vidioc-s-hw-freq-seek.rst | 2 ++ .../v4l/vidioc-subdev-enum-frame-interval.rst | 2 ++ .../uapi/v4l/vidioc-subdev-enum-frame-size.rst | 2 ++ .../uapi/v4l/vidioc-subdev-enum-mbus-code.rst | 2 ++ .../media/uapi/v4l/vidioc-subdev-g-crop.rst | 2 ++ .../media/uapi/v4l/vidioc-subdev-g-fmt.rst | 4 ++++ .../v4l/vidioc-subdev-g-frame-interval.rst | 2 ++ .../uapi/v4l/vidioc-subdev-g-selection.rst | 2 ++ .../media/uapi/v4l/vidioc-subscribe-event.rst | 4 ++++ 114 files changed, 430 insertions(+) diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst index 2516d4c3a4c8..4e70eae7e6ab 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst @@ -44,6 +44,8 @@ returns the information to the application. The ioctl never fails. .. _cec-caps: +.. tabularcolumns:: |p{1.0cm}|p{1.0cm}|p{15.5cm}| + .. flat-table:: struct cec_caps :header-rows: 0 :stub-columns: 0 @@ -89,6 +91,8 @@ returns the information to the application. The ioctl never fails. .. _cec-capabilities: +.. tabularcolumns:: |p{4.4cm}|p{1.5cm}|p{11.6cm}| + .. flat-table:: CEC Capabilities Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index 359f7b3aa91a..11fac7e24554 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst @@ -69,6 +69,8 @@ logical address types are already defined will return with error ``EBUSY``. .. _cec-log-addrs: +.. tabularcolumns:: |p{1.0cm}|p{1.0cm}|p{15.5cm}| + .. flat-table:: struct cec_log_addrs :header-rows: 0 :stub-columns: 0 @@ -205,6 +207,8 @@ logical address types are already defined will return with error ``EBUSY``. .. _cec-versions: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: CEC Versions :header-rows: 0 :stub-columns: 0 @@ -239,6 +243,8 @@ logical address types are already defined will return with error ``EBUSY``. .. _cec-prim-dev-types: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: CEC Primary Device Types :header-rows: 0 :stub-columns: 0 @@ -305,6 +311,8 @@ logical address types are already defined will return with error ``EBUSY``. .. _cec-log-addr-types: +.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| + .. flat-table:: CEC Logical Address Types :header-rows: 0 :stub-columns: 0 @@ -373,6 +381,8 @@ logical address types are already defined will return with error ``EBUSY``. .. _cec-all-dev-types-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: CEC All Device Types Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index 36eb4f907d30..b4c73ed50509 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -54,6 +54,8 @@ it is guaranteed that the state did change in between the two events. .. _cec-event-state-change_s: +.. tabularcolumns:: |p{1.8cm}|p{1.8cm}|p{13.9cm}| + .. flat-table:: struct cec_event_state_change :header-rows: 0 :stub-columns: 0 @@ -80,6 +82,8 @@ it is guaranteed that the state did change in between the two events. .. _cec-event-lost-msgs_s: +.. tabularcolumns:: |p{1.0cm}|p{1.0cm}|p{15.5cm}| + .. flat-table:: struct cec_event_lost_msgs :header-rows: 0 :stub-columns: 0 @@ -106,6 +110,8 @@ it is guaranteed that the state did change in between the two events. .. _cec-event: +.. tabularcolumns:: |p{1.6cm}|p{1.6cm}|p{1.6cm}|p{12.7cm}| + .. flat-table:: struct cec_event :header-rows: 0 :stub-columns: 0 @@ -177,6 +183,8 @@ it is guaranteed that the state did change in between the two events. .. _cec-events: +.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| + .. flat-table:: CEC Events Types :header-rows: 0 :stub-columns: 0 @@ -206,6 +214,8 @@ it is guaranteed that the state did change in between the two events. .. _cec-event-flags: +.. tabularcolumns:: |p{4.4cm}|p{1.5cm}|p{11.6cm}| + .. flat-table:: CEC Event Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst index c0e851f357d0..d213432eedd7 100644 --- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst @@ -76,6 +76,8 @@ Available initiator modes are: .. _cec-mode-initiator_e: +.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| + .. flat-table:: Initiator Modes :header-rows: 0 :stub-columns: 0 @@ -119,6 +121,8 @@ Available follower modes are: .. _cec-mode-follower_e: +.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| + .. flat-table:: Follower Modes :header-rows: 0 :stub-columns: 0 @@ -211,6 +215,8 @@ Core message processing details: .. _cec-core-processing: +.. tabularcolumns:: |p{1.9cm}|p{15.6cm}| + .. flat-table:: Core Message Processing :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index 7167a90209df..1a06c8d62ac9 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -75,6 +75,8 @@ result. .. _cec-msg: +.. tabularcolumns:: |p{1.0cm}|p{1.0cm}|p{15.5cm}| + .. flat-table:: struct cec_msg :header-rows: 0 :stub-columns: 0 @@ -252,6 +254,8 @@ result. .. _cec-tx-status: +.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| + .. flat-table:: CEC Transmit Status :header-rows: 0 :stub-columns: 0 @@ -320,6 +324,8 @@ result. .. _cec-rx-status: +.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| + .. flat-table:: CEC Receive Status :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst index 7bd02ac7bff4..7b32566b77a3 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst @@ -42,6 +42,8 @@ Receives reply from a DiSEqC 2.0 command. struct dvb_diseqc_slave_reply ----------------------------- +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct dvb_diseqc_slave_reply :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst index 58a5e6ac10bd..865914bf4efe 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst @@ -42,6 +42,8 @@ Sends a DiSEqC command to the antenna subsystem. struct dvb_diseqc_master_cmd ============================ +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct dvb_diseqc_master_cmd :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/fe-get-info.rst b/Documentation/media/uapi/dvb/fe-get-info.rst index dfc7644f9dac..80644072087f 100644 --- a/Documentation/media/uapi/dvb/fe-get-info.rst +++ b/Documentation/media/uapi/dvb/fe-get-info.rst @@ -47,6 +47,8 @@ returns an error. struct dvb_frontend_info ======================== +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct dvb_frontend_info :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/fe-type-t.rst b/Documentation/media/uapi/dvb/fe-type-t.rst index 8ca762b42e4d..fa377fe9e104 100644 --- a/Documentation/media/uapi/dvb/fe-type-t.rst +++ b/Documentation/media/uapi/dvb/fe-type-t.rst @@ -13,6 +13,8 @@ fe_type_t type, defined as: .. _fe-type: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Frontend types :header-rows: 1 :stub-columns: 0 diff --git a/Documentation/media/uapi/gen-errors.rst b/Documentation/media/uapi/gen-errors.rst index d6b0cfd00a3f..d37284d50e56 100644 --- a/Documentation/media/uapi/gen-errors.rst +++ b/Documentation/media/uapi/gen-errors.rst @@ -9,6 +9,8 @@ Generic Error Codes .. _gen-errors: +.. tabularcolumns:: |p{1.0cm}|p{16.5cm}| + .. flat-table:: Generic error codes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/mediactl/media-ioc-device-info.rst b/Documentation/media/uapi/mediactl/media-ioc-device-info.rst index 467d82cbb81e..567f5515a791 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-device-info.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-device-info.rst @@ -42,6 +42,8 @@ ioctl never fails. .. _media-device-info: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct media_device_info :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst index 12d4b25d5b94..a51c4cc9f6d3 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst @@ -53,6 +53,8 @@ id's until they get an error. .. _media-entity-desc: +.. tabularcolumns:: |p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{11.5cm}| + .. flat-table:: struct media_entity_desc :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst index 87443b1ce42d..f4334f5765c6 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst @@ -57,6 +57,8 @@ returned during the enumeration process. .. _media-links-enum: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct media_links_enum :header-rows: 0 :stub-columns: 0 @@ -93,6 +95,8 @@ returned during the enumeration process. .. _media-pad-desc: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct media_pad_desc :header-rows: 0 :stub-columns: 0 @@ -127,6 +131,8 @@ returned during the enumeration process. .. _media-link-desc: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct media_link_desc :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst index 2e382cc7762c..750dd11dbe03 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst @@ -51,6 +51,8 @@ desired arrays with the media graph elements. .. _media-v2-topology: +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| + .. flat-table:: struct media_v2_topology :header-rows: 0 :stub-columns: 0 @@ -145,6 +147,8 @@ desired arrays with the media graph elements. .. _media-v2-entity: +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| + .. flat-table:: struct media_v2_entity :header-rows: 0 :stub-columns: 0 @@ -188,6 +192,8 @@ desired arrays with the media graph elements. .. _media-v2-interface: +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| + .. flat-table:: struct media_v2_interface :header-rows: 0 :stub-columns: 0 @@ -239,6 +245,8 @@ desired arrays with the media graph elements. .. _media-v2-intf-devnode: +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| + .. flat-table:: struct media_v2_interface :header-rows: 0 :stub-columns: 0 @@ -265,6 +273,8 @@ desired arrays with the media graph elements. .. _media-v2-pad: +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| + .. flat-table:: struct media_v2_pad :header-rows: 0 :stub-columns: 0 @@ -308,6 +318,8 @@ desired arrays with the media graph elements. .. _media-v2-link: +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| + .. flat-table:: struct media_v2_pad :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/rc/rc-tables.rst b/Documentation/media/uapi/rc/rc-tables.rst index 0bb16c4af27d..c8ae9479f842 100644 --- a/Documentation/media/uapi/rc/rc-tables.rst +++ b/Documentation/media/uapi/rc/rc-tables.rst @@ -25,6 +25,8 @@ the remote via /dev/input/event devices. .. _rc_standard_keymap: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: IR default keymapping :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index f75f959b960b..064bc03b7a1d 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -39,6 +39,8 @@ buffer. struct v4l2_buffer ================== +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| + .. flat-table:: struct v4l2_buffer :header-rows: 0 :stub-columns: 0 @@ -282,6 +284,8 @@ struct v4l2_buffer struct v4l2_plane ================= +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -399,6 +403,8 @@ struct v4l2_plane enum v4l2_buf_type ================== +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -513,6 +519,8 @@ enum v4l2_buf_type Buffer Flags ============ +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -762,6 +770,8 @@ Buffer Flags enum v4l2_memory ================ +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -816,6 +826,8 @@ The :ref:`struct v4l2_timecode ` structure is designed to hold a struct v4l2_timecode -------------------- +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -886,6 +898,8 @@ struct v4l2_timecode Timecode Types -------------- +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -939,6 +953,8 @@ Timecode Types Timecode Flags -------------- +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst b/Documentation/media/uapi/v4l/dev-raw-vbi.rst index d5a4b3530b69..95de08b8fbf2 100644 --- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst @@ -102,6 +102,8 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does .. _v4l2-vbi-format: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_vbi_format :header-rows: 0 :stub-columns: 0 @@ -227,6 +229,8 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does .. _vbifmt-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Raw VBI Format Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/dev-rds.rst b/Documentation/media/uapi/v4l/dev-rds.rst index fa32538d4c1f..35117414c86b 100644 --- a/Documentation/media/uapi/v4l/dev-rds.rst +++ b/Documentation/media/uapi/v4l/dev-rds.rst @@ -95,6 +95,8 @@ RDS datastructures .. _v4l2-rds-data: +.. tabularcolumns:: |p{2.5cm}|p{2.5cm}|p{12.5cm}| + .. flat-table:: struct v4l2_rds_data :header-rows: 0 :stub-columns: 0 @@ -129,6 +131,8 @@ RDS datastructures .. _v4l2-rds-block: +.. tabularcolumns:: |p{2.9cm}|p{14.6cm}| + .. flat-table:: Block description :header-rows: 0 :stub-columns: 0 @@ -166,6 +170,8 @@ RDS datastructures .. _v4l2-rds-block-codes: +.. tabularcolumns:: |p{2.2cm}|p{2.2cm}|p{2.2cm}|p{10.9cm}| + .. flat-table:: Block defines :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/dev-sdr.rst b/Documentation/media/uapi/v4l/dev-sdr.rst index fc4053f957fb..3b6aa2a58430 100644 --- a/Documentation/media/uapi/v4l/dev-sdr.rst +++ b/Documentation/media/uapi/v4l/dev-sdr.rst @@ -80,6 +80,8 @@ data transfer, set by the driver in order to inform application. .. _v4l2-sdr-format: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_sdr_format :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst index ec52a825f4d6..9f59ba6847ec 100644 --- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst @@ -105,6 +105,8 @@ which may return ``EBUSY`` can be the struct v4l2_sliced_vbi_format ----------------------------- +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -250,6 +252,8 @@ struct v4l2_sliced_vbi_format Sliced VBI services ------------------- +.. tabularcolumns:: |p{4.4cm}|p{2.2cm}|p{2.2cm}|p{4.4cm}|p{4.3cm}| + .. flat-table:: :header-rows: 1 :stub-columns: 0 @@ -371,6 +375,8 @@ of one video frame. The ``id`` of unused struct v4l2_sliced_vbi_data --------------------------- +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -556,6 +562,8 @@ number). struct v4l2_mpeg_vbi_fmt_ivtv ----------------------------- +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -611,6 +619,8 @@ struct v4l2_mpeg_vbi_fmt_ivtv Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field ------------------------------------------------------------- +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 1 :stub-columns: 0 @@ -652,6 +662,8 @@ Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field struct v4l2_mpeg_vbi_itv0 ------------------------- +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -709,6 +721,8 @@ struct v4l2_mpeg_vbi_itv0 struct v4l2_mpeg_vbi_ITV0 ------------------------- +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -734,6 +748,8 @@ struct v4l2_mpeg_vbi_ITV0 struct v4l2_mpeg_vbi_itv0_line ------------------------------ +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -765,6 +781,8 @@ struct v4l2_mpeg_vbi_itv0_line Line Identifiers for struct v4l2_mpeg_vbi_itv0_line id field ------------------------------------------------------------ +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 1 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/field-order.rst b/Documentation/media/uapi/v4l/field-order.rst index 979fedbb2bda..95e9d2a41f1d 100644 --- a/Documentation/media/uapi/v4l/field-order.rst +++ b/Documentation/media/uapi/v4l/field-order.rst @@ -57,6 +57,8 @@ should have the value ``V4L2_FIELD_ANY`` (0). enum v4l2_field =============== +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst b/Documentation/media/uapi/v4l/pixfmt-002.rst index fae9b2d40a85..27d4e78760ba 100644 --- a/Documentation/media/uapi/v4l/pixfmt-002.rst +++ b/Documentation/media/uapi/v4l/pixfmt-002.rst @@ -7,6 +7,8 @@ Single-planar format structure .. _v4l2-pix-format: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_pix_format :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-003.rst b/Documentation/media/uapi/v4l/pixfmt-003.rst index 25c54872fbe1..8dc86b490451 100644 --- a/Documentation/media/uapi/v4l/pixfmt-003.rst +++ b/Documentation/media/uapi/v4l/pixfmt-003.rst @@ -14,6 +14,8 @@ describing all planes of that format. .. _v4l2-plane-pix-format: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_plane_pix_format :header-rows: 0 :stub-columns: 0 @@ -50,6 +52,8 @@ describing all planes of that format. .. _v4l2-pix-format-mplane: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_pix_format_mplane :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index 39753f6f7b83..95d790cbc152 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -19,6 +19,8 @@ are: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: SMPTE 170M Chromaticities :header-rows: 1 :stub-columns: 0 @@ -117,6 +119,8 @@ and the white reference are: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: Rec. 709 Chromaticities :header-rows: 1 :stub-columns: 0 @@ -246,6 +250,8 @@ The chromaticities of the primary colors and the white reference are: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: sRGB Chromaticities :header-rows: 1 :stub-columns: 0 @@ -345,6 +351,8 @@ are: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: Adobe RGB Chromaticities :header-rows: 1 :stub-columns: 0 @@ -429,6 +437,8 @@ of the primary colors and the white reference are: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: BT.2020 Chromaticities :header-rows: 1 :stub-columns: 0 @@ -548,6 +558,8 @@ is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: DCI-P3 Chromaticities :header-rows: 1 :stub-columns: 0 @@ -621,6 +633,8 @@ and the white reference are: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: SMPTE 240M Chromaticities :header-rows: 1 :stub-columns: 0 @@ -709,6 +723,8 @@ reference are: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: NTSC 1953 Chromaticities :header-rows: 1 :stub-columns: 0 @@ -805,6 +821,8 @@ are: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: EBU Tech. 3213 Chromaticities :header-rows: 1 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-013.rst b/Documentation/media/uapi/v4l/pixfmt-013.rst index 475f6e6fe785..bfef4f4ce6b1 100644 --- a/Documentation/media/uapi/v4l/pixfmt-013.rst +++ b/Documentation/media/uapi/v4l/pixfmt-013.rst @@ -7,6 +7,8 @@ Compressed Formats .. _compressed-formats: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Compressed Image Formats :header-rows: 1 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-grey.rst b/Documentation/media/uapi/v4l/pixfmt-grey.rst index 761d783d4989..844fb67320be 100644 --- a/Documentation/media/uapi/v4l/pixfmt-grey.rst +++ b/Documentation/media/uapi/v4l/pixfmt-grey.rst @@ -22,6 +22,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-m420.rst b/Documentation/media/uapi/v4l/pixfmt-m420.rst index 4c5b2969c039..ff0ed7abfef3 100644 --- a/Documentation/media/uapi/v4l/pixfmt-m420.rst +++ b/Documentation/media/uapi/v4l/pixfmt-m420.rst @@ -33,6 +33,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12.rst b/Documentation/media/uapi/v4l/pixfmt-nv12.rst index cf59b28f75b7..a5b70b8a1273 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12.rst @@ -37,6 +37,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12m.rst b/Documentation/media/uapi/v4l/pixfmt-nv12m.rst index a4e7eaeccea8..cdc24109fdf7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12m.rst @@ -47,6 +47,8 @@ many pad bytes after its rows. **Byte Order.** Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv16.rst b/Documentation/media/uapi/v4l/pixfmt-nv16.rst index 88aa7617f7cf..2cbdc1e6a36d 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv16.rst @@ -36,6 +36,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv16m.rst b/Documentation/media/uapi/v4l/pixfmt-nv16m.rst index b7ee068f491c..98cc0550bf26 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv16m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv16m.rst @@ -39,6 +39,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv24.rst b/Documentation/media/uapi/v4l/pixfmt-nv24.rst index db98f476446e..ebc27b772a38 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv24.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv24.rst @@ -36,6 +36,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst index c7aa2e91ac78..b1122ce0a8e8 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst @@ -974,6 +974,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{2.5cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{0.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-reserved.rst b/Documentation/media/uapi/v4l/pixfmt-reserved.rst index 9a5704baf9fe..d6938cd5e03e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-reserved.rst +++ b/Documentation/media/uapi/v4l/pixfmt-reserved.rst @@ -19,6 +19,8 @@ please make a proposal on the linux-media mailing list. .. _reserved-formats: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Reserved Image Formats :header-rows: 1 :stub-columns: 0 @@ -341,6 +343,8 @@ please make a proposal on the linux-media mailing list. .. _format-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Format Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst index 7f295b48748c..c2224c455e8a 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst @@ -29,6 +29,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst index db4c523f49a9..0a65450e017e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst @@ -26,6 +26,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst index 2736275d080f..48c2469ddd19 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst @@ -24,6 +24,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{11.7cm}|p{5.8cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst index bfe5804bd84e..d8d7fd3f0ec2 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst @@ -25,6 +25,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{8.8cm}|p{4.4cm}|p{4.3cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst index 68ad1717f6d7..1b7eaf652604 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst @@ -24,6 +24,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{11.7cm}|p{5.8cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst index 2a1c0d4924a1..e12d267423c4 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst @@ -24,6 +24,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{8.8cm}|p{4.4cm}|p{4.3cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst index 378581b27d4a..802aefe44b16 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst @@ -23,6 +23,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{8.8cm}|p{4.4cm}|p{4.3cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst b/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst index 6345c24d86f3..faad9b19dadd 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst @@ -26,6 +26,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst b/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst index 51b7b8ef7519..33a7c4fdf046 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst @@ -26,6 +26,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10.rst index 44a49563917c..6a32ecb7f9ad 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10.rst @@ -33,6 +33,8 @@ Each cell is one byte, high 6 bits in high bytes are 0. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst index d71368f69087..b577dbf09a8b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst @@ -36,6 +36,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.0cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst index f5303ab9e79c..54355af154c8 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst @@ -34,6 +34,8 @@ Each cell is one byte, high 6 bits in high bytes are 0. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb8.rst b/Documentation/media/uapi/v4l/pixfmt-srggb8.rst index e88de4c48d47..1a6966b34c6f 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb8.rst @@ -26,6 +26,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-uv8.rst b/Documentation/media/uapi/v4l/pixfmt-uv8.rst index fa8f7ee9fee1..ab73e0b55d05 100644 --- a/Documentation/media/uapi/v4l/pixfmt-uv8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-uv8.rst @@ -21,6 +21,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-uyvy.rst b/Documentation/media/uapi/v4l/pixfmt-uyvy.rst index 87b0081d44ee..4c0c56003355 100644 --- a/Documentation/media/uapi/v4l/pixfmt-uyvy.rst +++ b/Documentation/media/uapi/v4l/pixfmt-uyvy.rst @@ -23,6 +23,8 @@ half the horizontal resolution of the Y component. **Byte Order.** Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-vyuy.rst b/Documentation/media/uapi/v4l/pixfmt-vyuy.rst index 5d8f99f173b6..cdebbd3a5ad2 100644 --- a/Documentation/media/uapi/v4l/pixfmt-vyuy.rst +++ b/Documentation/media/uapi/v4l/pixfmt-vyuy.rst @@ -23,6 +23,8 @@ half the horizontal resolution of the Y component. **Byte Order.** Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y10.rst b/Documentation/media/uapi/v4l/pixfmt-y10.rst index d22f77138289..887e6f052879 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y10.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y10.rst @@ -23,6 +23,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y10b.rst b/Documentation/media/uapi/v4l/pixfmt-y10b.rst index 5b50cd61e654..5f5219904a62 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y10b.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y10b.rst @@ -26,6 +26,8 @@ pixels. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y12.rst b/Documentation/media/uapi/v4l/pixfmt-y12.rst index 7729bcbf3350..6148371909f8 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y12.rst @@ -23,6 +23,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y12i.rst b/Documentation/media/uapi/v4l/pixfmt-y12i.rst index 8967e8c33b47..70f2b2c1f57b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y12i.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y12i.rst @@ -29,6 +29,8 @@ these pixels can be deinterlaced using pixels cross the byte boundary and have a ratio of 3 bytes for each interleaved pixel. +.. tabularcolumns:: |p{8.8cm}|p{4.4cm}|p{4.3cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y16-be.rst b/Documentation/media/uapi/v4l/pixfmt-y16-be.rst index b16874951f0f..bc968c246ec5 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y16-be.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y16-be.rst @@ -27,6 +27,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y16.rst b/Documentation/media/uapi/v4l/pixfmt-y16.rst index 10e2824da147..deb59e2a62a7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y16.rst @@ -27,6 +27,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y41p.rst b/Documentation/media/uapi/v4l/pixfmt-y41p.rst index 4760174a4668..d160e3dc9115 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y41p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y41p.rst @@ -30,6 +30,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{2.5cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{0.7cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-y8i.rst b/Documentation/media/uapi/v4l/pixfmt-y8i.rst index 7fa16ee85ab7..8b13c7476efb 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y8i.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y8i.rst @@ -24,6 +24,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv410.rst b/Documentation/media/uapi/v4l/pixfmt-yuv410.rst index 8a5d1a2ee005..5d343d99922f 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv410.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv410.rst @@ -37,6 +37,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst b/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst index f85e3f388cbe..13a31d90bf11 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst @@ -33,6 +33,8 @@ have ¼ as many pad bytes after their rows. In other words, four C x rows Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv420.rst b/Documentation/media/uapi/v4l/pixfmt-yuv420.rst index b22e64c14f67..43bb676d5184 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv420.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv420.rst @@ -38,6 +38,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst index 4dab85090d7d..7f7a7dadd07d 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst @@ -45,6 +45,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst index ccb67284133a..5de85f987644 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst @@ -44,6 +44,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst b/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst index 9f34762adf18..6cdff74af7c9 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst @@ -34,6 +34,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst index 04f34508b934..8ebef2ce0e85 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst @@ -38,6 +38,8 @@ described in :ref:`planar-apis`. **Byte Order.** Each cell is one byte. +.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuyv.rst b/Documentation/media/uapi/v4l/pixfmt-yuyv.rst index 52917dfa9261..24fa9bbb67b6 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuyv.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuyv.rst @@ -26,6 +26,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-yvyu.rst b/Documentation/media/uapi/v4l/pixfmt-yvyu.rst index e466052b68b2..346b003b23ba 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yvyu.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yvyu.rst @@ -23,6 +23,8 @@ half the horizontal resolution of the Y component. **Byte Order.** Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-z16.rst b/Documentation/media/uapi/v4l/pixfmt-z16.rst index 4ebc561d0480..dd9a11a6746b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-z16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-z16.rst @@ -24,6 +24,8 @@ Each cell is one byte. +.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 6dbb27b09c34..265a6dc5fe92 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -8,6 +8,8 @@ Media Bus Formats .. _v4l2-mbus-framefmt: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_mbus_framefmt :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst index abdc0b4d83d5..b4b16aebac98 100644 --- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst @@ -75,6 +75,8 @@ than the number requested. .. _v4l2-create-buffers: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_create_buffers :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-cropcap.rst b/Documentation/media/uapi/v4l/vidioc-cropcap.rst index 8dcbe6d26219..e3d853356438 100644 --- a/Documentation/media/uapi/v4l/vidioc-cropcap.rst +++ b/Documentation/media/uapi/v4l/vidioc-cropcap.rst @@ -54,6 +54,8 @@ overlay devices. .. _v4l2-cropcap: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_cropcap :header-rows: 0 :stub-columns: 0 @@ -114,6 +116,8 @@ overlay devices. .. _v4l2-rect-crop: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_rect :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst index f7e1b80af29e..b433132a7564 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst @@ -80,6 +80,8 @@ instructions. .. _name-v4l2-dbg-match: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| + .. flat-table:: struct v4l2_dbg_match :header-rows: 0 :stub-columns: 0 @@ -124,6 +126,8 @@ instructions. .. _v4l2-dbg-chip-info: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_dbg_chip_info :header-rows: 0 :stub-columns: 0 @@ -169,6 +173,8 @@ instructions. .. _name-chip-match-types: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Chip Match Types :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst index 09d2880e6170..28885cff682a 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst @@ -88,6 +88,8 @@ instructions. .. _v4l2-dbg-match: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| + .. flat-table:: struct v4l2_dbg_match :header-rows: 0 :stub-columns: 0 @@ -173,6 +175,8 @@ instructions. .. _chip-match-types: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Chip Match Types :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst index 2a36e91b57b9..dad36acbb415 100644 --- a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst @@ -58,6 +58,8 @@ introduced in Linux 3.3. .. _v4l2-decoder-cmd: +.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: struct v4l2_decoder_cmd :header-rows: 0 :stub-columns: 0 @@ -187,6 +189,8 @@ introduced in Linux 3.3. .. _decoder-cmds: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Decoder Commands :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index 73c0d5be62ee..0a84f3a6ed92 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -42,6 +42,8 @@ call. .. _v4l2-event: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| + .. flat-table:: struct v4l2_event :header-rows: 0 :stub-columns: 0 @@ -177,6 +179,8 @@ call. .. _event-type: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Event Types :header-rows: 0 :stub-columns: 0 @@ -304,6 +308,8 @@ call. .. _v4l2-event-vsync: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_event_vsync :header-rows: 0 :stub-columns: 0 @@ -322,6 +328,8 @@ call. .. _v4l2-event-ctrl: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| + .. flat-table:: struct v4l2_event_ctrl :header-rows: 0 :stub-columns: 0 @@ -429,6 +437,8 @@ call. .. _v4l2-event-frame-sync: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_event_frame_sync :header-rows: 0 :stub-columns: 0 @@ -447,6 +457,8 @@ call. .. _v4l2-event-src-change: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_event_src_change :header-rows: 0 :stub-columns: 0 @@ -466,6 +478,8 @@ call. .. _v4l2-event-motion-det: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_event_motion_det :header-rows: 0 :stub-columns: 0 @@ -509,6 +523,8 @@ call. .. _ctrl-changes-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Control Changes :header-rows: 0 :stub-columns: 0 @@ -548,6 +564,8 @@ call. .. _src-changes-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Source Changes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst index c390412d5aa9..e14e780eb0d1 100644 --- a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst @@ -56,6 +56,8 @@ that doesn't support them will return an ``EINVAL`` error code. .. _v4l2-bt-timings-cap: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_bt_timings_cap :header-rows: 0 :stub-columns: 0 @@ -141,6 +143,8 @@ that doesn't support them will return an ``EINVAL`` error code. .. _v4l2-dv-timings-cap: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| + .. flat-table:: struct v4l2_dv_timings_cap :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst index 69bd9b4e0e56..18e955ff917a 100644 --- a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst @@ -66,6 +66,8 @@ introduced in Linux 2.6.21. .. _v4l2-encoder-cmd: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_encoder_cmd :header-rows: 0 :stub-columns: 0 @@ -103,6 +105,8 @@ introduced in Linux 2.6.21. .. _encoder-cmds: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Encoder Commands :header-rows: 0 :stub-columns: 0 @@ -164,6 +168,8 @@ introduced in Linux 2.6.21. .. _encoder-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Encoder Command Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst index 764d6cea601c..c386045885f2 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst @@ -66,6 +66,8 @@ return an ``EINVAL`` error code. .. _v4l2-enum-dv-timings: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_enum_dv_timings :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index 13d5b509a829..6bb30ade6aad 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -48,6 +48,8 @@ one until ``EINVAL`` is returned. .. _v4l2-fmtdesc: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_fmtdesc :header-rows: 0 :stub-columns: 0 @@ -129,6 +131,8 @@ one until ``EINVAL`` is returned. .. _fmtdesc-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Image Format Description Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst index 9c22a3a6938f..7541158e16d2 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst @@ -105,6 +105,8 @@ application should zero out all members except for the *IN* fields. .. _v4l2-frmival-stepwise: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_frmival_stepwise :header-rows: 0 :stub-columns: 0 @@ -233,6 +235,8 @@ Enums .. _v4l2-frmivaltypes: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: enum v4l2_frmivaltypes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst index 6e2adf6c23a3..1c23da3f26bc 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst @@ -94,6 +94,8 @@ application should zero out all members except for the *IN* fields. .. _v4l2-frmsize-discrete: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_frmsize_discrete :header-rows: 0 :stub-columns: 0 @@ -120,6 +122,8 @@ application should zero out all members except for the *IN* fields. .. _v4l2-frmsize-stepwise: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_frmsize_stepwise :header-rows: 0 :stub-columns: 0 @@ -254,6 +258,8 @@ Enums .. _v4l2-frmsizetypes: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: enum v4l2_frmsizetypes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index ccf308bd9423..ea1ccfb43e6d 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -45,6 +45,8 @@ of the corresponding tuner/modulator is set. .. _v4l2-frequency-band: +.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: struct v4l2_frequency_band :header-rows: 0 :stub-columns: 0 @@ -151,6 +153,8 @@ of the corresponding tuner/modulator is set. .. _band-modulation: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Band Modulation Systems :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index 5060f54e3d18..6b90a1a3506d 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -43,6 +43,8 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. .. _v4l2-input: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_input :header-rows: 0 :stub-columns: 0 @@ -150,6 +152,8 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. .. _input-type: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Input Types :header-rows: 0 :stub-columns: 0 @@ -320,6 +324,8 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. .. _input-capabilities: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Input capabilities :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst index 82fc9d3b237f..13939d8d4358 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst @@ -44,6 +44,8 @@ EINVAL. .. _v4l2-output: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_output :header-rows: 0 :stub-columns: 0 @@ -140,6 +142,8 @@ EINVAL. .. _output-type: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Output Type :header-rows: 0 :stub-columns: 0 @@ -175,6 +179,8 @@ EINVAL. .. _output-capabilities: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Output capabilities :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index f61f0c6b0723..9d7d77af0161 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -46,6 +46,8 @@ or output. [#f1]_ .. _v4l2-standard: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_standard :header-rows: 0 :stub-columns: 0 @@ -114,6 +116,8 @@ or output. [#f1]_ .. _v4l2-fract: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_fract :header-rows: 0 :stub-columns: 0 @@ -140,6 +144,8 @@ or output. [#f1]_ .. _v4l2-std-id: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: typedef v4l2_std_id :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-expbuf.rst b/Documentation/media/uapi/v4l/vidioc-expbuf.rst index ded708e647fa..67f72ced2a00 100644 --- a/Documentation/media/uapi/v4l/vidioc-expbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-expbuf.rst @@ -118,6 +118,8 @@ Examples .. _v4l2-exportbuffer: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_exportbuffer :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-audio.rst b/Documentation/media/uapi/v4l/vidioc-g-audio.rst index cccbcdb8c463..21fa5571b647 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audio.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audio.rst @@ -52,6 +52,8 @@ return the actual new audio mode. .. _v4l2-audio: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_audio :header-rows: 0 :stub-columns: 0 @@ -106,6 +108,8 @@ return the actual new audio mode. .. _audio-capability: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Audio Capability Flags :header-rows: 0 :stub-columns: 0 @@ -135,6 +139,8 @@ return the actual new audio mode. .. _audio-mode: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Audio Mode Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst index c9e9a550e86d..1420ddebefd0 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst @@ -59,6 +59,8 @@ as ``VIDIOC_G_AUDOUT`` does. .. _v4l2-audioout: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_audioout :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-g-crop.rst index 6cf76497937c..08df93224a38 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-crop.rst @@ -78,6 +78,8 @@ When cropping is not supported then no parameters are changed and .. _v4l2-crop: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_crop :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst index ee929f692ebe..e585b04b3f00 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst @@ -56,6 +56,8 @@ These ioctls work only with user controls. For other control classes the .. _v4l2-control: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_control :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index f7bf21f49092..d2ea3bf01fce 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -70,6 +70,8 @@ EBUSY .. _v4l2-bt-timings: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_bt_timings :header-rows: 0 :stub-columns: 0 @@ -223,6 +225,8 @@ EBUSY .. _v4l2-dv-timings: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| + .. flat-table:: struct v4l2_dv_timings :header-rows: 0 :stub-columns: 0 @@ -267,6 +271,8 @@ EBUSY .. _dv-timing-types: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: DV Timing types :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-edid.rst b/Documentation/media/uapi/v4l/vidioc-g-edid.rst index b881098b8964..721d17fc829e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-edid.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-edid.rst @@ -92,6 +92,8 @@ EDID is no longer available. .. _v4l2-edid: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_edid :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst index f0f41ac56b80..cb094b589f0e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst @@ -59,6 +59,8 @@ video elementary streams. .. _v4l2-enc-idx: +.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: struct v4l2_enc_idx :header-rows: 0 :stub-columns: 0 @@ -105,6 +107,8 @@ video elementary streams. .. _v4l2-enc-idx-entry: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_enc_idx_entry :header-rows: 0 :stub-columns: 0 @@ -162,6 +166,8 @@ video elementary streams. .. _enc-idx-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Index Entry Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index c91039b16d49..fee65debfee2 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -97,6 +97,8 @@ still cause this situation. .. _v4l2-ext-control: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| + .. flat-table:: struct v4l2_ext_control :header-rows: 0 :stub-columns: 0 @@ -228,6 +230,8 @@ still cause this situation. .. _v4l2-ext-controls: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| + .. flat-table:: struct v4l2_ext_controls :header-rows: 0 :stub-columns: 0 @@ -360,6 +364,8 @@ still cause this situation. .. _ctrl-class: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Control classes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index d182d9f5a50d..dc762325be5e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -78,6 +78,8 @@ destructive video overlay. .. _v4l2-framebuffer: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| + .. flat-table:: struct v4l2_framebuffer :header-rows: 0 :stub-columns: 0 @@ -283,6 +285,8 @@ destructive video overlay. .. _framebuffer-cap: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Frame Buffer Capability Flags :header-rows: 0 :stub-columns: 0 @@ -371,6 +375,8 @@ destructive video overlay. .. _framebuffer-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Frame Buffer Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst index a1fd2a870de4..bf0c1a13ddd7 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst @@ -54,6 +54,8 @@ write-only ioctl, it does not return the actual new frequency. .. _v4l2-frequency: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_frequency :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst index f5bf8b7915ed..6f9ee18e005f 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst @@ -57,6 +57,8 @@ encoding. You usually do want to add them. .. _v4l2-jpegcompression: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_jpegcompression :header-rows: 0 :stub-columns: 0 @@ -129,6 +131,8 @@ encoding. You usually do want to add them. .. _jpeg-markers: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: JPEG Markers Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst index fcb2e4896d4d..eaa62b6bd931 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst @@ -63,6 +63,8 @@ To change the radio frequency the .. _v4l2-modulator: +.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| + .. flat-table:: struct v4l2_modulator :header-rows: 0 :stub-columns: 0 @@ -160,6 +162,8 @@ To change the radio frequency the .. _modulator-txsubchans: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Modulator Audio Transmission Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-parm.rst b/Documentation/media/uapi/v4l/vidioc-g-parm.rst index 7116e0decddc..7c32fe94544a 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-parm.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-parm.rst @@ -52,6 +52,8 @@ union holding separate parameters for input and output devices. .. _v4l2-streamparm: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| + .. flat-table:: struct v4l2_streamparm :header-rows: 0 :stub-columns: 0 @@ -111,6 +113,8 @@ union holding separate parameters for input and output devices. .. _v4l2-captureparm: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_captureparm :header-rows: 0 :stub-columns: 0 @@ -192,6 +196,8 @@ union holding separate parameters for input and output devices. .. _v4l2-outputparm: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_outputparm :header-rows: 0 :stub-columns: 0 @@ -280,6 +286,8 @@ union holding separate parameters for input and output devices. .. _parm-caps: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Streaming Parameters Capabilites :header-rows: 0 :stub-columns: 0 @@ -299,6 +307,8 @@ union holding separate parameters for input and output devices. .. _parm-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Capture Parameters Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-priority.rst b/Documentation/media/uapi/v4l/vidioc-g-priority.rst index 9f774ce400a4..3f021e6b9d0d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-priority.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-priority.rst @@ -47,6 +47,8 @@ with a pointer to this variable. .. _v4l2-priority: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: enum v4l2_priority :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-g-selection.rst index 953931fabd00..8e72f93a358e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-selection.rst @@ -137,6 +137,8 @@ Selection targets and flags are documented in .. _v4l2-selection: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_selection :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index f3db6f677650..0d4b6b0044a0 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -48,6 +48,8 @@ the sliced VBI API is unsupported or ``type`` is invalid. .. _v4l2-sliced-vbi-cap: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}| + .. flat-table:: struct v4l2_sliced_vbi_cap :header-rows: 0 :stub-columns: 0 @@ -175,6 +177,8 @@ the sliced VBI API is unsupported or ``type`` is invalid. .. _vbi-services: +.. tabularcolumns:: |p{4.4cm}|p{2.2cm}|p{2.2cm}|p{4.4cm}|p{4.3cm}| + .. flat-table:: Sliced VBI services :header-rows: 1 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index d209736d6a53..762918a1e58a 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -255,6 +255,8 @@ To change the radio frequency the .. _v4l2-tuner-type: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: enum v4l2_tuner_type :header-rows: 0 :stub-columns: 0 @@ -297,6 +299,8 @@ To change the radio frequency the .. _tuner-capability: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Tuner and Modulator Capability Flags :header-rows: 0 :stub-columns: 0 @@ -455,6 +459,8 @@ To change the radio frequency the .. _tuner-rxsubchans: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Tuner Audio Reception Flags :header-rows: 0 :stub-columns: 0 @@ -522,6 +528,8 @@ To change the radio frequency the .. _tuner-audmode: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Tuner Audio Modes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index 937ce9e32a79..b2dba5e0822b 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -96,6 +96,8 @@ See also the examples in :ref:`control`. .. _v4l2-queryctrl: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_queryctrl :header-rows: 0 :stub-columns: 0 @@ -216,6 +218,8 @@ See also the examples in :ref:`control`. .. _v4l2-query-ext-ctrl: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_query_ext_ctrl :header-rows: 0 :stub-columns: 0 @@ -378,6 +382,8 @@ See also the examples in :ref:`control`. .. _v4l2-querymenu: +.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| + .. flat-table:: struct v4l2_querymenu :header-rows: 0 :stub-columns: 0 @@ -446,6 +452,8 @@ See also the examples in :ref:`control`. .. _v4l2-ctrl-type: +.. tabularcolumns:: |p{5.3cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{9.5cm}| + .. flat-table:: enum v4l2_ctrl_type :header-rows: 1 :stub-columns: 0 @@ -643,6 +651,8 @@ See also the examples in :ref:`control`. .. _control-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Control Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst index 5d0bc6d31c07..8be9343802dc 100644 --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst @@ -69,6 +69,8 @@ any DMA in progress, an implicit .. _v4l2-requestbuffers: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_requestbuffers :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst index 5fd332a5bfee..3e4e1f12c56c 100644 --- a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst +++ b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst @@ -63,6 +63,8 @@ error code is returned and no seek takes place. .. _v4l2-hw-freq-seek: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_hw_freq_seek :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst index 0aa6482a91a6..1c853f3f5676 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst @@ -64,6 +64,8 @@ multiple pads of the same sub-device is not defined. .. _v4l2-subdev-frame-interval-enum: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_subdev_frame_interval_enum :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst index 7a5811b71b68..e1bcc69f67db 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst @@ -66,6 +66,8 @@ information about try formats. .. _v4l2-subdev-frame-size-enum: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_subdev_frame_size_enum :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst index bc0531eb56fa..418d543ebbbf 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst @@ -51,6 +51,8 @@ information about the try formats. .. _v4l2-subdev-mbus-code-enum: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_subdev_mbus_code_enum :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst index ae802f1594e7..7caa04e1c2a8 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst @@ -74,6 +74,8 @@ modified format should be as close as possible to the original request. .. _v4l2-subdev-crop: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_subdev_crop :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst index 90e2a6635ebc..a16b3dd4bd3c 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst @@ -77,6 +77,8 @@ should be as close as possible to the original request. .. _v4l2-subdev-format: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_subdev_format :header-rows: 0 :stub-columns: 0 @@ -122,6 +124,8 @@ should be as close as possible to the original request. .. _v4l2-subdev-format-whence: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: enum v4l2_subdev_format_whence :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst index d8a1cabbd272..2df2d8635f2b 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst @@ -69,6 +69,8 @@ the same sub-device is not defined. .. _v4l2-subdev-frame-interval: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_subdev_frame_interval :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst index 50838a4a429e..c59a32e0cc20 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst @@ -66,6 +66,8 @@ Selection targets and flags are documented in .. _v4l2-subdev-selection: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_subdev_selection :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst index 86b16faa41bb..7ae35af66123 100644 --- a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst +++ b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst @@ -40,6 +40,8 @@ using the :ref:`VIDIOC_DQEVENT` ioctl. .. _v4l2-event-subscription: +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| + .. flat-table:: struct v4l2_event_subscription :header-rows: 0 :stub-columns: 0 @@ -91,6 +93,8 @@ using the :ref:`VIDIOC_DQEVENT` ioctl. .. _event-flags: +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| + .. flat-table:: Event Flags :header-rows: 0 :stub-columns: 0 From ca10257487779d938da54b3045f521c54dc732e9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 08:58:00 -0300 Subject: [PATCH 048/591] [media] control.rst: Fix table width Manually adjust the table width for it to look nice on PDF output. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/control.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/control.rst b/Documentation/media/uapi/v4l/control.rst index 10ab53dd3163..e881cd1f30d6 100644 --- a/Documentation/media/uapi/v4l/control.rst +++ b/Documentation/media/uapi/v4l/control.rst @@ -191,10 +191,12 @@ Control IDs +.. tabularcolumns:: |p{5.5cm}|p{12cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 - + :widths: 11 24 - .. row 1 From 1300c9308980cec492f1019341ece0f41c19860e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 11:27:22 -0300 Subject: [PATCH 049/591] [media] extended-controls.rst: fix table sizes Lots of tables at extended-controls.rst need explicit hints for LaTeX to adjust their widths. Provide that. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/extended-controls.rst | 63 +++++++++++-------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 782f7f3c2209..3f0f94a5eeed 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -291,6 +291,8 @@ Codec Control IDs +.. tabularcolumns:: |p{6 cm}|p{11.5cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -964,6 +966,8 @@ Codec Control IDs +.. tabularcolumns:: |p{9.0cm}|p{8.5cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -1671,6 +1675,8 @@ Codec Control IDs +.. tabularcolumns:: |p{5.5cm}|p{12.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -1715,11 +1721,12 @@ Codec Control IDs +.. tabularcolumns:: |p{14.0cm}|p{3.5cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED`` @@ -1918,6 +1925,8 @@ Codec Control IDs +.. tabularcolumns:: |p{10.3cm}|p{7.2cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -1967,17 +1976,16 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-sei-fp-arrangement-type: -``V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (enum v4l2_mpeg_video_h264_sei_fp_arrangement_type)`` +``V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE`` ``(enum v4l2_mpeg_video_h264_sei_fp_arrangement_type)`` Frame packing arrangement type for H264 SEI. Applicable to the H264 encoder. Possible values are: - +.. tabularcolumns:: |p{12cm}|p{5.5cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHEKERBOARD`` @@ -2023,18 +2031,17 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-fmo-map-type: -``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (enum v4l2_mpeg_video_h264_fmo_map_type)`` +``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE`` ``(enum v4l2_mpeg_video_h264_fmo_map_type)`` When using FMO, the map type divides the image in different scan patterns of macroblocks. Applicable to the H264 encoder. Possible values are: - +.. tabularcolumns:: |p{12.5cm}|p{5.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES`` @@ -2330,12 +2337,12 @@ MFC 5.1 Control IDs are: +.. tabularcolumns:: |p{9.0cm}|p{8.5cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_MPEG_MFC51_FRAME_SKIP_MODE_DISABLED`` @@ -2455,6 +2462,8 @@ CX2341x Control IDs +.. tabularcolumns:: |p{14.5cm}|p{3.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -2679,13 +2688,12 @@ VPX Control IDs The number of reference pictures for encoding P frames. Possible values are: - +.. tabularcolumns:: |p{7.9cm}|p{9.6cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME`` @@ -2731,13 +2739,16 @@ VPX Control IDs ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL (enum v4l2_vp8_golden_frame_sel)`` Selects the golden frame for encoding. Possible values are: +.. raw:: latex + \begin{adjustbox}{width=\columnwidth} + +.. tabularcolumns:: |p{11.0cm}|p{10.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_PREV`` @@ -2750,9 +2761,12 @@ VPX Control IDs - ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_REF_PERIOD`` - Use the previous specific frame indicated by - V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a + ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD`` as a golden frame. +.. raw:: latex + + \end{adjustbox} ``V4L2_CID_MPEG_VIDEO_VPX_MIN_QP (integer)`` @@ -2862,13 +2876,12 @@ Camera Control IDs Determines how the camera measures the amount of light available for the frame exposure. Possible values are: - +.. tabularcolumns:: |p{8.5cm}|p{9.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_EXPOSURE_METERING_AVERAGE`` @@ -2970,13 +2983,12 @@ Camera Control IDs control may stop updates of the ``V4L2_CID_AUTO_FOCUS_STATUS`` control value. - +.. tabularcolumns:: |p{6.5cm}|p{11.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_AUTO_FOCUS_STATUS_IDLE`` @@ -3009,7 +3021,7 @@ Camera Control IDs ``V4L2_CID_AUTO_FOCUS_RANGE (enum v4l2_auto_focus_range)`` Determines auto focus distance range for which lens may be adjusted. - +.. tabularcolumns:: |p{6.5cm}|p{11.0cm}| .. flat-table:: :header-rows: 0 @@ -3097,13 +3109,12 @@ Camera Control IDs representation. The following white balance presets are listed in order of increasing color temperature. - +.. tabularcolumns:: |p{7.0 cm}|p{10.5cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_WHITE_BALANCE_MANUAL`` @@ -3245,13 +3256,12 @@ Camera Control IDs to ``V4L2_SCENE_MODE_NONE`` to make sure the other possibly related controls are accessible. The following scene programs are defined: - +.. tabularcolumns:: |p{6.0cm}|p{11.5cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_SCENE_MODE_NONE`` @@ -3710,13 +3720,12 @@ Flash Control IDs ``V4L2_CID_FLASH_STROBE_SOURCE (menu)`` Defines the source of the flash LED strobe. - +.. tabularcolumns:: |p{7.0cm}|p{10.5cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``V4L2_FLASH_STROBE_SOURCE_SOFTWARE`` @@ -3777,7 +3786,7 @@ Flash Control IDs an effect is chip dependent. Reading the faults resets the control and returns the chip to a usable state if possible. - +.. tabularcolumns:: |p{8.0cm}|p{9.5cm}| .. flat-table:: :header-rows: 0 @@ -3888,7 +3897,7 @@ JPEG Control IDs how Cb and Cr components are downsampled after coverting an input image from RGB to Y'CbCr color space. - +.. tabularcolumns:: |p{7.0cm}|p{10.5cm}| .. flat-table:: :header-rows: 0 @@ -4190,7 +4199,7 @@ Digital Video Control IDs or an analog source. The enum v4l2_dv_it_content_type defines the possible content types: - +.. tabularcolumns:: |p{7.0cm}|p{10.5cm}| .. flat-table:: :header-rows: 0 @@ -4384,7 +4393,7 @@ Detect Control IDs ``V4L2_CID_DETECT_MD_MODE (menu)`` Sets the motion detection mode. - +.. tabularcolumns:: |p{7.5cm}|p{10.0cm}| .. flat-table:: :header-rows: 0 From 83eaeb85a5f6637986058487dadc94e3cfaa0057 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 11:47:21 -0300 Subject: [PATCH 050/591] [media] docs-rst: add column hints for pixfmt-002 and pixfmt-006 Add column hints for LaTeX to format columns on the tables inside pixfmt-002.rst and pixfmt-006.rst. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-002.rst | 4 +++- Documentation/media/uapi/v4l/pixfmt-006.rst | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst b/Documentation/media/uapi/v4l/pixfmt-002.rst index 27d4e78760ba..368da55e5f07 100644 --- a/Documentation/media/uapi/v4l/pixfmt-002.rst +++ b/Documentation/media/uapi/v4l/pixfmt-002.rst @@ -7,7 +7,9 @@ Single-planar format structure .. _v4l2-pix-format: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{11.0cm}| + +.. cssclass:: longtable .. flat-table:: struct v4l2_pix_format :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-006.rst b/Documentation/media/uapi/v4l/pixfmt-006.rst index 1c8321f9b1fb..56b691300158 100644 --- a/Documentation/media/uapi/v4l/pixfmt-006.rst +++ b/Documentation/media/uapi/v4l/pixfmt-006.rst @@ -25,6 +25,7 @@ needs to be filled in. colorspaces except for BT.2020 which uses limited range R'G'B' quantization. +.. tabularcolumns:: |p{6.0cm}|p{11.5cm}| .. _v4l2-colorspace: @@ -183,6 +184,8 @@ needs to be filled in. .. _v4l2-ycbcr-encoding: +.. tabularcolumns:: |p{6.5cm}|p{11.0cm}| + .. flat-table:: V4L2 Y'CbCr Encodings :header-rows: 1 :stub-columns: 0 @@ -252,6 +255,8 @@ needs to be filled in. .. _v4l2-quantization: +.. tabularcolumns:: |p{6.5cm}|p{11.0cm}| + .. flat-table:: V4L2 Quantization Methods :header-rows: 1 :stub-columns: 0 From fdb45d73ea442d8cc3f2dcfec12a0f2bc39cbaf0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 11:57:12 -0300 Subject: [PATCH 051/591] [media] pixfmt-packed-rgb.rst: Fix cell spans There is an extra column just before eack pack of bits, to improve table reading, but the header file didn't take this into account. Fix it. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/pixfmt-packed-rgb.rst | 88 ++++++++++--------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst index b1122ce0a8e8..3db34f9d36e6 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst @@ -36,10 +36,13 @@ next to each other in memory. - - :cspan:`7` Byte 0 in memory + - - :cspan:`7` Byte 1 + - - :cspan:`7` Byte 2 + - - :cspan:`7` Byte 3 - .. row 2 @@ -202,13 +205,13 @@ next to each other in memory. - b\ :sub:`0` - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`3` @@ -282,7 +285,7 @@ next to each other in memory. - b\ :sub:`0` - - - - + - - r\ :sub:`4` @@ -385,7 +388,7 @@ next to each other in memory. - 'XR15' | (1 << 31) - - - - + - - r\ :sub:`4` @@ -617,34 +620,34 @@ next to each other in memory. - r\ :sub:`0` - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - + - - - - + - - - - + - - - - + - - - - + - + - - - - + - - - - + - + + - + + - + + - + + - + + - - .. _V4L2-PIX-FMT-ABGR32: @@ -778,21 +781,21 @@ next to each other in memory. - r\ :sub:`0` - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - .. _V4L2-PIX-FMT-ARGB32: @@ -875,21 +878,21 @@ next to each other in memory. - 'BX24' - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - r\ :sub:`7` @@ -1117,10 +1120,13 @@ either the corresponding ARGB or XRGB format, depending on the driver. - - :cspan:`7` Byte 0 in memory + - - :cspan:`7` Byte 1 + - - :cspan:`7` Byte 2 + - - :cspan:`7` Byte 3 - .. row 2 From b315a63bf598e844e989498c3c5a2912877cc3a1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 12:02:12 -0300 Subject: [PATCH 052/591] [media] pixfmt-packed-rgb.rst: adjust tables to fit in LaTeX Adjust the tables to fit at the LaTeX and PDF outputs. I wrote a previous patch RFC to show the big table in landscape, but it makes harder to read on displays. So, instead, let's use the adjustbox to shrink the size of those long tables, as the table size can still be visible on screen, and it is a way better to read in horizontal position and visible if printed. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/pixfmt-packed-rgb.rst | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst index 3db34f9d36e6..af5fac78188f 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst @@ -6,11 +6,6 @@ Packed RGB formats ****************** -*man Packed RGB formats(2)* - -Packed RGB formats - - Description =========== @@ -19,9 +14,14 @@ graphics frame buffers. They occupy 8, 16, 24 or 32 bits per pixel. These are all packed-pixel formats, meaning all the data for a pixel lie next to each other in memory. +.. raw:: latex + + \newline\newline\begin{adjustbox}{width=\columnwidth} .. _rgb-formats: +.. tabularcolumns:: |p{4.5cm}|p{3.3cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| + .. flat-table:: Packed RGB Image Formats :header-rows: 2 :stub-columns: 0 @@ -945,8 +945,11 @@ next to each other in memory. - b\ :sub:`0` +.. raw:: latex -Bit 7 is the most significant bit. + \end{adjustbox}\newline\newline + +.. note:: Bit 7 is the most significant bit. The usage and value of the alpha bits (a) in the ARGB and ABGR formats (collectively referred to as alpha formats) depend on the device type @@ -976,13 +979,16 @@ devices and drivers must ignore those bits, for both Each cell is one byte. +.. raw:: latex -.. tabularcolumns:: |p{2.5cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{0.7cm}| + \newline\newline\begin{adjustbox}{width=\columnwidth} -.. flat-table:: +.. tabularcolumns:: |p{4.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.1cm}|p{1.3cm}| + +.. flat-table:: RGB byte order :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 1 1 1 1 + :widths: 11 3 3 3 3 3 3 3 3 3 3 3 3 - .. row 1 @@ -1097,6 +1103,9 @@ Each cell is one byte. - R\ :sub:`33` +.. raw:: latex + + \end{adjustbox}\newline\newline Formats defined in :ref:`rgb-formats-deprecated` are deprecated and must not be used by new drivers. They are documented here for reference. @@ -1106,6 +1115,13 @@ either the corresponding ARGB or XRGB format, depending on the driver. .. _rgb-formats-deprecated: +.. raw:: latex + + \newline\newline + \begin{adjustbox}{width=\columnwidth} + +.. tabularcolumns:: |p{4.2cm}|p{1.0cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| + .. flat-table:: Deprecated Packed RGB Image Formats :header-rows: 2 :stub-columns: 0 @@ -1470,6 +1486,9 @@ either the corresponding ARGB or XRGB format, depending on the driver. - b\ :sub:`0` +.. raw:: latex + + \end{adjustbox}\newline\newline A test utility to determine which RGB formats a driver actually supports is available from the LinuxTV v4l-dvb repository. See From 1c3fd7e7af7a28e79316a44b7c837b30ef4f00bb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 15:37:48 -0300 Subject: [PATCH 053/591] [media] pixfmt-packed-yuv.rst: adjust tables to fit in LaTeX Adjust the table to fit at the LaTeX and PDF outputs, just like what was done with pixfmt-packed-rgb.rst. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/pixfmt-packed-yuv.rst | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst index 54716455f453..2ffcee5b383b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst @@ -6,18 +6,19 @@ Packed YUV formats ****************** -*man Packed YUV formats(2)* - -Packed YUV formats - - Description =========== Similar to the packed RGB formats these formats store the Y, Cb and Cr component of each pixel in one 16 or 32 bit word. +.. raw:: latex + \newline\newline\begin{adjustbox}{width=\columnwidth} + +.. _rgb-formats: + +.. tabularcolumns:: |p{4.5cm}|p{3.3cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| .. flat-table:: Packed YUV Image Formats :header-rows: 2 @@ -309,8 +310,15 @@ component of each pixel in one 16 or 32 bit word. - Cr\ :sub:`0` +.. raw:: latex -Bit 7 is the most significant bit. The value of 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 -:ref:`Video Overlay ` or :ref:`Video Output Overlay `. + \end{adjustbox}\newline\newline + +.. note:: + + #) Bit 7 is the most significant bit; + + #) The value of 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 :ref:`Video Overlay ` or + :ref:`Video Output Overlay `. From 4810923765b868bd50730ed340538107d563832a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 13:26:23 -0300 Subject: [PATCH 054/591] [media] docs-rst: remove width hints from pixfmt byte order tables Those hints are wrong, and doesn't really improve the look of those tables. So, keep them only when they're useful. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-grey.rst | 7 ------- Documentation/media/uapi/v4l/pixfmt-m420.rst | 6 ------ Documentation/media/uapi/v4l/pixfmt-nv12.rst | 6 ------ Documentation/media/uapi/v4l/pixfmt-nv12m.rst | 5 ----- Documentation/media/uapi/v4l/pixfmt-nv12mt.rst | 2 -- Documentation/media/uapi/v4l/pixfmt-nv16.rst | 7 ------- Documentation/media/uapi/v4l/pixfmt-nv16m.rst | 7 ------- Documentation/media/uapi/v4l/pixfmt-nv24.rst | 7 ------- Documentation/media/uapi/v4l/pixfmt-sbggr16.rst | 8 -------- Documentation/media/uapi/v4l/pixfmt-sbggr8.rst | 6 ------ Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst | 7 ------- Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst | 7 ------- Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst | 8 -------- Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst | 6 ------ Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-srggb10.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-srggb10alaw8.rst | 2 -- Documentation/media/uapi/v4l/pixfmt-srggb10p.rst | 12 ++++++++---- Documentation/media/uapi/v4l/pixfmt-srggb12.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-srggb8.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-uv8.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-uyvy.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-vyuy.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-y10.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-y10b.rst | 8 -------- Documentation/media/uapi/v4l/pixfmt-y12.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-y12i.rst | 5 ----- Documentation/media/uapi/v4l/pixfmt-y16-be.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-y16.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-y41p.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-y8i.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yuv410.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yuv411p.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yuv420.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yuv420m.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yuv422m.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yuv422p.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yuv444m.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yuyv.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-yvyu.rst | 3 --- Documentation/media/uapi/v4l/pixfmt-z16.rst | 3 --- 43 files changed, 8 insertions(+), 183 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-grey.rst b/Documentation/media/uapi/v4l/pixfmt-grey.rst index 844fb67320be..fef58ca50f66 100644 --- a/Documentation/media/uapi/v4l/pixfmt-grey.rst +++ b/Documentation/media/uapi/v4l/pixfmt-grey.rst @@ -6,8 +6,6 @@ V4L2_PIX_FMT_GREY ('GREY') ************************** -*man V4L2_PIX_FMT_GREY(2)* - Grey-scale image @@ -20,14 +18,9 @@ which simply contains no Cb or Cr data. **Byte Order.** Each cell is one byte. - - -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-m420.rst b/Documentation/media/uapi/v4l/pixfmt-m420.rst index ff0ed7abfef3..f4a21a8a6dcc 100644 --- a/Documentation/media/uapi/v4l/pixfmt-m420.rst +++ b/Documentation/media/uapi/v4l/pixfmt-m420.rst @@ -6,8 +6,6 @@ V4L2_PIX_FMT_M420 ('M420') ************************** -*man V4L2_PIX_FMT_M420(2)* - Format with ½ horizontal and vertical chroma resolution, also known as YUV 4:2:0. Hybrid plane line-interleaved layout. @@ -32,13 +30,9 @@ the CbCr lines. Each cell is one byte. - -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12.rst b/Documentation/media/uapi/v4l/pixfmt-nv12.rst index a5b70b8a1273..6bbdc01362af 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12.rst @@ -7,7 +7,6 @@ V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21') ****************************************************** -*man V4L2_PIX_FMT_NV12(2)* V4L2_PIX_FMT_NV21 Formats with ½ horizontal and vertical chroma resolution, also known as @@ -36,14 +35,9 @@ many pad bytes after its rows. Each cell is one byte. - -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12m.rst b/Documentation/media/uapi/v4l/pixfmt-nv12m.rst index cdc24109fdf7..5c2e0648204b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12m.rst @@ -8,7 +8,6 @@ V4L2_PIX_FMT_NV12M ('NM12'), V4L2_PIX_FMT_NV21M ('NM21'), V4L2_PIX_FMT_NV12MT_16X16 *********************************************************************************** -*man V4L2_PIX_FMT_NV12M(2)* V4L2_PIX_FMT_NV21M V4L2_PIX_FMT_NV12MT_16X16 @@ -47,13 +46,9 @@ many pad bytes after its rows. **Byte Order.** Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst b/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst index 1e6fdf0194f5..9f250a1df2f6 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12mt.rst @@ -6,8 +6,6 @@ V4L2_PIX_FMT_NV12MT ('TM12') **************************** -*man V4L2_PIX_FMT_NV12MT(2)* - Formats with ½ horizontal and vertical chroma resolution. This format has two planes - one for luminance and one for chrominance. Chroma samples are interleaved. The difference to ``V4L2_PIX_FMT_NV12`` is the diff --git a/Documentation/media/uapi/v4l/pixfmt-nv16.rst b/Documentation/media/uapi/v4l/pixfmt-nv16.rst index 2cbdc1e6a36d..e2ea0fcdccc7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv16.rst @@ -7,8 +7,6 @@ V4L2_PIX_FMT_NV16 ('NV16'), V4L2_PIX_FMT_NV61 ('NV61') ****************************************************** -*man V4L2_PIX_FMT_NV16(2)* - V4L2_PIX_FMT_NV61 Formats with ½ horizontal chroma resolution, also known as YUV 4:2:2. One luminance and one chrominance plane with alternating chroma samples @@ -35,14 +33,9 @@ many pad bytes after its rows. Each cell is one byte. - -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv16m.rst b/Documentation/media/uapi/v4l/pixfmt-nv16m.rst index 98cc0550bf26..5908b0437697 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv16m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv16m.rst @@ -7,8 +7,6 @@ V4L2_PIX_FMT_NV16M ('NM16'), V4L2_PIX_FMT_NV61M ('NM61') ******************************************************** -*man V4L2_PIX_FMT_NV16M(2)* - V4L2_PIX_FMT_NV61M Variation of ``V4L2_PIX_FMT_NV16`` and ``V4L2_PIX_FMT_NV61`` with planes non contiguous in memory. @@ -38,14 +36,9 @@ described in :ref:`planar-apis`. Each cell is one byte. - -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-nv24.rst b/Documentation/media/uapi/v4l/pixfmt-nv24.rst index ebc27b772a38..67f3c53ac48d 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv24.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv24.rst @@ -7,8 +7,6 @@ V4L2_PIX_FMT_NV24 ('NV24'), V4L2_PIX_FMT_NV42 ('NV42') ****************************************************** -*man V4L2_PIX_FMT_NV24(2)* - V4L2_PIX_FMT_NV42 Formats with full horizontal and vertical chroma resolutions, also known as YUV 4:4:4. One luminance and one chrominance plane with alternating @@ -35,14 +33,9 @@ twice as many pad bytes after its rows. Each cell is one byte. - -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst index c2224c455e8a..58238c06f11e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst @@ -6,8 +6,6 @@ V4L2_PIX_FMT_SBGGR16 ('BYR2') ***************************** -*man V4L2_PIX_FMT_SBGGR16(2)* - Bayer RGB format @@ -27,15 +25,9 @@ memory addresses (little-endian). **Byte Order.** Each cell is one byte. - - -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst index 0a65450e017e..e880ba09379c 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst @@ -6,8 +6,6 @@ V4L2_PIX_FMT_SBGGR8 ('BA81') **************************** -*man V4L2_PIX_FMT_SBGGR8(2)* - Bayer RGB format @@ -25,13 +23,9 @@ scheme repeats to the right and down for every two columns and rows. Each cell is one byte. - -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst index 48c2469ddd19..82b9995155fa 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst @@ -6,8 +6,6 @@ V4L2_SDR_FMT_CS8 ('CS08') ************************* -*man V4L2_SDR_FMT_CS8(2)* - Complex signed 8-bit IQ sample @@ -22,14 +20,9 @@ Q value after that. **Byte Order.** Each cell is one byte. - - -.. tabularcolumns:: |p{11.7cm}|p{5.8cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst index d8d7fd3f0ec2..f06cbeb15dc2 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst @@ -6,8 +6,6 @@ V4L2_SDR_FMT_CS14LE ('CS14') **************************** -*man V4L2_SDR_FMT_CS14LE(2)* - Complex signed 14-bit little endian IQ sample @@ -24,14 +22,9 @@ space with unused high bits padded with 0. Each cell is one byte. - -.. tabularcolumns:: |p{8.8cm}|p{4.4cm}|p{4.3cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst index 1b7eaf652604..bd81eb2e0549 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst @@ -6,8 +6,6 @@ V4L2_SDR_FMT_CU8 ('CU08') ************************* -*man V4L2_SDR_FMT_CU8(2)* - Complex unsigned 8-bit IQ sample @@ -22,15 +20,9 @@ and Q value after that. **Byte Order.** Each cell is one byte. - - -.. tabularcolumns:: |p{11.7cm}|p{5.8cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst index e12d267423c4..c72587de4a8d 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst @@ -6,7 +6,6 @@ V4L2_SDR_FMT_CU16LE ('CU16') **************************** -*man V4L2_SDR_FMT_CU16LE(2)* Complex unsigned 16-bit little endian IQ sample @@ -23,14 +22,9 @@ comes first and Q value after that. Each cell is one byte. - -.. tabularcolumns:: |p{8.8cm}|p{4.4cm}|p{4.3cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst index 802aefe44b16..b5f0ca0f0c45 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst @@ -6,7 +6,6 @@ V4L2_SDR_FMT_RU12LE ('RU12') **************************** -*man V4L2_SDR_FMT_RU12LE(2)* Real unsigned 12-bit little endian sample @@ -23,12 +22,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{8.8cm}|p{4.4cm}|p{4.3cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst b/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst index faad9b19dadd..5cd40d611d68 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_SGBRG8 ('GBRG') **************************** -*man V4L2_PIX_FMT_SGBRG8(2)* Bayer RGB format @@ -26,12 +25,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst b/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst index 33a7c4fdf046..05a09dbac494 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_SGRBG8 ('GRBG') **************************** -*man V4L2_PIX_FMT_SGRBG8(2)* Bayer RGB format @@ -26,12 +25,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10.rst index 6a32ecb7f9ad..8af756944fd4 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10.rst @@ -9,7 +9,6 @@ V4L2_PIX_FMT_SRGGB10 ('RG10'), V4L2_PIX_FMT_SGRBG10 ('BA10'), V4L2_PIX_FMT_SGBRG10 ('GB10'), V4L2_PIX_FMT_SBGGR10 ('BG10'), *************************************************************************************************************************** -*man V4L2_PIX_FMT_SRGGB10(2)* V4L2_PIX_FMT_SGRBG10 V4L2_PIX_FMT_SGBRG10 @@ -33,12 +32,10 @@ Each cell is one byte, high 6 bits in high bytes are 0. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10alaw8.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10alaw8.rst index 68bae0cb764c..c44e093514de 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10alaw8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10alaw8.rst @@ -9,8 +9,6 @@ V4L2_PIX_FMT_SBGGR10ALAW8 ('aBA8'), V4L2_PIX_FMT_SGBRG10ALAW8 ('aGA8'), V4L2_PIX_FMT_SGRBG10ALAW8 ('agA8'), V4L2_PIX_FMT_SRGGB10ALAW8 ('aRA8'), *********************************************************************************************************************************************** -*man V4L2_PIX_FMT_SBGGR10ALAW8(2)* - V4L2_PIX_FMT_SGBRG10ALAW8 V4L2_PIX_FMT_SGRBG10ALAW8 V4L2_PIX_FMT_SRGGB10ALAW8 diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst index b577dbf09a8b..a5752b9063e3 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst @@ -9,7 +9,6 @@ V4L2_PIX_FMT_SRGGB10P ('pRAA'), V4L2_PIX_FMT_SGRBG10P ('pgAA'), V4L2_PIX_FMT_SGBRG10P ('pGAA'), V4L2_PIX_FMT_SBGGR10P ('pBAA'), ******************************************************************************************************************************* -*man V4L2_PIX_FMT_SRGGB10P(2)* V4L2_PIX_FMT_SGRBG10P V4L2_PIX_FMT_SGBRG10P @@ -34,15 +33,16 @@ of one of these formats: **Byte Order.** Each cell is one byte. +.. raw:: latex + \newline\newline\begin{adjustbox}{width=\columnwidth} -.. tabularcolumns:: |p{5.0cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}| +.. tabularcolumns:: |p{2.0cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{10.9cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 - + :widths: 12 8 8 8 8 68 - .. row 1 @@ -103,3 +103,7 @@ Each cell is one byte. - G\ :sub:`30low`\ (bits 7--6) R\ :sub:`31low`\ (bits 5--4) G\ :sub:`32low`\ (bits 3--2) R\ :sub:`33low`\ (bits 1--0) + +.. raw:: latex + + \end{adjustbox}\newline\newline diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst index 54355af154c8..109772fd0f23 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst @@ -10,7 +10,6 @@ V4L2_PIX_FMT_SRGGB12 ('RG12'), V4L2_PIX_FMT_SGRBG12 ('BA12'), V4L2_PIX_FMT_SGBRG12 ('GB12'), V4L2_PIX_FMT_SBGGR12 ('BG12'), *************************************************************************************************************************** -*man V4L2_PIX_FMT_SRGGB12(2)* V4L2_PIX_FMT_SGRBG12 V4L2_PIX_FMT_SGBRG12 @@ -34,12 +33,10 @@ Each cell is one byte, high 6 bits in high bytes are 0. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb8.rst b/Documentation/media/uapi/v4l/pixfmt-srggb8.rst index 1a6966b34c6f..41851bbde2cd 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb8.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_SRGGB8 ('RGGB') **************************** -*man V4L2_PIX_FMT_SRGGB8(2)* Bayer RGB format @@ -26,12 +25,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-uv8.rst b/Documentation/media/uapi/v4l/pixfmt-uv8.rst index ab73e0b55d05..8c4ebbf79ca0 100644 --- a/Documentation/media/uapi/v4l/pixfmt-uv8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-uv8.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_UV8 ('UV8') ************************ -*man V4L2_PIX_FMT_UV8(2)* UV plane interleaved @@ -21,12 +20,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-uyvy.rst b/Documentation/media/uapi/v4l/pixfmt-uyvy.rst index 4c0c56003355..ed8ccf52b1db 100644 --- a/Documentation/media/uapi/v4l/pixfmt-uyvy.rst +++ b/Documentation/media/uapi/v4l/pixfmt-uyvy.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_UYVY ('UYVY') ************************** -*man V4L2_PIX_FMT_UYVY(2)* Variation of ``V4L2_PIX_FMT_YUYV`` with different order of samples in memory @@ -23,12 +22,10 @@ half the horizontal resolution of the Y component. **Byte Order.** Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-vyuy.rst b/Documentation/media/uapi/v4l/pixfmt-vyuy.rst index cdebbd3a5ad2..d62c1ac4ed08 100644 --- a/Documentation/media/uapi/v4l/pixfmt-vyuy.rst +++ b/Documentation/media/uapi/v4l/pixfmt-vyuy.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_VYUY ('VYUY') ************************** -*man V4L2_PIX_FMT_VYUY(2)* Variation of ``V4L2_PIX_FMT_YUYV`` with different order of samples in memory @@ -23,12 +22,10 @@ half the horizontal resolution of the Y component. **Byte Order.** Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-y10.rst b/Documentation/media/uapi/v4l/pixfmt-y10.rst index 887e6f052879..cb78e365a84c 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y10.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y10.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_Y10 ('Y10 ') ************************* -*man V4L2_PIX_FMT_Y10(2)* Grey-scale image @@ -23,12 +22,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-y10b.rst b/Documentation/media/uapi/v4l/pixfmt-y10b.rst index 5f5219904a62..e89850bfef58 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y10b.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y10b.rst @@ -6,8 +6,6 @@ V4L2_PIX_FMT_Y10BPACK ('Y10B') ****************************** -*man V4L2_PIX_FMT_Y10BPACK(2)* - Grey-scale image as a bit-packed array @@ -24,15 +22,9 @@ first from the left. pixels cross the byte boundary and have a ratio of 5 bytes for each 4 pixels. - - -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-y12.rst b/Documentation/media/uapi/v4l/pixfmt-y12.rst index 6148371909f8..0958e87b6d22 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y12.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_Y12 ('Y12 ') ************************* -*man V4L2_PIX_FMT_Y12(2)* Grey-scale image @@ -23,12 +22,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-y12i.rst b/Documentation/media/uapi/v4l/pixfmt-y12i.rst index 70f2b2c1f57b..e66d8bcdb410 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y12i.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y12i.rst @@ -6,8 +6,6 @@ V4L2_PIX_FMT_Y12I ('Y12I') ************************** -*man V4L2_PIX_FMT_Y12I(2)* - Interleaved grey-scale image, e.g. from a stereo-pair @@ -29,12 +27,9 @@ these pixels can be deinterlaced using pixels cross the byte boundary and have a ratio of 3 bytes for each interleaved pixel. -.. tabularcolumns:: |p{8.8cm}|p{4.4cm}|p{4.3cm}| - .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-y16-be.rst b/Documentation/media/uapi/v4l/pixfmt-y16-be.rst index bc968c246ec5..fc23c6b12193 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y16-be.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y16-be.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_Y16_BE ('Y16 ' | (1 << 31)) **************************************** -*man V4L2_PIX_FMT_Y16_BE(2)* Grey-scale image @@ -27,12 +26,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-y16.rst b/Documentation/media/uapi/v4l/pixfmt-y16.rst index deb59e2a62a7..6b4edc4e34e5 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y16.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_Y16 ('Y16 ') ************************* -*man V4L2_PIX_FMT_Y16(2)* Grey-scale image @@ -27,12 +26,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-y41p.rst b/Documentation/media/uapi/v4l/pixfmt-y41p.rst index d160e3dc9115..9c3194bbf77e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y41p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y41p.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_Y41P ('Y41P') ************************** -*man V4L2_PIX_FMT_Y41P(2)* Format with ¼ horizontal chroma resolution, also known as YUV 4:1:1 @@ -30,12 +29,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{2.5cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|p{0.7cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-y8i.rst b/Documentation/media/uapi/v4l/pixfmt-y8i.rst index 8b13c7476efb..16bdfbbe6915 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y8i.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y8i.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_Y8I ('Y8I ') ************************* -*man V4L2_PIX_FMT_Y8I(2)* Interleaved grey-scale image, e.g. from a stereo-pair @@ -24,12 +23,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv410.rst b/Documentation/media/uapi/v4l/pixfmt-yuv410.rst index 5d343d99922f..54909839b0d1 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv410.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv410.rst @@ -7,7 +7,6 @@ V4L2_PIX_FMT_YVU410 ('YVU9'), V4L2_PIX_FMT_YUV410 ('YUV9') ********************************************************** -*man V4L2_PIX_FMT_YVU410(2)* V4L2_PIX_FMT_YUV410 Planar formats with ¼ horizontal and vertical chroma resolution, also @@ -37,12 +36,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst b/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst index 13a31d90bf11..913f68fe2536 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_YUV411P ('411P') ***************************** -*man V4L2_PIX_FMT_YUV411P(2)* Format with ¼ horizontal chroma resolution, also known as YUV 4:1:1. Planar layout as opposed to ``V4L2_PIX_FMT_Y41P`` @@ -33,12 +32,10 @@ have ¼ as many pad bytes after their rows. In other words, four C x rows Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv420.rst b/Documentation/media/uapi/v4l/pixfmt-yuv420.rst index 43bb676d5184..a7f17e40b59e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv420.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv420.rst @@ -7,7 +7,6 @@ V4L2_PIX_FMT_YVU420 ('YV12'), V4L2_PIX_FMT_YUV420 ('YU12') ********************************************************** -*man V4L2_PIX_FMT_YVU420(2)* V4L2_PIX_FMT_YUV420 Planar formats with ½ horizontal and vertical chroma resolution, also @@ -38,12 +37,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst index 7f7a7dadd07d..588784512944 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst @@ -7,7 +7,6 @@ V4L2_PIX_FMT_YUV420M ('YM12'), V4L2_PIX_FMT_YVU420M ('YM21') ************************************************************ -*man V4L2_PIX_FMT_YUV420M(2)* V4L2_PIX_FMT_YVU420M Variation of ``V4L2_PIX_FMT_YUV420`` and ``V4L2_PIX_FMT_YVU420`` with @@ -45,12 +44,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst index 5de85f987644..0c0a462c4dde 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst @@ -7,7 +7,6 @@ V4L2_PIX_FMT_YUV422M ('YM16'), V4L2_PIX_FMT_YVU422M ('YM61') ************************************************************ -*man V4L2_PIX_FMT_YUV422M(2)* V4L2_PIX_FMT_YVU422M Planar formats with ½ horizontal resolution, also known as YUV and YVU @@ -44,12 +43,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst b/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst index 6cdff74af7c9..9618f0d24265 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_YUV422P ('422P') ***************************** -*man V4L2_PIX_FMT_YUV422P(2)* Format with ½ horizontal chroma resolution, also known as YUV 4:2:2. Planar layout as opposed to ``V4L2_PIX_FMT_YUYV`` @@ -34,12 +33,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst index 8ebef2ce0e85..5985d45efb2c 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst @@ -7,7 +7,6 @@ V4L2_PIX_FMT_YUV444M ('YM24'), V4L2_PIX_FMT_YVU444M ('YM42') ************************************************************ -*man V4L2_PIX_FMT_YUV444M(2)* V4L2_PIX_FMT_YVU444M Planar formats with full horizontal resolution, also known as YUV and @@ -38,12 +37,10 @@ described in :ref:`planar-apis`. **Byte Order.** Each cell is one byte. -.. tabularcolumns:: |p{5.8cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}|p{3.0cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yuyv.rst b/Documentation/media/uapi/v4l/pixfmt-yuyv.rst index 24fa9bbb67b6..10deab080d51 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuyv.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuyv.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_YUYV ('YUYV') ************************** -*man V4L2_PIX_FMT_YUYV(2)* Packed format with ½ horizontal chroma resolution, also known as YUV 4:2:2 @@ -26,12 +25,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-yvyu.rst b/Documentation/media/uapi/v4l/pixfmt-yvyu.rst index 346b003b23ba..d126f08c1adc 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yvyu.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yvyu.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_YVYU ('YVYU') ************************** -*man V4L2_PIX_FMT_YVYU(2)* Variation of ``V4L2_PIX_FMT_YUYV`` with different order of samples in memory @@ -23,12 +22,10 @@ half the horizontal resolution of the Y component. **Byte Order.** Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 diff --git a/Documentation/media/uapi/v4l/pixfmt-z16.rst b/Documentation/media/uapi/v4l/pixfmt-z16.rst index dd9a11a6746b..97fe1483a481 100644 --- a/Documentation/media/uapi/v4l/pixfmt-z16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-z16.rst @@ -6,7 +6,6 @@ V4L2_PIX_FMT_Z16 ('Z16 ') ************************* -*man V4L2_PIX_FMT_Z16(2)* 16-bit depth data with distance values at each pixel @@ -24,12 +23,10 @@ Each cell is one byte. -.. tabularcolumns:: |p{3.5cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.8cm}|p{1.4cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 2 1 1 1 1 1 1 1 1 - .. row 1 From 8b5efbeb9702f8e4a913a7effac20239d1a168c2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 20:35:20 -0300 Subject: [PATCH 055/591] [media] buffer.rst: Adjust table columns for LaTeX output The table columns are not properly displayed. Also, some tables are too big to fit into just one page. So, fix them, in order to better display the tables. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/buffer.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index 064bc03b7a1d..4d315b01c2a4 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -39,12 +39,14 @@ buffer. struct v4l2_buffer ================== -.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. tabularcolumns:: |p{1.3cm}|p{2.5cm}|p{1.3cm}|p{12.0cm}| + +.. cssclass:: longtable .. flat-table:: struct v4l2_buffer :header-rows: 0 :stub-columns: 0 - :widths: 1 1 1 2 + :widths: 1 2 1 10 - .. row 1 @@ -286,6 +288,8 @@ struct v4l2_plane .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. cssclass:: longtable + .. flat-table:: :header-rows: 0 :stub-columns: 0 @@ -403,12 +407,14 @@ struct v4l2_plane enum v4l2_buf_type ================== -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. cssclass:: longtable + +.. tabularcolumns:: |p{7.2cm}|p{0.6cm}|p{9.7cm}| .. flat-table:: :header-rows: 0 :stub-columns: 0 - :widths: 3 1 4 + :widths: 4 1 9 - .. row 1 @@ -519,7 +525,9 @@ enum v4l2_buf_type Buffer Flags ============ -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. tabularcolumns:: |p{7.0cm}|p{2.2cm}|p{8.3cm}| + +.. cssclass:: longtable .. flat-table:: :header-rows: 0 @@ -953,7 +961,7 @@ Timecode Types Timecode Flags -------------- -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. tabularcolumns:: |p{6.6cm}|p{1.4cm}|p{9.5cm}| .. flat-table:: :header-rows: 0 From 0fb29313f329bf7cb01fbd9241cf8fd04c00dbf5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 17 Aug 2016 20:38:52 -0300 Subject: [PATCH 056/591] [media] dev-overlay.rst: don't ident a note There's one note there that it is indented for no good reason. Fix it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/dev-overlay.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/media/uapi/v4l/dev-overlay.rst b/Documentation/media/uapi/v4l/dev-overlay.rst index d47a6bbc2e98..50e2d52fcae6 100644 --- a/Documentation/media/uapi/v4l/dev-overlay.rst +++ b/Documentation/media/uapi/v4l/dev-overlay.rst @@ -238,12 +238,12 @@ exceeded are undefined. [#f3]_ :ref:`VIDIOC_S_FBUF `, :ref:`framebuffer-flags`). - .. note:: +.. note:: - This field was added in Linux 2.6.23, extending the - structure. However the :ref:`VIDIOC_[G|S|TRY]_FMT ` - ioctls, which take a pointer to a :ref:`v4l2_format ` - parent structure with padding bytes at the end, are not affected. + This field was added in Linux 2.6.23, extending the + structure. However the :ref:`VIDIOC_[G|S|TRY]_FMT ` + ioctls, which take a pointer to a :ref:`v4l2_format ` + parent structure with padding bytes at the end, are not affected. .. _v4l2-clip: From 0522322ce23bf7bbebc2fcce8d25e260f5e74d93 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 07:06:11 -0300 Subject: [PATCH 057/591] [media] dev-raw-vbi.rst: add a footnote for the count limits There's a bug with LaTeX output on flat-tables with Sphinx 1.4.5 that prevents references at a cell span to be broken. As the text is indeed too long, it makes sense to place the reference to the pictures showing the VBI limits as a footnote. That makes the text easier to read and also solves the issue with LaTeX output. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/dev-raw-vbi.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst b/Documentation/media/uapi/v4l/dev-raw-vbi.rst index 95de08b8fbf2..859b5bc8abbb 100644 --- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst @@ -196,10 +196,9 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does driver. Anyway, drivers may not support single field capturing and return both count values non-zero. - Both ``count`` values set to zero, or line numbers outside the - bounds depicted in :ref:`vbi-525` and :ref:`vbi-625`, or a - field image covering lines of two fields, are invalid and shall - not be returned by the driver. + Both ``count`` values set to zero, or line numbers are outside the + bounds depicted\ [#f4]_, or a field image covering lines of two + fields, are invalid and shall not be returned by the driver. To initialize the ``start`` and ``count`` fields, applications must first determine the current video standard selection. The @@ -352,3 +351,6 @@ another process. Most VBI services transmit on both fields, but some have different semantics depending on the field number. These cannot be reliable decoded or encoded when ``V4L2_VBI_UNSYNC`` is set. + +.. [#f4] + The valid values ar shown at :ref:`vbi-525` and :ref:`vbi-625`. From 6138e3032184613efbd90245cc9806a13c28e72d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 07:06:18 -0300 Subject: [PATCH 058/591] [media] dev-raw-vbi.rst: adjust table columns for LaTeX output Add the needed tags to fix LaTeX output of the tables there. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/dev-raw-vbi.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst b/Documentation/media/uapi/v4l/dev-raw-vbi.rst index 859b5bc8abbb..1b59239c7fb7 100644 --- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst @@ -102,7 +102,9 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does .. _v4l2-vbi-format: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. tabularcolumns:: |p{2.4cm}|p{4.4cm}|p{10.7cm}| + +.. cssclass:: longtable .. flat-table:: struct v4l2_vbi_format :header-rows: 0 @@ -228,7 +230,7 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does .. _vbifmt-flags: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. tabularcolumns:: |p{4.0cm}|p{1.5cm}|p{12.0cm}| .. flat-table:: Raw VBI Format Flags :header-rows: 0 From 605c6065363d3ee9e44594f2ba0998bf9f8a5fa5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 07:18:48 -0300 Subject: [PATCH 059/591] [media] docs-rst: re-generate vbi_525.pdf and vbi_625.pdf Originally, each image were one page big, causing them to be displayed on separate pages at the PDF output. Re-generate them from the gif files. Signed-off-by: Mauro Carvalho Chehab --- .../uapi/v4l/dev-raw-vbi_files/vbi_525.pdf | Bin 3395 -> 3706 bytes .../uapi/v4l/dev-raw-vbi_files/vbi_625.pdf | Bin 3683 -> 3996 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_525.pdf b/Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_525.pdf index 9e72c25b208db6c7844ed85fe9742324602c0a5c..0bae28385dfa119b6d3718e2e6cf6dc411ad0f67 100644 GIT binary patch literal 3706 zcmd5}Z6@(2h8 z*+SKrC=x(Ia!2~$Yc__(Tnqr~9nA*;EQ1vcs^T$N5EvnZU8)Oq0|PlM8ZQdi1DkMw zB_0P5a5%tEHQJ6BA%uqu00grcfSe$ni2qiyGyYXpb^cy(REQNJ;3Kiv(Q2~`AcRD! zERZ7Y;8FJAJ`NjXI?<3Jv(+&{0Z#<6K>>gu#eAzOq)-IGx7N*aF0GHP8xm$Fy;;aq zHF=2wgepuNc~H2@Li=~+zsZHH&gC5)|1w-7=l%`7Pe%Zf z03kbGIG-1xBI`RlaOA|3Fg>SL*Mr4a@fyLv=gS%;Us~Wt7cOdw&1C43gL_L7ca1v4 zv(LE==Uz=*N&hLN+q_ec9@BdW#aZ@X9V5QW;Hu?j?{L>~aLJ*Kl81h|4^lSmE_xa_ zWR~Mwdm=mc==O(3%A6xZR{6P7MULVx&@}m<{G-2zHcQgZo-Ld&@BT+I-x^9YZi@2^ zax1krv+=QN3H8An@1N`l)I|HqERC2Wva0BkOMW-RwEZ}z;$CY;!0>B(mmo~=Afr2_ zJjSJ2-?pF`l=aAZ2wj@=>z6~yr32l(^yvYwlBv(o7%OZ`UZ1fXiC#y1kQnP|}C zWW$L*$n(#Zn`WN=J)ej!mA-1>$!!(*Qqf=>aH9s;#c!cs@qzo zm5d$K`U|vgPo2Dg%1xG79F_Dn;ZQA)=gYyf*2&{d&)2>j_v((n8tfZay=S*0Enae| zl(O0S_`>s54)l^SiN(W247W?#>b;OqKM^R$v{IGL-OW!+OKe!hzH&?%!L+bDR&-ku zC^u5-AKuv)AToVyfX-ZA=Irz7Jh>OwaIHJ*yPrc<8QXdWR z*AdRGd;WgY@PfoTP=;|&EeM0pNcyw%# zXwnll+Ol&?c@#{oA+`_2b{u0u2TN;T#AEqzkwu7M54T8;jz99jl*k5LV34rUPa>^j^zTE@qm z%+j_eTqIUzbX=o;`ruL9#1-2qKJlwNHztbm{1{MLTK#I}o7tG|d|X?A)? zHjY)7khIYudoiKc$UU1iiBT$-zkEJil-F*!RhCaULHTUnp#8&JMz1A2f@f;VVqFu} zoCcy!N0rqLMP~lKeInn&^4@Q2(G~kSMR%^l0DQ30bE}D6#&Vne{Z=LM zBiaK_&W}?g3hp?4*Qpo>_w_2qr#5Xm%addKOT$jx88<0t5cBlin#5^~k~3dtqp!3k zWl*($n6~PAPLI}a?!OyHe_eI%zH+Qk>X&pDcVKP1XI9N5X6Mswk9#yc;VWCLZEc*7 z=4y=>CL9SPjl1=s$w@v+2RDR`(WcR(LEe_Re<%2T&QFyOh@V!wJ zS^w)VMr8-%yjyPS<@r%8YYwBc?&&0#2QJU_*%*Ts$rki?Qfd92eIAn5pY1tI5?8zc z*3tZXuO8@I|3igd@x9Ba_VYUJW~r?uCX)oS$$+l@R_?q;cil$!AKfHuPQhQY2I`IQ zJCoM|e|IPr!`v1tulVy%7t5MkgX^=|N7oA3((U-`kEeG?8n#rkh5G&C%Lmb#l!DV{ zHd6~j(++f29UE9oaafmnb=S$w{f7IC*Oz2&pHF9$|0oe_mwEe2lMK-l6P8E1Udw9* zJzjbB&tem&59J&Y>{9r*SREl_+F3LS%1sYzHW@rM;G(Y9FmO3YJuTLx4BEcOlGo%_-Q>) zOMZz9nkX3Fc3Xn7I-(g_R-zeGv*K%F7bKU~pCYx__L(ub-!K)jFGy)41^tE3Q>?$V~apK}v-=hYt~jI8alITmrZ@iaBwRNJ9C+X(QOV|Df2qkr#-qh7gb zBrm<&&1hj9ZlxSCu+OOwMA_=Cb8Ek56^cGwkVF_X+y_-i>jPF}McTKwTHmI$r3!iy zkZoaV8Jd%yX_eo8CV2mu`~cBCiimF2xOXH?+U@Rg{`t*6imJk1UBHh>nz~tE?el;AOGgs)a$^a?0F^LN3B5USHF6C< zPeVhaPB!i_!uv!9zrNoNkUhTFnD-H+)cP9sZ%$C-gvcB-(d*a_dG}yss0U-|p&}4Q3mI1YJCK-OXAAmkDe1h4(f!3f4&AY?&872-r90f#a+cJOdS{R`v+eUbnG literal 3395 zcmZWsc|4SB8*V|Giouv->YGF2pvV=8#K4Vcq>gD6}{P}eR@w_p0``}_J zluPkf5~8DWqLMHXLhEZUY9~PMyt;$j2*YBcEiWQs z*54#@R+pUAJtZXaPkClGF1ZUw_nj=P^yQ4#31ZAwqW479I@KR&SR&jSjQlv&x9bwT z<*stZqTWEDjH_;6_(idUxklP*l0y-9PCL0v3?%z5#RFE>{c|!#nWV&-N9(ltRqi54 z_#OIqcjgffV<_=CPTV`(^0|oRT0Xgphsg|UDtl-({=E9VrrfJNL(whexoHxH*R=bZ zeP?Jr-m#=?#YBNUG%=NcvX&@RJ^&*M0oa~+0ZJ+Q1575-j;CraOSG|-eC#JcS#09# z+Q5hjO0c3tFwe@o9F=$x%-c$|36*@jaTkm#Nyye}BAv%PGG}SKNQ5!HTMdm%Pj>1Q zWIxmAj2>N3mY}4a6|_F?nx5a%q_*{`F+I-vzAt>`^spLOH(>@sxbI(=zs{m( z4;a4fx2?2U7{uM`yp8j_oA$Hv8m8ikOYXam$NjTfqC=nG_%_7GY=HTXoiR3Gbtj-5 zo3|oUtr7$%{lFLxq76HI)8j-zF--DtBFWV;6I9J!5Dnt?U%?%vaaF|J`^fkXxC_C3 z_QGs%IDFbWgY<%4no&?0s*rWn`=DAGa=^jE1R6V=rT~xT@1VwtQ+y9*QMd{NN4~=s zMetRxSaEL-GC{^@TQAYu31p`zz%%*1&k^msF9zlxV_Uw&)QHVC@i5lxNdz)K)I{YO+eJ%2Q zzMY;*jC32sa$5}gNMF_AC|psyXTx-lMODXZrFOA4WR%Ju@g~pK!gX6-U42}AMtCKs zqOm~3?8?mSr_(0K;-y{)W;HdqJx*(!qjIX&_g)fj8!K6BW<%-6_PEEI<@Ns|RoUR$ zLK}1o+@m8E`k$9MbY!kYovb6LaE*Lb9KvYCS}AAV)IAlpkJg?9sIX_<gvDNLa%V)6DCfDJiqr*Z3q#?2fQw=SKwBipP4|93_r>ue}6D%u?>3;&n$~ z)*w9Df6}WPWdGtQs)6MYa=n|m=CBGv(#LfwdsOFJl&lN%2 zt~Bwsk?I@v(!{F72>!cik2H3_9KnDmMnX4ME)dFe5bgq}oi)Oh>~$Rr%x# z%A@jMka`-=hb*Vv47mQ3;R?0qwn|k7kbk@W+G~T0W4Y!SsWTSgyJ-QX(PQ8cULJRi zGqnD8f=`>`Q|N#@RF`@~WzdTL%4%Jw{@s+pJpHVg=*i!UjdsF5mE@+tHd_A5kS?M% z-@S;9O!ZjzLLIqCiNWDRbQP9^ZmMZ*N8#3*gjJ@`KRtEq%HA&F_+l}s;K-&+q1SQz z>B_pRGUe6e$_XBzsI~IF8#C9@s5=n!yV+O%PI0f zXO)x25o!U+?c*E5WQq7Yra30nZ{Z{NN4w};u?F>K=T@VP^#)KFQ(O>kdztCeK*!!u zh_D`XGgg;nO8NWSF3foh=iM;*(r|mO)4}-kwWw1G-8(7@ro7Lb+8C44H08b+A@68X zwm4wAxi#P7O!4JkJ414_ahD0xpQhqpP*Ipw=XpWiMx1bwH1|qyLR{yeLgSSp@a{wrcOS?lN6g`5 zVPO*parH9scX3Un5=(pY8pj?~U3l0X_73ICz4grycDiCP6Y_4K^KOwO=Dp;U|g6 zIu`MY%83S51KW;C|B|W;f@3~KKKy~h-sbAT2!`X_xufbWll@X#xm|gOYVxe7yMR5h zq_+!-Dp<29C+u(a2&{b_+bl|P+GNLU0|Jp5vfa+r%IU(4htdNZN3XJDeWq4+8HGd2 zy?1-f-#`sZ{w{j$FnJm&^kd+N*-u9?5#86lhPTxf= z{UsxW@jB-=91(s`iZ*)5$2MT()e9yV7#X-3b+71io*{XK5d~X*v*YH=6Dws8Babvi z;KMwKA+lQzBs|Pn!7nY<5*Nnbd>bly(~`UzeWPtje{rVObD5YQw}Iz@9Nou;N7gk& z&J9Pc4#y$MtC>qnW7NU?9bZ?@ctzv&$p<5S*N1SS#yR(ux>RreYNfPgt@8!_hN4`H z918_Gfo-gSrZ0Q%NhNGNRxIoI$?dZV^(QROFmwv8J>KE$2rWs>oMD0S~wjHOk|SR04%fp)q~_l!x_W z{(tV;|E~lB=;qmeOoj>Q@d1>Hz7__9)zs9~#$dJdG__Sh4Fj28L7w1u0P3){18~@v z$zroS1N{Qn09Hd2qx!EtIDu4e2nNuFVE$eJ4vW>s0^Yz6OdF#G4kB6r<1b804+m=c zf7pH<@csWUhQVn5glX;9`We&J`{@pC%zjYdzv{6ADSk9+Ao#%ppzZuZsemqkwq-Iw lRYf8LXmf@)6A+2?{XMhTltA|P*|asWdXU|_iAPN#{{`Xf*&6@= diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_625.pdf b/Documentation/media/uapi/v4l/dev-raw-vbi_files/vbi_625.pdf index 765235e33a4de256a0b3fbf64ffe52946190cac4..bf29b95dcd0800b4f7d05389ad60cf3e82569b00 100644 GIT binary patch literal 3996 zcmd5`y9R&aY#**zT03rD4%M^eXAdBk>qSmiR z@dXgb^g{)w=y$B@cw|p>*o4{g@B(%-uc{lRU@o^|p5g`+$nl(92EQQz5UFBa})L_9zh5(KQn3^I6cwm@VcmiN3W&jSru$b^aoB{k{;veH=@39MH31n-6 zNdO7S9r*_TCS#DNV*nV(5FQ9%9GG69ES>`s0yzTM_snNI8P&J77Ok=|s>WHm7Y zJOr|ySaKmhnZ^9ymH#Cdqp4iJ0m3CL(Lv5^x%{lulPJu@DNlleh@Cnx#Qj8RvV{IuP#6QoNWR~K0zTNOAk(o+%W;N%Og+Ge$TuRit+8u&Ibmz}XA3yL|t9=Yd4N#uRDjk%(EzaN_! zeka0aNZh6zW2r=6{!64mbfvs%e#P6fNpF`g+lf_hSpL%ecEX}?tT+avYgRB8&aJNf zbhc%1(7fn;mmrZkHD`M3W%!6#SIuy{atsLkp-a!vkv-B;!YI>>^(PX!Q zwEUlRb#9abie3l7PO}A-SzP&Y6FartekAD0)N=0tq`AR3RyLGH2=KOPz9<|;QPyucx>sSn~OJusHoZ0?s?;!FYfy_o-6Uo z7YB(eI4X+hLXl66a=v)e%Y%zGg=?KyE%A>|_GK+l%kEb#ezN(Kxp;W)jp)2bcQ?Od z4CVS>9KLt!K4X7~2Wml=kz*3GzGEf-e%?plShRtBtZ`TRJepztN~hHt`5!CPQgMIX zE9tO_m@g7;-!ii5*AF$8hNm67@DIzRpXbmHequZ=FZOUVD2+3=%m1i+K^(NXbMFQ< zaPEy>V$_xsh3UP?`E7C0%E}9J*+Tc+w@nE#D^wR!ledrF&k4T~XF1f?-gZAJvn=}I zV@K)iBj~)^mug*DiHI>*@S6#2u&9aS57lydM_f>~WH`HTJ4t zdthdt;>tfC1{OF6&@(O-9w{03ZZ^a138ELh$|@n4vH9vWr&J;N*|YLFFVt@u$W!;0 z-x)lq#Y#<-WcrTiQa@IeP;!DlQ_t1K3j2Rg4<6Gqus|vQj&~N}{gcsEc8YbDnKf6c z-nplIzW;7%?JLM|FqpcmZ^*gm_QAy!pISej8sc<)H0W+LKHcgWWYl`TU9MYusJHJ; z$X`oqsXML(hpHOY|JAKP4)Zr?`(%ER@D$Iw8`rJBT{FJgHmcX7FzocMHIFU2LNtp8 z6z{Ssb@#jEujZ}hA9Fgc*OqQhOR!Mgtp#-cbaj+ud8`$ut>(C=54@7_AztU2@gbV$ zmFrdiOuzhmpAAh-R}g#M?9jrO*W$FB52&|91YzH^tttMe*WG@_=^DFAW#*XF66?jM#u-zA5wwQ3Za;R=Yu+h>pfr>dEZ*z=AO}11+9Oh_sUuC&c`6+Y5sAD!u zN;NItZgXf-(Rp5WPW`v)C881NlYY^PKK;KXXYm2*=gyK~8iyib46XB&Q&P;#W` za_(@+zDu_+Yd?3l7D^5XheLz!8&Hj}SAL>rXdb@uFe7v%tw|(_>&NIynM$!U6vh{2 z2X+qWe6WduoPNn}e_>@&g_&BPP#S%MHz;T*&~)?Mt4C9*4q=K)>(6Ss@sL?!zBq!e z5=Esgj9_=7o-5_M;7yOryKtv#&QkZI8HxJ5#9gm*wUaH=6*&*sr`p>cwb~jQlIPHL z+C9SjFCT9o(~Gek(euklDG0o*iN1h;T_jR($m_jM+Uaxby?XJjJ^Q^Mn?&BtTmKVy z$*y_Zp-1OWjM7XVjA9lE?*)uUs;~672>WBFzU{~klJ&T>HK0o1VjB93U|gu)U3RA+ zQ7P%XyR_hf`8jvv=Xux8{Mk^fkr&gJy3Ode=5j_Vy##u@-&jiXJE7h^C-5-Z;CKOk z#vCDMEB~2#u~O6dpxIKgS#J$7xlO!uL};fMXvkl_>Xh9;C|aX#3q$4cyU@p1mg(In zV*YV7x7GyBE^4SRZnL4SMOoie6n;Q8%%nQkOZA+o&N|?wRbU&rv`Z*SHpb9YDF4{v zsG`h;yZy9gKv5*QsV>fip6Wfm%dAqn%$uz#pef&zp2;Dtiqgob&nVt3%vu#C$y5+Y z0vsY*VQXKSg2bo(@T%C1$PIeOJ}s0AB`NkZMG_yLjiaMVVw8U8McL)bYiv4kJaPNh zq$lN?nDE$Q_WSlDl$;))R6-6Vr>xP$OOoTXyY>VjopCixIiRNcmIy`Q{Ya~1OlFc- z;jtv*6thBz(08N}H$f~BcKClydXNMec1*qxAfs+FDm+a;2kziz$jQmwO&hfz;3}oT zuiuY-M)nuwX8cX3rW6S5pNOC86G8;1`t(II@MQ$fhV99R@)#&@3h!;sQ8B9MO;rpuGhGo(Tq)G_cVNV)DG%EWRNZ^3v0j#c_bRo&hXa zef{U#zGxoYl-fe%!9)cVrhw_o^_uVvQ&s+??D?`O7y@^qumFyP!cGr>Od=6Tz)oP& zMj()3*T?`kQ#LG)2si9I8x{vEl<#afJj}Ykvk^%@uEYP0KeEw}amggO&ENVXV9Bti z_|}Fs`f)D-OZ>qffk1@O@aOV literal 3683 zcmZWsc{r478#mUBeaW6)TMT73!wia;kZEzozLhaEG-5_(tYxjn$eOKmNKOliG-+j! zAu3r;NlIm}h@=p*eDC!2o$q|#d9U}npXd7B%k#VM=lSEl4P5XJ+mNOxs6qQw_8(9) z00A%pL!j2y@I6#|FzXP20TCkHffmZ5MgVY!P!fxZr;-^I>W&>yCM$wU3WLTJcltce zqTZEx+f)-nu(BQGoVzWPBlq!MQYepE50P*eFP6<2lruPz%PLKlPVY~8YZ>n}k*gee z$vC?C`F!HUx=p-w!qErc&ZIWkElezRr=||US6ug0AILesSv)x@XeN8JcIls!HQAqm z+hboCfeCA?A0$?30f236oE!o&qeLph60Vlydl295uFiYy9HJ@t+f2Nd(_(3+Xo;JL z;*@^&r5mPN+)QOlnm;yB6BhNXF1*#8Xh(c=gfAL%C%>QJfCUL z_Ue89=?peQ+NLW~! ztoKXSFtuqE4XN@}_}C)UQo+>U^7J=boWipaN67eCpNEaGQMr55vVtwP`2%ke)bwLi zY@kNv>>C110e~kcyX<4pXD=p2EDvr=5S5o*go+s7kNPHeT*xoYs~FGU6Ggmtt_KMg=vC}Rl?0^^D8D|s zUr=J0)wI4^ck7SJcTs<9P(MC*kG@Il3b)FJ;_>8w7RP?+h!MjLR ze1l4ht^01@)L&vheC$zp>7aKmokWAEsTlfs6NT9iVV;G`$v5>U_|H&?t^4Y4UXqti zSE|_x6KfgiH6fhZ>79FwM8m16lppja%CjGeUDyhfq;d=86-6wxOt+~M1beu&8eI6a zs`_CWtEu420a96N>Qi55g^SBaRt@J1Gj@dV{7NnRxT5oR59);=X!mewSp%0H?SU6+ zQ7H#AE*BTZF8+S9Rp`eyZqwB%`^$!J4yB6}i><4DMG-nZtJf6>D@~{TVLh0V$m1Vg zD%Pi@*Q_Ss&dy{*heO`NY}DOtwDSV_?4G!1#$76H{yw2Z&*Hf3YO(H$;g(Tos?5HZ zo~03*X*JkuwQ{a9bsTq9qwed7Mj576*Zl;ZL46kc&CNyI51q?HPZanb&b30WymOff z*g25|n5tbX2J5#Ap(FJ2$;R{qogtfV@jH!%p1U_(#s>$A=EMn44_>6pncooV=jNVK zZOk&8sxBO9_J0w#6W1%n?_W&X)H!f@N!evmQ`1_H$W15XkMm2$@svTa@TlWoytbue zd-0<=U0QaVc2$+C<+d9i!1m8v^G>Xgy%xiz(F(bEojP`8DAZZrfA8F|vqjRe-=xI| ztKu$7pPw7*I#dqr?HCjaarMKo?cmxD<621?Uy34h1Knzy&NV@LuVC)B9Tzg6?RsdS zEzC(PP6l08%%g=uMhVtzJGmIqw;2Up<@0Hry4K8NMRr(QA6qC;Nhq3L2kF-zy6zWZFN7hzjnWMq zJ92oSK{x631yPVxb`0$1th}v^7x_F#?J_Yec$DjN`FkW^_r|^T}2Q8caj!b_hoM-+K$<8bL~&{GOD8n2`Xc+Q${kf zKUCqWq7n1G)3s_(iOzn{Ds(Ren%Q$9CrZCe$J8m9BUPwgcd8PdZ+n&hw3#FMDJw0* zT~P$>sqb_5bdERwHBR|xfu)C49kkE953Q5CfoQdYuLyCpDSDXcK&#NqL|@Z9j2h1@ zN*&7_OXO_)5o!*@-a(Y*Brjovud`i6qusv?;^Ip8{M2xa>=Vtry{gvUu6k9ve zX5$h!zKq=#eZ_^cuk}v-srW6)H{=TTOb&_bC@D((a9MKID1Kn}0MBkr?>n6{udr|)|(XsPU)(pm9iQ#1CLpBE(_&yn1;1RlpaFbGgk-JilJ{hi-^Ibqk4 zL&HUL#2?8UJWihZ^j)6>6WxBZQ>jR6B;`wU_QDG&L|ap;n4~0ps-bShktbVi;TzlQ z+MV&}jo1r=V)AXH82P2JZ7B_YgyuY2Y#L`{{haQa=xGz5s{VV^wL7a~DA*>K8|Dqv z0L+5uqiR!gYgBH7O&fdMYlYve5h^7X{MmEseO;-*Mqjbl*JiYJNu3ZI_GC0#7b!7C z4bRHl72+r>dbCKyh}5w&9Kolpy8L#y;K$lrej)1R>a6pj6H{M}6}{Kb`L}JD=2s@( zJx%Hk7}#Ff-x28|%-W8T|Y`fN(I`vk{D%LZ3-Rf*h8fBuATYaso8S>D7p5l`&YFfs1EB~<%oC1>0r znD^8nI8%+3ytlf$|7l;aTJLg(YDj#DnN_JbbRPFDEu%k)@wR8hYj?e}-m`X%kg;P~ z4|Q=bvzYYX{ew|y`#^5q;UkUuQYjWF=6M62NM|{vNc>9zmuFz;gc!^%IBvo5 zQL(|E_O0Sw`!?-`ZCuZPb^T$g_2%rQJhdLg;#i-(OG|m$`+!%y3c3dShV$ayfAMaU zE~N|0mTJs@q%||=GQ@UuM+D71wNAQQ8(7kHXtKKKB8}%_mU%{fFQKT}wMqJro6$MK zPUeXvM+Wp!_dC(t&BL(AE7oW3a#v3MF0_0&TzaC$LGq8L5dC+r@`Oir1GASnam&+^ zqn>3;iD1{ZKDV$qdhjcHzHND79+~K#J~Q@T*W>CXSbJm~(IAIPtWMK_SaN=tU%Q`tyA#hsXP7qm6DA@`yNFaWe@_k1XDPM``1_BX^XtET0eO3O#Ex_SM5sBnnu&1 z26g!#lpXMUT(w{u+|eGfnz1N*?Jfx8gqKzK{-JQatftwfgg@&hZmYD{11bZCZ=x&b z4kllz(D~6mGt@p)1ap6NPzl<}IbGhHms78^11bD-!pQUd&&so@s9!{?Rd89zSENX_M8< zZyzs6sq4tUvTX$y{L$m&HeHA$sYes$j9PSC9jdUU~x!lAIxUl{tYP96$(iw&m& za2HZA6$;-=rO-%rj2OTd0a{>i7yxUA@`r-j2r8Wgpaktc6i%cv8IciWDig4_20bGf zWLGK+@P&iZ0swcT#;`yS2L@xs_;r5^cjKu^5(*#if{o*9B`ZZk$ zDE*88-$x3gf+66pk%24$D9|9`b|fZMZ~)wi8X84q(a5C#h7oZ5cNmb%U#T$xIDtlC z0=`f|>O`nN01}A=DI)*I0QnDBdlHKj$_V~WQ|L<8Ae{--0ryUlJLC1qL5MYG2 zL?I9uBoc{6U{E+D4hGgRf+z8U#fE zSSaGJ4=~4I&=?>H_=Ta-NRX}I1L%KYC=8hV|6vF;nDGB%2m}&*6aR~$5y*eop^?~s zo`E(8U&eoYSrH^!C^Z5c2m!b&EshFc0XUJt0IMn}G63IA4`Kj Date: Thu, 18 Aug 2016 07:37:49 -0300 Subject: [PATCH 060/591] [media] dev-sliced-vbi.rst: use a footnote for VBI images Just like on dvb-raw-vbi.rst, the LaTeX output doesn't work well with cell spans. Also, this is actually a note, so, move it to a footnote. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/dev-sliced-vbi.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst index 9f59ba6847ec..9f348e164782 100644 --- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst @@ -155,8 +155,7 @@ struct v4l2_sliced_vbi_format service the driver chooses. Data services are defined in :ref:`vbi-services2`. Array indices - map to ITU-R line numbers (see also :ref:`vbi-525` and - :ref:`vbi-625`) as follows: + map to ITU-R line numbers\ [#f2]_ as follows: - .. row 3 @@ -838,3 +837,6 @@ Line Identifiers for struct v4l2_mpeg_vbi_itv0_line id field .. [#f1] According to :ref:`ETS 300 706 ` lines 6-22 of the first field and lines 5-22 of the second field may carry Teletext data. + +.. [#f2] + See also :ref:`vbi-525` and :ref:`vbi-625`. From 0101036c7b4d5fc3b7f268312f49378c2db1777d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 07:38:53 -0300 Subject: [PATCH 061/591] [media] dev-sliced-vbi.rst: Adjust tables on LaTeX output Better format the tables in a way that will fit inside the page. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/dev-sliced-vbi.rst | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst index 9f348e164782..074aa3798152 100644 --- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst @@ -105,7 +105,9 @@ which may return ``EBUSY`` can be the struct v4l2_sliced_vbi_format ----------------------------- -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}| +.. tabularcolumns:: |p{1.0cm}|p{4.5cm}|p{4.0cm}|p{4.0cm}|p{4.0cm}| + +.. cssclass:: longtable .. flat-table:: :header-rows: 0 @@ -242,8 +244,8 @@ struct v4l2_sliced_vbi_format - ``reserved``\ [2] - :cspan:`2` This array is reserved for future extensions. - Applications and drivers must set it to zero. + Applications and drivers must set it to zero. .. _vbi-services2: @@ -251,7 +253,11 @@ struct v4l2_sliced_vbi_format Sliced VBI services ------------------- -.. tabularcolumns:: |p{4.4cm}|p{2.2cm}|p{2.2cm}|p{4.4cm}|p{4.3cm}| +.. raw:: latex + + \newline\newline\begin{adjustbox}{width=\columnwidth} + +.. tabularcolumns:: |p{5.0cm}|p{1.4cm}|p{3.0cm}|p{2.5cm}|p{9.0cm}| .. flat-table:: :header-rows: 1 @@ -277,7 +283,9 @@ Sliced VBI services - 0x0001 - - :ref:`ets300706`, :ref:`itu653` + - :ref:`ets300706`, + + :ref:`itu653` - PAL/SECAM line 7-22, 320-335 (second field 7-22) @@ -316,7 +324,9 @@ Sliced VBI services - 0x4000 - - :ref:`itu1119`, :ref:`en300294` + - :ref:`itu1119`, + + :ref:`en300294` - PAL/SECAM line 23 @@ -344,6 +354,10 @@ Sliced VBI services - :cspan:`2` Set of services applicable to 625 line systems. +.. raw:: latex + + \end{adjustbox}\newline\newline + Drivers may return an ``EINVAL`` error code when applications attempt to read or write data without prior format negotiation, after switching the @@ -561,7 +575,7 @@ number). struct v4l2_mpeg_vbi_fmt_ivtv ----------------------------- -.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{1.0cm}|p{11.5cm}| .. flat-table:: :header-rows: 0 @@ -661,7 +675,7 @@ Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field struct v4l2_mpeg_vbi_itv0 ------------------------- -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. tabularcolumns:: |p{4.4cm}|p{2.4cm}|p{10.7cm}| .. flat-table:: :header-rows: 0 @@ -687,9 +701,9 @@ struct v4l2_mpeg_vbi_itv0 :: linemask[0] b0: line 6 first field - linemask[0] b17: line 23 first field - linemask[0] b18: line 6 second field - linemask[0] b31: line 19 second field + linemask[0] b17: line 23 first field + linemask[0] b18: line 6 second field + linemask[0] b31: line 19 second field linemask[1] b0: line 20 second field linemask[1] b3: line 23 second field linemask[1] b4-b31: unused and set to 0 From 352ca7e7f81a1021c2682990f52019d1f2e8583b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 08:16:26 -0300 Subject: [PATCH 062/591] [media] dev-rds.rst: adjust table dimentions for LaTeX One of the tables has wrong column dimentions. Fix it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/dev-rds.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/dev-rds.rst b/Documentation/media/uapi/v4l/dev-rds.rst index 35117414c86b..841761a3ea59 100644 --- a/Documentation/media/uapi/v4l/dev-rds.rst +++ b/Documentation/media/uapi/v4l/dev-rds.rst @@ -170,7 +170,7 @@ RDS datastructures .. _v4l2-rds-block-codes: -.. tabularcolumns:: |p{2.2cm}|p{2.2cm}|p{2.2cm}|p{10.9cm}| +.. tabularcolumns:: |p{5.6cm}|p{2.0cm}|p{1.5cm}|p{7.0cm}| .. flat-table:: Block defines :header-rows: 0 From 3772b56a05690a66a018d22f9331cb5370572965 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 09:04:57 -0300 Subject: [PATCH 063/591] [media] dev-subdev.rst: make table fully visible on LaTeX The table there is too big and doesn't have format hints for LaTeX output. Fix it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/dev-subdev.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/media/uapi/v4l/dev-subdev.rst b/Documentation/media/uapi/v4l/dev-subdev.rst index 5a112eb7a245..b1aed4541bca 100644 --- a/Documentation/media/uapi/v4l/dev-subdev.rst +++ b/Documentation/media/uapi/v4l/dev-subdev.rst @@ -204,9 +204,16 @@ list entity names and pad numbers). .. _sample-pipeline-config: +.. raw:: latex + + \newline\newline\begin{adjustbox}{width=\columnwidth} + +.. tabularcolumns:: |p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}| + .. flat-table:: Sample Pipeline Configuration :header-rows: 1 :stub-columns: 0 + :widths: 5 5 5 5 5 5 5 - .. row 1 @@ -288,7 +295,9 @@ list entity names and pad numbers). - *1280x960/SGRBG8_1X8* +.. raw:: latex + \end{adjustbox}\newline\newline 1. Initial state. The sensor source pad format is set to its native 3MP size and V4L2_MBUS_FMT_SGRBG8_1X8 media bus code. Formats on the From 2ec708745f2ae981297b07d8f1cb1ce87010d6d6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 10:39:06 -0300 Subject: [PATCH 064/591] [media] subdev-formats.rst: adjust most of the tables to fill in page Fix mosto fo the tables there in order to make them fit at the page size. There are, however, two exceptions: RGB and YUV big tables, where adding the raw latex adjustbox caused the tables to not be properly formatted. I suspect that the problem is because those are long tables, but not really sure. The thing is that Sphinx lacks an "adjustbox" tag that would avoid the raw latex hacks. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/subdev-formats.rst | 5575 +++++++++-------- 1 file changed, 2806 insertions(+), 2769 deletions(-) diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 265a6dc5fe92..7d9b55dd6e91 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -155,12 +155,16 @@ half of the green value) transferred first will be named The following tables list existing packed RGB formats. +.. FIXME: I was unable to find a way to use adjustbox or landscape for this table! + +.. tabularcolumns:: |p{7.6cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{-1.0cm}| .. _v4l2-mbus-pixelcode-rgb: .. flat-table:: RGB formats :header-rows: 2 :stub-columns: 0 + :widths: 36 7 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 - .. row 1 @@ -249,45 +253,45 @@ The following tables list existing packed RGB formats. - 0x1016 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`3` @@ -320,53 +324,53 @@ The following tables list existing packed RGB formats. - 0x1001 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - 0 @@ -389,53 +393,53 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`3` @@ -460,53 +464,53 @@ The following tables list existing packed RGB formats. - 0x1002 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`3` @@ -529,53 +533,53 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - 0 @@ -600,53 +604,53 @@ The following tables list existing packed RGB formats. - 0x1003 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - 0 @@ -669,53 +673,53 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`2` @@ -740,53 +744,53 @@ The following tables list existing packed RGB formats. - 0x1004 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`2` @@ -809,53 +813,53 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - 0 @@ -880,37 +884,37 @@ The following tables list existing packed RGB formats. - 0x1017 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`4` @@ -951,53 +955,53 @@ The following tables list existing packed RGB formats. - 0x1005 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`4` @@ -1020,53 +1024,53 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`2` @@ -1091,53 +1095,53 @@ The following tables list existing packed RGB formats. - 0x1006 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`2` @@ -1160,53 +1164,53 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`4` @@ -1231,53 +1235,53 @@ The following tables list existing packed RGB formats. - 0x1007 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`4` @@ -1300,53 +1304,53 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`2` @@ -1371,53 +1375,53 @@ The following tables list existing packed RGB formats. - 0x1008 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`2` @@ -1440,53 +1444,53 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`4` @@ -1511,33 +1515,33 @@ The following tables list existing packed RGB formats. - 0x1009 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`5` @@ -1582,21 +1586,21 @@ The following tables list existing packed RGB formats. - 0x100e - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`7` @@ -1653,21 +1657,21 @@ The following tables list existing packed RGB formats. - 0x1015 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - 0 @@ -1724,21 +1728,21 @@ The following tables list existing packed RGB formats. - 0x1013 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`7` @@ -1795,21 +1799,21 @@ The following tables list existing packed RGB formats. - 0x1014 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`7` @@ -1866,21 +1870,21 @@ The following tables list existing packed RGB formats. - 0x100a - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`7` @@ -1937,45 +1941,45 @@ The following tables list existing packed RGB formats. - 0x100b - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`7` @@ -2006,45 +2010,45 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`3` @@ -2077,45 +2081,45 @@ The following tables list existing packed RGB formats. - 0x100c - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`3` @@ -2146,45 +2150,45 @@ The following tables list existing packed RGB formats. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`7` @@ -2352,7 +2356,6 @@ The following tables list existing packed RGB formats. - b\ :sub:`0` - On LVDS buses, usually each sample is transferred serialized in seven time slots per pixel clock, on three (18-bit) or four (24-bit) differential data pairs at the same time. The remaining bits are used @@ -2361,6 +2364,9 @@ for control signals as defined by SPWG/PSWG/VESA or JEIDA standards. The JEIDA defined bit mapping will be named ``MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA``, for example. +.. raw:: latex + + \newline\newline\begin{adjustbox}{width=\columnwidth} .. _v4l2-mbus-pixelcode-rgb-lvds: @@ -2404,7 +2410,7 @@ JEIDA defined bit mapping will be named - 0 - - - - + - - d @@ -2419,7 +2425,7 @@ JEIDA defined bit mapping will be named - 1 - - - - + - - d @@ -2434,7 +2440,7 @@ JEIDA defined bit mapping will be named - 2 - - - - + - - d @@ -2449,7 +2455,7 @@ JEIDA defined bit mapping will be named - 3 - - - - + - - b\ :sub:`5` @@ -2464,7 +2470,7 @@ JEIDA defined bit mapping will be named - 4 - - - - + - - b\ :sub:`4` @@ -2479,7 +2485,7 @@ JEIDA defined bit mapping will be named - 5 - - - - + - - b\ :sub:`3` @@ -2494,7 +2500,7 @@ JEIDA defined bit mapping will be named - 6 - - - - + - - b\ :sub:`2` @@ -2716,6 +2722,9 @@ JEIDA defined bit mapping will be named - r\ :sub:`2` +.. raw:: latex + + \end{adjustbox}\newline\newline Bayer Formats @@ -2770,8 +2779,16 @@ The following table lists existing packed Bayer formats. The data organization is given as an example for the first pixel only. +.. raw:: latex + + \newline\newline\begin{adjustbox}{width=\columnwidth} + +.. tabularcolumns:: |p{7.6cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}| + .. _v4l2-mbus-pixelcode-bayer: +.. cssclass: longtable + .. flat-table:: Bayer Formats :header-rows: 2 :stub-columns: 0 @@ -2823,13 +2840,13 @@ organization is given as an example for the first pixel only. - 0x3001 - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`7` @@ -2854,13 +2871,13 @@ organization is given as an example for the first pixel only. - 0x3013 - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`7` @@ -2885,13 +2902,13 @@ organization is given as an example for the first pixel only. - 0x3002 - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`7` @@ -2916,13 +2933,13 @@ organization is given as an example for the first pixel only. - 0x3014 - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`7` @@ -2947,13 +2964,13 @@ organization is given as an example for the first pixel only. - 0x3015 - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`7` @@ -2978,13 +2995,13 @@ organization is given as an example for the first pixel only. - 0x3016 - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`7` @@ -3009,13 +3026,13 @@ organization is given as an example for the first pixel only. - 0x3017 - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`7` @@ -3040,13 +3057,13 @@ organization is given as an example for the first pixel only. - 0x3018 - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`7` @@ -3071,13 +3088,13 @@ organization is given as an example for the first pixel only. - 0x300b - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`7` @@ -3102,13 +3119,13 @@ organization is given as an example for the first pixel only. - 0x300c - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`7` @@ -3133,13 +3150,13 @@ organization is given as an example for the first pixel only. - 0x3009 - - - - + - - - - + - - - - + - - - - + - - g\ :sub:`7` @@ -3164,13 +3181,13 @@ organization is given as an example for the first pixel only. - 0x300d - - - - + - - - - + - - - - + - - - - + - - r\ :sub:`7` @@ -3195,13 +3212,13 @@ organization is given as an example for the first pixel only. - 0x3003 - - - - + - - - - + - - - - + - - - - + - - 0 @@ -3224,13 +3241,13 @@ organization is given as an example for the first pixel only. - - - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`7` @@ -3255,13 +3272,13 @@ organization is given as an example for the first pixel only. - 0x3004 - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`7` @@ -3284,13 +3301,13 @@ organization is given as an example for the first pixel only. - - - - - - + - - - - + - - - - + - - - - + - - 0 @@ -3315,13 +3332,13 @@ organization is given as an example for the first pixel only. - 0x3005 - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`9` @@ -3344,13 +3361,13 @@ organization is given as an example for the first pixel only. - - - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`1` @@ -3375,13 +3392,13 @@ organization is given as an example for the first pixel only. - 0x3006 - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`1` @@ -3404,13 +3421,13 @@ organization is given as an example for the first pixel only. - - - - - - + - - - - + - - - - + - - - - + - - b\ :sub:`9` @@ -3435,9 +3452,9 @@ organization is given as an example for the first pixel only. - 0x3007 - - - - + - - - - + - - b\ :sub:`9` @@ -3466,9 +3483,9 @@ organization is given as an example for the first pixel only. - 0x300e - - - - + - - - - + - - g\ :sub:`9` @@ -3497,9 +3514,9 @@ organization is given as an example for the first pixel only. - 0x300a - - - - + - - - - + - - g\ :sub:`9` @@ -3528,9 +3545,9 @@ organization is given as an example for the first pixel only. - 0x300f - - - - + - - - - + - - r\ :sub:`9` @@ -3676,6 +3693,9 @@ organization is given as an example for the first pixel only. - r\ :sub:`0` +.. raw:: latex + + \end{adjustbox}\newline\newline Packed YUV Formats @@ -3728,17 +3748,22 @@ the following codes. - a\ :sub:`x` for alpha component bit number x -- - for non-available bits (for positions higher than the bus width) +- for non-available bits (for positions higher than the bus width) - d for dummy bits +.. FIXME: I was unable to find a way to use adjustbox or landscape for this table! + +.. tabularcolumns:: |p{7.6cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{-1.0cm}| .. _v4l2-mbus-pixelcode-yuv8: +.. cssclass: longtable + .. flat-table:: YUV Formats :header-rows: 2 :stub-columns: 0 - + :widths: 36 7 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 - .. row 1 @@ -3826,53 +3851,53 @@ the following codes. - 0x2001 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -3897,53 +3922,53 @@ the following codes. - 0x2015 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -3966,53 +3991,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -4037,53 +4062,53 @@ the following codes. - 0x2002 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -4106,53 +4131,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4175,53 +4200,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4244,53 +4269,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -4313,53 +4338,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4382,53 +4407,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4453,53 +4478,53 @@ the following codes. - 0x2003 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -4522,53 +4547,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4591,53 +4616,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4660,53 +4685,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -4729,53 +4754,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4798,53 +4823,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4869,53 +4894,53 @@ the following codes. - 0x2004 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -4938,53 +4963,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5007,53 +5032,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -5076,53 +5101,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5145,53 +5170,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5214,53 +5239,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -5285,53 +5310,53 @@ the following codes. - 0x2005 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5354,53 +5379,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5423,53 +5448,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -5492,53 +5517,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5561,53 +5586,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5630,53 +5655,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -5701,53 +5726,53 @@ the following codes. - 0x2006 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -5770,53 +5795,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5839,53 +5864,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -5908,53 +5933,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -5979,53 +6004,53 @@ the following codes. - 0x2007 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -6048,53 +6073,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -6117,53 +6142,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -6186,53 +6211,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -6257,53 +6282,53 @@ the following codes. - 0x2008 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -6326,53 +6351,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -6395,53 +6420,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -6464,53 +6489,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -6535,53 +6560,53 @@ the following codes. - 0x2009 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -6604,53 +6629,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -6673,53 +6698,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -6742,53 +6767,53 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -6813,49 +6838,49 @@ the following codes. - 0x200a - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -6884,49 +6909,49 @@ the following codes. - 0x2018 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`9` @@ -6953,49 +6978,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -7022,49 +7047,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`9` @@ -7091,49 +7116,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -7162,49 +7187,49 @@ the following codes. - 0x2019 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`9` @@ -7231,49 +7256,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -7300,49 +7325,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`9` @@ -7369,49 +7394,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -7440,49 +7465,49 @@ the following codes. - 0x200b - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -7509,49 +7534,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`9` @@ -7578,49 +7603,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -7647,49 +7672,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`9` @@ -7718,49 +7743,49 @@ the following codes. - 0x200c - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -7787,49 +7812,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`9` @@ -7856,49 +7881,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -7925,49 +7950,49 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`9` @@ -7996,45 +8021,45 @@ the following codes. - 0x2013 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -8067,45 +8092,45 @@ the following codes. - 0x201c - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`11` @@ -8136,45 +8161,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -8205,45 +8230,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`11` @@ -8274,45 +8299,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -8345,45 +8370,45 @@ the following codes. - 0x201d - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`11` @@ -8414,45 +8439,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -8483,45 +8508,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`11` @@ -8552,45 +8577,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -8623,45 +8648,45 @@ the following codes. - 0x201e - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -8692,45 +8717,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`11` @@ -8761,45 +8786,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -8830,45 +8855,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`11` @@ -8901,45 +8926,45 @@ the following codes. - 0x201f - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -8970,45 +8995,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`11` @@ -9039,45 +9064,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -9108,45 +9133,45 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`11` @@ -9179,37 +9204,37 @@ the following codes. - 0x200f - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -9248,37 +9273,37 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -9319,37 +9344,37 @@ the following codes. - 0x2010 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -9388,37 +9413,37 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`7` @@ -9459,37 +9484,37 @@ the following codes. - 0x2011 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -9528,37 +9553,37 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -9599,37 +9624,37 @@ the following codes. - 0x2012 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -9668,37 +9693,37 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -9739,37 +9764,37 @@ the following codes. - 0x2014 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -9808,37 +9833,37 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -9877,37 +9902,37 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -9946,37 +9971,37 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -10017,29 +10042,29 @@ the following codes. - 0x201a - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`9` @@ -10086,29 +10111,29 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`9` @@ -10157,29 +10182,29 @@ the following codes. - 0x201b - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`9` @@ -10226,29 +10251,29 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`9` @@ -10297,29 +10322,29 @@ the following codes. - 0x200d - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -10366,29 +10391,29 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -10437,29 +10462,29 @@ the following codes. - 0x200e - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -10506,29 +10531,29 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`9` @@ -10577,21 +10602,21 @@ the following codes. - 0x201a - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`7` @@ -10648,21 +10673,21 @@ the following codes. - 0x2025 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`7` @@ -10719,21 +10744,21 @@ the following codes. - 0x2020 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`11` @@ -10788,21 +10813,21 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`11` @@ -10859,21 +10884,21 @@ the following codes. - 0x2021 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - v\ :sub:`11` @@ -10928,21 +10953,21 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - u\ :sub:`11` @@ -10999,21 +11024,21 @@ the following codes. - 0x2022 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -11068,21 +11093,21 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -11139,21 +11164,21 @@ the following codes. - 0x2023 - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -11208,21 +11233,21 @@ the following codes. - - - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - - - + - - y\ :sub:`11` @@ -11279,9 +11304,9 @@ the following codes. - 0x2016 - - - - + - - - - + - - y\ :sub:`9` @@ -11449,13 +11474,18 @@ following information. The following table lists existing HSV/HSL formats. +.. raw:: latex + + \newline\newline\begin{adjustbox}{width=\columnwidth} + +.. tabularcolumns:: |p{6.2cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}| .. _v4l2-mbus-pixelcode-hsv: .. flat-table:: HSV/HSL formats :header-rows: 2 :stub-columns: 0 - + :widths: 28 7 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 - .. row 1 @@ -11607,6 +11637,9 @@ The following table lists existing HSV/HSL formats. - v\ :sub:`0` +.. raw:: latex + + \end{adjustbox}\newline\newline JPEG Compressed Formats @@ -11628,6 +11661,8 @@ The following table lists existing JPEG compressed formats. .. _v4l2-mbus-pixelcode-jpeg: +.. tabularcolumns:: |p{5.6cm}|p{1.2cm}|p{10.7cm}| + .. flat-table:: JPEG Formats :header-rows: 1 :stub-columns: 0 @@ -11667,6 +11702,8 @@ formats. .. _v4l2-mbus-pixelcode-vendor-specific: +.. tabularcolumns:: |p{6.6cm}|p{1.2cm}|p{9.7cm}| + .. flat-table:: Vendor and device specific formats :header-rows: 1 :stub-columns: 0 From 3532d9d6c5b3e0f51be61efb2f1ca8912dc928b3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 11:32:30 -0300 Subject: [PATCH 065/591] [media] diff-v4l.rst: Make capabilities table fit in LaTeX This table has several troubles: - a duplicated "struct" on its name; - a reference to a V4L version 1 struct that will never point to something (as we got rid of V4L1 API a long time ago); - misses hints for LaTeX output (column size and longtable style). Fix them. It should be noticed that the first column of this table is not aligned with the rest. I suspect that this is a bug at the flat-table extension. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/diff-v4l.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/diff-v4l.rst b/Documentation/media/uapi/v4l/diff-v4l.rst index e1e034df514c..93263e477127 100644 --- a/Documentation/media/uapi/v4l/diff-v4l.rst +++ b/Documentation/media/uapi/v4l/diff-v4l.rst @@ -95,7 +95,9 @@ and radio devices supporting a set of related functions like video capturing, video overlay and VBI capturing. See :ref:`open` for an introduction. +.. tabularcolumns:: |p{5.5cm}|p{6.5cm}|p{5.5cm} +.. cssclass:: longtable .. flat-table:: :header-rows: 1 @@ -104,7 +106,7 @@ introduction. - .. row 1 - - struct :c:type:`struct video_capability` ``type`` + - ``struct video_capability`` ``type`` - struct :ref:`v4l2_capability ` ``capabilities`` flags From 201784b5be79c52f641649a0bad919d4145582f3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 13:31:34 -0300 Subject: [PATCH 066/591] [media] vidioc-decoder-cmd.rst: better adjust column widths Better adjust the columns for LaTeX output Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst index dad36acbb415..4287e5b21a8b 100644 --- a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst @@ -58,12 +58,14 @@ introduced in Linux 3.3. .. _v4l2-decoder-cmd: -.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| +.. cssclass:: longtable + +.. tabularcolumns:: |p{1.1cm}|p{2.4cm}|p{1.2cm}|p{1.6cm}|p{10.6cm}| .. flat-table:: struct v4l2_decoder_cmd :header-rows: 0 :stub-columns: 0 - :widths: 1 1 2 1 1 + :widths: 11 24 12 16 106 - .. row 1 @@ -189,12 +191,12 @@ introduced in Linux 3.3. .. _decoder-cmds: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. tabularcolumns:: |p{5.6cm}|p{0.6cm}|p{11.3cm}| .. flat-table:: Decoder Commands :header-rows: 0 :stub-columns: 0 - :widths: 3 1 4 + :widths: 56 6 113 - .. row 1 From 0e9411ac56ddd4771be0f513c64c6e8b7eb0af19 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 13:46:03 -0300 Subject: [PATCH 067/591] [media] vidioc-dqevent.rst: adjust two table columns for LaTeX output There are two tables with mangled columns. Fix it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-dqevent.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index 0a84f3a6ed92..6cd5d7068065 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -42,7 +42,9 @@ call. .. _v4l2-event: -.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| +.. tabularcolumns:: |p{3.0cm}|p{4.3cm}|p{2.5cm}|p{7.7cm}| + +.. cssclass: longtable .. flat-table:: struct v4l2_event :header-rows: 0 @@ -328,7 +330,7 @@ call. .. _v4l2-event-ctrl: -.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| +.. tabularcolumns:: |p{3.5cm}|p{3.0cm}|p{1.8cm}|p{8.5cm}| .. flat-table:: struct v4l2_event_ctrl :header-rows: 0 From 64f6838a2b3194c45f85f1335ae77df0bb1361f2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 13:59:24 -0300 Subject: [PATCH 068/591] [media] vidioc-dv-timings-cap.rst: Adjust LaTeX columns Some tables are not properly displayed on LaTeX. Fix them. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/vidioc-dv-timings-cap.rst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst index e14e780eb0d1..b2bf4f3a3c25 100644 --- a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst @@ -56,7 +56,7 @@ that doesn't support them will return an ``EINVAL`` error code. .. _v4l2-bt-timings-cap: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{13.3cm}| .. flat-table:: struct v4l2_bt_timings_cap :header-rows: 0 @@ -136,14 +136,14 @@ that doesn't support them will return an ``EINVAL`` error code. - ``reserved``\ [16] - - Reserved for future extensions. Drivers must set the array to - zero. + - Reserved for future extensions. + Drivers must set the array to zero. .. _v4l2-dv-timings-cap: -.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| +.. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{3.5cm}|p{9.5cm}| .. flat-table:: struct v4l2_dv_timings_cap :header-rows: 0 @@ -175,8 +175,9 @@ that doesn't support them will return an ``EINVAL`` error code. - ``reserved``\ [2] - - Reserved for future extensions. Drivers and applications must set - the array to zero. + - Reserved for future extensions. + + Drivers and applications must set the array to zero. - .. row 4 @@ -203,6 +204,7 @@ that doesn't support them will return an ``EINVAL`` error code. - +.. tabularcolumns:: |p{7.0cm}|p{10.5cm}| .. _dv-bt-cap-capabilities: From 2bff5525366deb68c9e0ca22ce9285cd66eceae8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 14:55:24 -0300 Subject: [PATCH 069/591] [media] vidioc-enumstd.rst: adjust video standards table This table is too big for LaTeX output, and lacks columns specs for LaTeX format. Also, it has a hidden column, as there are some cell spans with the wrong values. Fix it, so it can be displayed properly on LaTeX/PDF. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/vidioc-enumstd.rst | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index 9d7d77af0161..28f00a027cc7 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -272,6 +272,12 @@ support digital TV. See also the Linux DVB API at #define V4L2_STD_ALL (V4L2_STD_525_60 | V4L2_STD_625_50) +.. raw:: latex + + \newline\newline\begin{adjustbox}{width=\columnwidth} + +.. NTSC/M PAL/M /N /B /D /H /I SECAM/B /D /K1 /L +.. tabularcolumns:: |p{2.7cm}|p{2.6cm}|p{3.0cm}|p{3.2cm}|p{3.2cm}|p{2.2cm}|p{1.2cm}|p{3.2cm}|p{3.0cm}|p{2.0cm}|p{2.0cm}|p{2.0cm}| .. _video-standards: @@ -312,7 +318,7 @@ support digital TV. See also the Linux DVB API at - :cspan:`1` 525 - - :cspan:`9` 625 + - :cspan:`8` 625 - .. row 3 @@ -320,7 +326,7 @@ support digital TV. See also the Linux DVB API at - :cspan:`1` 1001/30000 - - :cspan:`9` 1/25 + - :cspan:`8` 1/25 - .. row 4 @@ -330,13 +336,17 @@ support digital TV. See also the Linux DVB API at - 3579611.49 ± 10 - - 4433618.75 ± 5 (3582056.25 ± 5) + - 4433618.75 ± 5 + + (3582056.25 ± 5) - :cspan:`3` 4433618.75 ± 5 - 4433618.75 ± 1 - - :cspan:`3` f\ :sub:`OR` = 4406250 ± 2000, f\ :sub:`OB` = 4250000 ± 2000 + - :cspan:`2` f\ :sub:`OR` = 4406250 ± 2000, + + f\ :sub:`OB` = 4250000 ± 2000 - .. row 5 @@ -390,6 +400,11 @@ support digital TV. See also the Linux DVB API at - 6.5 [#f8]_ +.. raw:: latex + + \end{adjustbox}\newline\newline + + Return Value ============ From e7eaeb37f6e2168e0b240548f775b6f7b3640392 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 05:40:55 -0300 Subject: [PATCH 070/591] [media] vidioc-g-sliced-vbi-cap.rst: make tables fit on LaTeX output The tables don't fit at the page on this file. As noticed before, Sphinx (or LaTeX?) does a crap job on tables with cell span, and some work has to be done to make it fit. Move the see also reference to a footnote, break one paragraph into two and adjust the table columns to make it visible. Signed-off-by: Mauro Carvalho Chehab --- .../uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index 0d4b6b0044a0..740324e6e5db 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -48,7 +48,7 @@ the sliced VBI API is unsupported or ``type`` is invalid. .. _v4l2-sliced-vbi-cap: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{2.9cm}|p{2.9cm}|p{2.9cm}| +.. tabularcolumns:: |p{1.2cm}|p{4.2cm}|p{4.1cm}|p{4.0cm}|p{4.0cm}| .. flat-table:: struct v4l2_sliced_vbi_cap :header-rows: 0 @@ -63,6 +63,7 @@ the sliced VBI API is unsupported or ``type`` is invalid. - ``service_set`` - :cspan:`2` A set of all data services supported by the driver. + Equal to the union of all elements of the ``service_lines`` array. - .. row 2 @@ -74,8 +75,7 @@ the sliced VBI API is unsupported or ``type`` is invalid. - :cspan:`2` Each element of this array contains a set of data services the hardware can look for or insert into a particular scan line. Data services are defined in :ref:`vbi-services`. - Array indices map to ITU-R line numbers (see also :ref:`vbi-525` - and :ref:`vbi-625`) as follows: + Array indices map to ITU-R line numbers\ [#f1]_ as follows: - .. row 3 @@ -171,14 +171,22 @@ the sliced VBI API is unsupported or ``type`` is invalid. - ``reserved``\ [3] - :cspan:`2` This array is reserved for future extensions. + Applications and drivers must set it to zero. +.. [#f1] + See also :ref:`vbi-525` and :ref:`vbi-625`. + + +.. raw:: latex + + \newline\newline\begin{adjustbox}{width=\columnwidth} + +.. tabularcolumns:: |p{5.0cm}|p{1.4cm}|p{3.0cm}|p{2.5cm}|p{9.0cm}| .. _vbi-services: -.. tabularcolumns:: |p{4.4cm}|p{2.2cm}|p{2.2cm}|p{4.4cm}|p{4.3cm}| - .. flat-table:: Sliced VBI services :header-rows: 1 :stub-columns: 0 @@ -203,7 +211,9 @@ the sliced VBI API is unsupported or ``type`` is invalid. - 0x0001 - - :ref:`ets300706`, :ref:`itu653` + - :ref:`ets300706`, + + :ref:`itu653` - PAL/SECAM line 7-22, 320-335 (second field 7-22) @@ -242,7 +252,9 @@ the sliced VBI API is unsupported or ``type`` is invalid. - 0x4000 - - :ref:`en300294`, :ref:`itu1119` + - :ref:`en300294`, + + :ref:`itu1119` - PAL/SECAM line 23 @@ -270,6 +282,10 @@ the sliced VBI API is unsupported or ``type`` is invalid. - :cspan:`2` Set of services applicable to 625 line systems. +.. raw:: latex + + \end{adjustbox}\newline\newline + Return Value ============ From ef76c0685f5591927c553430967bf2e12ddb1dd6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 14:31:47 -0300 Subject: [PATCH 071/591] [media] adjust some vidioc-*rst tables with wrong columns Adjust simple cases where the columns on some vidioc files are overriding their neighbours. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-dqevent.rst | 2 ++ Documentation/media/uapi/v4l/vidioc-enum-fmt.rst | 4 +++- .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 5 +++-- .../media/uapi/v4l/vidioc-enuminput.rst | 2 ++ .../media/uapi/v4l/vidioc-enumoutput.rst | 2 +- .../media/uapi/v4l/vidioc-g-dv-timings.rst | 11 +---------- .../media/uapi/v4l/vidioc-g-enc-index.rst | 6 +++--- .../media/uapi/v4l/vidioc-g-ext-ctrls.rst | 14 ++++++++++---- Documentation/media/uapi/v4l/vidioc-g-fbuf.rst | 4 ++++ Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 2 ++ .../media/uapi/v4l/vidioc-g-jpegcomp.rst | 2 +- .../media/uapi/v4l/vidioc-g-modulator.rst | 10 ++++++---- .../media/uapi/v4l/vidioc-queryctrl.rst | 16 ++++++++++++---- 13 files changed, 50 insertions(+), 30 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index 6cd5d7068065..ad4b826a2966 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -183,6 +183,8 @@ call. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. cssclass:: longtable + .. flat-table:: Event Types :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index 6bb30ade6aad..2d1444b0d017 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -108,7 +108,9 @@ one until ``EINVAL`` is returned. - :cspan:`2` .. _v4l2-fourcc: - ``#define v4l2_fourcc(a,b,c,d) (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))`` + ``#define v4l2_fourcc(a,b,c,d)`` + + ``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))`` Several image formats are already defined by this specification in :ref:`pixfmt`. diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index ea1ccfb43e6d..c6ae6f14c9f6 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -146,8 +146,9 @@ of the corresponding tuner/modulator is set. - ``reserved``\ [9] - - Reserved for future extensions. Applications and drivers must set - the array to zero. + - Reserved for future extensions. + + Applications and drivers must set the array to zero. diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index 6b90a1a3506d..8f0b821bd921 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -181,6 +181,8 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. .. _input-status: +.. tabularcolumns:: |p{4.8cm}|p{2.6cm}|p{10.1cm}| + .. flat-table:: Input Status Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst index 13939d8d4358..456013fb50a2 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst @@ -142,7 +142,7 @@ EINVAL. .. _output-type: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. tabularcolumns:: |p{7.0cm}|p{1.8cm}|p{8.7cm}| .. flat-table:: Output Type :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index d2ea3bf01fce..58dec578f54d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -316,11 +316,6 @@ EBUSY - Description - - .. row 2 - - - - - - - .. row 3 - ``V4L2_DV_BT_STD_CEA861`` @@ -346,6 +341,7 @@ EBUSY - The timings follow the VESA Generalized Timings Formula standard +.. tabularcolumns:: |p{6.0cm}|p{11.5cm}| .. _dv-bt-flags: @@ -360,11 +356,6 @@ EBUSY - Description - - .. row 2 - - - - - - - .. row 3 - ``V4L2_DV_FL_REDUCED_BLANKING`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst index cb094b589f0e..9cb98a8eaf2d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst @@ -59,12 +59,12 @@ video elementary streams. .. _v4l2-enc-idx: -.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| +.. tabularcolumns:: |p{3.5cm}|p{5.6cm}|p{8.4cm}| .. flat-table:: struct v4l2_enc_idx :header-rows: 0 :stub-columns: 0 - :widths: 1 1 2 1 1 + :widths: 1 3 8 - .. row 1 @@ -90,7 +90,7 @@ video elementary streams. - ``reserved``\ [4] - - :cspan:`2` Reserved for future extensions. Drivers must set the + - Reserved for future extensions. Drivers must set the array to zero. - .. row 4 diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index fee65debfee2..33445c6b6bc2 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -97,7 +97,9 @@ still cause this situation. .. _v4l2-ext-control: -.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{1.5cm}|p{11.8cm}| + +.. cssclass: longtable .. flat-table:: struct v4l2_ext_control :header-rows: 0 @@ -230,7 +232,9 @@ still cause this situation. .. _v4l2-ext-controls: -.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| +.. tabularcolumns:: |p{4.0cm}|p{3.0cm}|p{2.0cm}|p{8.5cm}| + +.. cssclass:: longtable .. flat-table:: struct v4l2_ext_controls :header-rows: 0 @@ -348,8 +352,9 @@ still cause this situation. - ``reserved``\ [2] - - Reserved for future extensions. Drivers and applications must set - the array to zero. + - Reserved for future extensions. + + Drivers and applications must set the array to zero. - .. row 7 @@ -358,6 +363,7 @@ still cause this situation. - ``controls`` - Pointer to an array of ``count`` v4l2_ext_control structures. + Ignored if ``count`` equals zero. diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index dc762325be5e..a6cbc532ff05 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -80,6 +80,8 @@ destructive video overlay. .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. cssclass:: longtable + .. flat-table:: struct v4l2_framebuffer :header-rows: 0 :stub-columns: 0 @@ -377,6 +379,8 @@ destructive video overlay. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. cssclass:: longtable + .. flat-table:: Frame Buffer Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst index ee6f11978fd6..94e42ac3d4d8 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst @@ -84,6 +84,8 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical .. _v4l2-format: +.. tabularcolumns:: |p{1.2cm}|p{4.3cm}|p{3.0cm}|p{9.0cm}| + .. flat-table:: struct v4l2_format :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst index 6f9ee18e005f..9b87c7f4df52 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst @@ -57,7 +57,7 @@ encoding. You usually do want to add them. .. _v4l2-jpegcompression: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{13.3cm}| .. flat-table:: struct v4l2_jpegcompression :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst index eaa62b6bd931..52c7b95de8e6 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst @@ -85,8 +85,9 @@ To change the radio frequency the - ``name``\ [32] - - Name of the modulator, a NUL-terminated ASCII string. This - information is intended for the user. + - Name of the modulator, a NUL-terminated ASCII string. + + This information is intended for the user. - .. row 3 @@ -155,8 +156,9 @@ To change the radio frequency the - ``reserved``\ [3] - - Reserved for future extensions. Drivers and applications must set - the array to zero. + - Reserved for future extensions. + + Drivers and applications must set the array to zero. diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index b2dba5e0822b..437f0f7e3001 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -96,7 +96,9 @@ See also the examples in :ref:`control`. .. _v4l2-queryctrl: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. tabularcolumns:: |p{1.2cm}|p{3.6cm}|p{12.7cm}| + +.. cssclass:: longtable .. flat-table:: struct v4l2_queryctrl :header-rows: 0 @@ -218,7 +220,9 @@ See also the examples in :ref:`control`. .. _v4l2-query-ext-ctrl: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. tabularcolumns:: |p{1.2cm}|p{5.0cm}|p{11.3cm}| + +.. cssclass:: longtable .. flat-table:: struct v4l2_query_ext_ctrl :header-rows: 0 @@ -382,7 +386,7 @@ See also the examples in :ref:`control`. .. _v4l2-querymenu: -.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| +.. tabularcolumns:: |p{1.2cm}|p{0.6cm}|p{1.6cm}|p{13.5cm}| .. flat-table:: struct v4l2_querymenu :header-rows: 0 @@ -452,7 +456,9 @@ See also the examples in :ref:`control`. .. _v4l2-ctrl-type: -.. tabularcolumns:: |p{5.3cm}|p{0.9cm}|p{0.9cm}|p{0.9cm}|p{9.5cm}| +.. tabularcolumns:: |p{5.8cm}|p{1.4cm}|p{1.0cm}|p{1.4cm}|p{6.9cm}| + +.. cssclass:: longtable .. flat-table:: enum v4l2_ctrl_type :header-rows: 1 @@ -653,6 +659,8 @@ See also the examples in :ref:`control`. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. cssclass:: longtable + .. flat-table:: Control Flags :header-rows: 0 :stub-columns: 0 From e19c1779fbad7539a17ae81eb447cd1f48dd2f41 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 06:56:36 -0300 Subject: [PATCH 072/591] [media] vidioc-g-tuner.rst: improve documentation for tuner type The tuner type table misses descriptions for each type. While most of stuff are obvious, the two SDR definitions aren't. So, add descriptions to all of them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-g-tuner.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index 762918a1e58a..740a4dd0db00 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -260,7 +260,7 @@ To change the radio frequency the .. flat-table:: enum v4l2_tuner_type :header-rows: 0 :stub-columns: 0 - :widths: 3 1 4 + :widths: 3 1 6 - .. row 1 @@ -269,7 +269,7 @@ To change the radio frequency the - 1 - - + - Tuner supports radio - .. row 2 @@ -277,7 +277,7 @@ To change the radio frequency the - 2 - - + - Tuner supports analog TV - .. row 3 @@ -285,7 +285,8 @@ To change the radio frequency the - 4 - - + - Tuner controls the A/D and/or D/A block of a + Sofware Digital Radio (SDR) - .. row 4 @@ -293,8 +294,7 @@ To change the radio frequency the - 5 - - - + - Tuner controls the RF part of a Sofware Digital Radio (SDR) .. _tuner-capability: From 11d7512bfe23071b93bd7dc14abbc6ee002db2c3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 06:56:43 -0300 Subject: [PATCH 073/591] [media] vidioc-g-tuner.rst: Fix tables to fit at LaTeX output Several tables are missing column definitions and/or are too big to fit into the page. Adjust them. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/vidioc-g-tuner.rst | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index 740a4dd0db00..a52efdf94795 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -60,8 +60,12 @@ To change the radio frequency the :ref:`VIDIOC_S_FREQUENCY ` ioctl is available. + .. tabularcolumns:: |p{1.3cm}|p{3.0cm}|p{6.6cm}|p{6.6cm}| + .. _v4l2-tuner: +.. cssclass:: longtable + .. flat-table:: struct v4l2_tuner :header-rows: 0 :stub-columns: 0 @@ -83,8 +87,9 @@ To change the radio frequency the - :cspan:`1` - Name of the tuner, a NUL-terminated ASCII string. This information - is intended for the user. + Name of the tuner, a NUL-terminated ASCII string. + + This information is intended for the user. - .. row 3 @@ -230,8 +235,9 @@ To change the radio frequency the - ``signal`` - - :cspan:`1` The signal strength if known, ranging from 0 to - 65535. Higher values indicate a better signal. + - :cspan:`1` The signal strength if known. + + Ranging from 0 to 65535. Higher values indicate a better signal. - .. row 16 @@ -239,8 +245,10 @@ To change the radio frequency the - ``afc`` - - :cspan:`1` Automatic frequency control: When the ``afc`` value - is negative, the frequency is too low, when positive too high. + - :cspan:`1` Automatic frequency control. + + When the ``afc`` value is negative, the frequency is too + low, when positive too high. - .. row 17 @@ -248,8 +256,9 @@ To change the radio frequency the - ``reserved``\ [4] - - :cspan:`1` Reserved for future extensions. Drivers and - applications must set the array to zero. + - :cspan:`1` Reserved for future extensions. + + Drivers and applications must set the array to zero. @@ -301,6 +310,8 @@ To change the radio frequency the .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. cssclass:: longtable + .. flat-table:: Tuner and Modulator Capability Flags :header-rows: 0 :stub-columns: 0 @@ -608,7 +619,9 @@ To change the radio frequency the ``MODE_MONO``. Only ``V4L2_TUNER_ANALOG_TV`` tuners support this mode. +.. raw:: latex + \newline\newline\begin{adjustbox}{width=\columnwidth} .. _tuner-matrix: @@ -706,6 +719,9 @@ To change the radio frequency the - Lang1/Lang2 (preferred) or Lang1/Lang1 +.. raw:: latex + + \end{adjustbox}\newline\newline Return Value ============ From ed5d28d0b5147afdd9ba730b07a2e0be6fbfd05a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 07:34:13 -0300 Subject: [PATCH 074/591] [media] fix v4l2-selection-*.rst tables for LaTeX output Adjust the tables there to fit inside the page margins. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/v4l2-selection-flags.rst | 1 + Documentation/media/uapi/v4l/v4l2-selection-targets.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Documentation/media/uapi/v4l/v4l2-selection-flags.rst b/Documentation/media/uapi/v4l/v4l2-selection-flags.rst index 3ce3731faf5f..9ef139f8e21d 100644 --- a/Documentation/media/uapi/v4l/v4l2-selection-flags.rst +++ b/Documentation/media/uapi/v4l/v4l2-selection-flags.rst @@ -6,6 +6,7 @@ Selection flags *************** +.. tabularcolumns:: |p{5.2cm}|p{2.0cm}|p{6.5cm}|p{1.2cm}|p{1.6cm}| .. _v4l2-selection-flags-table: diff --git a/Documentation/media/uapi/v4l/v4l2-selection-targets.rst b/Documentation/media/uapi/v4l/v4l2-selection-targets.rst index 7519099a50cd..a82b58f5ebcf 100644 --- a/Documentation/media/uapi/v4l/v4l2-selection-targets.rst +++ b/Documentation/media/uapi/v4l/v4l2-selection-targets.rst @@ -12,6 +12,8 @@ of the two interfaces they are used. .. _v4l2-selection-targets-table: +.. tabularcolumns:: |p{5.8cm}|p{1.4cm}|p{6.5cm}|p{1.2cm}|p{1.6cm}| + .. flat-table:: Selection target definitions :header-rows: 1 :stub-columns: 0 From e9012dc3d60e9736bde4ef94a251fe5492ee4a52 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 07:43:02 -0300 Subject: [PATCH 075/591] [media] fe_property_parameters.rst: Adjust column sizes Add position hints for some tables, in order for them to be shown properly on LaTeX output. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/fe_property_parameters.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/media/uapi/dvb/fe_property_parameters.rst b/Documentation/media/uapi/dvb/fe_property_parameters.rst index f776d62523da..d7acc72ebbdf 100644 --- a/Documentation/media/uapi/dvb/fe_property_parameters.rst +++ b/Documentation/media/uapi/dvb/fe_property_parameters.rst @@ -1234,6 +1234,7 @@ Reed Solomon (RS) frame mode. Possible values are: +.. tabularcolumns:: |p{5.0cm}|p{12.5cm}| .. _atscmh-rs-frame-mode: @@ -1395,6 +1396,7 @@ Series Concatenated Convolutional Code Block Mode. Possible values are: +.. tabularcolumns:: |p{4.5cm}|p{13.0cm}| .. _atscmh-sccc-block-mode: @@ -1687,6 +1689,7 @@ on OFTM-based standards, e. g. DVB-T/T2, ISDB-T, DTMB enum fe_transmit_mode: Number of carriers per channel ----------------------------------------------------- +.. tabularcolumns:: |p{5.0cm}|p{12.5cm}| .. _fe-transmit-mode: From 16dac3541d4de6a27920d4a3e3656893a5359d9d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 08:00:44 -0300 Subject: [PATCH 076/591] [media] adjust remaining tables at DVB uAPI documentation There are a few broken tables on LaTeX output at the DVB uAPI documentation. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/audio-fopen.rst | 2 ++ Documentation/media/uapi/dvb/ca-fopen.rst | 2 ++ Documentation/media/uapi/dvb/dmx-fread.rst | 3 ++- Documentation/media/uapi/dvb/dmx-fwrite.rst | 2 ++ Documentation/media/uapi/dvb/dmx-set-pes-filter.rst | 2 +- Documentation/media/uapi/dvb/dmx-start.rst | 2 +- Documentation/media/uapi/dvb/dmx_types.rst | 1 + Documentation/media/uapi/dvb/fe-get-info.rst | 1 + Documentation/media/uapi/dvb/fe-read-status.rst | 1 + Documentation/media/uapi/dvb/video-fopen.rst | 2 ++ 10 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Documentation/media/uapi/dvb/audio-fopen.rst b/Documentation/media/uapi/dvb/audio-fopen.rst index ec3b23aa79b3..3ef4fd62ffb6 100644 --- a/Documentation/media/uapi/dvb/audio-fopen.rst +++ b/Documentation/media/uapi/dvb/audio-fopen.rst @@ -80,6 +80,8 @@ AUDIO_GET_STATUS. All other call will return with an error code. Return Value ------------ +.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/ca-fopen.rst b/Documentation/media/uapi/dvb/ca-fopen.rst index f284461cce20..9960fc76189c 100644 --- a/Documentation/media/uapi/dvb/ca-fopen.rst +++ b/Documentation/media/uapi/dvb/ca-fopen.rst @@ -79,6 +79,8 @@ the device in this mode will fail, and an error code will be returned. Return Value ------------ +.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/dmx-fread.rst b/Documentation/media/uapi/dvb/dmx-fread.rst index d25b19e4f696..266c9ca259c9 100644 --- a/Documentation/media/uapi/dvb/dmx-fread.rst +++ b/Documentation/media/uapi/dvb/dmx-fread.rst @@ -53,10 +53,11 @@ data. The filtered data is transferred from the driver’s internal circular buffer to buf. The maximum amount of data to be transferred is implied by count. - Return Value ------------ +.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/dmx-fwrite.rst b/Documentation/media/uapi/dvb/dmx-fwrite.rst index 9efd81a1b5c8..3d76470bef60 100644 --- a/Documentation/media/uapi/dvb/dmx-fwrite.rst +++ b/Documentation/media/uapi/dvb/dmx-fwrite.rst @@ -59,6 +59,8 @@ The amount of data to be transferred is implied by count. Return Value ------------ +.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst b/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst index addc321011ce..d71db779b6fd 100644 --- a/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst +++ b/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst @@ -61,7 +61,7 @@ On success 0 is returned, on error -1 and the ``errno`` variable is set appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. - +.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| .. flat-table:: :header-rows: 0 diff --git a/Documentation/media/uapi/dvb/dmx-start.rst b/Documentation/media/uapi/dvb/dmx-start.rst index 9835d1e78400..959b5eee2647 100644 --- a/Documentation/media/uapi/dvb/dmx-start.rst +++ b/Documentation/media/uapi/dvb/dmx-start.rst @@ -53,7 +53,7 @@ On success 0 is returned, on error -1 and the ``errno`` variable is set appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. - +.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| .. flat-table:: :header-rows: 0 diff --git a/Documentation/media/uapi/dvb/dmx_types.rst b/Documentation/media/uapi/dvb/dmx_types.rst index 7a8900af2680..efd564035958 100644 --- a/Documentation/media/uapi/dvb/dmx_types.rst +++ b/Documentation/media/uapi/dvb/dmx_types.rst @@ -12,6 +12,7 @@ Demux Data Types Output for the demux ==================== +.. tabularcolumns:: |p{5.0cm}|p{12.5cm}| .. _dmx-output: diff --git a/Documentation/media/uapi/dvb/fe-get-info.rst b/Documentation/media/uapi/dvb/fe-get-info.rst index 80644072087f..85973be62b0c 100644 --- a/Documentation/media/uapi/dvb/fe-get-info.rst +++ b/Documentation/media/uapi/dvb/fe-get-info.rst @@ -160,6 +160,7 @@ frontend capabilities Capabilities describe what a frontend can do. Some capabilities are supported only on some specific frontend types. +.. tabularcolumns:: |p{5.5cm}|p{12.0cm}| .. _fe-caps: diff --git a/Documentation/media/uapi/dvb/fe-read-status.rst b/Documentation/media/uapi/dvb/fe-read-status.rst index defe30d036ec..def8160d6807 100644 --- a/Documentation/media/uapi/dvb/fe-read-status.rst +++ b/Documentation/media/uapi/dvb/fe-read-status.rst @@ -56,6 +56,7 @@ The fe_status parameter is used to indicate the current state and/or state changes of the frontend hardware. It is produced using the enum :ref:`fe_status ` values on a bitmask +.. tabularcolumns:: |p{3.5cm}|p{14.0cm}| .. _fe-status: diff --git a/Documentation/media/uapi/dvb/video-fopen.rst b/Documentation/media/uapi/dvb/video-fopen.rst index 9e5471557b83..9addca95516e 100644 --- a/Documentation/media/uapi/dvb/video-fopen.rst +++ b/Documentation/media/uapi/dvb/video-fopen.rst @@ -82,6 +82,8 @@ return an error code. Return Value ------------ +.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| + .. flat-table:: :header-rows: 0 :stub-columns: 0 From d53c4261c6358dd2a031a273c2672dfc143fbf5f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 08:20:05 -0300 Subject: [PATCH 077/591] [media] media-types.rst: adjust tables to fit on LaTeX output A few tables at the media uAPI documentation have columns not well dimentioned. Adjust them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/mediactl/media-types.rst | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/mediactl/media-types.rst b/Documentation/media/uapi/mediactl/media-types.rst index c77717b236ce..20f99301bfdb 100644 --- a/Documentation/media/uapi/mediactl/media-types.rst +++ b/Documentation/media/uapi/mediactl/media-types.rst @@ -5,9 +5,12 @@ Types and flags used to represent the media graph elements ========================================================== +.. tabularcolumns:: |p{8.0cm}|p{10.5cm}| .. _media-entity-type: +.. cssclass:: longtable + .. flat-table:: Media entity types :header-rows: 0 :stub-columns: 0 @@ -15,10 +18,12 @@ Types and flags used to represent the media graph elements - .. row 1 - .. _MEDIA-ENT-F-UNKNOWN: + .. _MEDIA-ENT-F-UNKNOWN: .. _MEDIA-ENT-F-V4L2-SUBDEV-UNKNOWN: - - ``MEDIA_ENT_F_UNKNOWN`` and ``MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN`` + - ``MEDIA_ENT_F_UNKNOWN`` and + + ``MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN`` - Unknown entity. That generally indicates that a driver didn't initialize properly the entity, with is a Kernel bug @@ -294,6 +299,8 @@ Types and flags used to represent the media graph elements its source pad. +.. tabularcolumns:: |p{5.5cm}|p{12.0cm}| + .. _media-entity-flag: .. flat-table:: Media entity flags @@ -319,6 +326,7 @@ Types and flags used to represent the media graph elements - The entity represents a data conector +.. tabularcolumns:: |p{6.5cm}|p{6.0cm}|p{5.0cm}| .. _media-intf-type: @@ -508,6 +516,7 @@ Types and flags used to represent the media graph elements - typically, /dev/snd/timer +.. tabularcolumns:: |p{5.5cm}|p{12.0cm}| .. _media-pad-flag: @@ -551,6 +560,7 @@ Types and flags used to represent the media graph elements One and only one of ``MEDIA_PAD_FL_SINK`` and ``MEDIA_PAD_FL_SOURCE`` must be set for every pad. +.. tabularcolumns:: |p{5.5cm}|p{12.0cm}| .. _media-link-flag: From 4e5c054edc14d4e5ceb1866d8624669d2793de08 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 08:39:16 -0300 Subject: [PATCH 078/591] [media] docs-rst: move cec kAPI documentation to the media book The CEC kAPI documentation should also be part of the media book. Signed-off-by: Mauro Carvalho Chehab --- Documentation/{cec.txt => media/kapi/cec-core.rst} | 0 Documentation/media/media_kapi.rst | 1 + 2 files changed, 1 insertion(+) rename Documentation/{cec.txt => media/kapi/cec-core.rst} (100%) diff --git a/Documentation/cec.txt b/Documentation/media/kapi/cec-core.rst similarity index 100% rename from Documentation/cec.txt rename to Documentation/media/kapi/cec-core.rst diff --git a/Documentation/media/media_kapi.rst b/Documentation/media/media_kapi.rst index b71e8e8048ca..f282ca270369 100644 --- a/Documentation/media/media_kapi.rst +++ b/Documentation/media/media_kapi.rst @@ -32,3 +32,4 @@ For more details see the file COPYING in the source distribution of Linux. kapi/dtv-core kapi/rc-core kapi/mc-core + kapi/cec-core From 9486f2ba952a34cf37740e6fa3a7c360f67bb30b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 08:46:13 -0300 Subject: [PATCH 079/591] [media] cec-core: Convert it to ReST format There are some things there that aren't ok for ReST format. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/cec-core.rst | 145 +++++++++++++++++--------- 1 file changed, 93 insertions(+), 52 deletions(-) diff --git a/Documentation/media/kapi/cec-core.rst b/Documentation/media/kapi/cec-core.rst index 75155fe37153..88c33b53ec13 100644 --- a/Documentation/media/kapi/cec-core.rst +++ b/Documentation/media/kapi/cec-core.rst @@ -36,39 +36,50 @@ CEC Adapter The struct cec_adapter represents the CEC adapter hardware. It is created by calling cec_allocate_adapter() and deleted by calling cec_delete_adapter(): -struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, +.. c:function:: + struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, void *priv, const char *name, u32 caps, u8 available_las, struct device *parent); -void cec_delete_adapter(struct cec_adapter *adap); + +.. c:function:: + void cec_delete_adapter(struct cec_adapter *adap); To create an adapter you need to pass the following information: -ops: adapter operations which are called by the CEC framework and that you -have to implement. +ops: + adapter operations which are called by the CEC framework and that you + have to implement. -priv: will be stored in adap->priv and can be used by the adapter ops. +priv: + will be stored in adap->priv and can be used by the adapter ops. -name: the name of the CEC adapter. Note: this name will be copied. +name: + the name of the CEC adapter. Note: this name will be copied. -caps: capabilities of the CEC adapter. These capabilities determine the +caps: + capabilities of the CEC adapter. These capabilities determine the capabilities of the hardware and which parts are to be handled by userspace and which parts are handled by kernelspace. The capabilities are returned by CEC_ADAP_G_CAPS. -available_las: the number of simultaneous logical addresses that this +available_las: + the number of simultaneous logical addresses that this adapter can handle. Must be 1 <= available_las <= CEC_MAX_LOG_ADDRS. -parent: the parent device. +parent: + the parent device. To register the /dev/cecX device node and the remote control device (if CEC_CAP_RC is set) you call: -int cec_register_adapter(struct cec_adapter *adap); +.. c:function:: + int cec_register_adapter(struct cec_adapter \*adap); To unregister the devices call: -void cec_unregister_adapter(struct cec_adapter *adap); +.. c:function:: + void cec_unregister_adapter(struct cec_adapter \*adap); Note: if cec_register_adapter() fails, then call cec_delete_adapter() to clean up. But if cec_register_adapter() succeeded, then only call @@ -83,18 +94,23 @@ Implementing the Low-Level CEC Adapter The following low-level adapter operations have to be implemented in your driver: -struct cec_adap_ops { - /* Low-level callbacks */ - int (*adap_enable)(struct cec_adapter *adap, bool enable); - int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable); - int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr); - int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, - u32 signal_free_time, struct cec_msg *msg); - void (*adap_log_status)(struct cec_adapter *adap); +.. c:type:: struct cec_adap_ops - /* High-level callbacks */ - ... -}; +.. code-block:: none + + struct cec_adap_ops + { + /* Low-level callbacks */ + int (*adap_enable)(struct cec_adapter *adap, bool enable); + int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable); + int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr); + int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, + u32 signal_free_time, struct cec_msg *msg); + void (\*adap_log_status)(struct cec_adapter *adap); + + /* High-level callbacks */ + ... + }; The three low-level ops deal with various aspects of controlling the CEC adapter hardware: @@ -102,6 +118,7 @@ hardware: To enable/disable the hardware: +.. c:function:: int (*adap_enable)(struct cec_adapter *adap, bool enable); This callback enables or disables the CEC hardware. Enabling the CEC hardware @@ -115,6 +132,7 @@ Note that adap_enable must return 0 if enable is false. To enable/disable the 'monitor all' mode: +.. c:function:: int (*adap_monitor_all_enable)(struct cec_adapter *adap, bool enable); If enabled, then the adapter should be put in a mode to also monitor messages @@ -127,6 +145,7 @@ Note that adap_monitor_all_enable must return 0 if enable is false. To program a new logical address: +.. c:function:: int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr); If logical_addr == CEC_LOG_ADDR_INVALID then all programmed logical addresses @@ -140,6 +159,7 @@ Note that adap_log_addr must return 0 if logical_addr is CEC_LOG_ADDR_INVALID. To transmit a new message: +.. c:function:: int (*adap_transmit)(struct cec_adapter *adap, u8 attempts, u32 signal_free_time, struct cec_msg *msg); @@ -158,6 +178,7 @@ microseconds (one data bit period is 2.4 ms). To log the current CEC hardware status: +.. c:function:: void (*adap_status)(struct cec_adapter *adap, struct seq_file *file); This optional callback can be used to show the status of the CEC hardware. @@ -169,29 +190,41 @@ driven) by calling into the framework in the following situations: When a transmit finished (successfully or otherwise): -void cec_transmit_done(struct cec_adapter *adap, u8 status, u8 arb_lost_cnt, +.. c:function:: + void cec_transmit_done(struct cec_adapter *adap, u8 status, u8 arb_lost_cnt, u8 nack_cnt, u8 low_drive_cnt, u8 error_cnt); The status can be one of: -CEC_TX_STATUS_OK: the transmit was successful. -CEC_TX_STATUS_ARB_LOST: arbitration was lost: another CEC initiator -took control of the CEC line and you lost the arbitration. -CEC_TX_STATUS_NACK: the message was nacked (for a directed message) or -acked (for a broadcast message). A retransmission is needed. -CEC_TX_STATUS_LOW_DRIVE: low drive was detected on the CEC bus. This -indicates that a follower detected an error on the bus and requested a -retransmission. -CEC_TX_STATUS_ERROR: some unspecified error occurred: this can be one of -the previous two if the hardware cannot differentiate or something else -entirely. -CEC_TX_STATUS_MAX_RETRIES: could not transmit the message after -trying multiple times. Should only be set by the driver if it has hardware -support for retrying messages. If set, then the framework assumes that it -doesn't have to make another attempt to transmit the message since the -hardware did that already. +CEC_TX_STATUS_OK: + the transmit was successful. -The *_cnt arguments are the number of error conditions that were seen. +CEC_TX_STATUS_ARB_LOST: + arbitration was lost: another CEC initiator + took control of the CEC line and you lost the arbitration. + +CEC_TX_STATUS_NACK: + the message was nacked (for a directed message) or + acked (for a broadcast message). A retransmission is needed. + +CEC_TX_STATUS_LOW_DRIVE: + low drive was detected on the CEC bus. This indicates that + a follower detected an error on the bus and requested a + retransmission. + +CEC_TX_STATUS_ERROR: + some unspecified error occurred: this can be one of + the previous two if the hardware cannot differentiate or something + else entirely. + +CEC_TX_STATUS_MAX_RETRIES: + could not transmit the message after trying multiple times. + Should only be set by the driver if it has hardware support for + retrying messages. If set, then the framework assumes that it + doesn't have to make another attempt to transmit the message + since the hardware did that already. + +The \*_cnt arguments are the number of error conditions that were seen. This may be 0 if no information is available. Drivers that do not support hardware retry can just set the counter corresponding to the transmit error to 1, if the hardware does support retry then either set these counters to @@ -200,7 +233,8 @@ times, or fill in the correct values as reported by the hardware. When a CEC message was received: -void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg); +.. c:function:: + void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg); Speaks for itself. @@ -210,17 +244,20 @@ Implementing the High-Level CEC Adapter The low-level operations drive the hardware, the high-level operations are CEC protocol driven. The following high-level callbacks are available: -struct cec_adap_ops { - /* Low-level callbacks */ - ... +.. code-block:: none - /* High-level CEC message callback */ - int (*received)(struct cec_adapter *adap, struct cec_msg *msg); -}; + struct cec_adap_ops { + /\* Low-level callbacks \*/ + ... + + /\* High-level CEC message callback \*/ + int (\*received)(struct cec_adapter \*adap, struct cec_msg \*msg); + }; The received() callback allows the driver to optionally handle a newly received CEC message +.. c:function:: int (*received)(struct cec_adapter *adap, struct cec_msg *msg); If the driver wants to process a CEC message, then it can implement this @@ -234,13 +271,16 @@ CEC framework functions CEC Adapter drivers can call the following CEC framework functions: -int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, - bool block); +.. c:function:: + int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, + bool block); Transmit a CEC message. If block is true, then wait until the message has been transmitted, otherwise just queue it and return. -void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block); +.. c:function:: + void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, + bool block); Change the physical address. This function will set adap->phys_addr and send an event if it has changed. If cec_s_log_addrs() has been called and @@ -254,8 +294,9 @@ then the CEC adapter will be disabled. If you change a valid physical address to another valid physical address, then this function will first set the address to CEC_PHYS_ADDR_INVALID before enabling the new physical address. -int cec_s_log_addrs(struct cec_adapter *adap, - struct cec_log_addrs *log_addrs, bool block); +.. c:function:: + int cec_s_log_addrs(struct cec_adapter *adap, + struct cec_log_addrs *log_addrs, bool block); Claim the CEC logical addresses. Should never be called if CEC_CAP_LOG_ADDRS is set. If block is true, then wait until the logical addresses have been From 0d6821ec2f05c36af1e2dfc993348ae7972cf935 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 09:42:15 -0300 Subject: [PATCH 080/591] [media] uapi/cec: adjust tables on LaTeX output Fix tables to avoid text to overflow the cell limits. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/cec/cec-ioc-adap-g-caps.rst | 4 ++-- .../uapi/cec/cec-ioc-adap-g-log-addrs.rst | 6 +++-- .../media/uapi/cec/cec-ioc-dqevent.rst | 23 ++++++++----------- .../media/uapi/cec/cec-ioc-g-mode.rst | 6 ++--- .../media/uapi/cec/cec-ioc-receive.rst | 6 ++--- 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst index 4e70eae7e6ab..e0eaadaf2305 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst @@ -44,7 +44,7 @@ returns the information to the application. The ioctl never fails. .. _cec-caps: -.. tabularcolumns:: |p{1.0cm}|p{1.0cm}|p{15.5cm}| +.. tabularcolumns:: |p{1.2cm}|p{2.5cm}|p{13.8cm}| .. flat-table:: struct cec_caps :header-rows: 0 @@ -91,7 +91,7 @@ returns the information to the application. The ioctl never fails. .. _cec-capabilities: -.. tabularcolumns:: |p{4.4cm}|p{1.5cm}|p{11.6cm}| +.. tabularcolumns:: |p{4.4cm}|p{2.5cm}|p{10.6cm}| .. flat-table:: CEC Capabilities Flags :header-rows: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index 11fac7e24554..959e920eb7c3 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst @@ -69,7 +69,9 @@ logical address types are already defined will return with error ``EBUSY``. .. _cec-log-addrs: -.. tabularcolumns:: |p{1.0cm}|p{1.0cm}|p{15.5cm}| +.. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}| + +.. cssclass:: longtable .. flat-table:: struct cec_log_addrs :header-rows: 0 @@ -311,7 +313,7 @@ logical address types are already defined will return with error ``EBUSY``. .. _cec-log-addr-types: -.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. flat-table:: CEC Logical Address Types :header-rows: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index b4c73ed50509..c27b56881a4a 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -54,7 +54,7 @@ it is guaranteed that the state did change in between the two events. .. _cec-event-state-change_s: -.. tabularcolumns:: |p{1.8cm}|p{1.8cm}|p{13.9cm}| +.. tabularcolumns:: |p{1.2cm}|p{2.9cm}|p{13.4cm}| .. flat-table:: struct cec_event_state_change :header-rows: 0 @@ -82,7 +82,7 @@ it is guaranteed that the state did change in between the two events. .. _cec-event-lost-msgs_s: -.. tabularcolumns:: |p{1.0cm}|p{1.0cm}|p{15.5cm}| +.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.5cm}| .. flat-table:: struct cec_event_lost_msgs :header-rows: 0 @@ -110,7 +110,7 @@ it is guaranteed that the state did change in between the two events. .. _cec-event: -.. tabularcolumns:: |p{1.6cm}|p{1.6cm}|p{1.6cm}|p{12.7cm}| +.. tabularcolumns:: |p{1.0cm}|p{4.2cm}|p{2.5cm}|p{8.8cm}| .. flat-table:: struct cec_event :header-rows: 0 @@ -124,21 +124,18 @@ it is guaranteed that the state did change in between the two events. - ``ts`` - - Timestamp of the event in ns. + - :cspan:`1` Timestamp of the event in ns. + The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access the same clock from userspace use :c:func:`clock_gettime(2)`. - - - - .. row 2 - __u32 - ``event`` - - The CEC event type, see :ref:`cec-events`. - - - + - :cspan:`1` The CEC event type, see :ref:`cec-events`. - .. row 3 @@ -146,9 +143,7 @@ it is guaranteed that the state did change in between the two events. - ``flags`` - - Event flags, see :ref:`cec-event-flags`. - - - + - :cspan:`1` Event flags, see :ref:`cec-event-flags`. - .. row 4 @@ -183,7 +178,7 @@ it is guaranteed that the state did change in between the two events. .. _cec-events: -.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| +.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| .. flat-table:: CEC Events Types :header-rows: 0 @@ -214,7 +209,7 @@ it is guaranteed that the state did change in between the two events. .. _cec-event-flags: -.. tabularcolumns:: |p{4.4cm}|p{1.5cm}|p{11.6cm}| +.. tabularcolumns:: |p{6.0cm}|p{0.6cm}|p{10.9cm}| .. flat-table:: CEC Event Flags :header-rows: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst index d213432eedd7..32261e0510ca 100644 --- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst @@ -76,7 +76,7 @@ Available initiator modes are: .. _cec-mode-initiator_e: -.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| +.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| .. flat-table:: Initiator Modes :header-rows: 0 @@ -121,7 +121,7 @@ Available follower modes are: .. _cec-mode-follower_e: -.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| +.. tabularcolumns:: |p{6.6cm}|p{0.9cm}|p{10.0cm}| .. flat-table:: Follower Modes :header-rows: 0 @@ -215,7 +215,7 @@ Core message processing details: .. _cec-core-processing: -.. tabularcolumns:: |p{1.9cm}|p{15.6cm}| +.. tabularcolumns:: |p{6.6cm}|p{10.9cm}| .. flat-table:: Core Message Processing :header-rows: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index 1a06c8d62ac9..7615c94dc826 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -75,7 +75,7 @@ result. .. _cec-msg: -.. tabularcolumns:: |p{1.0cm}|p{1.0cm}|p{15.5cm}| +.. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{13.0cm}| .. flat-table:: struct cec_msg :header-rows: 0 @@ -254,7 +254,7 @@ result. .. _cec-tx-status: -.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| +.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| .. flat-table:: CEC Transmit Status :header-rows: 0 @@ -324,7 +324,7 @@ result. .. _cec-rx-status: -.. tabularcolumns:: |p{2.6cm}|p{0.9cm}|p{14.0cm}| +.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| .. flat-table:: CEC Receive Status :header-rows: 0 From 42858b555292196a49b08f03a6e63758ac90a482 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 09:46:28 -0300 Subject: [PATCH 081/591] [media] gen-errors.rst fix error table column limits Fix the generic errors table to avoid column overflows on LaTeX output. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/gen-errors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/gen-errors.rst b/Documentation/media/uapi/gen-errors.rst index d37284d50e56..6e983b9880fc 100644 --- a/Documentation/media/uapi/gen-errors.rst +++ b/Documentation/media/uapi/gen-errors.rst @@ -9,7 +9,7 @@ Generic Error Codes .. _gen-errors: -.. tabularcolumns:: |p{1.0cm}|p{16.5cm}| +.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| .. flat-table:: Generic error codes :header-rows: 0 From fa92b04d98e7c52038c1eb1cbf89ba0ba8679a94 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 11:14:23 -0300 Subject: [PATCH 082/591] [media] docs-rst: fix warnings introduced by LaTeX patchset Sphinx is really pedantic with respect to the order where table tags and references are created. Putting things at the wrong order causes troubles. The order that seems to work is: .. raw:: latex .. tabularcolumns:: .. _foo_name: .. cssclass: longtable .. flat-table:: Reorder the tags to the above order, to avoid troubles, and fix remaining warnings introduced by media recent patches. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/cec/cec-ioc-adap-g-caps.rst | 6 ++-- .../uapi/cec/cec-ioc-adap-g-log-addrs.rst | 17 ++++----- .../media/uapi/cec/cec-ioc-dqevent.rst | 15 +++----- .../media/uapi/cec/cec-ioc-g-mode.rst | 9 ++--- .../media/uapi/cec/cec-ioc-receive.rst | 10 +++--- .../uapi/mediactl/media-ioc-g-topology.rst | 18 ++++------ Documentation/media/uapi/v4l/dev-raw-vbi.rst | 6 ++-- Documentation/media/uapi/v4l/dev-subdev.rst | 4 +-- Documentation/media/uapi/v4l/pixfmt-002.rst | 3 +- Documentation/media/uapi/v4l/pixfmt-003.rst | 7 ++-- .../media/uapi/v4l/pixfmt-packed-rgb.rst | 8 ++--- .../media/uapi/v4l/pixfmt-packed-yuv.rst | 2 +- .../media/uapi/v4l/pixfmt-reserved.rst | 8 ++--- .../media/uapi/v4l/subdev-formats.rst | 5 ++- .../media/uapi/v4l/vidioc-dbg-g-chip-info.rst | 12 +++---- .../media/uapi/v4l/vidioc-dbg-g-register.rst | 8 ++--- .../media/uapi/v4l/vidioc-decoder-cmd.rst | 8 ++--- .../media/uapi/v4l/vidioc-dqevent.rst | 36 +++++++++---------- .../media/uapi/v4l/vidioc-dv-timings-cap.rst | 9 +++-- .../media/uapi/v4l/vidioc-encoder-cmd.rst | 11 +++--- .../media/uapi/v4l/vidioc-enum-fmt.rst | 9 ++--- .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 8 ++--- .../media/uapi/v4l/vidioc-enuminput.rst | 16 ++++----- .../media/uapi/v4l/vidioc-enumoutput.rst | 12 +++---- .../media/uapi/v4l/vidioc-enumstd.rst | 3 +- .../media/uapi/v4l/vidioc-g-audio.rst | 12 +++---- .../media/uapi/v4l/vidioc-g-dv-timings.rst | 12 +++---- .../media/uapi/v4l/vidioc-g-enc-index.rst | 11 +++--- .../media/uapi/v4l/vidioc-g-ext-ctrls.rst | 10 +++--- .../media/uapi/v4l/vidioc-g-fbuf.rst | 10 +++--- .../media/uapi/v4l/vidioc-g-frequency.rst | 4 +-- .../media/uapi/v4l/vidioc-g-jpegcomp.rst | 7 ++-- .../media/uapi/v4l/vidioc-g-modulator.rst | 8 ++--- .../media/uapi/v4l/vidioc-g-parm.rst | 20 +++++------ .../media/uapi/v4l/vidioc-g-tuner.rst | 16 ++++----- .../media/uapi/v4l/vidioc-querycap.rst | 8 ++--- .../media/uapi/v4l/vidioc-queryctrl.rst | 20 +++++------ .../media/uapi/v4l/vidioc-s-hw-freq-seek.rst | 4 +-- .../media/uapi/v4l/vidioc-subdev-g-fmt.rst | 8 ++--- .../media/uapi/v4l/vidioc-subscribe-event.rst | 8 ++--- 40 files changed, 186 insertions(+), 222 deletions(-) diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst index e0eaadaf2305..89ba813e577c 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst @@ -41,11 +41,10 @@ device information, applications call the ioctl with a pointer to a struct :ref:`cec_caps `. The driver fills the structure and returns the information to the application. The ioctl never fails. +.. tabularcolumns:: |p{1.2cm}|p{2.5cm}|p{13.8cm}| .. _cec-caps: -.. tabularcolumns:: |p{1.2cm}|p{2.5cm}|p{13.8cm}| - .. flat-table:: struct cec_caps :header-rows: 0 :stub-columns: 0 @@ -88,11 +87,10 @@ returns the information to the application. The ioctl never fails. macro. +.. tabularcolumns:: |p{4.4cm}|p{2.5cm}|p{10.6cm}| .. _cec-capabilities: -.. tabularcolumns:: |p{4.4cm}|p{2.5cm}|p{10.6cm}| - .. flat-table:: CEC Capabilities Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index 959e920eb7c3..42f8e856ec55 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst @@ -66,11 +66,10 @@ logical addresses are claimed or cleared. Attempting to call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` when logical address types are already defined will return with error ``EBUSY``. +.. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}| .. _cec-log-addrs: -.. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}| - .. cssclass:: longtable .. flat-table:: struct cec_log_addrs @@ -207,10 +206,10 @@ logical address types are already defined will return with error ``EBUSY``. give the CEC framework more information about the device type, even though the framework won't use it directly in the CEC message. -.. _cec-versions: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _cec-versions: + .. flat-table:: CEC Versions :header-rows: 0 :stub-columns: 0 @@ -242,11 +241,10 @@ logical address types are already defined will return with error ``EBUSY``. - CEC version according to the HDMI 2.0 standard. +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. _cec-prim-dev-types: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| - .. flat-table:: CEC Primary Device Types :header-rows: 0 :stub-columns: 0 @@ -310,11 +308,10 @@ logical address types are already defined will return with error ``EBUSY``. - Use for a video processor device. +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. _cec-log-addr-types: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| - .. flat-table:: CEC Logical Address Types :header-rows: 0 :stub-columns: 0 @@ -381,10 +378,10 @@ logical address types are already defined will return with error ``EBUSY``. -.. _cec-all-dev-types-flags: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _cec-all-dev-types-flags: + .. flat-table:: CEC All Device Types Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index c27b56881a4a..f606d2ffe6a9 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -51,11 +51,10 @@ two :ref:`CEC_EVENT_STATE_CHANGE ` events with the same state). In that case the intermediate state changes were lost but it is guaranteed that the state did change in between the two events. +.. tabularcolumns:: |p{1.2cm}|p{2.9cm}|p{13.4cm}| .. _cec-event-state-change_s: -.. tabularcolumns:: |p{1.2cm}|p{2.9cm}|p{13.4cm}| - .. flat-table:: struct cec_event_state_change :header-rows: 0 :stub-columns: 0 @@ -79,11 +78,10 @@ it is guaranteed that the state did change in between the two events. - The current set of claimed logical addresses. +.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.5cm}| .. _cec-event-lost-msgs_s: -.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.5cm}| - .. flat-table:: struct cec_event_lost_msgs :header-rows: 0 :stub-columns: 0 @@ -107,11 +105,10 @@ it is guaranteed that the state did change in between the two events. this is more than enough. +.. tabularcolumns:: |p{1.0cm}|p{4.2cm}|p{2.5cm}|p{8.8cm}| .. _cec-event: -.. tabularcolumns:: |p{1.0cm}|p{4.2cm}|p{2.5cm}|p{8.8cm}| - .. flat-table:: struct cec_event :header-rows: 0 :stub-columns: 0 @@ -175,11 +172,10 @@ it is guaranteed that the state did change in between the two events. event. +.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| .. _cec-events: -.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| - .. flat-table:: CEC Events Types :header-rows: 0 :stub-columns: 0 @@ -206,11 +202,10 @@ it is guaranteed that the state did change in between the two events. application didn't dequeue CEC messages fast enough. +.. tabularcolumns:: |p{6.0cm}|p{0.6cm}|p{10.9cm}| .. _cec-event-flags: -.. tabularcolumns:: |p{6.0cm}|p{0.6cm}|p{10.9cm}| - .. flat-table:: CEC Event Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst index 32261e0510ca..b75ed7057f7c 100644 --- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst @@ -73,11 +73,10 @@ always call :ref:`ioctl CEC_TRANSMIT `. Available initiator modes are: +.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| .. _cec-mode-initiator_e: -.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| - .. flat-table:: Initiator Modes :header-rows: 0 :stub-columns: 0 @@ -118,11 +117,10 @@ Available initiator modes are: Available follower modes are: +.. tabularcolumns:: |p{6.6cm}|p{0.9cm}|p{10.0cm}| .. _cec-mode-follower_e: -.. tabularcolumns:: |p{6.6cm}|p{0.9cm}|p{10.0cm}| - .. flat-table:: Follower Modes :header-rows: 0 :stub-columns: 0 @@ -212,11 +210,10 @@ Available follower modes are: Core message processing details: +.. tabularcolumns:: |p{6.6cm}|p{10.9cm}| .. _cec-core-processing: -.. tabularcolumns:: |p{6.6cm}|p{10.9cm}| - .. flat-table:: Core Message Processing :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index 7615c94dc826..a7074a967f8d 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -73,10 +73,10 @@ checked against the received messages to find the corresponding transmit result. -.. _cec-msg: - .. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{13.0cm}| +.. _cec-msg: + .. flat-table:: struct cec_msg :header-rows: 0 :stub-columns: 0 @@ -251,11 +251,10 @@ result. valid if the :ref:`CEC_TX_STATUS_ERROR ` status bit is set. +.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| .. _cec-tx-status: -.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| - .. flat-table:: CEC Transmit Status :header-rows: 0 :stub-columns: 0 @@ -321,11 +320,10 @@ result. be set to explain which failures were seen. +.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| .. _cec-rx-status: -.. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}| - .. flat-table:: CEC Receive Status :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst index 750dd11dbe03..c836d64df03b 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst @@ -48,11 +48,10 @@ other values untouched. If the ``topology_version`` remains the same, the ioctl should fill the desired arrays with the media graph elements. +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| .. _media-v2-topology: -.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| - .. flat-table:: struct media_v2_topology :header-rows: 0 :stub-columns: 0 @@ -144,11 +143,10 @@ desired arrays with the media graph elements. won't store the links. It will just update ``num_links`` +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| .. _media-v2-entity: -.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| - .. flat-table:: struct media_v2_entity :header-rows: 0 :stub-columns: 0 @@ -189,11 +187,10 @@ desired arrays with the media graph elements. this array to zero. +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| .. _media-v2-interface: -.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| - .. flat-table:: struct media_v2_interface :header-rows: 0 :stub-columns: 0 @@ -242,11 +239,10 @@ desired arrays with the media graph elements. :ref:`media-v2-intf-devnode` for details.. +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| .. _media-v2-intf-devnode: -.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| - .. flat-table:: struct media_v2_interface :header-rows: 0 :stub-columns: 0 @@ -270,11 +266,10 @@ desired arrays with the media graph elements. - Device node minor number. +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| .. _media-v2-pad: -.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| - .. flat-table:: struct media_v2_pad :header-rows: 0 :stub-columns: 0 @@ -315,11 +310,10 @@ desired arrays with the media graph elements. this array to zero. +.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| .. _media-v2-link: -.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| - .. flat-table:: struct media_v2_pad :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst b/Documentation/media/uapi/v4l/dev-raw-vbi.rst index 1b59239c7fb7..3cf44869a425 100644 --- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst @@ -99,11 +99,10 @@ VBI devices must implement both the :ref:`VIDIOC_G_FMT ` and and always returns default parameters as :ref:`VIDIOC_G_FMT ` does. :ref:`VIDIOC_TRY_FMT ` is optional. +.. tabularcolumns:: |p{2.4cm}|p{4.4cm}|p{10.7cm}| .. _v4l2-vbi-format: -.. tabularcolumns:: |p{2.4cm}|p{4.4cm}|p{10.7cm}| - .. cssclass:: longtable .. flat-table:: struct v4l2_vbi_format @@ -227,11 +226,10 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does applications must set it to zero. +.. tabularcolumns:: |p{4.0cm}|p{1.5cm}|p{12.0cm}| .. _vbifmt-flags: -.. tabularcolumns:: |p{4.0cm}|p{1.5cm}|p{12.0cm}| - .. flat-table:: Raw VBI Format Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/dev-subdev.rst b/Documentation/media/uapi/v4l/dev-subdev.rst index b1aed4541bca..7d20c725583d 100644 --- a/Documentation/media/uapi/v4l/dev-subdev.rst +++ b/Documentation/media/uapi/v4l/dev-subdev.rst @@ -202,14 +202,14 @@ for the pipeline described in :ref:`pipeline-scaling` (table columns list entity names and pad numbers). -.. _sample-pipeline-config: - .. raw:: latex \newline\newline\begin{adjustbox}{width=\columnwidth} .. tabularcolumns:: |p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}| +.. _sample-pipeline-config: + .. flat-table:: Sample Pipeline Configuration :header-rows: 1 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst b/Documentation/media/uapi/v4l/pixfmt-002.rst index 368da55e5f07..58e872f66a07 100644 --- a/Documentation/media/uapi/v4l/pixfmt-002.rst +++ b/Documentation/media/uapi/v4l/pixfmt-002.rst @@ -4,11 +4,10 @@ Single-planar format structure ****************************** +.. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{11.0cm}| .. _v4l2-pix-format: -.. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{11.0cm}| - .. cssclass:: longtable .. flat-table:: struct v4l2_pix_format diff --git a/Documentation/media/uapi/v4l/pixfmt-003.rst b/Documentation/media/uapi/v4l/pixfmt-003.rst index 8dc86b490451..4a2dbe1095b1 100644 --- a/Documentation/media/uapi/v4l/pixfmt-003.rst +++ b/Documentation/media/uapi/v4l/pixfmt-003.rst @@ -12,10 +12,10 @@ array of :ref:`struct v4l2_plane_pix_format ` structures, describing all planes of that format. -.. _v4l2-plane-pix-format: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-plane-pix-format: + .. flat-table:: struct v4l2_plane_pix_format :header-rows: 0 :stub-columns: 0 @@ -49,11 +49,10 @@ describing all planes of that format. applications. +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| .. _v4l2-pix-format-mplane: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| - .. flat-table:: struct v4l2_pix_format_mplane :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst index af5fac78188f..2180a3ae4c16 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst @@ -18,10 +18,10 @@ next to each other in memory. \newline\newline\begin{adjustbox}{width=\columnwidth} -.. _rgb-formats: - .. tabularcolumns:: |p{4.5cm}|p{3.3cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| +.. _rgb-formats: + .. flat-table:: Packed RGB Image Formats :header-rows: 2 :stub-columns: 0 @@ -1113,8 +1113,6 @@ The meaning of their alpha bits (a) is ill-defined and interpreted as in either the corresponding ARGB or XRGB format, depending on the driver. -.. _rgb-formats-deprecated: - .. raw:: latex \newline\newline @@ -1122,6 +1120,8 @@ either the corresponding ARGB or XRGB format, depending on the driver. .. tabularcolumns:: |p{4.2cm}|p{1.0cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| +.. _rgb-formats-deprecated: + .. flat-table:: Deprecated Packed RGB Image Formats :header-rows: 2 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst index 2ffcee5b383b..6066f13af5b3 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst @@ -16,7 +16,7 @@ component of each pixel in one 16 or 32 bit word. \newline\newline\begin{adjustbox}{width=\columnwidth} -.. _rgb-formats: +.. _yuv-formats: .. tabularcolumns:: |p{4.5cm}|p{3.3cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| diff --git a/Documentation/media/uapi/v4l/pixfmt-reserved.rst b/Documentation/media/uapi/v4l/pixfmt-reserved.rst index d6938cd5e03e..0dd2f7fe096f 100644 --- a/Documentation/media/uapi/v4l/pixfmt-reserved.rst +++ b/Documentation/media/uapi/v4l/pixfmt-reserved.rst @@ -17,10 +17,10 @@ you think your format should be listed in a standard format section please make a proposal on the linux-media mailing list. -.. _reserved-formats: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _reserved-formats: + .. flat-table:: Reserved Image Formats :header-rows: 1 :stub-columns: 0 @@ -341,10 +341,10 @@ please make a proposal on the linux-media mailing list. -.. _format-flags: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _format-flags: + .. flat-table:: Format Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 7d9b55dd6e91..a347fcc206db 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -5,11 +5,10 @@ Media Bus Formats ================= +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| .. _v4l2-mbus-framefmt: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| - .. flat-table:: struct v4l2_mbus_framefmt :header-rows: 0 :stub-columns: 0 @@ -3758,7 +3757,7 @@ the following codes. .. _v4l2-mbus-pixelcode-yuv8: -.. cssclass: longtable +.. cssclass:: longtable .. flat-table:: YUV Formats :header-rows: 2 diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst index b433132a7564..4c30b2268c70 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst @@ -78,10 +78,10 @@ is available from the LinuxTV v4l-dvb repository; see instructions. -.. _name-v4l2-dbg-match: - .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. _name-v4l2-dbg-match: + .. flat-table:: struct v4l2_dbg_match :header-rows: 0 :stub-columns: 0 @@ -124,10 +124,10 @@ instructions. -.. _v4l2-dbg-chip-info: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-dbg-chip-info: + .. flat-table:: struct v4l2_dbg_chip_info :header-rows: 0 :stub-columns: 0 @@ -171,10 +171,10 @@ instructions. -.. _name-chip-match-types: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _name-chip-match-types: + .. flat-table:: Chip Match Types :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst index 28885cff682a..cb6a878a60ea 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst @@ -86,10 +86,10 @@ It is available from the LinuxTV v4l-dvb repository; see instructions. -.. _v4l2-dbg-match: - .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. _v4l2-dbg-match: + .. flat-table:: struct v4l2_dbg_match :header-rows: 0 :stub-columns: 0 @@ -173,10 +173,10 @@ instructions. -.. _chip-match-types: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _chip-match-types: + .. flat-table:: Chip Match Types :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst index 4287e5b21a8b..63acf4e59530 100644 --- a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst @@ -56,12 +56,12 @@ These ioctls are optional, not all drivers may support them. They were introduced in Linux 3.3. +.. tabularcolumns:: |p{1.1cm}|p{2.4cm}|p{1.2cm}|p{1.6cm}|p{10.6cm}| + .. _v4l2-decoder-cmd: .. cssclass:: longtable -.. tabularcolumns:: |p{1.1cm}|p{2.4cm}|p{1.2cm}|p{1.6cm}|p{10.6cm}| - .. flat-table:: struct v4l2_decoder_cmd :header-rows: 0 :stub-columns: 0 @@ -189,10 +189,10 @@ introduced in Linux 3.3. -.. _decoder-cmds: - .. tabularcolumns:: |p{5.6cm}|p{0.6cm}|p{11.3cm}| +.. _decoder-cmds: + .. flat-table:: Decoder Commands :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index ad4b826a2966..e5be2a5518af 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -40,10 +40,10 @@ exceptions which the application may get by e.g. using the select system call. -.. _v4l2-event: - .. tabularcolumns:: |p{3.0cm}|p{4.3cm}|p{2.5cm}|p{7.7cm}| +.. _v4l2-event: + .. cssclass: longtable .. flat-table:: struct v4l2_event @@ -179,12 +179,12 @@ call. -.. _event-type: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. cssclass:: longtable +.. _event-type: + .. flat-table:: Event Types :header-rows: 0 :stub-columns: 0 @@ -310,10 +310,10 @@ call. -.. _v4l2-event-vsync: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-event-vsync: + .. flat-table:: struct v4l2_event_vsync :header-rows: 0 :stub-columns: 0 @@ -330,10 +330,10 @@ call. -.. _v4l2-event-ctrl: - .. tabularcolumns:: |p{3.5cm}|p{3.0cm}|p{1.8cm}|p{8.5cm}| +.. _v4l2-event-ctrl: + .. flat-table:: struct v4l2_event_ctrl :header-rows: 0 :stub-columns: 0 @@ -439,10 +439,10 @@ call. -.. _v4l2-event-frame-sync: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-event-frame-sync: + .. flat-table:: struct v4l2_event_frame_sync :header-rows: 0 :stub-columns: 0 @@ -459,10 +459,10 @@ call. -.. _v4l2-event-src-change: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-event-src-change: + .. flat-table:: struct v4l2_event_src_change :header-rows: 0 :stub-columns: 0 @@ -480,10 +480,10 @@ call. -.. _v4l2-event-motion-det: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-event-motion-det: + .. flat-table:: struct v4l2_event_motion_det :header-rows: 0 :stub-columns: 0 @@ -525,10 +525,10 @@ call. -.. _ctrl-changes-flags: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _ctrl-changes-flags: + .. flat-table:: Control Changes :header-rows: 0 :stub-columns: 0 @@ -566,10 +566,10 @@ call. -.. _src-changes-flags: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _src-changes-flags: + .. flat-table:: Source Changes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst index b2bf4f3a3c25..7054e36e061f 100644 --- a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst @@ -54,10 +54,10 @@ zero the ``reserved`` array. Attempts to query capabilities on a pad that doesn't support them will return an ``EINVAL`` error code. -.. _v4l2-bt-timings-cap: - .. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{13.3cm}| +.. _v4l2-bt-timings-cap: + .. flat-table:: struct v4l2_bt_timings_cap :header-rows: 0 :stub-columns: 0 @@ -141,10 +141,10 @@ that doesn't support them will return an ``EINVAL`` error code. -.. _v4l2-dv-timings-cap: - .. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{3.5cm}|p{9.5cm}| +.. _v4l2-dv-timings-cap: + .. flat-table:: struct v4l2_dv_timings_cap :header-rows: 0 :stub-columns: 0 @@ -206,7 +206,6 @@ that doesn't support them will return an ``EINVAL`` error code. .. tabularcolumns:: |p{7.0cm}|p{10.5cm}| - .. _dv-bt-cap-capabilities: .. flat-table:: DV BT Timing capabilities diff --git a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst index 18e955ff917a..795d9215017a 100644 --- a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst @@ -64,10 +64,10 @@ These ioctls are optional, not all drivers may support them. They were introduced in Linux 2.6.21. -.. _v4l2-encoder-cmd: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-encoder-cmd: + .. flat-table:: struct v4l2_encoder_cmd :header-rows: 0 :stub-columns: 0 @@ -103,10 +103,10 @@ introduced in Linux 2.6.21. -.. _encoder-cmds: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _encoder-cmds: + .. flat-table:: Encoder Commands :header-rows: 0 :stub-columns: 0 @@ -165,11 +165,10 @@ introduced in Linux 2.6.21. flags are defined for this command. +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. _encoder-flags: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| - .. flat-table:: Encoder Command Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index 2d1444b0d017..da0b888c01cb 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -46,10 +46,10 @@ one until ``EINVAL`` is returned. formats may be different. -.. _v4l2-fmtdesc: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-fmtdesc: + .. flat-table:: struct v4l2_fmtdesc :header-rows: 0 :stub-columns: 0 @@ -108,6 +108,7 @@ one until ``EINVAL`` is returned. - :cspan:`2` .. _v4l2-fourcc: + ``#define v4l2_fourcc(a,b,c,d)`` ``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))`` @@ -131,10 +132,10 @@ one until ``EINVAL`` is returned. -.. _fmtdesc-flags: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _fmtdesc-flags: + .. flat-table:: Image Format Description Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index c6ae6f14c9f6..8fac84d839f4 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -43,10 +43,10 @@ This ioctl is supported if the ``V4L2_TUNER_CAP_FREQ_BANDS`` capability of the corresponding tuner/modulator is set. -.. _v4l2-frequency-band: - .. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| +.. _v4l2-frequency-band: + .. flat-table:: struct v4l2_frequency_band :header-rows: 0 :stub-columns: 0 @@ -152,10 +152,10 @@ of the corresponding tuner/modulator is set. -.. _band-modulation: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _band-modulation: + .. flat-table:: Band Modulation Systems :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index 8f0b821bd921..f8188070335e 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -41,10 +41,10 @@ index is out of bounds. To enumerate all inputs applications shall begin at index zero, incrementing by one until the driver returns ``EINVAL``. -.. _v4l2-input: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-input: + .. flat-table:: struct v4l2_input :header-rows: 0 :stub-columns: 0 @@ -150,10 +150,10 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. -.. _input-type: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _input-type: + .. flat-table:: Input Types :header-rows: 0 :stub-columns: 0 @@ -179,10 +179,10 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. -.. _input-status: - .. tabularcolumns:: |p{4.8cm}|p{2.6cm}|p{10.1cm}| +.. _input-status: + .. flat-table:: Input Status Flags :header-rows: 0 :stub-columns: 0 @@ -324,10 +324,10 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. -.. _input-capabilities: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _input-capabilities: + .. flat-table:: Input capabilities :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst index 456013fb50a2..6d50b297b0aa 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst @@ -42,10 +42,10 @@ shall begin at index zero, incrementing by one until the driver returns EINVAL. -.. _v4l2-output: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-output: + .. flat-table:: struct v4l2_output :header-rows: 0 :stub-columns: 0 @@ -140,10 +140,10 @@ EINVAL. -.. _output-type: - .. tabularcolumns:: |p{7.0cm}|p{1.8cm}|p{8.7cm}| +.. _output-type: + .. flat-table:: Output Type :header-rows: 0 :stub-columns: 0 @@ -177,10 +177,10 @@ EINVAL. -.. _output-capabilities: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _output-capabilities: + .. flat-table:: Output capabilities :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index 28f00a027cc7..2735b0496e9e 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -141,11 +141,10 @@ or output. [#f1]_ - +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| .. _v4l2-std-id: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| - .. flat-table:: typedef v4l2_std_id :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-audio.rst b/Documentation/media/uapi/v4l/vidioc-g-audio.rst index 21fa5571b647..703091ba1391 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audio.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audio.rst @@ -50,10 +50,10 @@ cannot be satisfied. However, this is a write-only ioctl, it does not return the actual new audio mode. -.. _v4l2-audio: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-audio: + .. flat-table:: struct v4l2_audio :header-rows: 0 :stub-columns: 0 @@ -106,10 +106,10 @@ return the actual new audio mode. -.. _audio-capability: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _audio-capability: + .. flat-table:: Audio Capability Flags :header-rows: 0 :stub-columns: 0 @@ -137,10 +137,10 @@ return the actual new audio mode. -.. _audio-mode: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _audio-mode: + .. flat-table:: Audio Mode Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index 58dec578f54d..013f49210de9 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -68,10 +68,10 @@ EBUSY The device is busy and therefore can not change the timings. -.. _v4l2-bt-timings: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-bt-timings: + .. flat-table:: struct v4l2_bt_timings :header-rows: 0 :stub-columns: 0 @@ -223,10 +223,10 @@ EBUSY -.. _v4l2-dv-timings: - .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| +.. _v4l2-dv-timings: + .. flat-table:: struct v4l2_dv_timings :header-rows: 0 :stub-columns: 0 @@ -267,12 +267,10 @@ EBUSY - - +.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| .. _dv-timing-types: -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| - .. flat-table:: DV Timing types :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst index 9cb98a8eaf2d..64e74786babf 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst @@ -57,10 +57,10 @@ Currently this ioctl is only defined for MPEG-2 program streams and video elementary streams. -.. _v4l2-enc-idx: - .. tabularcolumns:: |p{3.5cm}|p{5.6cm}|p{8.4cm}| +.. _v4l2-enc-idx: + .. flat-table:: struct v4l2_enc_idx :header-rows: 0 :stub-columns: 0 @@ -105,10 +105,10 @@ video elementary streams. -.. _v4l2-enc-idx-entry: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-enc-idx-entry: + .. flat-table:: struct v4l2_enc_idx_entry :header-rows: 0 :stub-columns: 0 @@ -163,11 +163,10 @@ video elementary streams. zero. +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. _enc-idx-flags: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| - .. flat-table:: Index Entry Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index 33445c6b6bc2..5b80481d8734 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -95,10 +95,10 @@ were set/get. Only low-level errors (e. g. a failed i2c command) can still cause this situation. -.. _v4l2-ext-control: - .. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{1.5cm}|p{11.8cm}| +.. _v4l2-ext-control: + .. cssclass: longtable .. flat-table:: struct v4l2_ext_control @@ -229,11 +229,10 @@ still cause this situation. ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control. +.. tabularcolumns:: |p{4.0cm}|p{3.0cm}|p{2.0cm}|p{8.5cm}| .. _v4l2-ext-controls: -.. tabularcolumns:: |p{4.0cm}|p{3.0cm}|p{2.0cm}|p{8.5cm}| - .. cssclass:: longtable .. flat-table:: struct v4l2_ext_controls @@ -367,11 +366,10 @@ still cause this situation. Ignored if ``count`` equals zero. +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. _ctrl-class: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| - .. flat-table:: Control classes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index a6cbc532ff05..562505c5db0b 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -76,10 +76,10 @@ hardware, therefore only the superuser can set the parameters for a destructive video overlay. -.. _v4l2-framebuffer: - .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. _v4l2-framebuffer: + .. cssclass:: longtable .. flat-table:: struct v4l2_framebuffer @@ -284,11 +284,10 @@ destructive video overlay. - Reserved. Drivers and applications must set this field to zero. +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. _framebuffer-cap: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| - .. flat-table:: Frame Buffer Capability Flags :header-rows: 0 :stub-columns: 0 @@ -374,11 +373,10 @@ destructive video overlay. exactly opposite of ``V4L2_FBUF_CAP_CHROMAKEY`` +.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. _framebuffer-flags: -.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| - .. cssclass:: longtable .. flat-table:: Frame Buffer Flags diff --git a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst index bf0c1a13ddd7..c0468ff3546e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst @@ -52,10 +52,10 @@ assumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY ` ioctl is available. -.. _v4l2-modulator: - .. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| +.. _v4l2-modulator: + .. flat-table:: struct v4l2_modulator :header-rows: 0 :stub-columns: 0 @@ -162,10 +162,10 @@ To change the radio frequency the -.. _modulator-txsubchans: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _modulator-txsubchans: + .. flat-table:: Modulator Audio Transmission Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-parm.rst b/Documentation/media/uapi/v4l/vidioc-g-parm.rst index 7c32fe94544a..1b044613ab68 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-parm.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-parm.rst @@ -50,10 +50,10 @@ pointer to a struct :ref:`struct v4l2_streamparm ` which contai union holding separate parameters for input and output devices. -.. _v4l2-streamparm: - .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| +.. _v4l2-streamparm: + .. flat-table:: struct v4l2_streamparm :header-rows: 0 :stub-columns: 0 @@ -111,10 +111,10 @@ union holding separate parameters for input and output devices. -.. _v4l2-captureparm: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-captureparm: + .. flat-table:: struct v4l2_captureparm :header-rows: 0 :stub-columns: 0 @@ -194,10 +194,10 @@ union holding separate parameters for input and output devices. -.. _v4l2-outputparm: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-outputparm: + .. flat-table:: struct v4l2_outputparm :header-rows: 0 :stub-columns: 0 @@ -284,10 +284,10 @@ union holding separate parameters for input and output devices. -.. _parm-caps: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _parm-caps: + .. flat-table:: Streaming Parameters Capabilites :header-rows: 0 :stub-columns: 0 @@ -305,10 +305,10 @@ union holding separate parameters for input and output devices. -.. _parm-flags: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _parm-flags: + .. flat-table:: Capture Parameters Flags :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index a52efdf94795..9798a1a86e97 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -262,10 +262,10 @@ To change the radio frequency the -.. _v4l2-tuner-type: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _v4l2-tuner-type: + .. flat-table:: enum v4l2_tuner_type :header-rows: 0 :stub-columns: 0 @@ -306,10 +306,10 @@ To change the radio frequency the - Tuner controls the RF part of a Sofware Digital Radio (SDR) -.. _tuner-capability: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _tuner-capability: + .. cssclass:: longtable .. flat-table:: Tuner and Modulator Capability Flags @@ -468,10 +468,10 @@ To change the radio frequency the -.. _tuner-rxsubchans: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _tuner-rxsubchans: + .. flat-table:: Tuner Audio Reception Flags :header-rows: 0 :stub-columns: 0 @@ -537,10 +537,10 @@ To change the radio frequency the -.. _tuner-audmode: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _tuner-audmode: + .. flat-table:: Tuner Audio Modes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index 05d86b2b87dd..5b9922e83c58 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -41,10 +41,10 @@ filled by the driver. When the driver is not compatible with this specification the ioctl returns an ``EINVAL`` error code. -.. _v4l2-capability: - .. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}| +.. _v4l2-capability: + .. flat-table:: struct v4l2_capability :header-rows: 0 :stub-columns: 0 @@ -170,10 +170,10 @@ specification the ioctl returns an ``EINVAL`` error code. -.. _device-capabilities: - .. tabularcolumns:: |p{6cm}|p{2.2cm}|p{8.8cm}| +.. _device-capabilities: + .. cssclass:: longtable .. flat-table:: Device Capabilities Flags diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index 437f0f7e3001..6e4912f2e3a4 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -94,10 +94,10 @@ inclusive. See also the examples in :ref:`control`. -.. _v4l2-queryctrl: - .. tabularcolumns:: |p{1.2cm}|p{3.6cm}|p{12.7cm}| +.. _v4l2-queryctrl: + .. cssclass:: longtable .. flat-table:: struct v4l2_queryctrl @@ -218,10 +218,10 @@ See also the examples in :ref:`control`. -.. _v4l2-query-ext-ctrl: - .. tabularcolumns:: |p{1.2cm}|p{5.0cm}|p{11.3cm}| +.. _v4l2-query-ext-ctrl: + .. cssclass:: longtable .. flat-table:: struct v4l2_query_ext_ctrl @@ -384,10 +384,10 @@ See also the examples in :ref:`control`. -.. _v4l2-querymenu: - .. tabularcolumns:: |p{1.2cm}|p{0.6cm}|p{1.6cm}|p{13.5cm}| +.. _v4l2-querymenu: + .. flat-table:: struct v4l2_querymenu :header-rows: 0 :stub-columns: 0 @@ -454,10 +454,10 @@ See also the examples in :ref:`control`. -.. _v4l2-ctrl-type: - .. tabularcolumns:: |p{5.8cm}|p{1.4cm}|p{1.0cm}|p{1.4cm}|p{6.9cm}| +.. _v4l2-ctrl-type: + .. cssclass:: longtable .. flat-table:: enum v4l2_ctrl_type @@ -655,10 +655,10 @@ See also the examples in :ref:`control`. -.. _control-flags: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _control-flags: + .. cssclass:: longtable .. flat-table:: Control Flags diff --git a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst index 3e4e1f12c56c..2bc10ebb12a4 100644 --- a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst +++ b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst @@ -61,10 +61,10 @@ If this ioctl is called from a non-blocking filehandle, then ``EAGAIN`` error code is returned and no seek takes place. -.. _v4l2-hw-freq-seek: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-hw-freq-seek: + .. flat-table:: struct v4l2_hw_freq_seek :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst index a16b3dd4bd3c..f5e9b40b22f4 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst @@ -75,10 +75,10 @@ format to match what the hardware can provide. The modified format should be as close as possible to the original request. -.. _v4l2-subdev-format: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-subdev-format: + .. flat-table:: struct v4l2_subdev_format :header-rows: 0 :stub-columns: 0 @@ -122,10 +122,10 @@ should be as close as possible to the original request. -.. _v4l2-subdev-format-whence: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _v4l2-subdev-format-whence: + .. flat-table:: enum v4l2_subdev_format_whence :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst index 7ae35af66123..71079746ddac 100644 --- a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst +++ b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst @@ -38,10 +38,10 @@ Subscribe or unsubscribe V4L2 event. Subscribed events are dequeued by using the :ref:`VIDIOC_DQEVENT` ioctl. -.. _v4l2-event-subscription: - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. _v4l2-event-subscription: + .. flat-table:: struct v4l2_event_subscription :header-rows: 0 :stub-columns: 0 @@ -91,10 +91,10 @@ using the :ref:`VIDIOC_DQEVENT` ioctl. -.. _event-flags: - .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| +.. _event-flags: + .. flat-table:: Event Flags :header-rows: 0 :stub-columns: 0 From 43e4138be37a16b724666374b7e487d2410af8aa Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 11:48:14 -0300 Subject: [PATCH 083/591] [media] Fix a few additional tables at uAPI for LaTeX output There are still a few tables with wrong columns at the uAPI docs. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/fe-get-info.rst | 2 +- Documentation/media/uapi/dvb/fe_property_parameters.rst | 5 ++--- Documentation/media/uapi/v4l/buffer.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-003.rst | 2 +- Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Documentation/media/uapi/dvb/fe-get-info.rst b/Documentation/media/uapi/dvb/fe-get-info.rst index 85973be62b0c..87ff3f62050d 100644 --- a/Documentation/media/uapi/dvb/fe-get-info.rst +++ b/Documentation/media/uapi/dvb/fe-get-info.rst @@ -160,7 +160,7 @@ frontend capabilities Capabilities describe what a frontend can do. Some capabilities are supported only on some specific frontend types. -.. tabularcolumns:: |p{5.5cm}|p{12.0cm}| +.. tabularcolumns:: |p{6.5cm}|p{11.0cm}| .. _fe-caps: diff --git a/Documentation/media/uapi/dvb/fe_property_parameters.rst b/Documentation/media/uapi/dvb/fe_property_parameters.rst index d7acc72ebbdf..304ac1a3c2ff 100644 --- a/Documentation/media/uapi/dvb/fe_property_parameters.rst +++ b/Documentation/media/uapi/dvb/fe_property_parameters.rst @@ -1005,10 +1005,9 @@ Possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1 (AUTO) Note: Truth table for ``DTV_ISDBT_SOUND_BROADCASTING`` and ``DTV_ISDBT_PARTIAL_RECEPTION`` and ``LAYER[A-C]_SEGMENT_COUNT`` - .. _isdbt-layer_seg-cnt-table: -.. flat-table:: +.. flat-table:: Truth table for ISDB-T Sound Broadcasting :header-rows: 0 :stub-columns: 0 @@ -1101,7 +1100,7 @@ TMCC-structure, as shown in the table below. .. _isdbt-layer-interleaving-table: -.. flat-table:: +.. flat-table:: ISDB-T time interleaving modes :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index 4d315b01c2a4..7bab30b59eae 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -39,7 +39,7 @@ buffer. struct v4l2_buffer ================== -.. tabularcolumns:: |p{1.3cm}|p{2.5cm}|p{1.3cm}|p{12.0cm}| +.. tabularcolumns:: |p{2.8cm}|p{2.5cm}|p{1.3cm}|p{10.5cm}| .. cssclass:: longtable diff --git a/Documentation/media/uapi/v4l/pixfmt-003.rst b/Documentation/media/uapi/v4l/pixfmt-003.rst index 4a2dbe1095b1..6ec8ce639764 100644 --- a/Documentation/media/uapi/v4l/pixfmt-003.rst +++ b/Documentation/media/uapi/v4l/pixfmt-003.rst @@ -49,7 +49,7 @@ describing all planes of that format. applications. -.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| +.. tabularcolumns:: |p{4.4cm}|p{5.6cm}|p{7.5cm}| .. _v4l2-pix-format-mplane: diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index 5b80481d8734..f0d33298f329 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -229,7 +229,7 @@ still cause this situation. ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control. -.. tabularcolumns:: |p{4.0cm}|p{3.0cm}|p{2.0cm}|p{8.5cm}| +.. tabularcolumns:: |p{4.0cm}|p{2.0cm}|p{2.0cm}|p{8.5cm}| .. _v4l2-ext-controls: From 0c04622162ea65d0dcb0d5156f247131ceda64e0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 19:23:37 -0300 Subject: [PATCH 084/591] [media] extended-controls.rst: avoid going past page with LaTeX It is painful to put code/verbatim code in bold. It seems that the only way is to arrange it like: ``foo`` bar At least on LaTeX output, when this happens, the "foo" string is not hidentable/breakable. The entire string should fit into a single line. Add a workaround for this ReST limitation by splitting the foo string into two strings, on separate lines. The output is not the best, but it works. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/extended-controls.rst | 267 ++++++++++++++---- 1 file changed, 213 insertions(+), 54 deletions(-) diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 3f0f94a5eeed..9c6aff3e97c1 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -209,7 +209,10 @@ Codec Control IDs .. _v4l2-mpeg-stream-type: -``V4L2_CID_MPEG_STREAM_TYPE (enum v4l2_mpeg_stream_type)`` +``V4L2_CID_MPEG_STREAM_TYPE`` + (enum) + +enum v4l2_mpeg_stream_type - The MPEG-1, -2 or -4 output stream type. One cannot assume anything here. Each hardware MPEG encoder tends to support different subsets of the available MPEG stream types. This control is specific to @@ -282,7 +285,10 @@ Codec Control IDs .. _v4l2-mpeg-stream-vbi-fmt: -``V4L2_CID_MPEG_STREAM_VBI_FMT (enum v4l2_mpeg_stream_vbi_fmt)`` +``V4L2_CID_MPEG_STREAM_VBI_FMT`` + (enum) + +enum v4l2_mpeg_stream_vbi_fmt - Some cards can embed VBI data (e. g. Closed Caption, Teletext) into the MPEG stream. This control selects whether VBI data should be embedded, and if so, what embedding method should be used. The list @@ -316,7 +322,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-sampling-freq: -``V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (enum v4l2_mpeg_audio_sampling_freq)`` +``V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ`` + (enum) + +enum v4l2_mpeg_audio_sampling_freq - MPEG Audio sampling frequency. Possible values are: @@ -348,7 +357,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-encoding: -``V4L2_CID_MPEG_AUDIO_ENCODING (enum v4l2_mpeg_audio_encoding)`` +``V4L2_CID_MPEG_AUDIO_ENCODING`` + (enum) + +enum v4l2_mpeg_audio_encoding - MPEG Audio encoding. This control is specific to multiplexed MPEG streams. Possible values are: @@ -393,7 +405,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-l1-bitrate: -``V4L2_CID_MPEG_AUDIO_L1_BITRATE (enum v4l2_mpeg_audio_l1_bitrate)`` +``V4L2_CID_MPEG_AUDIO_L1_BITRATE`` + (enum) + +enum v4l2_mpeg_audio_l1_bitrate - MPEG-1/2 Layer I bitrate. Possible values are: @@ -491,7 +506,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-l2-bitrate: -``V4L2_CID_MPEG_AUDIO_L2_BITRATE (enum v4l2_mpeg_audio_l2_bitrate)`` +``V4L2_CID_MPEG_AUDIO_L2_BITRATE`` + (enum) + +enum v4l2_mpeg_audio_l2_bitrate - MPEG-1/2 Layer II bitrate. Possible values are: @@ -589,7 +607,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-l3-bitrate: -``V4L2_CID_MPEG_AUDIO_L3_BITRATE (enum v4l2_mpeg_audio_l3_bitrate)`` +``V4L2_CID_MPEG_AUDIO_L3_BITRATE`` + (enum) + +enum v4l2_mpeg_audio_l3_bitrate - MPEG-1/2 Layer III bitrate. Possible values are: @@ -690,7 +711,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-ac3-bitrate: -``V4L2_CID_MPEG_AUDIO_AC3_BITRATE (enum v4l2_mpeg_audio_ac3_bitrate)`` +``V4L2_CID_MPEG_AUDIO_AC3_BITRATE`` + (enum) + +enum v4l2_mpeg_audio_ac3_bitrate - AC-3 bitrate. Possible values are: @@ -818,7 +842,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-mode: -``V4L2_CID_MPEG_AUDIO_MODE (enum v4l2_mpeg_audio_mode)`` +``V4L2_CID_MPEG_AUDIO_MODE`` + (enum) + +enum v4l2_mpeg_audio_mode - MPEG Audio mode. Possible values are: @@ -856,7 +883,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-mode-extension: -``V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (enum v4l2_mpeg_audio_mode_extension)`` +``V4L2_CID_MPEG_AUDIO_MODE_EXTENSION`` + (enum) + +enum v4l2_mpeg_audio_mode_extension - Joint Stereo audio mode extension. In Layer I and II they indicate which subbands are in intensity stereo. All other subbands are coded in stereo. Layer III is not (yet) supported. Possible values are: @@ -896,7 +926,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-emphasis: -``V4L2_CID_MPEG_AUDIO_EMPHASIS (enum v4l2_mpeg_audio_emphasis)`` +``V4L2_CID_MPEG_AUDIO_EMPHASIS`` + (enum) + +enum v4l2_mpeg_audio_emphasis - Audio Emphasis. Possible values are: @@ -928,7 +961,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-crc: -``V4L2_CID_MPEG_AUDIO_CRC (enum v4l2_mpeg_audio_crc)`` +``V4L2_CID_MPEG_AUDIO_CRC`` + (enum) + +enum v4l2_mpeg_audio_crc - CRC method. Possible values are: @@ -960,7 +996,10 @@ Codec Control IDs .. _v4l2-mpeg-audio-dec-playback: -``V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (enum v4l2_mpeg_audio_dec_playback)`` +``V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK`` + (enum) + +enum v4l2_mpeg_audio_dec_playback - Determines how monolingual audio should be played back. Possible values are: @@ -1013,12 +1052,18 @@ Codec Control IDs .. _v4l2-mpeg-audio-dec-multilingual-playback: -``V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (enum v4l2_mpeg_audio_dec_playback)`` +``V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK`` + (enum) + +enum v4l2_mpeg_audio_dec_playback - Determines how multilingual audio should be played back. .. _v4l2-mpeg-video-encoding: -``V4L2_CID_MPEG_VIDEO_ENCODING (enum v4l2_mpeg_video_encoding)`` +``V4L2_CID_MPEG_VIDEO_ENCODING`` + (enum) + +enum v4l2_mpeg_video_encoding - MPEG Video encoding method. This control is specific to multiplexed MPEG streams. Possible values are: @@ -1051,7 +1096,10 @@ Codec Control IDs .. _v4l2-mpeg-video-aspect: -``V4L2_CID_MPEG_VIDEO_ASPECT (enum v4l2_mpeg_video_aspect)`` +``V4L2_CID_MPEG_VIDEO_ASPECT`` + (enum) + +enum v4l2_mpeg_video_aspect - Video aspect. Possible values are: @@ -1093,7 +1141,10 @@ Codec Control IDs .. _v4l2-mpeg-video-bitrate-mode: -``V4L2_CID_MPEG_VIDEO_BITRATE_MODE (enum v4l2_mpeg_video_bitrate_mode)`` +``V4L2_CID_MPEG_VIDEO_BITRATE_MODE`` + (enum) + +enum v4l2_mpeg_video_bitrate_mode - Video bitrate mode. Possible values are: @@ -1197,7 +1248,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-vui-sar-idc: -``V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (enum v4l2_mpeg_video_h264_vui_sar_idc)`` +``V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC`` + (enum) + +enum v4l2_mpeg_video_h264_vui_sar_idc - VUI sample aspect ratio indicator for H.264 encoding. The value is defined in the table E-1 in the standard. Applicable to the H264 encoder. @@ -1329,7 +1383,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-level: -``V4L2_CID_MPEG_VIDEO_H264_LEVEL (enum v4l2_mpeg_video_h264_level)`` +``V4L2_CID_MPEG_VIDEO_H264_LEVEL`` + (enum) + +enum v4l2_mpeg_video_h264_level - The level information for the H264 video elementary stream. Applicable to the H264 encoder. Possible values are: @@ -1440,7 +1497,10 @@ Codec Control IDs .. _v4l2-mpeg-video-mpeg4-level: -``V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (enum v4l2_mpeg_video_mpeg4_level)`` +``V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL`` + (enum) + +enum v4l2_mpeg_video_mpeg4_level - The level information for the MPEG4 elementary stream. Applicable to the MPEG4 encoder. Possible values are: @@ -1503,7 +1563,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-profile: -``V4L2_CID_MPEG_VIDEO_H264_PROFILE (enum v4l2_mpeg_video_h264_profile)`` +``V4L2_CID_MPEG_VIDEO_H264_PROFILE`` + (enum) + +enum v4l2_mpeg_video_h264_profile - The profile information for H264. Applicable to the H264 encoder. Possible values are: @@ -1620,7 +1683,10 @@ Codec Control IDs .. _v4l2-mpeg-video-mpeg4-profile: -``V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (enum v4l2_mpeg_video_mpeg4_profile)`` +``V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE`` + (enum) + +enum v4l2_mpeg_video_mpeg4_profile - The profile information for MPEG4. Applicable to the MPEG4 encoder. Possible values are: @@ -1669,13 +1735,16 @@ Codec Control IDs .. _v4l2-mpeg-video-multi-slice-mode: -``V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (enum v4l2_mpeg_video_multi_slice_mode)`` +``V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE`` + (enum) + +enum v4l2_mpeg_video_multi_slice_mode - Determines how the encoder should handle division of frame into slices. Applicable to the encoder. Possible values are: -.. tabularcolumns:: |p{5.5cm}|p{12.0cm}| +.. tabularcolumns:: |p{8.7cm}|p{8.8cm}| .. flat-table:: :header-rows: 0 @@ -1716,7 +1785,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-loop-filter-mode: -``V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (enum v4l2_mpeg_video_h264_loop_filter_mode)`` +``V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE`` + (enum) + +enum v4l2_mpeg_video_h264_loop_filter_mode - Loop filter mode for H264 encoder. Possible values are: @@ -1757,7 +1829,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-entropy-mode: -``V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (enum v4l2_mpeg_video_h264_entropy_mode)`` +``V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE`` + (enum) + +enum v4l2_mpeg_video_h264_entropy_mode - Entropy coding mode for H264 - CABAC/CAVALC. Applicable to the H264 encoder. Possible values are: @@ -1918,7 +1993,10 @@ Codec Control IDs .. _v4l2-mpeg-video-header-mode: -``V4L2_CID_MPEG_VIDEO_HEADER_MODE (enum v4l2_mpeg_video_header_mode)`` +``V4L2_CID_MPEG_VIDEO_HEADER_MODE`` + (enum) + +enum v4l2_mpeg_video_header_mode - Determines whether the header is returned as the first buffer or is it returned together with the first frame. Applicable to encoders. Possible values are: @@ -1976,7 +2054,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-sei-fp-arrangement-type: -``V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE`` ``(enum v4l2_mpeg_video_h264_sei_fp_arrangement_type)`` +``V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE`` + (enum) + +enum v4l2_mpeg_video_h264_sei_fp_arrangement_type - Frame packing arrangement type for H264 SEI. Applicable to the H264 encoder. Possible values are: @@ -2031,7 +2112,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-fmo-map-type: -``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE`` ``(enum v4l2_mpeg_video_h264_fmo_map_type)`` +``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE`` ```` + (enum) + +enum v4l2_mpeg_video_h264_fmo_map_type - When using FMO, the map type divides the image in different scan patterns of macroblocks. Applicable to the H264 encoder. Possible values are: @@ -2093,7 +2177,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-fmo-change-direction: -``V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION (enum v4l2_mpeg_video_h264_fmo_change_dir)`` +``V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION`` + (enum) + +enum v4l2_mpeg_video_h264_fmo_change_dir - Specifies a direction of the slice group change for raster and wipe maps. Applicable to the H264 encoder. Possible values are: @@ -2161,7 +2248,10 @@ Codec Control IDs .. _v4l2-mpeg-video-h264-hierarchical-coding-type: -``V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE (enum v4l2_mpeg_video_h264_hierarchical_coding_type)`` +``V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE`` + (enum) + +enum v4l2_mpeg_video_h264_hierarchical_coding_type - Specifies the hierarchical coding type. Applicable to the H264 encoder. Possible values are: @@ -2330,7 +2420,10 @@ MFC 5.1 Control IDs .. _v4l2-mpeg-mfc51-video-frame-skip-mode: -``V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (enum v4l2_mpeg_mfc51_video_frame_skip_mode)`` +``V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE`` + (enum) + +enum v4l2_mpeg_mfc51_video_frame_skip_mode - Indicates in what conditions the encoder should skip frames. If encoding a frame would cause the encoded stream to be larger then a chosen data limit then the frame will be skipped. Possible values @@ -2379,7 +2472,10 @@ MFC 5.1 Control IDs .. _v4l2-mpeg-mfc51-video-force-frame-type: -``V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (enum v4l2_mpeg_mfc51_video_force_frame_type)`` +``V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE`` + (enum) + +enum v4l2_mpeg_mfc51_video_force_frame_type - Force a frame type for the next queued buffer. Applicable to encoders. Possible values are: @@ -2425,7 +2521,10 @@ CX2341x Control IDs .. _v4l2-mpeg-cx2341x-video-spatial-filter-mode: -``V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (enum v4l2_mpeg_cx2341x_video_spatial_filter_mode)`` +``V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE`` + (enum) + +enum v4l2_mpeg_cx2341x_video_spatial_filter_mode - Sets the Spatial Filter mode (default ``MANUAL``). Possible values are: @@ -2456,7 +2555,10 @@ CX2341x Control IDs .. _luma-spatial-filter-type: -``V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type)`` +``V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE`` + (enum) + +enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type - Select the algorithm to use for the Luma Spatial Filter (default ``1D_HOR``). Possible values: @@ -2503,7 +2605,10 @@ CX2341x Control IDs .. _chroma-spatial-filter-type: -``V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type)`` +``V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE`` + (enum) + +enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type - Select the algorithm for the Chroma Spatial Filter (default ``1D_HOR``). Possible values are: @@ -2530,7 +2635,10 @@ CX2341x Control IDs .. _v4l2-mpeg-cx2341x-video-temporal-filter-mode: -``V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (enum v4l2_mpeg_cx2341x_video_temporal_filter_mode)`` +``V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE`` + (enum) + +enum v4l2_mpeg_cx2341x_video_temporal_filter_mode - Sets the Temporal Filter mode (default ``MANUAL``). Possible values are: @@ -2561,7 +2669,10 @@ CX2341x Control IDs .. _v4l2-mpeg-cx2341x-video-median-filter-type: -``V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (enum v4l2_mpeg_cx2341x_video_median_filter_type)`` +``V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE`` + (enum) + +enum v4l2_mpeg_cx2341x_video_median_filter_type - Median Filter Type (default ``OFF``). Possible values are: @@ -2642,7 +2753,10 @@ VPX Control IDs .. _v4l2-vpx-num-partitions: -``V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS (enum v4l2_vp8_num_partitions)`` +``V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS`` + (enum) + +enum v4l2_vp8_num_partitions - The number of token partitions to use in VP8 encoder. Possible values are: @@ -2684,7 +2798,10 @@ VPX Control IDs .. _v4l2-vpx-num-ref-frames: -``V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES (enum v4l2_vp8_num_ref_frames)`` +``V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES`` + (enum) + +enum v4l2_vp8_num_ref_frames - The number of reference pictures for encoding P frames. Possible values are: @@ -2736,7 +2853,10 @@ VPX Control IDs .. _v4l2-vpx-golden-frame-sel: -``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL (enum v4l2_vp8_golden_frame_sel)`` +``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL`` + (enum) + +enum v4l2_vp8_golden_frame_sel - Selects the golden frame for encoding. Possible values are: .. raw:: latex @@ -2807,7 +2927,10 @@ Camera Control IDs .. _v4l2-exposure-auto-type: -``V4L2_CID_EXPOSURE_AUTO (enum v4l2_exposure_auto_type)`` +``V4L2_CID_EXPOSURE_AUTO`` + (enum) + +enum v4l2_exposure_auto_type - Enables automatic adjustments of the exposure time and/or iris aperture. The effect of manual changes of the exposure time or iris aperture while these features are enabled is undefined, drivers @@ -2872,7 +2995,10 @@ Camera Control IDs .. _v4l2-exposure-metering: -``V4L2_CID_EXPOSURE_METERING (enum v4l2_exposure_metering)`` +``V4L2_CID_EXPOSURE_METERING`` + (enum) + +enum v4l2_exposure_metering - Determines how the camera measures the amount of light available for the frame exposure. Possible values are: @@ -3018,7 +3144,10 @@ Camera Control IDs .. _v4l2-auto-focus-range: -``V4L2_CID_AUTO_FOCUS_RANGE (enum v4l2_auto_focus_range)`` +``V4L2_CID_AUTO_FOCUS_RANGE`` + (enum) + +enum v4l2_auto_focus_range - Determines auto focus distance range for which lens may be adjusted. .. tabularcolumns:: |p{6.5cm}|p{11.0cm}| @@ -3102,7 +3231,10 @@ Camera Control IDs .. _v4l2-auto-n-preset-white-balance: -``V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (enum v4l2_auto_n_preset_white_balance)`` +``V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE`` + (enum) + +enum v4l2_auto_n_preset_white_balance - Sets white balance to automatic, manual or a preset. The presets determine color temperature of the light as a hint to the camera for white balance adjustments resulting in most accurate color @@ -3218,7 +3350,10 @@ Camera Control IDs .. _v4l2-iso-sensitivity-auto-type: -``V4L2_CID_ISO_SENSITIVITY_AUTO (enum v4l2_iso_sensitivity_type)`` +``V4L2_CID_ISO_SENSITIVITY_AUTO`` + (enum) + +enum v4l2_iso_sensitivity_type - Enables or disables automatic ISO sensitivity adjustments. @@ -3244,7 +3379,10 @@ Camera Control IDs .. _v4l2-scene-mode: -``V4L2_CID_SCENE_MODE (enum v4l2_scene_mode)`` +``V4L2_CID_SCENE_MODE`` + (enum) + +enum v4l2_scene_mode - This control allows to select scene programs as the camera automatic modes optimized for common shooting scenes. Within these modes the camera determines best exposure, aperture, focusing, light metering, @@ -3582,7 +3720,10 @@ FM_TX Control IDs Configures pilot tone frequency value. Unit is in Hz. The range and step are driver-specific. -``V4L2_CID_TUNE_PREEMPHASIS (enum v4l2_preemphasis)`` +``V4L2_CID_TUNE_PREEMPHASIS`` + (enum) + +enum v4l2_preemphasis - Configures the pre-emphasis value for broadcasting. A pre-emphasis filter is applied to the broadcast to accentuate the high audio frequencies. Depending on the region, a time constant of either 50 @@ -4173,13 +4314,19 @@ Digital Video Control IDs EDIDs, then the bit for that pad will be 0. This read-only control is applicable to VGA, DVI-A/D, HDMI and DisplayPort connectors. -``V4L2_CID_DV_TX_MODE (enum v4l2_dv_tx_mode)`` +``V4L2_CID_DV_TX_MODE`` + (enum) + +enum v4l2_dv_tx_mode - HDMI transmitters can transmit in DVI-D mode (just video) or in HDMI mode (video + audio + auxiliary data). This control selects which mode to use: V4L2_DV_TX_MODE_DVI_D or V4L2_DV_TX_MODE_HDMI. This control is applicable to HDMI connectors. -``V4L2_CID_DV_TX_RGB_RANGE (enum v4l2_dv_rgb_range)`` +``V4L2_CID_DV_TX_RGB_RANGE`` + (enum) + +enum v4l2_dv_rgb_range - Select the quantization range for RGB output. V4L2_DV_RANGE_AUTO follows the RGB quantization range specified in the standard for the video interface (ie. :ref:`cea861` for HDMI). @@ -4191,7 +4338,10 @@ Digital Video Control IDs the number of bits per component. This control is applicable to VGA, DVI-A/D, HDMI and DisplayPort connectors. -``V4L2_CID_DV_TX_IT_CONTENT_TYPE (enum v4l2_dv_it_content_type)`` +``V4L2_CID_DV_TX_IT_CONTENT_TYPE`` + (enum) + +enum v4l2_dv_it_content_type - Configures the IT Content Type of the transmitted video. This information is sent over HDMI and DisplayPort connectors as part of the AVI InfoFrame. The term 'IT Content' is used for content that @@ -4252,7 +4402,10 @@ Digital Video Control IDs will be 0. This read-only control is applicable to DVI-D, HDMI and DisplayPort connectors. -``V4L2_CID_DV_RX_RGB_RANGE (enum v4l2_dv_rgb_range)`` +``V4L2_CID_DV_RX_RGB_RANGE`` + (enum) + +enum v4l2_dv_rgb_range - Select the quantization range for RGB input. V4L2_DV_RANGE_AUTO follows the RGB quantization range specified in the standard for the video interface (ie. :ref:`cea861` for HDMI). @@ -4264,7 +4417,10 @@ Digital Video Control IDs the number of bits per component. This control is applicable to VGA, DVI-A/D, HDMI and DisplayPort connectors. -``V4L2_CID_DV_RX_IT_CONTENT_TYPE (enum v4l2_dv_it_content_type)`` +``V4L2_CID_DV_RX_IT_CONTENT_TYPE`` + (enum) + +enum v4l2_dv_it_content_type - Reads the IT Content Type of the received video. This information is sent over HDMI and DisplayPort connectors as part of the AVI InfoFrame. The term 'IT Content' is used for content that originates @@ -4336,7 +4492,10 @@ FM_RX Control IDs broadcasts speech. If the transmitter doesn't make this distinction, then it will be set. -``V4L2_CID_TUNE_DEEMPHASIS (enum v4l2_deemphasis)`` +``V4L2_CID_TUNE_DEEMPHASIS`` + (enum) + +enum v4l2_deemphasis - Configures the de-emphasis value for reception. A de-emphasis filter is applied to the broadcast to accentuate the high audio frequencies. Depending on the region, a time constant of either 50 From a3045153a3b3828e8c918e497624dc6792b95a6d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 22:30:47 -0300 Subject: [PATCH 085/591] [media] subdev-formats.rst: adjust tables size for LaTeX output There are two big tables here that are very hard to adjust its size. The first one would fit into one page, but the latex.py logic at Sphinx auto-switches to longtable when there are more than 30 rows. There's no way to override without coding. The second one is really big, and won't fit on a single page. So, it has to use tiny font to fit. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/subdev-formats.rst | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index a347fcc206db..0b31943bb300 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -154,18 +154,26 @@ half of the green value) transferred first will be named The following tables list existing packed RGB formats. -.. FIXME: I was unable to find a way to use adjustbox or landscape for this table! +.. HACK: ideally, we would be using adjustbox here. However, Sphinx +.. is a very bad behaviored guy: if the table has more than 30 cols, +.. it switches to long table, and there's no way to override it. -.. tabularcolumns:: |p{7.6cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{-1.0cm}| + +.. tabularcolumns:: |p{4.0cm}|p{0.7cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22}| .. _v4l2-mbus-pixelcode-rgb: +.. raw:: latex + + \begingroup + \tiny + \setlength{\tabcolsep}{2pt} + .. flat-table:: RGB formats :header-rows: 2 :stub-columns: 0 :widths: 36 7 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 - - .. row 1 - Identifier @@ -2355,6 +2363,10 @@ The following tables list existing packed RGB formats. - b\ :sub:`0` +.. raw:: latex + + \endgroup + On LVDS buses, usually each sample is transferred serialized in seven time slots per pixel clock, on three (18-bit) or four (24-bit) differential data pairs at the same time. The remaining bits are used @@ -3751,13 +3763,22 @@ the following codes. - d for dummy bits -.. FIXME: I was unable to find a way to use adjustbox or landscape for this table! -.. tabularcolumns:: |p{7.6cm}|p{1.6cm}|p{0.7cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{-1.0cm}| +.. tabularcolumns:: |p{4.0cm}|p{0.7cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22}| .. _v4l2-mbus-pixelcode-yuv8: -.. cssclass:: longtable + +.. HACK: ideally, we would be using adjustbox here. However, this +.. will never work for this table, as, even with tiny font, it is +.. to big for a single page. So, we need to manually adjust the +.. size. + +.. raw:: latex + + \begingroup + \tiny + \setlength{\tabcolsep}{2pt} .. flat-table:: YUV Formats :header-rows: 2 @@ -11439,6 +11460,9 @@ the following codes. - v\ :sub:`0` +.. raw:: latex + + \endgroup HSV/HSL Formats ^^^^^^^^^^^^^^^ From b782434133c7ff4db7ab46dab68dd0c2983a0b08 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 22:39:44 -0300 Subject: [PATCH 086/591] [media] cec-ioc-receive.rst: one table here should be longtable The table is too big to fit into a single page on LaTeX format. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/cec/cec-ioc-receive.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index a7074a967f8d..821562bc8c7a 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -77,6 +77,8 @@ result. .. _cec-msg: +.. cssclass:: longtable + .. flat-table:: struct cec_msg :header-rows: 0 :stub-columns: 0 From 5257d2689caf25dcc9e479ad368dc3f774415147 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 20 Aug 2016 09:25:51 -0300 Subject: [PATCH 087/591] [media] v4l2-dev.rst: adjust table to fit into page One table here is not being properly displayed on LaTeX format. Adjust it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/v4l2-dev.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/media/kapi/v4l2-dev.rst b/Documentation/media/kapi/v4l2-dev.rst index cdfcf0bc78be..429883b2f6ef 100644 --- a/Documentation/media/kapi/v4l2-dev.rst +++ b/Documentation/media/kapi/v4l2-dev.rst @@ -262,6 +262,7 @@ file operations. It is a bitmask and the following bits can be set: +.. tabularcolumns:: |p{5ex}|L| ===== ================================================================ Mask Description From e653062450152d7a6688ef2aebead0b0674a3774 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 20 Aug 2016 09:26:42 -0300 Subject: [PATCH 088/591] [media] docs-rst: v4l2-drivers book: adjust column margins A few tables are not properly output on LaTeX format. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/v4l-drivers/cpia2.rst | 3 + Documentation/media/v4l-drivers/si476x.rst | 116 +++++++++++---------- 2 files changed, 65 insertions(+), 54 deletions(-) diff --git a/Documentation/media/v4l-drivers/cpia2.rst b/Documentation/media/v4l-drivers/cpia2.rst index 763705c1f50f..b5125016cfcb 100644 --- a/Documentation/media/v4l-drivers/cpia2.rst +++ b/Documentation/media/v4l-drivers/cpia2.rst @@ -55,6 +55,9 @@ may be done automatically by your distribution. Driver options ~~~~~~~~~~~~~~ +.. tabularcolumns:: |p{13ex}|L| + + ============== ======================================================== Option Description ============== ======================================================== diff --git a/Documentation/media/v4l-drivers/si476x.rst b/Documentation/media/v4l-drivers/si476x.rst index d5c07bb7524d..677512566f15 100644 --- a/Documentation/media/v4l-drivers/si476x.rst +++ b/Documentation/media/v4l-drivers/si476x.rst @@ -31,31 +31,33 @@ The drivers exposes following files: information. The contents of the file is binary data of the following layout: + .. tabularcolumns:: |p{7ex}|p{12ex}|L| + ============= ============== ==================================== - Offset Name Description + Offset Name Description ============= ============== ==================================== - 0x00 blend_int Flag, set when stereo separation has + 0x00 blend_int Flag, set when stereo separation has crossed below the blend threshold - 0x01 hblend_int Flag, set when HiBlend cutoff + 0x01 hblend_int Flag, set when HiBlend cutoff frequency is lower than threshold - 0x02 hicut_int Flag, set when HiCut cutoff + 0x02 hicut_int Flag, set when HiCut cutoff frequency is lower than threshold - 0x03 chbw_int Flag, set when channel filter + 0x03 chbw_int Flag, set when channel filter bandwidth is less than threshold - 0x04 softmute_int Flag indicating that softmute + 0x04 softmute_int Flag indicating that softmute attenuation has increased above softmute threshold 0x05 smute 0 - Audio is not soft muted 1 - Audio is soft muted - 0x06 smattn Soft mute attenuation level in dB - 0x07 chbw Channel filter bandwidth in kHz - 0x08 hicut HiCut cutoff frequency in units of + 0x06 smattn Soft mute attenuation level in dB + 0x07 chbw Channel filter bandwidth in kHz + 0x08 hicut HiCut cutoff frequency in units of 100Hz - 0x09 hiblend HiBlend cutoff frequency in units + 0x09 hiblend HiBlend cutoff frequency in units of 100 Hz - 0x10 pilot 0 - Stereo pilot is not present + 0x10 pilot 0 - Stereo pilot is not present 1 - Stereo pilot is present - 0x11 stblend Stereo blend in % + 0x11 stblend Stereo blend in % ============= ============== ==================================== @@ -63,12 +65,14 @@ The drivers exposes following files: This file contains statistics about RDS receptions. It's binary data has the following layout: + .. tabularcolumns:: |p{7ex}|p{12ex}|L| + ============= ============== ==================================== - Offset Name Description + Offset Name Description ============= ============== ==================================== - 0x00 expected Number of expected RDS blocks - 0x02 received Number of received RDS blocks - 0x04 uncorrectable Number of uncorrectable RDS blocks + 0x00 expected Number of expected RDS blocks + 0x02 received Number of received RDS blocks + 0x04 uncorrectable Number of uncorrectable RDS blocks ============= ============== ==================================== * /sys/kernel/debug//agc @@ -77,21 +81,23 @@ The drivers exposes following files: The layout is: + .. tabularcolumns:: |p{7ex}|p{12ex}|L| + ============= ============== ==================================== - Offset Name Description + Offset Name Description ============= ============== ==================================== - 0x00 mxhi 0 - FM Mixer PD high threshold is + 0x00 mxhi 0 - FM Mixer PD high threshold is not tripped 1 - FM Mixer PD high threshold is tripped - 0x01 mxlo ditto for FM Mixer PD low - 0x02 lnahi ditto for FM LNA PD high - 0x03 lnalo ditto for FM LNA PD low - 0x04 fmagc1 FMAGC1 attenuator resistance + 0x01 mxlo ditto for FM Mixer PD low + 0x02 lnahi ditto for FM LNA PD high + 0x03 lnalo ditto for FM LNA PD low + 0x04 fmagc1 FMAGC1 attenuator resistance (see datasheet for more detail) - 0x05 fmagc2 ditto for FMAGC2 - 0x06 pgagain PGA gain in dB - 0x07 fmwblang FM/WB LNA Gain in dB + 0x05 fmagc2 ditto for FMAGC2 + 0x06 pgagain PGA gain in dB + 0x07 fmwblang FM/WB LNA Gain in dB ============= ============== ==================================== * /sys/kernel/debug//rsq @@ -100,48 +106,50 @@ The drivers exposes following files: The layout is: + .. tabularcolumns:: |p{7ex}|p{12ex}|p{60ex}| + ============= ============== ==================================== - Offset Name Description + Offset Name Description ============= ============== ==================================== - 0x00 multhint 0 - multipath value has not crossed + 0x00 multhint 0 - multipath value has not crossed the Multipath high threshold 1 - multipath value has crossed the Multipath high threshold - 0x01 multlint ditto for Multipath low threshold - 0x02 snrhint 0 - received signal's SNR has not + 0x01 multlint ditto for Multipath low threshold + 0x02 snrhint 0 - received signal's SNR has not crossed high threshold 1 - received signal's SNR has crossed high threshold - 0x03 snrlint ditto for low threshold - 0x04 rssihint ditto for RSSI high threshold - 0x05 rssilint ditto for RSSI low threshold - 0x06 bltf Flag indicating if seek command + 0x03 snrlint ditto for low threshold + 0x04 rssihint ditto for RSSI high threshold + 0x05 rssilint ditto for RSSI low threshold + 0x06 bltf Flag indicating if seek command reached/wrapped seek band limit - 0x07 snr_ready Indicates that SNR metrics is ready - 0x08 rssiready ditto for RSSI metrics - 0x09 injside 0 - Low-side injection is being used + 0x07 snr_ready Indicates that SNR metrics is ready + 0x08 rssiready ditto for RSSI metrics + 0x09 injside 0 - Low-side injection is being used 1 - High-side injection is used - 0x10 afcrl Flag indicating if AFC rails - 0x11 valid Flag indicating if channel is valid - 0x12 readfreq Current tuned frequency - 0x14 freqoff Signed frequency offset in units of + 0x10 afcrl Flag indicating if AFC rails + 0x11 valid Flag indicating if channel is valid + 0x12 readfreq Current tuned frequency + 0x14 freqoff Signed frequency offset in units of 2ppm - 0x15 rssi Signed value of RSSI in dBuV - 0x16 snr Signed RF SNR in dB - 0x17 issi Signed Image Strength Signal + 0x15 rssi Signed value of RSSI in dBuV + 0x16 snr Signed RF SNR in dB + 0x17 issi Signed Image Strength Signal indicator - 0x18 lassi Signed Low side adjacent Channel + 0x18 lassi Signed Low side adjacent Channel Strength indicator - 0x19 hassi ditto fpr High side - 0x20 mult Multipath indicator - 0x21 dev Frequency deviation - 0x24 assi Adjacent channel SSI - 0x25 usn Ultrasonic noise indicator - 0x26 pilotdev Pilot deviation in units of 100 Hz - 0x27 rdsdev ditto for RDS - 0x28 assidev ditto for ASSI - 0x29 strongdev Frequency deviation - 0x30 rdspi RDS PI code + 0x19 hassi ditto fpr High side + 0x20 mult Multipath indicator + 0x21 dev Frequency deviation + 0x24 assi Adjacent channel SSI + 0x25 usn Ultrasonic noise indicator + 0x26 pilotdev Pilot deviation in units of 100 Hz + 0x27 rdsdev ditto for RDS + 0x28 assidev ditto for ASSI + 0x29 strongdev Frequency deviation + 0x30 rdspi RDS PI code ============= ============== ==================================== * /sys/kernel/debug//rsq_primary From 8c978c0846cf1a702d302b555066b1a186592b32 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 21 Aug 2016 14:07:35 -0300 Subject: [PATCH 089/591] [media] docs-rst: fix some LaTeX errors when in interactive mode There are several minor issues that are seen when building PDF on interactive mode. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/dev-sliced-vbi.rst | 2 +- Documentation/media/uapi/v4l/dev-subdev.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst | 3 +-- Documentation/media/uapi/v4l/subdev-formats.rst | 6 +++--- Documentation/media/uapi/v4l/vidioc-enumstd.rst | 2 +- Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 2 +- Documentation/media/uapi/v4l/vidioc-g-tuner.rst | 4 ++-- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst index 074aa3798152..86d2d698d2af 100644 --- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst @@ -255,7 +255,7 @@ Sliced VBI services .. raw:: latex - \newline\newline\begin{adjustbox}{width=\columnwidth} + \begin{adjustbox}{width=\columnwidth} .. tabularcolumns:: |p{5.0cm}|p{1.4cm}|p{3.0cm}|p{2.5cm}|p{9.0cm}| diff --git a/Documentation/media/uapi/v4l/dev-subdev.rst b/Documentation/media/uapi/v4l/dev-subdev.rst index 7d20c725583d..1045b3c61031 100644 --- a/Documentation/media/uapi/v4l/dev-subdev.rst +++ b/Documentation/media/uapi/v4l/dev-subdev.rst @@ -204,7 +204,7 @@ list entity names and pad numbers). .. raw:: latex - \newline\newline\begin{adjustbox}{width=\columnwidth} + \begin{adjustbox}{width=\columnwidth} .. tabularcolumns:: |p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}|p{4.5cm}| diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst index 2180a3ae4c16..4eba72266587 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst @@ -16,7 +16,7 @@ next to each other in memory. .. raw:: latex - \newline\newline\begin{adjustbox}{width=\columnwidth} + \begin{adjustbox}{width=\columnwidth} .. tabularcolumns:: |p{4.5cm}|p{3.3cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| @@ -1115,7 +1115,6 @@ either the corresponding ARGB or XRGB format, depending on the driver. .. raw:: latex - \newline\newline \begin{adjustbox}{width=\columnwidth} .. tabularcolumns:: |p{4.2cm}|p{1.0cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 0b31943bb300..8b1ba4f53b18 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -159,7 +159,7 @@ The following tables list existing packed RGB formats. .. it switches to long table, and there's no way to override it. -.. tabularcolumns:: |p{4.0cm}|p{0.7cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22}| +.. tabularcolumns:: |p{4.0cm}|p{0.7cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| .. _v4l2-mbus-pixelcode-rgb: @@ -2377,7 +2377,7 @@ JEIDA defined bit mapping will be named .. raw:: latex - \newline\newline\begin{adjustbox}{width=\columnwidth} + \begin{adjustbox}{width=\columnwidth} .. _v4l2-mbus-pixelcode-rgb-lvds: @@ -3764,7 +3764,7 @@ the following codes. - d for dummy bits -.. tabularcolumns:: |p{4.0cm}|p{0.7cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22}| +.. tabularcolumns:: |p{4.0cm}|p{0.7cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| .. _v4l2-mbus-pixelcode-yuv8: diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index 2735b0496e9e..22b4bcde7a79 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -273,7 +273,7 @@ support digital TV. See also the Linux DVB API at .. raw:: latex - \newline\newline\begin{adjustbox}{width=\columnwidth} + \begin{adjustbox}{width=\columnwidth} .. NTSC/M PAL/M /N /B /D /H /I SECAM/B /D /K1 /L .. tabularcolumns:: |p{2.7cm}|p{2.6cm}|p{3.0cm}|p{3.2cm}|p{3.2cm}|p{2.2cm}|p{1.2cm}|p{3.2cm}|p{3.0cm}|p{2.0cm}|p{2.0cm}|p{2.0cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index 740324e6e5db..87c23f289fb4 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -181,7 +181,7 @@ the sliced VBI API is unsupported or ``type`` is invalid. .. raw:: latex - \newline\newline\begin{adjustbox}{width=\columnwidth} + \begin{adjustbox}{width=\columnwidth} .. tabularcolumns:: |p{5.0cm}|p{1.4cm}|p{3.0cm}|p{2.5cm}|p{9.0cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index 9798a1a86e97..e53abcbe9ea1 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -258,7 +258,7 @@ To change the radio frequency the - :cspan:`1` Reserved for future extensions. - Drivers and applications must set the array to zero. + Drivers and applications must set the array to zero. @@ -621,7 +621,7 @@ To change the radio frequency the .. raw:: latex - \newline\newline\begin{adjustbox}{width=\columnwidth} + \begin{adjustbox}{width=\columnwidth} .. _tuner-matrix: From 8d4b231af9d162859aa4b8aeaa09170230ea1b11 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Aug 2016 09:19:46 -0300 Subject: [PATCH 090/591] [media] docs-rst: fix some .. note:: occurrences On some places, either an space or the second ':' is missing. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/examples.rst | 2 +- Documentation/media/uapi/v4l/dev-output.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-sbggr16.rst | 2 +- Documentation/media/uapi/v4l/standard.rst | 2 +- Documentation/media/v4l-drivers/zr364xx.rst | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/media/uapi/dvb/examples.rst b/Documentation/media/uapi/dvb/examples.rst index 9a4ae4b0f3d7..1a94966312c0 100644 --- a/Documentation/media/uapi/dvb/examples.rst +++ b/Documentation/media/uapi/dvb/examples.rst @@ -9,7 +9,7 @@ Examples In this section we would like to present some examples for using the DVB API. -..note:: +.. note:: This section is out of date, and the code below won't even compile. Please refer to the diff --git a/Documentation/media/uapi/v4l/dev-output.rst b/Documentation/media/uapi/v4l/dev-output.rst index 4f1123a0b40d..dfb8207c21cc 100644 --- a/Documentation/media/uapi/v4l/dev-output.rst +++ b/Documentation/media/uapi/v4l/dev-output.rst @@ -16,7 +16,7 @@ device special files named ``/dev/video`` and ``/dev/video0`` to ``/dev/video`` is typically a symbolic link to the preferred video device. -..note:: The same device file names are used also for video capture devices. +.. note:: The same device file names are used also for video capture devices. Querying Capabilities diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst index 58238c06f11e..801b78ccbc25 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst @@ -17,7 +17,7 @@ This format is similar to has a depth of 16 bits. The least significant byte is stored at lower memory addresses (little-endian). -..note:: +.. note:: The actual sampling precision may be lower than 16 bits, for example 10 bits per pixel with values in tange 0 to 1023. diff --git a/Documentation/media/uapi/v4l/standard.rst b/Documentation/media/uapi/v4l/standard.rst index 5dd341f18839..2320008f6063 100644 --- a/Documentation/media/uapi/v4l/standard.rst +++ b/Documentation/media/uapi/v4l/standard.rst @@ -41,7 +41,7 @@ output applications call the :ref:`VIDIOC_G_STD ` and *received* standard can be sensed with the :ref:`VIDIOC_QUERYSTD` ioctl. -..note:: +.. note:: The parameter of all these ioctls is a pointer to a :ref:`v4l2_std_id ` type (a standard set), *not* an diff --git a/Documentation/media/v4l-drivers/zr364xx.rst b/Documentation/media/v4l-drivers/zr364xx.rst index d8d1171887cd..f5280e366826 100644 --- a/Documentation/media/v4l-drivers/zr364xx.rst +++ b/Documentation/media/v4l-drivers/zr364xx.rst @@ -5,7 +5,7 @@ site: http://royale.zerezo.com/zr364xx/ mail: royale@zerezo.com -.. note: +.. note:: This documentation is outdated From 106267444f12fde77f5aee92ca862a7138a88508 Mon Sep 17 00:00:00 2001 From: Songjun Wu Date: Wed, 17 Aug 2016 03:05:27 -0300 Subject: [PATCH 091/591] [media] atmel-isc: add the Image Sensor Controller code Add driver for the Image Sensor Controller. It manages incoming data from a parallel based CMOS/CCD sensor. It has an internal image processor, also integrates a triple channel direct memory access controller master interface. Signed-off-by: Songjun Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 2 + drivers/media/platform/atmel/Kconfig | 9 + drivers/media/platform/atmel/Makefile | 1 + drivers/media/platform/atmel/atmel-isc-regs.h | 165 ++ drivers/media/platform/atmel/atmel-isc.c | 1514 +++++++++++++++++ 6 files changed, 1692 insertions(+) create mode 100644 drivers/media/platform/atmel/Kconfig create mode 100644 drivers/media/platform/atmel/Makefile create mode 100644 drivers/media/platform/atmel/atmel-isc-regs.h create mode 100644 drivers/media/platform/atmel/atmel-isc.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index f25344bc7912..b23db1779808 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -111,6 +111,7 @@ source "drivers/media/platform/s5p-tv/Kconfig" source "drivers/media/platform/am437x/Kconfig" source "drivers/media/platform/xilinx/Kconfig" source "drivers/media/platform/rcar-vin/Kconfig" +source "drivers/media/platform/atmel/Kconfig" config VIDEO_TI_CAL tristate "TI CAL (Camera Adaptation Layer) driver" diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 21771c1a13fb..37b6c75f0b15 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -58,6 +58,8 @@ obj-$(CONFIG_VIDEO_XILINX) += xilinx/ obj-$(CONFIG_VIDEO_RCAR_VIN) += rcar-vin/ +obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel/ + ccflags-y += -I$(srctree)/drivers/media/i2c obj-$(CONFIG_VIDEO_MEDIATEK_VPU) += mtk-vpu/ diff --git a/drivers/media/platform/atmel/Kconfig b/drivers/media/platform/atmel/Kconfig new file mode 100644 index 000000000000..867dca22a473 --- /dev/null +++ b/drivers/media/platform/atmel/Kconfig @@ -0,0 +1,9 @@ +config VIDEO_ATMEL_ISC + tristate "ATMEL Image Sensor Controller (ISC) support" + depends on VIDEO_V4L2 && COMMON_CLK && VIDEO_V4L2_SUBDEV_API && HAS_DMA + depends on ARCH_AT91 || COMPILE_TEST + select VIDEOBUF2_DMA_CONTIG + select REGMAP_MMIO + help + This module makes the ATMEL Image Sensor Controller available + as a v4l2 device. \ No newline at end of file diff --git a/drivers/media/platform/atmel/Makefile b/drivers/media/platform/atmel/Makefile new file mode 100644 index 000000000000..9d7c999d434d --- /dev/null +++ b/drivers/media/platform/atmel/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o diff --git a/drivers/media/platform/atmel/atmel-isc-regs.h b/drivers/media/platform/atmel/atmel-isc-regs.h new file mode 100644 index 000000000000..00c449717cde --- /dev/null +++ b/drivers/media/platform/atmel/atmel-isc-regs.h @@ -0,0 +1,165 @@ +#ifndef __ATMEL_ISC_REGS_H +#define __ATMEL_ISC_REGS_H + +#include + +/* ISC Control Enable Register 0 */ +#define ISC_CTRLEN 0x00000000 + +/* ISC Control Disable Register 0 */ +#define ISC_CTRLDIS 0x00000004 + +/* ISC Control Status Register 0 */ +#define ISC_CTRLSR 0x00000008 + +#define ISC_CTRL_CAPTURE BIT(0) +#define ISC_CTRL_UPPRO BIT(1) +#define ISC_CTRL_HISREQ BIT(2) +#define ISC_CTRL_HISCLR BIT(3) + +/* ISC Parallel Front End Configuration 0 Register */ +#define ISC_PFE_CFG0 0x0000000c + +#define ISC_PFE_CFG0_HPOL_LOW BIT(0) +#define ISC_PFE_CFG0_VPOL_LOW BIT(1) +#define ISC_PFE_CFG0_PPOL_LOW BIT(2) + +#define ISC_PFE_CFG0_MODE_PROGRESSIVE (0x0 << 4) +#define ISC_PFE_CFG0_MODE_MASK GENMASK(6, 4) + +#define ISC_PFE_CFG0_BPS_EIGHT (0x4 << 28) +#define ISC_PFG_CFG0_BPS_NINE (0x3 << 28) +#define ISC_PFG_CFG0_BPS_TEN (0x2 << 28) +#define ISC_PFG_CFG0_BPS_ELEVEN (0x1 << 28) +#define ISC_PFG_CFG0_BPS_TWELVE (0x0 << 28) +#define ISC_PFE_CFG0_BPS_MASK GENMASK(30, 28) + +/* ISC Clock Enable Register */ +#define ISC_CLKEN 0x00000018 + +/* ISC Clock Disable Register */ +#define ISC_CLKDIS 0x0000001c + +/* ISC Clock Status Register */ +#define ISC_CLKSR 0x00000020 + +#define ISC_CLK(n) BIT(n) + +/* ISC Clock Configuration Register */ +#define ISC_CLKCFG 0x00000024 +#define ISC_CLKCFG_DIV_SHIFT(n) ((n)*16) +#define ISC_CLKCFG_DIV_MASK(n) GENMASK(((n)*16 + 7), (n)*16) +#define ISC_CLKCFG_SEL_SHIFT(n) ((n)*16 + 8) +#define ISC_CLKCFG_SEL_MASK(n) GENMASK(((n)*17 + 8), ((n)*16 + 8)) + +/* ISC Interrupt Enable Register */ +#define ISC_INTEN 0x00000028 + +/* ISC Interrupt Disable Register */ +#define ISC_INTDIS 0x0000002c + +/* ISC Interrupt Mask Register */ +#define ISC_INTMASK 0x00000030 + +/* ISC Interrupt Status Register */ +#define ISC_INTSR 0x00000034 + +#define ISC_INT_DDONE BIT(8) + +/* ISC White Balance Control Register */ +#define ISC_WB_CTRL 0x00000058 + +/* ISC White Balance Configuration Register */ +#define ISC_WB_CFG 0x0000005c + +/* ISC Color Filter Array Control Register */ +#define ISC_CFA_CTRL 0x00000070 + +/* ISC Color Filter Array Configuration Register */ +#define ISC_CFA_CFG 0x00000074 + +#define ISC_BAY_CFG_GRGR 0x0 +#define ISC_BAY_CFG_RGRG 0x1 +#define ISC_BAY_CFG_GBGB 0x2 +#define ISC_BAY_CFG_BGBG 0x3 +#define ISC_BAY_CFG_MASK GENMASK(1, 0) + +/* ISC Color Correction Control Register */ +#define ISC_CC_CTRL 0x00000078 + +/* ISC Gamma Correction Control Register */ +#define ISC_GAM_CTRL 0x00000094 + +/* Color Space Conversion Control Register */ +#define ISC_CSC_CTRL 0x00000398 + +/* Contrast And Brightness Control Register */ +#define ISC_CBC_CTRL 0x000003b4 + +/* Subsampling 4:4:4 to 4:2:2 Control Register */ +#define ISC_SUB422_CTRL 0x000003c4 + +/* Subsampling 4:2:2 to 4:2:0 Control Register */ +#define ISC_SUB420_CTRL 0x000003cc + +/* Rounding, Limiting and Packing Configuration Register */ +#define ISC_RLP_CFG 0x000003d0 + +#define ISC_RLP_CFG_MODE_DAT8 0x0 +#define ISC_RLP_CFG_MODE_DAT9 0x1 +#define ISC_RLP_CFG_MODE_DAT10 0x2 +#define ISC_RLP_CFG_MODE_DAT11 0x3 +#define ISC_RLP_CFG_MODE_DAT12 0x4 +#define ISC_RLP_CFG_MODE_DATY8 0x5 +#define ISC_RLP_CFG_MODE_DATY10 0x6 +#define ISC_RLP_CFG_MODE_ARGB444 0x7 +#define ISC_RLP_CFG_MODE_ARGB555 0x8 +#define ISC_RLP_CFG_MODE_RGB565 0x9 +#define ISC_RLP_CFG_MODE_ARGB32 0xa +#define ISC_RLP_CFG_MODE_YYCC 0xb +#define ISC_RLP_CFG_MODE_YYCC_LIMITED 0xc +#define ISC_RLP_CFG_MODE_MASK GENMASK(3, 0) + +/* DMA Configuration Register */ +#define ISC_DCFG 0x000003e0 +#define ISC_DCFG_IMODE_PACKED8 0x0 +#define ISC_DCFG_IMODE_PACKED16 0x1 +#define ISC_DCFG_IMODE_PACKED32 0x2 +#define ISC_DCFG_IMODE_YC422SP 0x3 +#define ISC_DCFG_IMODE_YC422P 0x4 +#define ISC_DCFG_IMODE_YC420SP 0x5 +#define ISC_DCFG_IMODE_YC420P 0x6 +#define ISC_DCFG_IMODE_MASK GENMASK(2, 0) + +#define ISC_DCFG_YMBSIZE_SINGLE (0x0 << 4) +#define ISC_DCFG_YMBSIZE_BEATS4 (0x1 << 4) +#define ISC_DCFG_YMBSIZE_BEATS8 (0x2 << 4) +#define ISC_DCFG_YMBSIZE_BEATS16 (0x3 << 4) +#define ISC_DCFG_YMBSIZE_MASK GENMASK(5, 4) + +#define ISC_DCFG_CMBSIZE_SINGLE (0x0 << 8) +#define ISC_DCFG_CMBSIZE_BEATS4 (0x1 << 8) +#define ISC_DCFG_CMBSIZE_BEATS8 (0x2 << 8) +#define ISC_DCFG_CMBSIZE_BEATS16 (0x3 << 8) +#define ISC_DCFG_CMBSIZE_MASK GENMASK(9, 8) + +/* DMA Control Register */ +#define ISC_DCTRL 0x000003e4 + +#define ISC_DCTRL_DVIEW_PACKED (0x0 << 1) +#define ISC_DCTRL_DVIEW_SEMIPLANAR (0x1 << 1) +#define ISC_DCTRL_DVIEW_PLANAR (0x2 << 1) +#define ISC_DCTRL_DVIEW_MASK GENMASK(2, 1) + +#define ISC_DCTRL_IE_IS (0x0 << 4) + +/* DMA Descriptor Address Register */ +#define ISC_DNDA 0x000003e8 + +/* DMA Address 0 Register */ +#define ISC_DAD0 0x000003ec + +/* DMA Stride 0 Register */ +#define ISC_DST0 0x000003f0 + +#endif diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c new file mode 100644 index 000000000000..f0c2512d27f0 --- /dev/null +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -0,0 +1,1514 @@ +/* + * Atmel Image Sensor Controller (ISC) driver + * + * Copyright (C) 2016 Atmel + * + * Author: Songjun Wu + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * Sensor-->PFE-->WB-->CFA-->CC-->GAM-->CSC-->CBC-->SUB-->RLP-->DMA + * + * ISC video pipeline integrates the following submodules: + * PFE: Parallel Front End to sample the camera sensor input stream + * WB: Programmable white balance in the Bayer domain + * CFA: Color filter array interpolation module + * CC: Programmable color correction + * GAM: Gamma correction + * CSC: Programmable color space conversion + * CBC: Contrast and Brightness control + * SUB: This module performs YCbCr444 to YCbCr420 chrominance subsampling + * RLP: This module performs rounding, range limiting + * and packing of the incoming data + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "atmel-isc-regs.h" + +#define ATMEL_ISC_NAME "atmel_isc" + +#define ISC_MAX_SUPPORT_WIDTH 2592 +#define ISC_MAX_SUPPORT_HEIGHT 1944 + +#define ISC_CLK_MAX_DIV 255 + +enum isc_clk_id { + ISC_ISPCK = 0, + ISC_MCK = 1, +}; + +struct isc_clk { + struct clk_hw hw; + struct clk *clk; + struct regmap *regmap; + u8 id; + u8 parent_id; + u32 div; + struct device *dev; +}; + +#define to_isc_clk(hw) container_of(hw, struct isc_clk, hw) + +struct isc_buffer { + struct vb2_v4l2_buffer vb; + struct list_head list; +}; + +struct isc_subdev_entity { + struct v4l2_subdev *sd; + struct v4l2_async_subdev *asd; + struct v4l2_async_notifier notifier; + struct v4l2_subdev_pad_config *config; + + u32 pfe_cfg0; + + struct list_head list; +}; + +/* + * struct isc_format - ISC media bus format information + * @fourcc: Fourcc code for this format + * @mbus_code: V4L2 media bus format code. + * @bpp: Bytes per pixel (when stored in memory) + * @reg_bps: reg value for bits per sample + * (when transferred over a bus) + * @support: Indicates format supported by subdev + */ +struct isc_format { + u32 fourcc; + u32 mbus_code; + u8 bpp; + + u32 reg_bps; + u32 reg_rlp_mode; + u32 reg_dcfg_imode; + u32 reg_dctrl_dview; + + bool support; +}; + +#define ISC_PIPE_LINE_NODE_NUM 11 + +struct isc_device { + struct regmap *regmap; + struct clk *hclock; + struct clk *ispck; + struct isc_clk isc_clks[2]; + + struct device *dev; + struct v4l2_device v4l2_dev; + struct video_device video_dev; + + struct vb2_queue vb2_vidq; + spinlock_t dma_queue_lock; + struct list_head dma_queue; + struct isc_buffer *cur_frm; + unsigned int sequence; + bool stop; + struct completion comp; + + struct v4l2_format fmt; + struct isc_format **user_formats; + unsigned int num_user_formats; + const struct isc_format *current_fmt; + + struct mutex lock; + + struct regmap_field *pipeline[ISC_PIPE_LINE_NODE_NUM]; + + struct isc_subdev_entity *current_subdev; + struct list_head subdev_entities; +}; + +static struct isc_format isc_formats[] = { + { V4L2_PIX_FMT_SBGGR8, MEDIA_BUS_FMT_SBGGR8_1X8, + 1, ISC_PFE_CFG0_BPS_EIGHT, ISC_RLP_CFG_MODE_DAT8, + ISC_DCFG_IMODE_PACKED8, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SGBRG8, MEDIA_BUS_FMT_SGBRG8_1X8, + 1, ISC_PFE_CFG0_BPS_EIGHT, ISC_RLP_CFG_MODE_DAT8, + ISC_DCFG_IMODE_PACKED8, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SGRBG8, MEDIA_BUS_FMT_SGRBG8_1X8, + 1, ISC_PFE_CFG0_BPS_EIGHT, ISC_RLP_CFG_MODE_DAT8, + ISC_DCFG_IMODE_PACKED8, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SRGGB8, MEDIA_BUS_FMT_SRGGB8_1X8, + 1, ISC_PFE_CFG0_BPS_EIGHT, ISC_RLP_CFG_MODE_DAT8, + ISC_DCFG_IMODE_PACKED8, ISC_DCTRL_DVIEW_PACKED, false }, + + { V4L2_PIX_FMT_SBGGR10, MEDIA_BUS_FMT_SBGGR10_1X10, + 2, ISC_PFG_CFG0_BPS_TEN, ISC_RLP_CFG_MODE_DAT10, + ISC_DCFG_IMODE_PACKED16, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SGBRG10, MEDIA_BUS_FMT_SGBRG10_1X10, + 2, ISC_PFG_CFG0_BPS_TEN, ISC_RLP_CFG_MODE_DAT10, + ISC_DCFG_IMODE_PACKED16, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SGRBG10, MEDIA_BUS_FMT_SGRBG10_1X10, + 2, ISC_PFG_CFG0_BPS_TEN, ISC_RLP_CFG_MODE_DAT10, + ISC_DCFG_IMODE_PACKED16, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SRGGB10, MEDIA_BUS_FMT_SRGGB10_1X10, + 2, ISC_PFG_CFG0_BPS_TEN, ISC_RLP_CFG_MODE_DAT10, + ISC_DCFG_IMODE_PACKED16, ISC_DCTRL_DVIEW_PACKED, false }, + + { V4L2_PIX_FMT_SBGGR12, MEDIA_BUS_FMT_SBGGR12_1X12, + 2, ISC_PFG_CFG0_BPS_TWELVE, ISC_RLP_CFG_MODE_DAT12, + ISC_DCFG_IMODE_PACKED16, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SGBRG12, MEDIA_BUS_FMT_SGBRG12_1X12, + 2, ISC_PFG_CFG0_BPS_TWELVE, ISC_RLP_CFG_MODE_DAT12, + ISC_DCFG_IMODE_PACKED16, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SGRBG12, MEDIA_BUS_FMT_SGRBG12_1X12, + 2, ISC_PFG_CFG0_BPS_TWELVE, ISC_RLP_CFG_MODE_DAT12, + ISC_DCFG_IMODE_PACKED16, ISC_DCTRL_DVIEW_PACKED, false }, + { V4L2_PIX_FMT_SRGGB12, MEDIA_BUS_FMT_SRGGB12_1X12, + 2, ISC_PFG_CFG0_BPS_TWELVE, ISC_RLP_CFG_MODE_DAT12, + ISC_DCFG_IMODE_PACKED16, ISC_DCTRL_DVIEW_PACKED, false }, + + { V4L2_PIX_FMT_YUYV, MEDIA_BUS_FMT_YUYV8_2X8, + 2, ISC_PFE_CFG0_BPS_EIGHT, ISC_RLP_CFG_MODE_DAT8, + ISC_DCFG_IMODE_PACKED8, ISC_DCTRL_DVIEW_PACKED, false }, +}; + +static int isc_clk_enable(struct clk_hw *hw) +{ + struct isc_clk *isc_clk = to_isc_clk(hw); + u32 id = isc_clk->id; + struct regmap *regmap = isc_clk->regmap; + + dev_dbg(isc_clk->dev, "ISC CLK: %s, div = %d, parent id = %d\n", + __func__, isc_clk->div, isc_clk->parent_id); + + regmap_update_bits(regmap, ISC_CLKCFG, + ISC_CLKCFG_DIV_MASK(id) | ISC_CLKCFG_SEL_MASK(id), + (isc_clk->div << ISC_CLKCFG_DIV_SHIFT(id)) | + (isc_clk->parent_id << ISC_CLKCFG_SEL_SHIFT(id))); + + regmap_write(regmap, ISC_CLKEN, ISC_CLK(id)); + + return 0; +} + +static void isc_clk_disable(struct clk_hw *hw) +{ + struct isc_clk *isc_clk = to_isc_clk(hw); + u32 id = isc_clk->id; + + regmap_write(isc_clk->regmap, ISC_CLKDIS, ISC_CLK(id)); +} + +static int isc_clk_is_enabled(struct clk_hw *hw) +{ + struct isc_clk *isc_clk = to_isc_clk(hw); + u32 status; + + regmap_read(isc_clk->regmap, ISC_CLKSR, &status); + + return status & ISC_CLK(isc_clk->id) ? 1 : 0; +} + +static unsigned long +isc_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) +{ + struct isc_clk *isc_clk = to_isc_clk(hw); + + return DIV_ROUND_CLOSEST(parent_rate, isc_clk->div + 1); +} + +static int isc_clk_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + struct isc_clk *isc_clk = to_isc_clk(hw); + long best_rate = -EINVAL; + int best_diff = -1; + unsigned int i, div; + + for (i = 0; i < clk_hw_get_num_parents(hw); i++) { + struct clk_hw *parent; + unsigned long parent_rate; + + parent = clk_hw_get_parent_by_index(hw, i); + if (!parent) + continue; + + parent_rate = clk_hw_get_rate(parent); + if (!parent_rate) + continue; + + for (div = 1; div < ISC_CLK_MAX_DIV + 2; div++) { + unsigned long rate; + int diff; + + rate = DIV_ROUND_CLOSEST(parent_rate, div); + diff = abs(req->rate - rate); + + if (best_diff < 0 || best_diff > diff) { + best_rate = rate; + best_diff = diff; + req->best_parent_rate = parent_rate; + req->best_parent_hw = parent; + } + + if (!best_diff || rate < req->rate) + break; + } + + if (!best_diff) + break; + } + + dev_dbg(isc_clk->dev, + "ISC CLK: %s, best_rate = %ld, parent clk: %s @ %ld\n", + __func__, best_rate, + __clk_get_name((req->best_parent_hw)->clk), + req->best_parent_rate); + + if (best_rate < 0) + return best_rate; + + req->rate = best_rate; + + return 0; +} + +static int isc_clk_set_parent(struct clk_hw *hw, u8 index) +{ + struct isc_clk *isc_clk = to_isc_clk(hw); + + if (index >= clk_hw_get_num_parents(hw)) + return -EINVAL; + + isc_clk->parent_id = index; + + return 0; +} + +static u8 isc_clk_get_parent(struct clk_hw *hw) +{ + struct isc_clk *isc_clk = to_isc_clk(hw); + + return isc_clk->parent_id; +} + +static int isc_clk_set_rate(struct clk_hw *hw, + unsigned long rate, + unsigned long parent_rate) +{ + struct isc_clk *isc_clk = to_isc_clk(hw); + u32 div; + + if (!rate) + return -EINVAL; + + div = DIV_ROUND_CLOSEST(parent_rate, rate); + if (div > (ISC_CLK_MAX_DIV + 1) || !div) + return -EINVAL; + + isc_clk->div = div - 1; + + return 0; +} + +static const struct clk_ops isc_clk_ops = { + .enable = isc_clk_enable, + .disable = isc_clk_disable, + .is_enabled = isc_clk_is_enabled, + .recalc_rate = isc_clk_recalc_rate, + .determine_rate = isc_clk_determine_rate, + .set_parent = isc_clk_set_parent, + .get_parent = isc_clk_get_parent, + .set_rate = isc_clk_set_rate, +}; + +static int isc_clk_register(struct isc_device *isc, unsigned int id) +{ + struct regmap *regmap = isc->regmap; + struct device_node *np = isc->dev->of_node; + struct isc_clk *isc_clk; + struct clk_init_data init; + const char *clk_name = np->name; + const char *parent_names[3]; + int num_parents; + + num_parents = of_clk_get_parent_count(np); + if (num_parents < 1 || num_parents > 3) + return -EINVAL; + + if (num_parents > 2 && id == ISC_ISPCK) + num_parents = 2; + + of_clk_parent_fill(np, parent_names, num_parents); + + if (id == ISC_MCK) + of_property_read_string(np, "clock-output-names", &clk_name); + else + clk_name = "isc-ispck"; + + init.parent_names = parent_names; + init.num_parents = num_parents; + init.name = clk_name; + init.ops = &isc_clk_ops; + init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; + + isc_clk = &isc->isc_clks[id]; + isc_clk->hw.init = &init; + isc_clk->regmap = regmap; + isc_clk->id = id; + isc_clk->dev = isc->dev; + + isc_clk->clk = clk_register(isc->dev, &isc_clk->hw); + if (IS_ERR(isc_clk->clk)) { + dev_err(isc->dev, "%s: clock register fail\n", clk_name); + return PTR_ERR(isc_clk->clk); + } else if (id == ISC_MCK) + of_clk_add_provider(np, of_clk_src_simple_get, isc_clk->clk); + + return 0; +} + +static int isc_clk_init(struct isc_device *isc) +{ + unsigned int i; + int ret; + + for (i = 0; i < ARRAY_SIZE(isc->isc_clks); i++) + isc->isc_clks[i].clk = ERR_PTR(-EINVAL); + + for (i = 0; i < ARRAY_SIZE(isc->isc_clks); i++) { + ret = isc_clk_register(isc, i); + if (ret) + return ret; + } + + return 0; +} + +static void isc_clk_cleanup(struct isc_device *isc) +{ + unsigned int i; + + of_clk_del_provider(isc->dev->of_node); + + for (i = 0; i < ARRAY_SIZE(isc->isc_clks); i++) { + struct isc_clk *isc_clk = &isc->isc_clks[i]; + + if (!IS_ERR(isc_clk->clk)) + clk_unregister(isc_clk->clk); + } +} + +static int isc_queue_setup(struct vb2_queue *vq, + unsigned int *nbuffers, unsigned int *nplanes, + unsigned int sizes[], struct device *alloc_devs[]) +{ + struct isc_device *isc = vb2_get_drv_priv(vq); + unsigned int size = isc->fmt.fmt.pix.sizeimage; + + if (*nplanes) + return sizes[0] < size ? -EINVAL : 0; + + *nplanes = 1; + sizes[0] = size; + + return 0; +} + +static int isc_buffer_prepare(struct vb2_buffer *vb) +{ + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + struct isc_device *isc = vb2_get_drv_priv(vb->vb2_queue); + unsigned long size = isc->fmt.fmt.pix.sizeimage; + + if (vb2_plane_size(vb, 0) < size) { + v4l2_err(&isc->v4l2_dev, "buffer too small (%lu < %lu)\n", + vb2_plane_size(vb, 0), size); + return -EINVAL; + } + + vb2_set_plane_payload(vb, 0, size); + + vbuf->field = isc->fmt.fmt.pix.field; + + return 0; +} + +static inline void isc_start_dma(struct regmap *regmap, + struct isc_buffer *frm, u32 dview) +{ + dma_addr_t addr; + + addr = vb2_dma_contig_plane_dma_addr(&frm->vb.vb2_buf, 0); + + regmap_write(regmap, ISC_DCTRL, dview | ISC_DCTRL_IE_IS); + regmap_write(regmap, ISC_DAD0, addr); + regmap_write(regmap, ISC_CTRLEN, ISC_CTRL_CAPTURE); +} + +static void isc_set_pipeline(struct isc_device *isc, u32 pipeline) +{ + u32 val; + unsigned int i; + + for (i = 0; i < ISC_PIPE_LINE_NODE_NUM; i++) { + val = pipeline & BIT(i) ? 1 : 0; + regmap_field_write(isc->pipeline[i], val); + } +} + +static int isc_configure(struct isc_device *isc) +{ + struct regmap *regmap = isc->regmap; + const struct isc_format *current_fmt = isc->current_fmt; + struct isc_subdev_entity *subdev = isc->current_subdev; + u32 val, mask; + int counter = 10; + + val = current_fmt->reg_bps | subdev->pfe_cfg0 | + ISC_PFE_CFG0_MODE_PROGRESSIVE; + mask = ISC_PFE_CFG0_BPS_MASK | ISC_PFE_CFG0_HPOL_LOW | + ISC_PFE_CFG0_VPOL_LOW | ISC_PFE_CFG0_PPOL_LOW | + ISC_PFE_CFG0_MODE_MASK; + + regmap_update_bits(regmap, ISC_PFE_CFG0, mask, val); + + regmap_update_bits(regmap, ISC_RLP_CFG, ISC_RLP_CFG_MODE_MASK, + current_fmt->reg_rlp_mode); + + regmap_update_bits(regmap, ISC_DCFG, ISC_DCFG_IMODE_MASK, + current_fmt->reg_dcfg_imode); + + /* Disable the pipeline */ + isc_set_pipeline(isc, 0x0); + + /* Update profile */ + regmap_write(regmap, ISC_CTRLEN, ISC_CTRL_UPPRO); + + regmap_read(regmap, ISC_CTRLSR, &val); + while ((val & ISC_CTRL_UPPRO) && counter--) { + usleep_range(1000, 2000); + regmap_read(regmap, ISC_CTRLSR, &val); + } + + if (counter < 0) + return -ETIMEDOUT; + + return 0; +} + +static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) +{ + struct isc_device *isc = vb2_get_drv_priv(vq); + struct regmap *regmap = isc->regmap; + struct isc_buffer *buf; + unsigned long flags; + int ret; + u32 val; + + /* Enable stream on the sub device */ + ret = v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 1); + if (ret && ret != -ENOIOCTLCMD) { + v4l2_err(&isc->v4l2_dev, "stream on failed in subdev\n"); + goto err_start_stream; + } + + pm_runtime_get_sync(isc->dev); + + /* Disable all the interrupts */ + regmap_write(isc->regmap, ISC_INTDIS, (u32)~0UL); + + /* Clean the interrupt status register */ + regmap_read(regmap, ISC_INTSR, &val); + + ret = isc_configure(isc); + if (unlikely(ret)) + goto err_configure; + + /* Enable DMA interrupt */ + regmap_write(regmap, ISC_INTEN, ISC_INT_DDONE); + + spin_lock_irqsave(&isc->dma_queue_lock, flags); + + isc->sequence = 0; + isc->stop = false; + reinit_completion(&isc->comp); + + isc->cur_frm = list_first_entry(&isc->dma_queue, + struct isc_buffer, list); + list_del(&isc->cur_frm->list); + + isc_start_dma(regmap, isc->cur_frm, isc->current_fmt->reg_dctrl_dview); + + spin_unlock_irqrestore(&isc->dma_queue_lock, flags); + + return 0; + +err_configure: + pm_runtime_put_sync(isc->dev); + + v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 0); + +err_start_stream: + spin_lock_irqsave(&isc->dma_queue_lock, flags); + list_for_each_entry(buf, &isc->dma_queue, list) + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED); + INIT_LIST_HEAD(&isc->dma_queue); + spin_unlock_irqrestore(&isc->dma_queue_lock, flags); + + return ret; +} + +static void isc_stop_streaming(struct vb2_queue *vq) +{ + struct isc_device *isc = vb2_get_drv_priv(vq); + unsigned long flags; + struct isc_buffer *buf; + int ret; + + isc->stop = true; + + /* Wait until the end of the current frame */ + if (isc->cur_frm && !wait_for_completion_timeout(&isc->comp, 5 * HZ)) + v4l2_err(&isc->v4l2_dev, + "Timeout waiting for end of the capture\n"); + + /* Disable DMA interrupt */ + regmap_write(isc->regmap, ISC_INTDIS, ISC_INT_DDONE); + + pm_runtime_put_sync(isc->dev); + + /* Disable stream on the sub device */ + ret = v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 0); + if (ret && ret != -ENOIOCTLCMD) + v4l2_err(&isc->v4l2_dev, "stream off failed in subdev\n"); + + /* Release all active buffers */ + spin_lock_irqsave(&isc->dma_queue_lock, flags); + if (unlikely(isc->cur_frm)) { + vb2_buffer_done(&isc->cur_frm->vb.vb2_buf, + VB2_BUF_STATE_ERROR); + isc->cur_frm = NULL; + } + list_for_each_entry(buf, &isc->dma_queue, list) + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); + INIT_LIST_HEAD(&isc->dma_queue); + spin_unlock_irqrestore(&isc->dma_queue_lock, flags); +} + +static void isc_buffer_queue(struct vb2_buffer *vb) +{ + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + struct isc_buffer *buf = container_of(vbuf, struct isc_buffer, vb); + struct isc_device *isc = vb2_get_drv_priv(vb->vb2_queue); + unsigned long flags; + + spin_lock_irqsave(&isc->dma_queue_lock, flags); + list_add_tail(&buf->list, &isc->dma_queue); + spin_unlock_irqrestore(&isc->dma_queue_lock, flags); +} + +static struct vb2_ops isc_vb2_ops = { + .queue_setup = isc_queue_setup, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, + .buf_prepare = isc_buffer_prepare, + .start_streaming = isc_start_streaming, + .stop_streaming = isc_stop_streaming, + .buf_queue = isc_buffer_queue, +}; + +static int isc_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + struct isc_device *isc = video_drvdata(file); + + strcpy(cap->driver, ATMEL_ISC_NAME); + strcpy(cap->card, "Atmel Image Sensor Controller"); + snprintf(cap->bus_info, sizeof(cap->bus_info), + "platform:%s", isc->v4l2_dev.name); + + return 0; +} + +static int isc_enum_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_fmtdesc *f) +{ + struct isc_device *isc = video_drvdata(file); + u32 index = f->index; + + if (index >= isc->num_user_formats) + return -EINVAL; + + f->pixelformat = isc->user_formats[index]->fourcc; + + return 0; +} + +static int isc_g_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *fmt) +{ + struct isc_device *isc = video_drvdata(file); + + *fmt = isc->fmt; + + return 0; +} + +static struct isc_format *find_format_by_fourcc(struct isc_device *isc, + unsigned int fourcc) +{ + unsigned int num_formats = isc->num_user_formats; + struct isc_format *fmt; + unsigned int i; + + for (i = 0; i < num_formats; i++) { + fmt = isc->user_formats[i]; + if (fmt->fourcc == fourcc) + return fmt; + } + + return NULL; +} + +static int isc_try_fmt(struct isc_device *isc, struct v4l2_format *f, + struct isc_format **current_fmt) +{ + struct isc_format *isc_fmt; + struct v4l2_pix_format *pixfmt = &f->fmt.pix; + struct v4l2_subdev_format format = { + .which = V4L2_SUBDEV_FORMAT_TRY, + }; + int ret; + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + isc_fmt = find_format_by_fourcc(isc, pixfmt->pixelformat); + if (!isc_fmt) { + v4l2_warn(&isc->v4l2_dev, "Format 0x%x not found\n", + pixfmt->pixelformat); + isc_fmt = isc->user_formats[isc->num_user_formats - 1]; + pixfmt->pixelformat = isc_fmt->fourcc; + } + + /* Limit to Atmel ISC hardware capabilities */ + if (pixfmt->width > ISC_MAX_SUPPORT_WIDTH) + pixfmt->width = ISC_MAX_SUPPORT_WIDTH; + if (pixfmt->height > ISC_MAX_SUPPORT_HEIGHT) + pixfmt->height = ISC_MAX_SUPPORT_HEIGHT; + + v4l2_fill_mbus_format(&format.format, pixfmt, isc_fmt->mbus_code); + ret = v4l2_subdev_call(isc->current_subdev->sd, pad, set_fmt, + isc->current_subdev->config, &format); + if (ret < 0) + return ret; + + v4l2_fill_pix_format(pixfmt, &format.format); + + pixfmt->field = V4L2_FIELD_NONE; + pixfmt->bytesperline = pixfmt->width * isc_fmt->bpp; + pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height; + + if (current_fmt) + *current_fmt = isc_fmt; + + return 0; +} + +static int isc_set_fmt(struct isc_device *isc, struct v4l2_format *f) +{ + struct v4l2_subdev_format format = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct isc_format *current_fmt; + int ret; + + ret = isc_try_fmt(isc, f, ¤t_fmt); + if (ret) + return ret; + + v4l2_fill_mbus_format(&format.format, &f->fmt.pix, + current_fmt->mbus_code); + ret = v4l2_subdev_call(isc->current_subdev->sd, pad, + set_fmt, NULL, &format); + if (ret < 0) + return ret; + + isc->fmt = *f; + isc->current_fmt = current_fmt; + + return 0; +} + +static int isc_s_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct isc_device *isc = video_drvdata(file); + + if (vb2_is_streaming(&isc->vb2_vidq)) + return -EBUSY; + + return isc_set_fmt(isc, f); +} + +static int isc_try_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct isc_device *isc = video_drvdata(file); + + return isc_try_fmt(isc, f, NULL); +} + +static int isc_enum_input(struct file *file, void *priv, + struct v4l2_input *inp) +{ + if (inp->index != 0) + return -EINVAL; + + inp->type = V4L2_INPUT_TYPE_CAMERA; + inp->std = 0; + strcpy(inp->name, "Camera"); + + return 0; +} + +static int isc_g_input(struct file *file, void *priv, unsigned int *i) +{ + *i = 0; + + return 0; +} + +static int isc_s_input(struct file *file, void *priv, unsigned int i) +{ + if (i > 0) + return -EINVAL; + + return 0; +} + +static int isc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a) +{ + struct isc_device *isc = video_drvdata(file); + + if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + return v4l2_subdev_call(isc->current_subdev->sd, video, g_parm, a); +} + +static int isc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a) +{ + struct isc_device *isc = video_drvdata(file); + + if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + return v4l2_subdev_call(isc->current_subdev->sd, video, s_parm, a); +} + +static int isc_enum_framesizes(struct file *file, void *fh, + struct v4l2_frmsizeenum *fsize) +{ + struct isc_device *isc = video_drvdata(file); + const struct isc_format *isc_fmt; + struct v4l2_subdev_frame_size_enum fse = { + .index = fsize->index, + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + int ret; + + isc_fmt = find_format_by_fourcc(isc, fsize->pixel_format); + if (!isc_fmt) + return -EINVAL; + + fse.code = isc_fmt->mbus_code; + + ret = v4l2_subdev_call(isc->current_subdev->sd, pad, enum_frame_size, + NULL, &fse); + if (ret) + return ret; + + fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; + fsize->discrete.width = fse.max_width; + fsize->discrete.height = fse.max_height; + + return 0; +} + +static int isc_enum_frameintervals(struct file *file, void *fh, + struct v4l2_frmivalenum *fival) +{ + struct isc_device *isc = video_drvdata(file); + const struct isc_format *isc_fmt; + struct v4l2_subdev_frame_interval_enum fie = { + .index = fival->index, + .width = fival->width, + .height = fival->height, + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + int ret; + + isc_fmt = find_format_by_fourcc(isc, fival->pixel_format); + if (!isc_fmt) + return -EINVAL; + + fie.code = isc_fmt->mbus_code; + + ret = v4l2_subdev_call(isc->current_subdev->sd, pad, + enum_frame_interval, NULL, &fie); + if (ret) + return ret; + + fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; + fival->discrete = fie.interval; + + return 0; +} + +static const struct v4l2_ioctl_ops isc_ioctl_ops = { + .vidioc_querycap = isc_querycap, + .vidioc_enum_fmt_vid_cap = isc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = isc_g_fmt_vid_cap, + .vidioc_s_fmt_vid_cap = isc_s_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = isc_try_fmt_vid_cap, + + .vidioc_enum_input = isc_enum_input, + .vidioc_g_input = isc_g_input, + .vidioc_s_input = isc_s_input, + + .vidioc_reqbufs = vb2_ioctl_reqbufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_expbuf = vb2_ioctl_expbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_prepare_buf = vb2_ioctl_prepare_buf, + .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamoff = vb2_ioctl_streamoff, + + .vidioc_g_parm = isc_g_parm, + .vidioc_s_parm = isc_s_parm, + .vidioc_enum_framesizes = isc_enum_framesizes, + .vidioc_enum_frameintervals = isc_enum_frameintervals, +}; + +static int isc_open(struct file *file) +{ + struct isc_device *isc = video_drvdata(file); + struct v4l2_subdev *sd = isc->current_subdev->sd; + int ret; + + if (mutex_lock_interruptible(&isc->lock)) + return -ERESTARTSYS; + + ret = v4l2_fh_open(file); + if (ret < 0) + goto unlock; + + if (!v4l2_fh_is_singular_file(file)) + goto unlock; + + ret = v4l2_subdev_call(sd, core, s_power, 1); + if (ret < 0 && ret != -ENOIOCTLCMD) + v4l2_fh_release(file); + else + ret = 0; + +unlock: + mutex_unlock(&isc->lock); + return ret; +} + +static int isc_release(struct file *file) +{ + struct isc_device *isc = video_drvdata(file); + struct v4l2_subdev *sd = isc->current_subdev->sd; + bool fh_singular; + int ret; + + mutex_lock(&isc->lock); + + fh_singular = v4l2_fh_is_singular_file(file); + + ret = _vb2_fop_release(file, NULL); + + if (fh_singular) + v4l2_subdev_call(sd, core, s_power, 0); + + mutex_unlock(&isc->lock); + + return ret; +} + +static const struct v4l2_file_operations isc_fops = { + .owner = THIS_MODULE, + .open = isc_open, + .release = isc_release, + .unlocked_ioctl = video_ioctl2, + .read = vb2_fop_read, + .mmap = vb2_fop_mmap, + .poll = vb2_fop_poll, +}; + +static irqreturn_t isc_interrupt(int irq, void *dev_id) +{ + struct isc_device *isc = (struct isc_device *)dev_id; + struct regmap *regmap = isc->regmap; + u32 isc_intsr, isc_intmask, pending; + irqreturn_t ret = IRQ_NONE; + + spin_lock(&isc->dma_queue_lock); + + regmap_read(regmap, ISC_INTSR, &isc_intsr); + regmap_read(regmap, ISC_INTMASK, &isc_intmask); + + pending = isc_intsr & isc_intmask; + + if (likely(pending & ISC_INT_DDONE)) { + if (isc->cur_frm) { + struct vb2_v4l2_buffer *vbuf = &isc->cur_frm->vb; + struct vb2_buffer *vb = &vbuf->vb2_buf; + + vb->timestamp = ktime_get_ns(); + vbuf->sequence = isc->sequence++; + vb2_buffer_done(vb, VB2_BUF_STATE_DONE); + isc->cur_frm = NULL; + } + + if (!list_empty(&isc->dma_queue) && !isc->stop) { + isc->cur_frm = list_first_entry(&isc->dma_queue, + struct isc_buffer, list); + list_del(&isc->cur_frm->list); + + isc_start_dma(regmap, isc->cur_frm, + isc->current_fmt->reg_dctrl_dview); + } + + if (isc->stop) + complete(&isc->comp); + + ret = IRQ_HANDLED; + } + + spin_unlock(&isc->dma_queue_lock); + + return ret; +} + +static int isc_async_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_subdev *asd) +{ + struct isc_device *isc = container_of(notifier->v4l2_dev, + struct isc_device, v4l2_dev); + struct isc_subdev_entity *subdev_entity = + container_of(notifier, struct isc_subdev_entity, notifier); + + if (video_is_registered(&isc->video_dev)) { + v4l2_err(&isc->v4l2_dev, "only supports one sub-device.\n"); + return -EBUSY; + } + + subdev_entity->sd = subdev; + + return 0; +} + +static void isc_async_unbind(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_subdev *asd) +{ + struct isc_device *isc = container_of(notifier->v4l2_dev, + struct isc_device, v4l2_dev); + + video_unregister_device(&isc->video_dev); + if (isc->current_subdev->config) + v4l2_subdev_free_pad_config(isc->current_subdev->config); +} + +static struct isc_format *find_format_by_code(unsigned int code, int *index) +{ + struct isc_format *fmt = &isc_formats[0]; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(isc_formats); i++) { + if (fmt->mbus_code == code) { + *index = i; + return fmt; + } + + fmt++; + } + + return NULL; +} + +static int isc_formats_init(struct isc_device *isc) +{ + struct isc_format *fmt; + struct v4l2_subdev *subdev = isc->current_subdev->sd; + int num_fmts = 0, i, j; + struct v4l2_subdev_mbus_code_enum mbus_code = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + + fmt = &isc_formats[0]; + for (i = 0; i < ARRAY_SIZE(isc_formats); i++) { + fmt->support = false; + fmt++; + } + + while (!v4l2_subdev_call(subdev, pad, enum_mbus_code, + NULL, &mbus_code)) { + mbus_code.index++; + fmt = find_format_by_code(mbus_code.code, &i); + if (!fmt) + continue; + + fmt->support = true; + num_fmts++; + } + + if (!num_fmts) + return -ENXIO; + + isc->num_user_formats = num_fmts; + isc->user_formats = devm_kcalloc(isc->dev, + num_fmts, sizeof(struct isc_format *), + GFP_KERNEL); + if (!isc->user_formats) { + v4l2_err(&isc->v4l2_dev, "could not allocate memory\n"); + return -ENOMEM; + } + + fmt = &isc_formats[0]; + for (i = 0, j = 0; i < ARRAY_SIZE(isc_formats); i++) { + if (fmt->support) + isc->user_formats[j++] = fmt; + + fmt++; + } + + return 0; +} + +static int isc_set_default_fmt(struct isc_device *isc) +{ + struct v4l2_format f = { + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, + .fmt.pix = { + .width = VGA_WIDTH, + .height = VGA_HEIGHT, + .field = V4L2_FIELD_NONE, + .pixelformat = isc->user_formats[0]->fourcc, + }, + }; + + return isc_set_fmt(isc, &f); +} + +static int isc_async_complete(struct v4l2_async_notifier *notifier) +{ + struct isc_device *isc = container_of(notifier->v4l2_dev, + struct isc_device, v4l2_dev); + struct isc_subdev_entity *sd_entity; + struct video_device *vdev = &isc->video_dev; + struct vb2_queue *q = &isc->vb2_vidq; + int ret; + + isc->current_subdev = container_of(notifier, + struct isc_subdev_entity, notifier); + sd_entity = isc->current_subdev; + + mutex_init(&isc->lock); + init_completion(&isc->comp); + + /* Initialize videobuf2 queue */ + q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; + q->drv_priv = isc; + q->buf_struct_size = sizeof(struct isc_buffer); + q->ops = &isc_vb2_ops; + q->mem_ops = &vb2_dma_contig_memops; + q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; + q->lock = &isc->lock; + q->min_buffers_needed = 1; + q->dev = isc->dev; + + ret = vb2_queue_init(q); + if (ret < 0) { + v4l2_err(&isc->v4l2_dev, + "vb2_queue_init() failed: %d\n", ret); + return ret; + } + + /* Init video dma queues */ + INIT_LIST_HEAD(&isc->dma_queue); + spin_lock_init(&isc->dma_queue_lock); + + sd_entity->config = v4l2_subdev_alloc_pad_config(sd_entity->sd); + if (sd_entity->config == NULL) + return -ENOMEM; + + ret = isc_formats_init(isc); + if (ret < 0) { + v4l2_err(&isc->v4l2_dev, + "Init format failed: %d\n", ret); + return ret; + } + + ret = v4l2_subdev_call(sd_entity->sd, core, s_power, 1); + if (ret < 0 && ret != -ENOIOCTLCMD) + return ret; + + ret = isc_set_default_fmt(isc); + if (ret) { + v4l2_err(&isc->v4l2_dev, "Could not set default format\n"); + return ret; + } + + ret = v4l2_subdev_call(sd_entity->sd, core, s_power, 0); + if (ret < 0 && ret != -ENOIOCTLCMD) + return ret; + + /* Register video device */ + strlcpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name)); + vdev->release = video_device_release_empty; + vdev->fops = &isc_fops; + vdev->ioctl_ops = &isc_ioctl_ops; + vdev->v4l2_dev = &isc->v4l2_dev; + vdev->vfl_dir = VFL_DIR_RX; + vdev->queue = q; + vdev->lock = &isc->lock; + vdev->ctrl_handler = isc->current_subdev->sd->ctrl_handler; + vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE; + video_set_drvdata(vdev, isc); + + ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); + if (ret < 0) { + v4l2_err(&isc->v4l2_dev, + "video_register_device failed: %d\n", ret); + return ret; + } + + return 0; +} + +static void isc_subdev_cleanup(struct isc_device *isc) +{ + struct isc_subdev_entity *subdev_entity; + + list_for_each_entry(subdev_entity, &isc->subdev_entities, list) + v4l2_async_notifier_unregister(&subdev_entity->notifier); + + INIT_LIST_HEAD(&isc->subdev_entities); +} + +static int isc_pipeline_init(struct isc_device *isc) +{ + struct device *dev = isc->dev; + struct regmap *regmap = isc->regmap; + struct regmap_field *regs; + unsigned int i; + + /* WB-->CFA-->CC-->GAM-->CSC-->CBC-->SUB422-->SUB420 */ + const struct reg_field regfields[ISC_PIPE_LINE_NODE_NUM] = { + REG_FIELD(ISC_WB_CTRL, 0, 0), + REG_FIELD(ISC_CFA_CTRL, 0, 0), + REG_FIELD(ISC_CC_CTRL, 0, 0), + REG_FIELD(ISC_GAM_CTRL, 0, 0), + REG_FIELD(ISC_GAM_CTRL, 1, 1), + REG_FIELD(ISC_GAM_CTRL, 2, 2), + REG_FIELD(ISC_GAM_CTRL, 3, 3), + REG_FIELD(ISC_CSC_CTRL, 0, 0), + REG_FIELD(ISC_CBC_CTRL, 0, 0), + REG_FIELD(ISC_SUB422_CTRL, 0, 0), + REG_FIELD(ISC_SUB420_CTRL, 0, 0), + }; + + for (i = 0; i < ISC_PIPE_LINE_NODE_NUM; i++) { + regs = devm_regmap_field_alloc(dev, regmap, regfields[i]); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + isc->pipeline[i] = regs; + } + + return 0; +} + +static int isc_parse_dt(struct device *dev, struct isc_device *isc) +{ + struct device_node *np = dev->of_node; + struct device_node *epn = NULL, *rem; + struct v4l2_of_endpoint v4l2_epn; + struct isc_subdev_entity *subdev_entity; + unsigned int flags; + int ret; + + INIT_LIST_HEAD(&isc->subdev_entities); + + for (; ;) { + epn = of_graph_get_next_endpoint(np, epn); + if (!epn) + break; + + rem = of_graph_get_remote_port_parent(epn); + if (!rem) { + dev_notice(dev, "Remote device at %s not found\n", + of_node_full_name(epn)); + continue; + } + + ret = v4l2_of_parse_endpoint(epn, &v4l2_epn); + if (ret) { + of_node_put(rem); + ret = -EINVAL; + dev_err(dev, "Could not parse the endpoint\n"); + break; + } + + subdev_entity = devm_kzalloc(dev, + sizeof(*subdev_entity), GFP_KERNEL); + if (subdev_entity == NULL) { + of_node_put(rem); + ret = -ENOMEM; + break; + } + + subdev_entity->asd = devm_kzalloc(dev, + sizeof(*subdev_entity->asd), GFP_KERNEL); + if (subdev_entity->asd == NULL) { + of_node_put(rem); + ret = -ENOMEM; + break; + } + + flags = v4l2_epn.bus.parallel.flags; + + if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW) + subdev_entity->pfe_cfg0 = ISC_PFE_CFG0_HPOL_LOW; + + if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW) + subdev_entity->pfe_cfg0 |= ISC_PFE_CFG0_VPOL_LOW; + + if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) + subdev_entity->pfe_cfg0 |= ISC_PFE_CFG0_PPOL_LOW; + + subdev_entity->asd->match_type = V4L2_ASYNC_MATCH_OF; + subdev_entity->asd->match.of.node = rem; + list_add_tail(&subdev_entity->list, &isc->subdev_entities); + } + + of_node_put(epn); + return ret; +} + +/* regmap configuration */ +#define ATMEL_ISC_REG_MAX 0xbfc +static const struct regmap_config isc_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .max_register = ATMEL_ISC_REG_MAX, +}; + +static int atmel_isc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct isc_device *isc; + struct resource *res; + void __iomem *io_base; + struct isc_subdev_entity *subdev_entity; + int irq; + int ret; + + isc = devm_kzalloc(dev, sizeof(*isc), GFP_KERNEL); + if (!isc) + return -ENOMEM; + + platform_set_drvdata(pdev, isc); + isc->dev = dev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + io_base = devm_ioremap_resource(dev, res); + if (IS_ERR(io_base)) + return PTR_ERR(io_base); + + isc->regmap = devm_regmap_init_mmio(dev, io_base, &isc_regmap_config); + if (IS_ERR(isc->regmap)) { + ret = PTR_ERR(isc->regmap); + dev_err(dev, "failed to init register map: %d\n", ret); + return ret; + } + + irq = platform_get_irq(pdev, 0); + if (IS_ERR_VALUE(irq)) { + ret = irq; + dev_err(dev, "failed to get irq: %d\n", ret); + return ret; + } + + ret = devm_request_irq(dev, irq, isc_interrupt, 0, + ATMEL_ISC_NAME, isc); + if (ret < 0) { + dev_err(dev, "can't register ISR for IRQ %u (ret=%i)\n", + irq, ret); + return ret; + } + + ret = isc_pipeline_init(isc); + if (ret) + return ret; + + isc->hclock = devm_clk_get(dev, "hclock"); + if (IS_ERR(isc->hclock)) { + ret = PTR_ERR(isc->hclock); + dev_err(dev, "failed to get hclock: %d\n", ret); + return ret; + } + + ret = isc_clk_init(isc); + if (ret) { + dev_err(dev, "failed to init isc clock: %d\n", ret); + goto clean_isc_clk; + } + + isc->ispck = isc->isc_clks[ISC_ISPCK].clk; + + /* ispck should be greater or equal to hclock */ + ret = clk_set_rate(isc->ispck, clk_get_rate(isc->hclock)); + if (ret) { + dev_err(dev, "failed to set ispck rate: %d\n", ret); + goto clean_isc_clk; + } + + ret = v4l2_device_register(dev, &isc->v4l2_dev); + if (ret) { + dev_err(dev, "unable to register v4l2 device.\n"); + goto clean_isc_clk; + } + + ret = isc_parse_dt(dev, isc); + if (ret) { + dev_err(dev, "fail to parse device tree\n"); + goto unregister_v4l2_device; + } + + if (list_empty(&isc->subdev_entities)) { + dev_err(dev, "no subdev found\n"); + goto unregister_v4l2_device; + } + + list_for_each_entry(subdev_entity, &isc->subdev_entities, list) { + subdev_entity->notifier.subdevs = &subdev_entity->asd; + subdev_entity->notifier.num_subdevs = 1; + subdev_entity->notifier.bound = isc_async_bound; + subdev_entity->notifier.unbind = isc_async_unbind; + subdev_entity->notifier.complete = isc_async_complete; + + ret = v4l2_async_notifier_register(&isc->v4l2_dev, + &subdev_entity->notifier); + if (ret) { + dev_err(dev, "fail to register async notifier\n"); + goto cleanup_subdev; + } + + if (video_is_registered(&isc->video_dev)) + break; + } + + pm_runtime_enable(dev); + + return 0; + +cleanup_subdev: + isc_subdev_cleanup(isc); + +unregister_v4l2_device: + v4l2_device_unregister(&isc->v4l2_dev); + +clean_isc_clk: + isc_clk_cleanup(isc); + + return ret; +} + +static int atmel_isc_remove(struct platform_device *pdev) +{ + struct isc_device *isc = platform_get_drvdata(pdev); + + pm_runtime_disable(&pdev->dev); + + isc_subdev_cleanup(isc); + + v4l2_device_unregister(&isc->v4l2_dev); + + isc_clk_cleanup(isc); + + return 0; +} + +static int isc_runtime_suspend(struct device *dev) +{ + struct isc_device *isc = dev_get_drvdata(dev); + + clk_disable_unprepare(isc->ispck); + clk_disable_unprepare(isc->hclock); + + return 0; +} + +static int isc_runtime_resume(struct device *dev) +{ + struct isc_device *isc = dev_get_drvdata(dev); + int ret; + + ret = clk_prepare_enable(isc->hclock); + if (ret) + return ret; + + return clk_prepare_enable(isc->ispck); +} + +static const struct dev_pm_ops atmel_isc_dev_pm_ops = { + SET_RUNTIME_PM_OPS(isc_runtime_suspend, isc_runtime_resume, NULL) +}; + +static const struct of_device_id atmel_isc_of_match[] = { + { .compatible = "atmel,sama5d2-isc" }, + { } +}; +MODULE_DEVICE_TABLE(of, atmel_isc_of_match); + +static struct platform_driver atmel_isc_driver = { + .probe = atmel_isc_probe, + .remove = atmel_isc_remove, + .driver = { + .name = ATMEL_ISC_NAME, + .pm = &atmel_isc_dev_pm_ops, + .of_match_table = of_match_ptr(atmel_isc_of_match), + }, +}; + +module_platform_driver(atmel_isc_driver); + +MODULE_AUTHOR("Songjun Wu "); +MODULE_DESCRIPTION("The V4L2 driver for Atmel-ISC"); +MODULE_LICENSE("GPL v2"); +MODULE_SUPPORTED_DEVICE("video"); From 3f75dc949b330f9ba73313cf058902bde86fd80d Mon Sep 17 00:00:00 2001 From: Songjun Wu Date: Wed, 17 Aug 2016 03:05:28 -0300 Subject: [PATCH 092/591] [media] atmel-isc: DT binding for Image Sensor Controller driver DT binding documentation for ISC driver. Acked-by: Rob Herring Signed-off-by: Songjun Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../devicetree/bindings/media/atmel-isc.txt | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/atmel-isc.txt diff --git a/Documentation/devicetree/bindings/media/atmel-isc.txt b/Documentation/devicetree/bindings/media/atmel-isc.txt new file mode 100644 index 000000000000..bbe0e87c6188 --- /dev/null +++ b/Documentation/devicetree/bindings/media/atmel-isc.txt @@ -0,0 +1,65 @@ +Atmel Image Sensor Controller (ISC) +---------------------------------------------- + +Required properties for ISC: +- compatible + Must be "atmel,sama5d2-isc". +- reg + Physical base address and length of the registers set for the device. +- interrupts + Should contain IRQ line for the ISC. +- clocks + List of clock specifiers, corresponding to entries in + the clock-names property; + Please refer to clock-bindings.txt. +- clock-names + Required elements: "hclock", "iscck", "gck". +- #clock-cells + Should be 0. +- clock-output-names + Should be "isc-mck". +- pinctrl-names, pinctrl-0 + Please refer to pinctrl-bindings.txt. + +ISC supports a single port node with parallel bus. It should contain one +'port' child node with child 'endpoint' node. Please refer to the bindings +defined in Documentation/devicetree/bindings/media/video-interfaces.txt. + +Example: +isc: isc@f0008000 { + compatible = "atmel,sama5d2-isc"; + reg = <0xf0008000 0x4000>; + interrupts = <46 IRQ_TYPE_LEVEL_HIGH 5>; + clocks = <&isc_clk>, <&iscck>, <&isc_gclk>; + clock-names = "hclock", "iscck", "gck"; + #clock-cells = <0>; + clock-output-names = "isc-mck"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_isc_base &pinctrl_isc_data_8bit &pinctrl_isc_data_9_10 &pinctrl_isc_data_11_12>; + + port { + isc_0: endpoint { + remote-endpoint = <&ov7740_0>; + hsync-active = <1>; + vsync-active = <0>; + pclk-sample = <1>; + }; + }; +}; + +i2c1: i2c@fc028000 { + ov7740: camera@21 { + compatible = "ovti,ov7740"; + reg = <0x21>; + clocks = <&isc>; + clock-names = "xvclk"; + assigned-clocks = <&isc>; + assigned-clock-rates = <24000000>; + + port { + ov7740_0: endpoint { + remote-endpoint = <&isc_0>; + }; + }; + }; +}; From 71fb2c74287d186938cde830ad8980f57a38b597 Mon Sep 17 00:00:00 2001 From: Songjun Wu Date: Wed, 17 Aug 2016 03:05:29 -0300 Subject: [PATCH 093/591] [media] MAINTAINERS: atmel-isc: add entry for Atmel ISC Add the MAINTAINERS' entry for Microchip / Atmel Image Sensor Controller. Signed-off-by: Songjun Wu Acked-by: Nicolas Ferre Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 20bb1d00098c..21a6f6f4c2d6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7733,6 +7733,14 @@ T: git git://git.monstr.eu/linux-2.6-microblaze.git S: Supported F: arch/microblaze/ +MICROCHIP / ATMEL ISC DRIVER +M: Songjun Wu +L: linux-media@vger.kernel.org +S: Supported +F: drivers/media/platform/atmel/atmel-isc.c +F: drivers/media/platform/atmel/atmel-isc-regs.h +F: devicetree/bindings/media/atmel-isc.txt + MICROSOFT SURFACE PRO 3 BUTTON DRIVER M: Chen Yu L: platform-driver-x86@vger.kernel.org From 47cb398dd75a9faa89d0617b55d4cf537935b731 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 20 Aug 2016 13:02:50 -0600 Subject: [PATCH 094/591] Docs: sphinxify device-drivers.tmpl Perform a basic sphinx conversion of the device-drivers docbook and move it to its own directory. Signed-off-by: Jonathan Corbet --- Documentation/DocBook/Makefile | 2 +- Documentation/DocBook/device-drivers.tmpl | 521 ----------------- Documentation/driver-api/drivers.rst | 654 ++++++++++++++++++++++ Documentation/index.rst | 1 + 4 files changed, 656 insertions(+), 522 deletions(-) delete mode 100644 Documentation/DocBook/device-drivers.tmpl create mode 100644 Documentation/driver-api/drivers.rst diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index a91c96522379..5fbfb7273f38 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -6,7 +6,7 @@ # To add a new book the only step required is to add the book to the # list of DOCBOOKS. -DOCBOOKS := z8530book.xml device-drivers.xml \ +DOCBOOKS := z8530book.xml \ kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ writing_usb_driver.xml networking.xml \ kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl deleted file mode 100644 index 9c10030eb2be..000000000000 --- a/Documentation/DocBook/device-drivers.tmpl +++ /dev/null @@ -1,521 +0,0 @@ - - - - - - Linux Device Drivers - - - - 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. - - - - This program is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, - MA 02111-1307 USA - - - - For more details see the file COPYING in the source - distribution of Linux. - - - - - - - - Driver Basics - Driver Entry and Exit points -!Iinclude/linux/init.h - - - Atomic and pointer manipulation -!Iarch/x86/include/asm/atomic.h - - - Delaying, scheduling, and timer routines -!Iinclude/linux/sched.h -!Ekernel/sched/core.c -!Ikernel/sched/cpupri.c -!Ikernel/sched/fair.c -!Iinclude/linux/completion.h -!Ekernel/time/timer.c - - Wait queues and Wake events -!Iinclude/linux/wait.h -!Ekernel/sched/wait.c - - High-resolution timers -!Iinclude/linux/ktime.h -!Iinclude/linux/hrtimer.h -!Ekernel/time/hrtimer.c - - Workqueues and Kevents -!Iinclude/linux/workqueue.h -!Ekernel/workqueue.c - - Internal Functions -!Ikernel/exit.c -!Ikernel/signal.c -!Iinclude/linux/kthread.h -!Ekernel/kthread.c - - - Kernel objects manipulation - -!Elib/kobject.c - - - Kernel utility functions -!Iinclude/linux/kernel.h -!Ekernel/printk/printk.c -!Ekernel/panic.c -!Ekernel/sys.c -!Ekernel/rcu/srcu.c -!Ekernel/rcu/tree.c -!Ekernel/rcu/tree_plugin.h -!Ekernel/rcu/update.c - - - Device Resource Management -!Edrivers/base/devres.c - - - - - - Device drivers infrastructure - The Basic Device Driver-Model Structures -!Iinclude/linux/device.h - - Device Drivers Base -!Idrivers/base/init.c -!Edrivers/base/driver.c -!Edrivers/base/core.c -!Edrivers/base/syscore.c -!Edrivers/base/class.c -!Idrivers/base/node.c -!Edrivers/base/firmware_class.c -!Edrivers/base/transport_class.c - -!Edrivers/base/dd.c - -!Iinclude/linux/platform_device.h -!Edrivers/base/platform.c -!Edrivers/base/bus.c - - - Buffer Sharing and Synchronization - - The dma-buf subsystem provides the framework for sharing buffers - for hardware (DMA) access across multiple device drivers and - subsystems, and for synchronizing asynchronous hardware access. - - - This is used, for example, by drm "prime" multi-GPU support, but - is of course not limited to GPU use cases. - - - The three main components of this are: (1) dma-buf, representing - a sg_table and exposed to userspace as a file descriptor to allow - passing between devices, (2) fence, which provides a mechanism - to signal when one device as finished access, and (3) reservation, - which manages the shared or exclusive fence(s) associated with - the buffer. - - dma-buf -!Edrivers/dma-buf/dma-buf.c -!Iinclude/linux/dma-buf.h - - reservation -!Pdrivers/dma-buf/reservation.c Reservation Object Overview -!Edrivers/dma-buf/reservation.c -!Iinclude/linux/reservation.h - - fence -!Edrivers/dma-buf/fence.c -!Iinclude/linux/fence.h -!Edrivers/dma-buf/seqno-fence.c -!Iinclude/linux/seqno-fence.h -!Edrivers/dma-buf/fence-array.c -!Iinclude/linux/fence-array.h -!Edrivers/dma-buf/reservation.c -!Iinclude/linux/reservation.h -!Edrivers/dma-buf/sync_file.c -!Iinclude/linux/sync_file.h - - - Device Drivers DMA Management -!Edrivers/base/dma-coherent.c -!Edrivers/base/dma-mapping.c - - Device Drivers Power Management -!Edrivers/base/power/main.c - - Device Drivers ACPI Support - -!Edrivers/acpi/scan.c -!Idrivers/acpi/scan.c - - - Device drivers PnP support -!Idrivers/pnp/core.c - -!Edrivers/pnp/card.c -!Idrivers/pnp/driver.c -!Edrivers/pnp/manager.c -!Edrivers/pnp/support.c - - Userspace IO devices -!Edrivers/uio/uio.c -!Iinclude/linux/uio_driver.h - - - - - Parallel Port Devices -!Iinclude/linux/parport.h -!Edrivers/parport/ieee1284.c -!Edrivers/parport/share.c -!Idrivers/parport/daisy.c - - - - Message-based devices - Fusion message devices -!Edrivers/message/fusion/mptbase.c -!Idrivers/message/fusion/mptbase.c -!Edrivers/message/fusion/mptscsih.c -!Idrivers/message/fusion/mptscsih.c -!Idrivers/message/fusion/mptctl.c -!Idrivers/message/fusion/mptspi.c -!Idrivers/message/fusion/mptfc.c -!Idrivers/message/fusion/mptlan.c - - - - - Sound Devices -!Iinclude/sound/core.h -!Esound/sound_core.c -!Iinclude/sound/pcm.h -!Esound/core/pcm.c -!Esound/core/device.c -!Esound/core/info.c -!Esound/core/rawmidi.c -!Esound/core/sound.c -!Esound/core/memory.c -!Esound/core/pcm_memory.c -!Esound/core/init.c -!Esound/core/isadma.c -!Esound/core/control.c -!Esound/core/pcm_lib.c -!Esound/core/hwdep.c -!Esound/core/pcm_native.c -!Esound/core/memalloc.c - - - - - - 16x50 UART Driver -!Edrivers/tty/serial/serial_core.c -!Edrivers/tty/serial/8250/8250_core.c - - - - Frame Buffer Library - - - The frame buffer drivers depend heavily on four data structures. - These structures are declared in include/linux/fb.h. They are - fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. - The last three can be made available to and from userland. - - - - fb_info defines the current state of a particular video card. - Inside fb_info, there exists a fb_ops structure which is a - collection of needed functions to make fbdev and fbcon work. - fb_info is only visible to the kernel. - - - - fb_var_screeninfo is used to describe the features of a video card - that are user defined. With fb_var_screeninfo, things such as - depth and the resolution may be defined. - - - - The next structure is fb_fix_screeninfo. This defines the - properties of a card that are created when a mode is set and can't - be changed otherwise. A good example of this is the start of the - frame buffer memory. This "locks" the address of the frame buffer - memory, so that it cannot be changed or moved. - - - - The last structure is fb_monospecs. In the old API, there was - little importance for fb_monospecs. This allowed for forbidden things - such as setting a mode of 800x600 on a fix frequency monitor. With - the new API, fb_monospecs prevents such things, and if used - correctly, can prevent a monitor from being cooked. fb_monospecs - will not be useful until kernels 2.5.x. - - - Frame Buffer Memory -!Edrivers/video/fbdev/core/fbmem.c - - - Frame Buffer Colormap -!Edrivers/video/fbdev/core/fbcmap.c - - - Frame Buffer Video Mode Database -!Idrivers/video/fbdev/core/modedb.c -!Edrivers/video/fbdev/core/modedb.c - - Frame Buffer Macintosh Video Mode Database -!Edrivers/video/fbdev/macmodes.c - - Frame Buffer Fonts - - Refer to the file lib/fonts/fonts.c for more information. - - - - - - - Input Subsystem - Input core -!Iinclude/linux/input.h -!Edrivers/input/input.c -!Edrivers/input/ff-core.c -!Edrivers/input/ff-memless.c - - Multitouch Library -!Iinclude/linux/input/mt.h -!Edrivers/input/input-mt.c - - Polled input devices -!Iinclude/linux/input-polldev.h -!Edrivers/input/input-polldev.c - - Matrix keyboards/keypads -!Iinclude/linux/input/matrix_keypad.h - - Sparse keymap support -!Iinclude/linux/input/sparse-keymap.h -!Edrivers/input/sparse-keymap.c - - - - - Serial Peripheral Interface (SPI) - - SPI is the "Serial Peripheral Interface", widely used with - embedded systems because it is a simple and efficient - interface: basically a multiplexed shift register. - Its three signal wires hold a clock (SCK, often in the range - of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and - a "Master In, Slave Out" (MISO) data line. - SPI is a full duplex protocol; for each bit shifted out the - MOSI line (one per clock) another is shifted in on the MISO line. - Those bits are assembled into words of various sizes on the - way to and from system memory. - An additional chipselect line is usually active-low (nCS); - four signals are normally used for each peripheral, plus - sometimes an interrupt. - - - The SPI bus facilities listed here provide a generalized - interface to declare SPI busses and devices, manage them - according to the standard Linux driver model, and perform - input/output operations. - At this time, only "master" side interfaces are supported, - where Linux talks to SPI peripherals and does not implement - such a peripheral itself. - (Interfaces to support implementing SPI slaves would - necessarily look different.) - - - The programming interface is structured around two kinds of driver, - and two kinds of device. - A "Controller Driver" abstracts the controller hardware, which may - be as simple as a set of GPIO pins or as complex as a pair of FIFOs - connected to dual DMA engines on the other side of the SPI shift - register (maximizing throughput). Such drivers bridge between - whatever bus they sit on (often the platform bus) and SPI, and - expose the SPI side of their device as a - struct spi_master. - SPI devices are children of that master, represented as a - struct spi_device and manufactured from - struct spi_board_info descriptors which - are usually provided by board-specific initialization code. - A struct spi_driver is called a - "Protocol Driver", and is bound to a spi_device using normal - driver model calls. - - - The I/O model is a set of queued messages. Protocol drivers - submit one or more struct spi_message - objects, which are processed and completed asynchronously. - (There are synchronous wrappers, however.) Messages are - built from one or more struct spi_transfer - objects, each of which wraps a full duplex SPI transfer. - A variety of protocol tweaking options are needed, because - different chips adopt very different policies for how they - use the bits transferred with SPI. - -!Iinclude/linux/spi/spi.h -!Fdrivers/spi/spi.c spi_register_board_info -!Edrivers/spi/spi.c - - - - I<superscript>2</superscript>C and SMBus Subsystem - - - I2C (or without fancy typography, "I2C") - is an acronym for the "Inter-IC" bus, a simple bus protocol which is - widely used where low data rate communications suffice. - Since it's also a licensed trademark, some vendors use another - name (such as "Two-Wire Interface", TWI) for the same bus. - I2C only needs two signals (SCL for clock, SDA for data), conserving - board real estate and minimizing signal quality issues. - Most I2C devices use seven bit addresses, and bus speeds of up - to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet - found wide use. - I2C is a multi-master bus; open drain signaling is used to - arbitrate between masters, as well as to handshake and to - synchronize clocks from slower clients. - - - - The Linux I2C programming interfaces support only the master - side of bus interactions, not the slave side. - The programming interface is structured around two kinds of driver, - and two kinds of device. - An I2C "Adapter Driver" abstracts the controller hardware; it binds - to a physical device (perhaps a PCI device or platform_device) and - exposes a struct i2c_adapter representing - each I2C bus segment it manages. - On each I2C bus segment will be I2C devices represented by a - struct i2c_client. Those devices will - be bound to a struct i2c_driver, - which should follow the standard Linux driver model. - (At this writing, a legacy model is more widely used.) - There are functions to perform various I2C protocol operations; at - this writing all such functions are usable only from task context. - - - - The System Management Bus (SMBus) is a sibling protocol. Most SMBus - systems are also I2C conformant. The electrical constraints are - tighter for SMBus, and it standardizes particular protocol messages - and idioms. Controllers that support I2C can also support most - SMBus operations, but SMBus controllers don't support all the protocol - options that an I2C controller will. - There are functions to perform various SMBus protocol operations, - either using I2C primitives or by issuing SMBus commands to - i2c_adapter devices which don't support those I2C operations. - - -!Iinclude/linux/i2c.h -!Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info -!Edrivers/i2c/i2c-core.c - - - - High Speed Synchronous Serial Interface (HSI) - - - High Speed Synchronous Serial Interface (HSI) is a - serial interface mainly used for connecting application - engines (APE) with cellular modem engines (CMT) in cellular - handsets. - - HSI provides multiplexing for up to 16 logical channels, - low-latency and full duplex communication. - - -!Iinclude/linux/hsi/hsi.h -!Edrivers/hsi/hsi_core.c - - - - Pulse-Width Modulation (PWM) - - Pulse-width modulation is a modulation technique primarily used to - control power supplied to electrical devices. - - - The PWM framework provides an abstraction for providers and consumers - of PWM signals. A controller that provides one or more PWM signals is - registered as struct pwm_chip. Providers are - expected to embed this structure in a driver-specific structure. This - structure contains fields that describe a particular chip. - - - A chip exposes one or more PWM signal sources, each of which exposed - as a struct pwm_device. Operations can be - performed on PWM devices to control the period, duty cycle, polarity - and active state of the signal. - - - Note that PWM devices are exclusive resources: they can always only be - used by one consumer at a time. - -!Iinclude/linux/pwm.h -!Edrivers/pwm/core.c - - - diff --git a/Documentation/driver-api/drivers.rst b/Documentation/driver-api/drivers.rst new file mode 100644 index 000000000000..17f99d441b52 --- /dev/null +++ b/Documentation/driver-api/drivers.rst @@ -0,0 +1,654 @@ +==================== +Linux Device Drivers +==================== + +Driver Basics +============= + +Driver Entry and Exit points +---------------------------- + +.. kernel-doc:: include/linux/init.h + :internal: + +Atomic and pointer manipulation +------------------------------- + +.. kernel-doc:: arch/x86/include/asm/atomic.h + :internal: + +Delaying, scheduling, and timer routines +---------------------------------------- + +.. kernel-doc:: include/linux/sched.h + :internal: + +.. kernel-doc:: kernel/sched/core.c + :export: + +.. kernel-doc:: kernel/sched/cpupri.c + :internal: + +.. kernel-doc:: kernel/sched/fair.c + :internal: + +.. kernel-doc:: include/linux/completion.h + :internal: + +.. kernel-doc:: kernel/time/timer.c + :export: + +Wait queues and Wake events +--------------------------- + +.. kernel-doc:: include/linux/wait.h + :internal: + +.. kernel-doc:: kernel/sched/wait.c + :export: + +High-resolution timers +---------------------- + +.. kernel-doc:: include/linux/ktime.h + :internal: + +.. kernel-doc:: include/linux/hrtimer.h + :internal: + +.. kernel-doc:: kernel/time/hrtimer.c + :export: + +Workqueues and Kevents +---------------------- + +.. kernel-doc:: include/linux/workqueue.h + :internal: + +.. kernel-doc:: kernel/workqueue.c + :export: + +Internal Functions +------------------ + +.. kernel-doc:: kernel/exit.c + :internal: + +.. kernel-doc:: kernel/signal.c + :internal: + +.. kernel-doc:: include/linux/kthread.h + :internal: + +.. kernel-doc:: kernel/kthread.c + :export: + +Kernel objects manipulation +--------------------------- + +.. kernel-doc:: lib/kobject.c + :export: + +Kernel utility functions +------------------------ + +.. kernel-doc:: include/linux/kernel.h + :internal: + +.. kernel-doc:: kernel/printk/printk.c + :export: + +.. kernel-doc:: kernel/panic.c + :export: + +.. kernel-doc:: kernel/sys.c + :export: + +.. kernel-doc:: kernel/rcu/srcu.c + :export: + +.. kernel-doc:: kernel/rcu/tree.c + :export: + +.. kernel-doc:: kernel/rcu/tree_plugin.h + :export: + +.. kernel-doc:: kernel/rcu/update.c + :export: + +Device Resource Management +-------------------------- + +.. kernel-doc:: drivers/base/devres.c + :export: + +Device drivers infrastructure +============================= + +The Basic Device Driver-Model Structures +---------------------------------------- + +.. kernel-doc:: include/linux/device.h + :internal: + +Device Drivers Base +------------------- + +.. kernel-doc:: drivers/base/init.c + :internal: + +.. kernel-doc:: drivers/base/driver.c + :export: + +.. kernel-doc:: drivers/base/core.c + :export: + +.. kernel-doc:: drivers/base/syscore.c + :export: + +.. kernel-doc:: drivers/base/class.c + :export: + +.. kernel-doc:: drivers/base/node.c + :internal: + +.. kernel-doc:: drivers/base/firmware_class.c + :export: + +.. kernel-doc:: drivers/base/transport_class.c + :export: + +.. kernel-doc:: drivers/base/dd.c + :export: + +.. kernel-doc:: include/linux/platform_device.h + :internal: + +.. kernel-doc:: drivers/base/platform.c + :export: + +.. kernel-doc:: drivers/base/bus.c + :export: + +Buffer Sharing and Synchronization +---------------------------------- + +The dma-buf subsystem provides the framework for sharing buffers for +hardware (DMA) access across multiple device drivers and subsystems, and +for synchronizing asynchronous hardware access. + +This is used, for example, by drm "prime" multi-GPU support, but is of +course not limited to GPU use cases. + +The three main components of this are: (1) dma-buf, representing a +sg_table and exposed to userspace as a file descriptor to allow passing +between devices, (2) fence, which provides a mechanism to signal when +one device as finished access, and (3) reservation, which manages the +shared or exclusive fence(s) associated with the buffer. + +dma-buf +~~~~~~~ + +.. kernel-doc:: drivers/dma-buf/dma-buf.c + :export: + +.. kernel-doc:: include/linux/dma-buf.h + :internal: + +reservation +~~~~~~~~~~~ + +.. kernel-doc:: drivers/dma-buf/reservation.c + :doc: Reservation Object Overview + +.. kernel-doc:: drivers/dma-buf/reservation.c + :export: + +.. kernel-doc:: include/linux/reservation.h + :internal: + +fence +~~~~~ + +.. kernel-doc:: drivers/dma-buf/fence.c + :export: + +.. kernel-doc:: include/linux/fence.h + :internal: + +.. kernel-doc:: drivers/dma-buf/seqno-fence.c + :export: + +.. kernel-doc:: include/linux/seqno-fence.h + :internal: + +.. kernel-doc:: drivers/dma-buf/fence-array.c + :export: + +.. kernel-doc:: include/linux/fence-array.h + :internal: + +.. kernel-doc:: drivers/dma-buf/reservation.c + :export: + +.. kernel-doc:: include/linux/reservation.h + :internal: + +.. kernel-doc:: drivers/dma-buf/sync_file.c + :export: + +.. kernel-doc:: include/linux/sync_file.h + :internal: + +Device Drivers DMA Management +----------------------------- + +.. kernel-doc:: drivers/base/dma-coherent.c + :export: + +.. kernel-doc:: drivers/base/dma-mapping.c + :export: + +Device Drivers Power Management +------------------------------- + +.. kernel-doc:: drivers/base/power/main.c + :export: + +Device Drivers ACPI Support +--------------------------- + +.. kernel-doc:: drivers/acpi/scan.c + :export: + +.. kernel-doc:: drivers/acpi/scan.c + :internal: + +Device drivers PnP support +-------------------------- + +.. kernel-doc:: drivers/pnp/core.c + :internal: + +.. kernel-doc:: drivers/pnp/card.c + :export: + +.. kernel-doc:: drivers/pnp/driver.c + :internal: + +.. kernel-doc:: drivers/pnp/manager.c + :export: + +.. kernel-doc:: drivers/pnp/support.c + :export: + +Userspace IO devices +-------------------- + +.. kernel-doc:: drivers/uio/uio.c + :export: + +.. kernel-doc:: include/linux/uio_driver.h + :internal: + +Parallel Port Devices +===================== + +.. kernel-doc:: include/linux/parport.h + :internal: + +.. kernel-doc:: drivers/parport/ieee1284.c + :export: + +.. kernel-doc:: drivers/parport/share.c + :export: + +.. kernel-doc:: drivers/parport/daisy.c + :internal: + +Message-based devices +===================== + +Fusion message devices +---------------------- + +.. kernel-doc:: drivers/message/fusion/mptbase.c + :export: + +.. kernel-doc:: drivers/message/fusion/mptbase.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptscsih.c + :export: + +.. kernel-doc:: drivers/message/fusion/mptscsih.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptctl.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptspi.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptfc.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptlan.c + :internal: + +Sound Devices +============= + +.. kernel-doc:: include/sound/core.h + :internal: + +.. kernel-doc:: sound/sound_core.c + :export: + +.. kernel-doc:: include/sound/pcm.h + :internal: + +.. kernel-doc:: sound/core/pcm.c + :export: + +.. kernel-doc:: sound/core/device.c + :export: + +.. kernel-doc:: sound/core/info.c + :export: + +.. kernel-doc:: sound/core/rawmidi.c + :export: + +.. kernel-doc:: sound/core/sound.c + :export: + +.. kernel-doc:: sound/core/memory.c + :export: + +.. kernel-doc:: sound/core/pcm_memory.c + :export: + +.. kernel-doc:: sound/core/init.c + :export: + +.. kernel-doc:: sound/core/isadma.c + :export: + +.. kernel-doc:: sound/core/control.c + :export: + +.. kernel-doc:: sound/core/pcm_lib.c + :export: + +.. kernel-doc:: sound/core/hwdep.c + :export: + +.. kernel-doc:: sound/core/pcm_native.c + :export: + +.. kernel-doc:: sound/core/memalloc.c + :export: + +16x50 UART Driver +================= + +.. kernel-doc:: drivers/tty/serial/serial_core.c + :export: + +.. kernel-doc:: drivers/tty/serial/8250/8250_core.c + :export: + +Frame Buffer Library +==================== + +The frame buffer drivers depend heavily on four data structures. These +structures are declared in include/linux/fb.h. They are fb_info, +fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last +three can be made available to and from userland. + +fb_info defines the current state of a particular video card. Inside +fb_info, there exists a fb_ops structure which is a collection of +needed functions to make fbdev and fbcon work. fb_info is only visible +to the kernel. + +fb_var_screeninfo is used to describe the features of a video card +that are user defined. With fb_var_screeninfo, things such as depth +and the resolution may be defined. + +The next structure is fb_fix_screeninfo. This defines the properties +of a card that are created when a mode is set and can't be changed +otherwise. A good example of this is the start of the frame buffer +memory. This "locks" the address of the frame buffer memory, so that it +cannot be changed or moved. + +The last structure is fb_monospecs. In the old API, there was little +importance for fb_monospecs. This allowed for forbidden things such as +setting a mode of 800x600 on a fix frequency monitor. With the new API, +fb_monospecs prevents such things, and if used correctly, can prevent a +monitor from being cooked. fb_monospecs will not be useful until +kernels 2.5.x. + +Frame Buffer Memory +------------------- + +.. kernel-doc:: drivers/video/fbdev/core/fbmem.c + :export: + +Frame Buffer Colormap +--------------------- + +.. kernel-doc:: drivers/video/fbdev/core/fbcmap.c + :export: + +Frame Buffer Video Mode Database +-------------------------------- + +.. kernel-doc:: drivers/video/fbdev/core/modedb.c + :internal: + +.. kernel-doc:: drivers/video/fbdev/core/modedb.c + :export: + +Frame Buffer Macintosh Video Mode Database +------------------------------------------ + +.. kernel-doc:: drivers/video/fbdev/macmodes.c + :export: + +Frame Buffer Fonts +------------------ + +Refer to the file lib/fonts/fonts.c for more information. + +Input Subsystem +=============== + +Input core +---------- + +.. kernel-doc:: include/linux/input.h + :internal: + +.. kernel-doc:: drivers/input/input.c + :export: + +.. kernel-doc:: drivers/input/ff-core.c + :export: + +.. kernel-doc:: drivers/input/ff-memless.c + :export: + +Multitouch Library +------------------ + +.. kernel-doc:: include/linux/input/mt.h + :internal: + +.. kernel-doc:: drivers/input/input-mt.c + :export: + +Polled input devices +-------------------- + +.. kernel-doc:: include/linux/input-polldev.h + :internal: + +.. kernel-doc:: drivers/input/input-polldev.c + :export: + +Matrix keyboards/keypads +------------------------ + +.. kernel-doc:: include/linux/input/matrix_keypad.h + :internal: + +Sparse keymap support +--------------------- + +.. kernel-doc:: include/linux/input/sparse-keymap.h + :internal: + +.. kernel-doc:: drivers/input/sparse-keymap.c + :export: + +Serial Peripheral Interface (SPI) +================================= + +SPI is the "Serial Peripheral Interface", widely used with embedded +systems because it is a simple and efficient interface: basically a +multiplexed shift register. Its three signal wires hold a clock (SCK, +often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data +line, and a "Master In, Slave Out" (MISO) data line. SPI is a full +duplex protocol; for each bit shifted out the MOSI line (one per clock) +another is shifted in on the MISO line. Those bits are assembled into +words of various sizes on the way to and from system memory. An +additional chipselect line is usually active-low (nCS); four signals are +normally used for each peripheral, plus sometimes an interrupt. + +The SPI bus facilities listed here provide a generalized interface to +declare SPI busses and devices, manage them according to the standard +Linux driver model, and perform input/output operations. At this time, +only "master" side interfaces are supported, where Linux talks to SPI +peripherals and does not implement such a peripheral itself. (Interfaces +to support implementing SPI slaves would necessarily look different.) + +The programming interface is structured around two kinds of driver, and +two kinds of device. A "Controller Driver" abstracts the controller +hardware, which may be as simple as a set of GPIO pins or as complex as +a pair of FIFOs connected to dual DMA engines on the other side of the +SPI shift register (maximizing throughput). Such drivers bridge between +whatever bus they sit on (often the platform bus) and SPI, and expose +the SPI side of their device as a :c:type:`struct spi_master +`. SPI devices are children of that master, +represented as a :c:type:`struct spi_device ` and +manufactured from :c:type:`struct spi_board_info +` descriptors which are usually provided by +board-specific initialization code. A :c:type:`struct spi_driver +` is called a "Protocol Driver", and is bound to a +spi_device using normal driver model calls. + +The I/O model is a set of queued messages. Protocol drivers submit one +or more :c:type:`struct spi_message ` objects, +which are processed and completed asynchronously. (There are synchronous +wrappers, however.) Messages are built from one or more +:c:type:`struct spi_transfer ` objects, each of +which wraps a full duplex SPI transfer. A variety of protocol tweaking +options are needed, because different chips adopt very different +policies for how they use the bits transferred with SPI. + +.. kernel-doc:: include/linux/spi/spi.h + :internal: + +.. kernel-doc:: drivers/spi/spi.c + :functions: spi_register_board_info + +.. kernel-doc:: drivers/spi/spi.c + :export: + +I\ :sup:`2`\ C and SMBus Subsystem +================================== + +I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for +the "Inter-IC" bus, a simple bus protocol which is widely used where low +data rate communications suffice. Since it's also a licensed trademark, +some vendors use another name (such as "Two-Wire Interface", TWI) for +the same bus. I2C only needs two signals (SCL for clock, SDA for data), +conserving board real estate and minimizing signal quality issues. Most +I2C devices use seven bit addresses, and bus speeds of up to 400 kHz; +there's a high speed extension (3.4 MHz) that's not yet found wide use. +I2C is a multi-master bus; open drain signaling is used to arbitrate +between masters, as well as to handshake and to synchronize clocks from +slower clients. + +The Linux I2C programming interfaces support only the master side of bus +interactions, not the slave side. The programming interface is +structured around two kinds of driver, and two kinds of device. An I2C +"Adapter Driver" abstracts the controller hardware; it binds to a +physical device (perhaps a PCI device or platform_device) and exposes a +:c:type:`struct i2c_adapter ` representing each +I2C bus segment it manages. On each I2C bus segment will be I2C devices +represented by a :c:type:`struct i2c_client `. +Those devices will be bound to a :c:type:`struct i2c_driver +`, which should follow the standard Linux driver +model. (At this writing, a legacy model is more widely used.) There are +functions to perform various I2C protocol operations; at this writing +all such functions are usable only from task context. + +The System Management Bus (SMBus) is a sibling protocol. Most SMBus +systems are also I2C conformant. The electrical constraints are tighter +for SMBus, and it standardizes particular protocol messages and idioms. +Controllers that support I2C can also support most SMBus operations, but +SMBus controllers don't support all the protocol options that an I2C +controller will. There are functions to perform various SMBus protocol +operations, either using I2C primitives or by issuing SMBus commands to +i2c_adapter devices which don't support those I2C operations. + +.. kernel-doc:: include/linux/i2c.h + :internal: + +.. kernel-doc:: drivers/i2c/i2c-boardinfo.c + :functions: i2c_register_board_info + +.. kernel-doc:: drivers/i2c/i2c-core.c + :export: + +High Speed Synchronous Serial Interface (HSI) +============================================= + +High Speed Synchronous Serial Interface (HSI) is a serial interface +mainly used for connecting application engines (APE) with cellular modem +engines (CMT) in cellular handsets. HSI provides multiplexing for up to +16 logical channels, low-latency and full duplex communication. + +.. kernel-doc:: include/linux/hsi/hsi.h + :internal: + +.. kernel-doc:: drivers/hsi/hsi_core.c + :export: + +Pulse-Width Modulation (PWM) +============================ + +Pulse-width modulation is a modulation technique primarily used to +control power supplied to electrical devices. + +The PWM framework provides an abstraction for providers and consumers of +PWM signals. A controller that provides one or more PWM signals is +registered as :c:type:`struct pwm_chip `. Providers +are expected to embed this structure in a driver-specific structure. +This structure contains fields that describe a particular chip. + +A chip exposes one or more PWM signal sources, each of which exposed as +a :c:type:`struct pwm_device `. Operations can be +performed on PWM devices to control the period, duty cycle, polarity and +active state of the signal. + +Note that PWM devices are exclusive resources: they can always only be +used by one consumer at a time. + +.. kernel-doc:: include/linux/pwm.h + :internal: + +.. kernel-doc:: drivers/pwm/core.c + :export: diff --git a/Documentation/index.rst b/Documentation/index.rst index 05eded59820e..0d6992b897c8 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -13,6 +13,7 @@ Contents: kernel-documentation dev-tools/tools + driver-api/drivers media/index gpu/index From dcec3c8c9aea9e779c59f420465381c0f3322913 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 20 Aug 2016 13:17:32 -0600 Subject: [PATCH 095/591] docs: split up the driver book We don't need to keep it as a single large file anymore; split it up so that it is easier to manage and the individual sections can be read directly as plain files. Signed-off-by: Jonathan Corbet --- Documentation/driver-api/basics.rst | 120 ++++ Documentation/driver-api/drivers.rst | 654 ------------------ Documentation/driver-api/frame-buffer.rst | 62 ++ Documentation/driver-api/index.rst | 24 + Documentation/driver-api/infrastructure.rst | 169 +++++ Documentation/driver-api/input.rst | 51 ++ Documentation/driver-api/message-based.rst | 30 + Documentation/driver-api/miscellaneous.rst | 50 ++ .../driver-api/serial-interfaces.rst | 115 +++ Documentation/driver-api/sound.rst | 54 ++ Documentation/index.rst | 2 +- 11 files changed, 676 insertions(+), 655 deletions(-) create mode 100644 Documentation/driver-api/basics.rst delete mode 100644 Documentation/driver-api/drivers.rst create mode 100644 Documentation/driver-api/frame-buffer.rst create mode 100644 Documentation/driver-api/index.rst create mode 100644 Documentation/driver-api/infrastructure.rst create mode 100644 Documentation/driver-api/input.rst create mode 100644 Documentation/driver-api/message-based.rst create mode 100644 Documentation/driver-api/miscellaneous.rst create mode 100644 Documentation/driver-api/serial-interfaces.rst create mode 100644 Documentation/driver-api/sound.rst diff --git a/Documentation/driver-api/basics.rst b/Documentation/driver-api/basics.rst new file mode 100644 index 000000000000..935b9b8d456c --- /dev/null +++ b/Documentation/driver-api/basics.rst @@ -0,0 +1,120 @@ +Driver Basics +============= + +Driver Entry and Exit points +---------------------------- + +.. kernel-doc:: include/linux/init.h + :internal: + +Atomic and pointer manipulation +------------------------------- + +.. kernel-doc:: arch/x86/include/asm/atomic.h + :internal: + +Delaying, scheduling, and timer routines +---------------------------------------- + +.. kernel-doc:: include/linux/sched.h + :internal: + +.. kernel-doc:: kernel/sched/core.c + :export: + +.. kernel-doc:: kernel/sched/cpupri.c + :internal: + +.. kernel-doc:: kernel/sched/fair.c + :internal: + +.. kernel-doc:: include/linux/completion.h + :internal: + +.. kernel-doc:: kernel/time/timer.c + :export: + +Wait queues and Wake events +--------------------------- + +.. kernel-doc:: include/linux/wait.h + :internal: + +.. kernel-doc:: kernel/sched/wait.c + :export: + +High-resolution timers +---------------------- + +.. kernel-doc:: include/linux/ktime.h + :internal: + +.. kernel-doc:: include/linux/hrtimer.h + :internal: + +.. kernel-doc:: kernel/time/hrtimer.c + :export: + +Workqueues and Kevents +---------------------- + +.. kernel-doc:: include/linux/workqueue.h + :internal: + +.. kernel-doc:: kernel/workqueue.c + :export: + +Internal Functions +------------------ + +.. kernel-doc:: kernel/exit.c + :internal: + +.. kernel-doc:: kernel/signal.c + :internal: + +.. kernel-doc:: include/linux/kthread.h + :internal: + +.. kernel-doc:: kernel/kthread.c + :export: + +Kernel objects manipulation +--------------------------- + +.. kernel-doc:: lib/kobject.c + :export: + +Kernel utility functions +------------------------ + +.. kernel-doc:: include/linux/kernel.h + :internal: + +.. kernel-doc:: kernel/printk/printk.c + :export: + +.. kernel-doc:: kernel/panic.c + :export: + +.. kernel-doc:: kernel/sys.c + :export: + +.. kernel-doc:: kernel/rcu/srcu.c + :export: + +.. kernel-doc:: kernel/rcu/tree.c + :export: + +.. kernel-doc:: kernel/rcu/tree_plugin.h + :export: + +.. kernel-doc:: kernel/rcu/update.c + :export: + +Device Resource Management +-------------------------- + +.. kernel-doc:: drivers/base/devres.c + :export: + diff --git a/Documentation/driver-api/drivers.rst b/Documentation/driver-api/drivers.rst deleted file mode 100644 index 17f99d441b52..000000000000 --- a/Documentation/driver-api/drivers.rst +++ /dev/null @@ -1,654 +0,0 @@ -==================== -Linux Device Drivers -==================== - -Driver Basics -============= - -Driver Entry and Exit points ----------------------------- - -.. kernel-doc:: include/linux/init.h - :internal: - -Atomic and pointer manipulation -------------------------------- - -.. kernel-doc:: arch/x86/include/asm/atomic.h - :internal: - -Delaying, scheduling, and timer routines ----------------------------------------- - -.. kernel-doc:: include/linux/sched.h - :internal: - -.. kernel-doc:: kernel/sched/core.c - :export: - -.. kernel-doc:: kernel/sched/cpupri.c - :internal: - -.. kernel-doc:: kernel/sched/fair.c - :internal: - -.. kernel-doc:: include/linux/completion.h - :internal: - -.. kernel-doc:: kernel/time/timer.c - :export: - -Wait queues and Wake events ---------------------------- - -.. kernel-doc:: include/linux/wait.h - :internal: - -.. kernel-doc:: kernel/sched/wait.c - :export: - -High-resolution timers ----------------------- - -.. kernel-doc:: include/linux/ktime.h - :internal: - -.. kernel-doc:: include/linux/hrtimer.h - :internal: - -.. kernel-doc:: kernel/time/hrtimer.c - :export: - -Workqueues and Kevents ----------------------- - -.. kernel-doc:: include/linux/workqueue.h - :internal: - -.. kernel-doc:: kernel/workqueue.c - :export: - -Internal Functions ------------------- - -.. kernel-doc:: kernel/exit.c - :internal: - -.. kernel-doc:: kernel/signal.c - :internal: - -.. kernel-doc:: include/linux/kthread.h - :internal: - -.. kernel-doc:: kernel/kthread.c - :export: - -Kernel objects manipulation ---------------------------- - -.. kernel-doc:: lib/kobject.c - :export: - -Kernel utility functions ------------------------- - -.. kernel-doc:: include/linux/kernel.h - :internal: - -.. kernel-doc:: kernel/printk/printk.c - :export: - -.. kernel-doc:: kernel/panic.c - :export: - -.. kernel-doc:: kernel/sys.c - :export: - -.. kernel-doc:: kernel/rcu/srcu.c - :export: - -.. kernel-doc:: kernel/rcu/tree.c - :export: - -.. kernel-doc:: kernel/rcu/tree_plugin.h - :export: - -.. kernel-doc:: kernel/rcu/update.c - :export: - -Device Resource Management --------------------------- - -.. kernel-doc:: drivers/base/devres.c - :export: - -Device drivers infrastructure -============================= - -The Basic Device Driver-Model Structures ----------------------------------------- - -.. kernel-doc:: include/linux/device.h - :internal: - -Device Drivers Base -------------------- - -.. kernel-doc:: drivers/base/init.c - :internal: - -.. kernel-doc:: drivers/base/driver.c - :export: - -.. kernel-doc:: drivers/base/core.c - :export: - -.. kernel-doc:: drivers/base/syscore.c - :export: - -.. kernel-doc:: drivers/base/class.c - :export: - -.. kernel-doc:: drivers/base/node.c - :internal: - -.. kernel-doc:: drivers/base/firmware_class.c - :export: - -.. kernel-doc:: drivers/base/transport_class.c - :export: - -.. kernel-doc:: drivers/base/dd.c - :export: - -.. kernel-doc:: include/linux/platform_device.h - :internal: - -.. kernel-doc:: drivers/base/platform.c - :export: - -.. kernel-doc:: drivers/base/bus.c - :export: - -Buffer Sharing and Synchronization ----------------------------------- - -The dma-buf subsystem provides the framework for sharing buffers for -hardware (DMA) access across multiple device drivers and subsystems, and -for synchronizing asynchronous hardware access. - -This is used, for example, by drm "prime" multi-GPU support, but is of -course not limited to GPU use cases. - -The three main components of this are: (1) dma-buf, representing a -sg_table and exposed to userspace as a file descriptor to allow passing -between devices, (2) fence, which provides a mechanism to signal when -one device as finished access, and (3) reservation, which manages the -shared or exclusive fence(s) associated with the buffer. - -dma-buf -~~~~~~~ - -.. kernel-doc:: drivers/dma-buf/dma-buf.c - :export: - -.. kernel-doc:: include/linux/dma-buf.h - :internal: - -reservation -~~~~~~~~~~~ - -.. kernel-doc:: drivers/dma-buf/reservation.c - :doc: Reservation Object Overview - -.. kernel-doc:: drivers/dma-buf/reservation.c - :export: - -.. kernel-doc:: include/linux/reservation.h - :internal: - -fence -~~~~~ - -.. kernel-doc:: drivers/dma-buf/fence.c - :export: - -.. kernel-doc:: include/linux/fence.h - :internal: - -.. kernel-doc:: drivers/dma-buf/seqno-fence.c - :export: - -.. kernel-doc:: include/linux/seqno-fence.h - :internal: - -.. kernel-doc:: drivers/dma-buf/fence-array.c - :export: - -.. kernel-doc:: include/linux/fence-array.h - :internal: - -.. kernel-doc:: drivers/dma-buf/reservation.c - :export: - -.. kernel-doc:: include/linux/reservation.h - :internal: - -.. kernel-doc:: drivers/dma-buf/sync_file.c - :export: - -.. kernel-doc:: include/linux/sync_file.h - :internal: - -Device Drivers DMA Management ------------------------------ - -.. kernel-doc:: drivers/base/dma-coherent.c - :export: - -.. kernel-doc:: drivers/base/dma-mapping.c - :export: - -Device Drivers Power Management -------------------------------- - -.. kernel-doc:: drivers/base/power/main.c - :export: - -Device Drivers ACPI Support ---------------------------- - -.. kernel-doc:: drivers/acpi/scan.c - :export: - -.. kernel-doc:: drivers/acpi/scan.c - :internal: - -Device drivers PnP support --------------------------- - -.. kernel-doc:: drivers/pnp/core.c - :internal: - -.. kernel-doc:: drivers/pnp/card.c - :export: - -.. kernel-doc:: drivers/pnp/driver.c - :internal: - -.. kernel-doc:: drivers/pnp/manager.c - :export: - -.. kernel-doc:: drivers/pnp/support.c - :export: - -Userspace IO devices --------------------- - -.. kernel-doc:: drivers/uio/uio.c - :export: - -.. kernel-doc:: include/linux/uio_driver.h - :internal: - -Parallel Port Devices -===================== - -.. kernel-doc:: include/linux/parport.h - :internal: - -.. kernel-doc:: drivers/parport/ieee1284.c - :export: - -.. kernel-doc:: drivers/parport/share.c - :export: - -.. kernel-doc:: drivers/parport/daisy.c - :internal: - -Message-based devices -===================== - -Fusion message devices ----------------------- - -.. kernel-doc:: drivers/message/fusion/mptbase.c - :export: - -.. kernel-doc:: drivers/message/fusion/mptbase.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptscsih.c - :export: - -.. kernel-doc:: drivers/message/fusion/mptscsih.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptctl.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptspi.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptfc.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptlan.c - :internal: - -Sound Devices -============= - -.. kernel-doc:: include/sound/core.h - :internal: - -.. kernel-doc:: sound/sound_core.c - :export: - -.. kernel-doc:: include/sound/pcm.h - :internal: - -.. kernel-doc:: sound/core/pcm.c - :export: - -.. kernel-doc:: sound/core/device.c - :export: - -.. kernel-doc:: sound/core/info.c - :export: - -.. kernel-doc:: sound/core/rawmidi.c - :export: - -.. kernel-doc:: sound/core/sound.c - :export: - -.. kernel-doc:: sound/core/memory.c - :export: - -.. kernel-doc:: sound/core/pcm_memory.c - :export: - -.. kernel-doc:: sound/core/init.c - :export: - -.. kernel-doc:: sound/core/isadma.c - :export: - -.. kernel-doc:: sound/core/control.c - :export: - -.. kernel-doc:: sound/core/pcm_lib.c - :export: - -.. kernel-doc:: sound/core/hwdep.c - :export: - -.. kernel-doc:: sound/core/pcm_native.c - :export: - -.. kernel-doc:: sound/core/memalloc.c - :export: - -16x50 UART Driver -================= - -.. kernel-doc:: drivers/tty/serial/serial_core.c - :export: - -.. kernel-doc:: drivers/tty/serial/8250/8250_core.c - :export: - -Frame Buffer Library -==================== - -The frame buffer drivers depend heavily on four data structures. These -structures are declared in include/linux/fb.h. They are fb_info, -fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last -three can be made available to and from userland. - -fb_info defines the current state of a particular video card. Inside -fb_info, there exists a fb_ops structure which is a collection of -needed functions to make fbdev and fbcon work. fb_info is only visible -to the kernel. - -fb_var_screeninfo is used to describe the features of a video card -that are user defined. With fb_var_screeninfo, things such as depth -and the resolution may be defined. - -The next structure is fb_fix_screeninfo. This defines the properties -of a card that are created when a mode is set and can't be changed -otherwise. A good example of this is the start of the frame buffer -memory. This "locks" the address of the frame buffer memory, so that it -cannot be changed or moved. - -The last structure is fb_monospecs. In the old API, there was little -importance for fb_monospecs. This allowed for forbidden things such as -setting a mode of 800x600 on a fix frequency monitor. With the new API, -fb_monospecs prevents such things, and if used correctly, can prevent a -monitor from being cooked. fb_monospecs will not be useful until -kernels 2.5.x. - -Frame Buffer Memory -------------------- - -.. kernel-doc:: drivers/video/fbdev/core/fbmem.c - :export: - -Frame Buffer Colormap ---------------------- - -.. kernel-doc:: drivers/video/fbdev/core/fbcmap.c - :export: - -Frame Buffer Video Mode Database --------------------------------- - -.. kernel-doc:: drivers/video/fbdev/core/modedb.c - :internal: - -.. kernel-doc:: drivers/video/fbdev/core/modedb.c - :export: - -Frame Buffer Macintosh Video Mode Database ------------------------------------------- - -.. kernel-doc:: drivers/video/fbdev/macmodes.c - :export: - -Frame Buffer Fonts ------------------- - -Refer to the file lib/fonts/fonts.c for more information. - -Input Subsystem -=============== - -Input core ----------- - -.. kernel-doc:: include/linux/input.h - :internal: - -.. kernel-doc:: drivers/input/input.c - :export: - -.. kernel-doc:: drivers/input/ff-core.c - :export: - -.. kernel-doc:: drivers/input/ff-memless.c - :export: - -Multitouch Library ------------------- - -.. kernel-doc:: include/linux/input/mt.h - :internal: - -.. kernel-doc:: drivers/input/input-mt.c - :export: - -Polled input devices --------------------- - -.. kernel-doc:: include/linux/input-polldev.h - :internal: - -.. kernel-doc:: drivers/input/input-polldev.c - :export: - -Matrix keyboards/keypads ------------------------- - -.. kernel-doc:: include/linux/input/matrix_keypad.h - :internal: - -Sparse keymap support ---------------------- - -.. kernel-doc:: include/linux/input/sparse-keymap.h - :internal: - -.. kernel-doc:: drivers/input/sparse-keymap.c - :export: - -Serial Peripheral Interface (SPI) -================================= - -SPI is the "Serial Peripheral Interface", widely used with embedded -systems because it is a simple and efficient interface: basically a -multiplexed shift register. Its three signal wires hold a clock (SCK, -often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data -line, and a "Master In, Slave Out" (MISO) data line. SPI is a full -duplex protocol; for each bit shifted out the MOSI line (one per clock) -another is shifted in on the MISO line. Those bits are assembled into -words of various sizes on the way to and from system memory. An -additional chipselect line is usually active-low (nCS); four signals are -normally used for each peripheral, plus sometimes an interrupt. - -The SPI bus facilities listed here provide a generalized interface to -declare SPI busses and devices, manage them according to the standard -Linux driver model, and perform input/output operations. At this time, -only "master" side interfaces are supported, where Linux talks to SPI -peripherals and does not implement such a peripheral itself. (Interfaces -to support implementing SPI slaves would necessarily look different.) - -The programming interface is structured around two kinds of driver, and -two kinds of device. A "Controller Driver" abstracts the controller -hardware, which may be as simple as a set of GPIO pins or as complex as -a pair of FIFOs connected to dual DMA engines on the other side of the -SPI shift register (maximizing throughput). Such drivers bridge between -whatever bus they sit on (often the platform bus) and SPI, and expose -the SPI side of their device as a :c:type:`struct spi_master -`. SPI devices are children of that master, -represented as a :c:type:`struct spi_device ` and -manufactured from :c:type:`struct spi_board_info -` descriptors which are usually provided by -board-specific initialization code. A :c:type:`struct spi_driver -` is called a "Protocol Driver", and is bound to a -spi_device using normal driver model calls. - -The I/O model is a set of queued messages. Protocol drivers submit one -or more :c:type:`struct spi_message ` objects, -which are processed and completed asynchronously. (There are synchronous -wrappers, however.) Messages are built from one or more -:c:type:`struct spi_transfer ` objects, each of -which wraps a full duplex SPI transfer. A variety of protocol tweaking -options are needed, because different chips adopt very different -policies for how they use the bits transferred with SPI. - -.. kernel-doc:: include/linux/spi/spi.h - :internal: - -.. kernel-doc:: drivers/spi/spi.c - :functions: spi_register_board_info - -.. kernel-doc:: drivers/spi/spi.c - :export: - -I\ :sup:`2`\ C and SMBus Subsystem -================================== - -I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for -the "Inter-IC" bus, a simple bus protocol which is widely used where low -data rate communications suffice. Since it's also a licensed trademark, -some vendors use another name (such as "Two-Wire Interface", TWI) for -the same bus. I2C only needs two signals (SCL for clock, SDA for data), -conserving board real estate and minimizing signal quality issues. Most -I2C devices use seven bit addresses, and bus speeds of up to 400 kHz; -there's a high speed extension (3.4 MHz) that's not yet found wide use. -I2C is a multi-master bus; open drain signaling is used to arbitrate -between masters, as well as to handshake and to synchronize clocks from -slower clients. - -The Linux I2C programming interfaces support only the master side of bus -interactions, not the slave side. The programming interface is -structured around two kinds of driver, and two kinds of device. An I2C -"Adapter Driver" abstracts the controller hardware; it binds to a -physical device (perhaps a PCI device or platform_device) and exposes a -:c:type:`struct i2c_adapter ` representing each -I2C bus segment it manages. On each I2C bus segment will be I2C devices -represented by a :c:type:`struct i2c_client `. -Those devices will be bound to a :c:type:`struct i2c_driver -`, which should follow the standard Linux driver -model. (At this writing, a legacy model is more widely used.) There are -functions to perform various I2C protocol operations; at this writing -all such functions are usable only from task context. - -The System Management Bus (SMBus) is a sibling protocol. Most SMBus -systems are also I2C conformant. The electrical constraints are tighter -for SMBus, and it standardizes particular protocol messages and idioms. -Controllers that support I2C can also support most SMBus operations, but -SMBus controllers don't support all the protocol options that an I2C -controller will. There are functions to perform various SMBus protocol -operations, either using I2C primitives or by issuing SMBus commands to -i2c_adapter devices which don't support those I2C operations. - -.. kernel-doc:: include/linux/i2c.h - :internal: - -.. kernel-doc:: drivers/i2c/i2c-boardinfo.c - :functions: i2c_register_board_info - -.. kernel-doc:: drivers/i2c/i2c-core.c - :export: - -High Speed Synchronous Serial Interface (HSI) -============================================= - -High Speed Synchronous Serial Interface (HSI) is a serial interface -mainly used for connecting application engines (APE) with cellular modem -engines (CMT) in cellular handsets. HSI provides multiplexing for up to -16 logical channels, low-latency and full duplex communication. - -.. kernel-doc:: include/linux/hsi/hsi.h - :internal: - -.. kernel-doc:: drivers/hsi/hsi_core.c - :export: - -Pulse-Width Modulation (PWM) -============================ - -Pulse-width modulation is a modulation technique primarily used to -control power supplied to electrical devices. - -The PWM framework provides an abstraction for providers and consumers of -PWM signals. A controller that provides one or more PWM signals is -registered as :c:type:`struct pwm_chip `. Providers -are expected to embed this structure in a driver-specific structure. -This structure contains fields that describe a particular chip. - -A chip exposes one or more PWM signal sources, each of which exposed as -a :c:type:`struct pwm_device `. Operations can be -performed on PWM devices to control the period, duty cycle, polarity and -active state of the signal. - -Note that PWM devices are exclusive resources: they can always only be -used by one consumer at a time. - -.. kernel-doc:: include/linux/pwm.h - :internal: - -.. kernel-doc:: drivers/pwm/core.c - :export: diff --git a/Documentation/driver-api/frame-buffer.rst b/Documentation/driver-api/frame-buffer.rst new file mode 100644 index 000000000000..9dd3060f027d --- /dev/null +++ b/Documentation/driver-api/frame-buffer.rst @@ -0,0 +1,62 @@ +Frame Buffer Library +==================== + +The frame buffer drivers depend heavily on four data structures. These +structures are declared in include/linux/fb.h. They are fb_info, +fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last +three can be made available to and from userland. + +fb_info defines the current state of a particular video card. Inside +fb_info, there exists a fb_ops structure which is a collection of +needed functions to make fbdev and fbcon work. fb_info is only visible +to the kernel. + +fb_var_screeninfo is used to describe the features of a video card +that are user defined. With fb_var_screeninfo, things such as depth +and the resolution may be defined. + +The next structure is fb_fix_screeninfo. This defines the properties +of a card that are created when a mode is set and can't be changed +otherwise. A good example of this is the start of the frame buffer +memory. This "locks" the address of the frame buffer memory, so that it +cannot be changed or moved. + +The last structure is fb_monospecs. In the old API, there was little +importance for fb_monospecs. This allowed for forbidden things such as +setting a mode of 800x600 on a fix frequency monitor. With the new API, +fb_monospecs prevents such things, and if used correctly, can prevent a +monitor from being cooked. fb_monospecs will not be useful until +kernels 2.5.x. + +Frame Buffer Memory +------------------- + +.. kernel-doc:: drivers/video/fbdev/core/fbmem.c + :export: + +Frame Buffer Colormap +--------------------- + +.. kernel-doc:: drivers/video/fbdev/core/fbcmap.c + :export: + +Frame Buffer Video Mode Database +-------------------------------- + +.. kernel-doc:: drivers/video/fbdev/core/modedb.c + :internal: + +.. kernel-doc:: drivers/video/fbdev/core/modedb.c + :export: + +Frame Buffer Macintosh Video Mode Database +------------------------------------------ + +.. kernel-doc:: drivers/video/fbdev/macmodes.c + :export: + +Frame Buffer Fonts +------------------ + +Refer to the file lib/fonts/fonts.c for more information. + diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst new file mode 100644 index 000000000000..b50c41011e47 --- /dev/null +++ b/Documentation/driver-api/index.rst @@ -0,0 +1,24 @@ +======================================== +The Linux driver implementer's API guide +======================================== + +The kernel offers a wide variety of interfaces to support the development +of device drivers. This document is an only somewhat organized collection +of some of those interfaces — it will hopefully get better over time! The +available subsections can be seen below. + +.. class:: toc-title + + Table of contents + +.. toctree:: + :maxdepth: 2 + + basics + infrastructure + message-based + sound + frame-buffer + input + serial-interfaces + miscellaneous diff --git a/Documentation/driver-api/infrastructure.rst b/Documentation/driver-api/infrastructure.rst new file mode 100644 index 000000000000..5d50d6733db3 --- /dev/null +++ b/Documentation/driver-api/infrastructure.rst @@ -0,0 +1,169 @@ +Device drivers infrastructure +============================= + +The Basic Device Driver-Model Structures +---------------------------------------- + +.. kernel-doc:: include/linux/device.h + :internal: + +Device Drivers Base +------------------- + +.. kernel-doc:: drivers/base/init.c + :internal: + +.. kernel-doc:: drivers/base/driver.c + :export: + +.. kernel-doc:: drivers/base/core.c + :export: + +.. kernel-doc:: drivers/base/syscore.c + :export: + +.. kernel-doc:: drivers/base/class.c + :export: + +.. kernel-doc:: drivers/base/node.c + :internal: + +.. kernel-doc:: drivers/base/firmware_class.c + :export: + +.. kernel-doc:: drivers/base/transport_class.c + :export: + +.. kernel-doc:: drivers/base/dd.c + :export: + +.. kernel-doc:: include/linux/platform_device.h + :internal: + +.. kernel-doc:: drivers/base/platform.c + :export: + +.. kernel-doc:: drivers/base/bus.c + :export: + +Buffer Sharing and Synchronization +---------------------------------- + +The dma-buf subsystem provides the framework for sharing buffers for +hardware (DMA) access across multiple device drivers and subsystems, and +for synchronizing asynchronous hardware access. + +This is used, for example, by drm "prime" multi-GPU support, but is of +course not limited to GPU use cases. + +The three main components of this are: (1) dma-buf, representing a +sg_table and exposed to userspace as a file descriptor to allow passing +between devices, (2) fence, which provides a mechanism to signal when +one device as finished access, and (3) reservation, which manages the +shared or exclusive fence(s) associated with the buffer. + +dma-buf +~~~~~~~ + +.. kernel-doc:: drivers/dma-buf/dma-buf.c + :export: + +.. kernel-doc:: include/linux/dma-buf.h + :internal: + +reservation +~~~~~~~~~~~ + +.. kernel-doc:: drivers/dma-buf/reservation.c + :doc: Reservation Object Overview + +.. kernel-doc:: drivers/dma-buf/reservation.c + :export: + +.. kernel-doc:: include/linux/reservation.h + :internal: + +fence +~~~~~ + +.. kernel-doc:: drivers/dma-buf/fence.c + :export: + +.. kernel-doc:: include/linux/fence.h + :internal: + +.. kernel-doc:: drivers/dma-buf/seqno-fence.c + :export: + +.. kernel-doc:: include/linux/seqno-fence.h + :internal: + +.. kernel-doc:: drivers/dma-buf/fence-array.c + :export: + +.. kernel-doc:: include/linux/fence-array.h + :internal: + +.. kernel-doc:: drivers/dma-buf/reservation.c + :export: + +.. kernel-doc:: include/linux/reservation.h + :internal: + +.. kernel-doc:: drivers/dma-buf/sync_file.c + :export: + +.. kernel-doc:: include/linux/sync_file.h + :internal: + +Device Drivers DMA Management +----------------------------- + +.. kernel-doc:: drivers/base/dma-coherent.c + :export: + +.. kernel-doc:: drivers/base/dma-mapping.c + :export: + +Device Drivers Power Management +------------------------------- + +.. kernel-doc:: drivers/base/power/main.c + :export: + +Device Drivers ACPI Support +--------------------------- + +.. kernel-doc:: drivers/acpi/scan.c + :export: + +.. kernel-doc:: drivers/acpi/scan.c + :internal: + +Device drivers PnP support +-------------------------- + +.. kernel-doc:: drivers/pnp/core.c + :internal: + +.. kernel-doc:: drivers/pnp/card.c + :export: + +.. kernel-doc:: drivers/pnp/driver.c + :internal: + +.. kernel-doc:: drivers/pnp/manager.c + :export: + +.. kernel-doc:: drivers/pnp/support.c + :export: + +Userspace IO devices +-------------------- + +.. kernel-doc:: drivers/uio/uio.c + :export: + +.. kernel-doc:: include/linux/uio_driver.h + :internal: + diff --git a/Documentation/driver-api/input.rst b/Documentation/driver-api/input.rst new file mode 100644 index 000000000000..d05bf58fa83e --- /dev/null +++ b/Documentation/driver-api/input.rst @@ -0,0 +1,51 @@ +Input Subsystem +=============== + +Input core +---------- + +.. kernel-doc:: include/linux/input.h + :internal: + +.. kernel-doc:: drivers/input/input.c + :export: + +.. kernel-doc:: drivers/input/ff-core.c + :export: + +.. kernel-doc:: drivers/input/ff-memless.c + :export: + +Multitouch Library +------------------ + +.. kernel-doc:: include/linux/input/mt.h + :internal: + +.. kernel-doc:: drivers/input/input-mt.c + :export: + +Polled input devices +-------------------- + +.. kernel-doc:: include/linux/input-polldev.h + :internal: + +.. kernel-doc:: drivers/input/input-polldev.c + :export: + +Matrix keyboards/keypads +------------------------ + +.. kernel-doc:: include/linux/input/matrix_keypad.h + :internal: + +Sparse keymap support +--------------------- + +.. kernel-doc:: include/linux/input/sparse-keymap.h + :internal: + +.. kernel-doc:: drivers/input/sparse-keymap.c + :export: + diff --git a/Documentation/driver-api/message-based.rst b/Documentation/driver-api/message-based.rst new file mode 100644 index 000000000000..ef5867a7de20 --- /dev/null +++ b/Documentation/driver-api/message-based.rst @@ -0,0 +1,30 @@ +Message-based devices +===================== + +Fusion message devices +---------------------- + +.. kernel-doc:: drivers/message/fusion/mptbase.c + :export: + +.. kernel-doc:: drivers/message/fusion/mptbase.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptscsih.c + :export: + +.. kernel-doc:: drivers/message/fusion/mptscsih.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptctl.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptspi.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptfc.c + :internal: + +.. kernel-doc:: drivers/message/fusion/mptlan.c + :internal: + diff --git a/Documentation/driver-api/miscellaneous.rst b/Documentation/driver-api/miscellaneous.rst new file mode 100644 index 000000000000..8da7d115bafc --- /dev/null +++ b/Documentation/driver-api/miscellaneous.rst @@ -0,0 +1,50 @@ +Parallel Port Devices +===================== + +.. kernel-doc:: include/linux/parport.h + :internal: + +.. kernel-doc:: drivers/parport/ieee1284.c + :export: + +.. kernel-doc:: drivers/parport/share.c + :export: + +.. kernel-doc:: drivers/parport/daisy.c + :internal: + +16x50 UART Driver +================= + +.. kernel-doc:: drivers/tty/serial/serial_core.c + :export: + +.. kernel-doc:: drivers/tty/serial/8250/8250_core.c + :export: + +Pulse-Width Modulation (PWM) +============================ + +Pulse-width modulation is a modulation technique primarily used to +control power supplied to electrical devices. + +The PWM framework provides an abstraction for providers and consumers of +PWM signals. A controller that provides one or more PWM signals is +registered as :c:type:`struct pwm_chip `. Providers +are expected to embed this structure in a driver-specific structure. +This structure contains fields that describe a particular chip. + +A chip exposes one or more PWM signal sources, each of which exposed as +a :c:type:`struct pwm_device `. Operations can be +performed on PWM devices to control the period, duty cycle, polarity and +active state of the signal. + +Note that PWM devices are exclusive resources: they can always only be +used by one consumer at a time. + +.. kernel-doc:: include/linux/pwm.h + :internal: + +.. kernel-doc:: drivers/pwm/core.c + :export: + diff --git a/Documentation/driver-api/serial-interfaces.rst b/Documentation/driver-api/serial-interfaces.rst new file mode 100644 index 000000000000..d0d65e58c14b --- /dev/null +++ b/Documentation/driver-api/serial-interfaces.rst @@ -0,0 +1,115 @@ +Serial Peripheral Interface (SPI) +================================= + +SPI is the "Serial Peripheral Interface", widely used with embedded +systems because it is a simple and efficient interface: basically a +multiplexed shift register. Its three signal wires hold a clock (SCK, +often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data +line, and a "Master In, Slave Out" (MISO) data line. SPI is a full +duplex protocol; for each bit shifted out the MOSI line (one per clock) +another is shifted in on the MISO line. Those bits are assembled into +words of various sizes on the way to and from system memory. An +additional chipselect line is usually active-low (nCS); four signals are +normally used for each peripheral, plus sometimes an interrupt. + +The SPI bus facilities listed here provide a generalized interface to +declare SPI busses and devices, manage them according to the standard +Linux driver model, and perform input/output operations. At this time, +only "master" side interfaces are supported, where Linux talks to SPI +peripherals and does not implement such a peripheral itself. (Interfaces +to support implementing SPI slaves would necessarily look different.) + +The programming interface is structured around two kinds of driver, and +two kinds of device. A "Controller Driver" abstracts the controller +hardware, which may be as simple as a set of GPIO pins or as complex as +a pair of FIFOs connected to dual DMA engines on the other side of the +SPI shift register (maximizing throughput). Such drivers bridge between +whatever bus they sit on (often the platform bus) and SPI, and expose +the SPI side of their device as a :c:type:`struct spi_master +`. SPI devices are children of that master, +represented as a :c:type:`struct spi_device ` and +manufactured from :c:type:`struct spi_board_info +` descriptors which are usually provided by +board-specific initialization code. A :c:type:`struct spi_driver +` is called a "Protocol Driver", and is bound to a +spi_device using normal driver model calls. + +The I/O model is a set of queued messages. Protocol drivers submit one +or more :c:type:`struct spi_message ` objects, +which are processed and completed asynchronously. (There are synchronous +wrappers, however.) Messages are built from one or more +:c:type:`struct spi_transfer ` objects, each of +which wraps a full duplex SPI transfer. A variety of protocol tweaking +options are needed, because different chips adopt very different +policies for how they use the bits transferred with SPI. + +.. kernel-doc:: include/linux/spi/spi.h + :internal: + +.. kernel-doc:: drivers/spi/spi.c + :functions: spi_register_board_info + +.. kernel-doc:: drivers/spi/spi.c + :export: + +I\ :sup:`2`\ C and SMBus Subsystem +================================== + +I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for +the "Inter-IC" bus, a simple bus protocol which is widely used where low +data rate communications suffice. Since it's also a licensed trademark, +some vendors use another name (such as "Two-Wire Interface", TWI) for +the same bus. I2C only needs two signals (SCL for clock, SDA for data), +conserving board real estate and minimizing signal quality issues. Most +I2C devices use seven bit addresses, and bus speeds of up to 400 kHz; +there's a high speed extension (3.4 MHz) that's not yet found wide use. +I2C is a multi-master bus; open drain signaling is used to arbitrate +between masters, as well as to handshake and to synchronize clocks from +slower clients. + +The Linux I2C programming interfaces support only the master side of bus +interactions, not the slave side. The programming interface is +structured around two kinds of driver, and two kinds of device. An I2C +"Adapter Driver" abstracts the controller hardware; it binds to a +physical device (perhaps a PCI device or platform_device) and exposes a +:c:type:`struct i2c_adapter ` representing each +I2C bus segment it manages. On each I2C bus segment will be I2C devices +represented by a :c:type:`struct i2c_client `. +Those devices will be bound to a :c:type:`struct i2c_driver +`, which should follow the standard Linux driver +model. (At this writing, a legacy model is more widely used.) There are +functions to perform various I2C protocol operations; at this writing +all such functions are usable only from task context. + +The System Management Bus (SMBus) is a sibling protocol. Most SMBus +systems are also I2C conformant. The electrical constraints are tighter +for SMBus, and it standardizes particular protocol messages and idioms. +Controllers that support I2C can also support most SMBus operations, but +SMBus controllers don't support all the protocol options that an I2C +controller will. There are functions to perform various SMBus protocol +operations, either using I2C primitives or by issuing SMBus commands to +i2c_adapter devices which don't support those I2C operations. + +.. kernel-doc:: include/linux/i2c.h + :internal: + +.. kernel-doc:: drivers/i2c/i2c-boardinfo.c + :functions: i2c_register_board_info + +.. kernel-doc:: drivers/i2c/i2c-core.c + :export: + +High Speed Synchronous Serial Interface (HSI) +============================================= + +High Speed Synchronous Serial Interface (HSI) is a serial interface +mainly used for connecting application engines (APE) with cellular modem +engines (CMT) in cellular handsets. HSI provides multiplexing for up to +16 logical channels, low-latency and full duplex communication. + +.. kernel-doc:: include/linux/hsi/hsi.h + :internal: + +.. kernel-doc:: drivers/hsi/hsi_core.c + :export: + diff --git a/Documentation/driver-api/sound.rst b/Documentation/driver-api/sound.rst new file mode 100644 index 000000000000..afef6eabc073 --- /dev/null +++ b/Documentation/driver-api/sound.rst @@ -0,0 +1,54 @@ +Sound Devices +============= + +.. kernel-doc:: include/sound/core.h + :internal: + +.. kernel-doc:: sound/sound_core.c + :export: + +.. kernel-doc:: include/sound/pcm.h + :internal: + +.. kernel-doc:: sound/core/pcm.c + :export: + +.. kernel-doc:: sound/core/device.c + :export: + +.. kernel-doc:: sound/core/info.c + :export: + +.. kernel-doc:: sound/core/rawmidi.c + :export: + +.. kernel-doc:: sound/core/sound.c + :export: + +.. kernel-doc:: sound/core/memory.c + :export: + +.. kernel-doc:: sound/core/pcm_memory.c + :export: + +.. kernel-doc:: sound/core/init.c + :export: + +.. kernel-doc:: sound/core/isadma.c + :export: + +.. kernel-doc:: sound/core/control.c + :export: + +.. kernel-doc:: sound/core/pcm_lib.c + :export: + +.. kernel-doc:: sound/core/hwdep.c + :export: + +.. kernel-doc:: sound/core/pcm_native.c + :export: + +.. kernel-doc:: sound/core/memalloc.c + :export: + diff --git a/Documentation/index.rst b/Documentation/index.rst index 0d6992b897c8..9fe5e0cacdd0 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -13,7 +13,7 @@ Contents: kernel-documentation dev-tools/tools - driver-api/drivers + driver-api/index media/index gpu/index From e8f5c617f26626ef4915ffa176f4ae02c9e08531 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 22 Aug 2016 15:16:21 -0600 Subject: [PATCH 096/591] doc-rst: add boilerplate to customize c-domain Add a sphinx-extension to customize the sphinx c-domain. No functional changes right yet, just the boilerplate code. Signed-off-by: Markus Heiser [ jc: coding-style tweak ] Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 2 +- Documentation/sphinx/cdomain.py | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Documentation/sphinx/cdomain.py diff --git a/Documentation/conf.py b/Documentation/conf.py index 23e2f0bbcfc8..88c377d468d0 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -34,7 +34,7 @@ from load_config import loadConfig # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include'] +extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include', 'cdomain'] # The name of the math extension changed on Sphinx 1.4 if minor > 3: diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py new file mode 100644 index 000000000000..d6e66e289808 --- /dev/null +++ b/Documentation/sphinx/cdomain.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8; mode: python -*- +u""" + cdomain + ~~~~~~~ + + Replacement for the sphinx c-domain. + + :copyright: Copyright (C) 2016 Markus Heiser + :license: GPL Version 2, June 1991 see Linux/COPYING for details. +""" + +from sphinx.domains.c import CObject as Base_CObject +from sphinx.domains.c import CDomain as Base_CDomain + +__version__ = '1.0' + +def setup(app): + + app.override_domain(CDomain) + + return dict( + version = __version__, + parallel_read_safe = True, + parallel_write_safe = True + ) + +class CObject(Base_CObject): + + """ + Description of a C language object. + """ + +class CDomain(Base_CDomain): + + """C language domain.""" + name = 'c' + label = 'C' + directives = { + 'function': CObject, + 'member': CObject, + 'macro': CObject, + 'type': CObject, + 'var': CObject, + } From 2c645cd7c4a0d4b35da1e43ec3a5b55a64038157 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 15 Aug 2016 16:08:25 +0200 Subject: [PATCH 097/591] doc-rst:c-domain: ref-name of a function declaration Add option 'name' to the "c:function:" directive. With option 'name' the ref-name of a function can be modified. E.g.:: .. c:function:: int ioctl( int fd, int request ) :name: VIDIOC_LOG_STATUS The func-name (e.g. ioctl) remains in the output but the ref-name changed from ``ioctl`` to ``VIDIOC_LOG_STATUS``. The index entry for this function is also changed to ``VIDIOC_LOG_STATUS`` and the function can now referenced by:: :c:func:`VIDIOC_LOG_STATUS` Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/kernel-documentation.rst | 29 ++++++++++++++++++++++++ Documentation/sphinx/cdomain.py | 31 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/Documentation/kernel-documentation.rst b/Documentation/kernel-documentation.rst index c4eb5049da39..bc4c3f526816 100644 --- a/Documentation/kernel-documentation.rst +++ b/Documentation/kernel-documentation.rst @@ -107,6 +107,35 @@ Here are some specific guidelines for the kernel documentation: the order as encountered."), having the higher levels the same overall makes it easier to follow the documents. + +the C domain +------------ + +The `Sphinx C Domain`_ (name c) is suited for documentation of C API. E.g. a +function prototype: + +.. code-block:: rst + + .. c:function:: int ioctl( int fd, int request ) + +The C domain of the kernel-doc has some additional features. E.g. you can +*rename* the reference name of a function with a common name like ``open`` or +``ioctl``: + +.. code-block:: rst + + .. c:function:: int ioctl( int fd, int request ) + :name: VIDIOC_LOG_STATUS + +The func-name (e.g. ioctl) remains in the output but the ref-name changed from +``ioctl`` to ``VIDIOC_LOG_STATUS``. The index entry for this function is also +changed to ``VIDIOC_LOG_STATUS`` and the function can now referenced by: + +.. code-block:: rst + + :c:func:`VIDIOC_LOG_STATUS` + + list tables ----------- diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py index d6e66e289808..b1912c80ff77 100644 --- a/Documentation/sphinx/cdomain.py +++ b/Documentation/sphinx/cdomain.py @@ -7,8 +7,24 @@ u""" :copyright: Copyright (C) 2016 Markus Heiser :license: GPL Version 2, June 1991 see Linux/COPYING for details. + + List of customizations: + + * Add option 'name' to the "c:function:" directive. With option 'name' the + ref-name of a function can be modified. E.g.:: + + .. c:function:: int ioctl( int fd, int request ) + :name: VIDIOC_LOG_STATUS + + The func-name (e.g. ioctl) remains in the output but the ref-name changed + from 'ioctl' to 'VIDIOC_LOG_STATUS'. The function is referenced by:: + + * :c:func:`VIDIOC_LOG_STATUS` or + * :any:`VIDIOC_LOG_STATUS` (``:any:`` needs sphinx 1.3) """ +from docutils.parsers.rst import directives + from sphinx.domains.c import CObject as Base_CObject from sphinx.domains.c import CDomain as Base_CDomain @@ -29,6 +45,21 @@ class CObject(Base_CObject): """ Description of a C language object. """ + option_spec = { + "name" : directives.unchanged + } + + def handle_signature(self, sig, signode): + """Transform a C signature into RST nodes.""" + fullname = super(CObject, self).handle_signature(sig, signode) + if "name" in self.options: + if self.objtype == 'function': + fullname = self.options["name"] + else: + # FIXME: handle :name: value of other declaration types? + pass + return fullname + class CDomain(Base_CDomain): From 556aa6d5d9616ccfc0099c40dc239157f50ee776 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 15 Aug 2016 16:08:26 +0200 Subject: [PATCH 098/591] doc-rst: moved *duplicate* warnings to nitpicky mode Moved the *duplicate C object description* warnings for function declarations in the nitpicky mode. In nitpick mode, you can suppress those warnings (e.g. ioctl) with:: nitpicky = True nitpick_ignore = [ ("c:func", "ioctl"), ] See Sphinx documentation for the config values for ``nitpick`` and ``nitpick_ignore`` [1]. With this change all the ".. cpp:function:: int ioctl(..)" descriptions (found in the media book) can be migrated to ".. c:function:: int ioctl(..)", without getting any warnings. E.g.:: .. cpp:function:: int ioctl( int fd, int request, struct cec_event *argp ) .. c:function:: int ioctl( int fd, int request, struct cec_event *argp ) The main effect, is that we get those *CPP-types* back into Sphinx's C- namespace and we need no longer to distinguish between c/cpp references, when we refer a function like the ioctl. [1] http://www.sphinx-doc.org/en/stable/config.html?highlight=nitpick#confval-nitpicky Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/sphinx/cdomain.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py index b1912c80ff77..9eb714ada394 100644 --- a/Documentation/sphinx/cdomain.py +++ b/Documentation/sphinx/cdomain.py @@ -10,6 +10,10 @@ u""" List of customizations: + * Moved the *duplicate C object description* warnings for function + declarations in the nitpicky mode. See Sphinx documentation for + the config values for ``nitpick`` and ``nitpick_ignore``. + * Add option 'name' to the "c:function:" directive. With option 'name' the ref-name of a function can be modified. E.g.:: @@ -60,6 +64,29 @@ class CObject(Base_CObject): pass return fullname + def add_target_and_index(self, name, sig, signode): + # for C API items we add a prefix since names are usually not qualified + # by a module name and so easily clash with e.g. section titles + targetname = 'c.' + name + if targetname not in self.state.document.ids: + signode['names'].append(targetname) + signode['ids'].append(targetname) + signode['first'] = (not self.names) + self.state.document.note_explicit_target(signode) + inv = self.env.domaindata['c']['objects'] + if (name in inv and self.env.config.nitpicky): + if self.objtype == 'function': + if ('c:func', name) not in self.env.config.nitpick_ignore: + self.state_machine.reporter.warning( + 'duplicate C object description of %s, ' % name + + 'other instance in ' + self.env.doc2path(inv[name][0]), + line=self.lineno) + inv[name] = (self.env.docname, self.objtype) + + indextext = self.get_index_text(name) + if indextext: + self.indexnode['entries'].append(('single', indextext, + targetname, '', None)) class CDomain(Base_CDomain): From aa10a7826646c56eb4553df8fe81b3d23655c91a Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 15 Aug 2016 16:08:27 +0200 Subject: [PATCH 099/591] doc-rst: Revert "kernel-doc: fix handling of address_space tags" This reverts commit a88b1672d4ddf9895eb53e6980926d5e960dea8e. From the origin comit log:: The RST cpp:function handler is very pedantic: it doesn't allow any macros like __user on it Since the kernel-doc parser does NOT make use of the cpp:domain, there is no need to change the kernel-doc parser eleminating the address_space tags. Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 4f2e9049e8fa..ba081c7636a2 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1849,9 +1849,6 @@ sub output_function_rst(%) { $count++; $type = $args{'parametertypes'}{$parameter}; - # RST doesn't like address_space tags at function prototypes - $type =~ s/__(user|kernel|iomem|percpu|pmem|rcu)\s*//; - if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { # pointer-to-function print $1 . $parameter . ") (" . $2; From 9cd3476c91708b4b814f17671597a2708ec195ed Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 15 Aug 2016 16:08:28 +0200 Subject: [PATCH 100/591] doc-rst: migrate ioctl CEC_DQEVENT to c-domain This is only one example, demonstrating the benefits of the patch series. The CEC_DQEVENT ioctl is migrated to the sphinx c-domain and referred by ":name: CEC_DQEVENT". With this change the indirection using ":ref:`CEC_DQEVENT` is no longer needed, we can refer the ioctl directly with ":c:func:`CEC_DQEVENT`". As addition in the index, there is a entry "CEC_DQEVENT (C function)". Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/media/uapi/cec/cec-func-open.rst | 2 +- Documentation/media/uapi/cec/cec-ioc-dqevent.rst | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/media/uapi/cec/cec-func-open.rst b/Documentation/media/uapi/cec/cec-func-open.rst index 38fd7e0cfccd..7c0f981a6e07 100644 --- a/Documentation/media/uapi/cec/cec-func-open.rst +++ b/Documentation/media/uapi/cec/cec-func-open.rst @@ -32,7 +32,7 @@ Arguments Open flags. Access mode must be ``O_RDWR``. When the ``O_NONBLOCK`` flag is given, the - :ref:`CEC_RECEIVE ` and :ref:`CEC_DQEVENT ` ioctls + :ref:`CEC_RECEIVE ` and :c:func:`CEC_DQEVENT` ioctls will return the ``EAGAIN`` error code when no message or event is available, and ioctls :ref:`CEC_TRANSMIT `, :ref:`CEC_ADAP_S_PHYS_ADDR ` and diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index 7a6d6d00ce19..4e12e6cd88ee 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -15,7 +15,8 @@ CEC_DQEVENT - Dequeue a CEC event Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct cec_event *argp ) +.. c:function:: int ioctl( int fd, int request, struct cec_event *argp ) + :name: CEC_DQEVENT Arguments ========= @@ -36,7 +37,7 @@ Description and is currently only available as a staging kernel module. CEC devices can send asynchronous events. These can be retrieved by -calling :ref:`ioctl CEC_DQEVENT `. If the file descriptor is in +calling :c:func:`CEC_DQEVENT`. If the file descriptor is in non-blocking mode and no event is pending, then it will return -1 and set errno to the ``EAGAIN`` error code. From d565127d120e9b95ba98549c31eab9cec1cbbbc7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 Aug 2016 11:53:39 -0300 Subject: [PATCH 101/591] docs-rst: add support for LaTeX output Sphinx supports LaTeX output. Sometimes, it is interesting to call it directly, instead of also generating a PDF. As it comes for free, add a target for it. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/DocBook/Makefile | 1 + Documentation/Makefile.sphinx | 7 ++++++- Makefile | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index a91c96522379..a558dfcc9e2d 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -72,6 +72,7 @@ installmandocs: mandocs # no-op for the DocBook toolchain epubdocs: +latexdocs: ### #External programs used diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx index ba4efb1f68f3..894cfaa41f55 100644 --- a/Documentation/Makefile.sphinx +++ b/Documentation/Makefile.sphinx @@ -66,12 +66,16 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4); htmldocs: @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var))) -pdfdocs: +latexdocs: ifeq ($(HAVE_PDFLATEX),0) $(warning The 'xelatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.) @echo " SKIP Sphinx $@ target." else # HAVE_PDFLATEX @$(call loop_cmd,sphinx,latex,.,latex,.) +endif # HAVE_PDFLATEX + +pdfdocs: latexdocs +ifneq ($(HAVE_PDFLATEX),0) $(Q)$(MAKE) PDFLATEX=xelatex LATEXOPTS="-interaction=nonstopmode" -C $(BUILDDIR)/latex endif # HAVE_PDFLATEX @@ -95,6 +99,7 @@ endif # HAVE_SPHINX dochelp: @echo ' Linux kernel internal documentation in different formats (Sphinx):' @echo ' htmldocs - HTML' + @echo ' latexdocs - LaTeX' @echo ' pdfdocs - PDF' @echo ' epubdocs - EPUB' @echo ' xmldocs - XML' diff --git a/Makefile b/Makefile index 70de1448c571..0fa3feb6f74e 100644 --- a/Makefile +++ b/Makefile @@ -1432,7 +1432,7 @@ $(help-board-dirs): help-%: # Documentation targets # --------------------------------------------------------------------------- -DOC_TARGETS := xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs epubdocs cleandocs +DOC_TARGETS := xmldocs sgmldocs psdocs latexdocs pdfdocs htmldocs mandocs installmandocs epubdocs cleandocs PHONY += $(DOC_TARGETS) $(DOC_TARGETS): scripts_basic FORCE $(Q)$(MAKE) $(build)=scripts build_docproc build_check-lc_ctype From aa4e37a3d13679dccf7945dd864375b698cf0df9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 09:49:38 -0300 Subject: [PATCH 102/591] docs-rst: conf.py: adjust the size of .. note:: tag While the current implementation works well when using as a paragraph, it doesn't work properly if inside a table. As we have quite a few such cases, fix the logic to take the column size into account. PS.: I took the logic there from the latest version of Sphinx.sty Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/conf.py b/Documentation/conf.py index 88c377d468d0..aaa3f70aafcb 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -282,7 +282,13 @@ latex_elements = { \\definecolor{MyGray}{rgb}{0.80,0.80,0.80} \\makeatletter\\newenvironment{graybox}{% - \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\columnwidth}}{\\end{minipage}\\end{lrbox}% + \\newlength{\\py@noticelength} + \\setlength{\\fboxrule}{1pt} + \\setlength{\\fboxsep}{7pt} + \\setlength{\\py@noticelength}{\\linewidth} + \\addtolength{\\py@noticelength}{-2\\fboxsep} + \\addtolength{\\py@noticelength}{-2\\fboxrule} + \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\py@noticelength}}{\\end{minipage}\\end{lrbox}% \\colorbox{MyGray}{\\usebox{\\@tempboxa}} }\\makeatother From 41cff161fe99d1c6a773becc2250a1dc3ac035ff Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 21 Aug 2016 15:23:03 -0300 Subject: [PATCH 103/591] docs-rst: Use better colors for note/warning/attention boxes Instead of painting the box with gray, let's use a colored box. IMHO, that makes easier to warn users about some issue pointed by the Sphinx. It also matches to what we do already with the HTML output. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Documentation/conf.py b/Documentation/conf.py index aaa3f70aafcb..2a02a817b1a0 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -277,11 +277,12 @@ latex_elements = { % Allow generate some pages in landscape \\usepackage{lscape} - % Put notes in gray color and let them be inside a table - - \\definecolor{MyGray}{rgb}{0.80,0.80,0.80} - - \\makeatletter\\newenvironment{graybox}{% + % Put notes in color and let them be inside a table + \\definecolor{NoteColor}{RGB}{204,255,255} + \\definecolor{WarningColor}{RGB}{255,204,204} + \\definecolor{AttentionColor}{RGB}{255,255,204} + \\definecolor{OtherColor}{RGB}{204,204,204} + \\makeatletter\\newenvironment{coloredbox}[1]{% \\newlength{\\py@noticelength} \\setlength{\\fboxrule}{1pt} \\setlength{\\fboxsep}{7pt} @@ -289,20 +290,33 @@ latex_elements = { \\addtolength{\\py@noticelength}{-2\\fboxsep} \\addtolength{\\py@noticelength}{-2\\fboxrule} \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\py@noticelength}}{\\end{minipage}\\end{lrbox}% - \\colorbox{MyGray}{\\usebox{\\@tempboxa}} + \\ifthenelse% + {\\equal{\\py@noticetype}{note}}% + {\\colorbox{NoteColor}{\\usebox{\\@tempboxa}}}% + {% + \\ifthenelse% + {\\equal{\\py@noticetype}{warning}}% + {\\colorbox{WarningColor}{\\usebox{\\@tempboxa}}}% + {% + \\ifthenelse% + {\\equal{\\py@noticetype}{attention}}% + {\\colorbox{AttentionColor}{\\usebox{\\@tempboxa}}}% + {\\colorbox{OtherColor}{\\usebox{\\@tempboxa}}}% + }% + }% }\\makeatother \\makeatletter - \\renewenvironment{notice}[2]{ - \\begin{graybox} - \\bf\\it + \\renewenvironment{notice}[2]{% \\def\\py@noticetype{#1} + \\begin{coloredbox}{#1} + \\bf\\it \\par\\strong{#2} \\csname py@noticestart@#1\\endcsname } { \\csname py@noticeend@\\py@noticetype\\endcsname - \\end{graybox} + \\end{coloredbox} } \\makeatother From ba1377fba7047a86c31981363cbd9e65b1ca2763 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 21 Aug 2016 15:23:04 -0300 Subject: [PATCH 104/591] docs-rst: Fix an warning when in interactive mode When XeLaTeX is in interactive mode, it complains that py@noticelength already exists. Rename it and declare it only once to avoid such messages. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/conf.py b/Documentation/conf.py index 2a02a817b1a0..85e9f16b1d98 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -282,14 +282,14 @@ latex_elements = { \\definecolor{WarningColor}{RGB}{255,204,204} \\definecolor{AttentionColor}{RGB}{255,255,204} \\definecolor{OtherColor}{RGB}{204,204,204} + \\newlength{\\mynoticelength} \\makeatletter\\newenvironment{coloredbox}[1]{% - \\newlength{\\py@noticelength} \\setlength{\\fboxrule}{1pt} \\setlength{\\fboxsep}{7pt} - \\setlength{\\py@noticelength}{\\linewidth} - \\addtolength{\\py@noticelength}{-2\\fboxsep} - \\addtolength{\\py@noticelength}{-2\\fboxrule} - \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\py@noticelength}}{\\end{minipage}\\end{lrbox}% + \\setlength{\\mynoticelength}{\\linewidth} + \\addtolength{\\mynoticelength}{-2\\fboxsep} + \\addtolength{\\mynoticelength}{-2\\fboxrule} + \\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\mynoticelength}}{\\end{minipage}\\end{lrbox}% \\ifthenelse% {\\equal{\\py@noticetype}{note}}% {\\colorbox{NoteColor}{\\usebox{\\@tempboxa}}}% From ca7bfe2c8d9f3aee469a3a36110a95ebb511ee20 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Aug 2016 11:04:49 -0300 Subject: [PATCH 105/591] docs-rst: add package adjustbox We need adjustbox to allow adjusting the size of tables that are bigger than the line width. There are quite a few of them at the media books. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/conf.py b/Documentation/conf.py index 85e9f16b1d98..ab484e56e23c 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -326,6 +326,9 @@ latex_elements = { \\setromanfont{DejaVu Sans} \\setmonofont{DejaVu Sans Mono} + % To allow adjusting table sizes + \\usepackage{adjustbox} + ''' } From b7ff94df5628326d4e204c97e782ecc0f3dfa8e3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 15 Aug 2016 10:47:18 -0300 Subject: [PATCH 106/591] [media] pixfmt-007.rst: use Sphinx math:: expressions Enrich math formulas by using the Sphinx math. That will allow using those formulas on pdf documents as well. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-007.rst | 173 +++++++++++++------- 1 file changed, 113 insertions(+), 60 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index 95d790cbc152..f097268ffc54 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -74,23 +74,29 @@ SMPTE C set, so this colorspace is sometimes called SMPTE C as well. The transfer function defined for SMPTE 170M is the same as the one defined in Rec. 709. - L' = -1.099(-L) :sup:`0.45` + 0.099 for L ≤ -0.018 +.. math:: - L' = 4.5L for -0.018 < L < 0.018 + L' = -1.099(-L)^{0.45} + 0.099 \text{, for } L \le-0.018 - L' = 1.099L :sup:`0.45` - 0.099 for L ≥ 0.018 + L' = 4.5L \text{, for } -0.018 < L < 0.018 + + L' = 1.099L^{0.45} - 0.099 \text{, for } L \ge 0.018 Inverse Transfer function: - L = -((L' - 0.099) / -1.099) :sup:`1/0.45` for L' ≤ -0.081 +.. math:: - L = L' / 4.5 for -0.081 < L' < 0.081 + L = -\left( \frac{L' - 0.099}{-1.099} \right) ^{\frac{1}{0.45}} \text{, for } L' \le -0.081 - L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 + L = \frac{L'}{4.5} \text{, for } -0.081 < L' < 0.081 + + L = \left(\frac{L' + 0.099}{1.099}\right)^{\frac{1}{0.45} } \text{, for } L' \ge 0.081 The luminance (Y') and color difference (Cb and Cr) are obtained with the following ``V4L2_YCBCR_ENC_601`` encoding: +.. math:: + Y' = 0.299R' + 0.587G' + 0.114B' Cb = -0.169R' - 0.331G' + 0.5B' @@ -173,23 +179,29 @@ The full name of this standard is Rec. ITU-R BT.709-5. Transfer function. Normally L is in the range [0…1], but for the extended gamut xvYCC encoding values outside that range are allowed. - L' = -1.099(-L) :sup:`0.45` + 0.099 for L ≤ -0.018 +.. math:: - L' = 4.5L for -0.018 < L < 0.018 + L' = -1.099(-L)^{0.45} + 0.099 \text{, for } L \le -0.018 - L' = 1.099L :sup:`0.45` - 0.099 for L ≥ 0.018 + L' = 4.5L \text{, for } -0.018 < L < 0.018 + + L' = 1.099L^{0.45} - 0.099 \text{, for } L \ge 0.018 Inverse Transfer function: - L = -((L' - 0.099) / -1.099) :sup:`1/0.45` for L' ≤ -0.081 +.. math:: - L = L' / 4.5 for -0.081 < L' < 0.081 + L = -\left( \frac{L' - 0.099}{-1.099} \right)^\frac{1}{0.45} \text{, for } L' \le -0.081 - L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 + L = \frac{L'}{4.5}\text{, for } -0.081 < L' < 0.081 + + L = \left(\frac{L' + 0.099}{1.099}\right)^{\frac{1}{0.45} } \text{, for } L' \ge 0.081 The luminance (Y') and color difference (Cb and Cr) are obtained with the following ``V4L2_YCBCR_ENC_709`` encoding: +.. math:: + Y' = 0.2126R' + 0.7152G' + 0.0722B' Cb = -0.1146R' - 0.3854G' + 0.5B' @@ -214,22 +226,26 @@ similar to the Rec. 709 encoding, but it allows for R', G' and B' values that are outside the range [0…1]. The resulting Y', Cb and Cr values are scaled and offset: - Y' = (219 / 256) * (0.2126R' + 0.7152G' + 0.0722B') + (16 / 256) +.. math:: - Cb = (224 / 256) * (-0.1146R' - 0.3854G' + 0.5B') + Y' = \frac{219}{256} * (0.2126R' + 0.7152G' + 0.0722B') + \frac{16}{256} - Cr = (224 / 256) * (0.5R' - 0.4542G' - 0.0458B') + Cb = \frac{224}{256} * (-0.1146R' - 0.3854G' + 0.5B') + + Cr = \frac{224}{256} * (0.5R' - 0.4542G' - 0.0458B') The xvYCC 601 encoding (``V4L2_YCBCR_ENC_XV601``, :ref:`xvycc`) is similar to the BT.601 encoding, but it allows for R', G' and B' values that are outside the range [0…1]. The resulting Y', Cb and Cr values are scaled and offset: - Y' = (219 / 256) * (0.299R' + 0.587G' + 0.114B') + (16 / 256) +.. math:: - Cb = (224 / 256) * (-0.169R' - 0.331G' + 0.5B') + Y' = \frac{219}{256} * (0.299R' + 0.587G' + 0.114B') + \frac{16}{256} - Cr = (224 / 256) * (0.5R' - 0.419G' - 0.081B') + Cb = \frac{224}{256} * (-0.169R' - 0.331G' + 0.5B') + + Cr = \frac{224}{256} * (0.5R' - 0.419G' - 0.081B') Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be @@ -304,24 +320,30 @@ These chromaticities are identical to the Rec. 709 colorspace. Transfer function. Note that negative values for L are only used by the Y'CbCr conversion. - L' = -1.055(-L) :sup:`1/2.4` + 0.055 for L < -0.0031308 +.. math:: - L' = 12.92L for -0.0031308 ≤ L ≤ 0.0031308 + L' = -1.055(-L)^{\frac{1}{2.4} } + 0.055\text{, for }L < -0.0031308 - L' = 1.055L :sup:`1/2.4` - 0.055 for 0.0031308 < L ≤ 1 + L' = 12.92L\text{, for }-0.0031308 \le L \le 0.0031308 + + L' = 1.055L ^{\frac{1}{2.4} } - 0.055\text{, for }0.0031308 < L \le 1 Inverse Transfer function: - L = -((-L' + 0.055) / 1.055) :sup:`2.4` for L' < -0.04045 +.. math:: - L = L' / 12.92 for -0.04045 ≤ L' ≤ 0.04045 + L = -((-L' + 0.055) / 1.055) ^{2.4}\text{, for }L' < -0.04045 - L = ((L' + 0.055) / 1.055) :sup:`2.4` for L' > 0.04045 + L = L' / 12.92\text{, for }-0.04045 \le L' \le 0.04045 + + L = ((L' + 0.055) / 1.055) ^{2.4}\text{, for }L' > 0.04045 The luminance (Y') and color difference (Cb and Cr) are obtained with the following ``V4L2_YCBCR_ENC_SYCC`` encoding as defined by :ref:`sycc`: +.. math:: + Y' = 0.2990R' + 0.5870G' + 0.1140B' Cb = -0.1687R' - 0.3313G' + 0.5B' @@ -403,15 +425,21 @@ are: Transfer function: - L' = L :sup:`1/2.19921875` +.. math:: + + L' = L ^{\frac{1}{2.19921875}} Inverse Transfer function: - L = L' :sup:`2.19921875` +.. math:: + + L = L'^{(2.19921875)} The luminance (Y') and color difference (Cb and Cr) are obtained with the following ``V4L2_YCBCR_ENC_601`` encoding: +.. math:: + Y' = 0.299R' + 0.587G' + 0.114B' Cb = -0.169R' - 0.331G' + 0.5B' @@ -489,19 +517,25 @@ of the primary colors and the white reference are: Transfer function (same as Rec. 709): - L' = 4.5L for 0 ≤ L < 0.018 +.. math:: - L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1 + L' = 4.5L\text{, for }0 \le L < 0.018 + + L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1 Inverse Transfer function: - L = L' / 4.5 for L' < 0.081 +.. math:: - L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 + L = L' / 4.5\text{, for } L' < 0.081 + + L = \left( \frac{L' + 0.099}{1.099}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081 The luminance (Y') and color difference (Cb and Cr) are obtained with the following ``V4L2_YCBCR_ENC_BT2020`` encoding: +.. math:: + Y' = 0.2627R' + 0.6780G' + 0.0593B' Cb = -0.1396R' - 0.3604G' + 0.5B' @@ -516,23 +550,20 @@ There is also an alternate constant luminance R'G'B' to Yc'CbcCrc Luma: - Yc' = (0.2627R + 0.6780G + 0.0593B)' +.. math:: + :nowrap: -B' - Yc' ≤ 0: - - Cbc = (B' - Yc') / 1.9404 - -B' - Yc' > 0: - - Cbc = (B' - Yc') / 1.5816 - -R' - Yc' ≤ 0: - - Crc = (R' - Y') / 1.7184 - -R' - Yc' > 0: - - Crc = (R' - Y') / 0.9936 + \begin{align*} + Yc' = (0.2627R + 0.6780G + 0.0593B)'& \\ + B' - Yc' \le 0:& \\ + &Cbc = (B' - Yc') / 1.9404 \\ + B' - Yc' > 0: & \\ + &Cbc = (B' - Yc') / 1.5816 \\ + R' - Yc' \le 0:& \\ + &Crc = (R' - Y') / 1.7184 \\ + R' - Yc' > 0:& \\ + &Crc = (R' - Y') / 0.9936 + \end{align*} Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the range [-0.5…0.5]. The Yc'CbcCrc quantization is limited range. @@ -610,11 +641,15 @@ is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is Transfer function: - L' = L :sup:`1/2.6` +.. math:: + + L' = L^{\frac{1}{2.6}} Inverse Transfer function: - L = L' :sup:`2.6` +.. math:: + + L = L'^{(2.6)} Y'CbCr encoding is not specified. V4L2 defaults to Rec. 709. @@ -686,19 +721,25 @@ These chromaticities are identical to the SMPTE 170M colorspace. Transfer function: - L' = 4L for 0 ≤ L < 0.0228 +.. math:: - L' = 1.1115L :sup:`0.45` - 0.1115 for 0.0228 ≤ L ≤ 1 + L' = 4L\text{, for } 0 \le L < 0.0228 + + L' = 1.1115L ^{0.45} - 0.1115\text{, for } 0.0228 \le L \le 1 Inverse Transfer function: - L = L' / 4 for 0 ≤ L' < 0.0913 +.. math:: - L = ((L' + 0.1115) / 1.1115) :sup:`1/0.45` for L' ≥ 0.0913 + L = \frac{L'}{4}\text{, for } 0 \le L' < 0.0913 + + L = \left( \frac{L' + 0.1115}{1.1115}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.0913 The luminance (Y') and color difference (Cb and Cr) are obtained with the following ``V4L2_YCBCR_ENC_SMPTE240M`` encoding: +.. math:: + Y' = 0.2122R' + 0.7013G' + 0.0865B' Cb = -0.1161R' - 0.3839G' + 0.5B' @@ -782,19 +823,25 @@ reference are: The transfer function was never properly defined for NTSC 1953. The Rec. 709 transfer function is recommended in the literature: - L' = 4.5L for 0 ≤ L < 0.018 +.. math:: - L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1 + L' = 4.5L\text{, for } 0 \le L < 0.018 + + L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1 Inverse Transfer function: - L = L' / 4.5 for L' < 0.081 +.. math:: - L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 + L = \frac{L'}{4.5} \text{, for } L' < 0.081 + + L = \left( \frac{L' + 0.099}{1.099}\right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081 The luminance (Y') and color difference (Cb and Cr) are obtained with the following ``V4L2_YCBCR_ENC_601`` encoding: +.. math:: + Y' = 0.299R' + 0.587G' + 0.114B' Cb = -0.169R' - 0.331G' + 0.5B' @@ -874,19 +921,25 @@ are: The transfer function was never properly defined for this colorspace. The Rec. 709 transfer function is recommended in the literature: - L' = 4.5L for 0 ≤ L < 0.018 +.. math:: - L' = 1.099L :sup:`0.45` - 0.099 for 0.018 ≤ L ≤ 1 + L' = 4.5L\text{, for } 0 \le L < 0.018 + + L' = 1.099L ^{0.45} - 0.099\text{, for } 0.018 \le L \le 1 Inverse Transfer function: - L = L' / 4.5 for L' < 0.081 +.. math:: - L = ((L' + 0.099) / 1.099) :sup:`1/0.45` for L' ≥ 0.081 + L = \frac{L'}{4.5} \text{, for } L' < 0.081 + + L = \left(\frac{L' + 0.099}{1.099} \right) ^{\frac{1}{0.45} }\text{, for } L' \ge 0.081 The luminance (Y') and color difference (Cb and Cr) are obtained with the following ``V4L2_YCBCR_ENC_601`` encoding: +.. math:: + Y' = 0.299R' + 0.587G' + 0.114B' Cb = -0.169R' - 0.331G' + 0.5B' From 1b81f010bfd8ce61b79329d7ebb23b62d5d7effb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 12:00:43 -0300 Subject: [PATCH 107/591] [media] docs-next: stop abusing on the cpp domain Now that we have an override for the c domain that will do the right thing for the Kernel, stop abusing on the cpp domain. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/conf_nitpick.py | 33 +++++++++---------- Documentation/media/kapi/dtv-core.rst | 2 +- Documentation/media/kapi/v4l2-dev.rst | 4 +-- Documentation/media/kapi/v4l2-fh.rst | 4 +-- Documentation/media/kapi/v4l2-subdev.rst | 2 +- .../media/uapi/cec/cec-func-close.rst | 2 +- .../media/uapi/cec/cec-func-ioctl.rst | 2 +- .../media/uapi/cec/cec-func-open.rst | 2 +- .../media/uapi/cec/cec-func-poll.rst | 2 +- .../media/uapi/cec/cec-ioc-adap-g-caps.rst | 2 +- .../uapi/cec/cec-ioc-adap-g-log-addrs.rst | 2 +- .../uapi/cec/cec-ioc-adap-g-phys-addr.rst | 2 +- .../media/uapi/cec/cec-ioc-g-mode.rst | 2 +- .../media/uapi/cec/cec-ioc-receive.rst | 2 +- .../dvb/audio-bilingual-channel-select.rst | 2 +- .../media/uapi/dvb/audio-channel-select.rst | 2 +- .../media/uapi/dvb/audio-clear-buffer.rst | 2 +- .../media/uapi/dvb/audio-continue.rst | 2 +- Documentation/media/uapi/dvb/audio-fclose.rst | 2 +- Documentation/media/uapi/dvb/audio-fopen.rst | 2 +- Documentation/media/uapi/dvb/audio-fwrite.rst | 2 +- .../media/uapi/dvb/audio-get-capabilities.rst | 2 +- .../media/uapi/dvb/audio-get-pts.rst | 2 +- .../media/uapi/dvb/audio-get-status.rst | 2 +- Documentation/media/uapi/dvb/audio-pause.rst | 2 +- Documentation/media/uapi/dvb/audio-play.rst | 2 +- .../media/uapi/dvb/audio-select-source.rst | 2 +- .../media/uapi/dvb/audio-set-attributes.rst | 2 +- .../media/uapi/dvb/audio-set-av-sync.rst | 2 +- .../media/uapi/dvb/audio-set-bypass-mode.rst | 2 +- .../media/uapi/dvb/audio-set-ext-id.rst | 2 +- Documentation/media/uapi/dvb/audio-set-id.rst | 2 +- .../media/uapi/dvb/audio-set-karaoke.rst | 2 +- .../media/uapi/dvb/audio-set-mixer.rst | 2 +- .../media/uapi/dvb/audio-set-mute.rst | 2 +- .../media/uapi/dvb/audio-set-streamtype.rst | 2 +- Documentation/media/uapi/dvb/audio-stop.rst | 2 +- Documentation/media/uapi/dvb/ca-fclose.rst | 2 +- Documentation/media/uapi/dvb/ca-fopen.rst | 2 +- Documentation/media/uapi/dvb/ca-get-cap.rst | 2 +- .../media/uapi/dvb/ca-get-descr-info.rst | 2 +- Documentation/media/uapi/dvb/ca-get-msg.rst | 2 +- .../media/uapi/dvb/ca-get-slot-info.rst | 2 +- Documentation/media/uapi/dvb/ca-reset.rst | 2 +- Documentation/media/uapi/dvb/ca-send-msg.rst | 2 +- Documentation/media/uapi/dvb/ca-set-descr.rst | 2 +- Documentation/media/uapi/dvb/ca-set-pid.rst | 2 +- Documentation/media/uapi/dvb/dmx-add-pid.rst | 2 +- Documentation/media/uapi/dvb/dmx-fclose.rst | 2 +- Documentation/media/uapi/dvb/dmx-fopen.rst | 2 +- Documentation/media/uapi/dvb/dmx-fread.rst | 2 +- Documentation/media/uapi/dvb/dmx-fwrite.rst | 2 +- Documentation/media/uapi/dvb/dmx-get-caps.rst | 2 +- .../media/uapi/dvb/dmx-get-event.rst | 2 +- .../media/uapi/dvb/dmx-get-pes-pids.rst | 2 +- Documentation/media/uapi/dvb/dmx-get-stc.rst | 2 +- .../media/uapi/dvb/dmx-remove-pid.rst | 2 +- .../media/uapi/dvb/dmx-set-buffer-size.rst | 2 +- .../media/uapi/dvb/dmx-set-filter.rst | 2 +- .../media/uapi/dvb/dmx-set-pes-filter.rst | 2 +- .../media/uapi/dvb/dmx-set-source.rst | 2 +- Documentation/media/uapi/dvb/dmx-start.rst | 2 +- Documentation/media/uapi/dvb/dmx-stop.rst | 2 +- .../uapi/dvb/fe-diseqc-recv-slave-reply.rst | 2 +- .../uapi/dvb/fe-diseqc-reset-overload.rst | 2 +- .../media/uapi/dvb/fe-diseqc-send-burst.rst | 2 +- .../uapi/dvb/fe-diseqc-send-master-cmd.rst | 2 +- .../dvb/fe-dishnetwork-send-legacy-cmd.rst | 2 +- .../uapi/dvb/fe-enable-high-lnb-voltage.rst | 2 +- Documentation/media/uapi/dvb/fe-get-event.rst | 2 +- .../media/uapi/dvb/fe-get-frontend.rst | 2 +- Documentation/media/uapi/dvb/fe-get-info.rst | 2 +- .../media/uapi/dvb/fe-get-property.rst | 2 +- Documentation/media/uapi/dvb/fe-read-ber.rst | 2 +- .../uapi/dvb/fe-read-signal-strength.rst | 2 +- Documentation/media/uapi/dvb/fe-read-snr.rst | 2 +- .../media/uapi/dvb/fe-read-status.rst | 2 +- .../uapi/dvb/fe-read-uncorrected-blocks.rst | 2 +- .../uapi/dvb/fe-set-frontend-tune-mode.rst | 2 +- .../media/uapi/dvb/fe-set-frontend.rst | 2 +- Documentation/media/uapi/dvb/fe-set-tone.rst | 2 +- .../media/uapi/dvb/fe-set-voltage.rst | 2 +- .../media/uapi/dvb/frontend_f_close.rst | 2 +- .../media/uapi/dvb/frontend_f_open.rst | 2 +- Documentation/media/uapi/dvb/net-add-if.rst | 2 +- Documentation/media/uapi/dvb/net-get-if.rst | 2 +- .../media/uapi/dvb/net-remove-if.rst | 2 +- .../media/uapi/dvb/video-clear-buffer.rst | 2 +- .../media/uapi/dvb/video-command.rst | 2 +- .../media/uapi/dvb/video-continue.rst | 2 +- .../media/uapi/dvb/video-fast-forward.rst | 2 +- Documentation/media/uapi/dvb/video-fclose.rst | 2 +- Documentation/media/uapi/dvb/video-fopen.rst | 2 +- Documentation/media/uapi/dvb/video-freeze.rst | 2 +- Documentation/media/uapi/dvb/video-fwrite.rst | 2 +- .../media/uapi/dvb/video-get-capabilities.rst | 2 +- .../media/uapi/dvb/video-get-event.rst | 2 +- .../media/uapi/dvb/video-get-frame-count.rst | 2 +- .../media/uapi/dvb/video-get-frame-rate.rst | 2 +- .../media/uapi/dvb/video-get-navi.rst | 2 +- .../media/uapi/dvb/video-get-pts.rst | 2 +- .../media/uapi/dvb/video-get-size.rst | 2 +- .../media/uapi/dvb/video-get-status.rst | 2 +- Documentation/media/uapi/dvb/video-play.rst | 2 +- .../media/uapi/dvb/video-select-source.rst | 2 +- .../media/uapi/dvb/video-set-attributes.rst | 2 +- .../media/uapi/dvb/video-set-blank.rst | 2 +- .../uapi/dvb/video-set-display-format.rst | 2 +- .../media/uapi/dvb/video-set-format.rst | 2 +- .../media/uapi/dvb/video-set-highlight.rst | 2 +- Documentation/media/uapi/dvb/video-set-id.rst | 2 +- .../media/uapi/dvb/video-set-spu-palette.rst | 2 +- .../media/uapi/dvb/video-set-spu.rst | 2 +- .../media/uapi/dvb/video-set-streamtype.rst | 2 +- .../media/uapi/dvb/video-set-system.rst | 2 +- .../media/uapi/dvb/video-slowmotion.rst | 2 +- .../media/uapi/dvb/video-stillpicture.rst | 2 +- Documentation/media/uapi/dvb/video-stop.rst | 2 +- .../media/uapi/dvb/video-try-command.rst | 2 +- .../media/uapi/mediactl/media-func-close.rst | 2 +- .../media/uapi/mediactl/media-func-ioctl.rst | 2 +- .../media/uapi/mediactl/media-func-open.rst | 2 +- .../uapi/mediactl/media-ioc-device-info.rst | 2 +- .../uapi/mediactl/media-ioc-enum-entities.rst | 2 +- .../uapi/mediactl/media-ioc-enum-links.rst | 2 +- .../uapi/mediactl/media-ioc-g-topology.rst | 2 +- .../uapi/mediactl/media-ioc-setup-link.rst | 2 +- .../media/uapi/rc/lirc-get-features.rst | 2 +- .../media/uapi/rc/lirc-get-length.rst | 2 +- .../media/uapi/rc/lirc-get-rec-mode.rst | 2 +- .../media/uapi/rc/lirc-get-rec-resolution.rst | 2 +- .../media/uapi/rc/lirc-get-send-mode.rst | 2 +- .../media/uapi/rc/lirc-get-timeout.rst | 2 +- Documentation/media/uapi/rc/lirc-read.rst | 2 +- .../uapi/rc/lirc-set-measure-carrier-mode.rst | 2 +- .../uapi/rc/lirc-set-rec-carrier-range.rst | 2 +- .../media/uapi/rc/lirc-set-rec-carrier.rst | 2 +- .../uapi/rc/lirc-set-rec-timeout-reports.rst | 2 +- .../media/uapi/rc/lirc-set-rec-timeout.rst | 2 +- .../media/uapi/rc/lirc-set-send-carrier.rst | 2 +- .../uapi/rc/lirc-set-send-duty-cycle.rst | 2 +- .../uapi/rc/lirc-set-transmitter-mask.rst | 2 +- .../uapi/rc/lirc-set-wideband-receiver.rst | 2 +- Documentation/media/uapi/rc/lirc-write.rst | 2 +- Documentation/media/uapi/v4l/func-close.rst | 2 +- Documentation/media/uapi/v4l/func-ioctl.rst | 2 +- Documentation/media/uapi/v4l/func-mmap.rst | 2 +- Documentation/media/uapi/v4l/func-munmap.rst | 2 +- Documentation/media/uapi/v4l/func-open.rst | 2 +- Documentation/media/uapi/v4l/func-poll.rst | 2 +- Documentation/media/uapi/v4l/func-read.rst | 2 +- Documentation/media/uapi/v4l/func-select.rst | 2 +- Documentation/media/uapi/v4l/func-write.rst | 2 +- .../media/uapi/v4l/vidioc-create-bufs.rst | 2 +- .../media/uapi/v4l/vidioc-cropcap.rst | 2 +- .../media/uapi/v4l/vidioc-dbg-g-chip-info.rst | 2 +- .../media/uapi/v4l/vidioc-dbg-g-register.rst | 4 +-- .../media/uapi/v4l/vidioc-decoder-cmd.rst | 2 +- .../media/uapi/v4l/vidioc-dqevent.rst | 2 +- .../media/uapi/v4l/vidioc-dv-timings-cap.rst | 2 +- .../media/uapi/v4l/vidioc-encoder-cmd.rst | 2 +- .../media/uapi/v4l/vidioc-enum-dv-timings.rst | 2 +- .../media/uapi/v4l/vidioc-enum-fmt.rst | 2 +- .../uapi/v4l/vidioc-enum-frameintervals.rst | 2 +- .../media/uapi/v4l/vidioc-enum-framesizes.rst | 2 +- .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 2 +- .../media/uapi/v4l/vidioc-enumaudio.rst | 2 +- .../media/uapi/v4l/vidioc-enumaudioout.rst | 2 +- .../media/uapi/v4l/vidioc-enuminput.rst | 2 +- .../media/uapi/v4l/vidioc-enumoutput.rst | 2 +- .../media/uapi/v4l/vidioc-enumstd.rst | 2 +- .../media/uapi/v4l/vidioc-expbuf.rst | 2 +- .../media/uapi/v4l/vidioc-g-audio.rst | 4 +-- .../media/uapi/v4l/vidioc-g-audioout.rst | 4 +-- .../media/uapi/v4l/vidioc-g-crop.rst | 4 +-- .../media/uapi/v4l/vidioc-g-ctrl.rst | 2 +- .../media/uapi/v4l/vidioc-g-dv-timings.rst | 2 +- .../media/uapi/v4l/vidioc-g-edid.rst | 2 +- .../media/uapi/v4l/vidioc-g-enc-index.rst | 2 +- .../media/uapi/v4l/vidioc-g-ext-ctrls.rst | 2 +- .../media/uapi/v4l/vidioc-g-fbuf.rst | 4 +-- Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 2 +- .../media/uapi/v4l/vidioc-g-frequency.rst | 4 +-- .../media/uapi/v4l/vidioc-g-input.rst | 2 +- .../media/uapi/v4l/vidioc-g-jpegcomp.rst | 4 +-- .../media/uapi/v4l/vidioc-g-modulator.rst | 4 +-- .../media/uapi/v4l/vidioc-g-output.rst | 2 +- .../media/uapi/v4l/vidioc-g-parm.rst | 2 +- .../media/uapi/v4l/vidioc-g-priority.rst | 4 +-- .../media/uapi/v4l/vidioc-g-selection.rst | 2 +- .../uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 2 +- Documentation/media/uapi/v4l/vidioc-g-std.rst | 4 +-- .../media/uapi/v4l/vidioc-g-tuner.rst | 4 +-- .../media/uapi/v4l/vidioc-log-status.rst | 2 +- .../media/uapi/v4l/vidioc-overlay.rst | 2 +- .../media/uapi/v4l/vidioc-prepare-buf.rst | 2 +- Documentation/media/uapi/v4l/vidioc-qbuf.rst | 2 +- .../uapi/v4l/vidioc-query-dv-timings.rst | 2 +- .../media/uapi/v4l/vidioc-querybuf.rst | 2 +- .../media/uapi/v4l/vidioc-querycap.rst | 2 +- .../media/uapi/v4l/vidioc-queryctrl.rst | 6 ++-- .../media/uapi/v4l/vidioc-querystd.rst | 2 +- .../media/uapi/v4l/vidioc-reqbufs.rst | 2 +- .../media/uapi/v4l/vidioc-s-hw-freq-seek.rst | 2 +- .../media/uapi/v4l/vidioc-streamon.rst | 2 +- .../v4l/vidioc-subdev-enum-frame-interval.rst | 2 +- .../v4l/vidioc-subdev-enum-frame-size.rst | 2 +- .../uapi/v4l/vidioc-subdev-enum-mbus-code.rst | 2 +- .../media/uapi/v4l/vidioc-subdev-g-crop.rst | 4 +-- .../media/uapi/v4l/vidioc-subdev-g-fmt.rst | 2 +- .../v4l/vidioc-subdev-g-frame-interval.rst | 2 +- .../uapi/v4l/vidioc-subdev-g-selection.rst | 2 +- .../media/uapi/v4l/vidioc-subscribe-event.rst | 2 +- 213 files changed, 244 insertions(+), 245 deletions(-) diff --git a/Documentation/media/conf_nitpick.py b/Documentation/media/conf_nitpick.py index 11beac2e68fb..227deee68c88 100644 --- a/Documentation/media/conf_nitpick.py +++ b/Documentation/media/conf_nitpick.py @@ -39,55 +39,54 @@ nitpick_ignore = [ ("c:func", "write"), ("c:type", "atomic_t"), ("c:type", "bool"), + ("c:type", "boolean"), ("c:type", "buf_queue"), ("c:type", "device"), ("c:type", "device_driver"), ("c:type", "device_node"), ("c:type", "enum"), + ("c:type", "fd"), + ("c:type", "fd_set"), ("c:type", "file"), ("c:type", "i2c_adapter"), ("c:type", "i2c_board_info"), ("c:type", "i2c_client"), + ("c:type", "int16_t"), ("c:type", "ktime_t"), ("c:type", "led_classdev_flash"), ("c:type", "list_head"), ("c:type", "lock_class_key"), ("c:type", "module"), ("c:type", "mutex"), + ("c:type", "NULL"), + ("c:type", "off_t"), ("c:type", "pci_dev"), ("c:type", "pdvbdev"), + ("c:type", "pollfd"), ("c:type", "poll_table_struct"), ("c:type", "s32"), ("c:type", "s64"), ("c:type", "sd"), + ("c:type", "size_t"), ("c:type", "spi_board_info"), ("c:type", "spi_device"), ("c:type", "spi_master"), + ("c:type", "ssize_t"), ("c:type", "struct fb_fix_screeninfo"), ("c:type", "struct pollfd"), ("c:type", "struct timeval"), ("c:type", "struct video_capability"), + ("c:type", "timeval"), + ("c:type", "__u16"), ("c:type", "u16"), + ("c:type", "__u32"), ("c:type", "u32"), + ("c:type", "__u64"), ("c:type", "u64"), ("c:type", "u8"), + ("c:type", "uint16_t"), + ("c:type", "uint32_t"), ("c:type", "union"), ("c:type", "usb_device"), - - ("cpp:type", "boolean"), - ("cpp:type", "fd"), - ("cpp:type", "fd_set"), - ("cpp:type", "int16_t"), - ("cpp:type", "NULL"), - ("cpp:type", "off_t"), - ("cpp:type", "pollfd"), - ("cpp:type", "size_t"), - ("cpp:type", "ssize_t"), - ("cpp:type", "timeval"), - ("cpp:type", "__u16"), - ("cpp:type", "__u32"), - ("cpp:type", "__u64"), - ("cpp:type", "uint16_t"), - ("cpp:type", "uint32_t"), - ("cpp:type", "video_system_t"), + ("c:type", "video_system_t"), ] diff --git a/Documentation/media/kapi/dtv-core.rst b/Documentation/media/kapi/dtv-core.rst index dd96e846fef9..41df9f144fcb 100644 --- a/Documentation/media/kapi/dtv-core.rst +++ b/Documentation/media/kapi/dtv-core.rst @@ -121,7 +121,7 @@ triggered by a hardware interrupt, it is recommended to use the Linux bottom half mechanism or start a tasklet instead of making the callback function call directly from a hardware interrupt. -This mechanism is implemented by :c:func:`dmx_ts_cb()` and :cpp:func:`dmx_section_cb()` +This mechanism is implemented by :c:func:`dmx_ts_cb()` and :c:func:`dmx_section_cb()` callbacks. .. kernel-doc:: drivers/media/dvb-core/demux.h diff --git a/Documentation/media/kapi/v4l2-dev.rst b/Documentation/media/kapi/v4l2-dev.rst index 429883b2f6ef..d07258a362d1 100644 --- a/Documentation/media/kapi/v4l2-dev.rst +++ b/Documentation/media/kapi/v4l2-dev.rst @@ -166,7 +166,7 @@ something. In the case of :ref:`videobuf2 ` you will need to implement the ``wait_prepare()`` and ``wait_finish()`` callbacks to unlock/lock if applicable. If you use the ``queue->lock`` pointer, then you can use the helper functions -:c:func:`vb2_ops_wait_prepare` and :cpp:func:`vb2_ops_wait_finish`. +:c:func:`vb2_ops_wait_prepare` and :c:func:`vb2_ops_wait_finish`. The implementation of a hotplug disconnect should also take the lock from :c:type:`video_device` before calling v4l2_device_disconnect. If you are also @@ -335,7 +335,7 @@ And this function: returns the video_device belonging to the file struct. -The :c:func:`video_devdata` function combines :cpp:func:`video_get_drvdata` +The :c:func:`video_devdata` function combines :c:func:`video_get_drvdata` with :c:func:`video_devdata`: :c:func:`video_drvdata ` diff --git a/Documentation/media/kapi/v4l2-fh.rst b/Documentation/media/kapi/v4l2-fh.rst index 9e87d5ca3e4a..3ee64adf4635 100644 --- a/Documentation/media/kapi/v4l2-fh.rst +++ b/Documentation/media/kapi/v4l2-fh.rst @@ -21,8 +21,8 @@ function by the driver. In many cases the struct :c:type:`v4l2_fh` will be embedded in a larger structure. In that case you should call: -#) :c:func:`v4l2_fh_init` and :cpp:func:`v4l2_fh_add` in ``open()`` -#) :c:func:`v4l2_fh_del` and :cpp:func:`v4l2_fh_exit` in ``release()`` +#) :c:func:`v4l2_fh_init` and :c:func:`v4l2_fh_add` in ``open()`` +#) :c:func:`v4l2_fh_del` and :c:func:`v4l2_fh_exit` in ``release()`` Drivers can extract their own file handle structure by using the container_of macro. diff --git a/Documentation/media/kapi/v4l2-subdev.rst b/Documentation/media/kapi/v4l2-subdev.rst index d767b61e9842..fcecce01a35c 100644 --- a/Documentation/media/kapi/v4l2-subdev.rst +++ b/Documentation/media/kapi/v4l2-subdev.rst @@ -27,7 +27,7 @@ methods. Bridges might also need to store per-subdev private data, such as a pointer to bridge-specific per-subdev private data. The :c:type:`v4l2_subdev` structure provides host private data for that purpose that can be accessed with -:c:func:`v4l2_get_subdev_hostdata` and :cpp:func:`v4l2_set_subdev_hostdata`. +:c:func:`v4l2_get_subdev_hostdata` and :c:func:`v4l2_set_subdev_hostdata`. From the bridge driver perspective, you load the sub-device module and somehow obtain the :c:type:`v4l2_subdev` pointer. For i2c devices this is easy: you call diff --git a/Documentation/media/uapi/cec/cec-func-close.rst b/Documentation/media/uapi/cec/cec-func-close.rst index bdbb9e545ae4..c763496b243f 100644 --- a/Documentation/media/uapi/cec/cec-func-close.rst +++ b/Documentation/media/uapi/cec/cec-func-close.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int close( int fd ) +.. c:function:: int close( int fd ) Arguments ========= diff --git a/Documentation/media/uapi/cec/cec-func-ioctl.rst b/Documentation/media/uapi/cec/cec-func-ioctl.rst index 170bdd56211e..116132b19515 100644 --- a/Documentation/media/uapi/cec/cec-func-ioctl.rst +++ b/Documentation/media/uapi/cec/cec-func-ioctl.rst @@ -19,7 +19,7 @@ Synopsis #include -.. cpp:function:: int ioctl( int fd, int request, void *argp ) +.. c:function:: int ioctl( int fd, int request, void *argp ) Arguments ========= diff --git a/Documentation/media/uapi/cec/cec-func-open.rst b/Documentation/media/uapi/cec/cec-func-open.rst index 3d55e9f2f64d..33e5b5379fa3 100644 --- a/Documentation/media/uapi/cec/cec-func-open.rst +++ b/Documentation/media/uapi/cec/cec-func-open.rst @@ -19,7 +19,7 @@ Synopsis #include -.. cpp:function:: int open( const char *device_name, int flags ) +.. c:function:: int open( const char *device_name, int flags ) Arguments diff --git a/Documentation/media/uapi/cec/cec-func-poll.rst b/Documentation/media/uapi/cec/cec-func-poll.rst index 5d1e0525056e..a5225185f98c 100644 --- a/Documentation/media/uapi/cec/cec-func-poll.rst +++ b/Documentation/media/uapi/cec/cec-func-poll.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout ) +.. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout ) Arguments ========= diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst index 89ba813e577c..cc68e0dcea7e 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst @@ -14,7 +14,7 @@ CEC_ADAP_G_CAPS - Query device capabilities Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct cec_caps *argp ) +.. c:function:: int ioctl( int fd, int request, struct cec_caps *argp ) Arguments ========= diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index 42f8e856ec55..9de2a005f6fb 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst @@ -17,7 +17,7 @@ CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS - Get or set the logical addresses Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct cec_log_addrs *argp ) +.. c:function:: int ioctl( int fd, int request, struct cec_log_addrs *argp ) Arguments diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst index c50aa3ee1e0d..9502d6f25798 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst @@ -17,7 +17,7 @@ CEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR - Get or set the physical address Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u16 *argp ) +.. c:function:: int ioctl( int fd, int request, __u16 *argp ) Arguments ========= diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst index b75ed7057f7c..a33522267d47 100644 --- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst @@ -13,7 +13,7 @@ CEC_G_MODE, CEC_S_MODE - Get or set exclusive use of the CEC adapter Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *argp ) +.. c:function:: int ioctl( int fd, int request, __u32 *argp ) Arguments ========= diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index 821562bc8c7a..99d875038f61 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -16,7 +16,7 @@ CEC_RECEIVE, CEC_TRANSMIT - Receive or transmit a CEC message Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct cec_msg *argp ) +.. c:function:: int ioctl( int fd, int request, struct cec_msg *argp ) Arguments ========= diff --git a/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst b/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst index dbe20ff38e83..841c9759d5e0 100644 --- a/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst +++ b/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst @@ -15,7 +15,7 @@ AUDIO_BILINGUAL_CHANNEL_SELECT Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_BILINGUAL_CHANNEL_SELECT, audio_channel_select_t) +.. c:function:: int ioctl(int fd, int request = AUDIO_BILINGUAL_CHANNEL_SELECT, audio_channel_select_t) Arguments diff --git a/Documentation/media/uapi/dvb/audio-channel-select.rst b/Documentation/media/uapi/dvb/audio-channel-select.rst index 69df4c0f2fb2..f2dd79903c49 100644 --- a/Documentation/media/uapi/dvb/audio-channel-select.rst +++ b/Documentation/media/uapi/dvb/audio-channel-select.rst @@ -15,7 +15,7 @@ AUDIO_CHANNEL_SELECT Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_CHANNEL_SELECT, audio_channel_select_t) +.. c:function:: int ioctl(int fd, int request = AUDIO_CHANNEL_SELECT, audio_channel_select_t) Arguments diff --git a/Documentation/media/uapi/dvb/audio-clear-buffer.rst b/Documentation/media/uapi/dvb/audio-clear-buffer.rst index a3dec29bdc69..a576c6b160a4 100644 --- a/Documentation/media/uapi/dvb/audio-clear-buffer.rst +++ b/Documentation/media/uapi/dvb/audio-clear-buffer.rst @@ -15,7 +15,7 @@ AUDIO_CLEAR_BUFFER Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_CLEAR_BUFFER) +.. c:function:: int ioctl(int fd, int request = AUDIO_CLEAR_BUFFER) Arguments diff --git a/Documentation/media/uapi/dvb/audio-continue.rst b/Documentation/media/uapi/dvb/audio-continue.rst index 053627dd61e7..b513a39f0935 100644 --- a/Documentation/media/uapi/dvb/audio-continue.rst +++ b/Documentation/media/uapi/dvb/audio-continue.rst @@ -15,7 +15,7 @@ AUDIO_CONTINUE Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_CONTINUE) +.. c:function:: int ioctl(int fd, int request = AUDIO_CONTINUE) Arguments diff --git a/Documentation/media/uapi/dvb/audio-fclose.rst b/Documentation/media/uapi/dvb/audio-fclose.rst index e5d4225cd9d7..e515fb353a14 100644 --- a/Documentation/media/uapi/dvb/audio-fclose.rst +++ b/Documentation/media/uapi/dvb/audio-fclose.rst @@ -15,7 +15,7 @@ DVB audio close() Synopsis -------- -.. cpp:function:: int close(int fd) +.. c:function:: int close(int fd) Arguments diff --git a/Documentation/media/uapi/dvb/audio-fopen.rst b/Documentation/media/uapi/dvb/audio-fopen.rst index 3ef4fd62ffb6..b629956bca5d 100644 --- a/Documentation/media/uapi/dvb/audio-fopen.rst +++ b/Documentation/media/uapi/dvb/audio-fopen.rst @@ -15,7 +15,7 @@ DVB audio open() Synopsis -------- -.. cpp:function:: int open(const char *deviceName, int flags) +.. c:function:: int open(const char *deviceName, int flags) Arguments diff --git a/Documentation/media/uapi/dvb/audio-fwrite.rst b/Documentation/media/uapi/dvb/audio-fwrite.rst index ca95b9be0c2a..f9307053064f 100644 --- a/Documentation/media/uapi/dvb/audio-fwrite.rst +++ b/Documentation/media/uapi/dvb/audio-fwrite.rst @@ -15,7 +15,7 @@ DVB audio write() Synopsis -------- -.. cpp:function:: size_t write(int fd, const void *buf, size_t count) +.. c:function:: size_t write(int fd, const void *buf, size_t count) Arguments diff --git a/Documentation/media/uapi/dvb/audio-get-capabilities.rst b/Documentation/media/uapi/dvb/audio-get-capabilities.rst index e274a8d53785..8b6fdc664f9d 100644 --- a/Documentation/media/uapi/dvb/audio-get-capabilities.rst +++ b/Documentation/media/uapi/dvb/audio-get-capabilities.rst @@ -15,7 +15,7 @@ AUDIO_GET_CAPABILITIES Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_GET_CAPABILITIES, unsigned int *cap) +.. c:function:: int ioctl(int fd, int request = AUDIO_GET_CAPABILITIES, unsigned int *cap) Arguments diff --git a/Documentation/media/uapi/dvb/audio-get-pts.rst b/Documentation/media/uapi/dvb/audio-get-pts.rst index 5f875508b833..246c78c003de 100644 --- a/Documentation/media/uapi/dvb/audio-get-pts.rst +++ b/Documentation/media/uapi/dvb/audio-get-pts.rst @@ -15,7 +15,7 @@ AUDIO_GET_PTS Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_GET_PTS, __u64 *pts) +.. c:function:: int ioctl(int fd, int request = AUDIO_GET_PTS, __u64 *pts) Arguments diff --git a/Documentation/media/uapi/dvb/audio-get-status.rst b/Documentation/media/uapi/dvb/audio-get-status.rst index cbd822773d85..b0a550af87b3 100644 --- a/Documentation/media/uapi/dvb/audio-get-status.rst +++ b/Documentation/media/uapi/dvb/audio-get-status.rst @@ -15,7 +15,7 @@ AUDIO_GET_STATUS Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_GET_STATUS, struct audio_status *status) +.. c:function:: int ioctl(int fd, int request = AUDIO_GET_STATUS, struct audio_status *status) Arguments diff --git a/Documentation/media/uapi/dvb/audio-pause.rst b/Documentation/media/uapi/dvb/audio-pause.rst index 9ca263e90c6c..86652c3bca06 100644 --- a/Documentation/media/uapi/dvb/audio-pause.rst +++ b/Documentation/media/uapi/dvb/audio-pause.rst @@ -15,7 +15,7 @@ AUDIO_PAUSE Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_PAUSE) +.. c:function:: int ioctl(int fd, int request = AUDIO_PAUSE) Arguments diff --git a/Documentation/media/uapi/dvb/audio-play.rst b/Documentation/media/uapi/dvb/audio-play.rst index db4d7203acc5..1af708375821 100644 --- a/Documentation/media/uapi/dvb/audio-play.rst +++ b/Documentation/media/uapi/dvb/audio-play.rst @@ -15,7 +15,7 @@ AUDIO_PLAY Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_PLAY) +.. c:function:: int ioctl(int fd, int request = AUDIO_PLAY) Arguments diff --git a/Documentation/media/uapi/dvb/audio-select-source.rst b/Documentation/media/uapi/dvb/audio-select-source.rst index b806d806a46f..3e873d9cb345 100644 --- a/Documentation/media/uapi/dvb/audio-select-source.rst +++ b/Documentation/media/uapi/dvb/audio-select-source.rst @@ -15,7 +15,7 @@ AUDIO_SELECT_SOURCE Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_SELECT_SOURCE, audio_stream_source_t source) +.. c:function:: int ioctl(int fd, int request = AUDIO_SELECT_SOURCE, audio_stream_source_t source) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-attributes.rst b/Documentation/media/uapi/dvb/audio-set-attributes.rst index 18667cea2cdf..43ff50279742 100644 --- a/Documentation/media/uapi/dvb/audio-set-attributes.rst +++ b/Documentation/media/uapi/dvb/audio-set-attributes.rst @@ -15,7 +15,7 @@ AUDIO_SET_ATTRIBUTES Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = AUDIO_SET_ATTRIBUTES, audio_attributes_t attr ) +.. c:function:: int ioctl(fd, int request = AUDIO_SET_ATTRIBUTES, audio_attributes_t attr ) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-av-sync.rst b/Documentation/media/uapi/dvb/audio-set-av-sync.rst index 6f7e26fa4cd1..4ecfb75d28f1 100644 --- a/Documentation/media/uapi/dvb/audio-set-av-sync.rst +++ b/Documentation/media/uapi/dvb/audio-set-av-sync.rst @@ -15,7 +15,7 @@ AUDIO_SET_AV_SYNC Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_SET_AV_SYNC, boolean state) +.. c:function:: int ioctl(int fd, int request = AUDIO_SET_AV_SYNC, boolean state) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-bypass-mode.rst b/Documentation/media/uapi/dvb/audio-set-bypass-mode.rst index 30bcaca14c3f..b21d142ec31c 100644 --- a/Documentation/media/uapi/dvb/audio-set-bypass-mode.rst +++ b/Documentation/media/uapi/dvb/audio-set-bypass-mode.rst @@ -15,7 +15,7 @@ AUDIO_SET_BYPASS_MODE Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_SET_BYPASS_MODE, boolean mode) +.. c:function:: int ioctl(int fd, int request = AUDIO_SET_BYPASS_MODE, boolean mode) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-ext-id.rst b/Documentation/media/uapi/dvb/audio-set-ext-id.rst index 049414db8ef6..1b5b8893a00b 100644 --- a/Documentation/media/uapi/dvb/audio-set-ext-id.rst +++ b/Documentation/media/uapi/dvb/audio-set-ext-id.rst @@ -15,7 +15,7 @@ AUDIO_SET_EXT_ID Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = AUDIO_SET_EXT_ID, int id) +.. c:function:: int ioctl(fd, int request = AUDIO_SET_EXT_ID, int id) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-id.rst b/Documentation/media/uapi/dvb/audio-set-id.rst index a664dc1955cb..fed99eae52cb 100644 --- a/Documentation/media/uapi/dvb/audio-set-id.rst +++ b/Documentation/media/uapi/dvb/audio-set-id.rst @@ -15,7 +15,7 @@ AUDIO_SET_ID Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_SET_ID, int id) +.. c:function:: int ioctl(int fd, int request = AUDIO_SET_ID, int id) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-karaoke.rst b/Documentation/media/uapi/dvb/audio-set-karaoke.rst index b55f8380b9cd..ebb2d41bbec3 100644 --- a/Documentation/media/uapi/dvb/audio-set-karaoke.rst +++ b/Documentation/media/uapi/dvb/audio-set-karaoke.rst @@ -15,7 +15,7 @@ AUDIO_SET_KARAOKE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = AUDIO_SET_KARAOKE, audio_karaoke_t *karaoke) +.. c:function:: int ioctl(fd, int request = AUDIO_SET_KARAOKE, audio_karaoke_t *karaoke) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-mixer.rst b/Documentation/media/uapi/dvb/audio-set-mixer.rst index 67821729c2b6..ce4b2a63917e 100644 --- a/Documentation/media/uapi/dvb/audio-set-mixer.rst +++ b/Documentation/media/uapi/dvb/audio-set-mixer.rst @@ -15,7 +15,7 @@ AUDIO_SET_MIXER Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_SET_MIXER, audio_mixer_t *mix) +.. c:function:: int ioctl(int fd, int request = AUDIO_SET_MIXER, audio_mixer_t *mix) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-mute.rst b/Documentation/media/uapi/dvb/audio-set-mute.rst index ebaba95ee278..a2469267508b 100644 --- a/Documentation/media/uapi/dvb/audio-set-mute.rst +++ b/Documentation/media/uapi/dvb/audio-set-mute.rst @@ -15,7 +15,7 @@ AUDIO_SET_MUTE Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_SET_MUTE, boolean state) +.. c:function:: int ioctl(int fd, int request = AUDIO_SET_MUTE, boolean state) Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-streamtype.rst b/Documentation/media/uapi/dvb/audio-set-streamtype.rst index dfb9a6c00d88..4b13c9b9dffe 100644 --- a/Documentation/media/uapi/dvb/audio-set-streamtype.rst +++ b/Documentation/media/uapi/dvb/audio-set-streamtype.rst @@ -15,7 +15,7 @@ AUDIO_SET_STREAMTYPE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, int type) +.. c:function:: int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, int type) Arguments diff --git a/Documentation/media/uapi/dvb/audio-stop.rst b/Documentation/media/uapi/dvb/audio-stop.rst index 449127e3f2aa..d9430978096f 100644 --- a/Documentation/media/uapi/dvb/audio-stop.rst +++ b/Documentation/media/uapi/dvb/audio-stop.rst @@ -15,7 +15,7 @@ AUDIO_STOP Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = AUDIO_STOP) +.. c:function:: int ioctl(int fd, int request = AUDIO_STOP) Arguments diff --git a/Documentation/media/uapi/dvb/ca-fclose.rst b/Documentation/media/uapi/dvb/ca-fclose.rst index 16d7a1e76193..f2ea50b87485 100644 --- a/Documentation/media/uapi/dvb/ca-fclose.rst +++ b/Documentation/media/uapi/dvb/ca-fclose.rst @@ -15,7 +15,7 @@ DVB CA close() Synopsis -------- -.. cpp:function:: int close(int fd) +.. c:function:: int close(int fd) Arguments diff --git a/Documentation/media/uapi/dvb/ca-fopen.rst b/Documentation/media/uapi/dvb/ca-fopen.rst index 9960fc76189c..8085a73e81c5 100644 --- a/Documentation/media/uapi/dvb/ca-fopen.rst +++ b/Documentation/media/uapi/dvb/ca-fopen.rst @@ -15,7 +15,7 @@ DVB CA open() Synopsis -------- -.. cpp:function:: int open(const char *deviceName, int flags) +.. c:function:: int open(const char *deviceName, int flags) Arguments diff --git a/Documentation/media/uapi/dvb/ca-get-cap.rst b/Documentation/media/uapi/dvb/ca-get-cap.rst index 891fbf2d9a84..55e49fd93c2c 100644 --- a/Documentation/media/uapi/dvb/ca-get-cap.rst +++ b/Documentation/media/uapi/dvb/ca-get-cap.rst @@ -15,7 +15,7 @@ CA_GET_CAP Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = CA_GET_CAP, ca_caps_t *) +.. c:function:: int ioctl(fd, int request = CA_GET_CAP, ca_caps_t *) Arguments diff --git a/Documentation/media/uapi/dvb/ca-get-descr-info.rst b/Documentation/media/uapi/dvb/ca-get-descr-info.rst index cf8e8242db66..e546e58ef7f8 100644 --- a/Documentation/media/uapi/dvb/ca-get-descr-info.rst +++ b/Documentation/media/uapi/dvb/ca-get-descr-info.rst @@ -15,7 +15,7 @@ CA_GET_DESCR_INFO Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = CA_GET_DESCR_INFO, ca_descr_info_t *) +.. c:function:: int ioctl(fd, int request = CA_GET_DESCR_INFO, ca_descr_info_t *) Arguments diff --git a/Documentation/media/uapi/dvb/ca-get-msg.rst b/Documentation/media/uapi/dvb/ca-get-msg.rst index 56004d5ea3ab..e0d2c8853e63 100644 --- a/Documentation/media/uapi/dvb/ca-get-msg.rst +++ b/Documentation/media/uapi/dvb/ca-get-msg.rst @@ -15,7 +15,7 @@ CA_GET_MSG Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = CA_GET_MSG, ca_msg_t *) +.. c:function:: int ioctl(fd, int request = CA_GET_MSG, ca_msg_t *) Arguments diff --git a/Documentation/media/uapi/dvb/ca-get-slot-info.rst b/Documentation/media/uapi/dvb/ca-get-slot-info.rst index 9fea28ccad0f..6c46a5395f45 100644 --- a/Documentation/media/uapi/dvb/ca-get-slot-info.rst +++ b/Documentation/media/uapi/dvb/ca-get-slot-info.rst @@ -15,7 +15,7 @@ CA_GET_SLOT_INFO Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = CA_GET_SLOT_INFO, ca_slot_info_t *) +.. c:function:: int ioctl(fd, int request = CA_GET_SLOT_INFO, ca_slot_info_t *) Arguments diff --git a/Documentation/media/uapi/dvb/ca-reset.rst b/Documentation/media/uapi/dvb/ca-reset.rst index d5a50088fc2d..a91f969318fb 100644 --- a/Documentation/media/uapi/dvb/ca-reset.rst +++ b/Documentation/media/uapi/dvb/ca-reset.rst @@ -15,7 +15,7 @@ CA_RESET Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = CA_RESET) +.. c:function:: int ioctl(fd, int request = CA_RESET) Arguments diff --git a/Documentation/media/uapi/dvb/ca-send-msg.rst b/Documentation/media/uapi/dvb/ca-send-msg.rst index 18974e61e788..5e4fd4f7b683 100644 --- a/Documentation/media/uapi/dvb/ca-send-msg.rst +++ b/Documentation/media/uapi/dvb/ca-send-msg.rst @@ -15,7 +15,7 @@ CA_SEND_MSG Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = CA_SEND_MSG, ca_msg_t *) +.. c:function:: int ioctl(fd, int request = CA_SEND_MSG, ca_msg_t *) Arguments diff --git a/Documentation/media/uapi/dvb/ca-set-descr.rst b/Documentation/media/uapi/dvb/ca-set-descr.rst index 293e6da5059f..2822718d655b 100644 --- a/Documentation/media/uapi/dvb/ca-set-descr.rst +++ b/Documentation/media/uapi/dvb/ca-set-descr.rst @@ -15,7 +15,7 @@ CA_SET_DESCR Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = CA_SET_DESCR, ca_descr_t *) +.. c:function:: int ioctl(fd, int request = CA_SET_DESCR, ca_descr_t *) Arguments diff --git a/Documentation/media/uapi/dvb/ca-set-pid.rst b/Documentation/media/uapi/dvb/ca-set-pid.rst index 5afa2fae3206..1ea95c7ef4e6 100644 --- a/Documentation/media/uapi/dvb/ca-set-pid.rst +++ b/Documentation/media/uapi/dvb/ca-set-pid.rst @@ -15,7 +15,7 @@ CA_SET_PID Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = CA_SET_PID, ca_pid_t *) +.. c:function:: int ioctl(fd, int request = CA_SET_PID, ca_pid_t *) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-add-pid.rst b/Documentation/media/uapi/dvb/dmx-add-pid.rst index 6343035653ac..37f5ee43d523 100644 --- a/Documentation/media/uapi/dvb/dmx-add-pid.rst +++ b/Documentation/media/uapi/dvb/dmx-add-pid.rst @@ -15,7 +15,7 @@ DMX_ADD_PID Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = DMX_ADD_PID, __u16 *) +.. c:function:: int ioctl(fd, int request = DMX_ADD_PID, __u16 *) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-fclose.rst b/Documentation/media/uapi/dvb/dmx-fclose.rst index f54c2a1220c1..e442881481a2 100644 --- a/Documentation/media/uapi/dvb/dmx-fclose.rst +++ b/Documentation/media/uapi/dvb/dmx-fclose.rst @@ -15,7 +15,7 @@ DVB demux close() Synopsis -------- -.. cpp:function:: int close(int fd) +.. c:function:: int close(int fd) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-fopen.rst b/Documentation/media/uapi/dvb/dmx-fopen.rst index 76dbb42713ad..7e640fa860c3 100644 --- a/Documentation/media/uapi/dvb/dmx-fopen.rst +++ b/Documentation/media/uapi/dvb/dmx-fopen.rst @@ -15,7 +15,7 @@ DVB demux open() Synopsis -------- -.. cpp:function:: int open(const char *deviceName, int flags) +.. c:function:: int open(const char *deviceName, int flags) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-fread.rst b/Documentation/media/uapi/dvb/dmx-fread.rst index 266c9ca259c9..efa2a01096c1 100644 --- a/Documentation/media/uapi/dvb/dmx-fread.rst +++ b/Documentation/media/uapi/dvb/dmx-fread.rst @@ -15,7 +15,7 @@ DVB demux read() Synopsis -------- -.. cpp:function:: size_t read(int fd, void *buf, size_t count) +.. c:function:: size_t read(int fd, void *buf, size_t count) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-fwrite.rst b/Documentation/media/uapi/dvb/dmx-fwrite.rst index 3d76470bef60..c05a44c4535f 100644 --- a/Documentation/media/uapi/dvb/dmx-fwrite.rst +++ b/Documentation/media/uapi/dvb/dmx-fwrite.rst @@ -15,7 +15,7 @@ DVB demux write() Synopsis -------- -.. cpp:function:: ssize_t write(int fd, const void *buf, size_t count) +.. c:function:: ssize_t write(int fd, const void *buf, size_t count) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-get-caps.rst b/Documentation/media/uapi/dvb/dmx-get-caps.rst index d0549eb7fbd3..20e3d6e55d30 100644 --- a/Documentation/media/uapi/dvb/dmx-get-caps.rst +++ b/Documentation/media/uapi/dvb/dmx-get-caps.rst @@ -15,7 +15,7 @@ DMX_GET_CAPS Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = DMX_GET_CAPS, dmx_caps_t *) +.. c:function:: int ioctl(fd, int request = DMX_GET_CAPS, dmx_caps_t *) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-get-event.rst b/Documentation/media/uapi/dvb/dmx-get-event.rst index 6a7550c63bb5..81a7c7fedd47 100644 --- a/Documentation/media/uapi/dvb/dmx-get-event.rst +++ b/Documentation/media/uapi/dvb/dmx-get-event.rst @@ -15,7 +15,7 @@ DMX_GET_EVENT Synopsis -------- -.. cpp:function:: int ioctl( int fd, int request = DMX_GET_EVENT, struct dmx_event *ev) +.. c:function:: int ioctl( int fd, int request = DMX_GET_EVENT, struct dmx_event *ev) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst b/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst index ba5d30c913c8..8b1fbf5d2c81 100644 --- a/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst +++ b/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst @@ -15,7 +15,7 @@ DMX_GET_PES_PIDS Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = DMX_GET_PES_PIDS, __u16[5]) +.. c:function:: int ioctl(fd, int request = DMX_GET_PES_PIDS, __u16[5]) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-get-stc.rst b/Documentation/media/uapi/dvb/dmx-get-stc.rst index bd477bb67082..616c745a0418 100644 --- a/Documentation/media/uapi/dvb/dmx-get-stc.rst +++ b/Documentation/media/uapi/dvb/dmx-get-stc.rst @@ -15,7 +15,7 @@ DMX_GET_STC Synopsis -------- -.. cpp:function:: int ioctl( int fd, int request = DMX_GET_STC, struct dmx_stc *stc) +.. c:function:: int ioctl( int fd, int request = DMX_GET_STC, struct dmx_stc *stc) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-remove-pid.rst b/Documentation/media/uapi/dvb/dmx-remove-pid.rst index c8f038b40074..ed1a49ce9fc2 100644 --- a/Documentation/media/uapi/dvb/dmx-remove-pid.rst +++ b/Documentation/media/uapi/dvb/dmx-remove-pid.rst @@ -15,7 +15,7 @@ DMX_REMOVE_PID Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = DMX_REMOVE_PID, __u16 *) +.. c:function:: int ioctl(fd, int request = DMX_REMOVE_PID, __u16 *) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-set-buffer-size.rst b/Documentation/media/uapi/dvb/dmx-set-buffer-size.rst index 8ae48cf39cda..012b9e9792be 100644 --- a/Documentation/media/uapi/dvb/dmx-set-buffer-size.rst +++ b/Documentation/media/uapi/dvb/dmx-set-buffer-size.rst @@ -15,7 +15,7 @@ DMX_SET_BUFFER_SIZE Synopsis -------- -.. cpp:function:: int ioctl( int fd, int request = DMX_SET_BUFFER_SIZE, unsigned long size) +.. c:function:: int ioctl( int fd, int request = DMX_SET_BUFFER_SIZE, unsigned long size) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-set-filter.rst b/Documentation/media/uapi/dvb/dmx-set-filter.rst index 8c929fa9b98c..d079d8b39597 100644 --- a/Documentation/media/uapi/dvb/dmx-set-filter.rst +++ b/Documentation/media/uapi/dvb/dmx-set-filter.rst @@ -15,7 +15,7 @@ DMX_SET_FILTER Synopsis -------- -.. cpp:function:: int ioctl( int fd, int request = DMX_SET_FILTER, struct dmx_sct_filter_params *params) +.. c:function:: int ioctl( int fd, int request = DMX_SET_FILTER, struct dmx_sct_filter_params *params) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst b/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst index d71db779b6fd..1f774624383f 100644 --- a/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst +++ b/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst @@ -15,7 +15,7 @@ DMX_SET_PES_FILTER Synopsis -------- -.. cpp:function:: int ioctl( int fd, int request = DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params) +.. c:function:: int ioctl( int fd, int request = DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst b/Documentation/media/uapi/dvb/dmx-set-source.rst index 99a8d5c82756..7aa4dfe3cdc5 100644 --- a/Documentation/media/uapi/dvb/dmx-set-source.rst +++ b/Documentation/media/uapi/dvb/dmx-set-source.rst @@ -15,7 +15,7 @@ DMX_SET_SOURCE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = DMX_SET_SOURCE, dmx_source_t *) +.. c:function:: int ioctl(fd, int request = DMX_SET_SOURCE, dmx_source_t *) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-start.rst b/Documentation/media/uapi/dvb/dmx-start.rst index 959b5eee2647..d494f6b03dbc 100644 --- a/Documentation/media/uapi/dvb/dmx-start.rst +++ b/Documentation/media/uapi/dvb/dmx-start.rst @@ -15,7 +15,7 @@ DMX_START Synopsis -------- -.. cpp:function:: int ioctl( int fd, int request = DMX_START) +.. c:function:: int ioctl( int fd, int request = DMX_START) Arguments diff --git a/Documentation/media/uapi/dvb/dmx-stop.rst b/Documentation/media/uapi/dvb/dmx-stop.rst index 7e4bf09fc83e..f9157dd6a8fe 100644 --- a/Documentation/media/uapi/dvb/dmx-stop.rst +++ b/Documentation/media/uapi/dvb/dmx-stop.rst @@ -15,7 +15,7 @@ DMX_STOP Synopsis -------- -.. cpp:function:: int ioctl( int fd, int request = DMX_STOP) +.. c:function:: int ioctl( int fd, int request = DMX_STOP) Arguments diff --git a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst index 7b32566b77a3..7bf1145b58a8 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst @@ -15,7 +15,7 @@ FE_DISEQC_RECV_SLAVE_REPLY - Receives reply from a DiSEqC 2.0 command Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct dvb_diseqc_slave_reply *argp ) +.. c:function:: int ioctl( int fd, int request, struct dvb_diseqc_slave_reply *argp ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-diseqc-reset-overload.rst b/Documentation/media/uapi/dvb/fe-diseqc-reset-overload.rst index cab157054c13..13bac53bd248 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-reset-overload.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-reset-overload.rst @@ -15,7 +15,7 @@ FE_DISEQC_RESET_OVERLOAD - Restores the power to the antenna subsystem, if it wa Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, NULL ) +.. c:function:: int ioctl( int fd, int request, NULL ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst b/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst index 9b476545ef89..d1e9f31ff347 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst @@ -15,7 +15,7 @@ FE_DISEQC_SEND_BURST - Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite se Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, enum fe_sec_mini_cmd *tone ) +.. c:function:: int ioctl( int fd, int request, enum fe_sec_mini_cmd *tone ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst index 865914bf4efe..3b27d9cc544d 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst @@ -15,7 +15,7 @@ FE_DISEQC_SEND_MASTER_CMD - Sends a DiSEqC command Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct dvb_diseqc_master_cmd *argp ) +.. c:function:: int ioctl( int fd, int request, struct dvb_diseqc_master_cmd *argp ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst b/Documentation/media/uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst index d47e9dbf558a..5ebab0ef9138 100644 --- a/Documentation/media/uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst +++ b/Documentation/media/uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst @@ -15,7 +15,7 @@ FE_DISHNETWORK_SEND_LEGACY_CMD Synopsis ======== -.. cpp:function:: int ioctl(int fd, int request = FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd) +.. c:function:: int ioctl(int fd, int request = FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd) Arguments diff --git a/Documentation/media/uapi/dvb/fe-enable-high-lnb-voltage.rst b/Documentation/media/uapi/dvb/fe-enable-high-lnb-voltage.rst index de99bf5fbf0e..a485bf259ed2 100644 --- a/Documentation/media/uapi/dvb/fe-enable-high-lnb-voltage.rst +++ b/Documentation/media/uapi/dvb/fe-enable-high-lnb-voltage.rst @@ -15,7 +15,7 @@ FE_ENABLE_HIGH_LNB_VOLTAGE - Select output DC level between normal LNBf voltages Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, unsigned int high ) +.. c:function:: int ioctl( int fd, int request, unsigned int high ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-get-event.rst b/Documentation/media/uapi/dvb/fe-get-event.rst index ffa3d04c6bd4..79beb1b9da3b 100644 --- a/Documentation/media/uapi/dvb/fe-get-event.rst +++ b/Documentation/media/uapi/dvb/fe-get-event.rst @@ -15,7 +15,7 @@ FE_GET_EVENT Synopsis ======== -.. cpp:function:: int ioctl(int fd, int request = QPSK_GET_EVENT, struct dvb_frontend_event *ev) +.. c:function:: int ioctl(int fd, int request = QPSK_GET_EVENT, struct dvb_frontend_event *ev) Arguments diff --git a/Documentation/media/uapi/dvb/fe-get-frontend.rst b/Documentation/media/uapi/dvb/fe-get-frontend.rst index 5d2df808df18..fdf0d1440add 100644 --- a/Documentation/media/uapi/dvb/fe-get-frontend.rst +++ b/Documentation/media/uapi/dvb/fe-get-frontend.rst @@ -15,7 +15,7 @@ FE_GET_FRONTEND Synopsis ======== -.. cpp:function:: int ioctl(int fd, int request = FE_GET_FRONTEND, struct dvb_frontend_parameters *p) +.. c:function:: int ioctl(int fd, int request = FE_GET_FRONTEND, struct dvb_frontend_parameters *p) Arguments diff --git a/Documentation/media/uapi/dvb/fe-get-info.rst b/Documentation/media/uapi/dvb/fe-get-info.rst index 87ff3f62050d..8768179cb812 100644 --- a/Documentation/media/uapi/dvb/fe-get-info.rst +++ b/Documentation/media/uapi/dvb/fe-get-info.rst @@ -15,7 +15,7 @@ FE_GET_INFO - Query DVB frontend capabilities and returns information about the Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct dvb_frontend_info *argp ) +.. c:function:: int ioctl( int fd, int request, struct dvb_frontend_info *argp ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-get-property.rst b/Documentation/media/uapi/dvb/fe-get-property.rst index 749daafe6b21..12042c7ae693 100644 --- a/Documentation/media/uapi/dvb/fe-get-property.rst +++ b/Documentation/media/uapi/dvb/fe-get-property.rst @@ -15,7 +15,7 @@ FE_SET_PROPERTY - FE_GET_PROPERTY - FE_SET_PROPERTY sets one or more frontend pr Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct dtv_properties *argp ) +.. c:function:: int ioctl( int fd, int request, struct dtv_properties *argp ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-read-ber.rst b/Documentation/media/uapi/dvb/fe-read-ber.rst index c2b5b417f5fb..3262441385ff 100644 --- a/Documentation/media/uapi/dvb/fe-read-ber.rst +++ b/Documentation/media/uapi/dvb/fe-read-ber.rst @@ -14,7 +14,7 @@ FE_READ_BER Synopsis ======== -.. cpp:function:: int ioctl(int fd, int request = FE_READ_BER, uint32_t *ber) +.. c:function:: int ioctl(int fd, int request = FE_READ_BER, uint32_t *ber) Arguments diff --git a/Documentation/media/uapi/dvb/fe-read-signal-strength.rst b/Documentation/media/uapi/dvb/fe-read-signal-strength.rst index 0cdee2effc97..fcaadcb537fb 100644 --- a/Documentation/media/uapi/dvb/fe-read-signal-strength.rst +++ b/Documentation/media/uapi/dvb/fe-read-signal-strength.rst @@ -15,7 +15,7 @@ FE_READ_SIGNAL_STRENGTH Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request = FE_READ_SIGNAL_STRENGTH, uint16_t *strength) +.. c:function:: int ioctl( int fd, int request = FE_READ_SIGNAL_STRENGTH, uint16_t *strength) Arguments diff --git a/Documentation/media/uapi/dvb/fe-read-snr.rst b/Documentation/media/uapi/dvb/fe-read-snr.rst index 5394f9ae90f4..837af2de9f6f 100644 --- a/Documentation/media/uapi/dvb/fe-read-snr.rst +++ b/Documentation/media/uapi/dvb/fe-read-snr.rst @@ -15,7 +15,7 @@ FE_READ_SNR Synopsis ======== -.. cpp:function:: int ioctl(int fd, int request = FE_READ_SNR, int16_t *snr) +.. c:function:: int ioctl(int fd, int request = FE_READ_SNR, int16_t *snr) Arguments diff --git a/Documentation/media/uapi/dvb/fe-read-status.rst b/Documentation/media/uapi/dvb/fe-read-status.rst index def8160d6807..b00bdc8a2e04 100644 --- a/Documentation/media/uapi/dvb/fe-read-status.rst +++ b/Documentation/media/uapi/dvb/fe-read-status.rst @@ -15,7 +15,7 @@ FE_READ_STATUS - Returns status information about the front-end. This call only Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, unsigned int *status ) +.. c:function:: int ioctl( int fd, int request, unsigned int *status ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-read-uncorrected-blocks.rst b/Documentation/media/uapi/dvb/fe-read-uncorrected-blocks.rst index 5c29c058dfdc..6b753846a008 100644 --- a/Documentation/media/uapi/dvb/fe-read-uncorrected-blocks.rst +++ b/Documentation/media/uapi/dvb/fe-read-uncorrected-blocks.rst @@ -15,7 +15,7 @@ FE_READ_UNCORRECTED_BLOCKS Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request =FE_READ_UNCORRECTED_BLOCKS, uint32_t *ublocks) +.. c:function:: int ioctl( int fd, int request =FE_READ_UNCORRECTED_BLOCKS, uint32_t *ublocks) Arguments diff --git a/Documentation/media/uapi/dvb/fe-set-frontend-tune-mode.rst b/Documentation/media/uapi/dvb/fe-set-frontend-tune-mode.rst index 411abcf4de58..4461aeb46ebb 100644 --- a/Documentation/media/uapi/dvb/fe-set-frontend-tune-mode.rst +++ b/Documentation/media/uapi/dvb/fe-set-frontend-tune-mode.rst @@ -15,7 +15,7 @@ FE_SET_FRONTEND_TUNE_MODE - Allow setting tuner mode flags to the frontend. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, unsigned int flags ) +.. c:function:: int ioctl( int fd, int request, unsigned int flags ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-set-frontend.rst b/Documentation/media/uapi/dvb/fe-set-frontend.rst index 7cb70c38d534..4e66da0af6fd 100644 --- a/Documentation/media/uapi/dvb/fe-set-frontend.rst +++ b/Documentation/media/uapi/dvb/fe-set-frontend.rst @@ -15,7 +15,7 @@ FE_SET_FRONTEND Synopsis ======== -.. cpp:function:: int ioctl(int fd, int request = FE_SET_FRONTEND, struct dvb_frontend_parameters *p) +.. c:function:: int ioctl(int fd, int request = FE_SET_FRONTEND, struct dvb_frontend_parameters *p) Arguments diff --git a/Documentation/media/uapi/dvb/fe-set-tone.rst b/Documentation/media/uapi/dvb/fe-set-tone.rst index 545e2afba2c0..a00fcaadecd1 100644 --- a/Documentation/media/uapi/dvb/fe-set-tone.rst +++ b/Documentation/media/uapi/dvb/fe-set-tone.rst @@ -15,7 +15,7 @@ FE_SET_TONE - Sets/resets the generation of the continuous 22kHz tone. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, enum fe_sec_tone_mode *tone ) +.. c:function:: int ioctl( int fd, int request, enum fe_sec_tone_mode *tone ) Arguments diff --git a/Documentation/media/uapi/dvb/fe-set-voltage.rst b/Documentation/media/uapi/dvb/fe-set-voltage.rst index 2b19086b660a..05baf77e0301 100644 --- a/Documentation/media/uapi/dvb/fe-set-voltage.rst +++ b/Documentation/media/uapi/dvb/fe-set-voltage.rst @@ -15,7 +15,7 @@ FE_SET_VOLTAGE - Allow setting the DC level sent to the antenna subsystem. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, enum fe_sec_voltage *voltage ) +.. c:function:: int ioctl( int fd, int request, enum fe_sec_voltage *voltage ) Arguments diff --git a/Documentation/media/uapi/dvb/frontend_f_close.rst b/Documentation/media/uapi/dvb/frontend_f_close.rst index 5cce9262084c..8746eec2b97d 100644 --- a/Documentation/media/uapi/dvb/frontend_f_close.rst +++ b/Documentation/media/uapi/dvb/frontend_f_close.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int close( int fd ) +.. c:function:: int close( int fd ) Arguments diff --git a/Documentation/media/uapi/dvb/frontend_f_open.rst b/Documentation/media/uapi/dvb/frontend_f_open.rst index e0c55345f524..5810e96abf89 100644 --- a/Documentation/media/uapi/dvb/frontend_f_open.rst +++ b/Documentation/media/uapi/dvb/frontend_f_open.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int open( const char *device_name, int flags ) +.. c:function:: int open( const char *device_name, int flags ) Arguments diff --git a/Documentation/media/uapi/dvb/net-add-if.rst b/Documentation/media/uapi/dvb/net-add-if.rst index 2b990d0e0fe1..ebde02b9a3ec 100644 --- a/Documentation/media/uapi/dvb/net-add-if.rst +++ b/Documentation/media/uapi/dvb/net-add-if.rst @@ -15,7 +15,7 @@ NET_ADD_IF - Creates a new network interface for a given Packet ID. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct dvb_net_if *net_if ) +.. c:function:: int ioctl( int fd, int request, struct dvb_net_if *net_if ) Arguments diff --git a/Documentation/media/uapi/dvb/net-get-if.rst b/Documentation/media/uapi/dvb/net-get-if.rst index 92b884143ccd..17cfcda22da3 100644 --- a/Documentation/media/uapi/dvb/net-get-if.rst +++ b/Documentation/media/uapi/dvb/net-get-if.rst @@ -15,7 +15,7 @@ NET_GET_IF - Read the configuration data of an interface created via - :ref:`NET Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct dvb_net_if *net_if ) +.. c:function:: int ioctl( int fd, int request, struct dvb_net_if *net_if ) Arguments diff --git a/Documentation/media/uapi/dvb/net-remove-if.rst b/Documentation/media/uapi/dvb/net-remove-if.rst index d374c1d63d06..447dd4299965 100644 --- a/Documentation/media/uapi/dvb/net-remove-if.rst +++ b/Documentation/media/uapi/dvb/net-remove-if.rst @@ -15,7 +15,7 @@ NET_REMOVE_IF - Removes a network interface. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, int ifnum ) +.. c:function:: int ioctl( int fd, int request, int ifnum ) Arguments diff --git a/Documentation/media/uapi/dvb/video-clear-buffer.rst b/Documentation/media/uapi/dvb/video-clear-buffer.rst index 7c85aa06f013..dd227ad85546 100644 --- a/Documentation/media/uapi/dvb/video-clear-buffer.rst +++ b/Documentation/media/uapi/dvb/video-clear-buffer.rst @@ -15,7 +15,7 @@ VIDEO_CLEAR_BUFFER Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_CLEAR_BUFFER) +.. c:function:: int ioctl(fd, int request = VIDEO_CLEAR_BUFFER) Arguments diff --git a/Documentation/media/uapi/dvb/video-command.rst b/Documentation/media/uapi/dvb/video-command.rst index b1634f722cbd..42a98a47e323 100644 --- a/Documentation/media/uapi/dvb/video-command.rst +++ b/Documentation/media/uapi/dvb/video-command.rst @@ -15,7 +15,7 @@ VIDEO_COMMAND Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = VIDEO_COMMAND, struct video_command *cmd) +.. c:function:: int ioctl(int fd, int request = VIDEO_COMMAND, struct video_command *cmd) Arguments diff --git a/Documentation/media/uapi/dvb/video-continue.rst b/Documentation/media/uapi/dvb/video-continue.rst index c5acc094986f..2a6444a4f4dc 100644 --- a/Documentation/media/uapi/dvb/video-continue.rst +++ b/Documentation/media/uapi/dvb/video-continue.rst @@ -15,7 +15,7 @@ VIDEO_CONTINUE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_CONTINUE) +.. c:function:: int ioctl(fd, int request = VIDEO_CONTINUE) Arguments diff --git a/Documentation/media/uapi/dvb/video-fast-forward.rst b/Documentation/media/uapi/dvb/video-fast-forward.rst index db338e9f5379..0b3a27a22d30 100644 --- a/Documentation/media/uapi/dvb/video-fast-forward.rst +++ b/Documentation/media/uapi/dvb/video-fast-forward.rst @@ -15,7 +15,7 @@ VIDEO_FAST_FORWARD Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_FAST_FORWARD, int nFrames) +.. c:function:: int ioctl(fd, int request = VIDEO_FAST_FORWARD, int nFrames) Arguments diff --git a/Documentation/media/uapi/dvb/video-fclose.rst b/Documentation/media/uapi/dvb/video-fclose.rst index ebeaade0c351..b4dd5ea676b9 100644 --- a/Documentation/media/uapi/dvb/video-fclose.rst +++ b/Documentation/media/uapi/dvb/video-fclose.rst @@ -15,7 +15,7 @@ dvb video close() Synopsis -------- -.. cpp:function:: int close(int fd) +.. c:function:: int close(int fd) Arguments diff --git a/Documentation/media/uapi/dvb/video-fopen.rst b/Documentation/media/uapi/dvb/video-fopen.rst index 9addca95516e..5b73ca9f7bed 100644 --- a/Documentation/media/uapi/dvb/video-fopen.rst +++ b/Documentation/media/uapi/dvb/video-fopen.rst @@ -15,7 +15,7 @@ dvb video open() Synopsis -------- -.. cpp:function:: int open(const char *deviceName, int flags) +.. c:function:: int open(const char *deviceName, int flags) Arguments diff --git a/Documentation/media/uapi/dvb/video-freeze.rst b/Documentation/media/uapi/dvb/video-freeze.rst index d3d0dc31281a..12e04df990b7 100644 --- a/Documentation/media/uapi/dvb/video-freeze.rst +++ b/Documentation/media/uapi/dvb/video-freeze.rst @@ -15,7 +15,7 @@ VIDEO_FREEZE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_FREEZE) +.. c:function:: int ioctl(fd, int request = VIDEO_FREEZE) Arguments diff --git a/Documentation/media/uapi/dvb/video-fwrite.rst b/Documentation/media/uapi/dvb/video-fwrite.rst index 045038f4181e..da03db4be8de 100644 --- a/Documentation/media/uapi/dvb/video-fwrite.rst +++ b/Documentation/media/uapi/dvb/video-fwrite.rst @@ -15,7 +15,7 @@ dvb video write() Synopsis -------- -.. cpp:function:: size_t write(int fd, const void *buf, size_t count) +.. c:function:: size_t write(int fd, const void *buf, size_t count) Arguments diff --git a/Documentation/media/uapi/dvb/video-get-capabilities.rst b/Documentation/media/uapi/dvb/video-get-capabilities.rst index 94cbbba478a8..5515dd40a1c1 100644 --- a/Documentation/media/uapi/dvb/video-get-capabilities.rst +++ b/Documentation/media/uapi/dvb/video-get-capabilities.rst @@ -15,7 +15,7 @@ VIDEO_GET_CAPABILITIES Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_GET_CAPABILITIES, unsigned int *cap) +.. c:function:: int ioctl(fd, int request = VIDEO_GET_CAPABILITIES, unsigned int *cap) Arguments diff --git a/Documentation/media/uapi/dvb/video-get-event.rst b/Documentation/media/uapi/dvb/video-get-event.rst index a1484a226518..d43459915179 100644 --- a/Documentation/media/uapi/dvb/video-get-event.rst +++ b/Documentation/media/uapi/dvb/video-get-event.rst @@ -15,7 +15,7 @@ VIDEO_GET_EVENT Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_GET_EVENT, struct video_event *ev) +.. c:function:: int ioctl(fd, int request = VIDEO_GET_EVENT, struct video_event *ev) Arguments diff --git a/Documentation/media/uapi/dvb/video-get-frame-count.rst b/Documentation/media/uapi/dvb/video-get-frame-count.rst index 4ff100c2ee95..a55f7a1d52ac 100644 --- a/Documentation/media/uapi/dvb/video-get-frame-count.rst +++ b/Documentation/media/uapi/dvb/video-get-frame-count.rst @@ -15,7 +15,7 @@ VIDEO_GET_FRAME_COUNT Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = VIDEO_GET_FRAME_COUNT, __u64 *pts) +.. c:function:: int ioctl(int fd, int request = VIDEO_GET_FRAME_COUNT, __u64 *pts) Arguments diff --git a/Documentation/media/uapi/dvb/video-get-frame-rate.rst b/Documentation/media/uapi/dvb/video-get-frame-rate.rst index 131def962305..a137b6589599 100644 --- a/Documentation/media/uapi/dvb/video-get-frame-rate.rst +++ b/Documentation/media/uapi/dvb/video-get-frame-rate.rst @@ -15,7 +15,7 @@ VIDEO_GET_FRAME_RATE Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = VIDEO_GET_FRAME_RATE, unsigned int *rate) +.. c:function:: int ioctl(int fd, int request = VIDEO_GET_FRAME_RATE, unsigned int *rate) Arguments diff --git a/Documentation/media/uapi/dvb/video-get-navi.rst b/Documentation/media/uapi/dvb/video-get-navi.rst index 6c3034fe5fa2..ccb2552722f0 100644 --- a/Documentation/media/uapi/dvb/video-get-navi.rst +++ b/Documentation/media/uapi/dvb/video-get-navi.rst @@ -15,7 +15,7 @@ VIDEO_GET_NAVI Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_GET_NAVI , video_navi_pack_t *navipack) +.. c:function:: int ioctl(fd, int request = VIDEO_GET_NAVI , video_navi_pack_t *navipack) Arguments diff --git a/Documentation/media/uapi/dvb/video-get-pts.rst b/Documentation/media/uapi/dvb/video-get-pts.rst index 082612243bbb..c1ad9576963d 100644 --- a/Documentation/media/uapi/dvb/video-get-pts.rst +++ b/Documentation/media/uapi/dvb/video-get-pts.rst @@ -15,7 +15,7 @@ VIDEO_GET_PTS Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = VIDEO_GET_PTS, __u64 *pts) +.. c:function:: int ioctl(int fd, int request = VIDEO_GET_PTS, __u64 *pts) Arguments diff --git a/Documentation/media/uapi/dvb/video-get-size.rst b/Documentation/media/uapi/dvb/video-get-size.rst index c75e3c47c471..70fb266e3ed8 100644 --- a/Documentation/media/uapi/dvb/video-get-size.rst +++ b/Documentation/media/uapi/dvb/video-get-size.rst @@ -15,7 +15,7 @@ VIDEO_GET_SIZE Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = VIDEO_GET_SIZE, video_size_t *size) +.. c:function:: int ioctl(int fd, int request = VIDEO_GET_SIZE, video_size_t *size) Arguments diff --git a/Documentation/media/uapi/dvb/video-get-status.rst b/Documentation/media/uapi/dvb/video-get-status.rst index ab9c2236df7e..5fd5b37942ec 100644 --- a/Documentation/media/uapi/dvb/video-get-status.rst +++ b/Documentation/media/uapi/dvb/video-get-status.rst @@ -15,7 +15,7 @@ VIDEO_GET_STATUS Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_GET_STATUS, struct video_status *status) +.. c:function:: int ioctl(fd, int request = VIDEO_GET_STATUS, struct video_status *status) Arguments diff --git a/Documentation/media/uapi/dvb/video-play.rst b/Documentation/media/uapi/dvb/video-play.rst index 943c4b755372..103d0ad3341a 100644 --- a/Documentation/media/uapi/dvb/video-play.rst +++ b/Documentation/media/uapi/dvb/video-play.rst @@ -15,7 +15,7 @@ VIDEO_PLAY Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_PLAY) +.. c:function:: int ioctl(fd, int request = VIDEO_PLAY) Arguments diff --git a/Documentation/media/uapi/dvb/video-select-source.rst b/Documentation/media/uapi/dvb/video-select-source.rst index 0ee0d03dbeb2..f03c544668f5 100644 --- a/Documentation/media/uapi/dvb/video-select-source.rst +++ b/Documentation/media/uapi/dvb/video-select-source.rst @@ -15,7 +15,7 @@ VIDEO_SELECT_SOURCE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SELECT_SOURCE, video_stream_source_t source) +.. c:function:: int ioctl(fd, int request = VIDEO_SELECT_SOURCE, video_stream_source_t source) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-attributes.rst b/Documentation/media/uapi/dvb/video-set-attributes.rst index 326c5c876e80..9de0d9c7c9ca 100644 --- a/Documentation/media/uapi/dvb/video-set-attributes.rst +++ b/Documentation/media/uapi/dvb/video-set-attributes.rst @@ -15,7 +15,7 @@ VIDEO_SET_ATTRIBUTES Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_ATTRIBUTE ,video_attributes_t vattr) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_ATTRIBUTE ,video_attributes_t vattr) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-blank.rst b/Documentation/media/uapi/dvb/video-set-blank.rst index 142ea8817380..d8b94c9b56b9 100644 --- a/Documentation/media/uapi/dvb/video-set-blank.rst +++ b/Documentation/media/uapi/dvb/video-set-blank.rst @@ -15,7 +15,7 @@ VIDEO_SET_BLANK Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_BLANK, boolean mode) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_BLANK, boolean mode) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-display-format.rst b/Documentation/media/uapi/dvb/video-set-display-format.rst index 2061ab064977..c1fb7c75b4a8 100644 --- a/Documentation/media/uapi/dvb/video-set-display-format.rst +++ b/Documentation/media/uapi/dvb/video-set-display-format.rst @@ -15,7 +15,7 @@ VIDEO_SET_DISPLAY_FORMAT Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_DISPLAY_FORMAT, video_display_format_t format) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_DISPLAY_FORMAT, video_display_format_t format) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-format.rst b/Documentation/media/uapi/dvb/video-set-format.rst index 53d66ec462ca..257a3c2a4627 100644 --- a/Documentation/media/uapi/dvb/video-set-format.rst +++ b/Documentation/media/uapi/dvb/video-set-format.rst @@ -15,7 +15,7 @@ VIDEO_SET_FORMAT Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_FORMAT, video_format_t format) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_FORMAT, video_format_t format) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-highlight.rst b/Documentation/media/uapi/dvb/video-set-highlight.rst index 374f5d895b4d..6ff11af71355 100644 --- a/Documentation/media/uapi/dvb/video-set-highlight.rst +++ b/Documentation/media/uapi/dvb/video-set-highlight.rst @@ -15,7 +15,7 @@ VIDEO_SET_HIGHLIGHT Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_HIGHLIGHT ,video_highlight_t *vhilite) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_HIGHLIGHT ,video_highlight_t *vhilite) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-id.rst b/Documentation/media/uapi/dvb/video-set-id.rst index 9c002d5399ad..61993ab354ca 100644 --- a/Documentation/media/uapi/dvb/video-set-id.rst +++ b/Documentation/media/uapi/dvb/video-set-id.rst @@ -15,7 +15,7 @@ VIDEO_SET_ID Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = VIDEO_SET_ID, int id) +.. c:function:: int ioctl(int fd, int request = VIDEO_SET_ID, int id) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-spu-palette.rst b/Documentation/media/uapi/dvb/video-set-spu-palette.rst index 4b80b6f56219..ae9e0da5fd0b 100644 --- a/Documentation/media/uapi/dvb/video-set-spu-palette.rst +++ b/Documentation/media/uapi/dvb/video-set-spu-palette.rst @@ -15,7 +15,7 @@ VIDEO_SET_SPU_PALETTE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_SPU_PALETTE, video_spu_palette_t *palette ) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_SPU_PALETTE, video_spu_palette_t *palette ) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-spu.rst b/Documentation/media/uapi/dvb/video-set-spu.rst index a6f6924f10c4..ce2860574f20 100644 --- a/Documentation/media/uapi/dvb/video-set-spu.rst +++ b/Documentation/media/uapi/dvb/video-set-spu.rst @@ -15,7 +15,7 @@ VIDEO_SET_SPU Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_SPU , video_spu_t *spu) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_SPU , video_spu_t *spu) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-streamtype.rst b/Documentation/media/uapi/dvb/video-set-streamtype.rst index 75b2e7a6e829..a2055369f0cd 100644 --- a/Documentation/media/uapi/dvb/video-set-streamtype.rst +++ b/Documentation/media/uapi/dvb/video-set-streamtype.rst @@ -15,7 +15,7 @@ VIDEO_SET_STREAMTYPE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_STREAMTYPE, int type) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_STREAMTYPE, int type) Arguments diff --git a/Documentation/media/uapi/dvb/video-set-system.rst b/Documentation/media/uapi/dvb/video-set-system.rst index 9ae0df1f5813..f84906a7d1f4 100644 --- a/Documentation/media/uapi/dvb/video-set-system.rst +++ b/Documentation/media/uapi/dvb/video-set-system.rst @@ -15,7 +15,7 @@ VIDEO_SET_SYSTEM Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SET_SYSTEM , video_system_t system) +.. c:function:: int ioctl(fd, int request = VIDEO_SET_SYSTEM , video_system_t system) Arguments diff --git a/Documentation/media/uapi/dvb/video-slowmotion.rst b/Documentation/media/uapi/dvb/video-slowmotion.rst index 905712844f6a..c8cc85af590b 100644 --- a/Documentation/media/uapi/dvb/video-slowmotion.rst +++ b/Documentation/media/uapi/dvb/video-slowmotion.rst @@ -15,7 +15,7 @@ VIDEO_SLOWMOTION Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_SLOWMOTION, int nFrames) +.. c:function:: int ioctl(fd, int request = VIDEO_SLOWMOTION, int nFrames) Arguments diff --git a/Documentation/media/uapi/dvb/video-stillpicture.rst b/Documentation/media/uapi/dvb/video-stillpicture.rst index ed3a2f53b998..053cdbba4ed4 100644 --- a/Documentation/media/uapi/dvb/video-stillpicture.rst +++ b/Documentation/media/uapi/dvb/video-stillpicture.rst @@ -15,7 +15,7 @@ VIDEO_STILLPICTURE Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_STILLPICTURE, struct video_still_picture *sp) +.. c:function:: int ioctl(fd, int request = VIDEO_STILLPICTURE, struct video_still_picture *sp) Arguments diff --git a/Documentation/media/uapi/dvb/video-stop.rst b/Documentation/media/uapi/dvb/video-stop.rst index ad8d59e06004..4e7fbab4b8bc 100644 --- a/Documentation/media/uapi/dvb/video-stop.rst +++ b/Documentation/media/uapi/dvb/video-stop.rst @@ -15,7 +15,7 @@ VIDEO_STOP Synopsis -------- -.. cpp:function:: int ioctl(fd, int request = VIDEO_STOP, boolean mode) +.. c:function:: int ioctl(fd, int request = VIDEO_STOP, boolean mode) Arguments diff --git a/Documentation/media/uapi/dvb/video-try-command.rst b/Documentation/media/uapi/dvb/video-try-command.rst index df96c2d7fc6b..be21fb01bd0f 100644 --- a/Documentation/media/uapi/dvb/video-try-command.rst +++ b/Documentation/media/uapi/dvb/video-try-command.rst @@ -15,7 +15,7 @@ VIDEO_TRY_COMMAND Synopsis -------- -.. cpp:function:: int ioctl(int fd, int request = VIDEO_TRY_COMMAND, struct video_command *cmd) +.. c:function:: int ioctl(int fd, int request = VIDEO_TRY_COMMAND, struct video_command *cmd) Arguments diff --git a/Documentation/media/uapi/mediactl/media-func-close.rst b/Documentation/media/uapi/mediactl/media-func-close.rst index 39ef70ac8656..c13220c2696e 100644 --- a/Documentation/media/uapi/mediactl/media-func-close.rst +++ b/Documentation/media/uapi/mediactl/media-func-close.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int close( int fd ) +.. c:function:: int close( int fd ) Arguments diff --git a/Documentation/media/uapi/mediactl/media-func-ioctl.rst b/Documentation/media/uapi/mediactl/media-func-ioctl.rst index 9d1b23133edf..6fa0a8e65af5 100644 --- a/Documentation/media/uapi/mediactl/media-func-ioctl.rst +++ b/Documentation/media/uapi/mediactl/media-func-ioctl.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int ioctl( int fd, int request, void *argp ) +.. c:function:: int ioctl( int fd, int request, void *argp ) Arguments diff --git a/Documentation/media/uapi/mediactl/media-func-open.rst b/Documentation/media/uapi/mediactl/media-func-open.rst index 2b2ecd85b995..aa77ba32db21 100644 --- a/Documentation/media/uapi/mediactl/media-func-open.rst +++ b/Documentation/media/uapi/mediactl/media-func-open.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int open( const char *device_name, int flags ) +.. c:function:: int open( const char *device_name, int flags ) Arguments diff --git a/Documentation/media/uapi/mediactl/media-ioc-device-info.rst b/Documentation/media/uapi/mediactl/media-ioc-device-info.rst index 567f5515a791..e8c97abed394 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-device-info.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-device-info.rst @@ -15,7 +15,7 @@ MEDIA_IOC_DEVICE_INFO - Query device information Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct media_device_info *argp ) +.. c:function:: int ioctl( int fd, int request, struct media_device_info *argp ) Arguments diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst index a51c4cc9f6d3..a621b08187ea 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst @@ -15,7 +15,7 @@ MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct media_entity_desc *argp ) +.. c:function:: int ioctl( int fd, int request, struct media_entity_desc *argp ) Arguments diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst index f4334f5765c6..d07629ba44db 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst @@ -15,7 +15,7 @@ MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct media_links_enum *argp ) +.. c:function:: int ioctl( int fd, int request, struct media_links_enum *argp ) Arguments diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst index c836d64df03b..d01a4528cb47 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst @@ -15,7 +15,7 @@ MEDIA_IOC_G_TOPOLOGY - Enumerate the graph topology and graph element properties Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct media_v2_topology *argp ) +.. c:function:: int ioctl( int fd, int request, struct media_v2_topology *argp ) Arguments diff --git a/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst b/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst index e02fe23de9de..10be4c546f33 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst @@ -15,7 +15,7 @@ MEDIA_IOC_SETUP_LINK - Modify the properties of a link Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct media_link_desc *argp ) +.. c:function:: int ioctl( int fd, int request, struct media_link_desc *argp ) Arguments diff --git a/Documentation/media/uapi/rc/lirc-get-features.rst b/Documentation/media/uapi/rc/lirc-get-features.rst index e763ebfb2cb1..d0c8a426aa16 100644 --- a/Documentation/media/uapi/rc/lirc-get-features.rst +++ b/Documentation/media/uapi/rc/lirc-get-features.rst @@ -14,7 +14,7 @@ LIRC_GET_FEATURES - Get the underlying hardware device's features Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *features) +.. c:function:: int ioctl( int fd, int request, __u32 *features) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-get-length.rst b/Documentation/media/uapi/rc/lirc-get-length.rst index d11c3d3f2c06..44c6e8923b40 100644 --- a/Documentation/media/uapi/rc/lirc-get-length.rst +++ b/Documentation/media/uapi/rc/lirc-get-length.rst @@ -14,7 +14,7 @@ LIRC_GET_LENGTH - Retrieves the code length in bits. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *length ) +.. c:function:: int ioctl( int fd, int request, __u32 *length ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-get-rec-mode.rst b/Documentation/media/uapi/rc/lirc-get-rec-mode.rst index 586860c36791..445c618771f4 100644 --- a/Documentation/media/uapi/rc/lirc-get-rec-mode.rst +++ b/Documentation/media/uapi/rc/lirc-get-rec-mode.rst @@ -15,7 +15,7 @@ LIRC_GET_REC_MODE/LIRC_GET_REC_MODE - Get/set supported receive modes. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 rx_modes) +.. c:function:: int ioctl( int fd, int request, __u32 rx_modes) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-get-rec-resolution.rst b/Documentation/media/uapi/rc/lirc-get-rec-resolution.rst index 6ef1723878b4..3ac3a8199c29 100644 --- a/Documentation/media/uapi/rc/lirc-get-rec-resolution.rst +++ b/Documentation/media/uapi/rc/lirc-get-rec-resolution.rst @@ -14,7 +14,7 @@ LIRC_GET_REC_RESOLUTION - Obtain the value of receive resolution, in microsecond Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *microseconds) +.. c:function:: int ioctl( int fd, int request, __u32 *microseconds) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-get-send-mode.rst b/Documentation/media/uapi/rc/lirc-get-send-mode.rst index 3e1d96122ff2..5e40b7bc1c1f 100644 --- a/Documentation/media/uapi/rc/lirc-get-send-mode.rst +++ b/Documentation/media/uapi/rc/lirc-get-send-mode.rst @@ -15,7 +15,7 @@ LIRC_GET_SEND_MODE/LIRC_SET_SEND_MODE - Get/set supported transmit mode. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *tx_modes ) +.. c:function:: int ioctl( int fd, int request, __u32 *tx_modes ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-get-timeout.rst b/Documentation/media/uapi/rc/lirc-get-timeout.rst index 6b8238f1f30e..0d103f899350 100644 --- a/Documentation/media/uapi/rc/lirc-get-timeout.rst +++ b/Documentation/media/uapi/rc/lirc-get-timeout.rst @@ -16,7 +16,7 @@ range for IR receive. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *timeout) +.. c:function:: int ioctl( int fd, int request, __u32 *timeout) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-read.rst b/Documentation/media/uapi/rc/lirc-read.rst index 8d4e9b6e507d..c5b5e1db7cad 100644 --- a/Documentation/media/uapi/rc/lirc-read.rst +++ b/Documentation/media/uapi/rc/lirc-read.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: ssize_t read( int fd, void *buf, size_t count ) +.. c:function:: ssize_t read( int fd, void *buf, size_t count ) Arguments diff --git a/Documentation/media/uapi/rc/lirc-set-measure-carrier-mode.rst b/Documentation/media/uapi/rc/lirc-set-measure-carrier-mode.rst index e145d9d1902d..ee0b46b44c24 100644 --- a/Documentation/media/uapi/rc/lirc-set-measure-carrier-mode.rst +++ b/Documentation/media/uapi/rc/lirc-set-measure-carrier-mode.rst @@ -14,7 +14,7 @@ LIRC_SET_MEASURE_CARRIER_MODE - enable or disable measure mode Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *enable ) +.. c:function:: int ioctl( int fd, int request, __u32 *enable ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-set-rec-carrier-range.rst b/Documentation/media/uapi/rc/lirc-set-rec-carrier-range.rst index 7cce9c8ba361..44814a5163e6 100644 --- a/Documentation/media/uapi/rc/lirc-set-rec-carrier-range.rst +++ b/Documentation/media/uapi/rc/lirc-set-rec-carrier-range.rst @@ -15,7 +15,7 @@ IR receive. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *frequency ) +.. c:function:: int ioctl( int fd, int request, __u32 *frequency ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-set-rec-carrier.rst b/Documentation/media/uapi/rc/lirc-set-rec-carrier.rst index 17ddb4723caa..c3508b7fd441 100644 --- a/Documentation/media/uapi/rc/lirc-set-rec-carrier.rst +++ b/Documentation/media/uapi/rc/lirc-set-rec-carrier.rst @@ -15,7 +15,7 @@ LIRC_SET_REC_CARRIER - Set carrier used to modulate IR receive. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *frequency ) +.. c:function:: int ioctl( int fd, int request, __u32 *frequency ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-set-rec-timeout-reports.rst b/Documentation/media/uapi/rc/lirc-set-rec-timeout-reports.rst index 0c7f85d0ce3b..676e7698b882 100644 --- a/Documentation/media/uapi/rc/lirc-set-rec-timeout-reports.rst +++ b/Documentation/media/uapi/rc/lirc-set-rec-timeout-reports.rst @@ -14,7 +14,7 @@ LIRC_SET_REC_TIMEOUT_REPORTS - enable or disable timeout reports for IR receive Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *enable ) +.. c:function:: int ioctl( int fd, int request, __u32 *enable ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst b/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst index ffc88f9fcd52..f54026a14c4f 100644 --- a/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst +++ b/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst @@ -14,7 +14,7 @@ LIRC_SET_REC_TIMEOUT - sets the integer value for IR inactivity timeout. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *timeout ) +.. c:function:: int ioctl( int fd, int request, __u32 *timeout ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-set-send-carrier.rst b/Documentation/media/uapi/rc/lirc-set-send-carrier.rst index 4314d4c86ced..fa4df86d7698 100644 --- a/Documentation/media/uapi/rc/lirc-set-send-carrier.rst +++ b/Documentation/media/uapi/rc/lirc-set-send-carrier.rst @@ -15,7 +15,7 @@ LIRC_SET_SEND_CARRIER - Set send carrier used to modulate IR TX. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *frequency ) +.. c:function:: int ioctl( int fd, int request, __u32 *frequency ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-set-send-duty-cycle.rst b/Documentation/media/uapi/rc/lirc-set-send-duty-cycle.rst index 48e7bb15fb69..7a7d2730d727 100644 --- a/Documentation/media/uapi/rc/lirc-set-send-duty-cycle.rst +++ b/Documentation/media/uapi/rc/lirc-set-send-duty-cycle.rst @@ -15,7 +15,7 @@ IR transmit. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *duty_cycle) +.. c:function:: int ioctl( int fd, int request, __u32 *duty_cycle) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-set-transmitter-mask.rst b/Documentation/media/uapi/rc/lirc-set-transmitter-mask.rst index 2b35e21b9bb9..179b835e5b53 100644 --- a/Documentation/media/uapi/rc/lirc-set-transmitter-mask.rst +++ b/Documentation/media/uapi/rc/lirc-set-transmitter-mask.rst @@ -14,7 +14,7 @@ LIRC_SET_TRANSMITTER_MASK - Enables send codes on a given set of transmitters Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *mask ) +.. c:function:: int ioctl( int fd, int request, __u32 *mask ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst b/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst index b9d582fd7df1..4a9101be40aa 100644 --- a/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst +++ b/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst @@ -14,7 +14,7 @@ LIRC_SET_WIDEBAND_RECEIVER - enable wide band receiver. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, __u32 *enable ) +.. c:function:: int ioctl( int fd, int request, __u32 *enable ) Arguments ========= diff --git a/Documentation/media/uapi/rc/lirc-write.rst b/Documentation/media/uapi/rc/lirc-write.rst index dcba3b1bee6e..631d961813d1 100644 --- a/Documentation/media/uapi/rc/lirc-write.rst +++ b/Documentation/media/uapi/rc/lirc-write.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: ssize_t write( int fd, void *buf, size_t count ) +.. c:function:: ssize_t write( int fd, void *buf, size_t count ) Arguments diff --git a/Documentation/media/uapi/v4l/func-close.rst b/Documentation/media/uapi/v4l/func-close.rst index 926a2ccc32e5..148fc009d033 100644 --- a/Documentation/media/uapi/v4l/func-close.rst +++ b/Documentation/media/uapi/v4l/func-close.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int close( int fd ) +.. c:function:: int close( int fd ) Arguments diff --git a/Documentation/media/uapi/v4l/func-ioctl.rst b/Documentation/media/uapi/v4l/func-ioctl.rst index 5632f48fce1b..c207f0727cf1 100644 --- a/Documentation/media/uapi/v4l/func-ioctl.rst +++ b/Documentation/media/uapi/v4l/func-ioctl.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int ioctl( int fd, int request, void *argp ) +.. c:function:: int ioctl( int fd, int request, void *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/func-mmap.rst b/Documentation/media/uapi/v4l/func-mmap.rst index 639fef5b4f78..e30b2981028f 100644 --- a/Documentation/media/uapi/v4l/func-mmap.rst +++ b/Documentation/media/uapi/v4l/func-mmap.rst @@ -21,7 +21,7 @@ Synopsis #include -.. cpp:function:: void *mmap( void *start, size_t length, int prot, int flags, int fd, off_t offset ) +.. c:function:: void *mmap( void *start, size_t length, int prot, int flags, int fd, off_t offset ) Arguments diff --git a/Documentation/media/uapi/v4l/func-munmap.rst b/Documentation/media/uapi/v4l/func-munmap.rst index c29c03f21279..51eafb215838 100644 --- a/Documentation/media/uapi/v4l/func-munmap.rst +++ b/Documentation/media/uapi/v4l/func-munmap.rst @@ -21,7 +21,7 @@ Synopsis #include -.. cpp:function:: int munmap( void *start, size_t length ) +.. c:function:: int munmap( void *start, size_t length ) Arguments diff --git a/Documentation/media/uapi/v4l/func-open.rst b/Documentation/media/uapi/v4l/func-open.rst index 06bcadc269a4..1d9e75d4960a 100644 --- a/Documentation/media/uapi/v4l/func-open.rst +++ b/Documentation/media/uapi/v4l/func-open.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int open( const char *device_name, int flags ) +.. c:function:: int open( const char *device_name, int flags ) Arguments diff --git a/Documentation/media/uapi/v4l/func-poll.rst b/Documentation/media/uapi/v4l/func-poll.rst index e6ceb712b783..da0edfcf9b9b 100644 --- a/Documentation/media/uapi/v4l/func-poll.rst +++ b/Documentation/media/uapi/v4l/func-poll.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout ) +.. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout ) Arguments diff --git a/Documentation/media/uapi/v4l/func-read.rst b/Documentation/media/uapi/v4l/func-read.rst index 9a2aa5210233..9c5b4be926db 100644 --- a/Documentation/media/uapi/v4l/func-read.rst +++ b/Documentation/media/uapi/v4l/func-read.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: ssize_t read( int fd, void *buf, size_t count ) +.. c:function:: ssize_t read( int fd, void *buf, size_t count ) Arguments diff --git a/Documentation/media/uapi/v4l/func-select.rst b/Documentation/media/uapi/v4l/func-select.rst index 7798384ae396..78fa66b984d3 100644 --- a/Documentation/media/uapi/v4l/func-select.rst +++ b/Documentation/media/uapi/v4l/func-select.rst @@ -22,7 +22,7 @@ Synopsis #include -.. cpp:function:: int select( int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) +.. c:function:: int select( int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) Arguments diff --git a/Documentation/media/uapi/v4l/func-write.rst b/Documentation/media/uapi/v4l/func-write.rst index a3bc9b26fe56..c9351a0efd99 100644 --- a/Documentation/media/uapi/v4l/func-write.rst +++ b/Documentation/media/uapi/v4l/func-write.rst @@ -20,7 +20,7 @@ Synopsis #include -.. cpp:function:: ssize_t write( int fd, void *buf, size_t count ) +.. c:function:: ssize_t write( int fd, void *buf, size_t count ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst index b4b16aebac98..d5107466b2c5 100644 --- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst @@ -15,7 +15,7 @@ VIDIOC_CREATE_BUFS - Create buffers for Memory Mapped or User Pointer or DMA Buf Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_create_buffers *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_create_buffers *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-cropcap.rst b/Documentation/media/uapi/v4l/vidioc-cropcap.rst index e3d853356438..30a0493f404a 100644 --- a/Documentation/media/uapi/v4l/vidioc-cropcap.rst +++ b/Documentation/media/uapi/v4l/vidioc-cropcap.rst @@ -15,7 +15,7 @@ VIDIOC_CROPCAP - Information about the video cropping and scaling abilities Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_cropcap *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_cropcap *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst index 4c30b2268c70..f0310afe6606 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst @@ -15,7 +15,7 @@ VIDIOC_DBG_G_CHIP_INFO - Identify the chips on a TV card Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_dbg_chip_info *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_dbg_chip_info *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst index cb6a878a60ea..2b508e8faa4b 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst @@ -15,9 +15,9 @@ VIDIOC_DBG_G_REGISTER - VIDIOC_DBG_S_REGISTER - Read or write hardware registers Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_dbg_register *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_dbg_register *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_dbg_register *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_dbg_register *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst index 63acf4e59530..1d918ade637e 100644 --- a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst @@ -15,7 +15,7 @@ VIDIOC_DECODER_CMD - VIDIOC_TRY_DECODER_CMD - Execute an decoder command Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_decoder_cmd *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_decoder_cmd *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index e5be2a5518af..c2c2a3337d09 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -15,7 +15,7 @@ VIDIOC_DQEVENT - Dequeue event Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_event *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_event *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst index 7054e36e061f..110e5783938d 100644 --- a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst @@ -15,7 +15,7 @@ VIDIOC_DV_TIMINGS_CAP - VIDIOC_SUBDEV_DV_TIMINGS_CAP - The capabilities of the D Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_dv_timings_cap *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_dv_timings_cap *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst index 795d9215017a..756a85f78f31 100644 --- a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst @@ -15,7 +15,7 @@ VIDIOC_ENCODER_CMD - VIDIOC_TRY_ENCODER_CMD - Execute an encoder command Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_encoder_cmd *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_encoder_cmd *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst index c386045885f2..2ca25a58ae4c 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst @@ -15,7 +15,7 @@ VIDIOC_ENUM_DV_TIMINGS - VIDIOC_SUBDEV_ENUM_DV_TIMINGS - Enumerate supported Dig Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_enum_dv_timings *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_enum_dv_timings *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index da0b888c01cb..eca4614a1b13 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -15,7 +15,7 @@ VIDIOC_ENUM_FMT - Enumerate image formats Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_fmtdesc *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_fmtdesc *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst index 7541158e16d2..39fbbb391c99 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst @@ -15,7 +15,7 @@ VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_frmivalenum *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_frmivalenum *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst index 1c23da3f26bc..1d428f88f329 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst @@ -15,7 +15,7 @@ VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_frmsizeenum *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_frmsizeenum *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index 8fac84d839f4..5fe84357d9cd 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -15,7 +15,7 @@ VIDIOC_ENUM_FREQ_BANDS - Enumerate supported frequency bands Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_frequency_band *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_frequency_band *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enumaudio.rst b/Documentation/media/uapi/v4l/vidioc-enumaudio.rst index bfdc3533240d..3127b9062d96 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumaudio.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumaudio.rst @@ -15,7 +15,7 @@ VIDIOC_ENUMAUDIO - Enumerate audio inputs Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_audio *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_audio *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst b/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst index 3112b43242f2..4cbba134e773 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst @@ -15,7 +15,7 @@ VIDIOC_ENUMAUDOUT - Enumerate audio outputs Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_audioout *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_audioout *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index f8188070335e..075cdf2c5749 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -15,7 +15,7 @@ VIDIOC_ENUMINPUT - Enumerate video inputs Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_input *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_input *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst index 6d50b297b0aa..d2c1d4eaaf47 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst @@ -15,7 +15,7 @@ VIDIOC_ENUMOUTPUT - Enumerate video outputs Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_output *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_output *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index 22b4bcde7a79..e07a6c9aedd4 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -15,7 +15,7 @@ VIDIOC_ENUMSTD - Enumerate supported video standards Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_standard *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_standard *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-expbuf.rst b/Documentation/media/uapi/v4l/vidioc-expbuf.rst index 67f72ced2a00..5e2db6efce38 100644 --- a/Documentation/media/uapi/v4l/vidioc-expbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-expbuf.rst @@ -15,7 +15,7 @@ VIDIOC_EXPBUF - Export a buffer as a DMABUF file descriptor. Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_exportbuffer *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_exportbuffer *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-audio.rst b/Documentation/media/uapi/v4l/vidioc-g-audio.rst index 703091ba1391..787668482198 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audio.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audio.rst @@ -15,9 +15,9 @@ VIDIOC_G_AUDIO - VIDIOC_S_AUDIO - Query or select the current audio input and it Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_audio *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_audio *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_audio *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_audio *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst index 1420ddebefd0..ed5ccca8797d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst @@ -15,9 +15,9 @@ VIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_audioout *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_audioout *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_audioout *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_audioout *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-g-crop.rst index 08df93224a38..2b171b5c003e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-crop.rst @@ -15,9 +15,9 @@ VIDIOC_G_CROP - VIDIOC_S_CROP - Get or set the current cropping rectangle Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_crop *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_crop *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_crop *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_crop *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst index e585b04b3f00..8eeb33916a7c 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst @@ -15,7 +15,7 @@ VIDIOC_G_CTRL - VIDIOC_S_CTRL - Get or set the value of a control Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_control *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_control *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index 013f49210de9..401a9ad2ad7b 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -15,7 +15,7 @@ VIDIOC_G_DV_TIMINGS - VIDIOC_S_DV_TIMINGS - VIDIOC_SUBDEV_G_DV_TIMINGS - VIDIOC_ Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_dv_timings *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_dv_timings *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-edid.rst b/Documentation/media/uapi/v4l/vidioc-g-edid.rst index 721d17fc829e..0940d46ad007 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-edid.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-edid.rst @@ -15,7 +15,7 @@ VIDIOC_G_EDID - VIDIOC_S_EDID - VIDIOC_SUBDEV_G_EDID - VIDIOC_SUBDEV_S_EDID - Ge Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_edid *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_edid *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst index 64e74786babf..479993e1fbbf 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst @@ -15,7 +15,7 @@ VIDIOC_G_ENC_INDEX - Get meta data about a compressed video stream Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_enc_idx *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_enc_idx *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index f0d33298f329..d0ddf3094c16 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -15,7 +15,7 @@ VIDIOC_G_EXT_CTRLS - VIDIOC_S_EXT_CTRLS - VIDIOC_TRY_EXT_CTRLS - Get or set the Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_ext_controls *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_ext_controls *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index 562505c5db0b..e7a6e14adb4f 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -15,9 +15,9 @@ VIDIOC_G_FBUF - VIDIOC_S_FBUF - Get or set frame buffer overlay parameters Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_framebuffer *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_framebuffer *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_framebuffer *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_framebuffer *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst index 94e42ac3d4d8..46e5b4de10bc 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst @@ -15,7 +15,7 @@ VIDIOC_G_FMT - VIDIOC_S_FMT - VIDIOC_TRY_FMT - Get or set the data format, try a Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_format *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_format *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst index c0468ff3546e..0810aec0e7b7 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst @@ -15,9 +15,9 @@ VIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio fr Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_frequency *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_frequency *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_frequency *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_frequency *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-input.rst b/Documentation/media/uapi/v4l/vidioc-g-input.rst index 29e22f6f8028..de87712f0336 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-input.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-input.rst @@ -15,7 +15,7 @@ VIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, int *argp ) +.. c:function:: int ioctl( int fd, int request, int *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst index a5a997db7a33..9800037b5ba0 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst @@ -15,9 +15,9 @@ VIDIOC_G_JPEGCOMP - VIDIOC_S_JPEGCOMP Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, v4l2_jpegcompression *argp ) +.. c:function:: int ioctl( int fd, int request, v4l2_jpegcompression *argp ) -.. cpp:function:: int ioctl( int fd, int request, const v4l2_jpegcompression *argp ) +.. c:function:: int ioctl( int fd, int request, const v4l2_jpegcompression *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst index 0b362fc8ec29..4f8d2babe79a 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst @@ -15,9 +15,9 @@ VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_modulator *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_modulator *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_modulator *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_modulator *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-output.rst b/Documentation/media/uapi/v4l/vidioc-g-output.rst index ae0ad577ba97..1b7fffe7f075 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-output.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-output.rst @@ -15,7 +15,7 @@ VIDIOC_G_OUTPUT - VIDIOC_S_OUTPUT - Query or select the current video output Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, int *argp ) +.. c:function:: int ioctl( int fd, int request, int *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-parm.rst b/Documentation/media/uapi/v4l/vidioc-g-parm.rst index 1b044613ab68..000109a0c86d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-parm.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-parm.rst @@ -15,7 +15,7 @@ VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, v4l2_streamparm *argp ) +.. c:function:: int ioctl( int fd, int request, v4l2_streamparm *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-priority.rst b/Documentation/media/uapi/v4l/vidioc-g-priority.rst index 3f021e6b9d0d..cafa7d099b86 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-priority.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-priority.rst @@ -15,9 +15,9 @@ VIDIOC_G_PRIORITY - VIDIOC_S_PRIORITY - Query or request the access priority ass Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, enum v4l2_priority *argp ) +.. c:function:: int ioctl( int fd, int request, enum v4l2_priority *argp ) -.. cpp:function:: int ioctl( int fd, int request, const enum v4l2_priority *argp ) +.. c:function:: int ioctl( int fd, int request, const enum v4l2_priority *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-g-selection.rst index 8e72f93a358e..e01e92549032 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-selection.rst @@ -15,7 +15,7 @@ VIDIOC_G_SELECTION - VIDIOC_S_SELECTION - Get or set one of the selection rectan Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_selection *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_selection *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index 87c23f289fb4..0ce63cc97878 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -15,7 +15,7 @@ VIDIOC_G_SLICED_VBI_CAP - Query sliced VBI capabilities Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_sliced_vbi_cap *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_sliced_vbi_cap *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-std.rst b/Documentation/media/uapi/v4l/vidioc-g-std.rst index 5c2b861f8d26..4fd57e7ed0d1 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-std.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-std.rst @@ -15,9 +15,9 @@ VIDIOC_G_STD - VIDIOC_S_STD - Query or select the video standard of the current Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, v4l2_std_id *argp ) +.. c:function:: int ioctl( int fd, int request, v4l2_std_id *argp ) -.. cpp:function:: int ioctl( int fd, int request, const v4l2_std_id *argp ) +.. c:function:: int ioctl( int fd, int request, const v4l2_std_id *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index e53abcbe9ea1..989dd53b16af 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -15,9 +15,9 @@ VIDIOC_G_TUNER - VIDIOC_S_TUNER - Get or set tuner attributes Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_tuner *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_tuner *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_tuner *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_tuner *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-log-status.rst b/Documentation/media/uapi/v4l/vidioc-log-status.rst index 66fc352c0ffa..6cf7904dd34c 100644 --- a/Documentation/media/uapi/v4l/vidioc-log-status.rst +++ b/Documentation/media/uapi/v4l/vidioc-log-status.rst @@ -15,7 +15,7 @@ VIDIOC_LOG_STATUS - Log driver status information Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request ) +.. c:function:: int ioctl( int fd, int request ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-overlay.rst b/Documentation/media/uapi/v4l/vidioc-overlay.rst index 191dbc144ef7..e7a3956cba3d 100644 --- a/Documentation/media/uapi/v4l/vidioc-overlay.rst +++ b/Documentation/media/uapi/v4l/vidioc-overlay.rst @@ -15,7 +15,7 @@ VIDIOC_OVERLAY - Start or stop video overlay Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, const int *argp ) +.. c:function:: int ioctl( int fd, int request, const int *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst b/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst index 79076dff46fd..0baa692edd33 100644 --- a/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst +++ b/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst @@ -15,7 +15,7 @@ VIDIOC_PREPARE_BUF - Prepare a buffer for I/O Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst b/Documentation/media/uapi/v4l/vidioc-qbuf.rst index 31c360d7d1a6..ec5cb57d4acf 100644 --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst @@ -15,7 +15,7 @@ VIDIOC_QBUF - VIDIOC_DQBUF - Exchange a buffer with the driver Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst index 6a87f44cdf3f..c262b0a0ef4a 100644 --- a/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst @@ -15,7 +15,7 @@ VIDIOC_QUERY_DV_TIMINGS - VIDIOC_SUBDEV_QUERY_DV_TIMINGS - Sense the DV preset r Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_dv_timings *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_dv_timings *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-querybuf.rst b/Documentation/media/uapi/v4l/vidioc-querybuf.rst index 32af6f7b5060..f180c42883fa 100644 --- a/Documentation/media/uapi/v4l/vidioc-querybuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-querybuf.rst @@ -15,7 +15,7 @@ VIDIOC_QUERYBUF - Query the status of a buffer Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index 5b9922e83c58..c821a6c77ab5 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -15,7 +15,7 @@ VIDIOC_QUERYCAP - Query device capabilities Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_capability *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_capability *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index 6e4912f2e3a4..25c7c035cccc 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -15,11 +15,11 @@ VIDIOC_QUERYCTRL - VIDIOC_QUERY_EXT_CTRL - VIDIOC_QUERYMENU - Enumerate controls Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_queryctrl *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_queryctrl *argp ) -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_query_ext_ctrl *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_query_ext_ctrl *argp ) -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_querymenu *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_querymenu *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-querystd.rst b/Documentation/media/uapi/v4l/vidioc-querystd.rst index cb03d249417c..9324659cebc6 100644 --- a/Documentation/media/uapi/v4l/vidioc-querystd.rst +++ b/Documentation/media/uapi/v4l/vidioc-querystd.rst @@ -15,7 +15,7 @@ VIDIOC_QUERYSTD - Sense the video standard received by the current input Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, v4l2_std_id *argp ) +.. c:function:: int ioctl( int fd, int request, v4l2_std_id *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst index 8be9343802dc..2078b0b00a9e 100644 --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst @@ -15,7 +15,7 @@ VIDIOC_REQBUFS - Initiate Memory Mapping, User Pointer I/O or DMA buffer I/O Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_requestbuffers *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_requestbuffers *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst index 2bc10ebb12a4..765a8453103f 100644 --- a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst +++ b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst @@ -15,7 +15,7 @@ VIDIOC_S_HW_FREQ_SEEK - Perform a hardware frequency seek Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_hw_freq_seek *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_hw_freq_seek *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-streamon.rst b/Documentation/media/uapi/v4l/vidioc-streamon.rst index 7fa4362f9a81..d27afa21b925 100644 --- a/Documentation/media/uapi/v4l/vidioc-streamon.rst +++ b/Documentation/media/uapi/v4l/vidioc-streamon.rst @@ -15,7 +15,7 @@ VIDIOC_STREAMON - VIDIOC_STREAMOFF - Start or stop streaming I/O Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, const int *argp ) +.. c:function:: int ioctl( int fd, int request, const int *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst index 1c853f3f5676..290ba88eb208 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst @@ -15,7 +15,7 @@ VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_interval_enum * argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_interval_enum * argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst index e1bcc69f67db..d26709184369 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst @@ -15,7 +15,7 @@ VIDIOC_SUBDEV_ENUM_FRAME_SIZE - Enumerate media bus frame sizes Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_size_enum * argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_size_enum * argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst index 418d543ebbbf..a1dabf071437 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst @@ -15,7 +15,7 @@ VIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_mbus_code_enum * argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_mbus_code_enum * argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst index 7caa04e1c2a8..c3e32c94937b 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst @@ -15,9 +15,9 @@ VIDIOC_SUBDEV_G_CROP - VIDIOC_SUBDEV_S_CROP - Get or set the crop rectangle on a Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_crop *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_crop *argp ) -.. cpp:function:: int ioctl( int fd, int request, const struct v4l2_subdev_crop *argp ) +.. c:function:: int ioctl( int fd, int request, const struct v4l2_subdev_crop *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst index f5e9b40b22f4..55b113de91bb 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst @@ -15,7 +15,7 @@ VIDIOC_SUBDEV_G_FMT - VIDIOC_SUBDEV_S_FMT - Get or set the data format on a subd Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_format *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_format *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst index 2df2d8635f2b..056af63b9cfa 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst @@ -15,7 +15,7 @@ VIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_interval *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_interval *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst index c59a32e0cc20..5c1626a4feaf 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst @@ -15,7 +15,7 @@ VIDIOC_SUBDEV_G_SELECTION - VIDIOC_SUBDEV_S_SELECTION - Get or set selection rec Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_selection *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_selection *argp ) Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst index 71079746ddac..7015bb283a6a 100644 --- a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst +++ b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst @@ -16,7 +16,7 @@ VIDIOC_SUBSCRIBE_EVENT - VIDIOC_UNSUBSCRIBE_EVENT - Subscribe or unsubscribe eve Synopsis ======== -.. cpp:function:: int ioctl( int fd, int request, struct v4l2_event_subscription *argp ) +.. c:function:: int ioctl( int fd, int request, struct v4l2_event_subscription *argp ) Arguments From 41d804653ec8aaee432bfd9a78f4c0e24553f5ab Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 16:53:38 -0300 Subject: [PATCH 108/591] [media] docs-rst: Convert V4L2 uAPI to use C function references Name all ioctl references and make them match the ioctls that are documented. That will improve the cross-reference index, as it will have all ioctls and syscalls there. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/func-close.rst | 2 +- Documentation/media/uapi/v4l/func-ioctl.rst | 2 +- Documentation/media/uapi/v4l/func-mmap.rst | 2 +- Documentation/media/uapi/v4l/func-munmap.rst | 2 +- Documentation/media/uapi/v4l/func-open.rst | 2 +- Documentation/media/uapi/v4l/func-poll.rst | 2 +- Documentation/media/uapi/v4l/func-read.rst | 6 ++++-- Documentation/media/uapi/v4l/func-select.rst | 16 +++++++++++++++- Documentation/media/uapi/v4l/func-write.rst | 6 ++++-- .../media/uapi/v4l/vidioc-create-bufs.rst | 6 ++---- Documentation/media/uapi/v4l/vidioc-cropcap.rst | 6 ++---- .../media/uapi/v4l/vidioc-dbg-g-chip-info.rst | 6 ++---- .../media/uapi/v4l/vidioc-dbg-g-register.rst | 9 ++++----- .../media/uapi/v4l/vidioc-decoder-cmd.rst | 11 +++++++---- Documentation/media/uapi/v4l/vidioc-dqevent.rst | 6 ++---- .../media/uapi/v4l/vidioc-dv-timings-cap.rst | 9 +++++---- .../media/uapi/v4l/vidioc-encoder-cmd.rst | 9 +++++---- .../media/uapi/v4l/vidioc-enum-dv-timings.rst | 9 +++++---- .../media/uapi/v4l/vidioc-enum-fmt.rst | 6 ++---- .../uapi/v4l/vidioc-enum-frameintervals.rst | 6 ++---- .../media/uapi/v4l/vidioc-enum-framesizes.rst | 6 ++---- .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 6 ++---- .../media/uapi/v4l/vidioc-enumaudio.rst | 6 ++---- .../media/uapi/v4l/vidioc-enumaudioout.rst | 6 ++---- .../media/uapi/v4l/vidioc-enuminput.rst | 6 ++---- .../media/uapi/v4l/vidioc-enumoutput.rst | 6 ++---- Documentation/media/uapi/v4l/vidioc-enumstd.rst | 6 ++---- Documentation/media/uapi/v4l/vidioc-expbuf.rst | 6 ++---- Documentation/media/uapi/v4l/vidioc-g-audio.rst | 9 ++++----- .../media/uapi/v4l/vidioc-g-audioout.rst | 9 ++++----- Documentation/media/uapi/v4l/vidioc-g-crop.rst | 9 ++++----- Documentation/media/uapi/v4l/vidioc-g-ctrl.rst | 9 +++++---- .../media/uapi/v4l/vidioc-g-dv-timings.rst | 16 +++++++++++----- Documentation/media/uapi/v4l/vidioc-g-edid.rst | 17 ++++++++++++----- .../media/uapi/v4l/vidioc-g-enc-index.rst | 6 ++---- .../media/uapi/v4l/vidioc-g-ext-ctrls.rst | 15 ++++++++++----- Documentation/media/uapi/v4l/vidioc-g-fbuf.rst | 9 ++++----- Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 11 +++++++---- .../media/uapi/v4l/vidioc-g-frequency.rst | 9 ++++----- Documentation/media/uapi/v4l/vidioc-g-input.rst | 9 +++++---- .../media/uapi/v4l/vidioc-g-jpegcomp.rst | 9 ++++----- .../media/uapi/v4l/vidioc-g-modulator.rst | 9 ++++----- .../media/uapi/v4l/vidioc-g-output.rst | 9 +++++---- Documentation/media/uapi/v4l/vidioc-g-parm.rst | 9 +++++---- .../media/uapi/v4l/vidioc-g-priority.rst | 9 ++++----- .../media/uapi/v4l/vidioc-g-selection.rst | 7 ++++++- .../media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 6 ++---- Documentation/media/uapi/v4l/vidioc-g-std.rst | 9 ++++----- Documentation/media/uapi/v4l/vidioc-g-tuner.rst | 9 ++++----- .../media/uapi/v4l/vidioc-log-status.rst | 5 ++++- Documentation/media/uapi/v4l/vidioc-overlay.rst | 6 ++---- .../media/uapi/v4l/vidioc-prepare-buf.rst | 6 ++---- Documentation/media/uapi/v4l/vidioc-qbuf.rst | 9 +++++---- .../media/uapi/v4l/vidioc-query-dv-timings.rst | 9 +++++---- .../media/uapi/v4l/vidioc-querybuf.rst | 6 ++---- .../media/uapi/v4l/vidioc-querycap.rst | 6 ++---- .../media/uapi/v4l/vidioc-queryctrl.rst | 12 ++++++------ .../media/uapi/v4l/vidioc-querystd.rst | 6 ++---- Documentation/media/uapi/v4l/vidioc-reqbufs.rst | 6 ++---- .../media/uapi/v4l/vidioc-s-hw-freq-seek.rst | 6 ++---- .../media/uapi/v4l/vidioc-streamon.rst | 9 +++++---- .../v4l/vidioc-subdev-enum-frame-interval.rst | 6 ++---- .../uapi/v4l/vidioc-subdev-enum-frame-size.rst | 6 ++---- .../uapi/v4l/vidioc-subdev-enum-mbus-code.rst | 6 ++---- .../media/uapi/v4l/vidioc-subdev-g-crop.rst | 9 ++++----- .../media/uapi/v4l/vidioc-subdev-g-fmt.rst | 9 +++++---- .../uapi/v4l/vidioc-subdev-g-frame-interval.rst | 10 +++++----- .../uapi/v4l/vidioc-subdev-g-selection.rst | 9 +++++---- .../media/uapi/v4l/vidioc-subscribe-event.rst | 9 +++++---- 69 files changed, 262 insertions(+), 263 deletions(-) diff --git a/Documentation/media/uapi/v4l/func-close.rst b/Documentation/media/uapi/v4l/func-close.rst index 148fc009d033..e85a6744eb91 100644 --- a/Documentation/media/uapi/v4l/func-close.rst +++ b/Documentation/media/uapi/v4l/func-close.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: int close( int fd ) - + :name: v4l2-close Arguments ========= diff --git a/Documentation/media/uapi/v4l/func-ioctl.rst b/Documentation/media/uapi/v4l/func-ioctl.rst index c207f0727cf1..ebfbe92f0478 100644 --- a/Documentation/media/uapi/v4l/func-ioctl.rst +++ b/Documentation/media/uapi/v4l/func-ioctl.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: int ioctl( int fd, int request, void *argp ) - + :name: v4l2-ioctl Arguments ========= diff --git a/Documentation/media/uapi/v4l/func-mmap.rst b/Documentation/media/uapi/v4l/func-mmap.rst index e30b2981028f..bd19cef952f5 100644 --- a/Documentation/media/uapi/v4l/func-mmap.rst +++ b/Documentation/media/uapi/v4l/func-mmap.rst @@ -22,7 +22,7 @@ Synopsis .. c:function:: void *mmap( void *start, size_t length, int prot, int flags, int fd, off_t offset ) - + :name: v4l2-mmap Arguments ========= diff --git a/Documentation/media/uapi/v4l/func-munmap.rst b/Documentation/media/uapi/v4l/func-munmap.rst index 51eafb215838..a1a4d8cb6c4b 100644 --- a/Documentation/media/uapi/v4l/func-munmap.rst +++ b/Documentation/media/uapi/v4l/func-munmap.rst @@ -22,7 +22,7 @@ Synopsis .. c:function:: int munmap( void *start, size_t length ) - + :name: v4l2-munmap Arguments ========= diff --git a/Documentation/media/uapi/v4l/func-open.rst b/Documentation/media/uapi/v4l/func-open.rst index 1d9e75d4960a..deea34cc778b 100644 --- a/Documentation/media/uapi/v4l/func-open.rst +++ b/Documentation/media/uapi/v4l/func-open.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: int open( const char *device_name, int flags ) - + :name: v4l2-open Arguments ========= diff --git a/Documentation/media/uapi/v4l/func-poll.rst b/Documentation/media/uapi/v4l/func-poll.rst index da0edfcf9b9b..186cd61b6cd1 100644 --- a/Documentation/media/uapi/v4l/func-poll.rst +++ b/Documentation/media/uapi/v4l/func-poll.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout ) - + name: v4l2-poll Arguments ========= diff --git a/Documentation/media/uapi/v4l/func-read.rst b/Documentation/media/uapi/v4l/func-read.rst index 9c5b4be926db..ae38c2d59d49 100644 --- a/Documentation/media/uapi/v4l/func-read.rst +++ b/Documentation/media/uapi/v4l/func-read.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: ssize_t read( int fd, void *buf, size_t count ) - + :name: v4l2-read Arguments ========= @@ -30,8 +30,10 @@ Arguments File descriptor returned by :ref:`open() `. ``buf`` -``count`` + Buffer to be filled +``count`` + Max number of bytes to read Description =========== diff --git a/Documentation/media/uapi/v4l/func-select.rst b/Documentation/media/uapi/v4l/func-select.rst index 78fa66b984d3..002dedba2666 100644 --- a/Documentation/media/uapi/v4l/func-select.rst +++ b/Documentation/media/uapi/v4l/func-select.rst @@ -23,11 +23,25 @@ Synopsis .. c:function:: int select( int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) - + :name: v4l2-select Arguments ========= +``nfds`` + The highest-numbered file descriptor in any of the three sets, plus 1. + +``readfds`` + File descriptions to be watched if a read() call won't block. + +``writefds`` + File descriptions to be watched if a write() won't block. + +``exceptfds`` + File descriptions to be watched for V4L2 events. + +``timeout`` + Maximum time to wait. Description diff --git a/Documentation/media/uapi/v4l/func-write.rst b/Documentation/media/uapi/v4l/func-write.rst index c9351a0efd99..938f33f85455 100644 --- a/Documentation/media/uapi/v4l/func-write.rst +++ b/Documentation/media/uapi/v4l/func-write.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: ssize_t write( int fd, void *buf, size_t count ) - + :name: v4l2-write Arguments ========= @@ -30,8 +30,10 @@ Arguments File descriptor returned by :ref:`open() `. ``buf`` -``count`` + Buffer with data to be written +``count`` + Number of bytes at the buffer Description =========== diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst index d5107466b2c5..dc75f21e4b4c 100644 --- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst @@ -15,7 +15,8 @@ VIDIOC_CREATE_BUFS - Create buffers for Memory Mapped or User Pointer or DMA Buf Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_create_buffers *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_CREATE_BUFS, struct v4l2_create_buffers *argp ) + :name: VIDIOC_CREATE_BUFS Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_CREATE_BUFS - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-cropcap.rst b/Documentation/media/uapi/v4l/vidioc-cropcap.rst index 30a0493f404a..b41fdd69054b 100644 --- a/Documentation/media/uapi/v4l/vidioc-cropcap.rst +++ b/Documentation/media/uapi/v4l/vidioc-cropcap.rst @@ -15,7 +15,8 @@ VIDIOC_CROPCAP - Information about the video cropping and scaling abilities Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_cropcap *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_CROPCAP, struct v4l2_cropcap *argp ) + :name: VIDIOC_CROPCAP Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_CROPCAP - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst index f0310afe6606..9c97527dc2cf 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst @@ -15,7 +15,8 @@ VIDIOC_DBG_G_CHIP_INFO - Identify the chips on a TV card Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_dbg_chip_info *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_DBG_G_CHIP_INFO, struct v4l2_dbg_chip_info *argp ) + :name: VIDIOC_DBG_G_CHIP_INFO Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_DBG_G_CHIP_INFO - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst index 2b508e8faa4b..6eeb0de24b50 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst @@ -15,9 +15,11 @@ VIDIOC_DBG_G_REGISTER - VIDIOC_DBG_S_REGISTER - Read or write hardware registers Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_dbg_register *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_DBG_G_REGISTER, struct v4l2_dbg_register *argp ) + :name: VIDIOC_DBG_G_REGISTER -.. c:function:: int ioctl( int fd, int request, const struct v4l2_dbg_register *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_DBG_S_REGISTER, const struct v4l2_dbg_register *argp ) + :name: VIDIOC_DBG_S_REGISTER Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst index 1d918ade637e..6077caac6086 100644 --- a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst @@ -15,7 +15,12 @@ VIDIOC_DECODER_CMD - VIDIOC_TRY_DECODER_CMD - Execute an decoder command Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_decoder_cmd *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_DECODER_CMD, struct v4l2_decoder_cmd *argp ) + :name: VIDIOC_DECODER_CMD + + +.. c:function:: int ioctl( int fd, VIDIOC_TRY_DECODER_CMD, struct v4l2_decoder_cmd *argp ) + :name: VIDIOC_TRY_DECODER_CMD Arguments @@ -24,10 +29,8 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD - ``argp`` + pointer to struct :ref:`v4l2_decoder_cmd `. Description diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index c2c2a3337d09..067e0aa27918 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -15,7 +15,8 @@ VIDIOC_DQEVENT - Dequeue event Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_event *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_DQEVENT, struct v4l2_event *argp ) + :name: VIDIOC_DQEVENT Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_DQEVENT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst index 110e5783938d..741718baf14b 100644 --- a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst @@ -15,7 +15,11 @@ VIDIOC_DV_TIMINGS_CAP - VIDIOC_SUBDEV_DV_TIMINGS_CAP - The capabilities of the D Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_dv_timings_cap *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_DV_TIMINGS_CAP, struct v4l2_dv_timings_cap *argp ) + :name: VIDIOC_DV_TIMINGS_CAP + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_DV_TIMINGS_CAP, struct v4l2_dv_timings_cap *argp ) + :name: VIDIOC_SUBDEV_DV_TIMINGS_CAP Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst index 756a85f78f31..802eac3ca9ec 100644 --- a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst @@ -15,7 +15,11 @@ VIDIOC_ENCODER_CMD - VIDIOC_TRY_ENCODER_CMD - Execute an encoder command Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_encoder_cmd *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENCODER_CMD, struct v4l2_encoder_cmd *argp ) + :name: VIDIOC_ENCODER_CMD + +.. c:function:: int ioctl( int fd, VIDIOC_TRY_ENCODER_CMD, struct v4l2_encoder_cmd *argp ) + :name: VIDIOC_TRY_ENCODER_CMD Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst index 2ca25a58ae4c..db9613c9b4bd 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst @@ -15,7 +15,11 @@ VIDIOC_ENUM_DV_TIMINGS - VIDIOC_SUBDEV_ENUM_DV_TIMINGS - Enumerate supported Dig Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_enum_dv_timings *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUM_DV_TIMINGS, struct v4l2_enum_dv_timings *argp ) + :name: VIDIOC_ENUM_DV_TIMINGS + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_ENUM_DV_TIMINGS, struct v4l2_enum_dv_timings *argp ) + :name: VIDIOC_SUBDEV_ENUM_DV_TIMINGS Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index eca4614a1b13..1a4834934085 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -15,7 +15,8 @@ VIDIOC_ENUM_FMT - Enumerate image formats Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_fmtdesc *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUM_FMT, struct v4l2_fmtdesc *argp ) + :name: VIDIOC_ENUM_FMT Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUM_FMT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst index 39fbbb391c99..f9bb6fb4ca8e 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst @@ -15,7 +15,8 @@ VIDIOC_ENUM_FRAMEINTERVALS - Enumerate frame intervals Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_frmivalenum *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUM_FRAMEINTERVALS, struct v4l2_frmivalenum *argp ) + :name: VIDIOC_ENUM_FRAMEINTERVALS Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUM_FRAMEINTERVALS - ``argp`` Pointer to a struct :ref:`v4l2_frmivalenum ` structure that contains a pixel format and size and receives a frame diff --git a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst index 1d428f88f329..4fb19b75abf1 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst @@ -15,7 +15,8 @@ VIDIOC_ENUM_FRAMESIZES - Enumerate frame sizes Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_frmsizeenum *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUM_FRAMESIZES, struct v4l2_frmsizeenum *argp ) + :name: VIDIOC_ENUM_FRAMESIZES Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUM_FRAMESIZES - ``argp`` Pointer to a struct :ref:`v4l2_frmsizeenum ` that contains an index and pixel format and receives a frame width diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index 5fe84357d9cd..60ae938d5ef8 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -15,7 +15,8 @@ VIDIOC_ENUM_FREQ_BANDS - Enumerate supported frequency bands Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_frequency_band *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUM_FREQ_BANDS, struct v4l2_frequency_band *argp ) + :name: VIDIOC_ENUM_FREQ_BANDS Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUM_FREQ_BANDS - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-enumaudio.rst b/Documentation/media/uapi/v4l/vidioc-enumaudio.rst index 3127b9062d96..c9d9eb60551e 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumaudio.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumaudio.rst @@ -15,7 +15,8 @@ VIDIOC_ENUMAUDIO - Enumerate audio inputs Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_audio *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUMAUDIO, struct v4l2_audio *argp ) + :name: VIDIOC_ENUMAUDIO Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUMAUDIO - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst b/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst index 4cbba134e773..a7a27327fe88 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst @@ -15,7 +15,8 @@ VIDIOC_ENUMAUDOUT - Enumerate audio outputs Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_audioout *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUMAUDOUT, struct v4l2_audioout *argp ) + :name: VIDIOC_ENUMAUDOUT Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUMAUDOUT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index 075cdf2c5749..51747b7b7f29 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -15,7 +15,8 @@ VIDIOC_ENUMINPUT - Enumerate video inputs Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_input *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUMINPUT, struct v4l2_input *argp ) + :name: VIDIOC_ENUMINPUT Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUMINPUT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst index d2c1d4eaaf47..d660c37d3516 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst @@ -15,7 +15,8 @@ VIDIOC_ENUMOUTPUT - Enumerate video outputs Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_output *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUMOUTPUT, struct v4l2_output *argp ) + :name: VIDIOC_ENUMOUTPUT Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUMOUTPUT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index e07a6c9aedd4..5bd85932d33b 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -15,7 +15,8 @@ VIDIOC_ENUMSTD - Enumerate supported video standards Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_standard *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_ENUMSTD, struct v4l2_standard *argp ) + :name: VIDIOC_ENUMSTD Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_ENUMSTD - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-expbuf.rst b/Documentation/media/uapi/v4l/vidioc-expbuf.rst index 5e2db6efce38..f7b8d643fd28 100644 --- a/Documentation/media/uapi/v4l/vidioc-expbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-expbuf.rst @@ -15,7 +15,8 @@ VIDIOC_EXPBUF - Export a buffer as a DMABUF file descriptor. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_exportbuffer *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_EXPBUF, struct v4l2_exportbuffer *argp ) + :name: VIDIOC_EXPBUF Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_EXPBUF - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-audio.rst b/Documentation/media/uapi/v4l/vidioc-g-audio.rst index 787668482198..224a09c2c53d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audio.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audio.rst @@ -15,9 +15,11 @@ VIDIOC_G_AUDIO - VIDIOC_S_AUDIO - Query or select the current audio input and it Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_audio *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_AUDIO, struct v4l2_audio *argp ) + :name: VIDIOC_G_AUDIO -.. c:function:: int ioctl( int fd, int request, const struct v4l2_audio *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_AUDIO, const struct v4l2_audio *argp ) + :name: VIDIOC_S_AUDIO Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_AUDIO, VIDIOC_S_AUDIO - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst index ed5ccca8797d..da8db3b42262 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst @@ -15,9 +15,11 @@ VIDIOC_G_AUDOUT - VIDIOC_S_AUDOUT - Query or select the current audio output Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_audioout *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_AUDOUT, struct v4l2_audioout *argp ) + :name: VIDIOC_G_AUDOUT -.. c:function:: int ioctl( int fd, int request, const struct v4l2_audioout *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_AUDOUT, const struct v4l2_audioout *argp ) + :name: VIDIOC_S_AUDOUT Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-g-crop.rst index 2b171b5c003e..d4b0607162c5 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-crop.rst @@ -15,9 +15,11 @@ VIDIOC_G_CROP - VIDIOC_S_CROP - Get or set the current cropping rectangle Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_crop *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_CROP, struct v4l2_crop *argp ) + :name: VIDIOC_G_CROP -.. c:function:: int ioctl( int fd, int request, const struct v4l2_crop *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_CROP, const struct v4l2_crop *argp ) + :name: VIDIOC_S_CROP Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_CROP, VIDIOC_S_CROP - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst index 8eeb33916a7c..6ced76016246 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst @@ -15,7 +15,11 @@ VIDIOC_G_CTRL - VIDIOC_S_CTRL - Get or set the value of a control Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_control *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_CTRL, struct v4l2_control *argp ) + :name: VIDIOC_G_CTRL + +.. c:function:: int ioctl( int fd, VIDIOC_S_CTRL, struct v4l2_control *argp ) + :name: VIDIOC_S_CTRL Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_CTRL, VIDIOC_S_CTRL - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index 401a9ad2ad7b..d75bf6742c5d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -15,7 +15,17 @@ VIDIOC_G_DV_TIMINGS - VIDIOC_S_DV_TIMINGS - VIDIOC_SUBDEV_G_DV_TIMINGS - VIDIOC_ Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_dv_timings *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_DV_TIMINGS, struct v4l2_dv_timings *argp ) + :name: VIDIOC_G_DV_TIMINGS + +.. c:function:: int ioctl( int fd, VIDIOC_S_DV_TIMINGS, struct v4l2_dv_timings *argp ) + :name: VIDIOC_S_DV_TIMINGS + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_DV_TIMINGS, struct v4l2_dv_timings *argp ) + :name: VIDIOC_SUBDEV_G_DV_TIMINGS + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_DV_TIMINGS, struct v4l2_dv_timings *argp ) + :name: VIDIOC_SUBDEV_S_DV_TIMINGS Arguments @@ -24,10 +34,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS, - VIDIOC_SUBDEV_G_DV_TIMINGS, VIDIOC_SUBDEV_S_DV_TIMINGS - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-edid.rst b/Documentation/media/uapi/v4l/vidioc-g-edid.rst index 0940d46ad007..b288d8ee49ef 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-edid.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-edid.rst @@ -15,7 +15,18 @@ VIDIOC_G_EDID - VIDIOC_S_EDID - VIDIOC_SUBDEV_G_EDID - VIDIOC_SUBDEV_S_EDID - Ge Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_edid *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_EDID, struct v4l2_edid *argp ) + :name: VIDIOC_G_EDID + +.. c:function:: int ioctl( int fd, VIDIOC_S_EDID, struct v4l2_edid *argp ) + :name: VIDIOC_S_EDID + + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_EDID, struct v4l2_edid *argp ) + :name: VIDIOC_SUBDEV_G_EDID + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_EDID, struct v4l2_edid *argp ) + :name: VIDIOC_SUBDEV_S_EDID Arguments @@ -24,10 +35,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, - VIDIOC_SUBDEV_S_EDID - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst index 479993e1fbbf..3decb810c8bb 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst @@ -15,7 +15,8 @@ VIDIOC_G_ENC_INDEX - Get meta data about a compressed video stream Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_enc_idx *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_ENC_INDEX, struct v4l2_enc_idx *argp ) + :name: VIDIOC_G_ENC_INDEX Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_ENC_INDEX - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index d0ddf3094c16..ee72c69f902a 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -15,7 +15,16 @@ VIDIOC_G_EXT_CTRLS - VIDIOC_S_EXT_CTRLS - VIDIOC_TRY_EXT_CTRLS - Get or set the Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_ext_controls *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_EXT_CTRLS, struct v4l2_ext_controls *argp ) + :name: VIDIOC_G_EXT_CTRLS + + +.. c:function:: int ioctl( int fd, VIDIOC_S_EXT_CTRLS, struct v4l2_ext_controls *argp ) + :name: VIDIOC_S_EXT_CTRLS + + +.. c:function:: int ioctl( int fd, VIDIOC_TRY_EXT_CTRLS, struct v4l2_ext_controls *argp ) + :name: VIDIOC_TRY_EXT_CTRLS Arguments @@ -24,10 +33,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, - VIDIOC_TRY_EXT_CTRLS - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index e7a6e14adb4f..00f783692752 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -15,9 +15,11 @@ VIDIOC_G_FBUF - VIDIOC_S_FBUF - Get or set frame buffer overlay parameters Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_framebuffer *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_FBUF, struct v4l2_framebuffer *argp ) + :name: VIDIOC_G_FBUF -.. c:function:: int ioctl( int fd, int request, const struct v4l2_framebuffer *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_FBUF, const struct v4l2_framebuffer *argp ) + :name: VIDIOC_S_FBUF Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_FBUF, VIDIOC_S_FBUF - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst index 46e5b4de10bc..ebeb7e9a48ea 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst @@ -15,8 +15,14 @@ VIDIOC_G_FMT - VIDIOC_S_FMT - VIDIOC_TRY_FMT - Get or set the data format, try a Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_format *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_FMT, struct v4l2_format *argp ) + :name: VIDIOC_G_FMT +.. c:function:: int ioctl( int fd, VIDIOC_S_FMT, struct v4l2_format *argp ) + :name: VIDIOC_S_FMT + +.. c:function:: int ioctl( int fd, VIDIOC_TRY_FMT, struct v4l2_format *argp ) + :name: VIDIOC_TRY_FMT Arguments ========= @@ -24,9 +30,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst index 0810aec0e7b7..d517c7bb2182 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst @@ -15,9 +15,11 @@ VIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio fr Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_frequency *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_FREQUENCY, struct v4l2_frequency *argp ) + :name: VIDIOC_G_FREQUENCY -.. c:function:: int ioctl( int fd, int request, const struct v4l2_frequency *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_FREQUENCY, const struct v4l2_frequency *argp ) + :name: VIDIOC_S_FREQUENCY Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-input.rst b/Documentation/media/uapi/v4l/vidioc-g-input.rst index de87712f0336..32735d20066c 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-input.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-input.rst @@ -15,7 +15,11 @@ VIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input Synopsis ======== -.. c:function:: int ioctl( int fd, int request, int *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_INPUT, int *argp ) + :name: VIDIOC_G_INPUT + +.. c:function:: int ioctl( int fd, VIDIOC_S_INPUT, int *argp ) + :name: VIDIOC_S_INPUT Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_INPUT, VIDIOC_S_INPUT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst index 9800037b5ba0..387c71c209bc 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst @@ -15,9 +15,11 @@ VIDIOC_G_JPEGCOMP - VIDIOC_S_JPEGCOMP Synopsis ======== -.. c:function:: int ioctl( int fd, int request, v4l2_jpegcompression *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_JPEGCOMP, v4l2_jpegcompression *argp ) + :name: VIDIOC_G_JPEGCOMP -.. c:function:: int ioctl( int fd, int request, const v4l2_jpegcompression *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_JPEGCOMP, const v4l2_jpegcompression *argp ) + :name: VIDIOC_S_JPEGCOMP Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_JPEGCOMP, VIDIOC_S_JPEGCOMP - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst index 4f8d2babe79a..c7729e67e8d9 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst @@ -15,9 +15,11 @@ VIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_modulator *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_MODULATOR, struct v4l2_modulator *argp ) + :name: VIDIOC_G_MODULATOR -.. c:function:: int ioctl( int fd, int request, const struct v4l2_modulator *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_MODULATOR, const struct v4l2_modulator *argp ) + :name: VIDIOC_S_MODULATOR Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-output.rst b/Documentation/media/uapi/v4l/vidioc-g-output.rst index 1b7fffe7f075..e0613e2d667f 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-output.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-output.rst @@ -15,7 +15,11 @@ VIDIOC_G_OUTPUT - VIDIOC_S_OUTPUT - Query or select the current video output Synopsis ======== -.. c:function:: int ioctl( int fd, int request, int *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_OUTPUT, int *argp ) + :name: VIDIOC_G_OUTPUT + +.. c:function:: int ioctl( int fd, VIDIOC_S_OUTPUT, int *argp ) + :name: VIDIOC_S_OUTPUT Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-parm.rst b/Documentation/media/uapi/v4l/vidioc-g-parm.rst index 000109a0c86d..9e9af1dd4f29 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-parm.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-parm.rst @@ -15,7 +15,11 @@ VIDIOC_G_PARM - VIDIOC_S_PARM - Get or set streaming parameters Synopsis ======== -.. c:function:: int ioctl( int fd, int request, v4l2_streamparm *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_PARM, v4l2_streamparm *argp ) + :name: VIDIOC_G_PARM + +.. c:function:: int ioctl( int fd, VIDIOC_S_PARM, v4l2_streamparm *argp ) + :name: VIDIOC_S_PARM Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_PARM, VIDIOC_S_PARM - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-priority.rst b/Documentation/media/uapi/v4l/vidioc-g-priority.rst index cafa7d099b86..d6a07c076837 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-priority.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-priority.rst @@ -15,9 +15,11 @@ VIDIOC_G_PRIORITY - VIDIOC_S_PRIORITY - Query or request the access priority ass Synopsis ======== -.. c:function:: int ioctl( int fd, int request, enum v4l2_priority *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_PRIORITY, enum v4l2_priority *argp ) + :name: VIDIOC_G_PRIORITY -.. c:function:: int ioctl( int fd, int request, const enum v4l2_priority *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_PRIORITY, const enum v4l2_priority *argp ) + :name: VIDIOC_S_PRIORITY Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY - ``argp`` Pointer to an enum v4l2_priority type. diff --git a/Documentation/media/uapi/v4l/vidioc-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-g-selection.rst index e01e92549032..34be08541ed8 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-selection.rst @@ -15,7 +15,12 @@ VIDIOC_G_SELECTION - VIDIOC_S_SELECTION - Get or set one of the selection rectan Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_selection *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_SELECTION, struct v4l2_selection *argp ) + :name: VIDIOC_G_SELECTION + + +.. c:function:: int ioctl( int fd, VIDIOC_S_SELECTION, struct v4l2_selection *argp ) + :name: VIDIOC_S_SELECTION Arguments diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index 0ce63cc97878..abda04b07999 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -15,7 +15,8 @@ VIDIOC_G_SLICED_VBI_CAP - Query sliced VBI capabilities Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_sliced_vbi_cap *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_SLICED_VBI_CAP, struct v4l2_sliced_vbi_cap *argp ) + :name: VIDIOC_G_SLICED_VBI_CAP Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_SLICED_VBI_CAP - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-std.rst b/Documentation/media/uapi/v4l/vidioc-g-std.rst index 4fd57e7ed0d1..91162f5ea6b2 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-std.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-std.rst @@ -15,9 +15,11 @@ VIDIOC_G_STD - VIDIOC_S_STD - Query or select the video standard of the current Synopsis ======== -.. c:function:: int ioctl( int fd, int request, v4l2_std_id *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_STD, v4l2_std_id *argp ) + :name: VIDIOC_G_STD -.. c:function:: int ioctl( int fd, int request, const v4l2_std_id *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_STD, const v4l2_std_id *argp ) + :name: VIDIOC_S_STD Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_STD, VIDIOC_S_STD - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index 989dd53b16af..4658a4715a5e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -15,9 +15,11 @@ VIDIOC_G_TUNER - VIDIOC_S_TUNER - Get or set tuner attributes Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_tuner *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_G_TUNER, struct v4l2_tuner *argp ) + :name: VIDIOC_G_TUNER -.. c:function:: int ioctl( int fd, int request, const struct v4l2_tuner *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_TUNER, const struct v4l2_tuner *argp ) + :name: VIDIOC_S_TUNER Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_G_TUNER, VIDIOC_S_TUNER - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-log-status.rst b/Documentation/media/uapi/v4l/vidioc-log-status.rst index 6cf7904dd34c..bbeb7b5f516b 100644 --- a/Documentation/media/uapi/v4l/vidioc-log-status.rst +++ b/Documentation/media/uapi/v4l/vidioc-log-status.rst @@ -15,12 +15,15 @@ VIDIOC_LOG_STATUS - Log driver status information Synopsis ======== -.. c:function:: int ioctl( int fd, int request ) +.. c:function:: int ioctl( int fd, VIDIOC_LOG_STATUS) + :name: VIDIOC_LOG_STATUS Arguments ========= +``fd`` + File descriptor returned by :ref:`open() `. Description diff --git a/Documentation/media/uapi/v4l/vidioc-overlay.rst b/Documentation/media/uapi/v4l/vidioc-overlay.rst index e7a3956cba3d..cd7b62ebc53b 100644 --- a/Documentation/media/uapi/v4l/vidioc-overlay.rst +++ b/Documentation/media/uapi/v4l/vidioc-overlay.rst @@ -15,7 +15,8 @@ VIDIOC_OVERLAY - Start or stop video overlay Synopsis ======== -.. c:function:: int ioctl( int fd, int request, const int *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_OVERLAY, const int *argp ) + :name: VIDIOC_OVERLAY Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_OVERLAY - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst b/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst index 0baa692edd33..c3f6c1c615f6 100644 --- a/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst +++ b/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst @@ -15,7 +15,8 @@ VIDIOC_PREPARE_BUF - Prepare a buffer for I/O Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_PREPARE_BUF, struct v4l2_buffer *argp ) + :name: VIDIOC_PREPARE_BUF Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_PREPARE_BUF - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst b/Documentation/media/uapi/v4l/vidioc-qbuf.rst index ec5cb57d4acf..dd3f2e069fcb 100644 --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst @@ -15,7 +15,11 @@ VIDIOC_QBUF - VIDIOC_DQBUF - Exchange a buffer with the driver Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_QBUF, struct v4l2_buffer *argp ) + :name: VIDIOC_QBUF + +.. c:function:: int ioctl( int fd, VIDIOC_DQBUF, struct v4l2_buffer *argp ) + :name: VIDIOC_DQBUF Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_QBUF, VIDIOC_DQBUF - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst index c262b0a0ef4a..230ebcb8aa4b 100644 --- a/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst @@ -15,7 +15,11 @@ VIDIOC_QUERY_DV_TIMINGS - VIDIOC_SUBDEV_QUERY_DV_TIMINGS - Sense the DV preset r Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_dv_timings *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_QUERY_DV_TIMINGS, struct v4l2_dv_timings *argp ) + :name: VIDIOC_QUERY_DV_TIMINGS + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_QUERY_DV_TIMINGS, struct v4l2_dv_timings *argp ) + :name: VIDIOC_SUBDEV_QUERY_DV_TIMINGS Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_QUERY_DV_TIMINGS, VIDIOC_SUBDEV_QUERY_DV_TIMINGS - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-querybuf.rst b/Documentation/media/uapi/v4l/vidioc-querybuf.rst index f180c42883fa..8edfc7931ec6 100644 --- a/Documentation/media/uapi/v4l/vidioc-querybuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-querybuf.rst @@ -15,7 +15,8 @@ VIDIOC_QUERYBUF - Query the status of a buffer Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_QUERYBUF, struct v4l2_buffer *argp ) + :name: VIDIOC_QUERYBUF Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_QUERYBUF - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index c821a6c77ab5..d627b80c4141 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -15,7 +15,8 @@ VIDIOC_QUERYCAP - Query device capabilities Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_capability *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_QUERYCAP, struct v4l2_capability *argp ) + :name: VIDIOC_QUERYCAP Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_QUERYCAP - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index 25c7c035cccc..5817264e11ca 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -15,11 +15,14 @@ VIDIOC_QUERYCTRL - VIDIOC_QUERY_EXT_CTRL - VIDIOC_QUERYMENU - Enumerate controls Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_queryctrl *argp ) +.. c:function:: int ioctl( int fd, int VIDIOC_QUERYCTRL, struct v4l2_queryctrl *argp ) + :name: VIDIOC_QUERYCTRL -.. c:function:: int ioctl( int fd, int request, struct v4l2_query_ext_ctrl *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_QUERY_EXT_CTRL, struct v4l2_query_ext_ctrl *argp ) + :name: VIDIOC_QUERY_EXT_CTRL -.. c:function:: int ioctl( int fd, int request, struct v4l2_querymenu *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_QUERYMENU, struct v4l2_querymenu *argp ) + :name: VIDIOC_QUERYMENU Arguments @@ -28,9 +31,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-querystd.rst b/Documentation/media/uapi/v4l/vidioc-querystd.rst index 9324659cebc6..3ef9ab37f582 100644 --- a/Documentation/media/uapi/v4l/vidioc-querystd.rst +++ b/Documentation/media/uapi/v4l/vidioc-querystd.rst @@ -15,7 +15,8 @@ VIDIOC_QUERYSTD - Sense the video standard received by the current input Synopsis ======== -.. c:function:: int ioctl( int fd, int request, v4l2_std_id *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_QUERYSTD, v4l2_std_id *argp ) + :name: VIDIOC_QUERYSTD Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_QUERYSTD - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst index 2078b0b00a9e..39c9bf8af47a 100644 --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst @@ -15,7 +15,8 @@ VIDIOC_REQBUFS - Initiate Memory Mapping, User Pointer I/O or DMA buffer I/O Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_requestbuffers *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_REQBUFS, struct v4l2_requestbuffers *argp ) + :name: VIDIOC_REQBUFS Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_REQBUFS - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst index 765a8453103f..efbe3a1f1134 100644 --- a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst +++ b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst @@ -15,7 +15,8 @@ VIDIOC_S_HW_FREQ_SEEK - Perform a hardware frequency seek Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_hw_freq_seek *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_S_HW_FREQ_SEEK, struct v4l2_hw_freq_seek *argp ) + :name: VIDIOC_S_HW_FREQ_SEEK Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_S_HW_FREQ_SEEK - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-streamon.rst b/Documentation/media/uapi/v4l/vidioc-streamon.rst index d27afa21b925..25dfaa44af3b 100644 --- a/Documentation/media/uapi/v4l/vidioc-streamon.rst +++ b/Documentation/media/uapi/v4l/vidioc-streamon.rst @@ -15,7 +15,11 @@ VIDIOC_STREAMON - VIDIOC_STREAMOFF - Start or stop streaming I/O Synopsis ======== -.. c:function:: int ioctl( int fd, int request, const int *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_STREAMON, const int *argp ) + :name: VIDIOC_STREAMON + +.. c:function:: int ioctl( int fd, VIDIOC_STREAMOFF, const int *argp ) + :name: VIDIOC_STREAMOFF Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_STREAMON, VIDIOC_STREAMOFF - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst index 290ba88eb208..3df2099ceeb9 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst @@ -15,7 +15,8 @@ VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - Enumerate frame intervals Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_interval_enum * argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, struct v4l2_subdev_frame_interval_enum * argp ) + :name: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst index d26709184369..8d2694a96b7d 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst @@ -15,7 +15,8 @@ VIDIOC_SUBDEV_ENUM_FRAME_SIZE - Enumerate media bus frame sizes Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_size_enum * argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, struct v4l2_subdev_frame_size_enum * argp ) + :name: VIDIOC_SUBDEV_ENUM_FRAME_SIZE Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_SUBDEV_ENUM_FRAME_SIZE - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst index a1dabf071437..5ecc33daba8b 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst @@ -15,7 +15,8 @@ VIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_mbus_code_enum * argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_ENUM_MBUS_CODE, struct v4l2_subdev_mbus_code_enum * argp ) + :name: VIDIOC_SUBDEV_ENUM_MBUS_CODE Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_SUBDEV_ENUM_MBUS_CODE - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst index c3e32c94937b..b0fb5203e65f 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst @@ -15,9 +15,11 @@ VIDIOC_SUBDEV_G_CROP - VIDIOC_SUBDEV_S_CROP - Get or set the crop rectangle on a Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_crop *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_CROP, struct v4l2_subdev_crop *argp ) + :name: VIDIOC_SUBDEV_G_CROP -.. c:function:: int ioctl( int fd, int request, const struct v4l2_subdev_crop *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_CROP, const struct v4l2_subdev_crop *argp ) + :name: VIDIOC_SUBDEV_S_CROP Arguments @@ -26,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst index 55b113de91bb..2df1342ac6ea 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst @@ -15,7 +15,11 @@ VIDIOC_SUBDEV_G_FMT - VIDIOC_SUBDEV_S_FMT - Get or set the data format on a subd Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_format *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_FMT, struct v4l2_subdev_format *argp ) + :name: VIDIOC_SUBDEV_G_FMT + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_FMT, struct v4l2_subdev_format *argp ) + :name: VIDIOC_SUBDEV_S_FMT Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst index 056af63b9cfa..f8405bf344fa 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst @@ -15,7 +15,11 @@ VIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_frame_interval *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp ) + :name: VIDIOC_SUBDEV_G_FRAME_INTERVAL + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp ) + :name: VIDIOC_SUBDEV_S_FRAME_INTERVAL Arguments @@ -24,10 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_SUBDEV_G_FRAME_INTERVAL, - VIDIOC_SUBDEV_S_FRAME_INTERVAL - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst index 5c1626a4feaf..697fc40434cc 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst @@ -15,7 +15,11 @@ VIDIOC_SUBDEV_G_SELECTION - VIDIOC_SUBDEV_S_SELECTION - Get or set selection rec Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_subdev_selection *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_SELECTION, struct v4l2_subdev_selection *argp ) + :name: VIDIOC_SUBDEV_G_SELECTION + +.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_SELECTION, struct v4l2_subdev_selection *argp ) + :name: VIDIOC_SUBDEV_S_SELECTION Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION - ``argp`` diff --git a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst index 7015bb283a6a..04eee095952b 100644 --- a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst +++ b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst @@ -16,7 +16,11 @@ VIDIOC_SUBSCRIBE_EVENT - VIDIOC_UNSUBSCRIBE_EVENT - Subscribe or unsubscribe eve Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct v4l2_event_subscription *argp ) +.. c:function:: int ioctl( int fd, VIDIOC_SUBSCRIBE_EVENT, struct v4l2_event_subscription *argp ) + :name: VIDIOC_SUBSCRIBE_EVENT + +.. c:function:: int ioctl( int fd, VIDIOC_UNSUBSCRIBE_EVENT, struct v4l2_event_subscription *argp ) + :name: VIDIOC_UNSUBSCRIBE_EVENT Arguments @@ -25,9 +29,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT - ``argp`` From cf8076c31471f967080a5c77daac7582b0b6d63f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 16:56:15 -0300 Subject: [PATCH 109/591] [media] docs-rst: Convert DVB uAPI to use C function references Name all ioctl references and make them match the ioctls that are documented. That will improve the cross-reference index, as it will have all ioctls and syscalls there. While here, improve the documentation, marking the deprecated ioctls, and making the non-deprecated ones more like the rest of the media book. Also, add a notice for ioctls that still require documentation. Signed-off-by: Mauro Carvalho Chehab --- .../dvb/audio-bilingual-channel-select.rst | 15 ++---- .../media/uapi/dvb/audio-channel-select.rst | 14 ++---- .../media/uapi/dvb/audio-clear-buffer.rst | 12 ++--- .../media/uapi/dvb/audio-continue.rst | 11 ++--- Documentation/media/uapi/dvb/audio-fclose.rst | 4 +- Documentation/media/uapi/dvb/audio-fopen.rst | 4 +- Documentation/media/uapi/dvb/audio-fwrite.rst | 2 + .../media/uapi/dvb/audio-get-capabilities.rst | 14 ++---- .../media/uapi/dvb/audio-get-pts.rst | 14 ++---- .../media/uapi/dvb/audio-get-status.rst | 14 ++---- Documentation/media/uapi/dvb/audio-pause.rst | 11 ++--- Documentation/media/uapi/dvb/audio-play.rst | 11 ++--- .../media/uapi/dvb/audio-select-source.rst | 14 ++---- .../media/uapi/dvb/audio-set-attributes.rst | 16 +++--- .../media/uapi/dvb/audio-set-av-sync.rst | 24 +++------ .../media/uapi/dvb/audio-set-bypass-mode.rst | 25 +++------- .../media/uapi/dvb/audio-set-ext-id.rst | 15 ++---- Documentation/media/uapi/dvb/audio-set-id.rst | 15 ++---- .../media/uapi/dvb/audio-set-karaoke.rst | 14 ++---- .../media/uapi/dvb/audio-set-mixer.rst | 15 ++---- .../media/uapi/dvb/audio-set-mute.rst | 24 +++------ .../media/uapi/dvb/audio-set-streamtype.rst | 14 ++---- Documentation/media/uapi/dvb/audio-stop.rst | 11 ++--- Documentation/media/uapi/dvb/ca-fclose.rst | 18 ++----- Documentation/media/uapi/dvb/ca-fopen.rst | 49 +++++++------------ Documentation/media/uapi/dvb/ca-get-cap.rst | 30 +++--------- .../media/uapi/dvb/ca-get-descr-info.rst | 31 +++--------- Documentation/media/uapi/dvb/ca-get-msg.rst | 30 +++--------- .../media/uapi/dvb/ca-get-slot-info.rst | 30 +++--------- Documentation/media/uapi/dvb/ca-reset.rst | 24 ++------- Documentation/media/uapi/dvb/ca-send-msg.rst | 30 +++--------- Documentation/media/uapi/dvb/ca-set-descr.rst | 30 +++--------- Documentation/media/uapi/dvb/ca-set-pid.rst | 30 +++--------- Documentation/media/uapi/dvb/dmx-add-pid.rst | 28 +++-------- Documentation/media/uapi/dvb/dmx-fclose.rst | 14 ++---- Documentation/media/uapi/dvb/dmx-fopen.rst | 43 +++++++--------- Documentation/media/uapi/dvb/dmx-fread.rst | 29 +++-------- Documentation/media/uapi/dvb/dmx-fwrite.rst | 30 +++--------- Documentation/media/uapi/dvb/dmx-get-caps.rst | 31 +++--------- .../media/uapi/dvb/dmx-get-event.rst | 28 +++-------- .../media/uapi/dvb/dmx-get-pes-pids.rst | 31 +++--------- Documentation/media/uapi/dvb/dmx-get-stc.rst | 31 +++--------- .../media/uapi/dvb/dmx-remove-pid.rst | 28 +++-------- .../media/uapi/dvb/dmx-set-buffer-size.rst | 29 +++-------- .../media/uapi/dvb/dmx-set-filter.rst | 28 +++-------- .../media/uapi/dvb/dmx-set-pes-filter.rst | 27 +++------- .../media/uapi/dvb/dmx-set-source.rst | 29 +++-------- Documentation/media/uapi/dvb/dmx-start.rst | 22 ++------- Documentation/media/uapi/dvb/dmx-stop.rst | 22 ++------- .../uapi/dvb/fe-diseqc-recv-slave-reply.rst | 6 +-- .../uapi/dvb/fe-diseqc-reset-overload.rst | 7 +-- .../media/uapi/dvb/fe-diseqc-send-burst.rst | 6 +-- .../uapi/dvb/fe-diseqc-send-master-cmd.rst | 6 +-- .../dvb/fe-dishnetwork-send-legacy-cmd.rst | 16 +++--- .../uapi/dvb/fe-enable-high-lnb-voltage.rst | 6 +-- Documentation/media/uapi/dvb/fe-get-event.rst | 35 +++---------- .../media/uapi/dvb/fe-get-frontend.rst | 30 +++--------- Documentation/media/uapi/dvb/fe-get-info.rst | 6 +-- .../media/uapi/dvb/fe-get-property.rst | 9 ++-- Documentation/media/uapi/dvb/fe-read-ber.rst | 30 +++--------- .../uapi/dvb/fe-read-signal-strength.rst | 31 +++--------- Documentation/media/uapi/dvb/fe-read-snr.rst | 29 +++-------- .../media/uapi/dvb/fe-read-status.rst | 6 +-- .../uapi/dvb/fe-read-uncorrected-blocks.rst | 31 +++--------- .../uapi/dvb/fe-set-frontend-tune-mode.rst | 6 +-- .../media/uapi/dvb/fe-set-frontend.rst | 31 +++--------- Documentation/media/uapi/dvb/fe-set-tone.rst | 6 +-- .../media/uapi/dvb/fe-set-voltage.rst | 6 +-- .../media/uapi/dvb/frontend_f_close.rst | 4 +- .../media/uapi/dvb/frontend_f_open.rst | 2 +- Documentation/media/uapi/dvb/net-add-if.rst | 6 +-- Documentation/media/uapi/dvb/net-get-if.rst | 6 +-- .../media/uapi/dvb/net-remove-if.rst | 6 +-- .../media/uapi/dvb/video-clear-buffer.rst | 4 +- .../media/uapi/dvb/video-command.rst | 4 +- .../media/uapi/dvb/video-continue.rst | 4 +- .../media/uapi/dvb/video-fast-forward.rst | 4 +- Documentation/media/uapi/dvb/video-fclose.rst | 1 + Documentation/media/uapi/dvb/video-fopen.rst | 1 + Documentation/media/uapi/dvb/video-freeze.rst | 4 +- Documentation/media/uapi/dvb/video-fwrite.rst | 1 + .../media/uapi/dvb/video-get-capabilities.rst | 4 +- .../media/uapi/dvb/video-get-event.rst | 4 +- .../media/uapi/dvb/video-get-frame-count.rst | 4 +- .../media/uapi/dvb/video-get-frame-rate.rst | 4 +- .../media/uapi/dvb/video-get-navi.rst | 4 +- .../media/uapi/dvb/video-get-pts.rst | 4 +- .../media/uapi/dvb/video-get-size.rst | 4 +- .../media/uapi/dvb/video-get-status.rst | 4 +- Documentation/media/uapi/dvb/video-play.rst | 4 +- .../media/uapi/dvb/video-select-source.rst | 4 +- .../media/uapi/dvb/video-set-attributes.rst | 4 +- .../media/uapi/dvb/video-set-blank.rst | 4 +- .../uapi/dvb/video-set-display-format.rst | 4 +- .../media/uapi/dvb/video-set-format.rst | 4 +- .../media/uapi/dvb/video-set-highlight.rst | 4 +- Documentation/media/uapi/dvb/video-set-id.rst | 4 +- .../media/uapi/dvb/video-set-spu-palette.rst | 4 +- .../media/uapi/dvb/video-set-spu.rst | 4 +- .../media/uapi/dvb/video-set-streamtype.rst | 4 +- .../media/uapi/dvb/video-set-system.rst | 4 +- .../media/uapi/dvb/video-slowmotion.rst | 4 +- .../media/uapi/dvb/video-stillpicture.rst | 4 +- Documentation/media/uapi/dvb/video-stop.rst | 4 +- .../media/uapi/dvb/video-try-command.rst | 4 +- 105 files changed, 470 insertions(+), 1041 deletions(-) diff --git a/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst b/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst index 841c9759d5e0..e048ee8f4d65 100644 --- a/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst +++ b/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst @@ -11,11 +11,13 @@ Name AUDIO_BILINGUAL_CHANNEL_SELECT +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_BILINGUAL_CHANNEL_SELECT, audio_channel_select_t) +.. c:function:: int ioctl(int fd, AUDIO_BILINGUAL_CHANNEL_SELECT, audio_channel_select_t) + :name: AUDIO_BILINGUAL_CHANNEL_SELECT Arguments @@ -25,20 +27,13 @@ Arguments :header-rows: 0 :stub-columns: 0 - - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_BILINGUAL_CHANNEL_SELECT for this command. - - - .. row 3 + - - audio_channel_select_t ch diff --git a/Documentation/media/uapi/dvb/audio-channel-select.rst b/Documentation/media/uapi/dvb/audio-channel-select.rst index f2dd79903c49..03dcdbbfbbc6 100644 --- a/Documentation/media/uapi/dvb/audio-channel-select.rst +++ b/Documentation/media/uapi/dvb/audio-channel-select.rst @@ -11,11 +11,13 @@ Name AUDIO_CHANNEL_SELECT +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_CHANNEL_SELECT, audio_channel_select_t) +.. c:function:: int ioctl(int fd, AUDIO_CHANNEL_SELECT, audio_channel_select_t) + :name: AUDIO_CHANNEL_SELECT Arguments @@ -26,19 +28,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_CHANNEL_SELECT for this command. - - - .. row 3 + - - audio_channel_select_t ch diff --git a/Documentation/media/uapi/dvb/audio-clear-buffer.rst b/Documentation/media/uapi/dvb/audio-clear-buffer.rst index a576c6b160a4..f6bed67cb070 100644 --- a/Documentation/media/uapi/dvb/audio-clear-buffer.rst +++ b/Documentation/media/uapi/dvb/audio-clear-buffer.rst @@ -11,12 +11,13 @@ Name AUDIO_CLEAR_BUFFER +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_CLEAR_BUFFER) - +.. c:function:: int ioctl(int fd, AUDIO_CLEAR_BUFFER) + :name: AUDIO_CLEAR_BUFFER Arguments --------- @@ -32,13 +33,6 @@ Arguments - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_CLEAR_BUFFER for this command. - - Description ----------- diff --git a/Documentation/media/uapi/dvb/audio-continue.rst b/Documentation/media/uapi/dvb/audio-continue.rst index b513a39f0935..ca587869306e 100644 --- a/Documentation/media/uapi/dvb/audio-continue.rst +++ b/Documentation/media/uapi/dvb/audio-continue.rst @@ -11,11 +11,13 @@ Name AUDIO_CONTINUE +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_CONTINUE) +.. c:function:: int ioctl(int fd, AUDIO_CONTINUE) + :name: AUDIO_CONTINUE Arguments @@ -32,13 +34,6 @@ Arguments - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_CONTINUE for this command. - - Description ----------- diff --git a/Documentation/media/uapi/dvb/audio-fclose.rst b/Documentation/media/uapi/dvb/audio-fclose.rst index e515fb353a14..4df24c8d74ed 100644 --- a/Documentation/media/uapi/dvb/audio-fclose.rst +++ b/Documentation/media/uapi/dvb/audio-fclose.rst @@ -11,11 +11,13 @@ Name DVB audio close() +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int close(int fd) +.. c:function:: int close(int fd) + :name: dvb-audio-close Arguments diff --git a/Documentation/media/uapi/dvb/audio-fopen.rst b/Documentation/media/uapi/dvb/audio-fopen.rst index b629956bca5d..a802c2e0dc6a 100644 --- a/Documentation/media/uapi/dvb/audio-fopen.rst +++ b/Documentation/media/uapi/dvb/audio-fopen.rst @@ -11,11 +11,13 @@ Name DVB audio open() +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int open(const char *deviceName, int flags) +.. c:function:: int open(const char *deviceName, int flags) + :name: dvb-audio-open Arguments diff --git a/Documentation/media/uapi/dvb/audio-fwrite.rst b/Documentation/media/uapi/dvb/audio-fwrite.rst index f9307053064f..8882cad7d165 100644 --- a/Documentation/media/uapi/dvb/audio-fwrite.rst +++ b/Documentation/media/uapi/dvb/audio-fwrite.rst @@ -11,11 +11,13 @@ Name DVB audio write() +.. attention:: This ioctl is deprecated Synopsis -------- .. c:function:: size_t write(int fd, const void *buf, size_t count) + :name: dvb-audio-write Arguments diff --git a/Documentation/media/uapi/dvb/audio-get-capabilities.rst b/Documentation/media/uapi/dvb/audio-get-capabilities.rst index 8b6fdc664f9d..0d867f189c22 100644 --- a/Documentation/media/uapi/dvb/audio-get-capabilities.rst +++ b/Documentation/media/uapi/dvb/audio-get-capabilities.rst @@ -11,11 +11,13 @@ Name AUDIO_GET_CAPABILITIES +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_GET_CAPABILITIES, unsigned int *cap) +.. c:function:: int ioctl(int fd, AUDIO_GET_CAPABILITIES, unsigned int *cap) + :name: AUDIO_GET_CAPABILITIES Arguments @@ -26,19 +28,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_GET_CAPABILITIES for this command. - - - .. row 3 + - - unsigned int \*cap diff --git a/Documentation/media/uapi/dvb/audio-get-pts.rst b/Documentation/media/uapi/dvb/audio-get-pts.rst index 246c78c003de..2d1396b003de 100644 --- a/Documentation/media/uapi/dvb/audio-get-pts.rst +++ b/Documentation/media/uapi/dvb/audio-get-pts.rst @@ -11,11 +11,13 @@ Name AUDIO_GET_PTS +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_GET_PTS, __u64 *pts) +.. c:function:: int ioctl(int fd, AUDIO_GET_PTS, __u64 *pts) + :name: AUDIO_GET_PTS Arguments @@ -26,19 +28,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_GET_PTS for this command. - - - .. row 3 + - - __u64 \*pts diff --git a/Documentation/media/uapi/dvb/audio-get-status.rst b/Documentation/media/uapi/dvb/audio-get-status.rst index b0a550af87b3..857b058325f1 100644 --- a/Documentation/media/uapi/dvb/audio-get-status.rst +++ b/Documentation/media/uapi/dvb/audio-get-status.rst @@ -11,11 +11,13 @@ Name AUDIO_GET_STATUS +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_GET_STATUS, struct audio_status *status) +.. c:function:: int ioctl(int fd, AUDIO_GET_STATUS, struct audio_status *status) + :name: AUDIO_GET_STATUS Arguments @@ -26,19 +28,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_GET_STATUS for this command. - - - .. row 3 + - - struct audio_status \*status diff --git a/Documentation/media/uapi/dvb/audio-pause.rst b/Documentation/media/uapi/dvb/audio-pause.rst index 86652c3bca06..c7310dffbff2 100644 --- a/Documentation/media/uapi/dvb/audio-pause.rst +++ b/Documentation/media/uapi/dvb/audio-pause.rst @@ -11,12 +11,13 @@ Name AUDIO_PAUSE +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_PAUSE) - +.. c:function:: int ioctl(int fd, AUDIO_PAUSE) + :name: AUDIO_PAUSE Arguments --------- @@ -32,12 +33,6 @@ Arguments - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_PAUSE for this command. - Description ----------- diff --git a/Documentation/media/uapi/dvb/audio-play.rst b/Documentation/media/uapi/dvb/audio-play.rst index 1af708375821..943b5eec9f28 100644 --- a/Documentation/media/uapi/dvb/audio-play.rst +++ b/Documentation/media/uapi/dvb/audio-play.rst @@ -11,11 +11,13 @@ Name AUDIO_PLAY +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_PLAY) +.. c:function:: int ioctl(int fd, AUDIO_PLAY) + :name: AUDIO_PLAY Arguments @@ -32,13 +34,6 @@ Arguments - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_PLAY for this command. - - Description ----------- diff --git a/Documentation/media/uapi/dvb/audio-select-source.rst b/Documentation/media/uapi/dvb/audio-select-source.rst index 3e873d9cb345..e4ea98787619 100644 --- a/Documentation/media/uapi/dvb/audio-select-source.rst +++ b/Documentation/media/uapi/dvb/audio-select-source.rst @@ -11,11 +11,13 @@ Name AUDIO_SELECT_SOURCE +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_SELECT_SOURCE, audio_stream_source_t source) +.. c:function:: int ioctl(int fd, AUDIO_SELECT_SOURCE, audio_stream_source_t source) + :name: AUDIO_SELECT_SOURCE Arguments @@ -26,19 +28,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SELECT_SOURCE for this command. - - - .. row 3 + - - audio_stream_source_t source diff --git a/Documentation/media/uapi/dvb/audio-set-attributes.rst b/Documentation/media/uapi/dvb/audio-set-attributes.rst index 43ff50279742..ad89a37cf83c 100644 --- a/Documentation/media/uapi/dvb/audio-set-attributes.rst +++ b/Documentation/media/uapi/dvb/audio-set-attributes.rst @@ -11,12 +11,14 @@ Name AUDIO_SET_ATTRIBUTES +.. attention:: This ioctl is deprecated + Synopsis -------- -.. c:function:: int ioctl(fd, int request = AUDIO_SET_ATTRIBUTES, audio_attributes_t attr ) - +.. c:function:: int ioctl(fd, AUDIO_SET_ATTRIBUTES, audio_attributes_t attr ) + :name: AUDIO_SET_ATTRIBUTES Arguments --------- @@ -26,19 +28,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SET_ATTRIBUTES for this command. - - - .. row 3 + - - audio_attributes_t attr diff --git a/Documentation/media/uapi/dvb/audio-set-av-sync.rst b/Documentation/media/uapi/dvb/audio-set-av-sync.rst index 4ecfb75d28f1..0cef4917d2cf 100644 --- a/Documentation/media/uapi/dvb/audio-set-av-sync.rst +++ b/Documentation/media/uapi/dvb/audio-set-av-sync.rst @@ -11,11 +11,13 @@ Name AUDIO_SET_AV_SYNC +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_SET_AV_SYNC, boolean state) +.. c:function:: int ioctl(int fd, AUDIO_SET_AV_SYNC, boolean state) + :name: AUDIO_SET_AV_SYNC Arguments @@ -26,33 +28,21 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_AV_SYNC for this command. - - - .. row 3 + - - boolean state - Tells the DVB subsystem if A/V synchronization shall be ON or OFF. - - .. row 4 + TRUE: AV-sync ON - - - - TRUE AV-sync ON - - - .. row 5 - - - - - FALSE AV-sync OFF + FALSE: AV-sync OFF Description diff --git a/Documentation/media/uapi/dvb/audio-set-bypass-mode.rst b/Documentation/media/uapi/dvb/audio-set-bypass-mode.rst index b21d142ec31c..b063c496c2eb 100644 --- a/Documentation/media/uapi/dvb/audio-set-bypass-mode.rst +++ b/Documentation/media/uapi/dvb/audio-set-bypass-mode.rst @@ -11,12 +11,13 @@ Name AUDIO_SET_BYPASS_MODE +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_SET_BYPASS_MODE, boolean mode) - +.. c:function:: int ioctl(int fd, AUDIO_SET_BYPASS_MODE, boolean mode) + :name: AUDIO_SET_BYPASS_MODE Arguments --------- @@ -26,34 +27,22 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SET_BYPASS_MODE for this command. - - - .. row 3 + - - boolean mode - Enables or disables the decoding of the current Audio stream in the DVB subsystem. - - .. row 4 + TRUE: Bypass is disabled - - - - TRUE Bypass is disabled - - - .. row 5 - - - - - FALSE Bypass is enabled + FALSE: Bypass is enabled Description diff --git a/Documentation/media/uapi/dvb/audio-set-ext-id.rst b/Documentation/media/uapi/dvb/audio-set-ext-id.rst index 1b5b8893a00b..8503c47f26bd 100644 --- a/Documentation/media/uapi/dvb/audio-set-ext-id.rst +++ b/Documentation/media/uapi/dvb/audio-set-ext-id.rst @@ -11,12 +11,13 @@ Name AUDIO_SET_EXT_ID +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(fd, int request = AUDIO_SET_EXT_ID, int id) - +.. c:function:: int ioctl(fd, AUDIO_SET_EXT_ID, int id) + :name: AUDIO_SET_EXT_ID Arguments --------- @@ -26,19 +27,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SET_EXT_ID for this command. - - - .. row 3 + - - int id diff --git a/Documentation/media/uapi/dvb/audio-set-id.rst b/Documentation/media/uapi/dvb/audio-set-id.rst index fed99eae52cb..8b1081d24473 100644 --- a/Documentation/media/uapi/dvb/audio-set-id.rst +++ b/Documentation/media/uapi/dvb/audio-set-id.rst @@ -11,12 +11,13 @@ Name AUDIO_SET_ID +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_SET_ID, int id) - +.. c:function:: int ioctl(int fd, AUDIO_SET_ID, int id) + :name: AUDIO_SET_ID Arguments --------- @@ -26,19 +27,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SET_ID for this command. - - - .. row 3 + - - int id diff --git a/Documentation/media/uapi/dvb/audio-set-karaoke.rst b/Documentation/media/uapi/dvb/audio-set-karaoke.rst index ebb2d41bbec3..78571abdd93a 100644 --- a/Documentation/media/uapi/dvb/audio-set-karaoke.rst +++ b/Documentation/media/uapi/dvb/audio-set-karaoke.rst @@ -11,11 +11,13 @@ Name AUDIO_SET_KARAOKE +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(fd, int request = AUDIO_SET_KARAOKE, audio_karaoke_t *karaoke) +.. c:function:: int ioctl(fd, AUDIO_SET_KARAOKE, audio_karaoke_t *karaoke) + :name: AUDIO_SET_KARAOKE Arguments @@ -26,19 +28,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SET_KARAOKE for this command. - - - .. row 3 + - - audio_karaoke_t \*karaoke diff --git a/Documentation/media/uapi/dvb/audio-set-mixer.rst b/Documentation/media/uapi/dvb/audio-set-mixer.rst index ce4b2a63917e..657bd89b8a6a 100644 --- a/Documentation/media/uapi/dvb/audio-set-mixer.rst +++ b/Documentation/media/uapi/dvb/audio-set-mixer.rst @@ -11,12 +11,13 @@ Name AUDIO_SET_MIXER +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_SET_MIXER, audio_mixer_t *mix) - +.. c:function:: int ioctl(int fd, AUDIO_SET_MIXER, audio_mixer_t *mix) + :name: AUDIO_SET_MIXER Arguments --------- @@ -26,19 +27,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SET_ID for this command. - - - .. row 3 + - - audio_mixer_t \*mix diff --git a/Documentation/media/uapi/dvb/audio-set-mute.rst b/Documentation/media/uapi/dvb/audio-set-mute.rst index a2469267508b..897e7228f4d8 100644 --- a/Documentation/media/uapi/dvb/audio-set-mute.rst +++ b/Documentation/media/uapi/dvb/audio-set-mute.rst @@ -11,11 +11,13 @@ Name AUDIO_SET_MUTE +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_SET_MUTE, boolean state) +.. c:function:: int ioctl(int fd, AUDIO_SET_MUTE, boolean state) + :name: AUDIO_SET_MUTE Arguments @@ -26,33 +28,21 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SET_MUTE for this command. - - - .. row 3 + - - boolean state - Indicates if audio device shall mute or not. - - .. row 4 + TRUE: Audio Mute - - - - TRUE Audio Mute - - - .. row 5 - - - - - FALSE Audio Un-mute + FALSE: Audio Un-mute Description diff --git a/Documentation/media/uapi/dvb/audio-set-streamtype.rst b/Documentation/media/uapi/dvb/audio-set-streamtype.rst index 4b13c9b9dffe..46c0362ac71d 100644 --- a/Documentation/media/uapi/dvb/audio-set-streamtype.rst +++ b/Documentation/media/uapi/dvb/audio-set-streamtype.rst @@ -11,11 +11,13 @@ Name AUDIO_SET_STREAMTYPE +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(fd, int request = AUDIO_SET_STREAMTYPE, int type) +.. c:function:: int ioctl(fd, AUDIO_SET_STREAMTYPE, int type) + :name: AUDIO_SET_STREAMTYPE Arguments @@ -26,19 +28,13 @@ Arguments :stub-columns: 0 - - .. row 1 + - - int fd - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_SET_STREAMTYPE for this command. - - - .. row 3 + - - int type diff --git a/Documentation/media/uapi/dvb/audio-stop.rst b/Documentation/media/uapi/dvb/audio-stop.rst index d9430978096f..dd6c3b6826ec 100644 --- a/Documentation/media/uapi/dvb/audio-stop.rst +++ b/Documentation/media/uapi/dvb/audio-stop.rst @@ -11,12 +11,13 @@ Name AUDIO_STOP +.. attention:: This ioctl is deprecated Synopsis -------- -.. c:function:: int ioctl(int fd, int request = AUDIO_STOP) - +.. c:function:: int ioctl(int fd, AUDIO_STOP) + :name: AUDIO_STOP Arguments --------- @@ -32,12 +33,6 @@ Arguments - File descriptor returned by a previous call to open(). - - .. row 2 - - - int request - - - Equals AUDIO_STOP for this command. - Description ----------- diff --git a/Documentation/media/uapi/dvb/ca-fclose.rst b/Documentation/media/uapi/dvb/ca-fclose.rst index f2ea50b87485..5ecefa4abc3d 100644 --- a/Documentation/media/uapi/dvb/ca-fclose.rst +++ b/Documentation/media/uapi/dvb/ca-fclose.rst @@ -15,28 +15,20 @@ DVB CA close() Synopsis -------- -.. c:function:: int close(int fd) +.. c:function:: int close(int fd) + :name: dvb-ca-close Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. Description ----------- -This system call closes a previously opened audio device. +This system call closes a previously opened CA device. Return Value diff --git a/Documentation/media/uapi/dvb/ca-fopen.rst b/Documentation/media/uapi/dvb/ca-fopen.rst index 8085a73e81c5..3d2819751446 100644 --- a/Documentation/media/uapi/dvb/ca-fopen.rst +++ b/Documentation/media/uapi/dvb/ca-fopen.rst @@ -15,48 +15,35 @@ DVB CA open() Synopsis -------- -.. c:function:: int open(const char *deviceName, int flags) +.. c:function:: int open(const char *name, int flags) + :name: dvb-ca-open Arguments --------- +``name`` + Name of specific DVB CA device. + +``flags`` + A bit-wise OR of the following flags: + .. flat-table:: :header-rows: 0 :stub-columns: 0 + - + - O_RDONLY + - read-only access - - .. row 1 + - + - O_RDWR + - read/write access - - const char \*deviceName - - - Name of specific video device. - - - .. row 2 - - - int flags - - - A bit-wise OR of the following flags: - - - .. row 3 - - - - - O_RDONLY read-only access - - - .. row 4 - - - - - O_RDWR read/write access - - - .. row 5 - - - - - O_NONBLOCK open in non-blocking mode - - - .. row 6 - - - - - (blocking mode is the default) + - + - O_NONBLOCK + - open in non-blocking mode + (blocking mode is the default) Description diff --git a/Documentation/media/uapi/dvb/ca-get-cap.rst b/Documentation/media/uapi/dvb/ca-get-cap.rst index 55e49fd93c2c..3486805b62a9 100644 --- a/Documentation/media/uapi/dvb/ca-get-cap.rst +++ b/Documentation/media/uapi/dvb/ca-get-cap.rst @@ -15,40 +15,24 @@ CA_GET_CAP Synopsis -------- -.. c:function:: int ioctl(fd, int request = CA_GET_CAP, ca_caps_t *) +.. c:function:: int ioctl(fd, CA_GET_CAP, ca_caps_t *caps) + :name: CA_GET_CAP Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals CA_GET_CAP for this command. - - - .. row 3 - - - ca_caps_t * - - - Undocumented. +``caps`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/ca-get-descr-info.rst b/Documentation/media/uapi/dvb/ca-get-descr-info.rst index e546e58ef7f8..b007f10b4910 100644 --- a/Documentation/media/uapi/dvb/ca-get-descr-info.rst +++ b/Documentation/media/uapi/dvb/ca-get-descr-info.rst @@ -15,40 +15,23 @@ CA_GET_DESCR_INFO Synopsis -------- -.. c:function:: int ioctl(fd, int request = CA_GET_DESCR_INFO, ca_descr_info_t *) - +.. c:function:: int ioctl(fd, CA_GET_DESCR_INFO, ca_descr_info_t *desc) + :name: CA_GET_DESCR_INFO Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals CA_GET_DESCR_INFO for this command. - - - .. row 3 - - - ca_descr_info_t \* - - - Undocumented. +``desc`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/ca-get-msg.rst b/Documentation/media/uapi/dvb/ca-get-msg.rst index e0d2c8853e63..880995230909 100644 --- a/Documentation/media/uapi/dvb/ca-get-msg.rst +++ b/Documentation/media/uapi/dvb/ca-get-msg.rst @@ -15,40 +15,24 @@ CA_GET_MSG Synopsis -------- -.. c:function:: int ioctl(fd, int request = CA_GET_MSG, ca_msg_t *) +.. c:function:: int ioctl(fd, CA_GET_MSG, ca_msg_t *msg) + :name: CA_GET_MSG Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals CA_GET_MSG for this command. - - - .. row 3 - - - ca_msg_t \* - - - Undocumented. +``msg`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/ca-get-slot-info.rst b/Documentation/media/uapi/dvb/ca-get-slot-info.rst index 6c46a5395f45..fcecd80e30d4 100644 --- a/Documentation/media/uapi/dvb/ca-get-slot-info.rst +++ b/Documentation/media/uapi/dvb/ca-get-slot-info.rst @@ -15,40 +15,24 @@ CA_GET_SLOT_INFO Synopsis -------- -.. c:function:: int ioctl(fd, int request = CA_GET_SLOT_INFO, ca_slot_info_t *) +.. c:function:: int ioctl(fd, CA_GET_SLOT_INFO, ca_slot_info_t *info) + :name: CA_GET_SLOT_INFO Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals CA_GET_SLOT_INFO for this command. - - - .. row 3 - - - ca_slot_info_t \* - - - Undocumented. +``info`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/ca-reset.rst b/Documentation/media/uapi/dvb/ca-reset.rst index a91f969318fb..477313121a65 100644 --- a/Documentation/media/uapi/dvb/ca-reset.rst +++ b/Documentation/media/uapi/dvb/ca-reset.rst @@ -15,34 +15,20 @@ CA_RESET Synopsis -------- -.. c:function:: int ioctl(fd, int request = CA_RESET) +.. c:function:: int ioctl(fd, CA_RESET) + :name: CA_RESET Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals CA_RESET for this command. - +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/ca-send-msg.rst b/Documentation/media/uapi/dvb/ca-send-msg.rst index 5e4fd4f7b683..0c42b10cf4f4 100644 --- a/Documentation/media/uapi/dvb/ca-send-msg.rst +++ b/Documentation/media/uapi/dvb/ca-send-msg.rst @@ -15,40 +15,24 @@ CA_SEND_MSG Synopsis -------- -.. c:function:: int ioctl(fd, int request = CA_SEND_MSG, ca_msg_t *) +.. c:function:: int ioctl(fd, CA_SEND_MSG, ca_msg_t *msg) + :name: CA_SEND_MSG Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals CA_SEND_MSG for this command. - - - .. row 3 - - - ca_msg_t \* - - - Undocumented. +``msg`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/ca-set-descr.rst b/Documentation/media/uapi/dvb/ca-set-descr.rst index 2822718d655b..63dcc2b751ef 100644 --- a/Documentation/media/uapi/dvb/ca-set-descr.rst +++ b/Documentation/media/uapi/dvb/ca-set-descr.rst @@ -15,40 +15,24 @@ CA_SET_DESCR Synopsis -------- -.. c:function:: int ioctl(fd, int request = CA_SET_DESCR, ca_descr_t *) +.. c:function:: int ioctl(fd, CA_SET_DESCR, ca_descr_t *desc) + :name: Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals CA_SET_DESCR for this command. - - - .. row 3 - - - ca_descr_t \* - - - Undocumented. +``msg`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/ca-set-pid.rst b/Documentation/media/uapi/dvb/ca-set-pid.rst index 1ea95c7ef4e6..8e13ad9595d3 100644 --- a/Documentation/media/uapi/dvb/ca-set-pid.rst +++ b/Documentation/media/uapi/dvb/ca-set-pid.rst @@ -15,40 +15,24 @@ CA_SET_PID Synopsis -------- -.. c:function:: int ioctl(fd, int request = CA_SET_PID, ca_pid_t *) +.. c:function:: int ioctl(fd, CA_SET_PID, ca_pid_t *pid) + :name: CA_SET_PID Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals CA_SET_PID for this command. - - - .. row 3 - - - ca_pid_t \* - - - Undocumented. +``pid`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/dmx-add-pid.rst b/Documentation/media/uapi/dvb/dmx-add-pid.rst index 37f5ee43d523..689cd1fc9142 100644 --- a/Documentation/media/uapi/dvb/dmx-add-pid.rst +++ b/Documentation/media/uapi/dvb/dmx-add-pid.rst @@ -15,34 +15,18 @@ DMX_ADD_PID Synopsis -------- -.. c:function:: int ioctl(fd, int request = DMX_ADD_PID, __u16 *) +.. c:function:: int ioctl(fd, DMX_ADD_PID, __u16 *pid) + :name: DMX_ADD_PID Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_ADD_PID for this command. - - - .. row 3 - - - __u16 * - - - PID number to be filtered. +``pid`` + PID number to be filtered. Description diff --git a/Documentation/media/uapi/dvb/dmx-fclose.rst b/Documentation/media/uapi/dvb/dmx-fclose.rst index e442881481a2..ca93c23cde6d 100644 --- a/Documentation/media/uapi/dvb/dmx-fclose.rst +++ b/Documentation/media/uapi/dvb/dmx-fclose.rst @@ -16,22 +16,14 @@ Synopsis -------- .. c:function:: int close(int fd) + :name: dvb-dmx-close Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. Description ----------- diff --git a/Documentation/media/uapi/dvb/dmx-fopen.rst b/Documentation/media/uapi/dvb/dmx-fopen.rst index 7e640fa860c3..a697e33c32ea 100644 --- a/Documentation/media/uapi/dvb/dmx-fopen.rst +++ b/Documentation/media/uapi/dvb/dmx-fopen.rst @@ -16,42 +16,33 @@ Synopsis -------- .. c:function:: int open(const char *deviceName, int flags) - + :name: dvb-dmx-open Arguments --------- +``name`` + Name of specific DVB demux device. + +``flags`` + A bit-wise OR of the following flags: + .. flat-table:: :header-rows: 0 :stub-columns: 0 + - + - O_RDONLY + - read-only access - - .. row 1 + - + - O_RDWR + - read/write access - - const char \*deviceName - - - Name of demux device. - - - .. row 2 - - - int flags - - - A bit-wise OR of the following flags: - - - .. row 3 - - - - - O_RDWR read/write access - - - .. row 4 - - - - - O_NONBLOCK open in non-blocking mode - - - .. row 5 - - - - - (blocking mode is the default) + - + - O_NONBLOCK + - open in non-blocking mode + (blocking mode is the default) Description diff --git a/Documentation/media/uapi/dvb/dmx-fread.rst b/Documentation/media/uapi/dvb/dmx-fread.rst index efa2a01096c1..e8c7f4db353f 100644 --- a/Documentation/media/uapi/dvb/dmx-fread.rst +++ b/Documentation/media/uapi/dvb/dmx-fread.rst @@ -16,34 +16,19 @@ Synopsis -------- .. c:function:: size_t read(int fd, void *buf, size_t count) - + :name: dvb-dmx-read Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. + ``buf`` + Buffer to be filled - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - void \*buf - - - Pointer to the buffer to be used for returned filtered data. - - - .. row 3 - - - size_t count - - - Size of buf. - +``count`` + Max number of bytes to read Description ----------- diff --git a/Documentation/media/uapi/dvb/dmx-fwrite.rst b/Documentation/media/uapi/dvb/dmx-fwrite.rst index c05a44c4535f..8a90dfe28307 100644 --- a/Documentation/media/uapi/dvb/dmx-fwrite.rst +++ b/Documentation/media/uapi/dvb/dmx-fwrite.rst @@ -16,34 +16,19 @@ Synopsis -------- .. c:function:: ssize_t write(int fd, const void *buf, size_t count) - + :name: dvb-dmx-write Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by a previous call to :c:func:`open() `. +``buf`` + Buffer with data to be written - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - void \*buf - - - Pointer to the buffer containing the Transport Stream. - - - .. row 3 - - - size_t count - - - Size of buf. - +``count`` + Number of bytes at the buffer Description ----------- @@ -65,7 +50,6 @@ Return Value :header-rows: 0 :stub-columns: 0 - - .. row 1 - ``EWOULDBLOCK`` diff --git a/Documentation/media/uapi/dvb/dmx-get-caps.rst b/Documentation/media/uapi/dvb/dmx-get-caps.rst index 20e3d6e55d30..aaf084a245fd 100644 --- a/Documentation/media/uapi/dvb/dmx-get-caps.rst +++ b/Documentation/media/uapi/dvb/dmx-get-caps.rst @@ -15,40 +15,23 @@ DMX_GET_CAPS Synopsis -------- -.. c:function:: int ioctl(fd, int request = DMX_GET_CAPS, dmx_caps_t *) - +.. c:function:: int ioctl(fd, DMX_GET_CAPS, dmx_caps_t *caps) + :name: DMX_GET_CAPS Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_GET_CAPS for this command. - - - .. row 3 - - - dmx_caps_t * - - - Undocumented. +``caps`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/dmx-get-event.rst b/Documentation/media/uapi/dvb/dmx-get-event.rst index 81a7c7fedd47..8be626c29158 100644 --- a/Documentation/media/uapi/dvb/dmx-get-event.rst +++ b/Documentation/media/uapi/dvb/dmx-get-event.rst @@ -15,34 +15,18 @@ DMX_GET_EVENT Synopsis -------- -.. c:function:: int ioctl( int fd, int request = DMX_GET_EVENT, struct dmx_event *ev) +.. c:function:: int ioctl( int fd, DMX_GET_EVENT, struct dmx_event *ev) + :name: DMX_GET_EVENT Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_GET_EVENT for this command. - - - .. row 3 - - - struct dmx_event \*ev - - - Pointer to the location where the event is to be stored. +``ev`` + Pointer to the location where the event is to be stored. Description diff --git a/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst b/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst index 8b1fbf5d2c81..b31634a1cca4 100644 --- a/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst +++ b/Documentation/media/uapi/dvb/dmx-get-pes-pids.rst @@ -15,40 +15,23 @@ DMX_GET_PES_PIDS Synopsis -------- -.. c:function:: int ioctl(fd, int request = DMX_GET_PES_PIDS, __u16[5]) - +.. c:function:: int ioctl(fd, DMX_GET_PES_PIDS, __u16 pids[5]) + :name: DMX_GET_PES_PIDS Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_GET_PES_PIDS for this command. - - - .. row 3 - - - __u16[5] - - - Undocumented. +``pids`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/dmx-get-stc.rst b/Documentation/media/uapi/dvb/dmx-get-stc.rst index 616c745a0418..9fc501e8128a 100644 --- a/Documentation/media/uapi/dvb/dmx-get-stc.rst +++ b/Documentation/media/uapi/dvb/dmx-get-stc.rst @@ -15,34 +15,17 @@ DMX_GET_STC Synopsis -------- -.. c:function:: int ioctl( int fd, int request = DMX_GET_STC, struct dmx_stc *stc) - +.. c:function:: int ioctl( int fd, DMX_GET_STC, struct dmx_stc *stc) + :name: DMX_GET_STC Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_GET_STC for this command. - - - .. row 3 - - - struct dmx_stc \*stc - - - Pointer to the location where the stc is to be stored. +``stc`` + Pointer to the location where the stc is to be stored. Description @@ -63,8 +46,6 @@ On success 0 is returned, on error -1 and the ``errno`` variable is set appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. - - .. flat-table:: :header-rows: 0 :stub-columns: 0 diff --git a/Documentation/media/uapi/dvb/dmx-remove-pid.rst b/Documentation/media/uapi/dvb/dmx-remove-pid.rst index ed1a49ce9fc2..e411495c619c 100644 --- a/Documentation/media/uapi/dvb/dmx-remove-pid.rst +++ b/Documentation/media/uapi/dvb/dmx-remove-pid.rst @@ -15,34 +15,18 @@ DMX_REMOVE_PID Synopsis -------- -.. c:function:: int ioctl(fd, int request = DMX_REMOVE_PID, __u16 *) +.. c:function:: int ioctl(fd, DMX_REMOVE_PID, __u16 *pid) + :name: DMX_REMOVE_PID Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_REMOVE_PID for this command. - - - .. row 3 - - - __u16 * - - - PID of the PES filter to be removed. +``pid`` + PID of the PES filter to be removed. Description diff --git a/Documentation/media/uapi/dvb/dmx-set-buffer-size.rst b/Documentation/media/uapi/dvb/dmx-set-buffer-size.rst index 012b9e9792be..f2f7379f29ed 100644 --- a/Documentation/media/uapi/dvb/dmx-set-buffer-size.rst +++ b/Documentation/media/uapi/dvb/dmx-set-buffer-size.rst @@ -15,35 +15,18 @@ DMX_SET_BUFFER_SIZE Synopsis -------- -.. c:function:: int ioctl( int fd, int request = DMX_SET_BUFFER_SIZE, unsigned long size) +.. c:function:: int ioctl( int fd, DMX_SET_BUFFER_SIZE, unsigned long size) + :name: DMX_SET_BUFFER_SIZE Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_SET_BUFFER_SIZE for this command. - - - .. row 3 - - - unsigned long size - - - Size of circular buffer. +``fd`` + File descriptor returned by :c:func:`open() `. +``size`` + Unsigned long size Description ----------- diff --git a/Documentation/media/uapi/dvb/dmx-set-filter.rst b/Documentation/media/uapi/dvb/dmx-set-filter.rst index d079d8b39597..1d50c803d69a 100644 --- a/Documentation/media/uapi/dvb/dmx-set-filter.rst +++ b/Documentation/media/uapi/dvb/dmx-set-filter.rst @@ -15,34 +15,18 @@ DMX_SET_FILTER Synopsis -------- -.. c:function:: int ioctl( int fd, int request = DMX_SET_FILTER, struct dmx_sct_filter_params *params) - +.. c:function:: int ioctl( int fd, DMX_SET_FILTER, struct dmx_sct_filter_params *params) + :name: DMX_SET_FILTER Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. +``params`` - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_SET_FILTER for this command. - - - .. row 3 - - - struct dmx_sct_filter_params \*params - - - Pointer to structure containing filter parameters. + Pointer to structure containing filter parameters. Description diff --git a/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst b/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst index 1f774624383f..145451d04f7d 100644 --- a/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst +++ b/Documentation/media/uapi/dvb/dmx-set-pes-filter.rst @@ -15,34 +15,19 @@ DMX_SET_PES_FILTER Synopsis -------- -.. c:function:: int ioctl( int fd, int request = DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params) +.. c:function:: int ioctl( int fd, DMX_SET_PES_FILTER, struct dmx_pes_filter_params *params) + :name: DMX_SET_PES_FILTER Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_SET_PES_FILTER for this command. - - - .. row 3 - - - struct dmx_pes_filter_params \*params - - - Pointer to structure containing filter parameters. +``params`` + Pointer to structure containing filter parameters. Description diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst b/Documentation/media/uapi/dvb/dmx-set-source.rst index 7aa4dfe3cdc5..a232fd6e5f52 100644 --- a/Documentation/media/uapi/dvb/dmx-set-source.rst +++ b/Documentation/media/uapi/dvb/dmx-set-source.rst @@ -15,40 +15,25 @@ DMX_SET_SOURCE Synopsis -------- -.. c:function:: int ioctl(fd, int request = DMX_SET_SOURCE, dmx_source_t *) +.. c:function:: int ioctl(fd, DMX_SET_SOURCE, dmx_source_t *src) + :name: DMX_SET_SOURCE Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_SET_SOURCE for this command. - - - .. row 3 - - - dmx_source_t * - - - Undocumented. +``src`` + Undocumented. Description ----------- -This ioctl is undocumented. Documentation is welcome. +.. note:: This ioctl is undocumented. Documentation is welcome. Return Value diff --git a/Documentation/media/uapi/dvb/dmx-start.rst b/Documentation/media/uapi/dvb/dmx-start.rst index d494f6b03dbc..641f3e017fb1 100644 --- a/Documentation/media/uapi/dvb/dmx-start.rst +++ b/Documentation/media/uapi/dvb/dmx-start.rst @@ -15,29 +15,15 @@ DMX_START Synopsis -------- -.. c:function:: int ioctl( int fd, int request = DMX_START) +.. c:function:: int ioctl( int fd, DMX_START) + :name: DMX_START Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_START for this command. - +``fd`` + File descriptor returned by :c:func:`open() `. Description ----------- diff --git a/Documentation/media/uapi/dvb/dmx-stop.rst b/Documentation/media/uapi/dvb/dmx-stop.rst index f9157dd6a8fe..569a3df44923 100644 --- a/Documentation/media/uapi/dvb/dmx-stop.rst +++ b/Documentation/media/uapi/dvb/dmx-stop.rst @@ -15,29 +15,15 @@ DMX_STOP Synopsis -------- -.. c:function:: int ioctl( int fd, int request = DMX_STOP) +.. c:function:: int ioctl( int fd, DMX_STOP) + :name: DMX_STOP Arguments --------- -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals DMX_STOP for this command. - +``fd`` + File descriptor returned by :c:func:`open() `. Description ----------- diff --git a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst index 7bf1145b58a8..e1b6da08b3a1 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst @@ -15,7 +15,8 @@ FE_DISEQC_RECV_SLAVE_REPLY - Receives reply from a DiSEqC 2.0 command Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct dvb_diseqc_slave_reply *argp ) +.. c:function:: int ioctl( int fd, FE_DISEQC_RECV_SLAVE_REPLY, struct dvb_diseqc_slave_reply *argp ) + :name: FE_DISEQC_RECV_SLAVE_REPLY Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_DISEQC_RECV_SLAVE_REPLY - ``argp`` pointer to struct :ref:`dvb_diseqc_slave_reply ` diff --git a/Documentation/media/uapi/dvb/fe-diseqc-reset-overload.rst b/Documentation/media/uapi/dvb/fe-diseqc-reset-overload.rst index 13bac53bd248..75116f283faf 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-reset-overload.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-reset-overload.rst @@ -15,7 +15,8 @@ FE_DISEQC_RESET_OVERLOAD - Restores the power to the antenna subsystem, if it wa Synopsis ======== -.. c:function:: int ioctl( int fd, int request, NULL ) +.. c:function:: int ioctl( int fd, FE_DISEQC_RESET_OVERLOAD, NULL ) + :name: FE_DISEQC_RESET_OVERLOAD Arguments @@ -24,10 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_DISEQC_RESET_OVERLOAD - - Description =========== diff --git a/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst b/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst index d1e9f31ff347..0e55614bc987 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst @@ -15,7 +15,8 @@ FE_DISEQC_SEND_BURST - Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite se Synopsis ======== -.. c:function:: int ioctl( int fd, int request, enum fe_sec_mini_cmd *tone ) +.. c:function:: int ioctl( int fd, FE_DISEQC_SEND_BURST, enum fe_sec_mini_cmd *tone ) + :name: FE_DISEQC_SEND_BURST Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_DISEQC_SEND_BURST - ``tone`` pointer to enum :ref:`fe_sec_mini_cmd ` diff --git a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst index 3b27d9cc544d..ea090cbeaae0 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst @@ -15,7 +15,8 @@ FE_DISEQC_SEND_MASTER_CMD - Sends a DiSEqC command Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct dvb_diseqc_master_cmd *argp ) +.. c:function:: int ioctl( int fd, FE_DISEQC_SEND_MASTER_CMD, struct dvb_diseqc_master_cmd *argp ) + :name: FE_DISEQC_SEND_MASTER_CMD Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_DISEQC_SEND_MASTER_CMD - ``argp`` pointer to struct :ref:`dvb_diseqc_master_cmd ` diff --git a/Documentation/media/uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst b/Documentation/media/uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst index 5ebab0ef9138..f41371f12456 100644 --- a/Documentation/media/uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst +++ b/Documentation/media/uapi/dvb/fe-dishnetwork-send-legacy-cmd.rst @@ -15,22 +15,18 @@ FE_DISHNETWORK_SEND_LEGACY_CMD Synopsis ======== -.. c:function:: int ioctl(int fd, int request = FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd) +.. c:function:: int ioctl(int fd, FE_DISHNETWORK_SEND_LEGACY_CMD, unsigned long cmd) + :name: FE_DISHNETWORK_SEND_LEGACY_CMD Arguments ========= -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - unsigned long cmd - - - sends the specified raw cmd to the dish via DISEqC. +``cmd`` + Sends the specified raw cmd to the dish via DISEqC. Description diff --git a/Documentation/media/uapi/dvb/fe-enable-high-lnb-voltage.rst b/Documentation/media/uapi/dvb/fe-enable-high-lnb-voltage.rst index a485bf259ed2..bacafbc462d2 100644 --- a/Documentation/media/uapi/dvb/fe-enable-high-lnb-voltage.rst +++ b/Documentation/media/uapi/dvb/fe-enable-high-lnb-voltage.rst @@ -15,7 +15,8 @@ FE_ENABLE_HIGH_LNB_VOLTAGE - Select output DC level between normal LNBf voltages Synopsis ======== -.. c:function:: int ioctl( int fd, int request, unsigned int high ) +.. c:function:: int ioctl( int fd, FE_ENABLE_HIGH_LNB_VOLTAGE, unsigned int high ) + :name: FE_ENABLE_HIGH_LNB_VOLTAGE Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_ENABLE_HIGH_LNB_VOLTAGE - ``high`` Valid flags: diff --git a/Documentation/media/uapi/dvb/fe-get-event.rst b/Documentation/media/uapi/dvb/fe-get-event.rst index 79beb1b9da3b..8a719c33073d 100644 --- a/Documentation/media/uapi/dvb/fe-get-event.rst +++ b/Documentation/media/uapi/dvb/fe-get-event.rst @@ -11,43 +11,24 @@ Name FE_GET_EVENT +.. attention:: This ioctl is deprecated. + Synopsis ======== -.. c:function:: int ioctl(int fd, int request = QPSK_GET_EVENT, struct dvb_frontend_event *ev) +.. c:function:: int ioctl(int fd, FE_GET_EVENT, struct dvb_frontend_event *ev) + :name: FE_GET_EVENT Arguments ========= -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals :ref:`FE_GET_EVENT` for this command. - - - .. row 3 - - - struct dvb_frontend_event \*ev - - - Points to the location where the event, - - - .. row 4 - - - - - if any, is to be stored. +``ev`` + Points to the location where the event, if any, is to be stored. Description diff --git a/Documentation/media/uapi/dvb/fe-get-frontend.rst b/Documentation/media/uapi/dvb/fe-get-frontend.rst index fdf0d1440add..d53a3f8237c3 100644 --- a/Documentation/media/uapi/dvb/fe-get-frontend.rst +++ b/Documentation/media/uapi/dvb/fe-get-frontend.rst @@ -11,39 +11,25 @@ Name FE_GET_FRONTEND +.. attention:: This ioctl is deprecated. + Synopsis ======== -.. c:function:: int ioctl(int fd, int request = FE_GET_FRONTEND, struct dvb_frontend_parameters *p) +.. c:function:: int ioctl(int fd, FE_GET_FRONTEND, struct dvb_frontend_parameters *p) + :name: FE_GET_FRONTEND Arguments ========= -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals :ref:`FE_SET_FRONTEND` for this - command. - - - .. row 3 - - - struct dvb_frontend_parameters \*p - - - Points to parameters for tuning operation. +``p`` + Points to parameters for tuning operation. Description diff --git a/Documentation/media/uapi/dvb/fe-get-info.rst b/Documentation/media/uapi/dvb/fe-get-info.rst index 8768179cb812..c367b5ab023c 100644 --- a/Documentation/media/uapi/dvb/fe-get-info.rst +++ b/Documentation/media/uapi/dvb/fe-get-info.rst @@ -15,7 +15,8 @@ FE_GET_INFO - Query DVB frontend capabilities and returns information about the Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct dvb_frontend_info *argp ) +.. c:function:: int ioctl( int fd, FE_GET_INFO, struct dvb_frontend_info *argp ) + :name: FE_GET_INFO Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_GET_INFO - ``argp`` pointer to struct struct :ref:`dvb_frontend_info ` diff --git a/Documentation/media/uapi/dvb/fe-get-property.rst b/Documentation/media/uapi/dvb/fe-get-property.rst index 12042c7ae693..51daf016a8eb 100644 --- a/Documentation/media/uapi/dvb/fe-get-property.rst +++ b/Documentation/media/uapi/dvb/fe-get-property.rst @@ -15,7 +15,11 @@ FE_SET_PROPERTY - FE_GET_PROPERTY - FE_SET_PROPERTY sets one or more frontend pr Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct dtv_properties *argp ) +.. c:function:: int ioctl( int fd, FE_GET_PROPERTY, struct dtv_properties *argp ) + :name: FE_GET_PROPERTY + +.. c:function:: int ioctl( int fd, FE_SET_PROPERTY, struct dtv_properties *argp ) + :name: FE_SET_PROPERTY Arguments @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_SET_PROPERTY, FE_GET_PROPERTY - ``argp`` pointer to struct :ref:`dtv_properties ` diff --git a/Documentation/media/uapi/dvb/fe-read-ber.rst b/Documentation/media/uapi/dvb/fe-read-ber.rst index 3262441385ff..e54972ad5250 100644 --- a/Documentation/media/uapi/dvb/fe-read-ber.rst +++ b/Documentation/media/uapi/dvb/fe-read-ber.rst @@ -11,37 +11,23 @@ Name FE_READ_BER +.. attention:: This ioctl is deprecated. + Synopsis ======== -.. c:function:: int ioctl(int fd, int request = FE_READ_BER, uint32_t *ber) +.. c:function:: int ioctl(int fd, FE_READ_BER, uint32_t *ber) + :name: FE_READ_BER Arguments ========= -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals :ref:`FE_READ_BER` for this command. - - - .. row 3 - - - uint32_t \*ber - - - The bit error rate is stored into \*ber. +``ber`` + The bit error rate is stored into \*ber. Description diff --git a/Documentation/media/uapi/dvb/fe-read-signal-strength.rst b/Documentation/media/uapi/dvb/fe-read-signal-strength.rst index fcaadcb537fb..4b13c4757744 100644 --- a/Documentation/media/uapi/dvb/fe-read-signal-strength.rst +++ b/Documentation/media/uapi/dvb/fe-read-signal-strength.rst @@ -11,40 +11,23 @@ Name FE_READ_SIGNAL_STRENGTH +.. attention:: This ioctl is deprecated. Synopsis ======== -.. c:function:: int ioctl( int fd, int request = FE_READ_SIGNAL_STRENGTH, uint16_t *strength) +.. c:function:: int ioctl( int fd, FE_READ_SIGNAL_STRENGTH, uint16_t *strength) + :name: FE_READ_SIGNAL_STRENGTH Arguments ========= -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals - :ref:`FE_READ_SIGNAL_STRENGTH` - for this command. - - - .. row 3 - - - uint16_t \*strength - - - The signal strength value is stored into \*strength. +``strength`` + The signal strength value is stored into \*strength. Description diff --git a/Documentation/media/uapi/dvb/fe-read-snr.rst b/Documentation/media/uapi/dvb/fe-read-snr.rst index 837af2de9f6f..2aed487f5c99 100644 --- a/Documentation/media/uapi/dvb/fe-read-snr.rst +++ b/Documentation/media/uapi/dvb/fe-read-snr.rst @@ -11,38 +11,23 @@ Name FE_READ_SNR +.. attention:: This ioctl is deprecated. Synopsis ======== -.. c:function:: int ioctl(int fd, int request = FE_READ_SNR, int16_t *snr) +.. c:function:: int ioctl(int fd, FE_READ_SNR, int16_t *snr) + :name: FE_READ_SNR Arguments ========= -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals :ref:`FE_READ_SNR` for this command. - - - .. row 3 - - - uint16_t \*snr - - - The signal-to-noise ratio is stored into \*snr. +``snr`` + The signal-to-noise ratio is stored into \*snr. Description diff --git a/Documentation/media/uapi/dvb/fe-read-status.rst b/Documentation/media/uapi/dvb/fe-read-status.rst index b00bdc8a2e04..c65cec3a35c9 100644 --- a/Documentation/media/uapi/dvb/fe-read-status.rst +++ b/Documentation/media/uapi/dvb/fe-read-status.rst @@ -15,7 +15,8 @@ FE_READ_STATUS - Returns status information about the front-end. This call only Synopsis ======== -.. c:function:: int ioctl( int fd, int request, unsigned int *status ) +.. c:function:: int ioctl( int fd, FE_READ_STATUS, unsigned int *status ) + :name: FE_READ_STATUS Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_READ_STATUS - ``status`` pointer to a bitmask integer filled with the values defined by enum :ref:`fe_status `. diff --git a/Documentation/media/uapi/dvb/fe-read-uncorrected-blocks.rst b/Documentation/media/uapi/dvb/fe-read-uncorrected-blocks.rst index 6b753846a008..46687c123402 100644 --- a/Documentation/media/uapi/dvb/fe-read-uncorrected-blocks.rst +++ b/Documentation/media/uapi/dvb/fe-read-uncorrected-blocks.rst @@ -11,40 +11,23 @@ Name FE_READ_UNCORRECTED_BLOCKS +.. attention:: This ioctl is deprecated. Synopsis ======== -.. c:function:: int ioctl( int fd, int request =FE_READ_UNCORRECTED_BLOCKS, uint32_t *ublocks) +.. c:function:: int ioctl( int fd, FE_READ_UNCORRECTED_BLOCKS, uint32_t *ublocks) + :name: FE_READ_UNCORRECTED_BLOCKS Arguments ========= -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals - :ref:`FE_READ_UNCORRECTED_BLOCKS` - for this command. - - - .. row 3 - - - uint32_t \*ublocks - - - The total number of uncorrected blocks seen by the driver so far. +``ublocks`` + The total number of uncorrected blocks seen by the driver so far. Description diff --git a/Documentation/media/uapi/dvb/fe-set-frontend-tune-mode.rst b/Documentation/media/uapi/dvb/fe-set-frontend-tune-mode.rst index 4461aeb46ebb..1d5878da2f41 100644 --- a/Documentation/media/uapi/dvb/fe-set-frontend-tune-mode.rst +++ b/Documentation/media/uapi/dvb/fe-set-frontend-tune-mode.rst @@ -15,7 +15,8 @@ FE_SET_FRONTEND_TUNE_MODE - Allow setting tuner mode flags to the frontend. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, unsigned int flags ) +.. c:function:: int ioctl( int fd, FE_SET_FRONTEND_TUNE_MODE, unsigned int flags ) + :name: FE_SET_FRONTEND_TUNE_MODE Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_SET_FRONTEND_TUNE_MODE - ``flags`` Valid flags: diff --git a/Documentation/media/uapi/dvb/fe-set-frontend.rst b/Documentation/media/uapi/dvb/fe-set-frontend.rst index 4e66da0af6fd..7f97dce9aee6 100644 --- a/Documentation/media/uapi/dvb/fe-set-frontend.rst +++ b/Documentation/media/uapi/dvb/fe-set-frontend.rst @@ -6,6 +6,8 @@ FE_SET_FRONTEND *************** +.. attention:: This ioctl is deprecated. + Name ==== @@ -15,35 +17,18 @@ FE_SET_FRONTEND Synopsis ======== -.. c:function:: int ioctl(int fd, int request = FE_SET_FRONTEND, struct dvb_frontend_parameters *p) +.. c:function:: int ioctl(int fd, FE_SET_FRONTEND, struct dvb_frontend_parameters *p) + :name: FE_SET_FRONTEND Arguments ========= -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 +``fd`` + File descriptor returned by :c:func:`open() `. - - - .. row 1 - - - int fd - - - File descriptor returned by a previous call to open(). - - - .. row 2 - - - int request - - - Equals :ref:`FE_SET_FRONTEND` for this - command. - - - .. row 3 - - - struct dvb_frontend_parameters \*p - - - Points to parameters for tuning operation. +``p`` + Points to parameters for tuning operation. Description diff --git a/Documentation/media/uapi/dvb/fe-set-tone.rst b/Documentation/media/uapi/dvb/fe-set-tone.rst index a00fcaadecd1..4cfd532d3dc5 100644 --- a/Documentation/media/uapi/dvb/fe-set-tone.rst +++ b/Documentation/media/uapi/dvb/fe-set-tone.rst @@ -15,7 +15,8 @@ FE_SET_TONE - Sets/resets the generation of the continuous 22kHz tone. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, enum fe_sec_tone_mode *tone ) +.. c:function:: int ioctl( int fd, FE_SET_TONE, enum fe_sec_tone_mode *tone ) + :name: FE_SET_TONE Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_SET_TONE - ``tone`` pointer to enum :ref:`fe_sec_tone_mode ` diff --git a/Documentation/media/uapi/dvb/fe-set-voltage.rst b/Documentation/media/uapi/dvb/fe-set-voltage.rst index 05baf77e0301..b8b23c51ec7d 100644 --- a/Documentation/media/uapi/dvb/fe-set-voltage.rst +++ b/Documentation/media/uapi/dvb/fe-set-voltage.rst @@ -15,7 +15,8 @@ FE_SET_VOLTAGE - Allow setting the DC level sent to the antenna subsystem. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, enum fe_sec_voltage *voltage ) +.. c:function:: int ioctl( int fd, FE_SET_VOLTAGE, enum fe_sec_voltage *voltage ) + :name: FE_SET_VOLTAGE Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_SET_VOLTAGE - ``voltage`` pointer to enum :ref:`fe_sec_voltage ` diff --git a/Documentation/media/uapi/dvb/frontend_f_close.rst b/Documentation/media/uapi/dvb/frontend_f_close.rst index 8746eec2b97d..f3b04b60246c 100644 --- a/Documentation/media/uapi/dvb/frontend_f_close.rst +++ b/Documentation/media/uapi/dvb/frontend_f_close.rst @@ -21,13 +21,13 @@ Synopsis .. c:function:: int close( int fd ) - + :name: dvb-fe-close Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. + File descriptor returned by :c:func:`open() `. Description diff --git a/Documentation/media/uapi/dvb/frontend_f_open.rst b/Documentation/media/uapi/dvb/frontend_f_open.rst index 5810e96abf89..690eb375bdc1 100644 --- a/Documentation/media/uapi/dvb/frontend_f_open.rst +++ b/Documentation/media/uapi/dvb/frontend_f_open.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: int open( const char *device_name, int flags ) - + :name: dvb-fe-open Arguments ========= diff --git a/Documentation/media/uapi/dvb/net-add-if.rst b/Documentation/media/uapi/dvb/net-add-if.rst index ebde02b9a3ec..dfb4509f816c 100644 --- a/Documentation/media/uapi/dvb/net-add-if.rst +++ b/Documentation/media/uapi/dvb/net-add-if.rst @@ -15,7 +15,8 @@ NET_ADD_IF - Creates a new network interface for a given Packet ID. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct dvb_net_if *net_if ) +.. c:function:: int ioctl( int fd, NET_ADD_IF, struct dvb_net_if *net_if ) + :name: NET_ADD_IF Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_SET_TONE - ``net_if`` pointer to struct :ref:`dvb_net_if ` diff --git a/Documentation/media/uapi/dvb/net-get-if.rst b/Documentation/media/uapi/dvb/net-get-if.rst index 17cfcda22da3..dd9d6a3c4a2b 100644 --- a/Documentation/media/uapi/dvb/net-get-if.rst +++ b/Documentation/media/uapi/dvb/net-get-if.rst @@ -15,7 +15,8 @@ NET_GET_IF - Read the configuration data of an interface created via - :ref:`NET Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct dvb_net_if *net_if ) +.. c:function:: int ioctl( int fd, NET_GET_IF, struct dvb_net_if *net_if ) + :name: NET_GET_IF Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_SET_TONE - ``net_if`` pointer to struct :ref:`dvb_net_if ` diff --git a/Documentation/media/uapi/dvb/net-remove-if.rst b/Documentation/media/uapi/dvb/net-remove-if.rst index 447dd4299965..646af23a925a 100644 --- a/Documentation/media/uapi/dvb/net-remove-if.rst +++ b/Documentation/media/uapi/dvb/net-remove-if.rst @@ -15,7 +15,8 @@ NET_REMOVE_IF - Removes a network interface. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, int ifnum ) +.. c:function:: int ioctl( int fd, NET_REMOVE_IF, int ifnum ) + :name: NET_REMOVE_IF Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - FE_SET_TONE - ``net_if`` number of the interface to be removed diff --git a/Documentation/media/uapi/dvb/video-clear-buffer.rst b/Documentation/media/uapi/dvb/video-clear-buffer.rst index dd227ad85546..2e51a78a69f1 100644 --- a/Documentation/media/uapi/dvb/video-clear-buffer.rst +++ b/Documentation/media/uapi/dvb/video-clear-buffer.rst @@ -11,11 +11,13 @@ Name VIDEO_CLEAR_BUFFER +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_CLEAR_BUFFER) +.. c:function:: int ioctl(fd, VIDEO_CLEAR_BUFFER) + :name: VIDEO_CLEAR_BUFFER Arguments diff --git a/Documentation/media/uapi/dvb/video-command.rst b/Documentation/media/uapi/dvb/video-command.rst index 42a98a47e323..4772562036f1 100644 --- a/Documentation/media/uapi/dvb/video-command.rst +++ b/Documentation/media/uapi/dvb/video-command.rst @@ -11,11 +11,13 @@ Name VIDEO_COMMAND +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(int fd, int request = VIDEO_COMMAND, struct video_command *cmd) +.. c:function:: int ioctl(int fd, VIDEO_COMMAND, struct video_command *cmd) + :name: VIDEO_COMMAND Arguments diff --git a/Documentation/media/uapi/dvb/video-continue.rst b/Documentation/media/uapi/dvb/video-continue.rst index 2a6444a4f4dc..030c2ec98869 100644 --- a/Documentation/media/uapi/dvb/video-continue.rst +++ b/Documentation/media/uapi/dvb/video-continue.rst @@ -11,11 +11,13 @@ Name VIDEO_CONTINUE +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_CONTINUE) +.. c:function:: int ioctl(fd, VIDEO_CONTINUE) + :name: VIDEO_CONTINUE Arguments diff --git a/Documentation/media/uapi/dvb/video-fast-forward.rst b/Documentation/media/uapi/dvb/video-fast-forward.rst index 0b3a27a22d30..70a53e110335 100644 --- a/Documentation/media/uapi/dvb/video-fast-forward.rst +++ b/Documentation/media/uapi/dvb/video-fast-forward.rst @@ -11,11 +11,13 @@ Name VIDEO_FAST_FORWARD +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_FAST_FORWARD, int nFrames) +.. c:function:: int ioctl(fd, VIDEO_FAST_FORWARD, int nFrames) + :name: VIDEO_FAST_FORWARD Arguments diff --git a/Documentation/media/uapi/dvb/video-fclose.rst b/Documentation/media/uapi/dvb/video-fclose.rst index b4dd5ea676b9..8a997ae6f6a7 100644 --- a/Documentation/media/uapi/dvb/video-fclose.rst +++ b/Documentation/media/uapi/dvb/video-fclose.rst @@ -11,6 +11,7 @@ Name dvb video close() +.. attention:: This ioctl is deprecated. Synopsis -------- diff --git a/Documentation/media/uapi/dvb/video-fopen.rst b/Documentation/media/uapi/dvb/video-fopen.rst index 5b73ca9f7bed..203a2c56f10a 100644 --- a/Documentation/media/uapi/dvb/video-fopen.rst +++ b/Documentation/media/uapi/dvb/video-fopen.rst @@ -11,6 +11,7 @@ Name dvb video open() +.. attention:: This ioctl is deprecated. Synopsis -------- diff --git a/Documentation/media/uapi/dvb/video-freeze.rst b/Documentation/media/uapi/dvb/video-freeze.rst index 12e04df990b7..9cef65a02e8d 100644 --- a/Documentation/media/uapi/dvb/video-freeze.rst +++ b/Documentation/media/uapi/dvb/video-freeze.rst @@ -11,11 +11,13 @@ Name VIDEO_FREEZE +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_FREEZE) +.. c:function:: int ioctl(fd, VIDEO_FREEZE) + :name: VIDEO_FREEZE Arguments diff --git a/Documentation/media/uapi/dvb/video-fwrite.rst b/Documentation/media/uapi/dvb/video-fwrite.rst index da03db4be8de..cfe7c57dcfc7 100644 --- a/Documentation/media/uapi/dvb/video-fwrite.rst +++ b/Documentation/media/uapi/dvb/video-fwrite.rst @@ -11,6 +11,7 @@ Name dvb video write() +.. attention:: This ioctl is deprecated. Synopsis -------- diff --git a/Documentation/media/uapi/dvb/video-get-capabilities.rst b/Documentation/media/uapi/dvb/video-get-capabilities.rst index 5515dd40a1c1..6987f659a1ad 100644 --- a/Documentation/media/uapi/dvb/video-get-capabilities.rst +++ b/Documentation/media/uapi/dvb/video-get-capabilities.rst @@ -11,11 +11,13 @@ Name VIDEO_GET_CAPABILITIES +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_GET_CAPABILITIES, unsigned int *cap) +.. c:function:: int ioctl(fd, VIDEO_GET_CAPABILITIES, unsigned int *cap) + :name: VIDEO_GET_CAPABILITIES Arguments diff --git a/Documentation/media/uapi/dvb/video-get-event.rst b/Documentation/media/uapi/dvb/video-get-event.rst index d43459915179..8c0c622c380b 100644 --- a/Documentation/media/uapi/dvb/video-get-event.rst +++ b/Documentation/media/uapi/dvb/video-get-event.rst @@ -11,11 +11,13 @@ Name VIDEO_GET_EVENT +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_GET_EVENT, struct video_event *ev) +.. c:function:: int ioctl(fd, VIDEO_GET_EVENT, struct video_event *ev) + :name: VIDEO_GET_EVENT Arguments diff --git a/Documentation/media/uapi/dvb/video-get-frame-count.rst b/Documentation/media/uapi/dvb/video-get-frame-count.rst index a55f7a1d52ac..0ffe22cd6108 100644 --- a/Documentation/media/uapi/dvb/video-get-frame-count.rst +++ b/Documentation/media/uapi/dvb/video-get-frame-count.rst @@ -11,11 +11,13 @@ Name VIDEO_GET_FRAME_COUNT +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(int fd, int request = VIDEO_GET_FRAME_COUNT, __u64 *pts) +.. c:function:: int ioctl(int fd, VIDEO_GET_FRAME_COUNT, __u64 *pts) + :name: VIDEO_GET_FRAME_COUNT Arguments diff --git a/Documentation/media/uapi/dvb/video-get-frame-rate.rst b/Documentation/media/uapi/dvb/video-get-frame-rate.rst index a137b6589599..400042a854cf 100644 --- a/Documentation/media/uapi/dvb/video-get-frame-rate.rst +++ b/Documentation/media/uapi/dvb/video-get-frame-rate.rst @@ -11,11 +11,13 @@ Name VIDEO_GET_FRAME_RATE +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(int fd, int request = VIDEO_GET_FRAME_RATE, unsigned int *rate) +.. c:function:: int ioctl(int fd, VIDEO_GET_FRAME_RATE, unsigned int *rate) + :name: VIDEO_GET_FRAME_RATE Arguments diff --git a/Documentation/media/uapi/dvb/video-get-navi.rst b/Documentation/media/uapi/dvb/video-get-navi.rst index ccb2552722f0..b8de9ccf38c2 100644 --- a/Documentation/media/uapi/dvb/video-get-navi.rst +++ b/Documentation/media/uapi/dvb/video-get-navi.rst @@ -11,11 +11,13 @@ Name VIDEO_GET_NAVI +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_GET_NAVI , video_navi_pack_t *navipack) +.. c:function:: int ioctl(fd, VIDEO_GET_NAVI , video_navi_pack_t *navipack) + :name: VIDEO_GET_NAVI Arguments diff --git a/Documentation/media/uapi/dvb/video-get-pts.rst b/Documentation/media/uapi/dvb/video-get-pts.rst index c1ad9576963d..c73f86f1d35b 100644 --- a/Documentation/media/uapi/dvb/video-get-pts.rst +++ b/Documentation/media/uapi/dvb/video-get-pts.rst @@ -11,11 +11,13 @@ Name VIDEO_GET_PTS +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(int fd, int request = VIDEO_GET_PTS, __u64 *pts) +.. c:function:: int ioctl(int fd, VIDEO_GET_PTS, __u64 *pts) + :name: VIDEO_GET_PTS Arguments diff --git a/Documentation/media/uapi/dvb/video-get-size.rst b/Documentation/media/uapi/dvb/video-get-size.rst index 70fb266e3ed8..ce8b4c6b41a5 100644 --- a/Documentation/media/uapi/dvb/video-get-size.rst +++ b/Documentation/media/uapi/dvb/video-get-size.rst @@ -11,11 +11,13 @@ Name VIDEO_GET_SIZE +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(int fd, int request = VIDEO_GET_SIZE, video_size_t *size) +.. c:function:: int ioctl(int fd, VIDEO_GET_SIZE, video_size_t *size) + :name: VIDEO_GET_SIZE Arguments diff --git a/Documentation/media/uapi/dvb/video-get-status.rst b/Documentation/media/uapi/dvb/video-get-status.rst index 5fd5b37942ec..7b6a278b5246 100644 --- a/Documentation/media/uapi/dvb/video-get-status.rst +++ b/Documentation/media/uapi/dvb/video-get-status.rst @@ -11,11 +11,13 @@ Name VIDEO_GET_STATUS +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_GET_STATUS, struct video_status *status) +.. c:function:: int ioctl(fd, VIDEO_GET_STATUS, struct video_status *status) + :name: VIDEO_GET_STATUS Arguments diff --git a/Documentation/media/uapi/dvb/video-play.rst b/Documentation/media/uapi/dvb/video-play.rst index 103d0ad3341a..3f66ae3b7e35 100644 --- a/Documentation/media/uapi/dvb/video-play.rst +++ b/Documentation/media/uapi/dvb/video-play.rst @@ -11,11 +11,13 @@ Name VIDEO_PLAY +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_PLAY) +.. c:function:: int ioctl(fd, VIDEO_PLAY) + :name: VIDEO_PLAY Arguments diff --git a/Documentation/media/uapi/dvb/video-select-source.rst b/Documentation/media/uapi/dvb/video-select-source.rst index f03c544668f5..eaa1088f07da 100644 --- a/Documentation/media/uapi/dvb/video-select-source.rst +++ b/Documentation/media/uapi/dvb/video-select-source.rst @@ -11,11 +11,13 @@ Name VIDEO_SELECT_SOURCE +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SELECT_SOURCE, video_stream_source_t source) +.. c:function:: int ioctl(fd, VIDEO_SELECT_SOURCE, video_stream_source_t source) + :name: VIDEO_SELECT_SOURCE Arguments diff --git a/Documentation/media/uapi/dvb/video-set-attributes.rst b/Documentation/media/uapi/dvb/video-set-attributes.rst index 9de0d9c7c9ca..8901520d7e43 100644 --- a/Documentation/media/uapi/dvb/video-set-attributes.rst +++ b/Documentation/media/uapi/dvb/video-set-attributes.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_ATTRIBUTES +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_ATTRIBUTE ,video_attributes_t vattr) +.. c:function:: int ioctl(fd, VIDEO_SET_ATTRIBUTE ,video_attributes_t vattr) + :name: VIDEO_SET_ATTRIBUTE Arguments diff --git a/Documentation/media/uapi/dvb/video-set-blank.rst b/Documentation/media/uapi/dvb/video-set-blank.rst index d8b94c9b56b9..3858c69496a5 100644 --- a/Documentation/media/uapi/dvb/video-set-blank.rst +++ b/Documentation/media/uapi/dvb/video-set-blank.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_BLANK +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_BLANK, boolean mode) +.. c:function:: int ioctl(fd, VIDEO_SET_BLANK, boolean mode) + :name: VIDEO_SET_BLANK Arguments diff --git a/Documentation/media/uapi/dvb/video-set-display-format.rst b/Documentation/media/uapi/dvb/video-set-display-format.rst index c1fb7c75b4a8..6abf19479939 100644 --- a/Documentation/media/uapi/dvb/video-set-display-format.rst +++ b/Documentation/media/uapi/dvb/video-set-display-format.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_DISPLAY_FORMAT +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_DISPLAY_FORMAT, video_display_format_t format) +.. c:function:: int ioctl(fd, VIDEO_SET_DISPLAY_FORMAT, video_display_format_t format) + :name: VIDEO_SET_DISPLAY_FORMAT Arguments diff --git a/Documentation/media/uapi/dvb/video-set-format.rst b/Documentation/media/uapi/dvb/video-set-format.rst index 257a3c2a4627..117618525538 100644 --- a/Documentation/media/uapi/dvb/video-set-format.rst +++ b/Documentation/media/uapi/dvb/video-set-format.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_FORMAT +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_FORMAT, video_format_t format) +.. c:function:: int ioctl(fd, VIDEO_SET_FORMAT, video_format_t format) + :name: VIDEO_SET_FORMAT Arguments diff --git a/Documentation/media/uapi/dvb/video-set-highlight.rst b/Documentation/media/uapi/dvb/video-set-highlight.rst index 6ff11af71355..d93b69eef15b 100644 --- a/Documentation/media/uapi/dvb/video-set-highlight.rst +++ b/Documentation/media/uapi/dvb/video-set-highlight.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_HIGHLIGHT +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_HIGHLIGHT ,video_highlight_t *vhilite) +.. c:function:: int ioctl(fd, VIDEO_SET_HIGHLIGHT ,video_highlight_t *vhilite) + :name: VIDEO_SET_HIGHLIGHT Arguments diff --git a/Documentation/media/uapi/dvb/video-set-id.rst b/Documentation/media/uapi/dvb/video-set-id.rst index 61993ab354ca..18f66875ae3f 100644 --- a/Documentation/media/uapi/dvb/video-set-id.rst +++ b/Documentation/media/uapi/dvb/video-set-id.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_ID +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(int fd, int request = VIDEO_SET_ID, int id) +.. c:function:: int ioctl(int fd, VIDEO_SET_ID, int id) + :name: VIDEO_SET_ID Arguments diff --git a/Documentation/media/uapi/dvb/video-set-spu-palette.rst b/Documentation/media/uapi/dvb/video-set-spu-palette.rst index ae9e0da5fd0b..b24f7882089a 100644 --- a/Documentation/media/uapi/dvb/video-set-spu-palette.rst +++ b/Documentation/media/uapi/dvb/video-set-spu-palette.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_SPU_PALETTE +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_SPU_PALETTE, video_spu_palette_t *palette ) +.. c:function:: int ioctl(fd, VIDEO_SET_SPU_PALETTE, video_spu_palette_t *palette ) + :name: VIDEO_SET_SPU_PALETTE Arguments diff --git a/Documentation/media/uapi/dvb/video-set-spu.rst b/Documentation/media/uapi/dvb/video-set-spu.rst index ce2860574f20..2a7f0625de38 100644 --- a/Documentation/media/uapi/dvb/video-set-spu.rst +++ b/Documentation/media/uapi/dvb/video-set-spu.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_SPU +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_SPU , video_spu_t *spu) +.. c:function:: int ioctl(fd, VIDEO_SET_SPU , video_spu_t *spu) + :name: VIDEO_SET_SPU Arguments diff --git a/Documentation/media/uapi/dvb/video-set-streamtype.rst b/Documentation/media/uapi/dvb/video-set-streamtype.rst index a2055369f0cd..02a3c2e4e67c 100644 --- a/Documentation/media/uapi/dvb/video-set-streamtype.rst +++ b/Documentation/media/uapi/dvb/video-set-streamtype.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_STREAMTYPE +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_STREAMTYPE, int type) +.. c:function:: int ioctl(fd, VIDEO_SET_STREAMTYPE, int type) + :name: VIDEO_SET_STREAMTYPE Arguments diff --git a/Documentation/media/uapi/dvb/video-set-system.rst b/Documentation/media/uapi/dvb/video-set-system.rst index f84906a7d1f4..e39cbe080ef7 100644 --- a/Documentation/media/uapi/dvb/video-set-system.rst +++ b/Documentation/media/uapi/dvb/video-set-system.rst @@ -11,11 +11,13 @@ Name VIDEO_SET_SYSTEM +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SET_SYSTEM , video_system_t system) +.. c:function:: int ioctl(fd, VIDEO_SET_SYSTEM , video_system_t system) + :name: VIDEO_SET_SYSTEM Arguments diff --git a/Documentation/media/uapi/dvb/video-slowmotion.rst b/Documentation/media/uapi/dvb/video-slowmotion.rst index c8cc85af590b..bd3d1a4070d9 100644 --- a/Documentation/media/uapi/dvb/video-slowmotion.rst +++ b/Documentation/media/uapi/dvb/video-slowmotion.rst @@ -11,11 +11,13 @@ Name VIDEO_SLOWMOTION +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_SLOWMOTION, int nFrames) +.. c:function:: int ioctl(fd, VIDEO_SLOWMOTION, int nFrames) + :name: VIDEO_SLOWMOTION Arguments diff --git a/Documentation/media/uapi/dvb/video-stillpicture.rst b/Documentation/media/uapi/dvb/video-stillpicture.rst index 053cdbba4ed4..6f943f5e27bd 100644 --- a/Documentation/media/uapi/dvb/video-stillpicture.rst +++ b/Documentation/media/uapi/dvb/video-stillpicture.rst @@ -11,11 +11,13 @@ Name VIDEO_STILLPICTURE +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_STILLPICTURE, struct video_still_picture *sp) +.. c:function:: int ioctl(fd, VIDEO_STILLPICTURE, struct video_still_picture *sp) + :name: VIDEO_STILLPICTURE Arguments diff --git a/Documentation/media/uapi/dvb/video-stop.rst b/Documentation/media/uapi/dvb/video-stop.rst index 4e7fbab4b8bc..fb827effb276 100644 --- a/Documentation/media/uapi/dvb/video-stop.rst +++ b/Documentation/media/uapi/dvb/video-stop.rst @@ -11,11 +11,13 @@ Name VIDEO_STOP +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(fd, int request = VIDEO_STOP, boolean mode) +.. c:function:: int ioctl(fd, VIDEO_STOP, boolean mode) + :name: VIDEO_STOP Arguments diff --git a/Documentation/media/uapi/dvb/video-try-command.rst b/Documentation/media/uapi/dvb/video-try-command.rst index be21fb01bd0f..008e6a9ab696 100644 --- a/Documentation/media/uapi/dvb/video-try-command.rst +++ b/Documentation/media/uapi/dvb/video-try-command.rst @@ -11,11 +11,13 @@ Name VIDEO_TRY_COMMAND +.. attention:: This ioctl is deprecated. Synopsis -------- -.. c:function:: int ioctl(int fd, int request = VIDEO_TRY_COMMAND, struct video_command *cmd) +.. c:function:: int ioctl(int fd, VIDEO_TRY_COMMAND, struct video_command *cmd) + :name: VIDEO_TRY_COMMAND Arguments From 995478366220ba770895e24db04c601f19455f6b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 16:58:14 -0300 Subject: [PATCH 110/591] [media] docs-rst: Convert CEC uAPI to use C function references Name all ioctl references and make them match the ioctls that are documented. That will improve the cross-reference index, as it will have all ioctls and syscalls there. While here, improve the documentation to make them to look more like the rest of the document. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/cec/cec-func-close.rst | 3 ++- Documentation/media/uapi/cec/cec-func-ioctl.rst | 5 +++-- Documentation/media/uapi/cec/cec-func-open.rst | 1 + Documentation/media/uapi/cec/cec-func-poll.rst | 10 ++++++++++ .../media/uapi/cec/cec-ioc-adap-g-caps.rst | 6 ++---- .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst | 12 ++++++------ .../media/uapi/cec/cec-ioc-adap-g-phys-addr.rst | 13 +++++++------ Documentation/media/uapi/cec/cec-ioc-dqevent.rst | 7 ++----- Documentation/media/uapi/cec/cec-ioc-g-mode.rst | 13 +++++++------ Documentation/media/uapi/cec/cec-ioc-receive.rst | 13 +++++++------ 10 files changed, 47 insertions(+), 36 deletions(-) diff --git a/Documentation/media/uapi/cec/cec-func-close.rst b/Documentation/media/uapi/cec/cec-func-close.rst index c763496b243f..8267c31b317d 100644 --- a/Documentation/media/uapi/cec/cec-func-close.rst +++ b/Documentation/media/uapi/cec/cec-func-close.rst @@ -21,12 +21,13 @@ Synopsis .. c:function:: int close( int fd ) + :name: cec-close Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. + File descriptor returned by :c:func:`open() `. Description diff --git a/Documentation/media/uapi/cec/cec-func-ioctl.rst b/Documentation/media/uapi/cec/cec-func-ioctl.rst index 116132b19515..9e8dbb118d6a 100644 --- a/Documentation/media/uapi/cec/cec-func-ioctl.rst +++ b/Documentation/media/uapi/cec/cec-func-ioctl.rst @@ -20,16 +20,17 @@ Synopsis .. c:function:: int ioctl( int fd, int request, void *argp ) + :name: cec-ioctl Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. + File descriptor returned by :c:func:`open() `. ``request`` CEC ioctl request code as defined in the cec.h header file, for - example :ref:`CEC_ADAP_G_CAPS`. + example :c:func:`CEC_ADAP_G_CAPS`. ``argp`` Pointer to a request-specific structure. diff --git a/Documentation/media/uapi/cec/cec-func-open.rst b/Documentation/media/uapi/cec/cec-func-open.rst index 33e5b5379fa3..af3f5b5c24c6 100644 --- a/Documentation/media/uapi/cec/cec-func-open.rst +++ b/Documentation/media/uapi/cec/cec-func-open.rst @@ -20,6 +20,7 @@ Synopsis .. c:function:: int open( const char *device_name, int flags ) + :name: cec-open Arguments diff --git a/Documentation/media/uapi/cec/cec-func-poll.rst b/Documentation/media/uapi/cec/cec-func-poll.rst index a5225185f98c..5bacb7c6f33b 100644 --- a/Documentation/media/uapi/cec/cec-func-poll.rst +++ b/Documentation/media/uapi/cec/cec-func-poll.rst @@ -21,10 +21,20 @@ Synopsis .. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout ) + :name: cec-poll Arguments ========= +``ufds`` + List of FD events to be watched + +``nfds`` + Number of FD efents at the \*ufds array + +``timeout`` + Timeout to wait for events + Description =========== diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst index cc68e0dcea7e..14d7f6a19455 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst @@ -14,7 +14,8 @@ CEC_ADAP_G_CAPS - Query device capabilities Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct cec_caps *argp ) +.. c:function:: int ioctl( int fd, CEC_ADAP_G_CAPS, struct cec_caps *argp ) + :name: CEC_ADAP_G_CAPS Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - CEC_ADAP_G_CAPS - ``argp`` diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index 9de2a005f6fb..1a920109072c 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst @@ -17,20 +17,20 @@ CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS - Get or set the logical addresses Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct cec_log_addrs *argp ) +.. c:function:: int ioctl( int fd, CEC_ADAP_G_LOG_ADDRS, struct cec_log_addrs *argp ) + :name: CEC_ADAP_G_LOG_ADDRS +.. c:function:: int ioctl( int fd, CEC_ADAP_S_LOG_ADDRS, struct cec_log_addrs *argp ) + :name: CEC_ADAP_S_LOG_ADDRS Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. - -``request`` - CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS + File descriptor returned by :c:func:`open() `. ``argp`` - + Pointer to struct cec_log_addrs Description =========== diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst index 9502d6f25798..3357deb43c85 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-phys-addr.rst @@ -17,19 +17,20 @@ CEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR - Get or set the physical address Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u16 *argp ) +.. c:function:: int ioctl( int fd, CEC_ADAP_G_PHYS_ADDR, __u16 *argp ) + :name: CEC_ADAP_G_PHYS_ADDR + +.. c:function:: int ioctl( int fd, CEC_ADAP_S_PHYS_ADDR, __u16 *argp ) + :name: CEC_ADAP_S_PHYS_ADDR Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. - -``request`` - CEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR + File descriptor returned by :c:func:`open() `. ``argp`` - + Pointer to the CEC address. Description =========== diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index ca9ef597527e..b7f104802045 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -15,8 +15,8 @@ CEC_DQEVENT - Dequeue a CEC event Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct cec_event *argp ) - :name: CEC_DQEVENT +.. c:function:: int ioctl( int fd, CEC_DQEVENT, struct cec_event *argp ) + :name: CEC_DQEVENT Arguments ========= @@ -24,9 +24,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - CEC_DQEVENT - ``argp`` diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst index a33522267d47..70a41902ab58 100644 --- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst +++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst @@ -13,19 +13,20 @@ CEC_G_MODE, CEC_S_MODE - Get or set exclusive use of the CEC adapter Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *argp ) +.. c:function:: int ioctl( int fd, CEC_G_MODE, __u32 *argp ) + :name: CEC_G_MODE + +.. c:function:: int ioctl( int fd, CEC_S_MODE, __u32 *argp ) + :name: CEC_S_MODE Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. - -``request`` - CEC_G_MODE, CEC_S_MODE + File descriptor returned by :c:func:`open() `. ``argp`` - + Pointer to CEC mode. Description =========== diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index 99d875038f61..025a3851ab76 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -16,19 +16,20 @@ CEC_RECEIVE, CEC_TRANSMIT - Receive or transmit a CEC message Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct cec_msg *argp ) +.. c:function:: int ioctl( int fd, CEC_RECEIVE, struct cec_msg *argp ) + :name: CEC_RECEIVE + +.. c:function:: int ioctl( int fd, CEC_TRANSMIT, struct cec_msg *argp ) + :name: CEC_TRANSMIT Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. - -``request`` - CEC_RECEIVE, CEC_TRANSMIT + File descriptor returned by :c:func:`open() `. ``argp`` - + Pointer to struct cec_msg. Description =========== From 15c190146c5d1843d2eda0aac8be21d22c3ac431 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 16:59:31 -0300 Subject: [PATCH 111/591] [media] docs-rst: Convert LIRC uAPI to use C function references Name all ioctl references and make them match the ioctls that are documented. That will improve the cross-reference index, as it will have all ioctls and syscalls there. While here, improve the documentation to make them to look more like the rest of the document. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/rc/lirc-get-features.rst | 6 ++---- Documentation/media/uapi/rc/lirc-get-length.rst | 6 ++---- Documentation/media/uapi/rc/lirc-get-rec-mode.rst | 11 ++++++----- .../media/uapi/rc/lirc-get-rec-resolution.rst | 6 ++---- Documentation/media/uapi/rc/lirc-get-send-mode.rst | 9 +++++---- Documentation/media/uapi/rc/lirc-get-timeout.rst | 9 +++++---- Documentation/media/uapi/rc/lirc-read.rst | 5 ++++- .../media/uapi/rc/lirc-set-measure-carrier-mode.rst | 6 ++---- .../media/uapi/rc/lirc-set-rec-carrier-range.rst | 6 ++---- Documentation/media/uapi/rc/lirc-set-rec-carrier.rst | 6 ++---- .../media/uapi/rc/lirc-set-rec-timeout-reports.rst | 6 ++---- Documentation/media/uapi/rc/lirc-set-rec-timeout.rst | 6 ++---- Documentation/media/uapi/rc/lirc-set-send-carrier.rst | 6 ++---- .../media/uapi/rc/lirc-set-send-duty-cycle.rst | 6 ++---- .../media/uapi/rc/lirc-set-transmitter-mask.rst | 6 ++---- .../media/uapi/rc/lirc-set-wideband-receiver.rst | 6 ++---- Documentation/media/uapi/rc/lirc-write.rst | 6 ++++-- 17 files changed, 48 insertions(+), 64 deletions(-) diff --git a/Documentation/media/uapi/rc/lirc-get-features.rst b/Documentation/media/uapi/rc/lirc-get-features.rst index d0c8a426aa16..79e07b4d44d6 100644 --- a/Documentation/media/uapi/rc/lirc-get-features.rst +++ b/Documentation/media/uapi/rc/lirc-get-features.rst @@ -14,7 +14,8 @@ LIRC_GET_FEATURES - Get the underlying hardware device's features Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *features) +.. c:function:: int ioctl( int fd, LIRC_GET_FEATURES, __u32 *features) + :name: LIRC_GET_FEATURES Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_GET_FEATURES - ``features`` Bitmask with the LIRC features. diff --git a/Documentation/media/uapi/rc/lirc-get-length.rst b/Documentation/media/uapi/rc/lirc-get-length.rst index 44c6e8923b40..8c2747c8d2c9 100644 --- a/Documentation/media/uapi/rc/lirc-get-length.rst +++ b/Documentation/media/uapi/rc/lirc-get-length.rst @@ -14,7 +14,8 @@ LIRC_GET_LENGTH - Retrieves the code length in bits. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *length ) +.. c:function:: int ioctl( int fd, LIRC_GET_LENGTH, __u32 *length ) + :name: LIRC_GET_LENGTH Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_GET_LENGTH - ``length`` length, in bits diff --git a/Documentation/media/uapi/rc/lirc-get-rec-mode.rst b/Documentation/media/uapi/rc/lirc-get-rec-mode.rst index 445c618771f4..a5023e0194c1 100644 --- a/Documentation/media/uapi/rc/lirc-get-rec-mode.rst +++ b/Documentation/media/uapi/rc/lirc-get-rec-mode.rst @@ -10,12 +10,16 @@ ioctls LIRC_GET_REC_MODE and LIRC_SET_REC_MODE Name ==== -LIRC_GET_REC_MODE/LIRC_GET_REC_MODE - Get/set supported receive modes. +LIRC_GET_REC_MODE/LIRC_SET_REC_MODE - Get/set supported receive modes. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 rx_modes) +.. c:function:: int ioctl( int fd, LIRC_GET_REC_MODE, __u32 rx_modes) + :name: LIRC_GET_REC_MODE + +.. c:function:: int ioctl( int fd, LIRC_SET_REC_MODE, __u32 rx_modes) + :name: LIRC_SET_REC_MODE Arguments ========= @@ -23,9 +27,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_GET_REC_MODE or LIRC_GET_REC_MODE - ``rx_modes`` Bitmask with the supported transmit modes. diff --git a/Documentation/media/uapi/rc/lirc-get-rec-resolution.rst b/Documentation/media/uapi/rc/lirc-get-rec-resolution.rst index 3ac3a8199c29..6e016edc2bc4 100644 --- a/Documentation/media/uapi/rc/lirc-get-rec-resolution.rst +++ b/Documentation/media/uapi/rc/lirc-get-rec-resolution.rst @@ -14,7 +14,8 @@ LIRC_GET_REC_RESOLUTION - Obtain the value of receive resolution, in microsecond Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *microseconds) +.. c:function:: int ioctl( int fd, LIRC_GET_REC_RESOLUTION, __u32 *microseconds) + :name: LIRC_GET_REC_RESOLUTION Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_GET_REC_RESOLUTION - ``microseconds`` Resolution, in microseconds. diff --git a/Documentation/media/uapi/rc/lirc-get-send-mode.rst b/Documentation/media/uapi/rc/lirc-get-send-mode.rst index 5e40b7bc1c1f..51ac13428969 100644 --- a/Documentation/media/uapi/rc/lirc-get-send-mode.rst +++ b/Documentation/media/uapi/rc/lirc-get-send-mode.rst @@ -15,7 +15,11 @@ LIRC_GET_SEND_MODE/LIRC_SET_SEND_MODE - Get/set supported transmit mode. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *tx_modes ) +.. c:function:: int ioctl( int fd, LIRC_GET_SEND_MODE, __u32 *tx_modes ) + :name: LIRC_GET_SEND_MODE + +.. c:function:: int ioctl( int fd, LIRC_SET_SEND_MODE, __u32 *tx_modes ) + :name: LIRC_SET_SEND_MODE Arguments ========= @@ -23,9 +27,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_GET_SEND_MODE - ``tx_modes`` Bitmask with the supported transmit modes. diff --git a/Documentation/media/uapi/rc/lirc-get-timeout.rst b/Documentation/media/uapi/rc/lirc-get-timeout.rst index 0d103f899350..c94bc5dcaa8e 100644 --- a/Documentation/media/uapi/rc/lirc-get-timeout.rst +++ b/Documentation/media/uapi/rc/lirc-get-timeout.rst @@ -16,7 +16,11 @@ range for IR receive. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *timeout) +.. c:function:: int ioctl( int fd, LIRC_GET_MIN_TIMEOUT, __u32 *timeout) + :name: LIRC_GET_MIN_TIMEOUT + +.. c:function:: int ioctl( int fd, LIRC_GET_MAX_TIMEOUT, __u32 *timeout) + :name: LIRC_GET_MAX_TIMEOUT Arguments ========= @@ -24,9 +28,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_GET_MIN_TIMEOUT or LIRC_GET_MAX_TIMEOUT - ``timeout`` Timeout, in microseconds. diff --git a/Documentation/media/uapi/rc/lirc-read.rst b/Documentation/media/uapi/rc/lirc-read.rst index c5b5e1db7cad..62bd3d8c9c67 100644 --- a/Documentation/media/uapi/rc/lirc-read.rst +++ b/Documentation/media/uapi/rc/lirc-read.rst @@ -21,6 +21,7 @@ Synopsis .. c:function:: ssize_t read( int fd, void *buf, size_t count ) + :name lirc-read Arguments @@ -30,8 +31,10 @@ Arguments File descriptor returned by ``open()``. ``buf`` -``count`` + Buffer to be filled +``count`` + Max number of bytes to read Description =========== diff --git a/Documentation/media/uapi/rc/lirc-set-measure-carrier-mode.rst b/Documentation/media/uapi/rc/lirc-set-measure-carrier-mode.rst index ee0b46b44c24..6307b5715595 100644 --- a/Documentation/media/uapi/rc/lirc-set-measure-carrier-mode.rst +++ b/Documentation/media/uapi/rc/lirc-set-measure-carrier-mode.rst @@ -14,7 +14,8 @@ LIRC_SET_MEASURE_CARRIER_MODE - enable or disable measure mode Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *enable ) +.. c:function:: int ioctl( int fd, LIRC_SET_MEASURE_CARRIER_MODE, __u32 *enable ) + :name: LIRC_SET_MEASURE_CARRIER_MODE Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_MEASURE_CARRIER_MODE - ``enable`` enable = 1 means enable measure mode, enable = 0 means disable measure mode. diff --git a/Documentation/media/uapi/rc/lirc-set-rec-carrier-range.rst b/Documentation/media/uapi/rc/lirc-set-rec-carrier-range.rst index 44814a5163e6..a83fbbfa0d3b 100644 --- a/Documentation/media/uapi/rc/lirc-set-rec-carrier-range.rst +++ b/Documentation/media/uapi/rc/lirc-set-rec-carrier-range.rst @@ -15,7 +15,8 @@ IR receive. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *frequency ) +.. c:function:: int ioctl( int fd, LIRC_SET_REC_CARRIER_RANGE, __u32 *frequency ) + :name: LIRC_SET_REC_CARRIER_RANGE Arguments ========= @@ -23,9 +24,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_REC_CARRIER_RANGE - ``frequency`` Frequency of the carrier that modulates PWM data, in Hz. diff --git a/Documentation/media/uapi/rc/lirc-set-rec-carrier.rst b/Documentation/media/uapi/rc/lirc-set-rec-carrier.rst index c3508b7fd441..a411c0330818 100644 --- a/Documentation/media/uapi/rc/lirc-set-rec-carrier.rst +++ b/Documentation/media/uapi/rc/lirc-set-rec-carrier.rst @@ -15,7 +15,8 @@ LIRC_SET_REC_CARRIER - Set carrier used to modulate IR receive. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *frequency ) +.. c:function:: int ioctl( int fd, LIRC_SET_REC_CARRIER, __u32 *frequency ) + :name: LIRC_SET_REC_CARRIER Arguments ========= @@ -23,9 +24,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_REC_CARRIER - ``frequency`` Frequency of the carrier that modulates PWM data, in Hz. diff --git a/Documentation/media/uapi/rc/lirc-set-rec-timeout-reports.rst b/Documentation/media/uapi/rc/lirc-set-rec-timeout-reports.rst index 676e7698b882..9c501bbf4c62 100644 --- a/Documentation/media/uapi/rc/lirc-set-rec-timeout-reports.rst +++ b/Documentation/media/uapi/rc/lirc-set-rec-timeout-reports.rst @@ -14,7 +14,8 @@ LIRC_SET_REC_TIMEOUT_REPORTS - enable or disable timeout reports for IR receive Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *enable ) +.. c:function:: int ioctl( int fd, LIRC_SET_REC_TIMEOUT_REPORTS, __u32 *enable ) + :name: LIRC_SET_REC_TIMEOUT_REPORTS Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_REC_TIMEOUT_REPORTS - ``enable`` enable = 1 means enable timeout report, enable = 0 means disable timeout reports. diff --git a/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst b/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst index f54026a14c4f..b3e16bbdbc90 100644 --- a/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst +++ b/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst @@ -14,7 +14,8 @@ LIRC_SET_REC_TIMEOUT - sets the integer value for IR inactivity timeout. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *timeout ) +.. c:function:: int ioctl( int fd, LIRC_SET_REC_TIMEOUT, __u32 *timeout ) + :name: LIRC_SET_REC_TIMEOUT Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_REC_TIMEOUT - ``timeout`` Timeout, in microseconds. diff --git a/Documentation/media/uapi/rc/lirc-set-send-carrier.rst b/Documentation/media/uapi/rc/lirc-set-send-carrier.rst index fa4df86d7698..42c8cfb42df5 100644 --- a/Documentation/media/uapi/rc/lirc-set-send-carrier.rst +++ b/Documentation/media/uapi/rc/lirc-set-send-carrier.rst @@ -15,7 +15,8 @@ LIRC_SET_SEND_CARRIER - Set send carrier used to modulate IR TX. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *frequency ) +.. c:function:: int ioctl( int fd, LIRC_SET_SEND_CARRIER, __u32 *frequency ) + :name: LIRC_SET_SEND_CARRIER Arguments ========= @@ -23,9 +24,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_SEND_CARRIER - ``frequency`` Frequency of the carrier to be modulated, in Hz. diff --git a/Documentation/media/uapi/rc/lirc-set-send-duty-cycle.rst b/Documentation/media/uapi/rc/lirc-set-send-duty-cycle.rst index 7a7d2730d727..20d07c2a37a5 100644 --- a/Documentation/media/uapi/rc/lirc-set-send-duty-cycle.rst +++ b/Documentation/media/uapi/rc/lirc-set-send-duty-cycle.rst @@ -15,7 +15,8 @@ IR transmit. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *duty_cycle) +.. c:function:: int ioctl( int fd, LIRC_SET_SEND_DUTY_CYCLE, __u32 *duty_cycle) + :name: LIRC_SET_SEND_DUTY_CYCLE Arguments ========= @@ -23,9 +24,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_SEND_DUTY_CYCLE - ``duty_cycle`` Duty cicle, describing the pulse width in percent (from 1 to 99) of the total cycle. Values 0 and 100 are reserved. diff --git a/Documentation/media/uapi/rc/lirc-set-transmitter-mask.rst b/Documentation/media/uapi/rc/lirc-set-transmitter-mask.rst index 179b835e5b53..69b7ad8c2afb 100644 --- a/Documentation/media/uapi/rc/lirc-set-transmitter-mask.rst +++ b/Documentation/media/uapi/rc/lirc-set-transmitter-mask.rst @@ -14,7 +14,8 @@ LIRC_SET_TRANSMITTER_MASK - Enables send codes on a given set of transmitters Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *mask ) +.. c:function:: int ioctl( int fd, LIRC_SET_TRANSMITTER_MASK, __u32 *mask ) + :name: LIRC_SET_TRANSMITTER_MASK Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_TRANSMITTER_MASK - ``mask`` Mask with channels to enable tx. Channel 0 is the least significant bit. diff --git a/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst b/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst index 4a9101be40aa..0415c6a54f23 100644 --- a/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst +++ b/Documentation/media/uapi/rc/lirc-set-wideband-receiver.rst @@ -14,7 +14,8 @@ LIRC_SET_WIDEBAND_RECEIVER - enable wide band receiver. Synopsis ======== -.. c:function:: int ioctl( int fd, int request, __u32 *enable ) +.. c:function:: int ioctl( int fd, LIRC_SET_WIDEBAND_RECEIVER, __u32 *enable ) + :name: LIRC_SET_WIDEBAND_RECEIVER Arguments ========= @@ -22,9 +23,6 @@ Arguments ``fd`` File descriptor returned by open(). -``request`` - LIRC_SET_WIDEBAND_RECEIVER - ``enable`` enable = 1 means enable wideband receiver, enable = 0 means disable wideband receiver. diff --git a/Documentation/media/uapi/rc/lirc-write.rst b/Documentation/media/uapi/rc/lirc-write.rst index 631d961813d1..3b035c6613b1 100644 --- a/Documentation/media/uapi/rc/lirc-write.rst +++ b/Documentation/media/uapi/rc/lirc-write.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: ssize_t write( int fd, void *buf, size_t count ) - + :name: lirc-write Arguments ========= @@ -30,8 +30,10 @@ Arguments File descriptor returned by ``open()``. ``buf`` -``count`` + Buffer with data to be written +``count`` + Number of bytes at the buffer Description =========== From 5ccbb182d70561a49f84b42169d2dbc39e39aea2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Aug 2016 16:59:55 -0300 Subject: [PATCH 112/591] [media] docs-rst: Convert MC uAPI to use C function references Name all ioctl references and make them match the ioctls that are documented. That will improve the cross-reference index, as it will have all ioctls and syscalls there. While here, improve the documentation to make them to look more like the rest of the document. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/mediactl/media-func-close.rst | 4 ++-- Documentation/media/uapi/mediactl/media-func-ioctl.rst | 4 ++-- Documentation/media/uapi/mediactl/media-func-open.rst | 2 +- Documentation/media/uapi/mediactl/media-ioc-device-info.rst | 6 ++---- .../media/uapi/mediactl/media-ioc-enum-entities.rst | 6 ++---- Documentation/media/uapi/mediactl/media-ioc-enum-links.rst | 6 ++---- Documentation/media/uapi/mediactl/media-ioc-g-topology.rst | 6 ++---- Documentation/media/uapi/mediactl/media-ioc-setup-link.rst | 6 ++---- 8 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Documentation/media/uapi/mediactl/media-func-close.rst b/Documentation/media/uapi/mediactl/media-func-close.rst index c13220c2696e..a8f5203afe4b 100644 --- a/Documentation/media/uapi/mediactl/media-func-close.rst +++ b/Documentation/media/uapi/mediactl/media-func-close.rst @@ -21,13 +21,13 @@ Synopsis .. c:function:: int close( int fd ) - + :name: mc-close Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. + File descriptor returned by :c:func:`open() `. Description diff --git a/Documentation/media/uapi/mediactl/media-func-ioctl.rst b/Documentation/media/uapi/mediactl/media-func-ioctl.rst index 6fa0a8e65af5..fe072b7c8765 100644 --- a/Documentation/media/uapi/mediactl/media-func-ioctl.rst +++ b/Documentation/media/uapi/mediactl/media-func-ioctl.rst @@ -21,13 +21,13 @@ Synopsis .. c:function:: int ioctl( int fd, int request, void *argp ) - + :name: mc-ioctl Arguments ========= ``fd`` - File descriptor returned by :ref:`open() `. + File descriptor returned by :c:func:`open() `. ``request`` Media ioctl request code as defined in the media.h header file, for diff --git a/Documentation/media/uapi/mediactl/media-func-open.rst b/Documentation/media/uapi/mediactl/media-func-open.rst index aa77ba32db21..32f53016a9e5 100644 --- a/Documentation/media/uapi/mediactl/media-func-open.rst +++ b/Documentation/media/uapi/mediactl/media-func-open.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: int open( const char *device_name, int flags ) - + :name: mc-open Arguments ========= diff --git a/Documentation/media/uapi/mediactl/media-ioc-device-info.rst b/Documentation/media/uapi/mediactl/media-ioc-device-info.rst index e8c97abed394..412014110570 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-device-info.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-device-info.rst @@ -15,7 +15,8 @@ MEDIA_IOC_DEVICE_INFO - Query device information Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct media_device_info *argp ) +.. c:function:: int ioctl( int fd, MEDIA_IOC_DEVICE_INFO, struct media_device_info *argp ) + :name: MEDIA_IOC_DEVICE_INFO Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - MEDIA_IOC_DEVICE_INFO - ``argp`` diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst index a621b08187ea..628e91aeda97 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst @@ -15,7 +15,8 @@ MEDIA_IOC_ENUM_ENTITIES - Enumerate entities and their properties Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct media_entity_desc *argp ) +.. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_ENTITIES, struct media_entity_desc *argp ) + :name: MEDIA_IOC_ENUM_ENTITIES Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - MEDIA_IOC_ENUM_ENTITIES - ``argp`` diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst index d07629ba44db..c81765f14b9f 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst @@ -15,7 +15,8 @@ MEDIA_IOC_ENUM_LINKS - Enumerate all pads and links for a given entity Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct media_links_enum *argp ) +.. c:function:: int ioctl( int fd, MEDIA_IOC_ENUM_LINKS, struct media_links_enum *argp ) + :name: MEDIA_IOC_ENUM_LINKS Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - MEDIA_IOC_ENUM_LINKS - ``argp`` diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst index d01a4528cb47..c246df06ff7f 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst @@ -15,7 +15,8 @@ MEDIA_IOC_G_TOPOLOGY - Enumerate the graph topology and graph element properties Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct media_v2_topology *argp ) +.. c:function:: int ioctl( int fd, MEDIA_IOC_G_TOPOLOGY, struct media_v2_topology *argp ) + :name: MEDIA_IOC_G_TOPOLOGY Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - MEDIA_IOC_G_TOPOLOGY - ``argp`` diff --git a/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst b/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst index 10be4c546f33..35a189e19962 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst @@ -15,7 +15,8 @@ MEDIA_IOC_SETUP_LINK - Modify the properties of a link Synopsis ======== -.. c:function:: int ioctl( int fd, int request, struct media_link_desc *argp ) +.. c:function:: int ioctl( int fd, MEDIA_IOC_SETUP_LINK, struct media_link_desc *argp ) + :name: MEDIA_IOC_SETUP_LINK Arguments @@ -24,9 +25,6 @@ Arguments ``fd`` File descriptor returned by :ref:`open() `. -``request`` - MEDIA_IOC_SETUP_LINK - ``argp`` From e61a39baf74dddb6cd236147bd19b55c10188d78 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 21 Aug 2016 15:14:57 -0300 Subject: [PATCH 113/591] [media] index.rst: Fix LaTeX error in interactive mode on Sphinx 1.4.x The Sphinx 1.4.x definition for \DUrole is: \providecommand*{\DUrole}[2]{% \ifcsname DUrole#1\endcsname% \csname DUrole#1\endcsname{#2}% \else% backwards compatibility: try \docutilsrole#1{#2} \ifcsname docutilsrole#1\endcsname% \csname docutilsrole#1\endcsname{#2}% \else% #2% \fi% \fi% } This is broken when it is used inside a \begin{alltt} block. So, replace it by just "#2", as this won't cause troubles, and it is one of the fallback methods for it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/index.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/media/index.rst b/Documentation/media/index.rst index 7f8f0af620ce..e347a3e7bdef 100644 --- a/Documentation/media/index.rst +++ b/Documentation/media/index.rst @@ -1,6 +1,11 @@ Linux Media Subsystem Documentation =================================== +.. Sphinx 1.4.x has a definition for DUrole that doesn't work on alltt blocks +.. raw:: latex + + \renewcommand*{\DUrole}[2]{ #2 } + Contents: .. toctree:: From 859b01cdc03eb83c4b3ec14a89ac132039ad0d43 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Aug 2016 10:49:31 -0300 Subject: [PATCH 114/591] [media] docs-rst: fix some .. note:: occurrences On some places, either an space or the second ':' is missing. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst | 2 +- Documentation/media/uapi/v4l/subdev-formats.rst | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst index 6066f13af5b3..36a221753b37 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst @@ -16,7 +16,7 @@ component of each pixel in one 16 or 32 bit word. \newline\newline\begin{adjustbox}{width=\columnwidth} -.. _yuv-formats: +.. _packed-yuv-formats: .. tabularcolumns:: |p{4.5cm}|p{3.3cm}|p{0.7cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.2cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{0.4cm}|p{1.7cm}| diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 8b1ba4f53b18..52013b55ea80 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -3763,12 +3763,6 @@ the following codes. - d for dummy bits - -.. tabularcolumns:: |p{4.0cm}|p{0.7cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| - -.. _v4l2-mbus-pixelcode-yuv8: - - .. HACK: ideally, we would be using adjustbox here. However, this .. will never work for this table, as, even with tiny font, it is .. to big for a single page. So, we need to manually adjust the @@ -3780,6 +3774,10 @@ the following codes. \tiny \setlength{\tabcolsep}{2pt} +.. tabularcolumns:: |p{4.0cm}|p{0.7cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| + +.. _v4l2-mbus-pixelcode-yuv8: + .. flat-table:: YUV Formats :header-rows: 2 :stub-columns: 0 From 0d1c7d60c287d13cfea27b50f75dbff411544488 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 16 Aug 2016 13:02:40 -0300 Subject: [PATCH 115/591] docs-rst: add media documentation to PDF output Now that the build of PDF output on media got fixed, re-add it to the Sphinx PDF build. Partially reverts 3eb6cd6834c3 ('Documentation: exclude media documentation from pdf generation'). Signed-off-by: Mauro Carvalho Chehab --- Documentation/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/conf.py b/Documentation/conf.py index 46e69dba0e3c..c25e95d46272 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -340,6 +340,8 @@ latex_documents = [ 'The kernel development community', 'manual'), ('gpu/index', 'gpu.tex', 'Linux GPU Driver Developer\'s Guide', 'The kernel development community', 'manual'), + ('media/index', 'media.tex', 'Linux Media Subsystem Documentation', + 'The kernel development community', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of From 7eb95877a09b1ccfa35fb4bb5fe4c3e3ea7ed43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:26 -0300 Subject: [PATCH 116/591] [media] rcar-vin: fix indentation errors in rcar-v4l2.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix broken indentations and line breaks. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 46 ++++++++++----------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 10a5c107e8b9..f26e3cd10cf3 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -93,9 +93,9 @@ static u32 rvin_format_sizeimage(struct v4l2_pix_format *pix) */ static int __rvin_try_format_source(struct rvin_dev *vin, - u32 which, - struct v4l2_pix_format *pix, - struct rvin_source_fmt *source) + u32 which, + struct v4l2_pix_format *pix, + struct rvin_source_fmt *source) { struct v4l2_subdev *sd; struct v4l2_subdev_pad_config *pad_cfg; @@ -133,9 +133,9 @@ cleanup: } static int __rvin_try_format(struct rvin_dev *vin, - u32 which, - struct v4l2_pix_format *pix, - struct rvin_source_fmt *source) + u32 which, + struct v4l2_pix_format *pix, + struct rvin_source_fmt *source) { const struct rvin_video_format *info; u32 rwidth, rheight, walign; @@ -219,7 +219,7 @@ static int rvin_try_fmt_vid_cap(struct file *file, void *priv, struct rvin_source_fmt source; return __rvin_try_format(vin, V4L2_SUBDEV_FORMAT_TRY, &f->fmt.pix, - &source); + &source); } static int rvin_s_fmt_vid_cap(struct file *file, void *priv, @@ -233,7 +233,7 @@ static int rvin_s_fmt_vid_cap(struct file *file, void *priv, return -EBUSY; ret = __rvin_try_format(vin, V4L2_SUBDEV_FORMAT_ACTIVE, &f->fmt.pix, - &source); + &source); if (ret) return ret; @@ -334,8 +334,8 @@ static int rvin_s_selection(struct file *file, void *fh, vin->crop = s->r = r; vin_dbg(vin, "Cropped %dx%d@%d:%d of %dx%d\n", - r.width, r.height, r.left, r.top, - vin->source.width, vin->source.height); + r.width, r.height, r.left, r.top, + vin->source.width, vin->source.height); break; case V4L2_SEL_TGT_COMPOSE: /* Make sure compose rect fits inside output format */ @@ -359,8 +359,8 @@ static int rvin_s_selection(struct file *file, void *fh, vin->compose = s->r = r; vin_dbg(vin, "Compose %dx%d@%d:%d in %dx%d\n", - r.width, r.height, r.left, r.top, - vin->format.width, vin->format.height); + r.width, r.height, r.left, r.top, + vin->format.width, vin->format.height); break; default: return -EINVAL; @@ -483,7 +483,7 @@ static int rvin_subscribe_event(struct v4l2_fh *fh, } static int rvin_enum_dv_timings(struct file *file, void *priv_fh, - struct v4l2_enum_dv_timings *timings) + struct v4l2_enum_dv_timings *timings) { struct rvin_dev *vin = video_drvdata(file); struct v4l2_subdev *sd = vin_to_source(vin); @@ -500,14 +500,13 @@ static int rvin_enum_dv_timings(struct file *file, void *priv_fh, } static int rvin_s_dv_timings(struct file *file, void *priv_fh, - struct v4l2_dv_timings *timings) + struct v4l2_dv_timings *timings) { struct rvin_dev *vin = video_drvdata(file); struct v4l2_subdev *sd = vin_to_source(vin); int err; - err = v4l2_subdev_call(sd, - video, s_dv_timings, timings); + err = v4l2_subdev_call(sd, video, s_dv_timings, timings); if (!err) { vin->source.width = timings->bt.width; vin->source.height = timings->bt.height; @@ -518,27 +517,25 @@ static int rvin_s_dv_timings(struct file *file, void *priv_fh, } static int rvin_g_dv_timings(struct file *file, void *priv_fh, - struct v4l2_dv_timings *timings) + struct v4l2_dv_timings *timings) { struct rvin_dev *vin = video_drvdata(file); struct v4l2_subdev *sd = vin_to_source(vin); - return v4l2_subdev_call(sd, - video, g_dv_timings, timings); + return v4l2_subdev_call(sd, video, g_dv_timings, timings); } static int rvin_query_dv_timings(struct file *file, void *priv_fh, - struct v4l2_dv_timings *timings) + struct v4l2_dv_timings *timings) { struct rvin_dev *vin = video_drvdata(file); struct v4l2_subdev *sd = vin_to_source(vin); - return v4l2_subdev_call(sd, - video, query_dv_timings, timings); + return v4l2_subdev_call(sd, video, query_dv_timings, timings); } static int rvin_dv_timings_cap(struct file *file, void *priv_fh, - struct v4l2_dv_timings_cap *cap) + struct v4l2_dv_timings_cap *cap) { struct rvin_dev *vin = video_drvdata(file); struct v4l2_subdev *sd = vin_to_source(vin); @@ -825,8 +822,7 @@ int rvin_v4l2_probe(struct rvin_dev *vin) vin->src_pad_idx = 0; #if defined(CONFIG_MEDIA_CONTROLLER) for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++) - if (sd->entity.pads[pad_idx].flags - == MEDIA_PAD_FL_SOURCE) + if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SOURCE) break; if (pad_idx >= sd->entity.num_pads) return -EINVAL; From 325527a6e829bf21c658d9756249baaeba876312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:27 -0300 Subject: [PATCH 117/591] [media] rcar-vin: reduce indentation in rvin_s_dv_timings() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align style with the rest of the driver. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index f26e3cd10cf3..72fe6bc7bdce 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -504,16 +504,18 @@ static int rvin_s_dv_timings(struct file *file, void *priv_fh, { struct rvin_dev *vin = video_drvdata(file); struct v4l2_subdev *sd = vin_to_source(vin); - int err; + int ret; - err = v4l2_subdev_call(sd, video, s_dv_timings, timings); - if (!err) { - vin->source.width = timings->bt.width; - vin->source.height = timings->bt.height; - vin->format.width = timings->bt.width; - vin->format.height = timings->bt.height; - } - return err; + ret = v4l2_subdev_call(sd, video, s_dv_timings, timings); + if (ret) + return ret; + + vin->source.width = timings->bt.width; + vin->source.height = timings->bt.height; + vin->format.width = timings->bt.width; + vin->format.height = timings->bt.height; + + return 0; } static int rvin_g_dv_timings(struct file *file, void *priv_fh, From 23eb2c86f5b6c50676b9698a9963ab035e0cb9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:28 -0300 Subject: [PATCH 118/591] [media] rcar-vin: arrange enum chip_id in chronological order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-vin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 31ad39a39937..b92741322dd9 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -30,9 +30,9 @@ #define HW_BUFFER_MASK 0x7f enum chip_id { - RCAR_GEN2, RCAR_H1, RCAR_M1, + RCAR_GEN2, }; /** From 4869ce9d1a53236f61fefdc819765c7a3ccb6e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:29 -0300 Subject: [PATCH 119/591] [media] rcar-vin: rename entity to digital MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Gen3 support is added to the driver more then one possible video source entity will be possible. Knowing that the name entity is a bad one, rename it to digital since it will deal with the digital input source. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-core.c | 46 ++++++++++----------- drivers/media/platform/rcar-vin/rcar-vin.h | 6 +-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 4b2007b73463..a1eb26b2eea0 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -60,7 +60,7 @@ static int rvin_mbus_supported(struct rvin_dev *vin) return false; } -static int rvin_graph_notify_complete(struct v4l2_async_notifier *notifier) +static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier) { struct rvin_dev *vin = notifier_to_vin(notifier); int ret; @@ -79,31 +79,31 @@ static int rvin_graph_notify_complete(struct v4l2_async_notifier *notifier) return rvin_v4l2_probe(vin); } -static void rvin_graph_notify_unbind(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *sd, - struct v4l2_async_subdev *asd) +static void rvin_digital_notify_unbind(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_subdev *asd) { struct rvin_dev *vin = notifier_to_vin(notifier); rvin_v4l2_remove(vin); } -static int rvin_graph_notify_bound(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *subdev, - struct v4l2_async_subdev *asd) +static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_subdev *asd) { struct rvin_dev *vin = notifier_to_vin(notifier); vin_dbg(vin, "subdev %s bound\n", subdev->name); - vin->entity.entity = &subdev->entity; - vin->entity.subdev = subdev; + vin->digital.entity = &subdev->entity; + vin->digital.subdev = subdev; return 0; } -static int rvin_graph_parse(struct rvin_dev *vin, - struct device_node *node) +static int rvin_digital_parse(struct rvin_dev *vin, + struct device_node *node) { struct device_node *remote; struct device_node *ep = NULL; @@ -131,10 +131,10 @@ static int rvin_graph_parse(struct rvin_dev *vin, } /* Remote node to connect */ - if (!vin->entity.node) { - vin->entity.node = remote; - vin->entity.asd.match_type = V4L2_ASYNC_MATCH_OF; - vin->entity.asd.match.of.node = remote; + if (!vin->digital.node) { + vin->digital.node = remote; + vin->digital.asd.match_type = V4L2_ASYNC_MATCH_OF; + vin->digital.asd.match.of.node = remote; ret++; } } @@ -144,13 +144,13 @@ static int rvin_graph_parse(struct rvin_dev *vin, return ret; } -static int rvin_graph_init(struct rvin_dev *vin) +static int rvin_digital_init(struct rvin_dev *vin) { struct v4l2_async_subdev **subdevs = NULL; int ret; /* Parse the graph to extract a list of subdevice DT nodes. */ - ret = rvin_graph_parse(vin, vin->dev->of_node); + ret = rvin_digital_parse(vin, vin->dev->of_node); if (ret < 0) { vin_err(vin, "Graph parsing failed\n"); goto done; @@ -173,13 +173,13 @@ static int rvin_graph_init(struct rvin_dev *vin) goto done; } - subdevs[0] = &vin->entity.asd; + subdevs[0] = &vin->digital.asd; vin->notifier.subdevs = subdevs; vin->notifier.num_subdevs = 1; - vin->notifier.bound = rvin_graph_notify_bound; - vin->notifier.unbind = rvin_graph_notify_unbind; - vin->notifier.complete = rvin_graph_notify_complete; + vin->notifier.bound = rvin_digital_notify_bound; + vin->notifier.unbind = rvin_digital_notify_unbind; + vin->notifier.complete = rvin_digital_notify_complete; ret = v4l2_async_notifier_register(&vin->v4l2_dev, &vin->notifier); if (ret < 0) { @@ -192,7 +192,7 @@ static int rvin_graph_init(struct rvin_dev *vin) done: if (ret < 0) { v4l2_async_notifier_unregister(&vin->notifier); - of_node_put(vin->entity.node); + of_node_put(vin->digital.node); } return ret; @@ -289,7 +289,7 @@ static int rcar_vin_probe(struct platform_device *pdev) if (ret) return ret; - ret = rvin_graph_init(vin); + ret = rvin_digital_init(vin); if (ret < 0) goto error; diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index b92741322dd9..93daa05221f6 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -90,7 +90,7 @@ struct rvin_graph_entity { * @src_pad_idx: source pad index for media controller drivers * @ctrl_handler: V4L2 control handler * @notifier: V4L2 asynchronous subdevs notifier - * @entity: entity in the DT for subdevice + * @digital: entity in the DT for local digital subdevice * * @lock: protects @queue * @queue: vb2 buffers queue @@ -120,7 +120,7 @@ struct rvin_dev { int src_pad_idx; struct v4l2_ctrl_handler ctrl_handler; struct v4l2_async_notifier notifier; - struct rvin_graph_entity entity; + struct rvin_graph_entity digital; struct mutex lock; struct vb2_queue queue; @@ -139,7 +139,7 @@ struct rvin_dev { struct v4l2_rect compose; }; -#define vin_to_source(vin) vin->entity.subdev +#define vin_to_source(vin) vin->digital.subdev /* Debug */ #define vin_dbg(d, fmt, arg...) dev_dbg(d->dev, fmt, ##arg) From fc738177f837742d21707cd773b2c86233e277ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:30 -0300 Subject: [PATCH 120/591] [media] rcar-vin: return correct error from platform_get_irq() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a error from the original driver where the wrong error code is returned if the driver fails to get a IRQ number from platform_get_irq(). Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index a1eb26b2eea0..394113486291 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -282,8 +282,8 @@ static int rcar_vin_probe(struct platform_device *pdev) return PTR_ERR(vin->base); irq = platform_get_irq(pdev, 0); - if (irq <= 0) - return ret; + if (irq < 0) + return irq; ret = rvin_dma_probe(vin, irq); if (ret) From 64663531a487d7ebc6f2545949fc9233cb6b5e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:31 -0300 Subject: [PATCH 121/591] [media] rcar-vin: do not use v4l2_device_call_until_err() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a error from the original driver where v4l2_device_call_until_err() where used for the pad specific v4l2 operation set_fmt. Also fix up the error path from this fix so if there is an error it will be propagated to the caller. The error path label have also been renamed as a result from a nitpicking review comment since we are fixing other issues here. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 72fe6bc7bdce..3f80a0b0bd49 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -114,10 +114,9 @@ static int __rvin_try_format_source(struct rvin_dev *vin, format.pad = vin->src_pad_idx; - ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt, - pad_cfg, &format); - if (ret < 0) - goto cleanup; + ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format); + if (ret < 0 && ret != -ENOIOCTLCMD) + goto done; v4l2_fill_pix_format(pix, &format.format); @@ -127,9 +126,9 @@ static int __rvin_try_format_source(struct rvin_dev *vin, vin_dbg(vin, "Source resolution: %ux%u\n", source->width, source->height); -cleanup: +done: v4l2_subdev_free_pad_config(pad_cfg); - return 0; + return ret; } static int __rvin_try_format(struct rvin_dev *vin, From 2fb5910c03606ecb2797c3dc6577a7cb30da8abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:32 -0300 Subject: [PATCH 122/591] [media] rcar-vin: add dependency on MEDIA_CONTROLLER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is done in preparation for Gen3 support where media controller support will be mandatory for the driver. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/rcar-vin/rcar-v4l2.c | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/Kconfig b/drivers/media/platform/rcar-vin/Kconfig index b2ff2d4e8bb1..111d2a151f6a 100644 --- a/drivers/media/platform/rcar-vin/Kconfig +++ b/drivers/media/platform/rcar-vin/Kconfig @@ -1,6 +1,6 @@ config VIDEO_RCAR_VIN tristate "R-Car Video Input (VIN) Driver" - depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA + depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA && MEDIA_CONTROLLER depends on ARCH_RENESAS || COMPILE_TEST select VIDEOBUF2_DMA_CONTIG ---help--- diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 3f80a0b0bd49..09df3963d32f 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -771,10 +771,7 @@ int rvin_v4l2_probe(struct rvin_dev *vin) struct v4l2_mbus_framefmt *mf = &fmt.format; struct video_device *vdev = &vin->vdev; struct v4l2_subdev *sd = vin_to_source(vin); -#if defined(CONFIG_MEDIA_CONTROLLER) - int pad_idx; -#endif - int ret; + int pad_idx, ret; v4l2_set_subdev_hostdata(sd, vin); @@ -821,7 +818,6 @@ int rvin_v4l2_probe(struct rvin_dev *vin) V4L2_CAP_READWRITE; vin->src_pad_idx = 0; -#if defined(CONFIG_MEDIA_CONTROLLER) for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++) if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SOURCE) break; @@ -829,7 +825,6 @@ int rvin_v4l2_probe(struct rvin_dev *vin) return -EINVAL; vin->src_pad_idx = pad_idx; -#endif fmt.pad = vin->src_pad_idx; /* Try to improve our guess of a reasonable window format */ From ee9e2a525c825a5c9c358d4c8388242b81ba707f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:33 -0300 Subject: [PATCH 123/591] [media] rcar-vin: move chip check for pixelformat support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check for if the specific pixelformat is supported on the current chip should happen in VIDIOC_S_FMT and VIDIOC_TRY_FMT and not when we try to setup the hardware for streaming. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-dma.c | 8 +++----- drivers/media/platform/rcar-vin/rcar-v4l2.c | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 496aa97b6400..3df3f0c70758 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -225,11 +225,9 @@ static int rvin_setup(struct rvin_dev *vin) dmr = 0; break; case V4L2_PIX_FMT_XBGR32: - if (vin->chip == RCAR_GEN2 || vin->chip == RCAR_H1) { - dmr = VNDMR_EXRGB; - break; - } - /* fall through */ + /* Note: not supported on M1 */ + dmr = VNDMR_EXRGB; + break; default: vin_err(vin, "Invalid pixelformat (0x%x)\n", vin->format.pixelformat); diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 09df3963d32f..ef3464d10cfb 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -192,6 +192,11 @@ static int __rvin_try_format(struct rvin_dev *vin, pix->sizeimage = max_t(u32, pix->sizeimage, rvin_format_sizeimage(pix)); + if (vin->chip == RCAR_M1 && pix->pixelformat == V4L2_PIX_FMT_XBGR32) { + vin_err(vin, "pixel format XBGR32 not supported on M1\n"); + return -EINVAL; + } + vin_dbg(vin, "Requested %ux%u Got %ux%u bpl: %d size: %d\n", rwidth, rheight, pix->width, pix->height, pix->bytesperline, pix->sizeimage); From 83fba2c06f19f4a6bff785a91c33a5c4de142e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:34 -0300 Subject: [PATCH 124/591] [media] rcar-vin: rework how subdevice is found and bound MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original drivers code to find a subdevice by looking in the DT grpah and how the callbacks to the v4l2 async bind framework where poorly written. The most obvious example of badness was the duplication of data in the struct rvin_graph_entity. This patch removes the data duplication, simplifies the parsing of the DT graph and add checks to the v4l2 callbacks. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-core.c | 232 +++++++++----------- drivers/media/platform/rcar-vin/rcar-vin.h | 8 +- 2 files changed, 111 insertions(+), 129 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 394113486291..39bf6fc3599d 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -31,15 +31,13 @@ #define notifier_to_vin(n) container_of(n, struct rvin_dev, notifier) -static int rvin_mbus_supported(struct rvin_dev *vin) +static bool rvin_mbus_supported(struct rvin_dev *vin) { - struct v4l2_subdev *sd; + struct v4l2_subdev *sd = vin->digital.subdev; struct v4l2_subdev_mbus_code_enum code = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, }; - sd = vin_to_source(vin); - code.index = 0; while (!v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code)) { code.index++; @@ -49,8 +47,6 @@ static int rvin_mbus_supported(struct rvin_dev *vin) case MEDIA_BUS_FMT_YUYV10_2X10: case MEDIA_BUS_FMT_RGB888_1X24: vin->source.code = code.code; - vin_dbg(vin, "Found supported media bus format: %d\n", - vin->source.code); return true; default: break; @@ -65,17 +61,22 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier) struct rvin_dev *vin = notifier_to_vin(notifier); int ret; + /* Verify subdevices mbus format */ + if (!rvin_mbus_supported(vin)) { + vin_err(vin, "Unsupported media bus format for %s\n", + vin->digital.subdev->name); + return -EINVAL; + } + + vin_dbg(vin, "Found media bus format for %s: %d\n", + vin->digital.subdev->name, vin->source.code); + ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); if (ret < 0) { vin_err(vin, "Failed to register subdev nodes\n"); return ret; } - if (!rvin_mbus_supported(vin)) { - vin_err(vin, "No supported mediabus format found\n"); - return -EINVAL; - } - return rvin_v4l2_probe(vin); } @@ -85,7 +86,14 @@ static void rvin_digital_notify_unbind(struct v4l2_async_notifier *notifier, { struct rvin_dev *vin = notifier_to_vin(notifier); - rvin_v4l2_remove(vin); + if (vin->digital.subdev == subdev) { + vin_dbg(vin, "unbind digital subdev %s\n", subdev->name); + rvin_v4l2_remove(vin); + vin->digital.subdev = NULL; + return; + } + + vin_err(vin, "no entity for subdev %s to unbind\n", subdev->name); } static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, @@ -94,89 +102,111 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, { struct rvin_dev *vin = notifier_to_vin(notifier); - vin_dbg(vin, "subdev %s bound\n", subdev->name); + v4l2_set_subdev_hostdata(subdev, vin); - vin->digital.entity = &subdev->entity; - vin->digital.subdev = subdev; + if (vin->digital.asd.match.of.node == subdev->dev->of_node) { + vin_dbg(vin, "bound digital subdev %s\n", subdev->name); + vin->digital.subdev = subdev; + return 0; + } + + vin_err(vin, "no entity for subdev %s to bind\n", subdev->name); + return -EINVAL; +} + +static int rvin_digitial_parse_v4l2(struct rvin_dev *vin, + struct device_node *ep, + struct v4l2_mbus_config *mbus_cfg) +{ + struct v4l2_of_endpoint v4l2_ep; + int ret; + + ret = v4l2_of_parse_endpoint(ep, &v4l2_ep); + if (ret) { + vin_err(vin, "Could not parse v4l2 endpoint\n"); + return -EINVAL; + } + + mbus_cfg->type = v4l2_ep.bus_type; + + switch (mbus_cfg->type) { + case V4L2_MBUS_PARALLEL: + vin_dbg(vin, "Found PARALLEL media bus\n"); + mbus_cfg->flags = v4l2_ep.bus.parallel.flags; + break; + case V4L2_MBUS_BT656: + vin_dbg(vin, "Found BT656 media bus\n"); + mbus_cfg->flags = 0; + break; + default: + vin_err(vin, "Unknown media bus type\n"); + return -EINVAL; + } return 0; } -static int rvin_digital_parse(struct rvin_dev *vin, - struct device_node *node) +static int rvin_digital_graph_parse(struct rvin_dev *vin) { - struct device_node *remote; - struct device_node *ep = NULL; - struct device_node *next; - int ret = 0; + struct device_node *ep, *np; + int ret; - while (1) { - next = of_graph_get_next_endpoint(node, ep); - if (!next) - break; + vin->digital.asd.match.of.node = NULL; + vin->digital.subdev = NULL; + /* + * Port 0 id 0 is local digital input, try to get it. + * Not all instances can or will have this, that is OK + */ + ep = of_graph_get_endpoint_by_regs(vin->dev->of_node, 0, 0); + if (!ep) + return 0; + + np = of_graph_get_remote_port_parent(ep); + if (!np) { + vin_err(vin, "No remote parent for digital input\n"); of_node_put(ep); - ep = next; - - remote = of_graph_get_remote_port_parent(ep); - if (!remote) { - ret = -EINVAL; - break; - } - - /* Skip entities that we have already processed. */ - if (remote == vin->dev->of_node) { - of_node_put(remote); - continue; - } - - /* Remote node to connect */ - if (!vin->digital.node) { - vin->digital.node = remote; - vin->digital.asd.match_type = V4L2_ASYNC_MATCH_OF; - vin->digital.asd.match.of.node = remote; - ret++; - } + return -EINVAL; } + of_node_put(np); + ret = rvin_digitial_parse_v4l2(vin, ep, &vin->mbus_cfg); of_node_put(ep); + if (ret) + return ret; - return ret; + vin->digital.asd.match.of.node = np; + vin->digital.asd.match_type = V4L2_ASYNC_MATCH_OF; + + return 0; } -static int rvin_digital_init(struct rvin_dev *vin) +static int rvin_digital_graph_init(struct rvin_dev *vin) { struct v4l2_async_subdev **subdevs = NULL; int ret; - /* Parse the graph to extract a list of subdevice DT nodes. */ - ret = rvin_digital_parse(vin, vin->dev->of_node); - if (ret < 0) { - vin_err(vin, "Graph parsing failed\n"); - goto done; - } + ret = rvin_digital_graph_parse(vin); + if (ret) + return ret; - if (!ret) { - vin_err(vin, "No subdev found in graph\n"); - goto done; - } - - if (ret != 1) { - vin_err(vin, "More then one subdev found in graph\n"); - goto done; + if (!vin->digital.asd.match.of.node) { + vin_dbg(vin, "No digital subdevice found\n"); + return -ENODEV; } /* Register the subdevices notifier. */ subdevs = devm_kzalloc(vin->dev, sizeof(*subdevs), GFP_KERNEL); - if (subdevs == NULL) { - ret = -ENOMEM; - goto done; - } + if (subdevs == NULL) + return -ENOMEM; subdevs[0] = &vin->digital.asd; - vin->notifier.subdevs = subdevs; + vin_dbg(vin, "Found digital subdevice %s\n", + of_node_full_name(subdevs[0]->match.of.node)); + vin->notifier.num_subdevs = 1; + vin->notifier.subdevs = subdevs; vin->notifier.bound = rvin_digital_notify_bound; vin->notifier.unbind = rvin_digital_notify_unbind; vin->notifier.complete = rvin_digital_notify_complete; @@ -184,18 +214,10 @@ static int rvin_digital_init(struct rvin_dev *vin) ret = v4l2_async_notifier_register(&vin->v4l2_dev, &vin->notifier); if (ret < 0) { vin_err(vin, "Notifier registration failed\n"); - goto done; + return ret; } - ret = 0; - -done: - if (ret < 0) { - v4l2_async_notifier_unregister(&vin->notifier); - of_node_put(vin->digital.node); - } - - return ret; + return 0; } /* ----------------------------------------------------------------------------- @@ -213,52 +235,9 @@ static const struct of_device_id rvin_of_id_table[] = { }; MODULE_DEVICE_TABLE(of, rvin_of_id_table); -static int rvin_parse_dt(struct rvin_dev *vin) -{ - const struct of_device_id *match; - struct v4l2_of_endpoint ep; - struct device_node *np; - int ret; - - match = of_match_device(of_match_ptr(rvin_of_id_table), vin->dev); - if (!match) - return -ENODEV; - - vin->chip = (enum chip_id)match->data; - - np = of_graph_get_next_endpoint(vin->dev->of_node, NULL); - if (!np) { - vin_err(vin, "Could not find endpoint\n"); - return -EINVAL; - } - - ret = v4l2_of_parse_endpoint(np, &ep); - if (ret) { - vin_err(vin, "Could not parse endpoint\n"); - return ret; - } - - of_node_put(np); - - vin->mbus_cfg.type = ep.bus_type; - - switch (vin->mbus_cfg.type) { - case V4L2_MBUS_PARALLEL: - vin->mbus_cfg.flags = ep.bus.parallel.flags; - break; - case V4L2_MBUS_BT656: - vin->mbus_cfg.flags = 0; - break; - default: - vin_err(vin, "Unknown media bus type\n"); - return -EINVAL; - } - - return 0; -} - static int rcar_vin_probe(struct platform_device *pdev) { + const struct of_device_id *match; struct rvin_dev *vin; struct resource *mem; int irq, ret; @@ -267,11 +246,12 @@ static int rcar_vin_probe(struct platform_device *pdev) if (!vin) return -ENOMEM; - vin->dev = &pdev->dev; + match = of_match_device(of_match_ptr(rvin_of_id_table), &pdev->dev); + if (!match) + return -ENODEV; - ret = rvin_parse_dt(vin); - if (ret) - return ret; + vin->dev = &pdev->dev; + vin->chip = (enum chip_id)match->data; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (mem == NULL) @@ -289,7 +269,7 @@ static int rcar_vin_probe(struct platform_device *pdev) if (ret) return ret; - ret = rvin_digital_init(vin); + ret = rvin_digital_graph_init(vin); if (ret < 0) goto error; diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 93daa05221f6..edfe6581eb8c 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -70,10 +70,12 @@ struct rvin_video_format { u8 bpp; }; +/** + * struct rvin_graph_entity - Video endpoint from async framework + * @asd: sub-device descriptor for async framework + * @subdev: subdevice matched using async framework + */ struct rvin_graph_entity { - struct device_node *node; - struct media_entity *entity; - struct v4l2_async_subdev asd; struct v4l2_subdev *subdev; }; From b50b77e6c9a99ddae5266b21cf6757e91d18ffc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 15 Aug 2016 12:06:35 -0300 Subject: [PATCH 125/591] [media] rcar-vin: move media bus information to struct rvin_graph_entity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The primary reason for this change is to prepare for Gen3 support where there will be more then one possible video source. Each source will have its own media bus format and code, so it needs to be moved from the per device structure to a structure used to represent an individual connection to a video source. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-core.c | 12 ++++++------ drivers/media/platform/rcar-vin/rcar-dma.c | 10 +++++----- drivers/media/platform/rcar-vin/rcar-v4l2.c | 2 +- drivers/media/platform/rcar-vin/rcar-vin.h | 9 +++++---- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 39bf6fc3599d..64999a2fba15 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -31,9 +31,9 @@ #define notifier_to_vin(n) container_of(n, struct rvin_dev, notifier) -static bool rvin_mbus_supported(struct rvin_dev *vin) +static bool rvin_mbus_supported(struct rvin_graph_entity *entity) { - struct v4l2_subdev *sd = vin->digital.subdev; + struct v4l2_subdev *sd = entity->subdev; struct v4l2_subdev_mbus_code_enum code = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, }; @@ -46,7 +46,7 @@ static bool rvin_mbus_supported(struct rvin_dev *vin) case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YUYV10_2X10: case MEDIA_BUS_FMT_RGB888_1X24: - vin->source.code = code.code; + entity->code = code.code; return true; default: break; @@ -62,14 +62,14 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier) int ret; /* Verify subdevices mbus format */ - if (!rvin_mbus_supported(vin)) { + if (!rvin_mbus_supported(&vin->digital)) { vin_err(vin, "Unsupported media bus format for %s\n", vin->digital.subdev->name); return -EINVAL; } vin_dbg(vin, "Found media bus format for %s: %d\n", - vin->digital.subdev->name, vin->source.code); + vin->digital.subdev->name, vin->digital.code); ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); if (ret < 0) { @@ -170,7 +170,7 @@ static int rvin_digital_graph_parse(struct rvin_dev *vin) } of_node_put(np); - ret = rvin_digitial_parse_v4l2(vin, ep, &vin->mbus_cfg); + ret = rvin_digitial_parse_v4l2(vin, ep, &vin->digital.mbus_cfg); of_node_put(ep); if (ret) return ret; diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 3df3f0c70758..46abdb0ea663 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -163,7 +163,7 @@ static int rvin_setup(struct rvin_dev *vin) /* * Input interface */ - switch (vin->source.code) { + switch (vin->digital.code) { case MEDIA_BUS_FMT_YUYV8_1X16: /* BT.601/BT.1358 16bit YCbCr422 */ vnmc |= VNMC_INF_YUV16; @@ -171,7 +171,7 @@ static int rvin_setup(struct rvin_dev *vin) break; case MEDIA_BUS_FMT_YUYV8_2X8: /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */ - vnmc |= vin->mbus_cfg.type == V4L2_MBUS_BT656 ? + vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ? VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601; input_is_yuv = true; break; @@ -180,7 +180,7 @@ static int rvin_setup(struct rvin_dev *vin) break; case MEDIA_BUS_FMT_YUYV10_2X10: /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */ - vnmc |= vin->mbus_cfg.type == V4L2_MBUS_BT656 ? + vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ? VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601; input_is_yuv = true; break; @@ -192,11 +192,11 @@ static int rvin_setup(struct rvin_dev *vin) dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1); /* Hsync Signal Polarity Select */ - if (!(vin->mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) + if (!(vin->digital.mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) dmr2 |= VNDMR2_HPS; /* Vsync Signal Polarity Select */ - if (!(vin->mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) + if (!(vin->digital.mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) dmr2 |= VNDMR2_VPS; /* diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index ef3464d10cfb..d0e9d65b9cf3 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -106,7 +106,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin, sd = vin_to_source(vin); - v4l2_fill_mbus_format(&format.format, pix, vin->source.code); + v4l2_fill_mbus_format(&format.format, pix, vin->digital.code); pad_cfg = v4l2_subdev_alloc_pad_config(sd); if (pad_cfg == NULL) diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index edfe6581eb8c..793184d26c17 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -50,12 +50,10 @@ enum rvin_dma_state { /** * struct rvin_source_fmt - Source information - * @code: Media bus format from source * @width: Width from source * @height: Height from source */ struct rvin_source_fmt { - u32 code; u32 width; u32 height; }; @@ -74,10 +72,15 @@ struct rvin_video_format { * struct rvin_graph_entity - Video endpoint from async framework * @asd: sub-device descriptor for async framework * @subdev: subdevice matched using async framework + * @code: Media bus format from source + * @mbus_cfg: Media bus format from DT */ struct rvin_graph_entity { struct v4l2_async_subdev asd; struct v4l2_subdev *subdev; + + u32 code; + struct v4l2_mbus_config mbus_cfg; }; /** @@ -85,7 +88,6 @@ struct rvin_graph_entity { * @dev: (OF) device * @base: device I/O register space remapped to virtual memory * @chip: type of VIN chip - * @mbus_cfg media bus configuration * * @vdev: V4L2 video device associated with VIN * @v4l2_dev: V4L2 device @@ -115,7 +117,6 @@ struct rvin_dev { struct device *dev; void __iomem *base; enum chip_id chip; - struct v4l2_mbus_config mbus_cfg; struct video_device vdev; struct v4l2_device v4l2_dev; From aaf578e12e06160792ae5dd71dee3b074e0f9475 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:29 -0300 Subject: [PATCH 126/591] [media] Input: atmel_mxt_ts - update MAINTAINERS email address I'm leaving ITDev, so change to my personal email. My understanding is that someone at Atmel will take this on once their takeover by Microchip has settled down. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- MAINTAINERS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7e09a5169a5f..6c33d29f79b0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2211,9 +2211,9 @@ S: Maintained F: drivers/net/wireless/atmel/atmel* ATMEL MAXTOUCH DRIVER -M: Nick Dyer -T: git git://github.com/atmel-maxtouch/linux.git -S: Supported +M: Nick Dyer +T: git git://github.com/ndyer/linux.git +S: Maintained F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt F: drivers/input/touchscreen/atmel_mxt_ts.c F: include/linux/platform_data/atmel_mxt_ts.h From b2fe22d0cf64708c50c26f11b3da8b79809c699b Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:30 -0300 Subject: [PATCH 127/591] [media] v4l2-core: Add support for touch devices Some touch controllers send out touch data in a similar way to a greyscale frame grabber. Add new device type VFL_TYPE_TOUCH: - This uses a new device prefix v4l-touch for these devices, to stop generic capture software from treating them as webcams. Otherwise, touch is treated similarly to video capture. - Add V4L2_INPUT_TYPE_TOUCH - Add MEDIA_INTF_T_V4L_TOUCH - Add V4L2_CAP_TOUCH to indicate device is a touch device Add formats: - V4L2_TCH_FMT_DELTA_TD16 for signed 16-bit touch deltas - V4L2_TCH_FMT_DELTA_TD08 for signed 16-bit touch deltas - V4L2_TCH_FMT_TU16 for unsigned 16-bit touch data - V4L2_TCH_FMT_TU08 for unsigned 8-bit touch data This support will be used by: - Atmel maXTouch (atmel_mxt_ts) - Synaptics RMI4. - sur40 Signed-off-by: Nick Dyer Tested-by: Chris Healy Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- Documentation/media/kapi/v4l2-dev.rst | 1 + drivers/media/media-entity.c | 2 ++ drivers/media/v4l2-core/v4l2-dev.c | 14 ++++++++--- drivers/media/v4l2-core/v4l2-ioctl.c | 36 +++++++++++++++++++++++---- include/media/v4l2-dev.h | 4 ++- include/uapi/linux/media.h | 1 + include/uapi/linux/videodev2.h | 9 +++++++ 7 files changed, 58 insertions(+), 9 deletions(-) diff --git a/Documentation/media/kapi/v4l2-dev.rst b/Documentation/media/kapi/v4l2-dev.rst index d07258a362d1..5782be725334 100644 --- a/Documentation/media/kapi/v4l2-dev.rst +++ b/Documentation/media/kapi/v4l2-dev.rst @@ -200,6 +200,7 @@ types exist: - ``VFL_TYPE_VBI``: ``/dev/vbiX`` for vertical blank data (i.e. closed captions, teletext) - ``VFL_TYPE_RADIO``: ``/dev/radioX`` for radio tuners - ``VFL_TYPE_SDR``: ``/dev/swradioX`` for Software Defined Radio tuners +- ``VFL_TYPE_TOUCH``: ``/dev/v4l-touchX`` for touch sensors The last argument gives you a certain amount of control over the device device node number used (i.e. the X in ``videoX``). Normally you will pass -1 diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index d8a2299f0c2a..9014362e904d 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -65,6 +65,8 @@ static inline const char *intf_type(struct media_interface *intf) return "v4l-subdev"; case MEDIA_INTF_T_V4L_SWRADIO: return "v4l-swradio"; + case MEDIA_INTF_T_V4L_TOUCH: + return "v4l-touch"; case MEDIA_INTF_T_ALSA_PCM_CAPTURE: return "alsa-pcm-capture"; case MEDIA_INTF_T_ALSA_PCM_PLAYBACK: diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index e6da353b39bc..8be561ab2615 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -527,6 +527,7 @@ static void determine_valid_ioctls(struct video_device *vdev) bool is_vbi = vdev->vfl_type == VFL_TYPE_VBI; bool is_radio = vdev->vfl_type == VFL_TYPE_RADIO; bool is_sdr = vdev->vfl_type == VFL_TYPE_SDR; + bool is_tch = vdev->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vdev->vfl_dir != VFL_DIR_TX; bool is_tx = vdev->vfl_dir != VFL_DIR_RX; @@ -573,7 +574,7 @@ static void determine_valid_ioctls(struct video_device *vdev) if (ops->vidioc_enum_freq_bands || ops->vidioc_g_tuner || ops->vidioc_g_modulator) set_bit(_IOC_NR(VIDIOC_ENUM_FREQ_BANDS), valid_ioctls); - if (is_vid) { + if (is_vid || is_tch) { /* video specific ioctls */ if ((is_rx && (ops->vidioc_enum_fmt_vid_cap || ops->vidioc_enum_fmt_vid_cap_mplane || @@ -662,7 +663,7 @@ static void determine_valid_ioctls(struct video_device *vdev) set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls); } - if (is_vid || is_vbi || is_sdr) { + if (is_vid || is_vbi || is_sdr || is_tch) { /* ioctls valid for video, vbi or sdr */ SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs); SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf); @@ -675,7 +676,7 @@ static void determine_valid_ioctls(struct video_device *vdev) SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff); } - if (is_vid || is_vbi) { + if (is_vid || is_vbi || is_tch) { /* ioctls valid for video or vbi */ if (ops->vidioc_s_std) set_bit(_IOC_NR(VIDIOC_ENUMSTD), valid_ioctls); @@ -751,6 +752,10 @@ static int video_register_media_controller(struct video_device *vdev, int type) intf_type = MEDIA_INTF_T_V4L_SWRADIO; vdev->entity.function = MEDIA_ENT_F_IO_SWRADIO; break; + case VFL_TYPE_TOUCH: + intf_type = MEDIA_INTF_T_V4L_TOUCH; + vdev->entity.function = MEDIA_ENT_F_IO_V4L; + break; case VFL_TYPE_RADIO: intf_type = MEDIA_INTF_T_V4L_RADIO; /* @@ -854,6 +859,9 @@ int __video_register_device(struct video_device *vdev, int type, int nr, /* Use device name 'swradio' because 'sdr' was already taken. */ name_base = "swradio"; break; + case VFL_TYPE_TOUCH: + name_base = "v4l-touch"; + break; default: printk(KERN_ERR "%s called with unknown type: %d\n", __func__, type); diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 51a0fa144392..eb6ccc70e9a8 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -924,6 +924,7 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type) bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_vbi = vfd->vfl_type == VFL_TYPE_VBI; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; @@ -932,7 +933,7 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type) switch (type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (is_vid && is_rx && + if ((is_vid || is_tch) && is_rx && (ops->vidioc_g_fmt_vid_cap || ops->vidioc_g_fmt_vid_cap_mplane)) return 0; break; @@ -1243,6 +1244,10 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; + case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; + case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; + case V4L2_TCH_FMT_TU08: descr = "8-bit unsigned touch data"; break; default: /* Compressed formats */ @@ -1309,13 +1314,14 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file); bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; int ret = -EINVAL; switch (p->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (unlikely(!is_rx || !is_vid || !ops->vidioc_enum_fmt_vid_cap)) + if (unlikely(!is_rx || (!is_vid && !is_tch) || !ops->vidioc_enum_fmt_vid_cap)) break; ret = ops->vidioc_enum_fmt_vid_cap(file, fh, arg); break; @@ -1362,6 +1368,7 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file); bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; int ret; @@ -1392,7 +1399,7 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, switch (p->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (unlikely(!is_rx || !is_vid || !ops->vidioc_g_fmt_vid_cap)) + if (unlikely(!is_rx || (!is_vid && !is_tch) || !ops->vidioc_g_fmt_vid_cap)) break; p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; ret = ops->vidioc_g_fmt_vid_cap(file, fh, arg); @@ -1451,6 +1458,21 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, return -EINVAL; } +static void v4l_pix_format_touch(struct v4l2_pix_format *p) +{ + /* + * The v4l2_pix_format structure contains fields that make no sense for + * touch. Set them to default values in this case. + */ + + p->field = V4L2_FIELD_NONE; + p->colorspace = V4L2_COLORSPACE_RAW; + p->flags = 0; + p->ycbcr_enc = 0; + p->quantization = 0; + p->xfer_func = 0; +} + static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { @@ -1458,6 +1480,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file); bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; int ret; @@ -1469,12 +1492,14 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, switch (p->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (unlikely(!is_rx || !is_vid || !ops->vidioc_s_fmt_vid_cap)) + if (unlikely(!is_rx || (!is_vid && !is_tch) || !ops->vidioc_s_fmt_vid_cap)) break; CLEAR_AFTER_FIELD(p, fmt.pix); ret = ops->vidioc_s_fmt_vid_cap(file, fh, arg); /* just in case the driver zeroed it again */ p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC; + if (is_tch) + v4l_pix_format_touch(&p->fmt.pix); return ret; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: if (unlikely(!is_rx || !is_vid || !ops->vidioc_s_fmt_vid_cap_mplane)) @@ -1545,6 +1570,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file); bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER; bool is_sdr = vfd->vfl_type == VFL_TYPE_SDR; + bool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH; bool is_rx = vfd->vfl_dir != VFL_DIR_TX; bool is_tx = vfd->vfl_dir != VFL_DIR_RX; int ret; @@ -1553,7 +1579,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, switch (p->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (unlikely(!is_rx || !is_vid || !ops->vidioc_try_fmt_vid_cap)) + if (unlikely(!is_rx || (!is_vid && !is_tch) || !ops->vidioc_try_fmt_vid_cap)) break; CLEAR_AFTER_FIELD(p, fmt.pix); ret = ops->vidioc_try_fmt_vid_cap(file, fh, arg); diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index a122b1bd40f9..5272aeec0cec 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -25,7 +25,8 @@ #define VFL_TYPE_RADIO 2 #define VFL_TYPE_SUBDEV 3 #define VFL_TYPE_SDR 4 -#define VFL_TYPE_MAX 5 +#define VFL_TYPE_TOUCH 5 +#define VFL_TYPE_MAX 6 /* Is this a receiver, transmitter or mem-to-mem? */ /* Ignored for VFL_TYPE_SUBDEV. */ @@ -294,6 +295,7 @@ struct video_device * - %VFL_TYPE_RADIO - A radio card * - %VFL_TYPE_SUBDEV - A subdevice * - %VFL_TYPE_SDR - Software Defined Radio + * - %VFL_TYPE_TOUCH - A touch sensor * * .. note:: * diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 7acf0f634f70..4890787731b8 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -307,6 +307,7 @@ struct media_links_enum { #define MEDIA_INTF_T_V4L_RADIO (MEDIA_INTF_T_V4L_BASE + 2) #define MEDIA_INTF_T_V4L_SUBDEV (MEDIA_INTF_T_V4L_BASE + 3) #define MEDIA_INTF_T_V4L_SWRADIO (MEDIA_INTF_T_V4L_BASE + 4) +#define MEDIA_INTF_T_V4L_TOUCH (MEDIA_INTF_T_V4L_BASE + 5) #define MEDIA_INTF_T_ALSA_PCM_CAPTURE (MEDIA_INTF_T_ALSA_BASE) #define MEDIA_INTF_T_ALSA_PCM_PLAYBACK (MEDIA_INTF_T_ALSA_BASE + 1) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 724f43e69d03..22bad8c741fe 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -440,6 +440,8 @@ struct v4l2_capability { #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ +#define V4L2_CAP_TOUCH 0x10000000 /* Is a touch device */ + #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ /* @@ -635,6 +637,12 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +/* Touch formats - used for Touch devices */ +#define V4L2_TCH_FMT_DELTA_TD16 v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ +#define V4L2_TCH_FMT_DELTA_TD08 v4l2_fourcc('T', 'D', '0', '8') /* 8-bit signed deltas */ +#define V4L2_TCH_FMT_TU16 v4l2_fourcc('T', 'U', '1', '6') /* 16-bit unsigned touch data */ +#define V4L2_TCH_FMT_TU08 v4l2_fourcc('T', 'U', '0', '8') /* 8-bit unsigned touch data */ + /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe @@ -1401,6 +1409,7 @@ struct v4l2_input { /* Values for the 'type' field */ #define V4L2_INPUT_TYPE_TUNER 1 #define V4L2_INPUT_TYPE_CAMERA 2 +#define V4L2_INPUT_TYPE_TOUCH 3 /* field 'status' - general */ #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ From d6a39404984094c5e20e1d17a91036ac6b125731 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:31 -0300 Subject: [PATCH 128/591] [media] Input: atmel_mxt_ts - add support for T37 diagnostic data Atmel maXTouch devices have a T37 object which can be used to read raw touch deltas from the device. This consists of an array of 16-bit integers, one for each node on the touchscreen matrix. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/Kconfig | 6 + drivers/input/touchscreen/atmel_mxt_ts.c | 159 +++++++++++++++++++++++ 2 files changed, 165 insertions(+) diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 2fb1f430a431..f0eef41e49e5 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -115,6 +115,12 @@ config TOUCHSCREEN_ATMEL_MXT To compile this driver as a module, choose M here: the module will be called atmel_mxt_ts. +config TOUCHSCREEN_ATMEL_MXT_T37 + bool "Support T37 Diagnostic Data" + depends on TOUCHSCREEN_ATMEL_MXT + help + Say Y here if you want support for the T37 Diagnostic Data object. + config TOUCHSCREEN_AUO_PIXCIR tristate "AUO in-cell touchscreen using Pixcir ICs" depends on I2C diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 5af7907d0af4..0048233255f2 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -124,6 +124,19 @@ struct t9_range { #define MXT_COMMS_CTRL 0 #define MXT_COMMS_CMD 1 +/* MXT_DEBUG_DIAGNOSTIC_T37 */ +#define MXT_DIAGNOSTIC_PAGEUP 0x01 +#define MXT_DIAGNOSTIC_DELTAS 0x10 +#define MXT_DIAGNOSTIC_SIZE 128 + +struct t37_debug { +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 + u8 mode; + u8 page; + u8 data[MXT_DIAGNOSTIC_SIZE]; +#endif +}; + /* Define for MXT_GEN_COMMAND_T6 */ #define MXT_BOOT_VALUE 0xa5 #define MXT_RESET_VALUE 0x01 @@ -205,6 +218,14 @@ struct mxt_object { u8 num_report_ids; } __packed; +struct mxt_dbg { + u16 t37_address; + u16 diag_cmd_address; + struct t37_debug *t37_buf; + unsigned int t37_pages; + unsigned int t37_nodes; +}; + /* Each client has this additional data */ struct mxt_data { struct i2c_client *client; @@ -233,6 +254,7 @@ struct mxt_data { u8 num_touchids; u8 multitouch; struct t7_config t7_cfg; + struct mxt_dbg dbg; /* Cached parameters from object table */ u16 T5_address; @@ -2043,6 +2065,141 @@ recheck: return 0; } +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 +static u16 mxt_get_debug_value(struct mxt_data *data, unsigned int x, + unsigned int y) +{ + struct mxt_dbg *dbg = &data->dbg; + unsigned int ofs, page; + + ofs = (y + (x * data->info.matrix_ysize)) * sizeof(u16); + page = ofs / MXT_DIAGNOSTIC_SIZE; + ofs %= MXT_DIAGNOSTIC_SIZE; + + return get_unaligned_le16(&dbg->t37_buf[page].data[ofs]); +} + +static int mxt_convert_debug_pages(struct mxt_data *data, u16 *outbuf) +{ + struct mxt_dbg *dbg = &data->dbg; + unsigned int x = 0; + unsigned int y = 0; + unsigned int i; + + for (i = 0; i < dbg->t37_nodes; i++) { + outbuf[i] = mxt_get_debug_value(data, x, y); + + /* Next value */ + if (++x >= data->info.matrix_xsize) { + x = 0; + y++; + } + } + + return 0; +} + +static int mxt_read_diagnostic_debug(struct mxt_data *data, u8 mode, + u16 *outbuf) +{ + struct mxt_dbg *dbg = &data->dbg; + int retries = 0; + int page; + int ret; + u8 cmd = mode; + struct t37_debug *p; + u8 cmd_poll; + + for (page = 0; page < dbg->t37_pages; page++) { + p = dbg->t37_buf + page; + + ret = mxt_write_reg(data->client, dbg->diag_cmd_address, + cmd); + if (ret) + return ret; + + retries = 0; + msleep(20); +wait_cmd: + /* Read back command byte */ + ret = __mxt_read_reg(data->client, dbg->diag_cmd_address, + sizeof(cmd_poll), &cmd_poll); + if (ret) + return ret; + + /* Field is cleared once the command has been processed */ + if (cmd_poll) { + if (retries++ > 100) + return -EINVAL; + + msleep(20); + goto wait_cmd; + } + + /* Read T37 page */ + ret = __mxt_read_reg(data->client, dbg->t37_address, + sizeof(struct t37_debug), p); + if (ret) + return ret; + + if (p->mode != mode || p->page != page) { + dev_err(&data->client->dev, "T37 page mismatch\n"); + return -EINVAL; + } + + dev_dbg(&data->client->dev, "%s page:%d retries:%d\n", + __func__, page, retries); + + /* For remaining pages, write PAGEUP rather than mode */ + cmd = MXT_DIAGNOSTIC_PAGEUP; + } + + return mxt_convert_debug_pages(data, outbuf); +} + +static void mxt_debug_init(struct mxt_data *data) +{ + struct mxt_dbg *dbg = &data->dbg; + struct mxt_object *object; + + object = mxt_get_object(data, MXT_GEN_COMMAND_T6); + if (!object) + goto error; + + dbg->diag_cmd_address = object->start_address + MXT_COMMAND_DIAGNOSTIC; + + object = mxt_get_object(data, MXT_DEBUG_DIAGNOSTIC_T37); + if (!object) + goto error; + + if (mxt_obj_size(object) != sizeof(struct t37_debug)) { + dev_warn(&data->client->dev, "Bad T37 size"); + goto error; + } + + dbg->t37_address = object->start_address; + + /* Calculate size of data and allocate buffer */ + dbg->t37_nodes = data->info.matrix_xsize * data->info.matrix_ysize; + dbg->t37_pages = DIV_ROUND_UP(dbg->t37_nodes * sizeof(u16), + sizeof(dbg->t37_buf->data)); + + dbg->t37_buf = devm_kmalloc_array(&data->client->dev, dbg->t37_pages, + sizeof(struct t37_debug), GFP_KERNEL); + if (!dbg->t37_buf) + goto error; + + return; + +error: + dev_warn(&data->client->dev, "Error initializing T37\n"); +} +#else +static void mxt_debug_init(struct mxt_data *data) +{ +} +#endif + static int mxt_configure_objects(struct mxt_data *data, const struct firmware *cfg) { @@ -2070,6 +2227,8 @@ static int mxt_configure_objects(struct mxt_data *data, dev_warn(dev, "No touch object detected\n"); } + mxt_debug_init(data); + dev_info(dev, "Family: %u Variant: %u Firmware V%u.%u.%02X Objects: %u\n", info->family_id, info->variant_id, info->version >> 4, From ecfdd7e2660e5208072d3afaed8c3e05a643b64f Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:32 -0300 Subject: [PATCH 129/591] [media] Input: atmel_mxt_ts - output diagnostic debug via V4L2 device Register a video device to output T37 diagnostic data. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/Kconfig | 6 +- drivers/input/touchscreen/atmel_mxt_ts.c | 245 +++++++++++++++++++++++ 2 files changed, 249 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index f0eef41e49e5..754e6aa0851d 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -117,9 +117,11 @@ config TOUCHSCREEN_ATMEL_MXT config TOUCHSCREEN_ATMEL_MXT_T37 bool "Support T37 Diagnostic Data" - depends on TOUCHSCREEN_ATMEL_MXT + depends on TOUCHSCREEN_ATMEL_MXT && VIDEO_V4L2 + select VIDEOBUF2_VMALLOC help - Say Y here if you want support for the T37 Diagnostic Data object. + Say Y here if you want support to output data from the T37 + Diagnostic Data object using a V4L device. config TOUCHSCREEN_AUO_PIXCIR tristate "AUO in-cell touchscreen using Pixcir ICs" diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 0048233255f2..a9f987b59f9a 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -28,6 +28,10 @@ #include #include #include +#include +#include +#include +#include /* Firmware files */ #define MXT_FW_NAME "maxtouch.fw" @@ -224,6 +228,23 @@ struct mxt_dbg { struct t37_debug *t37_buf; unsigned int t37_pages; unsigned int t37_nodes; + + struct v4l2_device v4l2; + struct v4l2_pix_format format; + struct video_device vdev; + struct vb2_queue queue; + struct mutex lock; + int input; +}; + +static const struct v4l2_file_operations mxt_video_fops = { + .owner = THIS_MODULE, + .open = v4l2_fh_open, + .release = vb2_fop_release, + .unlocked_ioctl = video_ioctl2, + .read = vb2_fop_read, + .mmap = vb2_fop_mmap, + .poll = vb2_fop_poll, }; /* Each client has this additional data */ @@ -279,6 +300,11 @@ struct mxt_data { struct completion crc_completion; }; +struct mxt_vb2_buffer { + struct vb2_buffer vb; + struct list_head list; +}; + static size_t mxt_obj_size(const struct mxt_object *obj) { return obj->size_minus_one + 1; @@ -1525,6 +1551,11 @@ static void mxt_free_input_device(struct mxt_data *data) static void mxt_free_object_table(struct mxt_data *data) { +#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 + video_unregister_device(&data->dbg.vdev); + v4l2_device_unregister(&data->dbg.v4l2); +#endif + kfree(data->object_table); data->object_table = NULL; kfree(data->msg_buf); @@ -2157,10 +2188,191 @@ wait_cmd: return mxt_convert_debug_pages(data, outbuf); } +static int mxt_queue_setup(struct vb2_queue *q, + unsigned int *nbuffers, unsigned int *nplanes, + unsigned int sizes[], struct device *alloc_devs[]) +{ + struct mxt_data *data = q->drv_priv; + size_t size = data->dbg.t37_nodes * sizeof(u16); + + if (*nplanes) + return sizes[0] < size ? -EINVAL : 0; + + *nplanes = 1; + sizes[0] = size; + + return 0; +} + +static void mxt_buffer_queue(struct vb2_buffer *vb) +{ + struct mxt_data *data = vb2_get_drv_priv(vb->vb2_queue); + u16 *ptr; + int ret; + + ptr = vb2_plane_vaddr(vb, 0); + if (!ptr) { + dev_err(&data->client->dev, "Error acquiring frame ptr\n"); + goto fault; + } + + ret = mxt_read_diagnostic_debug(data, MXT_DIAGNOSTIC_DELTAS, ptr); + if (ret) + goto fault; + + vb2_set_plane_payload(vb, 0, data->dbg.t37_nodes * sizeof(u16)); + vb2_buffer_done(vb, VB2_BUF_STATE_DONE); + return; + +fault: + vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); +} + +/* V4L2 structures */ +static const struct vb2_ops mxt_queue_ops = { + .queue_setup = mxt_queue_setup, + .buf_queue = mxt_buffer_queue, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, +}; + +static const struct vb2_queue mxt_queue = { + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, + .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ, + .buf_struct_size = sizeof(struct mxt_vb2_buffer), + .ops = &mxt_queue_ops, + .mem_ops = &vb2_vmalloc_memops, + .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, + .min_buffers_needed = 1, +}; + +static int mxt_vidioc_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + struct mxt_data *data = video_drvdata(file); + + strlcpy(cap->driver, "atmel_mxt_ts", sizeof(cap->driver)); + strlcpy(cap->card, "atmel_mxt_ts touch", sizeof(cap->card)); + snprintf(cap->bus_info, sizeof(cap->bus_info), + "I2C:%s", dev_name(&data->client->dev)); + return 0; +} + +static int mxt_vidioc_enum_input(struct file *file, void *priv, + struct v4l2_input *i) +{ + if (i->index > 0) + return -EINVAL; + + i->type = V4L2_INPUT_TYPE_TOUCH; + strlcpy(i->name, "Mutual Capacitance Deltas", sizeof(i->name)); + return 0; +} + +static int mxt_set_input(struct mxt_data *data, unsigned int i) +{ + struct v4l2_pix_format *f = &data->dbg.format; + + if (i > 0) + return -EINVAL; + + f->width = data->info.matrix_xsize; + f->height = data->info.matrix_ysize; + f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + f->field = V4L2_FIELD_NONE; + f->colorspace = V4L2_COLORSPACE_RAW; + f->bytesperline = f->width * sizeof(u16); + f->sizeimage = f->width * f->height * sizeof(u16); + + data->dbg.input = i; + + return 0; +} + +static int mxt_vidioc_s_input(struct file *file, void *priv, unsigned int i) +{ + return mxt_set_input(video_drvdata(file), i); +} + +static int mxt_vidioc_g_input(struct file *file, void *priv, unsigned int *i) +{ + struct mxt_data *data = video_drvdata(file); + + *i = data->dbg.input; + + return 0; +} + +static int mxt_vidioc_fmt(struct file *file, void *priv, struct v4l2_format *f) +{ + struct mxt_data *data = video_drvdata(file); + + f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + f->fmt.pix = data->dbg.format; + + return 0; +} + +static int mxt_vidioc_enum_fmt(struct file *file, void *priv, + struct v4l2_fmtdesc *fmt) +{ + if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + return 0; +} + +static int mxt_vidioc_g_parm(struct file *file, void *fh, + struct v4l2_streamparm *a) +{ + if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + a->parm.capture.readbuffers = 1; + a->parm.capture.timeperframe.numerator = 1; + a->parm.capture.timeperframe.denominator = 10; + return 0; +} + +static const struct v4l2_ioctl_ops mxt_video_ioctl_ops = { + .vidioc_querycap = mxt_vidioc_querycap, + + .vidioc_enum_fmt_vid_cap = mxt_vidioc_enum_fmt, + .vidioc_s_fmt_vid_cap = mxt_vidioc_fmt, + .vidioc_g_fmt_vid_cap = mxt_vidioc_fmt, + .vidioc_try_fmt_vid_cap = mxt_vidioc_fmt, + .vidioc_g_parm = mxt_vidioc_g_parm, + + .vidioc_enum_input = mxt_vidioc_enum_input, + .vidioc_g_input = mxt_vidioc_g_input, + .vidioc_s_input = mxt_vidioc_s_input, + + .vidioc_reqbufs = vb2_ioctl_reqbufs, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_expbuf = vb2_ioctl_expbuf, + + .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamoff = vb2_ioctl_streamoff, +}; + +static const struct video_device mxt_video_device = { + .name = "Atmel maxTouch", + .fops = &mxt_video_fops, + .ioctl_ops = &mxt_video_ioctl_ops, + .release = video_device_release_empty, + .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TOUCH | + V4L2_CAP_READWRITE | V4L2_CAP_STREAMING, +}; + static void mxt_debug_init(struct mxt_data *data) { struct mxt_dbg *dbg = &data->dbg; struct mxt_object *object; + int error; object = mxt_get_object(data, MXT_GEN_COMMAND_T6); if (!object) @@ -2189,8 +2401,41 @@ static void mxt_debug_init(struct mxt_data *data) if (!dbg->t37_buf) goto error; + /* init channel to zero */ + mxt_set_input(data, 0); + + /* register video device */ + snprintf(dbg->v4l2.name, sizeof(dbg->v4l2.name), "%s", "atmel_mxt_ts"); + error = v4l2_device_register(&data->client->dev, &dbg->v4l2); + if (error) + goto error; + + /* initialize the queue */ + mutex_init(&dbg->lock); + dbg->queue = mxt_queue; + dbg->queue.drv_priv = data; + dbg->queue.lock = &dbg->lock; + dbg->queue.dev = &data->client->dev; + + error = vb2_queue_init(&dbg->queue); + if (error) + goto error_unreg_v4l2; + + dbg->vdev = mxt_video_device; + dbg->vdev.v4l2_dev = &dbg->v4l2; + dbg->vdev.lock = &dbg->lock; + dbg->vdev.vfl_dir = VFL_DIR_RX; + dbg->vdev.queue = &dbg->queue; + video_set_drvdata(&dbg->vdev, data); + + error = video_register_device(&dbg->vdev, VFL_TYPE_TOUCH, -1); + if (error) + goto error_unreg_v4l2; + return; +error_unreg_v4l2: + v4l2_device_unregister(&dbg->v4l2); error: dev_warn(&data->client->dev, "Error initializing T37\n"); } From 2786489f324e8384a814793d88c3a76d1973f422 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:33 -0300 Subject: [PATCH 130/591] [media] Input: atmel_mxt_ts - read touchscreen size The touchscreen may have a margin where not all the matrix is used. Read the parameters from T9 and T100 and take account of the difference. Note: this does not read the XORIGIN/YORIGIN fields so it assumes that the touchscreen starts at (0,0) Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/atmel_mxt_ts.c | 42 ++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index a9f987b59f9a..29be261a4750 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -103,6 +103,8 @@ struct t7_config { /* MXT_TOUCH_MULTI_T9 field */ #define MXT_T9_CTRL 0 +#define MXT_T9_XSIZE 3 +#define MXT_T9_YSIZE 4 #define MXT_T9_ORIENT 9 #define MXT_T9_RANGE 18 @@ -150,7 +152,9 @@ struct t37_debug { #define MXT_T100_CTRL 0 #define MXT_T100_CFG1 1 #define MXT_T100_TCHAUX 3 +#define MXT_T100_XSIZE 9 #define MXT_T100_XRANGE 13 +#define MXT_T100_YSIZE 20 #define MXT_T100_YRANGE 24 #define MXT_T100_CFG_SWITCHXY BIT(5) @@ -259,6 +263,8 @@ struct mxt_data { unsigned int max_x; unsigned int max_y; bool xy_switch; + u8 xsize; + u8 ysize; bool in_bootloader; u16 mem_size; u8 t100_aux_ampl; @@ -1713,6 +1719,18 @@ static int mxt_read_t9_resolution(struct mxt_data *data) if (!object) return -EINVAL; + error = __mxt_read_reg(client, + object->start_address + MXT_T9_XSIZE, + sizeof(data->xsize), &data->xsize); + if (error) + return error; + + error = __mxt_read_reg(client, + object->start_address + MXT_T9_YSIZE, + sizeof(data->ysize), &data->ysize); + if (error) + return error; + error = __mxt_read_reg(client, object->start_address + MXT_T9_RANGE, sizeof(range), &range); @@ -1763,6 +1781,18 @@ static int mxt_read_t100_config(struct mxt_data *data) data->max_y = get_unaligned_le16(&range_y); + error = __mxt_read_reg(client, + object->start_address + MXT_T100_XSIZE, + sizeof(data->xsize), &data->xsize); + if (error) + return error; + + error = __mxt_read_reg(client, + object->start_address + MXT_T100_YSIZE, + sizeof(data->ysize), &data->ysize); + if (error) + return error; + /* read orientation config */ error = __mxt_read_reg(client, object->start_address + MXT_T100_CFG1, @@ -2121,7 +2151,7 @@ static int mxt_convert_debug_pages(struct mxt_data *data, u16 *outbuf) outbuf[i] = mxt_get_debug_value(data, x, y); /* Next value */ - if (++x >= data->info.matrix_xsize) { + if (++x >= data->xsize) { x = 0; y++; } @@ -2276,8 +2306,8 @@ static int mxt_set_input(struct mxt_data *data, unsigned int i) if (i > 0) return -EINVAL; - f->width = data->info.matrix_xsize; - f->height = data->info.matrix_ysize; + f->width = data->xsize; + f->height = data->ysize; f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; f->field = V4L2_FIELD_NONE; f->colorspace = V4L2_COLORSPACE_RAW; @@ -2392,9 +2422,9 @@ static void mxt_debug_init(struct mxt_data *data) dbg->t37_address = object->start_address; /* Calculate size of data and allocate buffer */ - dbg->t37_nodes = data->info.matrix_xsize * data->info.matrix_ysize; - dbg->t37_pages = DIV_ROUND_UP(dbg->t37_nodes * sizeof(u16), - sizeof(dbg->t37_buf->data)); + dbg->t37_nodes = data->xsize * data->ysize; + dbg->t37_pages = DIV_ROUND_UP(data->xsize * data->info.matrix_ysize * + sizeof(u16), sizeof(dbg->t37_buf->data)); dbg->t37_buf = devm_kmalloc_array(&data->client->dev, dbg->t37_pages, sizeof(struct t37_debug), GFP_KERNEL); From de601f71e7d1bdfa411e61d43af7b2b6cde5d2a2 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:34 -0300 Subject: [PATCH 131/591] [media] Input: atmel_mxt_ts - handle diagnostic data orientation Invert the diagnostic data to match the orientation of the input device. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/atmel_mxt_ts.c | 26 +++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 29be261a4750..7376c42d2370 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -125,6 +125,8 @@ struct t9_range { /* MXT_TOUCH_MULTI_T9 orient */ #define MXT_T9_ORIENT_SWITCH (1 << 0) +#define MXT_T9_ORIENT_INVERTX (1 << 1) +#define MXT_T9_ORIENT_INVERTY (1 << 2) /* MXT_SPT_COMMSCONFIG_T18 */ #define MXT_COMMS_CTRL 0 @@ -158,6 +160,8 @@ struct t37_debug { #define MXT_T100_YRANGE 24 #define MXT_T100_CFG_SWITCHXY BIT(5) +#define MXT_T100_CFG_INVERTY BIT(6) +#define MXT_T100_CFG_INVERTX BIT(7) #define MXT_T100_TCHAUX_VECT BIT(0) #define MXT_T100_TCHAUX_AMPL BIT(1) @@ -262,6 +266,8 @@ struct mxt_data { unsigned int irq; unsigned int max_x; unsigned int max_y; + bool invertx; + bool inverty; bool xy_switch; u8 xsize; u8 ysize; @@ -1747,6 +1753,8 @@ static int mxt_read_t9_resolution(struct mxt_data *data) return error; data->xy_switch = orient & MXT_T9_ORIENT_SWITCH; + data->invertx = orient & MXT_T9_ORIENT_INVERTX; + data->inverty = orient & MXT_T9_ORIENT_INVERTY; return 0; } @@ -1801,6 +1809,8 @@ static int mxt_read_t100_config(struct mxt_data *data) return error; data->xy_switch = cfg & MXT_T100_CFG_SWITCHXY; + data->invertx = cfg & MXT_T100_CFG_INVERTX; + data->inverty = cfg & MXT_T100_CFG_INVERTY; /* allocate aux bytes */ error = __mxt_read_reg(client, @@ -2145,13 +2155,19 @@ static int mxt_convert_debug_pages(struct mxt_data *data, u16 *outbuf) struct mxt_dbg *dbg = &data->dbg; unsigned int x = 0; unsigned int y = 0; - unsigned int i; + unsigned int i, rx, ry; for (i = 0; i < dbg->t37_nodes; i++) { - outbuf[i] = mxt_get_debug_value(data, x, y); + /* Handle orientation */ + rx = data->xy_switch ? y : x; + ry = data->xy_switch ? x : y; + rx = data->invertx ? (data->xsize - 1 - rx) : rx; + ry = data->inverty ? (data->ysize - 1 - ry) : ry; + + outbuf[i] = mxt_get_debug_value(data, rx, ry); /* Next value */ - if (++x >= data->xsize) { + if (++x >= (data->xy_switch ? data->ysize : data->xsize)) { x = 0; y++; } @@ -2306,8 +2322,8 @@ static int mxt_set_input(struct mxt_data *data, unsigned int i) if (i > 0) return -EINVAL; - f->width = data->xsize; - f->height = data->ysize; + f->width = data->xy_switch ? data->ysize : data->xsize; + f->height = data->xy_switch ? data->xsize : data->ysize; f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; f->field = V4L2_FIELD_NONE; f->colorspace = V4L2_COLORSPACE_RAW; From 566d533a4bd2ed9a7ce26a08df31a6e634051562 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:35 -0300 Subject: [PATCH 132/591] [media] Input: atmel_mxt_ts - add diagnostic data support for mXT1386 The mXT1386 family of chips have a different architecture which splits the diagnostic data into 3 columns. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/atmel_mxt_ts.c | 31 +++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 7376c42d2370..584198e64661 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -137,6 +137,10 @@ struct t9_range { #define MXT_DIAGNOSTIC_DELTAS 0x10 #define MXT_DIAGNOSTIC_SIZE 128 +#define MXT_FAMILY_1386 160 +#define MXT1386_COLUMNS 3 +#define MXT1386_PAGES_PER_COLUMN 8 + struct t37_debug { #ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT_T37 u8 mode; @@ -2140,13 +2144,27 @@ recheck: static u16 mxt_get_debug_value(struct mxt_data *data, unsigned int x, unsigned int y) { + struct mxt_info *info = &data->info; struct mxt_dbg *dbg = &data->dbg; unsigned int ofs, page; + unsigned int col = 0; + unsigned int col_width; - ofs = (y + (x * data->info.matrix_ysize)) * sizeof(u16); + if (info->family_id == MXT_FAMILY_1386) { + col_width = info->matrix_ysize / MXT1386_COLUMNS; + col = y / col_width; + y = y % col_width; + } else { + col_width = info->matrix_ysize; + } + + ofs = (y + (x * col_width)) * sizeof(u16); page = ofs / MXT_DIAGNOSTIC_SIZE; ofs %= MXT_DIAGNOSTIC_SIZE; + if (info->family_id == MXT_FAMILY_1386) + page += col * MXT1386_PAGES_PER_COLUMN; + return get_unaligned_le16(&dbg->t37_buf[page].data[ofs]); } @@ -2416,6 +2434,7 @@ static const struct video_device mxt_video_device = { static void mxt_debug_init(struct mxt_data *data) { + struct mxt_info *info = &data->info; struct mxt_dbg *dbg = &data->dbg; struct mxt_object *object; int error; @@ -2439,8 +2458,14 @@ static void mxt_debug_init(struct mxt_data *data) /* Calculate size of data and allocate buffer */ dbg->t37_nodes = data->xsize * data->ysize; - dbg->t37_pages = DIV_ROUND_UP(data->xsize * data->info.matrix_ysize * - sizeof(u16), sizeof(dbg->t37_buf->data)); + + if (info->family_id == MXT_FAMILY_1386) + dbg->t37_pages = MXT1386_COLUMNS * MXT1386_PAGES_PER_COLUMN; + else + dbg->t37_pages = DIV_ROUND_UP(data->xsize * + data->info.matrix_ysize * + sizeof(u16), + sizeof(dbg->t37_buf->data)); dbg->t37_buf = devm_kmalloc_array(&data->client->dev, dbg->t37_pages, sizeof(struct t37_debug), GFP_KERNEL); From 06b3d3f38c19601564cdd10443edbcac5c8293e2 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:36 -0300 Subject: [PATCH 133/591] [media] Input: atmel_mxt_ts - add support for reference data There are different datatypes available from a maXTouch chip. Add support to retrieve reference data as well. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/atmel_mxt_ts.c | 57 +++++++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 584198e64661..beede8fe511c 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -135,6 +135,7 @@ struct t9_range { /* MXT_DEBUG_DIAGNOSTIC_T37 */ #define MXT_DIAGNOSTIC_PAGEUP 0x01 #define MXT_DIAGNOSTIC_DELTAS 0x10 +#define MXT_DIAGNOSTIC_REFS 0x11 #define MXT_DIAGNOSTIC_SIZE 128 #define MXT_FAMILY_1386 160 @@ -249,6 +250,12 @@ struct mxt_dbg { int input; }; +enum v4l_dbg_inputs { + MXT_V4L_INPUT_DELTAS, + MXT_V4L_INPUT_REFS, + MXT_V4L_INPUT_MAX, +}; + static const struct v4l2_file_operations mxt_video_fops = { .owner = THIS_MODULE, .open = v4l2_fh_open, @@ -2273,6 +2280,7 @@ static void mxt_buffer_queue(struct vb2_buffer *vb) struct mxt_data *data = vb2_get_drv_priv(vb->vb2_queue); u16 *ptr; int ret; + u8 mode; ptr = vb2_plane_vaddr(vb, 0); if (!ptr) { @@ -2280,7 +2288,18 @@ static void mxt_buffer_queue(struct vb2_buffer *vb) goto fault; } - ret = mxt_read_diagnostic_debug(data, MXT_DIAGNOSTIC_DELTAS, ptr); + switch (data->dbg.input) { + case MXT_V4L_INPUT_DELTAS: + default: + mode = MXT_DIAGNOSTIC_DELTAS; + break; + + case MXT_V4L_INPUT_REFS: + mode = MXT_DIAGNOSTIC_REFS; + break; + } + + ret = mxt_read_diagnostic_debug(data, mode, ptr); if (ret) goto fault; @@ -2325,11 +2344,21 @@ static int mxt_vidioc_querycap(struct file *file, void *priv, static int mxt_vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i) { - if (i->index > 0) + if (i->index >= MXT_V4L_INPUT_MAX) return -EINVAL; i->type = V4L2_INPUT_TYPE_TOUCH; - strlcpy(i->name, "Mutual Capacitance Deltas", sizeof(i->name)); + + switch (i->index) { + case MXT_V4L_INPUT_REFS: + strlcpy(i->name, "Mutual Capacitance References", + sizeof(i->name)); + break; + case MXT_V4L_INPUT_DELTAS: + strlcpy(i->name, "Mutual Capacitance Deltas", sizeof(i->name)); + break; + } + return 0; } @@ -2337,12 +2366,16 @@ static int mxt_set_input(struct mxt_data *data, unsigned int i) { struct v4l2_pix_format *f = &data->dbg.format; - if (i > 0) + if (i >= MXT_V4L_INPUT_MAX) return -EINVAL; + if (i == MXT_V4L_INPUT_DELTAS) + f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + else + f->pixelformat = V4L2_TCH_FMT_TU16; + f->width = data->xy_switch ? data->ysize : data->xsize; f->height = data->xy_switch ? data->xsize : data->ysize; - f->pixelformat = V4L2_TCH_FMT_DELTA_TD16; f->field = V4L2_FIELD_NONE; f->colorspace = V4L2_COLORSPACE_RAW; f->bytesperline = f->width * sizeof(u16); @@ -2383,7 +2416,19 @@ static int mxt_vidioc_enum_fmt(struct file *file, void *priv, if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + switch (fmt->index) { + case 0: + fmt->pixelformat = V4L2_TCH_FMT_TU16; + break; + + case 1: + fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + break; + + default: + return -EINVAL; + } + return 0; } From 3a762dbd5347514c3cb2ac756a92a3d1c7646a2d Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 18 Jul 2016 18:10:37 -0300 Subject: [PATCH 134/591] [media] Input: synaptics-rmi4 - add support for F54 diagnostics Function 54 implements access to various RMI4 diagnostic features. This patch adds support for retrieving this data. It registers a V4L2 device to output the data to user space. Signed-off-by: Nick Dyer Tested-by: Andrew Duggan Tested-by: Chris Healy Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- drivers/input/rmi4/Kconfig | 11 + drivers/input/rmi4/Makefile | 1 + drivers/input/rmi4/rmi_bus.c | 3 + drivers/input/rmi4/rmi_driver.h | 1 + drivers/input/rmi4/rmi_f54.c | 756 ++++++++++++++++++++++++++++++++ 5 files changed, 772 insertions(+) create mode 100644 drivers/input/rmi4/rmi_f54.c diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index f73df2495fed..f3418b65eb41 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -61,3 +61,14 @@ config RMI4_F30 Function 30 provides GPIO and LED support for RMI4 devices. This includes support for buttons on TouchPads and ClickPads. + +config RMI4_F54 + bool "RMI4 Function 54 (Analog diagnostics)" + depends on RMI4_CORE + depends on VIDEO_V4L2 + select VIDEOBUF2_VMALLOC + help + Say Y here if you want to add support for RMI4 function 54 + + Function 54 provides access to various diagnostic features in certain + RMI4 touch sensors. diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile index 95c00a783992..0bafc8502c4b 100644 --- a/drivers/input/rmi4/Makefile +++ b/drivers/input/rmi4/Makefile @@ -7,6 +7,7 @@ rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o +rmi_core-$(CONFIG_RMI4_F54) += rmi_f54.o # Transports obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index a73580654c6b..09c769c6e91f 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -312,6 +312,9 @@ static struct rmi_function_handler *fn_handlers[] = { #ifdef CONFIG_RMI4_F30 &rmi_f30_handler, #endif +#ifdef CONFIG_RMI4_F54 + &rmi_f54_handler, +#endif }; static void __rmi_unregister_function_handlers(int start_idx) diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index 6e140fa3cce1..8dfbebe9bf86 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -102,4 +102,5 @@ extern struct rmi_function_handler rmi_f01_handler; extern struct rmi_function_handler rmi_f11_handler; extern struct rmi_function_handler rmi_f12_handler; extern struct rmi_function_handler rmi_f30_handler; +extern struct rmi_function_handler rmi_f54_handler; #endif diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c new file mode 100644 index 000000000000..bd86d3d599e7 --- /dev/null +++ b/drivers/input/rmi4/rmi_f54.c @@ -0,0 +1,756 @@ +/* + * Copyright (c) 2012-2015 Synaptics Incorporated + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "rmi_driver.h" + +#define F54_NAME "rmi4_f54" + +/* F54 data offsets */ +#define F54_REPORT_DATA_OFFSET 3 +#define F54_FIFO_OFFSET 1 +#define F54_NUM_TX_OFFSET 1 +#define F54_NUM_RX_OFFSET 0 + +/* F54 commands */ +#define F54_GET_REPORT 1 +#define F54_FORCE_CAL 2 + +/* Fixed sizes of reports */ +#define F54_QUERY_LEN 27 + +/* F54 capabilities */ +#define F54_CAP_BASELINE (1 << 2) +#define F54_CAP_IMAGE8 (1 << 3) +#define F54_CAP_IMAGE16 (1 << 6) + +/** + * enum rmi_f54_report_type - RMI4 F54 report types + * + * @F54_8BIT_IMAGE: Normalized 8-Bit Image Report. The capacitance variance + * from baseline for each pixel. + * + * @F54_16BIT_IMAGE: Normalized 16-Bit Image Report. The capacitance variance + * from baseline for each pixel. + * + * @F54_RAW_16BIT_IMAGE: + * Raw 16-Bit Image Report. The raw capacitance for each + * pixel. + * + * @F54_TRUE_BASELINE: True Baseline Report. The baseline capacitance for each + * pixel. + * + * @F54_FULL_RAW_CAP: Full Raw Capacitance Report. The raw capacitance with + * low reference set to its minimum value and high + * reference set to its maximum value. + * + * @F54_FULL_RAW_CAP_RX_OFFSET_REMOVED: + * Full Raw Capacitance with Receiver Offset Removed + * Report. Set Low reference to its minimum value and high + * references to its maximum value, then report the raw + * capacitance for each pixel. + */ +enum rmi_f54_report_type { + F54_REPORT_NONE = 0, + F54_8BIT_IMAGE = 1, + F54_16BIT_IMAGE = 2, + F54_RAW_16BIT_IMAGE = 3, + F54_TRUE_BASELINE = 9, + F54_FULL_RAW_CAP = 19, + F54_FULL_RAW_CAP_RX_OFFSET_REMOVED = 20, + F54_MAX_REPORT_TYPE, +}; + +const char *rmi_f54_report_type_names[] = { + [F54_REPORT_NONE] = "Unknown", + [F54_8BIT_IMAGE] = "Normalized 8-Bit Image", + [F54_16BIT_IMAGE] = "Normalized 16-Bit Image", + [F54_RAW_16BIT_IMAGE] = "Raw 16-Bit Image", + [F54_TRUE_BASELINE] = "True Baseline", + [F54_FULL_RAW_CAP] = "Full Raw Capacitance", + [F54_FULL_RAW_CAP_RX_OFFSET_REMOVED] + = "Full Raw Capacitance RX Offset Removed", +}; + +struct rmi_f54_reports { + int start; + int size; +}; + +struct f54_data { + struct rmi_function *fn; + + u8 qry[F54_QUERY_LEN]; + u8 num_rx_electrodes; + u8 num_tx_electrodes; + u8 capabilities; + u16 clock_rate; + u8 family; + + enum rmi_f54_report_type report_type; + u8 *report_data; + int report_size; + struct rmi_f54_reports standard_report[2]; + + bool is_busy; + struct mutex status_mutex; + struct mutex data_mutex; + + struct workqueue_struct *workqueue; + struct delayed_work work; + unsigned long timeout; + + struct completion cmd_done; + + /* V4L2 support */ + struct v4l2_device v4l2; + struct v4l2_pix_format format; + struct video_device vdev; + struct vb2_queue queue; + struct mutex lock; + int input; + enum rmi_f54_report_type inputs[F54_MAX_REPORT_TYPE]; +}; + +/* + * Basic checks on report_type to ensure we write a valid type + * to the sensor. + */ +static bool is_f54_report_type_valid(struct f54_data *f54, + enum rmi_f54_report_type reptype) +{ + switch (reptype) { + case F54_8BIT_IMAGE: + return f54->capabilities & F54_CAP_IMAGE8; + case F54_16BIT_IMAGE: + case F54_RAW_16BIT_IMAGE: + return f54->capabilities & F54_CAP_IMAGE16; + case F54_TRUE_BASELINE: + return f54->capabilities & F54_CAP_IMAGE16; + case F54_FULL_RAW_CAP: + case F54_FULL_RAW_CAP_RX_OFFSET_REMOVED: + return true; + default: + return false; + } +} + +static enum rmi_f54_report_type rmi_f54_get_reptype(struct f54_data *f54, + unsigned int i) +{ + if (i >= F54_MAX_REPORT_TYPE) + return F54_REPORT_NONE; + + return f54->inputs[i]; +} + +static void rmi_f54_create_input_map(struct f54_data *f54) +{ + int i = 0; + enum rmi_f54_report_type reptype; + + for (reptype = 1; reptype < F54_MAX_REPORT_TYPE; reptype++) { + if (!is_f54_report_type_valid(f54, reptype)) + continue; + + f54->inputs[i++] = reptype; + } + + /* Remaining values are zero via kzalloc */ +} + +static int rmi_f54_request_report(struct rmi_function *fn, u8 report_type) +{ + struct f54_data *f54 = dev_get_drvdata(&fn->dev); + struct rmi_device *rmi_dev = fn->rmi_dev; + int error; + + /* Write Report Type into F54_AD_Data0 */ + if (f54->report_type != report_type) { + error = rmi_write(rmi_dev, f54->fn->fd.data_base_addr, + report_type); + if (error) + return error; + f54->report_type = report_type; + } + + /* + * Small delay after disabling interrupts to avoid race condition + * in firmare. This value is a bit higher than absolutely necessary. + * Should be removed once issue is resolved in firmware. + */ + usleep_range(2000, 3000); + + mutex_lock(&f54->data_mutex); + + error = rmi_write(rmi_dev, fn->fd.command_base_addr, F54_GET_REPORT); + if (error < 0) + return error; + + init_completion(&f54->cmd_done); + + f54->is_busy = 1; + f54->timeout = jiffies + msecs_to_jiffies(100); + + queue_delayed_work(f54->workqueue, &f54->work, 0); + + mutex_unlock(&f54->data_mutex); + + return 0; +} + +static size_t rmi_f54_get_report_size(struct f54_data *f54) +{ + u8 rx = f54->num_rx_electrodes ? : f54->num_rx_electrodes; + u8 tx = f54->num_tx_electrodes ? : f54->num_tx_electrodes; + size_t size; + + switch (rmi_f54_get_reptype(f54, f54->input)) { + case F54_8BIT_IMAGE: + size = rx * tx; + break; + case F54_16BIT_IMAGE: + case F54_RAW_16BIT_IMAGE: + case F54_TRUE_BASELINE: + case F54_FULL_RAW_CAP: + case F54_FULL_RAW_CAP_RX_OFFSET_REMOVED: + size = sizeof(u16) * rx * tx; + break; + default: + size = 0; + } + + return size; +} + +static int rmi_f54_get_pixel_fmt(enum rmi_f54_report_type reptype, u32 *pixfmt) +{ + int ret = 0; + + switch (reptype) { + case F54_8BIT_IMAGE: + *pixfmt = V4L2_TCH_FMT_DELTA_TD08; + break; + + case F54_16BIT_IMAGE: + *pixfmt = V4L2_TCH_FMT_DELTA_TD16; + break; + + case F54_RAW_16BIT_IMAGE: + case F54_TRUE_BASELINE: + case F54_FULL_RAW_CAP: + case F54_FULL_RAW_CAP_RX_OFFSET_REMOVED: + *pixfmt = V4L2_TCH_FMT_TU16; + break; + + case F54_REPORT_NONE: + case F54_MAX_REPORT_TYPE: + ret = -EINVAL; + break; + } + + return ret; +} + +static const struct v4l2_file_operations rmi_f54_video_fops = { + .owner = THIS_MODULE, + .open = v4l2_fh_open, + .release = vb2_fop_release, + .unlocked_ioctl = video_ioctl2, + .read = vb2_fop_read, + .mmap = vb2_fop_mmap, + .poll = vb2_fop_poll, +}; + +static int rmi_f54_queue_setup(struct vb2_queue *q, unsigned int *nbuffers, + unsigned int *nplanes, unsigned int sizes[], + struct device *alloc_devs[]) +{ + struct f54_data *f54 = q->drv_priv; + + if (*nplanes) + return sizes[0] < rmi_f54_get_report_size(f54) ? -EINVAL : 0; + + *nplanes = 1; + sizes[0] = rmi_f54_get_report_size(f54); + + return 0; +} + +static void rmi_f54_buffer_queue(struct vb2_buffer *vb) +{ + struct f54_data *f54 = vb2_get_drv_priv(vb->vb2_queue); + u16 *ptr; + enum vb2_buffer_state state; + enum rmi_f54_report_type reptype; + int ret; + + mutex_lock(&f54->status_mutex); + + reptype = rmi_f54_get_reptype(f54, f54->input); + if (reptype == F54_REPORT_NONE) { + state = VB2_BUF_STATE_ERROR; + goto done; + } + + if (f54->is_busy) { + state = VB2_BUF_STATE_ERROR; + goto done; + } + + ret = rmi_f54_request_report(f54->fn, reptype); + if (ret) { + dev_err(&f54->fn->dev, "Error requesting F54 report\n"); + state = VB2_BUF_STATE_ERROR; + goto done; + } + + /* get frame data */ + mutex_lock(&f54->data_mutex); + + while (f54->is_busy) { + mutex_unlock(&f54->data_mutex); + if (!wait_for_completion_timeout(&f54->cmd_done, + msecs_to_jiffies(1000))) { + dev_err(&f54->fn->dev, "Timed out\n"); + state = VB2_BUF_STATE_ERROR; + goto done; + } + mutex_lock(&f54->data_mutex); + } + + ptr = vb2_plane_vaddr(vb, 0); + if (!ptr) { + dev_err(&f54->fn->dev, "Error acquiring frame ptr\n"); + state = VB2_BUF_STATE_ERROR; + goto data_done; + } + + memcpy(ptr, f54->report_data, f54->report_size); + vb2_set_plane_payload(vb, 0, rmi_f54_get_report_size(f54)); + state = VB2_BUF_STATE_DONE; + +data_done: + mutex_unlock(&f54->data_mutex); +done: + vb2_buffer_done(vb, state); + mutex_unlock(&f54->status_mutex); +} + +/* V4L2 structures */ +static const struct vb2_ops rmi_f54_queue_ops = { + .queue_setup = rmi_f54_queue_setup, + .buf_queue = rmi_f54_buffer_queue, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, +}; + +static const struct vb2_queue rmi_f54_queue = { + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, + .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ, + .buf_struct_size = sizeof(struct vb2_buffer), + .ops = &rmi_f54_queue_ops, + .mem_ops = &vb2_vmalloc_memops, + .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, + .min_buffers_needed = 1, +}; + +static int rmi_f54_vidioc_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + struct f54_data *f54 = video_drvdata(file); + + strlcpy(cap->driver, F54_NAME, sizeof(cap->driver)); + strlcpy(cap->card, SYNAPTICS_INPUT_DEVICE_NAME, sizeof(cap->card)); + snprintf(cap->bus_info, sizeof(cap->bus_info), + "rmi4:%s", dev_name(&f54->fn->dev)); + + return 0; +} + +static int rmi_f54_vidioc_enum_input(struct file *file, void *priv, + struct v4l2_input *i) +{ + struct f54_data *f54 = video_drvdata(file); + enum rmi_f54_report_type reptype; + + reptype = rmi_f54_get_reptype(f54, i->index); + if (reptype == F54_REPORT_NONE) + return -EINVAL; + + i->type = V4L2_INPUT_TYPE_TOUCH; + + strlcpy(i->name, rmi_f54_report_type_names[reptype], sizeof(i->name)); + return 0; +} + +static int rmi_f54_set_input(struct f54_data *f54, unsigned int i) +{ + struct v4l2_pix_format *f = &f54->format; + enum rmi_f54_report_type reptype; + int ret; + + reptype = rmi_f54_get_reptype(f54, i); + if (reptype == F54_REPORT_NONE) + return -EINVAL; + + ret = rmi_f54_get_pixel_fmt(reptype, &f->pixelformat); + if (ret) + return ret; + + f54->input = i; + + f->width = f54->num_rx_electrodes; + f->height = f54->num_tx_electrodes; + f->field = V4L2_FIELD_NONE; + f->colorspace = V4L2_COLORSPACE_RAW; + f->bytesperline = f->width * sizeof(u16); + f->sizeimage = f->width * f->height * sizeof(u16); + + return 0; +} + +static int rmi_f54_vidioc_s_input(struct file *file, void *priv, unsigned int i) +{ + return rmi_f54_set_input(video_drvdata(file), i); +} + +static int rmi_f54_vidioc_g_input(struct file *file, void *priv, + unsigned int *i) +{ + struct f54_data *f54 = video_drvdata(file); + + *i = f54->input; + + return 0; +} + +static int rmi_f54_vidioc_fmt(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct f54_data *f54 = video_drvdata(file); + + f->fmt.pix = f54->format; + + return 0; +} + +static int rmi_f54_vidioc_enum_fmt(struct file *file, void *priv, + struct v4l2_fmtdesc *fmt) +{ + if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + switch (fmt->index) { + case 0: + fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; + break; + + case 1: + fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD08; + break; + + case 2: + fmt->pixelformat = V4L2_TCH_FMT_TU16; + break; + + default: + return -EINVAL; + } + + return 0; +} + +static int rmi_f54_vidioc_g_parm(struct file *file, void *fh, + struct v4l2_streamparm *a) +{ + if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + a->parm.capture.readbuffers = 1; + a->parm.capture.timeperframe.numerator = 1; + a->parm.capture.timeperframe.denominator = 10; + return 0; +} + +static const struct v4l2_ioctl_ops rmi_f54_video_ioctl_ops = { + .vidioc_querycap = rmi_f54_vidioc_querycap, + + .vidioc_enum_fmt_vid_cap = rmi_f54_vidioc_enum_fmt, + .vidioc_s_fmt_vid_cap = rmi_f54_vidioc_fmt, + .vidioc_g_fmt_vid_cap = rmi_f54_vidioc_fmt, + .vidioc_try_fmt_vid_cap = rmi_f54_vidioc_fmt, + .vidioc_g_parm = rmi_f54_vidioc_g_parm, + + .vidioc_enum_input = rmi_f54_vidioc_enum_input, + .vidioc_g_input = rmi_f54_vidioc_g_input, + .vidioc_s_input = rmi_f54_vidioc_s_input, + + .vidioc_reqbufs = vb2_ioctl_reqbufs, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_expbuf = vb2_ioctl_expbuf, + + .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamoff = vb2_ioctl_streamoff, +}; + +static const struct video_device rmi_f54_video_device = { + .name = "Synaptics RMI4", + .fops = &rmi_f54_video_fops, + .ioctl_ops = &rmi_f54_video_ioctl_ops, + .release = video_device_release_empty, + .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TOUCH | + V4L2_CAP_READWRITE | V4L2_CAP_STREAMING, +}; + +static void rmi_f54_work(struct work_struct *work) +{ + struct f54_data *f54 = container_of(work, struct f54_data, work.work); + struct rmi_function *fn = f54->fn; + u8 fifo[2]; + struct rmi_f54_reports *report; + int report_size; + u8 command; + u8 *data; + int error; + + data = f54->report_data; + report_size = rmi_f54_get_report_size(f54); + if (report_size == 0) { + dev_err(&fn->dev, "Bad report size, report type=%d\n", + f54->report_type); + error = -EINVAL; + goto error; /* retry won't help */ + } + f54->standard_report[0].size = report_size; + report = f54->standard_report; + + mutex_lock(&f54->data_mutex); + + /* + * Need to check if command has completed. + * If not try again later. + */ + error = rmi_read(fn->rmi_dev, f54->fn->fd.command_base_addr, + &command); + if (error) { + dev_err(&fn->dev, "Failed to read back command\n"); + goto error; + } + if (command & F54_GET_REPORT) { + if (time_after(jiffies, f54->timeout)) { + dev_err(&fn->dev, "Get report command timed out\n"); + error = -ETIMEDOUT; + } + report_size = 0; + goto error; + } + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "Get report command completed, reading data\n"); + + report_size = 0; + for (; report->size; report++) { + fifo[0] = report->start & 0xff; + fifo[1] = (report->start >> 8) & 0xff; + error = rmi_write_block(fn->rmi_dev, + fn->fd.data_base_addr + F54_FIFO_OFFSET, + fifo, sizeof(fifo)); + if (error) { + dev_err(&fn->dev, "Failed to set fifo start offset\n"); + goto abort; + } + + error = rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr + + F54_REPORT_DATA_OFFSET, data, + report->size); + if (error) { + dev_err(&fn->dev, "%s: read [%d bytes] returned %d\n", + __func__, report->size, error); + goto abort; + } + data += report->size; + report_size += report->size; + } + +abort: + f54->report_size = error ? 0 : report_size; +error: + if (error) + report_size = 0; + + if (report_size == 0 && !error) { + queue_delayed_work(f54->workqueue, &f54->work, + msecs_to_jiffies(1)); + } else { + f54->is_busy = false; + complete(&f54->cmd_done); + } + + mutex_unlock(&f54->data_mutex); +} + +static int rmi_f54_attention(struct rmi_function *fn, unsigned long *irqbits) +{ + return 0; +} + +static int rmi_f54_config(struct rmi_function *fn) +{ + struct rmi_driver *drv = fn->rmi_dev->driver; + + drv->set_irq_bits(fn->rmi_dev, fn->irq_mask); + + return 0; +} + +static int rmi_f54_detect(struct rmi_function *fn) +{ + int error; + struct f54_data *f54; + + f54 = dev_get_drvdata(&fn->dev); + + error = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr, + &f54->qry, sizeof(f54->qry)); + if (error) { + dev_err(&fn->dev, "%s: Failed to query F54 properties\n", + __func__); + return error; + } + + f54->num_rx_electrodes = f54->qry[0]; + f54->num_tx_electrodes = f54->qry[1]; + f54->capabilities = f54->qry[2]; + f54->clock_rate = f54->qry[3] | (f54->qry[4] << 8); + f54->family = f54->qry[5]; + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F54 num_rx_electrodes: %d\n", + f54->num_rx_electrodes); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F54 num_tx_electrodes: %d\n", + f54->num_tx_electrodes); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F54 capabilities: 0x%x\n", + f54->capabilities); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F54 clock rate: 0x%x\n", + f54->clock_rate); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F54 family: 0x%x\n", + f54->family); + + f54->is_busy = false; + + return 0; +} + +static int rmi_f54_probe(struct rmi_function *fn) +{ + struct f54_data *f54; + int ret; + u8 rx, tx; + + f54 = devm_kzalloc(&fn->dev, sizeof(struct f54_data), GFP_KERNEL); + if (!f54) + return -ENOMEM; + + f54->fn = fn; + dev_set_drvdata(&fn->dev, f54); + + ret = rmi_f54_detect(fn); + if (ret) + return ret; + + mutex_init(&f54->data_mutex); + mutex_init(&f54->status_mutex); + + rx = f54->num_rx_electrodes; + tx = f54->num_tx_electrodes; + f54->report_data = devm_kzalloc(&fn->dev, + sizeof(u16) * tx * rx, + GFP_KERNEL); + if (f54->report_data == NULL) + return -ENOMEM; + + INIT_DELAYED_WORK(&f54->work, rmi_f54_work); + + f54->workqueue = create_singlethread_workqueue("rmi4-poller"); + if (!f54->workqueue) + return -ENOMEM; + + rmi_f54_create_input_map(f54); + + /* register video device */ + strlcpy(f54->v4l2.name, F54_NAME, sizeof(f54->v4l2.name)); + ret = v4l2_device_register(&fn->dev, &f54->v4l2); + if (ret) { + dev_err(&fn->dev, "Unable to register video dev.\n"); + goto remove_wq; + } + + /* initialize the queue */ + mutex_init(&f54->lock); + f54->queue = rmi_f54_queue; + f54->queue.drv_priv = f54; + f54->queue.lock = &f54->lock; + f54->queue.dev = &fn->dev; + + ret = vb2_queue_init(&f54->queue); + if (ret) + goto remove_v4l2; + + f54->vdev = rmi_f54_video_device; + f54->vdev.v4l2_dev = &f54->v4l2; + f54->vdev.lock = &f54->lock; + f54->vdev.vfl_dir = VFL_DIR_RX; + f54->vdev.queue = &f54->queue; + video_set_drvdata(&f54->vdev, f54); + + ret = video_register_device(&f54->vdev, VFL_TYPE_TOUCH, -1); + if (ret) { + dev_err(&fn->dev, "Unable to register video subdevice."); + goto remove_v4l2; + } + + return 0; + +remove_v4l2: + v4l2_device_unregister(&f54->v4l2); +remove_wq: + cancel_delayed_work_sync(&f54->work); + flush_workqueue(f54->workqueue); + destroy_workqueue(f54->workqueue); + return ret; +} + +static void rmi_f54_remove(struct rmi_function *fn) +{ + struct f54_data *f54 = dev_get_drvdata(&fn->dev); + + video_unregister_device(&f54->vdev); + v4l2_device_unregister(&f54->v4l2); +} + +struct rmi_function_handler rmi_f54_handler = { + .driver = { + .name = F54_NAME, + }, + .func = 0x54, + .probe = rmi_f54_probe, + .config = rmi_f54_config, + .attention = rmi_f54_attention, + .remove = rmi_f54_remove, +}; From b497265266a8083547e9ca162ace72cbb41522f1 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 22 Aug 2016 06:28:23 -0300 Subject: [PATCH 135/591] [media] Input: sur40 - use new V4L2 touch input type Support both V4L2_TCH_FMT_TU08 and V4L2_PIX_FMT_GREY for backwards compatibility. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/sur40.c | 124 ++++++++++++++++++++++-------- 1 file changed, 91 insertions(+), 33 deletions(-) diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index 4ea475775d58..3967d8c651cc 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c @@ -139,6 +139,27 @@ struct sur40_image_header { #define SUR40_GET_STATE 0xc5 /* 4 bytes state (?) */ #define SUR40_GET_SENSORS 0xb1 /* 8 bytes sensors */ +static const struct v4l2_pix_format sur40_pix_format[] = { + { + .pixelformat = V4L2_TCH_FMT_TU08, + .width = SENSOR_RES_X / 2, + .height = SENSOR_RES_Y / 2, + .field = V4L2_FIELD_NONE, + .colorspace = V4L2_COLORSPACE_SRGB, + .bytesperline = SENSOR_RES_X / 2, + .sizeimage = (SENSOR_RES_X/2) * (SENSOR_RES_Y/2), + }, + { + .pixelformat = V4L2_PIX_FMT_GREY, + .width = SENSOR_RES_X / 2, + .height = SENSOR_RES_Y / 2, + .field = V4L2_FIELD_NONE, + .colorspace = V4L2_COLORSPACE_SRGB, + .bytesperline = SENSOR_RES_X / 2, + .sizeimage = (SENSOR_RES_X/2) * (SENSOR_RES_Y/2), + } +}; + /* master device state */ struct sur40_state { @@ -149,6 +170,7 @@ struct sur40_state { struct v4l2_device v4l2; struct video_device vdev; struct mutex lock; + struct v4l2_pix_format pix_fmt; struct vb2_queue queue; struct list_head buf_list; @@ -169,7 +191,6 @@ struct sur40_buffer { /* forward declarations */ static const struct video_device sur40_video_device; -static const struct v4l2_pix_format sur40_video_format; static const struct vb2_queue sur40_queue; static void sur40_process_video(struct sur40_state *sur40); @@ -420,7 +441,7 @@ static void sur40_process_video(struct sur40_state *sur40) goto err_poll; } - if (le32_to_cpu(img->size) != sur40_video_format.sizeimage) { + if (le32_to_cpu(img->size) != sur40->pix_fmt.sizeimage) { dev_err(sur40->dev, "image size mismatch\n"); goto err_poll; } @@ -431,7 +452,7 @@ static void sur40_process_video(struct sur40_state *sur40) result = usb_sg_init(&sgr, sur40->usbdev, usb_rcvbulkpipe(sur40->usbdev, VIDEO_ENDPOINT), 0, - sgt->sgl, sgt->nents, sur40_video_format.sizeimage, 0); + sgt->sgl, sgt->nents, sur40->pix_fmt.sizeimage, 0); if (result < 0) { dev_err(sur40->dev, "error %d in usb_sg_init\n", result); goto err_poll; @@ -586,13 +607,14 @@ static int sur40_probe(struct usb_interface *interface, if (error) goto err_unreg_v4l2; + sur40->pix_fmt = sur40_pix_format[0]; sur40->vdev = sur40_video_device; sur40->vdev.v4l2_dev = &sur40->v4l2; sur40->vdev.lock = &sur40->lock; sur40->vdev.queue = &sur40->queue; video_set_drvdata(&sur40->vdev, sur40); - error = video_register_device(&sur40->vdev, VFL_TYPE_GRABBER, -1); + error = video_register_device(&sur40->vdev, VFL_TYPE_TOUCH, -1); if (error) { dev_err(&interface->dev, "Unable to register video subdevice."); @@ -647,14 +669,16 @@ static int sur40_queue_setup(struct vb2_queue *q, unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[]) { + struct sur40_state *sur40 = vb2_get_drv_priv(q); + if (q->num_buffers + *nbuffers < 3) *nbuffers = 3 - q->num_buffers; if (*nplanes) - return sizes[0] < sur40_video_format.sizeimage ? -EINVAL : 0; + return sizes[0] < sur40->pix_fmt.sizeimage ? -EINVAL : 0; *nplanes = 1; - sizes[0] = sur40_video_format.sizeimage; + sizes[0] = sur40->pix_fmt.sizeimage; return 0; } @@ -666,7 +690,7 @@ static int sur40_queue_setup(struct vb2_queue *q, static int sur40_buffer_prepare(struct vb2_buffer *vb) { struct sur40_state *sur40 = vb2_get_drv_priv(vb->vb2_queue); - unsigned long size = sur40_video_format.sizeimage; + unsigned long size = sur40->pix_fmt.sizeimage; if (vb2_plane_size(vb, 0) < size) { dev_err(&sur40->usbdev->dev, "buffer too small (%lu < %lu)\n", @@ -741,7 +765,7 @@ static int sur40_vidioc_querycap(struct file *file, void *priv, strlcpy(cap->driver, DRIVER_SHORT, sizeof(cap->driver)); strlcpy(cap->card, DRIVER_LONG, sizeof(cap->card)); usb_make_path(sur40->usbdev, cap->bus_info, sizeof(cap->bus_info)); - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | + cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TOUCH | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -753,7 +777,7 @@ static int sur40_vidioc_enum_input(struct file *file, void *priv, { if (i->index != 0) return -EINVAL; - i->type = V4L2_INPUT_TYPE_CAMERA; + i->type = V4L2_INPUT_TYPE_TOUCH; i->std = V4L2_STD_UNKNOWN; strlcpy(i->name, "In-Cell Sensor", sizeof(i->name)); i->capabilities = 0; @@ -771,19 +795,57 @@ static int sur40_vidioc_g_input(struct file *file, void *priv, unsigned int *i) return 0; } -static int sur40_vidioc_fmt(struct file *file, void *priv, +static int sur40_vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) { - f->fmt.pix = sur40_video_format; + switch (f->fmt.pix.pixelformat) { + case V4L2_PIX_FMT_GREY: + f->fmt.pix = sur40_pix_format[1]; + break; + + default: + f->fmt.pix = sur40_pix_format[0]; + break; + } + + return 0; +} + +static int sur40_vidioc_s_fmt(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct sur40_state *sur40 = video_drvdata(file); + + switch (f->fmt.pix.pixelformat) { + case V4L2_PIX_FMT_GREY: + sur40->pix_fmt = sur40_pix_format[1]; + break; + + default: + sur40->pix_fmt = sur40_pix_format[0]; + break; + } + + f->fmt.pix = sur40->pix_fmt; + return 0; +} + +static int sur40_vidioc_g_fmt(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct sur40_state *sur40 = video_drvdata(file); + + f->fmt.pix = sur40->pix_fmt; return 0; } static int sur40_vidioc_enum_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - if (f->index != 0) + if (f->index >= ARRAY_SIZE(sur40_pix_format)) return -EINVAL; - f->pixelformat = V4L2_PIX_FMT_GREY; + + f->pixelformat = sur40_pix_format[f->index].pixelformat; f->flags = 0; return 0; } @@ -791,22 +853,28 @@ static int sur40_vidioc_enum_fmt(struct file *file, void *priv, static int sur40_vidioc_enum_framesizes(struct file *file, void *priv, struct v4l2_frmsizeenum *f) { - if ((f->index != 0) || (f->pixel_format != V4L2_PIX_FMT_GREY)) + struct sur40_state *sur40 = video_drvdata(file); + + if ((f->index != 0) || ((f->pixel_format != V4L2_TCH_FMT_TU08) + && (f->pixel_format != V4L2_PIX_FMT_GREY))) return -EINVAL; f->type = V4L2_FRMSIZE_TYPE_DISCRETE; - f->discrete.width = sur40_video_format.width; - f->discrete.height = sur40_video_format.height; + f->discrete.width = sur40->pix_fmt.width; + f->discrete.height = sur40->pix_fmt.height; return 0; } static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv, struct v4l2_frmivalenum *f) { - if ((f->index > 1) || (f->pixel_format != V4L2_PIX_FMT_GREY) - || (f->width != sur40_video_format.width) - || (f->height != sur40_video_format.height)) - return -EINVAL; + struct sur40_state *sur40 = video_drvdata(file); + + if ((f->index > 1) || ((f->pixel_format != V4L2_TCH_FMT_TU08) + && (f->pixel_format != V4L2_PIX_FMT_GREY)) + || (f->width != sur40->pix_fmt.width) + || (f->height != sur40->pix_fmt.height)) + return -EINVAL; f->type = V4L2_FRMIVAL_TYPE_DISCRETE; f->discrete.denominator = 60/(f->index+1); @@ -862,9 +930,9 @@ static const struct v4l2_ioctl_ops sur40_video_ioctl_ops = { .vidioc_querycap = sur40_vidioc_querycap, .vidioc_enum_fmt_vid_cap = sur40_vidioc_enum_fmt, - .vidioc_try_fmt_vid_cap = sur40_vidioc_fmt, - .vidioc_s_fmt_vid_cap = sur40_vidioc_fmt, - .vidioc_g_fmt_vid_cap = sur40_vidioc_fmt, + .vidioc_try_fmt_vid_cap = sur40_vidioc_try_fmt, + .vidioc_s_fmt_vid_cap = sur40_vidioc_s_fmt, + .vidioc_g_fmt_vid_cap = sur40_vidioc_g_fmt, .vidioc_enum_framesizes = sur40_vidioc_enum_framesizes, .vidioc_enum_frameintervals = sur40_vidioc_enum_frameintervals, @@ -891,16 +959,6 @@ static const struct video_device sur40_video_device = { .release = video_device_release_empty, }; -static const struct v4l2_pix_format sur40_video_format = { - .pixelformat = V4L2_PIX_FMT_GREY, - .width = SENSOR_RES_X / 2, - .height = SENSOR_RES_Y / 2, - .field = V4L2_FIELD_NONE, - .colorspace = V4L2_COLORSPACE_SRGB, - .bytesperline = SENSOR_RES_X / 2, - .sizeimage = (SENSOR_RES_X/2) * (SENSOR_RES_Y/2), -}; - /* USB-specific object needed to register this driver with the USB subsystem. */ static struct usb_driver sur40_driver = { .name = DRIVER_SHORT, From 233b213a3143d9f1dc6984816262c43f95144bb9 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sun, 14 Aug 2016 16:57:29 -0300 Subject: [PATCH 136/591] [media] Documentation: add support for V4L touch devices Document the new touch API. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil [hans.verkuil@cisco.com: fix up videodev2.h.rst.exceptions] Signed-off-by: Mauro Carvalho Chehab Acked-by: Dmitry Torokhov --- .../media/uapi/mediactl/media-types.rst | 24 ++-- Documentation/media/uapi/v4l/dev-touch.rst | 56 +++++++++ Documentation/media/uapi/v4l/devices.rst | 1 + .../media/uapi/v4l/pixfmt-tch-td08.rst | 80 +++++++++++++ .../media/uapi/v4l/pixfmt-tch-td16.rst | 111 ++++++++++++++++++ .../media/uapi/v4l/pixfmt-tch-tu08.rst | 78 ++++++++++++ .../media/uapi/v4l/pixfmt-tch-tu16.rst | 110 +++++++++++++++++ Documentation/media/uapi/v4l/pixfmt.rst | 1 + Documentation/media/uapi/v4l/tch-formats.rst | 18 +++ .../media/uapi/v4l/vidioc-enuminput.rst | 8 ++ .../media/uapi/v4l/vidioc-querycap.rst | 8 ++ .../media/videodev2.h.rst.exceptions | 2 + 12 files changed, 490 insertions(+), 7 deletions(-) create mode 100644 Documentation/media/uapi/v4l/dev-touch.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-tch-td08.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-tch-td16.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst create mode 100644 Documentation/media/uapi/v4l/tch-formats.rst diff --git a/Documentation/media/uapi/mediactl/media-types.rst b/Documentation/media/uapi/mediactl/media-types.rst index 20f99301bfdb..c3a23108b99d 100644 --- a/Documentation/media/uapi/mediactl/media-types.rst +++ b/Documentation/media/uapi/mediactl/media-types.rst @@ -437,6 +437,16 @@ Types and flags used to represent the media graph elements - .. row 11 + .. _MEDIA-INTF-T-V4L-TOUCH: + + - ``MEDIA_INTF_T_V4L_TOUCH`` + + - Device node interface for Touch device (V4L) + + - typically, /dev/v4l-touch? + + - .. row 12 + .. _MEDIA-INTF-T-ALSA-PCM-CAPTURE: - ``MEDIA_INTF_T_ALSA_PCM_CAPTURE`` @@ -445,7 +455,7 @@ Types and flags used to represent the media graph elements - typically, /dev/snd/pcmC?D?c - - .. row 12 + - .. row 13 .. _MEDIA-INTF-T-ALSA-PCM-PLAYBACK: @@ -455,7 +465,7 @@ Types and flags used to represent the media graph elements - typically, /dev/snd/pcmC?D?p - - .. row 13 + - .. row 14 .. _MEDIA-INTF-T-ALSA-CONTROL: @@ -465,7 +475,7 @@ Types and flags used to represent the media graph elements - typically, /dev/snd/controlC? - - .. row 14 + - .. row 15 .. _MEDIA-INTF-T-ALSA-COMPRESS: @@ -475,7 +485,7 @@ Types and flags used to represent the media graph elements - typically, /dev/snd/compr? - - .. row 15 + - .. row 16 .. _MEDIA-INTF-T-ALSA-RAWMIDI: @@ -485,7 +495,7 @@ Types and flags used to represent the media graph elements - typically, /dev/snd/midi? - - .. row 16 + - .. row 17 .. _MEDIA-INTF-T-ALSA-HWDEP: @@ -495,7 +505,7 @@ Types and flags used to represent the media graph elements - typically, /dev/snd/hwC?D? - - .. row 17 + - .. row 18 .. _MEDIA-INTF-T-ALSA-SEQUENCER: @@ -505,7 +515,7 @@ Types and flags used to represent the media graph elements - typically, /dev/snd/seq - - .. row 18 + - .. row 19 .. _MEDIA-INTF-T-ALSA-TIMER: diff --git a/Documentation/media/uapi/v4l/dev-touch.rst b/Documentation/media/uapi/v4l/dev-touch.rst new file mode 100644 index 000000000000..1f4e75243a47 --- /dev/null +++ b/Documentation/media/uapi/v4l/dev-touch.rst @@ -0,0 +1,56 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _touch: + +************* +Touch Devices +************* + +Touch devices are accessed through character device special files named +``/dev/v4l-touch0`` to ``/dev/v4l-touch255`` with major number 81 and +dynamically allocated minor numbers 0 to 255. + +Overview +======== + +Sensors may be Optical, or Projected Capacitive touch (PCT). + +Processing is required to analyse the raw data and produce input events. In +some systems, this may be performed on the ASIC and the raw data is purely a +side-channel for diagnostics or tuning. In other systems, the ASIC is a simple +analogue front end device which delivers touch data at high rate, and any touch +processing must be done on the host. + +For capacitive touch sensing, the touchscreen is composed of an array of +horizontal and vertical conductors (alternatively called rows/columns, X/Y +lines, or tx/rx). Mutual Capacitance measured is at the nodes where the +conductors cross. Alternatively, Self Capacitance measures the signal from each +column and row independently. + +A touch input may be determined by comparing the raw capacitance measurement to +a no-touch reference (or "baseline") measurement: + +Delta = Raw - Reference + +The reference measurement takes account of variations in the capacitance across +the touch sensor matrix, for example manufacturing irregularities, +environmental or edge effects. + +Querying Capabilities +===================== + +Devices supporting the touch interface set the ``V4L2_CAP_VIDEO_CAPTURE`` flag +and the ``V4L2_CAP_TOUCH`` flag in the ``capabilities`` field of +:ref:`v4l2_capability ` returned by the +:ref:`VIDIOC_QUERYCAP` ioctl. + +At least one of the read/write or streaming I/O methods must be +supported. + +The formats supported by touch devices are documented in +:ref:`Touch Formats `. + +Data Format Negotiation +======================= + +A touch device may support any I/O method. diff --git a/Documentation/media/uapi/v4l/devices.rst b/Documentation/media/uapi/v4l/devices.rst index aed0ce11d1f8..5c3d6c29e12c 100644 --- a/Documentation/media/uapi/v4l/devices.rst +++ b/Documentation/media/uapi/v4l/devices.rst @@ -22,5 +22,6 @@ Interfaces dev-radio dev-rds dev-sdr + dev-touch dev-event dev-subdev diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-td08.rst b/Documentation/media/uapi/v4l/pixfmt-tch-td08.rst new file mode 100644 index 000000000000..e1d1b75454cd --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-tch-td08.rst @@ -0,0 +1,80 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-TCH-FMT-DELTA-TD08: + +******************************** +V4L2_TCH_FMT_DELTA_TD08 ('TD08') +******************************** + +*man V4L2_TCH_FMT_DELTA_TD08(2)* + +8-bit signed Touch Delta + +Description +=========== + +This format represents delta data from a touch controller. + +Delta values may range from -128 to 127. Typically the values will vary through +a small range depending on whether the sensor is touched or not. The full value +may be seen if one of the touchscreen nodes has a fault or the line is not +connected. + +**Byte Order.** +Each cell is one byte. + + + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 2 1 1 1 1 + + + - .. row 1 + + - start + 0: + + - D'\ :sub:`00` + + - D'\ :sub:`01` + + - D'\ :sub:`02` + + - D'\ :sub:`03` + + - .. row 2 + + - start + 4: + + - D'\ :sub:`10` + + - D'\ :sub:`11` + + - D'\ :sub:`12` + + - D'\ :sub:`13` + + - .. row 3 + + - start + 8: + + - D'\ :sub:`20` + + - D'\ :sub:`21` + + - D'\ :sub:`22` + + - D'\ :sub:`23` + + - .. row 4 + + - start + 12: + + - D'\ :sub:`30` + + - D'\ :sub:`31` + + - D'\ :sub:`32` + + - D'\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst b/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst new file mode 100644 index 000000000000..dfbbc405f889 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst @@ -0,0 +1,111 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-TCH-FMT-DELTA-TD16: + +******************************** +V4L2_TCH_FMT_DELTA_TD16 ('TD16') +******************************** + +*man V4L2_TCH_FMT_DELTA_TD16(2)* + +16-bit signed Touch Delta + + +Description +=========== + +This format represents delta data from a touch controller. + +Delta values may range from -32768 to 32767. Typically the values will vary +through a small range depending on whether the sensor is touched or not. The +full value may be seen if one of the touchscreen nodes has a fault or the line +is not connected. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 2 1 1 1 1 1 1 1 1 + + + - .. row 1 + + - start + 0: + + - D'\ :sub:`00high` + + - D'\ :sub:`00low` + + - D'\ :sub:`01high` + + - D'\ :sub:`01low` + + - D'\ :sub:`02high` + + - D'\ :sub:`02low` + + - D'\ :sub:`03high` + + - D'\ :sub:`03low` + + - .. row 2 + + - start + 8: + + - D'\ :sub:`10high` + + - D'\ :sub:`10low` + + - D'\ :sub:`11high` + + - D'\ :sub:`11low` + + - D'\ :sub:`12high` + + - D'\ :sub:`12low` + + - D'\ :sub:`13high` + + - D'\ :sub:`13low` + + - .. row 3 + + - start + 16: + + - D'\ :sub:`20high` + + - D'\ :sub:`20low` + + - D'\ :sub:`21high` + + - D'\ :sub:`21low` + + - D'\ :sub:`22high` + + - D'\ :sub:`22low` + + - D'\ :sub:`23high` + + - D'\ :sub:`23low` + + - .. row 4 + + - start + 24: + + - D'\ :sub:`30high` + + - D'\ :sub:`30low` + + - D'\ :sub:`31high` + + - D'\ :sub:`31low` + + - D'\ :sub:`32high` + + - D'\ :sub:`32low` + + - D'\ :sub:`33high` + + - D'\ :sub:`33low` diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst b/Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst new file mode 100644 index 000000000000..18408afe39f5 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst @@ -0,0 +1,78 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-TCH-FMT-TU08: + +************************** +V4L2_TCH_FMT_TU08 ('TU08') +************************** + +*man V4L2_TCH_FMT_TU08(2)* + +8-bit unsigned raw touch data + +Description +=========== + +This format represents unsigned 8-bit data from a touch controller. + +This may be used for output for raw and reference data. Values may range from +0 to 255. + +**Byte Order.** +Each cell is one byte. + + + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 2 1 1 1 1 + + + - .. row 1 + + - start + 0: + + - R'\ :sub:`00` + + - R'\ :sub:`01` + + - R'\ :sub:`02` + + - R'\ :sub:`03` + + - .. row 2 + + - start + 4: + + - R'\ :sub:`10` + + - R'\ :sub:`11` + + - R'\ :sub:`12` + + - R'\ :sub:`13` + + - .. row 3 + + - start + 8: + + - R'\ :sub:`20` + + - R'\ :sub:`21` + + - R'\ :sub:`22` + + - R'\ :sub:`23` + + - .. row 4 + + - start + 12: + + - R'\ :sub:`30` + + - R'\ :sub:`31` + + - R'\ :sub:`32` + + - R'\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst b/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst new file mode 100644 index 000000000000..67be13d9e550 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst @@ -0,0 +1,110 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-TCH-FMT-TU16: + +******************************** +V4L2_TCH_FMT_TU16 ('TU16') +******************************** + +*man V4L2_TCH_FMT_TU16(2)* + +16-bit unsigned raw touch data + + +Description +=========== + +This format represents unsigned 16-bit data from a touch controller. + +This may be used for output for raw and reference data. Values may range from +0 to 65535. + +**Byte Order.** +Each cell is one byte. + + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 2 1 1 1 1 1 1 1 1 + + + - .. row 1 + + - start + 0: + + - R'\ :sub:`00high` + + - R'\ :sub:`00low` + + - R'\ :sub:`01high` + + - R'\ :sub:`01low` + + - R'\ :sub:`02high` + + - R'\ :sub:`02low` + + - R'\ :sub:`03high` + + - R'\ :sub:`03low` + + - .. row 2 + + - start + 8: + + - R'\ :sub:`10high` + + - R'\ :sub:`10low` + + - R'\ :sub:`11high` + + - R'\ :sub:`11low` + + - R'\ :sub:`12high` + + - R'\ :sub:`12low` + + - R'\ :sub:`13high` + + - R'\ :sub:`13low` + + - .. row 3 + + - start + 16: + + - R'\ :sub:`20high` + + - R'\ :sub:`20low` + + - R'\ :sub:`21high` + + - R'\ :sub:`21low` + + - R'\ :sub:`22high` + + - R'\ :sub:`22low` + + - R'\ :sub:`23high` + + - R'\ :sub:`23low` + + - .. row 4 + + - start + 24: + + - R'\ :sub:`30high` + + - R'\ :sub:`30low` + + - R'\ :sub:`31high` + + - R'\ :sub:`31low` + + - R'\ :sub:`32high` + + - R'\ :sub:`32low` + + - R'\ :sub:`33high` + + - R'\ :sub:`33low` diff --git a/Documentation/media/uapi/v4l/pixfmt.rst b/Documentation/media/uapi/v4l/pixfmt.rst index 81222a99f7ce..6866bcb7d229 100644 --- a/Documentation/media/uapi/v4l/pixfmt.rst +++ b/Documentation/media/uapi/v4l/pixfmt.rst @@ -32,4 +32,5 @@ see also :ref:`VIDIOC_G_FBUF `.) depth-formats pixfmt-013 sdr-formats + tch-formats pixfmt-reserved diff --git a/Documentation/media/uapi/v4l/tch-formats.rst b/Documentation/media/uapi/v4l/tch-formats.rst new file mode 100644 index 000000000000..dbaabf33a5b8 --- /dev/null +++ b/Documentation/media/uapi/v4l/tch-formats.rst @@ -0,0 +1,18 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _tch-formats: + +************* +Touch Formats +************* + +These formats are used for :ref:`touch` interface only. + + +.. toctree:: + :maxdepth: 1 + + pixfmt-tch-td16 + pixfmt-tch-td08 + pixfmt-tch-tu16 + pixfmt-tch-tu08 diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index 51747b7b7f29..8f6c603819d8 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -175,6 +175,14 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. - Analog baseband input, for example CVBS / Composite Video, S-Video, RGB. + - .. row 3 + + - ``V4L2_INPUT_TYPE_TOUCH`` + + - 3 + + - This input is a touch device for capturing raw touch data. + .. tabularcolumns:: |p{4.8cm}|p{2.6cm}|p{10.1cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index d627b80c4141..97a394bbcc9c 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -410,6 +410,14 @@ specification the ioctl returns an ``EINVAL`` error code. - .. row 26 + - ``V4L2_CAP_TOUCH`` + + - 0x10000000 + + - This is a touch device. + + - .. row 27 + - ``V4L2_CAP_DEVICE_CAPS`` - 0x80000000 diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions index 9bb9a6cc39d8..f0b243c48118 100644 --- a/Documentation/media/videodev2.h.rst.exceptions +++ b/Documentation/media/videodev2.h.rst.exceptions @@ -152,6 +152,7 @@ replace define V4L2_CAP_READWRITE device-capabilities replace define V4L2_CAP_ASYNCIO device-capabilities replace define V4L2_CAP_STREAMING device-capabilities replace define V4L2_CAP_DEVICE_CAPS device-capabilities +replace define V4L2_CAP_TOUCH device-capabilities # V4L2 pix flags replace define V4L2_PIX_FMT_PRIV_MAGIC v4l2-pix-format @@ -285,6 +286,7 @@ replace define V4L2_DV_BT_CAP_CUSTOM framebuffer-cap replace define V4L2_INPUT_TYPE_TUNER input-type replace define V4L2_INPUT_TYPE_CAMERA input-type +replace define V4L2_INPUT_TYPE_TOUCH input-type replace define V4L2_IN_ST_NO_POWER input-status replace define V4L2_IN_ST_NO_SIGNAL input-status From 563bf7a72eac823b06953cd3dce9b71b499fa438 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 31 Jul 2016 07:50:08 -0300 Subject: [PATCH 137/591] [media] tw686x-kh: remove obsolete driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The functionality that was part of the tw686x-kh driver but not of the mainlined tw686x driver has now been added to the tw686x driver as well. So this driver no longer adds any functionality not available through the mainlined driver and it can now be removed. Signed-off-by: Hans Verkuil Cc: Krzysztof Hałasa Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/Kconfig | 2 - drivers/staging/media/Makefile | 1 - drivers/staging/media/tw686x-kh/Kconfig | 17 - drivers/staging/media/tw686x-kh/Makefile | 3 - drivers/staging/media/tw686x-kh/TODO | 6 - .../staging/media/tw686x-kh/tw686x-kh-core.c | 140 --- .../staging/media/tw686x-kh/tw686x-kh-regs.h | 103 --- .../staging/media/tw686x-kh/tw686x-kh-video.c | 813 ------------------ drivers/staging/media/tw686x-kh/tw686x-kh.h | 117 --- 9 files changed, 1202 deletions(-) delete mode 100644 drivers/staging/media/tw686x-kh/Kconfig delete mode 100644 drivers/staging/media/tw686x-kh/Makefile delete mode 100644 drivers/staging/media/tw686x-kh/TODO delete mode 100644 drivers/staging/media/tw686x-kh/tw686x-kh-core.c delete mode 100644 drivers/staging/media/tw686x-kh/tw686x-kh-regs.h delete mode 100644 drivers/staging/media/tw686x-kh/tw686x-kh-video.c delete mode 100644 drivers/staging/media/tw686x-kh/tw686x-kh.h diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index 7292f23954df..53827778b414 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -31,8 +31,6 @@ source "drivers/staging/media/omap4iss/Kconfig" source "drivers/staging/media/pulse8-cec/Kconfig" -source "drivers/staging/media/tw686x-kh/Kconfig" - source "drivers/staging/media/s5p-cec/Kconfig" # Keep LIRC at the end, as it has sub-menus diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index 87ce8ad1e22a..6316e8c7a497 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile @@ -6,4 +6,3 @@ obj-$(CONFIG_LIRC_STAGING) += lirc/ obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/ -obj-$(CONFIG_VIDEO_TW686X_KH) += tw686x-kh/ diff --git a/drivers/staging/media/tw686x-kh/Kconfig b/drivers/staging/media/tw686x-kh/Kconfig deleted file mode 100644 index 6264d30edf5a..000000000000 --- a/drivers/staging/media/tw686x-kh/Kconfig +++ /dev/null @@ -1,17 +0,0 @@ -config VIDEO_TW686X_KH - tristate "Intersil/Techwell TW686x Video For Linux" - depends on VIDEO_DEV && PCI && VIDEO_V4L2 - depends on !(VIDEO_TW686X=y || VIDEO_TW686X=m) || COMPILE_TEST - select VIDEOBUF2_DMA_SG - help - Support for Intersil/Techwell TW686x-based frame grabber cards. - - Currently supported chips: - - TW6864 (4 video channels), - - TW6865 (4 video channels, not tested, second generation chip), - - TW6868 (8 video channels but only 4 first channels using - built-in video decoder are supported, not tested), - - TW6869 (8 video channels, second generation chip). - - To compile this driver as a module, choose M here: the module - will be named tw686x-kh. diff --git a/drivers/staging/media/tw686x-kh/Makefile b/drivers/staging/media/tw686x-kh/Makefile deleted file mode 100644 index 2a36a38cf30e..000000000000 --- a/drivers/staging/media/tw686x-kh/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -tw686x-kh-objs := tw686x-kh-core.o tw686x-kh-video.o - -obj-$(CONFIG_VIDEO_TW686X_KH) += tw686x-kh.o diff --git a/drivers/staging/media/tw686x-kh/TODO b/drivers/staging/media/tw686x-kh/TODO deleted file mode 100644 index 480a495b11fb..000000000000 --- a/drivers/staging/media/tw686x-kh/TODO +++ /dev/null @@ -1,6 +0,0 @@ -TODO: - -- implement V4L2_FIELD_INTERLACED* mode(s). -- add audio support - -Please Cc: patches to Krzysztof Halasa . diff --git a/drivers/staging/media/tw686x-kh/tw686x-kh-core.c b/drivers/staging/media/tw686x-kh/tw686x-kh-core.c deleted file mode 100644 index 03b3b62c59c4..000000000000 --- a/drivers/staging/media/tw686x-kh/tw686x-kh-core.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2015 Industrial Research Institute for Automation - * and Measurements PIAP - * - * Written by Krzysztof Ha?asa. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include "tw686x-kh.h" -#include "tw686x-kh-regs.h" - -static irqreturn_t tw686x_irq(int irq, void *dev_id) -{ - struct tw686x_dev *dev = (struct tw686x_dev *)dev_id; - u32 int_status = reg_read(dev, INT_STATUS); /* cleared on read */ - unsigned long flags; - unsigned int handled = 0; - - if (int_status) { - spin_lock_irqsave(&dev->irq_lock, flags); - dev->dma_requests |= int_status; - spin_unlock_irqrestore(&dev->irq_lock, flags); - - if (int_status & 0xFF0000FF) - handled = tw686x_kh_video_irq(dev); - } - - return IRQ_RETVAL(handled); -} - -static int tw686x_probe(struct pci_dev *pci_dev, - const struct pci_device_id *pci_id) -{ - struct tw686x_dev *dev; - int err; - - dev = devm_kzalloc(&pci_dev->dev, sizeof(*dev) + - (pci_id->driver_data & TYPE_MAX_CHANNELS) * - sizeof(dev->video_channels[0]), GFP_KERNEL); - if (!dev) - return -ENOMEM; - - sprintf(dev->name, "TW%04X", pci_dev->device); - dev->type = pci_id->driver_data; - - pr_info("%s: PCI %s, IRQ %d, MMIO 0x%lx\n", dev->name, - pci_name(pci_dev), pci_dev->irq, - (unsigned long)pci_resource_start(pci_dev, 0)); - - dev->pci_dev = pci_dev; - if (pcim_enable_device(pci_dev)) - return -EIO; - - pci_set_master(pci_dev); - - if (pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32))) { - pr_err("%s: 32-bit PCI DMA not supported\n", dev->name); - return -EIO; - } - - err = pci_request_regions(pci_dev, dev->name); - if (err < 0) { - pr_err("%s: Unable to get MMIO region\n", dev->name); - return err; - } - - dev->mmio = pci_ioremap_bar(pci_dev, 0); - if (!dev->mmio) { - pr_err("%s: Unable to remap MMIO region\n", dev->name); - return -EIO; - } - - reg_write(dev, SYS_SOFT_RST, 0x0F); /* Reset all subsystems */ - mdelay(1); - - reg_write(dev, SRST[0], 0x3F); - if (max_channels(dev) > 4) - reg_write(dev, SRST[1], 0x3F); - reg_write(dev, DMA_CMD, 0); - reg_write(dev, DMA_CHANNEL_ENABLE, 0); - reg_write(dev, DMA_CHANNEL_TIMEOUT, 0x3EFF0FF0); - reg_write(dev, DMA_TIMER_INTERVAL, 0x38000); - reg_write(dev, DMA_CONFIG, 0xFFFFFF04); - - spin_lock_init(&dev->irq_lock); - - err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw686x_irq, - IRQF_SHARED, dev->name, dev); - if (err < 0) { - pr_err("%s: Unable to get IRQ\n", dev->name); - return err; - } - - err = tw686x_kh_video_init(dev); - if (err) - return err; - - pci_set_drvdata(pci_dev, dev); - return 0; -} - -static void tw686x_remove(struct pci_dev *pci_dev) -{ - struct tw686x_dev *dev = pci_get_drvdata(pci_dev); - - tw686x_kh_video_free(dev); -} - -/* driver_data is number of A/V channels */ -static const struct pci_device_id tw686x_pci_tbl[] = { - {PCI_DEVICE(0x1797, 0x6864), .driver_data = 4}, - /* not tested */ - {PCI_DEVICE(0x1797, 0x6865), .driver_data = 4 | TYPE_SECOND_GEN}, - /* TW6868 supports 8 A/V channels with an external TW2865 chip - - not supported by the driver */ - {PCI_DEVICE(0x1797, 0x6868), .driver_data = 4}, /* not tested */ - {PCI_DEVICE(0x1797, 0x6869), .driver_data = 8 | TYPE_SECOND_GEN}, - {} -}; - -static struct pci_driver tw686x_pci_driver = { - .name = "tw686x-kh", - .id_table = tw686x_pci_tbl, - .probe = tw686x_probe, - .remove = tw686x_remove, -}; - -MODULE_DESCRIPTION("Driver for video frame grabber cards based on Intersil/Techwell TW686[4589]"); -MODULE_AUTHOR("Krzysztof Halasa"); -MODULE_LICENSE("GPL v2"); -MODULE_DEVICE_TABLE(pci, tw686x_pci_tbl); -module_pci_driver(tw686x_pci_driver); diff --git a/drivers/staging/media/tw686x-kh/tw686x-kh-regs.h b/drivers/staging/media/tw686x-kh/tw686x-kh-regs.h deleted file mode 100644 index 53e1889babd0..000000000000 --- a/drivers/staging/media/tw686x-kh/tw686x-kh-regs.h +++ /dev/null @@ -1,103 +0,0 @@ -/* DMA controller registers */ -#define REG8_1(a0) ((const u16[8]) {a0, a0 + 1, a0 + 2, a0 + 3, \ - a0 + 4, a0 + 5, a0 + 6, a0 + 7}) -#define REG8_2(a0) ((const u16[8]) {a0, a0 + 2, a0 + 4, a0 + 6, \ - a0 + 8, a0 + 0xA, a0 + 0xC, a0 + 0xE}) -#define REG8_8(a0) ((const u16[8]) {a0, a0 + 8, a0 + 0x10, a0 + 0x18, \ - a0 + 0x20, a0 + 0x28, a0 + 0x30, a0 + 0x38}) -#define INT_STATUS 0x00 -#define PB_STATUS 0x01 -#define DMA_CMD 0x02 -#define VIDEO_FIFO_STATUS 0x03 -#define VIDEO_CHANNEL_ID 0x04 -#define VIDEO_PARSER_STATUS 0x05 -#define SYS_SOFT_RST 0x06 -#define DMA_PAGE_TABLE0_ADDR ((const u16[8]) {0x08, 0xD0, 0xD2, 0xD4, \ - 0xD6, 0xD8, 0xDA, 0xDC}) -#define DMA_PAGE_TABLE1_ADDR ((const u16[8]) {0x09, 0xD1, 0xD3, 0xD5, \ - 0xD7, 0xD9, 0xDB, 0xDD}) -#define DMA_CHANNEL_ENABLE 0x0A -#define DMA_CONFIG 0x0B -#define DMA_TIMER_INTERVAL 0x0C -#define DMA_CHANNEL_TIMEOUT 0x0D -#define VDMA_CHANNEL_CONFIG REG8_1(0x10) -#define ADMA_P_ADDR REG8_2(0x18) -#define ADMA_B_ADDR REG8_2(0x19) -#define DMA10_P_ADDR 0x28 /* ??? */ -#define DMA10_B_ADDR 0x29 -#define VIDEO_CONTROL1 0x2A -#define VIDEO_CONTROL2 0x2B -#define AUDIO_CONTROL1 0x2C -#define AUDIO_CONTROL2 0x2D -#define PHASE_REF 0x2E -#define GPIO_REG 0x2F -#define INTL_HBAR_CTRL REG8_1(0x30) -#define AUDIO_CONTROL3 0x38 -#define VIDEO_FIELD_CTRL REG8_1(0x39) -#define HSCALER_CTRL REG8_1(0x42) -#define VIDEO_SIZE REG8_1(0x4A) -#define VIDEO_SIZE_F2 REG8_1(0x52) -#define MD_CONF REG8_1(0x60) -#define MD_INIT REG8_1(0x68) -#define MD_MAP0 REG8_1(0x70) -#define VDMA_P_ADDR REG8_8(0x80) /* not used in DMA SG mode */ -#define VDMA_WHP REG8_8(0x81) -#define VDMA_B_ADDR REG8_8(0x82) -#define VDMA_F2_P_ADDR REG8_8(0x84) -#define VDMA_F2_WHP REG8_8(0x85) -#define VDMA_F2_B_ADDR REG8_8(0x86) -#define EP_REG_ADDR 0xFE -#define EP_REG_DATA 0xFF - -/* Video decoder registers */ -#define VDREG8(a0) ((const u16[8]) { \ - a0 + 0x000, a0 + 0x010, a0 + 0x020, a0 + 0x030, \ - a0 + 0x100, a0 + 0x110, a0 + 0x120, a0 + 0x130}) -#define VIDSTAT VDREG8(0x100) -#define BRIGHT VDREG8(0x101) -#define CONTRAST VDREG8(0x102) -#define SHARPNESS VDREG8(0x103) -#define SAT_U VDREG8(0x104) -#define SAT_V VDREG8(0x105) -#define HUE VDREG8(0x106) -#define CROP_HI VDREG8(0x107) -#define VDELAY_LO VDREG8(0x108) -#define VACTIVE_LO VDREG8(0x109) -#define HDELAY_LO VDREG8(0x10A) -#define HACTIVE_LO VDREG8(0x10B) -#define MVSN VDREG8(0x10C) -#define STATUS2 VDREG8(0x10C) -#define SDT VDREG8(0x10E) -#define SDT_EN VDREG8(0x10F) - -#define VSCALE_LO VDREG8(0x144) -#define SCALE_HI VDREG8(0x145) -#define HSCALE_LO VDREG8(0x146) -#define F2CROP_HI VDREG8(0x147) -#define F2VDELAY_LO VDREG8(0x148) -#define F2VACTIVE_LO VDREG8(0x149) -#define F2HDELAY_LO VDREG8(0x14A) -#define F2HACTIVE_LO VDREG8(0x14B) -#define F2VSCALE_LO VDREG8(0x14C) -#define F2SCALE_HI VDREG8(0x14D) -#define F2HSCALE_LO VDREG8(0x14E) -#define F2CNT VDREG8(0x14F) - -#define VDREG2(a0) ((const u16[2]) {a0, a0 + 0x100}) -#define SRST VDREG2(0x180) -#define ACNTL VDREG2(0x181) -#define ACNTL2 VDREG2(0x182) -#define CNTRL1 VDREG2(0x183) -#define CKHY VDREG2(0x184) -#define SHCOR VDREG2(0x185) -#define CORING VDREG2(0x186) -#define CLMPG VDREG2(0x187) -#define IAGC VDREG2(0x188) -#define VCTRL1 VDREG2(0x18F) -#define MISC1 VDREG2(0x194) -#define LOOP VDREG2(0x195) -#define MISC2 VDREG2(0x196) - -#define CLMD VDREG2(0x197) -#define AIGAIN ((const u16[8]) {0x1D0, 0x1D1, 0x1D2, 0x1D3, \ - 0x2D0, 0x2D1, 0x2D2, 0x2D3}) diff --git a/drivers/staging/media/tw686x-kh/tw686x-kh-video.c b/drivers/staging/media/tw686x-kh/tw686x-kh-video.c deleted file mode 100644 index 9bf32aec2fc6..000000000000 --- a/drivers/staging/media/tw686x-kh/tw686x-kh-video.c +++ /dev/null @@ -1,813 +0,0 @@ -/* - * Copyright (C) 2015 Industrial Research Institute for Automation - * and Measurements PIAP - * - * Written by Krzysztof Ha?asa. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "tw686x-kh.h" -#include "tw686x-kh-regs.h" - -#define MAX_SG_ENTRY_SIZE (/* 8192 - 128 */ 4096) -#define MAX_SG_DESC_COUNT 256 /* PAL 704x576 needs up to 198 4-KB pages */ - -static const struct tw686x_format formats[] = { - { - .name = "4:2:2 packed, UYVY", /* aka Y422 */ - .fourcc = V4L2_PIX_FMT_UYVY, - .mode = 0, - .depth = 16, - }, { -#if 0 - .name = "4:2:0 packed, YUV", - .mode = 1, /* non-standard */ - .depth = 12, - }, { - .name = "4:1:1 packed, YUV", - .mode = 2, /* non-standard */ - .depth = 12, - }, { -#endif - .name = "4:1:1 packed, YUV", - .fourcc = V4L2_PIX_FMT_Y41P, - .mode = 3, - .depth = 12, - }, { - .name = "15 bpp RGB", - .fourcc = V4L2_PIX_FMT_RGB555, - .mode = 4, - .depth = 16, - }, { - .name = "16 bpp RGB", - .fourcc = V4L2_PIX_FMT_RGB565, - .mode = 5, - .depth = 16, - }, { - .name = "4:2:2 packed, YUYV", - .fourcc = V4L2_PIX_FMT_YUYV, - .mode = 6, - .depth = 16, - } - /* mode 7 is "reserved" */ -}; - -static const v4l2_std_id video_standards[7] = { - V4L2_STD_NTSC, - V4L2_STD_PAL, - V4L2_STD_SECAM, - V4L2_STD_NTSC_443, - V4L2_STD_PAL_M, - V4L2_STD_PAL_N, - V4L2_STD_PAL_60, -}; - -static const struct tw686x_format *format_by_fourcc(unsigned int fourcc) -{ - unsigned int cnt; - - for (cnt = 0; cnt < ARRAY_SIZE(formats); cnt++) - if (formats[cnt].fourcc == fourcc) - return &formats[cnt]; - return NULL; -} - -static void tw686x_get_format(struct tw686x_video_channel *vc, - struct v4l2_format *f) -{ - const struct tw686x_format *format; - unsigned int width, height, height_div = 1; - - format = format_by_fourcc(f->fmt.pix.pixelformat); - if (!format) { - format = &formats[0]; - f->fmt.pix.pixelformat = format->fourcc; - } - - width = 704; - if (f->fmt.pix.width < width * 3 / 4 /* halfway */) - width /= 2; - - height = (vc->video_standard & V4L2_STD_625_50) ? 576 : 480; - if (f->fmt.pix.height < height * 3 / 4 /* halfway */) - height_div = 2; - - switch (f->fmt.pix.field) { - case V4L2_FIELD_TOP: - case V4L2_FIELD_BOTTOM: - height_div = 2; - break; - case V4L2_FIELD_SEQ_BT: - if (height_div > 1) - f->fmt.pix.field = V4L2_FIELD_BOTTOM; - break; - default: - if (height_div > 1) - f->fmt.pix.field = V4L2_FIELD_TOP; - else - f->fmt.pix.field = V4L2_FIELD_SEQ_TB; - } - height /= height_div; - - f->fmt.pix.width = width; - f->fmt.pix.height = height; - f->fmt.pix.bytesperline = f->fmt.pix.width * format->depth / 8; - f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; - f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; -} - -/* video queue operations */ - -static int tw686x_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, - unsigned int *nplanes, unsigned int sizes[], - struct device *alloc_devs[]) -{ - struct tw686x_video_channel *vc = vb2_get_drv_priv(vq); - unsigned int size = vc->width * vc->height * vc->format->depth / 8; - - if (*nbuffers < 2) - *nbuffers = 2; - - if (*nplanes) - return sizes[0] < size ? -EINVAL : 0; - - sizes[0] = size; - *nplanes = 1; /* packed formats only */ - return 0; -} - -static void tw686x_buf_queue(struct vb2_buffer *vb) -{ - struct tw686x_video_channel *vc = vb2_get_drv_priv(vb->vb2_queue); - struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); - struct tw686x_vb2_buf *buf; - - buf = container_of(vbuf, struct tw686x_vb2_buf, vb); - - spin_lock(&vc->qlock); - list_add_tail(&buf->list, &vc->vidq_queued); - spin_unlock(&vc->qlock); -} - -static void setup_descs(struct tw686x_video_channel *vc, unsigned int n) -{ -loop: - while (!list_empty(&vc->vidq_queued)) { - struct vdma_desc *descs = vc->sg_descs[n]; - struct tw686x_vb2_buf *buf; - struct sg_table *vbuf; - struct scatterlist *sg; - unsigned int buf_len, count = 0; - int i; - - buf = list_first_entry(&vc->vidq_queued, struct tw686x_vb2_buf, - list); - list_del(&buf->list); - - buf_len = vc->width * vc->height * vc->format->depth / 8; - if (vb2_plane_size(&buf->vb.vb2_buf, 0) < buf_len) { - pr_err("Video buffer size too small\n"); - vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); - goto loop; /* try another */ - } - - vbuf = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0); - for_each_sg(vbuf->sgl, sg, vbuf->nents, i) { - dma_addr_t phys = sg_dma_address(sg); - unsigned int len = sg_dma_len(sg); - - while (len && buf_len) { - unsigned int entry_len = min_t(unsigned int, len, - MAX_SG_ENTRY_SIZE); - entry_len = min(entry_len, buf_len); - if (count == MAX_SG_DESC_COUNT) { - pr_err("Video buffer size too fragmented\n"); - vb2_buffer_done(&buf->vb.vb2_buf, - VB2_BUF_STATE_ERROR); - goto loop; - } - descs[count].phys = cpu_to_le32(phys); - descs[count++].flags_length = - cpu_to_le32(0x40000000 /* available */ | - entry_len); - phys += entry_len; - len -= entry_len; - buf_len -= entry_len; - } - if (!buf_len) - break; - } - - /* clear the remaining entries */ - while (count < MAX_SG_DESC_COUNT) { - descs[count].phys = 0; - descs[count++].flags_length = 0; /* unavailable */ - } - - buf->vb.vb2_buf.state = VB2_BUF_STATE_ACTIVE; - vc->curr_bufs[n] = buf; - return; - } - vc->curr_bufs[n] = NULL; -} - -/* On TW6864 and TW6868, all channels share the pair of video DMA SG tables, - with 10-bit start_idx and end_idx determining start and end of frame buffer - for particular channel. - TW6868 with all its 8 channels would be problematic (only 127 SG entries per - channel) but we support only 4 channels on this chip anyway (the first - 4 channels are driven with internal video decoder, the other 4 would require - an external TW286x part). - - On TW6865 and TW6869, each channel has its own DMA SG table, with indexes - starting with 0. Both chips have complete sets of internal video decoders - (respectively 4 or 8-channel). - - All chips have separate SG tables for two video frames. */ - -static void setup_dma_cfg(struct tw686x_video_channel *vc) -{ - unsigned int field_width = 704; - unsigned int field_height = (vc->video_standard & V4L2_STD_625_50) ? - 288 : 240; - unsigned int start_idx = is_second_gen(vc->dev) ? 0 : - vc->ch * MAX_SG_DESC_COUNT; - unsigned int end_idx = start_idx + MAX_SG_DESC_COUNT - 1; - u32 dma_cfg = (0 << 30) /* input selection */ | - (1 << 29) /* field2 dropped (if any) */ | - ((vc->height < 300) << 28) /* field dropping */ | - (1 << 27) /* master */ | - (0 << 25) /* master channel (for slave only) */ | - (0 << 24) /* (no) vertical (line) decimation */ | - ((vc->width < 400) << 23) /* horizontal decimation */ | - (vc->format->mode << 20) /* output video format */ | - (end_idx << 10) /* DMA end index */ | - start_idx /* DMA start index */; - u32 reg; - - reg_write(vc->dev, VDMA_CHANNEL_CONFIG[vc->ch], dma_cfg); - reg_write(vc->dev, VIDEO_SIZE[vc->ch], (1 << 31) | (field_height << 16) - | field_width); - reg = reg_read(vc->dev, VIDEO_CONTROL1); - if (vc->video_standard & V4L2_STD_625_50) - reg |= 1 << (vc->ch + 13); - else - reg &= ~(1 << (vc->ch + 13)); - reg_write(vc->dev, VIDEO_CONTROL1, reg); -} - -static int tw686x_start_streaming(struct vb2_queue *vq, unsigned int count) -{ - struct tw686x_video_channel *vc = vb2_get_drv_priv(vq); - struct tw686x_dev *dev = vc->dev; - u32 dma_ch_mask; - unsigned int n; - - setup_dma_cfg(vc); - - /* queue video buffers if available */ - spin_lock(&vc->qlock); - for (n = 0; n < 2; n++) - setup_descs(vc, n); - spin_unlock(&vc->qlock); - - dev->video_active |= 1 << vc->ch; - vc->seq = 0; - dma_ch_mask = reg_read(dev, DMA_CHANNEL_ENABLE) | (1 << vc->ch); - reg_write(dev, DMA_CHANNEL_ENABLE, dma_ch_mask); - reg_write(dev, DMA_CMD, (1 << 31) | dma_ch_mask); - return 0; -} - -static void tw686x_stop_streaming(struct vb2_queue *vq) -{ - struct tw686x_video_channel *vc = vb2_get_drv_priv(vq); - struct tw686x_dev *dev = vc->dev; - u32 dma_ch_mask = reg_read(dev, DMA_CHANNEL_ENABLE); - u32 dma_cmd = reg_read(dev, DMA_CMD); - unsigned int n; - - dma_ch_mask &= ~(1 << vc->ch); - reg_write(dev, DMA_CHANNEL_ENABLE, dma_ch_mask); - - dev->video_active &= ~(1 << vc->ch); - - dma_cmd &= ~(1 << vc->ch); - reg_write(dev, DMA_CMD, dma_cmd); - - if (!dev->video_active) { - reg_write(dev, DMA_CMD, 0); - reg_write(dev, DMA_CHANNEL_ENABLE, 0); - } - - spin_lock(&vc->qlock); - while (!list_empty(&vc->vidq_queued)) { - struct tw686x_vb2_buf *buf; - - buf = list_entry(vc->vidq_queued.next, struct tw686x_vb2_buf, - list); - list_del(&buf->list); - vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); - } - - for (n = 0; n < 2; n++) - if (vc->curr_bufs[n]) - vb2_buffer_done(&vc->curr_bufs[n]->vb.vb2_buf, - VB2_BUF_STATE_ERROR); - - spin_unlock(&vc->qlock); -} - -static struct vb2_ops tw686x_video_qops = { - .queue_setup = tw686x_queue_setup, - .buf_queue = tw686x_buf_queue, - .start_streaming = tw686x_start_streaming, - .stop_streaming = tw686x_stop_streaming, - .wait_prepare = vb2_ops_wait_prepare, - .wait_finish = vb2_ops_wait_finish, -}; - -static int tw686x_s_ctrl(struct v4l2_ctrl *ctrl) -{ - struct tw686x_video_channel *vc; - struct tw686x_dev *dev; - unsigned int ch; - - vc = container_of(ctrl->handler, struct tw686x_video_channel, - ctrl_handler); - dev = vc->dev; - ch = vc->ch; - - switch (ctrl->id) { - case V4L2_CID_BRIGHTNESS: - reg_write(dev, BRIGHT[ch], ctrl->val & 0xFF); - return 0; - - case V4L2_CID_CONTRAST: - reg_write(dev, CONTRAST[ch], ctrl->val); - return 0; - - case V4L2_CID_SATURATION: - reg_write(dev, SAT_U[ch], ctrl->val); - reg_write(dev, SAT_V[ch], ctrl->val); - return 0; - - case V4L2_CID_HUE: - reg_write(dev, HUE[ch], ctrl->val & 0xFF); - return 0; - } - - return -EINVAL; -} - -static const struct v4l2_ctrl_ops ctrl_ops = { - .s_ctrl = tw686x_s_ctrl, -}; - -static int tw686x_g_fmt_vid_cap(struct file *file, void *priv, - struct v4l2_format *f) -{ - struct tw686x_video_channel *vc = video_drvdata(file); - - f->fmt.pix.width = vc->width; - f->fmt.pix.height = vc->height; - f->fmt.pix.field = vc->field; - f->fmt.pix.pixelformat = vc->format->fourcc; - f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; - f->fmt.pix.bytesperline = f->fmt.pix.width * vc->format->depth / 8; - f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; - return 0; -} - -static int tw686x_try_fmt_vid_cap(struct file *file, void *priv, - struct v4l2_format *f) -{ - tw686x_get_format(video_drvdata(file), f); - return 0; -} - -static int tw686x_s_fmt_vid_cap(struct file *file, void *priv, - struct v4l2_format *f) -{ - struct tw686x_video_channel *vc = video_drvdata(file); - - tw686x_get_format(vc, f); - vc->format = format_by_fourcc(f->fmt.pix.pixelformat); - vc->field = f->fmt.pix.field; - vc->width = f->fmt.pix.width; - vc->height = f->fmt.pix.height; - return 0; -} - -static int tw686x_querycap(struct file *file, void *priv, - struct v4l2_capability *cap) -{ - struct tw686x_video_channel *vc = video_drvdata(file); - struct tw686x_dev *dev = vc->dev; - - strcpy(cap->driver, "tw686x-kh"); - strcpy(cap->card, dev->name); - sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci_dev)); - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; - return 0; -} - -static int tw686x_s_std(struct file *file, void *priv, v4l2_std_id id) -{ - struct tw686x_video_channel *vc = video_drvdata(file); - unsigned int cnt; - u32 sdt = 0; /* default */ - - for (cnt = 0; cnt < ARRAY_SIZE(video_standards); cnt++) - if (id & video_standards[cnt]) { - sdt = cnt; - break; - } - - reg_write(vc->dev, SDT[vc->ch], sdt); - vc->video_standard = video_standards[sdt]; - return 0; -} - -static int tw686x_g_std(struct file *file, void *priv, v4l2_std_id *id) -{ - struct tw686x_video_channel *vc = video_drvdata(file); - - *id = vc->video_standard; - return 0; -} - -static int tw686x_enum_fmt_vid_cap(struct file *file, void *priv, - struct v4l2_fmtdesc *f) -{ - if (f->index >= ARRAY_SIZE(formats)) - return -EINVAL; - - strlcpy(f->description, formats[f->index].name, sizeof(f->description)); - f->pixelformat = formats[f->index].fourcc; - return 0; -} - -static int tw686x_g_parm(struct file *file, void *priv, - struct v4l2_streamparm *sp) -{ - struct tw686x_video_channel *vc = video_drvdata(file); - - if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - memset(&sp->parm.capture, 0, sizeof(sp->parm.capture)); - sp->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; - v4l2_video_std_frame_period(vc->video_standard, - &sp->parm.capture.timeperframe); - - return 0; -} - -static int tw686x_enum_input(struct file *file, void *priv, - struct v4l2_input *inp) -{ - /* the chip has internal multiplexer, support can be added - if the actual hw uses it */ - if (inp->index) - return -EINVAL; - - snprintf(inp->name, sizeof(inp->name), "Composite"); - inp->type = V4L2_INPUT_TYPE_CAMERA; - inp->std = V4L2_STD_ALL; - inp->capabilities = V4L2_IN_CAP_STD; - return 0; -} - -static int tw686x_g_input(struct file *file, void *priv, unsigned int *v) -{ - *v = 0; - return 0; -} - -static int tw686x_s_input(struct file *file, void *priv, unsigned int v) -{ - if (v) - return -EINVAL; - return 0; -} - -static const struct v4l2_file_operations tw686x_video_fops = { - .owner = THIS_MODULE, - .open = v4l2_fh_open, - .unlocked_ioctl = video_ioctl2, - .release = vb2_fop_release, - .poll = vb2_fop_poll, - .read = vb2_fop_read, - .mmap = vb2_fop_mmap, -}; - -static const struct v4l2_ioctl_ops tw686x_video_ioctl_ops = { - .vidioc_querycap = tw686x_querycap, - .vidioc_enum_fmt_vid_cap = tw686x_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = tw686x_g_fmt_vid_cap, - .vidioc_s_fmt_vid_cap = tw686x_s_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = tw686x_try_fmt_vid_cap, - .vidioc_reqbufs = vb2_ioctl_reqbufs, - .vidioc_querybuf = vb2_ioctl_querybuf, - .vidioc_qbuf = vb2_ioctl_qbuf, - .vidioc_dqbuf = vb2_ioctl_dqbuf, - .vidioc_create_bufs = vb2_ioctl_create_bufs, - .vidioc_streamon = vb2_ioctl_streamon, - .vidioc_streamoff = vb2_ioctl_streamoff, - .vidioc_g_std = tw686x_g_std, - .vidioc_s_std = tw686x_s_std, - .vidioc_g_parm = tw686x_g_parm, - .vidioc_enum_input = tw686x_enum_input, - .vidioc_g_input = tw686x_g_input, - .vidioc_s_input = tw686x_s_input, - .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, - .vidioc_unsubscribe_event = v4l2_event_unsubscribe, -}; - -static int video_thread(void *arg) -{ - struct tw686x_dev *dev = arg; - DECLARE_WAITQUEUE(wait, current); - - set_freezable(); - add_wait_queue(&dev->video_thread_wait, &wait); - - while (1) { - long timeout = schedule_timeout_interruptible(HZ); - unsigned int ch; - - if (timeout == -ERESTARTSYS || kthread_should_stop()) - break; - - for (ch = 0; ch < max_channels(dev); ch++) { - struct tw686x_video_channel *vc; - unsigned long flags; - u32 request, n, stat = VB2_BUF_STATE_DONE; - - vc = &dev->video_channels[ch]; - if (!(dev->video_active & (1 << ch))) - continue; - - spin_lock_irq(&dev->irq_lock); - request = dev->dma_requests & (0x01000001 << ch); - if (request) - dev->dma_requests &= ~request; - spin_unlock_irq(&dev->irq_lock); - - if (!request) - continue; - - request >>= ch; - - /* handle channel events */ - if ((request & 0x01000000) | - (reg_read(dev, VIDEO_FIFO_STATUS) & (0x01010001 << ch)) | - (reg_read(dev, VIDEO_PARSER_STATUS) & (0x00000101 << ch))) { - /* DMA Errors - reset channel */ - u32 reg; - - spin_lock_irqsave(&dev->irq_lock, flags); - reg = reg_read(dev, DMA_CMD); - /* Reset DMA channel */ - reg_write(dev, DMA_CMD, reg & ~(1 << ch)); - reg_write(dev, DMA_CMD, reg); - spin_unlock_irqrestore(&dev->irq_lock, flags); - stat = VB2_BUF_STATE_ERROR; - } - - /* handle video stream */ - mutex_lock(&vc->vb_mutex); - spin_lock(&vc->qlock); - n = !!(reg_read(dev, PB_STATUS) & (1 << ch)); - if (vc->curr_bufs[n]) { - struct vb2_v4l2_buffer *vb; - - vb = &vc->curr_bufs[n]->vb; - vb->vb2_buf.timestamp = ktime_get_ns(); - vb->field = vc->field; - if (V4L2_FIELD_HAS_BOTH(vc->field)) - vb->sequence = vc->seq++; - else - vb->sequence = (vc->seq++) / 2; - vb2_set_plane_payload(&vb->vb2_buf, 0, - vc->width * vc->height * vc->format->depth / 8); - vb2_buffer_done(&vb->vb2_buf, stat); - } - setup_descs(vc, n); - spin_unlock(&vc->qlock); - mutex_unlock(&vc->vb_mutex); - } - try_to_freeze(); - } - - remove_wait_queue(&dev->video_thread_wait, &wait); - return 0; -} - -int tw686x_kh_video_irq(struct tw686x_dev *dev) -{ - unsigned long flags, handled = 0; - u32 requests; - - spin_lock_irqsave(&dev->irq_lock, flags); - requests = dev->dma_requests; - spin_unlock_irqrestore(&dev->irq_lock, flags); - - if (requests & dev->video_active) { - wake_up_interruptible_all(&dev->video_thread_wait); - handled = 1; - } - return handled; -} - -void tw686x_kh_video_free(struct tw686x_dev *dev) -{ - unsigned int ch, n; - - if (dev->video_thread) - kthread_stop(dev->video_thread); - - for (ch = 0; ch < max_channels(dev); ch++) { - struct tw686x_video_channel *vc = &dev->video_channels[ch]; - - v4l2_ctrl_handler_free(&vc->ctrl_handler); - if (vc->device) - video_unregister_device(vc->device); - for (n = 0; n < 2; n++) { - struct dma_desc *descs = &vc->sg_tables[n]; - - if (descs->virt) - pci_free_consistent(dev->pci_dev, descs->size, - descs->virt, descs->phys); - } - } - - v4l2_device_unregister(&dev->v4l2_dev); -} - -#define SG_TABLE_SIZE (MAX_SG_DESC_COUNT * sizeof(struct vdma_desc)) - -int tw686x_kh_video_init(struct tw686x_dev *dev) -{ - unsigned int ch, n; - int err; - - init_waitqueue_head(&dev->video_thread_wait); - - err = v4l2_device_register(&dev->pci_dev->dev, &dev->v4l2_dev); - if (err) - return err; - - reg_write(dev, VIDEO_CONTROL1, 0); /* NTSC, disable scaler */ - reg_write(dev, PHASE_REF, 0x00001518); /* Scatter-gather DMA mode */ - - /* setup required SG table sizes */ - for (n = 0; n < 2; n++) - if (is_second_gen(dev)) { - /* TW 6865, TW6869 - each channel needs a pair of - descriptor tables */ - for (ch = 0; ch < max_channels(dev); ch++) - dev->video_channels[ch].sg_tables[n].size = - SG_TABLE_SIZE; - - } else - /* TW 6864, TW6868 - we need to allocate a pair of - descriptor tables, common for all channels. - Each table will be bigger than 4 KB. */ - dev->video_channels[0].sg_tables[n].size = - max_channels(dev) * SG_TABLE_SIZE; - - /* allocate SG tables and initialize video channels */ - for (ch = 0; ch < max_channels(dev); ch++) { - struct tw686x_video_channel *vc = &dev->video_channels[ch]; - struct video_device *vdev; - - mutex_init(&vc->vb_mutex); - spin_lock_init(&vc->qlock); - INIT_LIST_HEAD(&vc->vidq_queued); - - vc->dev = dev; - vc->ch = ch; - - /* default settings: NTSC */ - vc->format = &formats[0]; - vc->video_standard = V4L2_STD_NTSC; - reg_write(vc->dev, SDT[vc->ch], 0); - vc->field = V4L2_FIELD_SEQ_BT; - vc->width = 704; - vc->height = 480; - - for (n = 0; n < 2; n++) { - void *cpu; - - if (vc->sg_tables[n].size) { - unsigned int reg = n ? DMA_PAGE_TABLE1_ADDR[ch] : - DMA_PAGE_TABLE0_ADDR[ch]; - - cpu = pci_alloc_consistent(dev->pci_dev, - vc->sg_tables[n].size, - &vc->sg_tables[n].phys); - if (!cpu) { - pr_err("Error allocating video DMA scatter-gather tables\n"); - err = -ENOMEM; - goto error; - } - vc->sg_tables[n].virt = cpu; - reg_write(dev, reg, vc->sg_tables[n].phys); - } else - cpu = dev->video_channels[0].sg_tables[n].virt + - ch * SG_TABLE_SIZE; - - vc->sg_descs[n] = cpu; - } - - reg_write(dev, VCTRL1[0], 0x24); - reg_write(dev, LOOP[0], 0xA5); - if (max_channels(dev) > 4) { - reg_write(dev, VCTRL1[1], 0x24); - reg_write(dev, LOOP[1], 0xA5); - } - reg_write(dev, VIDEO_FIELD_CTRL[ch], 0); - reg_write(dev, VDELAY_LO[ch], 0x14); - - vdev = video_device_alloc(); - if (!vdev) { - pr_warn("Unable to allocate video device\n"); - err = -ENOMEM; - goto error; - } - - vc->vidq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - vc->vidq.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; - vc->vidq.drv_priv = vc; - vc->vidq.buf_struct_size = sizeof(struct tw686x_vb2_buf); - vc->vidq.ops = &tw686x_video_qops; - vc->vidq.mem_ops = &vb2_dma_sg_memops; - vc->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - vc->vidq.min_buffers_needed = 2; - vc->vidq.lock = &vc->vb_mutex; - vc->vidq.dev = &dev->pci_dev->dev; - vc->vidq.gfp_flags = GFP_DMA32; - - err = vb2_queue_init(&vc->vidq); - if (err) - goto error; - - strcpy(vdev->name, "TW686x-video"); - snprintf(vdev->name, sizeof(vdev->name), "%s video", dev->name); - vdev->fops = &tw686x_video_fops; - vdev->ioctl_ops = &tw686x_video_ioctl_ops; - vdev->release = video_device_release; - vdev->v4l2_dev = &dev->v4l2_dev; - vdev->queue = &vc->vidq; - vdev->tvnorms = V4L2_STD_ALL; - vdev->minor = -1; - vdev->lock = &vc->vb_mutex; - - dev->video_channels[ch].device = vdev; - video_set_drvdata(vdev, vc); - err = video_register_device(vdev, VFL_TYPE_GRABBER, -1); - if (err < 0) - goto error; - - v4l2_ctrl_handler_init(&vc->ctrl_handler, - 4 /* number of controls */); - vdev->ctrl_handler = &vc->ctrl_handler; - v4l2_ctrl_new_std(&vc->ctrl_handler, &ctrl_ops, - V4L2_CID_BRIGHTNESS, -128, 127, 1, 0); - v4l2_ctrl_new_std(&vc->ctrl_handler, &ctrl_ops, - V4L2_CID_CONTRAST, 0, 255, 1, 64); - v4l2_ctrl_new_std(&vc->ctrl_handler, &ctrl_ops, - V4L2_CID_SATURATION, 0, 255, 1, 128); - v4l2_ctrl_new_std(&vc->ctrl_handler, &ctrl_ops, V4L2_CID_HUE, - -124, 127, 1, 0); - err = vc->ctrl_handler.error; - if (err) - goto error; - - v4l2_ctrl_handler_setup(&vc->ctrl_handler); - } - - dev->video_thread = kthread_run(video_thread, dev, "tw686x_video"); - if (IS_ERR(dev->video_thread)) { - err = PTR_ERR(dev->video_thread); - goto error; - } - - return 0; - -error: - tw686x_kh_video_free(dev); - return err; -} diff --git a/drivers/staging/media/tw686x-kh/tw686x-kh.h b/drivers/staging/media/tw686x-kh/tw686x-kh.h deleted file mode 100644 index 6284a90d6fe3..000000000000 --- a/drivers/staging/media/tw686x-kh/tw686x-kh.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2015 Industrial Research Institute for Automation - * and Measurements PIAP - * - * Written by Krzysztof Ha?asa. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TYPE_MAX_CHANNELS 0x0F -#define TYPE_SECOND_GEN 0x10 - -struct tw686x_format { - char *name; - unsigned int fourcc; - unsigned int depth; - unsigned int mode; -}; - -struct dma_desc { - dma_addr_t phys; - void *virt; - unsigned int size; -}; - -struct vdma_desc { - __le32 flags_length; /* 3 MSBits for flags, 13 LSBits for length */ - __le32 phys; -}; - -struct tw686x_vb2_buf { - struct vb2_v4l2_buffer vb; - struct list_head list; -}; - -struct tw686x_video_channel { - struct tw686x_dev *dev; - - struct vb2_queue vidq; - struct list_head vidq_queued; - struct video_device *device; - struct dma_desc sg_tables[2]; - struct tw686x_vb2_buf *curr_bufs[2]; - struct vdma_desc *sg_descs[2]; - - struct v4l2_ctrl_handler ctrl_handler; - const struct tw686x_format *format; - struct mutex vb_mutex; - spinlock_t qlock; - v4l2_std_id video_standard; - unsigned int width, height; - enum v4l2_field field; /* supported TOP, BOTTOM, SEQ_TB and SEQ_BT */ - unsigned int seq; /* video field or frame counter */ - unsigned int ch; -}; - -/* global device status */ -struct tw686x_dev { - spinlock_t irq_lock; - - struct v4l2_device v4l2_dev; - struct snd_card *card; /* sound card */ - - unsigned int video_active; /* active video channel mask */ - - char name[32]; - unsigned int type; - struct pci_dev *pci_dev; - __u32 __iomem *mmio; - - struct task_struct *video_thread; - wait_queue_head_t video_thread_wait; - u32 dma_requests; - - struct tw686x_video_channel video_channels[0]; -}; - -static inline uint32_t reg_read(struct tw686x_dev *dev, unsigned int reg) -{ - return readl(dev->mmio + reg); -} - -static inline void reg_write(struct tw686x_dev *dev, unsigned int reg, - uint32_t value) -{ - writel(value, dev->mmio + reg); -} - -static inline unsigned int max_channels(struct tw686x_dev *dev) -{ - return dev->type & TYPE_MAX_CHANNELS; /* 4 or 8 channels */ -} - -static inline unsigned int is_second_gen(struct tw686x_dev *dev) -{ - /* each channel has its own DMA SG table */ - return dev->type & TYPE_SECOND_GEN; -} - -int tw686x_kh_video_irq(struct tw686x_dev *dev); -int tw686x_kh_video_init(struct tw686x_dev *dev); -void tw686x_kh_video_free(struct tw686x_dev *dev); From f304562ed3c97e237a77b3da57b0e43f264bd82a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 31 Jul 2016 08:12:22 -0300 Subject: [PATCH 138/591] [media] soc-camera/sh_mobile_csi2: remove unused driver The sh_mobile_csi2 isn't used anymore (was it ever?), so remove it. Especially since the soc-camera framework is being deprecated. Signed-off-by: Hans Verkuil Acked-by: Laurent Pinchart Cc: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/soc_camera/Kconfig | 7 - drivers/media/platform/soc_camera/Makefile | 1 - .../soc_camera/sh_mobile_ceu_camera.c | 229 +--------- .../platform/soc_camera/sh_mobile_csi2.c | 400 ------------------ include/media/drv-intf/sh_mobile_ceu.h | 1 - include/media/drv-intf/sh_mobile_csi2.h | 48 --- 6 files changed, 10 insertions(+), 676 deletions(-) delete mode 100644 drivers/media/platform/soc_camera/sh_mobile_csi2.c delete mode 100644 include/media/drv-intf/sh_mobile_csi2.h diff --git a/drivers/media/platform/soc_camera/Kconfig b/drivers/media/platform/soc_camera/Kconfig index 39f66414f621..99cf471a5fc0 100644 --- a/drivers/media/platform/soc_camera/Kconfig +++ b/drivers/media/platform/soc_camera/Kconfig @@ -35,13 +35,6 @@ config VIDEO_RCAR_VIN_OLD ---help--- This is a v4l2 driver for the R-Car VIN Interface -config VIDEO_SH_MOBILE_CSI2 - tristate "SuperH Mobile MIPI CSI-2 Interface driver" - depends on VIDEO_DEV && SOC_CAMERA && HAVE_CLK - depends on ARCH_SHMOBILE || SUPERH || COMPILE_TEST - ---help--- - This is a v4l2 driver for the SuperH MIPI CSI-2 Interface - config VIDEO_SH_MOBILE_CEU tristate "SuperH Mobile CEU Interface driver" depends on VIDEO_DEV && SOC_CAMERA && HAS_DMA && HAVE_CLK diff --git a/drivers/media/platform/soc_camera/Makefile b/drivers/media/platform/soc_camera/Makefile index 7703cb7ce456..ee8f9a4ae2a4 100644 --- a/drivers/media/platform/soc_camera/Makefile +++ b/drivers/media/platform/soc_camera/Makefile @@ -9,5 +9,4 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o -obj-$(CONFIG_VIDEO_SH_MOBILE_CSI2) += sh_mobile_csi2.o obj-$(CONFIG_VIDEO_RCAR_VIN_OLD) += rcar_vin.o diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 02b519dde42a..05eafe3a421e 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -99,11 +98,6 @@ struct sh_mobile_ceu_buffer { struct sh_mobile_ceu_dev { struct soc_camera_host ici; - /* Asynchronous CSI2 linking */ - struct v4l2_async_subdev *csi2_asd; - struct v4l2_subdev *csi2_sd; - /* Synchronous probing compatibility */ - struct platform_device *csi2_pdev; unsigned int irq; void __iomem *base; @@ -517,74 +511,20 @@ out: return IRQ_HANDLED; } -static struct v4l2_subdev *find_csi2(struct sh_mobile_ceu_dev *pcdev) -{ - struct v4l2_subdev *sd; - - if (pcdev->csi2_sd) - return pcdev->csi2_sd; - - if (pcdev->csi2_asd) { - char name[] = "sh-mobile-csi2"; - v4l2_device_for_each_subdev(sd, &pcdev->ici.v4l2_dev) - if (!strncmp(name, sd->name, sizeof(name) - 1)) { - pcdev->csi2_sd = sd; - return sd; - } - } - - return NULL; -} - -static struct v4l2_subdev *csi2_subdev(struct sh_mobile_ceu_dev *pcdev, - struct soc_camera_device *icd) -{ - struct v4l2_subdev *sd = pcdev->csi2_sd; - - return sd && sd->grp_id == soc_camera_grp_id(icd) ? sd : NULL; -} - static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct sh_mobile_ceu_dev *pcdev = ici->priv; - struct v4l2_subdev *csi2_sd = find_csi2(pcdev); - int ret; - - if (csi2_sd) { - csi2_sd->grp_id = soc_camera_grp_id(icd); - v4l2_set_subdev_hostdata(csi2_sd, icd); - } - - ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) - return ret; - - /* - * -ENODEV is special: either csi2_sd == NULL or the CSI-2 driver - * has not found this soc-camera device among its clients - */ - if (csi2_sd && ret == -ENODEV) - csi2_sd->grp_id = 0; - dev_info(icd->parent, - "SuperH Mobile CEU%s driver attached to camera %d\n", - csi2_sd && csi2_sd->grp_id ? "/CSI-2" : "", icd->devnum); + "SuperH Mobile CEU driver attached to camera %d\n", + icd->devnum); return 0; } static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct sh_mobile_ceu_dev *pcdev = ici->priv; - struct v4l2_subdev *csi2_sd = find_csi2(pcdev); - dev_info(icd->parent, "SuperH Mobile CEU driver detached from camera %d\n", icd->devnum); - - v4l2_subdev_call(csi2_sd, core, s_power, 0); } /* Called with .host_lock held */ @@ -704,12 +644,6 @@ static void sh_mobile_ceu_set_rect(struct soc_camera_device *icd) cdwdr_width *= 2; } - /* CSI2 special configuration */ - if (csi2_subdev(pcdev, icd)) { - in_width = ((in_width - 2) * 2); - left_offset *= 2; - } - /* Set CAMOR, CAPWR, CFSZR, take care of CDWDR */ camor = left_offset | (top_offset << 16); @@ -758,13 +692,6 @@ static void capture_restore(struct sh_mobile_ceu_dev *pcdev, u32 capsr) ceu_write(pcdev, CAPSR, capsr); } -/* Find the bus subdevice driver, e.g., CSI2 */ -static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev, - struct soc_camera_device *icd) -{ - return csi2_subdev(pcdev, icd) ? : soc_camera_to_subdev(icd); -} - #define CEU_BUS_FLAGS (V4L2_MBUS_MASTER | \ V4L2_MBUS_PCLK_SAMPLE_RISING | \ V4L2_MBUS_HSYNC_ACTIVE_HIGH | \ @@ -778,7 +705,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd) { struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct sh_mobile_ceu_dev *pcdev = ici->priv; - struct v4l2_subdev *sd = find_bus_subdev(pcdev, icd); + struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct sh_mobile_ceu_cam *cam = icd->host_priv; struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; unsigned long value, common_flags = CEU_BUS_FLAGS; @@ -866,9 +793,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd) value |= common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW ? 1 << 1 : 0; value |= common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW ? 1 << 0 : 0; - if (csi2_subdev(pcdev, icd)) /* CSI2 mode */ - value |= 3 << 12; - else if (pcdev->is_16bit) + if (pcdev->is_16bit) value |= 1 << 12; else if (pcdev->flags & SH_CEU_FLAG_LOWER_8BIT) value |= 2 << 12; @@ -923,9 +848,7 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd) static int sh_mobile_ceu_try_bus_param(struct soc_camera_device *icd, unsigned char buswidth) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct sh_mobile_ceu_dev *pcdev = ici->priv; - struct v4l2_subdev *sd = find_bus_subdev(pcdev, icd); + struct v4l2_subdev *sd = soc_camera_to_subdev(icd); unsigned long common_flags = CEU_BUS_FLAGS; struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; int ret; @@ -1046,12 +969,9 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int return 0; } - if (!csi2_subdev(pcdev, icd)) { - /* Are there any restrictions in the CSI-2 case? */ - ret = sh_mobile_ceu_try_bus_param(icd, fmt->bits_per_sample); - if (ret < 0) - return 0; - } + ret = sh_mobile_ceu_try_bus_param(icd, fmt->bits_per_sample); + if (ret < 0) + return 0; if (!icd->host_priv) { struct v4l2_subdev_format fmt = { @@ -1721,12 +1641,11 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) struct resource *res; void __iomem *base; unsigned int irq; - int err, i; + int err; struct bus_wait wait = { .completion = COMPLETION_INITIALIZER_ONSTACK(wait.completion), .notifier.notifier_call = bus_notify, }; - struct sh_mobile_ceu_companion *csi2; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq = platform_get_irq(pdev, 0); @@ -1821,132 +1740,16 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) pcdev->ici.capabilities = SOCAM_HOST_CAP_STRIDE; if (pcdev->pdata && pcdev->pdata->asd_sizes) { - struct v4l2_async_subdev **asd; - char name[] = "sh-mobile-csi2"; - int j; - - /* - * CSI2 interfacing: several groups can use CSI2, pick up the - * first one - */ - asd = pcdev->pdata->asd; - for (j = 0; pcdev->pdata->asd_sizes[j]; j++) { - for (i = 0; i < pcdev->pdata->asd_sizes[j]; i++, asd++) { - dev_dbg(&pdev->dev, "%s(): subdev #%d, type %u\n", - __func__, i, (*asd)->match_type); - if ((*asd)->match_type == V4L2_ASYNC_MATCH_DEVNAME && - !strncmp(name, (*asd)->match.device_name.name, - sizeof(name) - 1)) { - pcdev->csi2_asd = *asd; - break; - } - } - if (pcdev->csi2_asd) - break; - } - pcdev->ici.asd = pcdev->pdata->asd; pcdev->ici.asd_sizes = pcdev->pdata->asd_sizes; } - /* Legacy CSI2 interfacing */ - csi2 = pcdev->pdata ? pcdev->pdata->csi2 : NULL; - if (csi2) { - /* - * TODO: remove this once all users are converted to - * asynchronous CSI2 probing. If it has to be kept, csi2 - * platform device resources have to be added, using - * platform_device_add_resources() - */ - struct platform_device *csi2_pdev = - platform_device_alloc("sh-mobile-csi2", csi2->id); - struct sh_csi2_pdata *csi2_pdata = csi2->platform_data; - - if (!csi2_pdev) { - err = -ENOMEM; - goto exit_free_clk; - } - - pcdev->csi2_pdev = csi2_pdev; - - err = platform_device_add_data(csi2_pdev, csi2_pdata, - sizeof(*csi2_pdata)); - if (err < 0) - goto exit_pdev_put; - - csi2_pdev->resource = csi2->resource; - csi2_pdev->num_resources = csi2->num_resources; - - err = platform_device_add(csi2_pdev); - if (err < 0) - goto exit_pdev_put; - - wait.dev = &csi2_pdev->dev; - - err = bus_register_notifier(&platform_bus_type, &wait.notifier); - if (err < 0) - goto exit_pdev_unregister; - - /* - * From this point the driver module will not unload, until - * we complete the completion. - */ - - if (!csi2_pdev->dev.driver) { - complete(&wait.completion); - /* Either too late, or probing failed */ - bus_unregister_notifier(&platform_bus_type, &wait.notifier); - err = -ENXIO; - goto exit_pdev_unregister; - } - - /* - * The module is still loaded, in the worst case it is hanging - * in device release on our completion. So, _now_ dereferencing - * the "owner" is safe! - */ - - err = try_module_get(csi2_pdev->dev.driver->owner); - - /* Let notifier complete, if it has been locked */ - complete(&wait.completion); - bus_unregister_notifier(&platform_bus_type, &wait.notifier); - if (!err) { - err = -ENODEV; - goto exit_pdev_unregister; - } - - pcdev->csi2_sd = platform_get_drvdata(csi2_pdev); - } - err = soc_camera_host_register(&pcdev->ici); if (err) - goto exit_csi2_unregister; - - if (csi2) { - err = v4l2_device_register_subdev(&pcdev->ici.v4l2_dev, - pcdev->csi2_sd); - dev_dbg(&pdev->dev, "%s(): ret(register_subdev) = %d\n", - __func__, err); - if (err < 0) - goto exit_host_unregister; - /* v4l2_device_register_subdev() took a reference too */ - module_put(pcdev->csi2_sd->owner); - } + goto exit_free_clk; return 0; -exit_host_unregister: - soc_camera_host_unregister(&pcdev->ici); -exit_csi2_unregister: - if (csi2) { - module_put(pcdev->csi2_pdev->dev.driver->owner); -exit_pdev_unregister: - platform_device_del(pcdev->csi2_pdev); -exit_pdev_put: - pcdev->csi2_pdev->resource = NULL; - platform_device_put(pcdev->csi2_pdev); - } exit_free_clk: pm_runtime_disable(&pdev->dev); exit_release_mem: @@ -1958,21 +1761,11 @@ exit_release_mem: static int sh_mobile_ceu_remove(struct platform_device *pdev) { struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); - struct sh_mobile_ceu_dev *pcdev = container_of(soc_host, - struct sh_mobile_ceu_dev, ici); - struct platform_device *csi2_pdev = pcdev->csi2_pdev; soc_camera_host_unregister(soc_host); pm_runtime_disable(&pdev->dev); if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) dma_release_declared_memory(&pdev->dev); - if (csi2_pdev && csi2_pdev->dev.driver) { - struct module *csi2_drv = csi2_pdev->dev.driver->owner; - platform_device_del(csi2_pdev); - csi2_pdev->resource = NULL; - platform_device_put(csi2_pdev); - module_put(csi2_drv); - } return 0; } @@ -2012,8 +1805,6 @@ static struct platform_driver sh_mobile_ceu_driver = { static int __init sh_mobile_ceu_init(void) { - /* Whatever return code */ - request_module("sh_mobile_csi2"); return platform_driver_register(&sh_mobile_ceu_driver); } diff --git a/drivers/media/platform/soc_camera/sh_mobile_csi2.c b/drivers/media/platform/soc_camera/sh_mobile_csi2.c deleted file mode 100644 index 09b18365a4b1..000000000000 --- a/drivers/media/platform/soc_camera/sh_mobile_csi2.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Driver for the SH-Mobile MIPI CSI-2 unit - * - * Copyright (C) 2010, Guennadi Liakhovetski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SH_CSI2_TREF 0x00 -#define SH_CSI2_SRST 0x04 -#define SH_CSI2_PHYCNT 0x08 -#define SH_CSI2_CHKSUM 0x0C -#define SH_CSI2_VCDT 0x10 - -struct sh_csi2 { - struct v4l2_subdev subdev; - unsigned int irq; - unsigned long mipi_flags; - void __iomem *base; - struct platform_device *pdev; - struct sh_csi2_client_config *client; -}; - -static void sh_csi2_hwinit(struct sh_csi2 *priv); - -static int sh_csi2_set_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) -{ - struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); - struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; - struct v4l2_mbus_framefmt *mf = &format->format; - u32 tmp = (priv->client->channel & 3) << 8; - - if (format->pad) - return -EINVAL; - - if (mf->width > 8188) - mf->width = 8188; - else if (mf->width & 1) - mf->width &= ~1; - - switch (pdata->type) { - case SH_CSI2C: - switch (mf->code) { - case MEDIA_BUS_FMT_UYVY8_2X8: /* YUV422 */ - case MEDIA_BUS_FMT_YUYV8_1_5X8: /* YUV420 */ - case MEDIA_BUS_FMT_Y8_1X8: /* RAW8 */ - case MEDIA_BUS_FMT_SBGGR8_1X8: - case MEDIA_BUS_FMT_SGRBG8_1X8: - break; - default: - /* All MIPI CSI-2 devices must support one of primary formats */ - mf->code = MEDIA_BUS_FMT_YUYV8_2X8; - } - break; - case SH_CSI2I: - switch (mf->code) { - case MEDIA_BUS_FMT_Y8_1X8: /* RAW8 */ - case MEDIA_BUS_FMT_SBGGR8_1X8: - case MEDIA_BUS_FMT_SGRBG8_1X8: - case MEDIA_BUS_FMT_SBGGR10_1X10: /* RAW10 */ - case MEDIA_BUS_FMT_SBGGR12_1X12: /* RAW12 */ - break; - default: - /* All MIPI CSI-2 devices must support one of primary formats */ - mf->code = MEDIA_BUS_FMT_SBGGR8_1X8; - } - break; - } - - if (format->which == V4L2_SUBDEV_FORMAT_TRY) { - cfg->try_fmt = *mf; - return 0; - } - - if (mf->width > 8188 || mf->width & 1) - return -EINVAL; - - switch (mf->code) { - case MEDIA_BUS_FMT_UYVY8_2X8: - tmp |= 0x1e; /* YUV422 8 bit */ - break; - case MEDIA_BUS_FMT_YUYV8_1_5X8: - tmp |= 0x18; /* YUV420 8 bit */ - break; - case MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE: - tmp |= 0x21; /* RGB555 */ - break; - case MEDIA_BUS_FMT_RGB565_2X8_BE: - tmp |= 0x22; /* RGB565 */ - break; - case MEDIA_BUS_FMT_Y8_1X8: - case MEDIA_BUS_FMT_SBGGR8_1X8: - case MEDIA_BUS_FMT_SGRBG8_1X8: - tmp |= 0x2a; /* RAW8 */ - break; - default: - return -EINVAL; - } - - iowrite32(tmp, priv->base + SH_CSI2_VCDT); - - return 0; -} - -static int sh_csi2_g_mbus_config(struct v4l2_subdev *sd, - struct v4l2_mbus_config *cfg) -{ - struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); - - if (!priv->mipi_flags) { - struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); - struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); - struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; - unsigned long common_flags, csi2_flags; - struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2,}; - int ret; - - /* Check if we can support this camera */ - csi2_flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK | - V4L2_MBUS_CSI2_1_LANE; - - switch (pdata->type) { - case SH_CSI2C: - if (priv->client->lanes != 1) - csi2_flags |= V4L2_MBUS_CSI2_2_LANE; - break; - case SH_CSI2I: - switch (priv->client->lanes) { - default: - csi2_flags |= V4L2_MBUS_CSI2_4_LANE; - case 3: - csi2_flags |= V4L2_MBUS_CSI2_3_LANE; - case 2: - csi2_flags |= V4L2_MBUS_CSI2_2_LANE; - } - } - - ret = v4l2_subdev_call(client_sd, video, g_mbus_config, &client_cfg); - if (ret == -ENOIOCTLCMD) - common_flags = csi2_flags; - else if (!ret) - common_flags = soc_mbus_config_compatible(&client_cfg, - csi2_flags); - else - common_flags = 0; - - if (!common_flags) - return -EINVAL; - - /* All good: camera MIPI configuration supported */ - priv->mipi_flags = common_flags; - } - - if (cfg) { - cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | - V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | - V4L2_MBUS_MASTER | V4L2_MBUS_DATA_ACTIVE_HIGH; - cfg->type = V4L2_MBUS_PARALLEL; - } - - return 0; -} - -static int sh_csi2_s_mbus_config(struct v4l2_subdev *sd, - const struct v4l2_mbus_config *cfg) -{ - struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); - struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); - struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); - struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2,}; - int ret = sh_csi2_g_mbus_config(sd, NULL); - - if (ret < 0) - return ret; - - pm_runtime_get_sync(&priv->pdev->dev); - - sh_csi2_hwinit(priv); - - client_cfg.flags = priv->mipi_flags; - - return v4l2_subdev_call(client_sd, video, s_mbus_config, &client_cfg); -} - -static struct v4l2_subdev_video_ops sh_csi2_subdev_video_ops = { - .g_mbus_config = sh_csi2_g_mbus_config, - .s_mbus_config = sh_csi2_s_mbus_config, -}; - -static struct v4l2_subdev_pad_ops sh_csi2_subdev_pad_ops = { - .set_fmt = sh_csi2_set_fmt, -}; - -static void sh_csi2_hwinit(struct sh_csi2 *priv) -{ - struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; - __u32 tmp = 0x10; /* Enable MIPI CSI clock lane */ - - /* Reflect registers immediately */ - iowrite32(0x00000001, priv->base + SH_CSI2_TREF); - /* reset CSI2 harware */ - iowrite32(0x00000001, priv->base + SH_CSI2_SRST); - udelay(5); - iowrite32(0x00000000, priv->base + SH_CSI2_SRST); - - switch (pdata->type) { - case SH_CSI2C: - if (priv->client->lanes == 1) - tmp |= 1; - else - /* Default - both lanes */ - tmp |= 3; - break; - case SH_CSI2I: - if (!priv->client->lanes || priv->client->lanes > 4) - /* Default - all 4 lanes */ - tmp |= 0xf; - else - tmp |= (1 << priv->client->lanes) - 1; - } - - if (priv->client->phy == SH_CSI2_PHY_MAIN) - tmp |= 0x8000; - - iowrite32(tmp, priv->base + SH_CSI2_PHYCNT); - - tmp = 0; - if (pdata->flags & SH_CSI2_ECC) - tmp |= 2; - if (pdata->flags & SH_CSI2_CRC) - tmp |= 1; - iowrite32(tmp, priv->base + SH_CSI2_CHKSUM); -} - -static int sh_csi2_client_connect(struct sh_csi2 *priv) -{ - struct device *dev = v4l2_get_subdevdata(&priv->subdev); - struct sh_csi2_pdata *pdata = dev->platform_data; - struct soc_camera_device *icd = v4l2_get_subdev_hostdata(&priv->subdev); - int i; - - if (priv->client) - return -EBUSY; - - for (i = 0; i < pdata->num_clients; i++) - if ((pdata->clients[i].pdev && - &pdata->clients[i].pdev->dev == icd->pdev) || - (icd->control && - strcmp(pdata->clients[i].name, dev_name(icd->control)))) - break; - - dev_dbg(dev, "%s(%p): found #%d\n", __func__, dev, i); - - if (i == pdata->num_clients) - return -ENODEV; - - priv->client = pdata->clients + i; - - return 0; -} - -static void sh_csi2_client_disconnect(struct sh_csi2 *priv) -{ - if (!priv->client) - return; - - priv->client = NULL; - - pm_runtime_put(v4l2_get_subdevdata(&priv->subdev)); -} - -static int sh_csi2_s_power(struct v4l2_subdev *sd, int on) -{ - struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); - - if (on) - return sh_csi2_client_connect(priv); - - sh_csi2_client_disconnect(priv); - return 0; -} - -static struct v4l2_subdev_core_ops sh_csi2_subdev_core_ops = { - .s_power = sh_csi2_s_power, -}; - -static struct v4l2_subdev_ops sh_csi2_subdev_ops = { - .core = &sh_csi2_subdev_core_ops, - .video = &sh_csi2_subdev_video_ops, - .pad = &sh_csi2_subdev_pad_ops, -}; - -static int sh_csi2_probe(struct platform_device *pdev) -{ - struct resource *res; - unsigned int irq; - int ret; - struct sh_csi2 *priv; - /* Platform data specify the PHY, lanes, ECC, CRC */ - struct sh_csi2_pdata *pdata = pdev->dev.platform_data; - - if (!pdata) - return -EINVAL; - - priv = devm_kzalloc(&pdev->dev, sizeof(struct sh_csi2), GFP_KERNEL); - if (!priv) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - /* Interrupt unused so far */ - irq = platform_get_irq(pdev, 0); - - if (!res || (int)irq <= 0) { - dev_err(&pdev->dev, "Not enough CSI2 platform resources.\n"); - return -ENODEV; - } - - /* TODO: Add support for CSI2I. Careful: different register layout! */ - if (pdata->type != SH_CSI2C) { - dev_err(&pdev->dev, "Only CSI2C supported ATM.\n"); - return -EINVAL; - } - - priv->irq = irq; - - priv->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(priv->base)) - return PTR_ERR(priv->base); - - priv->pdev = pdev; - priv->subdev.owner = THIS_MODULE; - priv->subdev.dev = &pdev->dev; - platform_set_drvdata(pdev, &priv->subdev); - - v4l2_subdev_init(&priv->subdev, &sh_csi2_subdev_ops); - v4l2_set_subdevdata(&priv->subdev, &pdev->dev); - - snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.mipi-csi", - dev_name(&pdev->dev)); - - ret = v4l2_async_register_subdev(&priv->subdev); - if (ret < 0) - return ret; - - pm_runtime_enable(&pdev->dev); - - dev_dbg(&pdev->dev, "CSI2 probed.\n"); - - return 0; -} - -static int sh_csi2_remove(struct platform_device *pdev) -{ - struct v4l2_subdev *subdev = platform_get_drvdata(pdev); - struct sh_csi2 *priv = container_of(subdev, struct sh_csi2, subdev); - - v4l2_async_unregister_subdev(&priv->subdev); - pm_runtime_disable(&pdev->dev); - - return 0; -} - -static struct platform_driver __refdata sh_csi2_pdrv = { - .remove = sh_csi2_remove, - .probe = sh_csi2_probe, - .driver = { - .name = "sh-mobile-csi2", - }, -}; - -module_platform_driver(sh_csi2_pdrv); - -MODULE_DESCRIPTION("SH-Mobile MIPI CSI-2 driver"); -MODULE_AUTHOR("Guennadi Liakhovetski "); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:sh-mobile-csi2"); diff --git a/include/media/drv-intf/sh_mobile_ceu.h b/include/media/drv-intf/sh_mobile_ceu.h index 7f57056c22ba..2f43f7d9e28d 100644 --- a/include/media/drv-intf/sh_mobile_ceu.h +++ b/include/media/drv-intf/sh_mobile_ceu.h @@ -21,7 +21,6 @@ struct sh_mobile_ceu_info { unsigned long flags; int max_width; int max_height; - struct sh_mobile_ceu_companion *csi2; struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ unsigned int *asd_sizes; /* 0-terminated array pf asd group sizes */ }; diff --git a/include/media/drv-intf/sh_mobile_csi2.h b/include/media/drv-intf/sh_mobile_csi2.h deleted file mode 100644 index 14030db51f13..000000000000 --- a/include/media/drv-intf/sh_mobile_csi2.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Driver header for the SH-Mobile MIPI CSI-2 unit - * - * Copyright (C) 2010, Guennadi Liakhovetski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef SH_MIPI_CSI -#define SH_MIPI_CSI - -#include - -enum sh_csi2_phy { - SH_CSI2_PHY_MAIN, - SH_CSI2_PHY_SUB, -}; - -enum sh_csi2_type { - SH_CSI2C, - SH_CSI2I, -}; - -#define SH_CSI2_CRC (1 << 0) -#define SH_CSI2_ECC (1 << 1) - -struct platform_device; - -struct sh_csi2_client_config { - enum sh_csi2_phy phy; - unsigned char lanes; /* bitmask[3:0] */ - unsigned char channel; /* 0..3 */ - struct platform_device *pdev; /* client platform device */ - const char *name; /* async matching: client name */ -}; - -struct v4l2_device; - -struct sh_csi2_pdata { - enum sh_csi2_type type; - unsigned int flags; - struct sh_csi2_client_config *clients; - int num_clients; -}; - -#endif From d0d44516f8e989392d1fa545ae58ea6694743db9 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 5 Aug 2016 10:38:32 -0300 Subject: [PATCH 139/591] [media] s5p-tv: remove obsolete driver The s5p-tv driver has been replaced by the exynos drm driver for quite a long time now. Remove this driver to avoid having duplicate drivers, of which this one is considered dead code by Samsung. Signed-off-by: Hans Verkuil Acked-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 8 - drivers/gpu/drm/exynos/Kconfig | 3 +- drivers/media/platform/Kconfig | 1 - drivers/media/platform/Makefile | 1 - drivers/media/platform/s5p-tv/Kconfig | 88 -- drivers/media/platform/s5p-tv/Makefile | 19 - drivers/media/platform/s5p-tv/hdmi_drv.c | 1059 --------------- drivers/media/platform/s5p-tv/hdmiphy_drv.c | 324 ----- drivers/media/platform/s5p-tv/mixer.h | 364 ------ drivers/media/platform/s5p-tv/mixer_drv.c | 527 -------- .../media/platform/s5p-tv/mixer_grp_layer.c | 270 ---- drivers/media/platform/s5p-tv/mixer_reg.c | 551 -------- drivers/media/platform/s5p-tv/mixer_video.c | 1130 ----------------- .../media/platform/s5p-tv/mixer_vp_layer.c | 242 ---- drivers/media/platform/s5p-tv/regs-hdmi.h | 146 --- drivers/media/platform/s5p-tv/regs-mixer.h | 122 -- drivers/media/platform/s5p-tv/regs-sdo.h | 63 - drivers/media/platform/s5p-tv/regs-vp.h | 88 -- drivers/media/platform/s5p-tv/sdo_drv.c | 497 -------- drivers/media/platform/s5p-tv/sii9234_drv.c | 407 ------ 20 files changed, 1 insertion(+), 5909 deletions(-) delete mode 100644 drivers/media/platform/s5p-tv/Kconfig delete mode 100644 drivers/media/platform/s5p-tv/Makefile delete mode 100644 drivers/media/platform/s5p-tv/hdmi_drv.c delete mode 100644 drivers/media/platform/s5p-tv/hdmiphy_drv.c delete mode 100644 drivers/media/platform/s5p-tv/mixer.h delete mode 100644 drivers/media/platform/s5p-tv/mixer_drv.c delete mode 100644 drivers/media/platform/s5p-tv/mixer_grp_layer.c delete mode 100644 drivers/media/platform/s5p-tv/mixer_reg.c delete mode 100644 drivers/media/platform/s5p-tv/mixer_video.c delete mode 100644 drivers/media/platform/s5p-tv/mixer_vp_layer.c delete mode 100644 drivers/media/platform/s5p-tv/regs-hdmi.h delete mode 100644 drivers/media/platform/s5p-tv/regs-mixer.h delete mode 100644 drivers/media/platform/s5p-tv/regs-sdo.h delete mode 100644 drivers/media/platform/s5p-tv/regs-vp.h delete mode 100644 drivers/media/platform/s5p-tv/sdo_drv.c delete mode 100644 drivers/media/platform/s5p-tv/sii9234_drv.c diff --git a/MAINTAINERS b/MAINTAINERS index 6c33d29f79b0..998fd6b767f2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1666,14 +1666,6 @@ S: Maintained F: arch/arm/plat-samsung/s5p-dev-mfc.c F: drivers/media/platform/s5p-mfc/ -ARM/SAMSUNG S5P SERIES TV SUBSYSTEM SUPPORT -M: Kyungmin Park -M: Tomasz Stanislawski -L: linux-arm-kernel@lists.infradead.org -L: linux-media@vger.kernel.org -S: Maintained -F: drivers/media/platform/s5p-tv/ - ARM/SAMSUNG S5P SERIES HDMI CEC SUBSYSTEM SUPPORT M: Kyungmin Park L: linux-arm-kernel@lists.infradead.org diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 83f61c513b7e..465d344f3391 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -38,7 +38,6 @@ config DRM_EXYNOS7_DECON config DRM_EXYNOS_MIXER bool "Mixer" - depends on !VIDEO_SAMSUNG_S5P_TV help Choose this option if you want to use Exynos Mixer for DRM. @@ -77,7 +76,7 @@ config DRM_EXYNOS_DP config DRM_EXYNOS_HDMI bool "HDMI" - depends on !VIDEO_SAMSUNG_S5P_TV && (DRM_EXYNOS_MIXER || DRM_EXYNOS5433_DECON) + depends on DRM_EXYNOS_MIXER || DRM_EXYNOS5433_DECON help Choose this option if you want to use Exynos HDMI for DRM. diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index b23db1779808..7843e8f3d37d 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -107,7 +107,6 @@ config VIDEO_S3C_CAMIF source "drivers/media/platform/soc_camera/Kconfig" source "drivers/media/platform/exynos4-is/Kconfig" -source "drivers/media/platform/s5p-tv/Kconfig" source "drivers/media/platform/am437x/Kconfig" source "drivers/media/platform/xilinx/Kconfig" source "drivers/media/platform/rcar-vin/Kconfig" diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 37b6c75f0b15..536d1d8ef022 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -30,7 +30,6 @@ obj-$(CONFIG_VIDEO_S3C_CAMIF) += s3c-camif/ obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS4_IS) += exynos4-is/ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg/ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) += s5p-mfc/ -obj-$(CONFIG_VIDEO_SAMSUNG_S5P_TV) += s5p-tv/ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_G2D) += s5p-g2d/ obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC) += exynos-gsc/ diff --git a/drivers/media/platform/s5p-tv/Kconfig b/drivers/media/platform/s5p-tv/Kconfig deleted file mode 100644 index 697aaed42486..000000000000 --- a/drivers/media/platform/s5p-tv/Kconfig +++ /dev/null @@ -1,88 +0,0 @@ -# drivers/media/platform/s5p-tv/Kconfig -# -# Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. -# http://www.samsung.com/ -# Tomasz Stanislawski -# -# Licensed under GPL - -config VIDEO_SAMSUNG_S5P_TV - bool "Samsung TV driver for S5P platform" - depends on PM - depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST - default n - ---help--- - Say Y here to enable selecting the TV output devices for - Samsung S5P platform. - -if VIDEO_SAMSUNG_S5P_TV - -config VIDEO_SAMSUNG_S5P_HDMI - tristate "Samsung HDMI Driver" - depends on VIDEO_V4L2 - depends on I2C - depends on VIDEO_SAMSUNG_S5P_TV - select VIDEO_SAMSUNG_S5P_HDMIPHY - help - Say Y here if you want support for the HDMI output - interface in S5P Samsung SoC. The driver can be compiled - as module. It is an auxiliary driver, that exposes a V4L2 - subdev for use by other drivers. This driver requires - hdmiphy driver to work correctly. - -config VIDEO_SAMSUNG_S5P_HDMI_DEBUG - bool "Enable debug for HDMI Driver" - depends on VIDEO_SAMSUNG_S5P_HDMI - default n - help - Enables debugging for HDMI driver. - -config VIDEO_SAMSUNG_S5P_HDMIPHY - tristate "Samsung HDMIPHY Driver" - depends on VIDEO_DEV && VIDEO_V4L2 && I2C - depends on VIDEO_SAMSUNG_S5P_TV - help - Say Y here if you want support for the physical HDMI - interface in S5P Samsung SoC. The driver can be compiled - as module. It is an I2C driver, that exposes a V4L2 - subdev for use by other drivers. - -config VIDEO_SAMSUNG_S5P_SII9234 - tristate "Samsung SII9234 Driver" - depends on VIDEO_DEV && VIDEO_V4L2 && I2C - depends on VIDEO_SAMSUNG_S5P_TV - help - Say Y here if you want support for the MHL interface - in S5P Samsung SoC. The driver can be compiled - as module. It is an I2C driver, that exposes a V4L2 - subdev for use by other drivers. - -config VIDEO_SAMSUNG_S5P_SDO - tristate "Samsung Analog TV Driver" - depends on VIDEO_DEV && VIDEO_V4L2 - depends on VIDEO_SAMSUNG_S5P_TV - help - Say Y here if you want support for the analog TV output - interface in S5P Samsung SoC. The driver can be compiled - as module. It is an auxiliary driver, that exposes a V4L2 - subdev for use by other drivers. This driver requires - hdmiphy driver to work correctly. - -config VIDEO_SAMSUNG_S5P_MIXER - tristate "Samsung Mixer and Video Processor Driver" - depends on VIDEO_DEV && VIDEO_V4L2 - depends on VIDEO_SAMSUNG_S5P_TV - depends on HAS_DMA - select VIDEOBUF2_DMA_CONTIG - help - Say Y here if you want support for the Mixer in Samsung S5P SoCs. - This device produce image data to one of output interfaces. - -config VIDEO_SAMSUNG_S5P_MIXER_DEBUG - bool "Enable debug for Mixer Driver" - depends on VIDEO_SAMSUNG_S5P_MIXER - default n - help - Enables debugging for Mixer driver. - -endif # VIDEO_SAMSUNG_S5P_TV diff --git a/drivers/media/platform/s5p-tv/Makefile b/drivers/media/platform/s5p-tv/Makefile deleted file mode 100644 index 7cd47902e269..000000000000 --- a/drivers/media/platform/s5p-tv/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# drivers/media/platform/samsung/tvout/Makefile -# -# Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. -# http://www.samsung.com/ -# Tomasz Stanislawski -# -# Licensed under GPL - -obj-$(CONFIG_VIDEO_SAMSUNG_S5P_HDMIPHY) += s5p-hdmiphy.o -s5p-hdmiphy-y += hdmiphy_drv.o -obj-$(CONFIG_VIDEO_SAMSUNG_S5P_SII9234) += s5p-sii9234.o -s5p-sii9234-y += sii9234_drv.o -obj-$(CONFIG_VIDEO_SAMSUNG_S5P_HDMI) += s5p-hdmi.o -s5p-hdmi-y += hdmi_drv.o -obj-$(CONFIG_VIDEO_SAMSUNG_S5P_SDO) += s5p-sdo.o -s5p-sdo-y += sdo_drv.o -obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MIXER) += s5p-mixer.o -s5p-mixer-y += mixer_drv.o mixer_video.o mixer_reg.o mixer_grp_layer.o mixer_vp_layer.o - diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c deleted file mode 100644 index e71b13e40f59..000000000000 --- a/drivers/media/platform/s5p-tv/hdmi_drv.c +++ /dev/null @@ -1,1059 +0,0 @@ -/* - * Samsung HDMI interface driver - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * - * Tomasz Stanislawski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundiation. either version 2 of the License, - * or (at your option) any later version - */ - -#define pr_fmt(fmt) "s5p-tv (hdmi_drv): " fmt - -#ifdef CONFIG_VIDEO_SAMSUNG_S5P_HDMI_DEBUG -#define DEBUG -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "regs-hdmi.h" - -MODULE_AUTHOR("Tomasz Stanislawski, "); -MODULE_DESCRIPTION("Samsung HDMI"); -MODULE_LICENSE("GPL"); - -struct hdmi_pulse { - u32 beg; - u32 end; -}; - -struct hdmi_timings { - struct hdmi_pulse hact; - u32 hsyn_pol; /* 0 - high, 1 - low */ - struct hdmi_pulse hsyn; - u32 interlaced; - struct hdmi_pulse vact[2]; - u32 vsyn_pol; /* 0 - high, 1 - low */ - u32 vsyn_off; - struct hdmi_pulse vsyn[2]; -}; - -struct hdmi_resources { - struct clk *hdmi; - struct clk *sclk_hdmi; - struct clk *sclk_pixel; - struct clk *sclk_hdmiphy; - struct clk *hdmiphy; - struct regulator_bulk_data *regul_bulk; - int regul_count; -}; - -struct hdmi_device { - /** base address of HDMI registers */ - void __iomem *regs; - /** HDMI interrupt */ - unsigned int irq; - /** pointer to device parent */ - struct device *dev; - /** subdev generated by HDMI device */ - struct v4l2_subdev sd; - /** V4L2 device structure */ - struct v4l2_device v4l2_dev; - /** subdev of HDMIPHY interface */ - struct v4l2_subdev *phy_sd; - /** subdev of MHL interface */ - struct v4l2_subdev *mhl_sd; - /** configuration of current graphic mode */ - const struct hdmi_timings *cur_conf; - /** flag indicating that timings are dirty */ - int cur_conf_dirty; - /** current timings */ - struct v4l2_dv_timings cur_timings; - /** other resources */ - struct hdmi_resources res; -}; - -static const struct platform_device_id hdmi_driver_types[] = { - { - .name = "s5pv210-hdmi", - }, { - .name = "exynos4-hdmi", - }, { - /* end node */ - } -}; - -static const struct v4l2_subdev_ops hdmi_sd_ops; - -static struct hdmi_device *sd_to_hdmi_dev(struct v4l2_subdev *sd) -{ - return container_of(sd, struct hdmi_device, sd); -} - -static inline -void hdmi_write(struct hdmi_device *hdev, u32 reg_id, u32 value) -{ - writel(value, hdev->regs + reg_id); -} - -static inline -void hdmi_write_mask(struct hdmi_device *hdev, u32 reg_id, u32 value, u32 mask) -{ - u32 old = readl(hdev->regs + reg_id); - value = (value & mask) | (old & ~mask); - writel(value, hdev->regs + reg_id); -} - -static inline -void hdmi_writeb(struct hdmi_device *hdev, u32 reg_id, u8 value) -{ - writeb(value, hdev->regs + reg_id); -} - -static inline -void hdmi_writebn(struct hdmi_device *hdev, u32 reg_id, int n, u32 value) -{ - switch (n) { - default: - writeb(value >> 24, hdev->regs + reg_id + 12); - case 3: - writeb(value >> 16, hdev->regs + reg_id + 8); - case 2: - writeb(value >> 8, hdev->regs + reg_id + 4); - case 1: - writeb(value >> 0, hdev->regs + reg_id + 0); - } -} - -static inline u32 hdmi_read(struct hdmi_device *hdev, u32 reg_id) -{ - return readl(hdev->regs + reg_id); -} - -static irqreturn_t hdmi_irq_handler(int irq, void *dev_data) -{ - struct hdmi_device *hdev = dev_data; - u32 intc_flag; - - (void)irq; - intc_flag = hdmi_read(hdev, HDMI_INTC_FLAG); - /* clearing flags for HPD plug/unplug */ - if (intc_flag & HDMI_INTC_FLAG_HPD_UNPLUG) { - pr_info("unplugged\n"); - hdmi_write_mask(hdev, HDMI_INTC_FLAG, ~0, - HDMI_INTC_FLAG_HPD_UNPLUG); - } - if (intc_flag & HDMI_INTC_FLAG_HPD_PLUG) { - pr_info("plugged\n"); - hdmi_write_mask(hdev, HDMI_INTC_FLAG, ~0, - HDMI_INTC_FLAG_HPD_PLUG); - } - - return IRQ_HANDLED; -} - -static void hdmi_reg_init(struct hdmi_device *hdev) -{ - /* enable HPD interrupts */ - hdmi_write_mask(hdev, HDMI_INTC_CON, ~0, HDMI_INTC_EN_GLOBAL | - HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); - /* choose DVI mode */ - hdmi_write_mask(hdev, HDMI_MODE_SEL, - HDMI_MODE_DVI_EN, HDMI_MODE_MASK); - hdmi_write_mask(hdev, HDMI_CON_2, ~0, - HDMI_DVI_PERAMBLE_EN | HDMI_DVI_BAND_EN); - /* disable bluescreen */ - hdmi_write_mask(hdev, HDMI_CON_0, 0, HDMI_BLUE_SCR_EN); - /* choose bluescreen (fecal) color */ - hdmi_writeb(hdev, HDMI_BLUE_SCREEN_0, 0x12); - hdmi_writeb(hdev, HDMI_BLUE_SCREEN_1, 0x34); - hdmi_writeb(hdev, HDMI_BLUE_SCREEN_2, 0x56); -} - -static void hdmi_timing_apply(struct hdmi_device *hdev, - const struct hdmi_timings *t) -{ - /* setting core registers */ - hdmi_writebn(hdev, HDMI_H_BLANK_0, 2, t->hact.beg); - hdmi_writebn(hdev, HDMI_H_SYNC_GEN_0, 3, - (t->hsyn_pol << 20) | (t->hsyn.end << 10) | t->hsyn.beg); - hdmi_writeb(hdev, HDMI_VSYNC_POL, t->vsyn_pol); - hdmi_writebn(hdev, HDMI_V_BLANK_0, 3, - (t->vact[0].beg << 11) | t->vact[0].end); - hdmi_writebn(hdev, HDMI_V_SYNC_GEN_1_0, 3, - (t->vsyn[0].beg << 12) | t->vsyn[0].end); - if (t->interlaced) { - u32 vsyn_trans = t->hsyn.beg + t->vsyn_off; - - hdmi_writeb(hdev, HDMI_INT_PRO_MODE, 1); - hdmi_writebn(hdev, HDMI_H_V_LINE_0, 3, - (t->hact.end << 12) | t->vact[1].end); - hdmi_writebn(hdev, HDMI_V_BLANK_F_0, 3, - (t->vact[1].end << 11) | t->vact[1].beg); - hdmi_writebn(hdev, HDMI_V_SYNC_GEN_2_0, 3, - (t->vsyn[1].beg << 12) | t->vsyn[1].end); - hdmi_writebn(hdev, HDMI_V_SYNC_GEN_3_0, 3, - (vsyn_trans << 12) | vsyn_trans); - } else { - hdmi_writeb(hdev, HDMI_INT_PRO_MODE, 0); - hdmi_writebn(hdev, HDMI_H_V_LINE_0, 3, - (t->hact.end << 12) | t->vact[0].end); - } - - /* Timing generator registers */ - hdmi_writebn(hdev, HDMI_TG_H_FSZ_L, 2, t->hact.end); - hdmi_writebn(hdev, HDMI_TG_HACT_ST_L, 2, t->hact.beg); - hdmi_writebn(hdev, HDMI_TG_HACT_SZ_L, 2, t->hact.end - t->hact.beg); - hdmi_writebn(hdev, HDMI_TG_VSYNC_L, 2, t->vsyn[0].beg); - hdmi_writebn(hdev, HDMI_TG_VACT_ST_L, 2, t->vact[0].beg); - hdmi_writebn(hdev, HDMI_TG_VACT_SZ_L, 2, - t->vact[0].end - t->vact[0].beg); - hdmi_writebn(hdev, HDMI_TG_VSYNC_TOP_HDMI_L, 2, t->vsyn[0].beg); - hdmi_writebn(hdev, HDMI_TG_FIELD_TOP_HDMI_L, 2, t->vsyn[0].beg); - if (t->interlaced) { - hdmi_write_mask(hdev, HDMI_TG_CMD, ~0, HDMI_TG_FIELD_EN); - hdmi_writebn(hdev, HDMI_TG_V_FSZ_L, 2, t->vact[1].end); - hdmi_writebn(hdev, HDMI_TG_VSYNC2_L, 2, t->vsyn[1].beg); - hdmi_writebn(hdev, HDMI_TG_FIELD_CHG_L, 2, t->vact[0].end); - hdmi_writebn(hdev, HDMI_TG_VACT_ST2_L, 2, t->vact[1].beg); - hdmi_writebn(hdev, HDMI_TG_VSYNC_BOT_HDMI_L, 2, t->vsyn[1].beg); - hdmi_writebn(hdev, HDMI_TG_FIELD_BOT_HDMI_L, 2, t->vsyn[1].beg); - } else { - hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_FIELD_EN); - hdmi_writebn(hdev, HDMI_TG_V_FSZ_L, 2, t->vact[0].end); - } -} - -static int hdmi_conf_apply(struct hdmi_device *hdmi_dev) -{ - struct device *dev = hdmi_dev->dev; - const struct hdmi_timings *conf = hdmi_dev->cur_conf; - int ret; - - dev_dbg(dev, "%s\n", __func__); - - /* skip if conf is already synchronized with HW */ - if (!hdmi_dev->cur_conf_dirty) - return 0; - - /* reset hdmiphy */ - hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT, ~0, HDMI_PHY_SW_RSTOUT); - mdelay(10); - hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT, 0, HDMI_PHY_SW_RSTOUT); - mdelay(10); - - /* configure timings */ - ret = v4l2_subdev_call(hdmi_dev->phy_sd, video, s_dv_timings, - &hdmi_dev->cur_timings); - if (ret) { - dev_err(dev, "failed to set timings\n"); - return ret; - } - - /* resetting HDMI core */ - hdmi_write_mask(hdmi_dev, HDMI_CORE_RSTOUT, 0, HDMI_CORE_SW_RSTOUT); - mdelay(10); - hdmi_write_mask(hdmi_dev, HDMI_CORE_RSTOUT, ~0, HDMI_CORE_SW_RSTOUT); - mdelay(10); - - hdmi_reg_init(hdmi_dev); - - /* setting core registers */ - hdmi_timing_apply(hdmi_dev, conf); - - hdmi_dev->cur_conf_dirty = 0; - - return 0; -} - -static void hdmi_dumpregs(struct hdmi_device *hdev, char *prefix) -{ -#define DUMPREG(reg_id) \ - dev_dbg(hdev->dev, "%s:" #reg_id " = %08x\n", prefix, \ - readl(hdev->regs + reg_id)) - - dev_dbg(hdev->dev, "%s: ---- CONTROL REGISTERS ----\n", prefix); - DUMPREG(HDMI_INTC_FLAG); - DUMPREG(HDMI_INTC_CON); - DUMPREG(HDMI_HPD_STATUS); - DUMPREG(HDMI_PHY_RSTOUT); - DUMPREG(HDMI_PHY_VPLL); - DUMPREG(HDMI_PHY_CMU); - DUMPREG(HDMI_CORE_RSTOUT); - - dev_dbg(hdev->dev, "%s: ---- CORE REGISTERS ----\n", prefix); - DUMPREG(HDMI_CON_0); - DUMPREG(HDMI_CON_1); - DUMPREG(HDMI_CON_2); - DUMPREG(HDMI_SYS_STATUS); - DUMPREG(HDMI_PHY_STATUS); - DUMPREG(HDMI_STATUS_EN); - DUMPREG(HDMI_HPD); - DUMPREG(HDMI_MODE_SEL); - DUMPREG(HDMI_HPD_GEN); - DUMPREG(HDMI_DC_CONTROL); - DUMPREG(HDMI_VIDEO_PATTERN_GEN); - - dev_dbg(hdev->dev, "%s: ---- CORE SYNC REGISTERS ----\n", prefix); - DUMPREG(HDMI_H_BLANK_0); - DUMPREG(HDMI_H_BLANK_1); - DUMPREG(HDMI_V_BLANK_0); - DUMPREG(HDMI_V_BLANK_1); - DUMPREG(HDMI_V_BLANK_2); - DUMPREG(HDMI_H_V_LINE_0); - DUMPREG(HDMI_H_V_LINE_1); - DUMPREG(HDMI_H_V_LINE_2); - DUMPREG(HDMI_VSYNC_POL); - DUMPREG(HDMI_INT_PRO_MODE); - DUMPREG(HDMI_V_BLANK_F_0); - DUMPREG(HDMI_V_BLANK_F_1); - DUMPREG(HDMI_V_BLANK_F_2); - DUMPREG(HDMI_H_SYNC_GEN_0); - DUMPREG(HDMI_H_SYNC_GEN_1); - DUMPREG(HDMI_H_SYNC_GEN_2); - DUMPREG(HDMI_V_SYNC_GEN_1_0); - DUMPREG(HDMI_V_SYNC_GEN_1_1); - DUMPREG(HDMI_V_SYNC_GEN_1_2); - DUMPREG(HDMI_V_SYNC_GEN_2_0); - DUMPREG(HDMI_V_SYNC_GEN_2_1); - DUMPREG(HDMI_V_SYNC_GEN_2_2); - DUMPREG(HDMI_V_SYNC_GEN_3_0); - DUMPREG(HDMI_V_SYNC_GEN_3_1); - DUMPREG(HDMI_V_SYNC_GEN_3_2); - - dev_dbg(hdev->dev, "%s: ---- TG REGISTERS ----\n", prefix); - DUMPREG(HDMI_TG_CMD); - DUMPREG(HDMI_TG_H_FSZ_L); - DUMPREG(HDMI_TG_H_FSZ_H); - DUMPREG(HDMI_TG_HACT_ST_L); - DUMPREG(HDMI_TG_HACT_ST_H); - DUMPREG(HDMI_TG_HACT_SZ_L); - DUMPREG(HDMI_TG_HACT_SZ_H); - DUMPREG(HDMI_TG_V_FSZ_L); - DUMPREG(HDMI_TG_V_FSZ_H); - DUMPREG(HDMI_TG_VSYNC_L); - DUMPREG(HDMI_TG_VSYNC_H); - DUMPREG(HDMI_TG_VSYNC2_L); - DUMPREG(HDMI_TG_VSYNC2_H); - DUMPREG(HDMI_TG_VACT_ST_L); - DUMPREG(HDMI_TG_VACT_ST_H); - DUMPREG(HDMI_TG_VACT_SZ_L); - DUMPREG(HDMI_TG_VACT_SZ_H); - DUMPREG(HDMI_TG_FIELD_CHG_L); - DUMPREG(HDMI_TG_FIELD_CHG_H); - DUMPREG(HDMI_TG_VACT_ST2_L); - DUMPREG(HDMI_TG_VACT_ST2_H); - DUMPREG(HDMI_TG_VSYNC_TOP_HDMI_L); - DUMPREG(HDMI_TG_VSYNC_TOP_HDMI_H); - DUMPREG(HDMI_TG_VSYNC_BOT_HDMI_L); - DUMPREG(HDMI_TG_VSYNC_BOT_HDMI_H); - DUMPREG(HDMI_TG_FIELD_TOP_HDMI_L); - DUMPREG(HDMI_TG_FIELD_TOP_HDMI_H); - DUMPREG(HDMI_TG_FIELD_BOT_HDMI_L); - DUMPREG(HDMI_TG_FIELD_BOT_HDMI_H); -#undef DUMPREG -} - -static const struct hdmi_timings hdmi_timings_480p = { - .hact = { .beg = 138, .end = 858 }, - .hsyn_pol = 1, - .hsyn = { .beg = 16, .end = 16 + 62 }, - .interlaced = 0, - .vact[0] = { .beg = 42 + 3, .end = 522 + 3 }, - .vsyn_pol = 1, - .vsyn[0] = { .beg = 6 + 3, .end = 12 + 3}, -}; - -static const struct hdmi_timings hdmi_timings_576p50 = { - .hact = { .beg = 144, .end = 864 }, - .hsyn_pol = 1, - .hsyn = { .beg = 12, .end = 12 + 64 }, - .interlaced = 0, - .vact[0] = { .beg = 44 + 5, .end = 620 + 5 }, - .vsyn_pol = 1, - .vsyn[0] = { .beg = 0 + 5, .end = 5 + 5}, -}; - -static const struct hdmi_timings hdmi_timings_720p60 = { - .hact = { .beg = 370, .end = 1650 }, - .hsyn_pol = 0, - .hsyn = { .beg = 110, .end = 110 + 40 }, - .interlaced = 0, - .vact[0] = { .beg = 25 + 5, .end = 745 + 5 }, - .vsyn_pol = 0, - .vsyn[0] = { .beg = 0 + 5, .end = 5 + 5}, -}; - -static const struct hdmi_timings hdmi_timings_720p50 = { - .hact = { .beg = 700, .end = 1980 }, - .hsyn_pol = 0, - .hsyn = { .beg = 440, .end = 440 + 40 }, - .interlaced = 0, - .vact[0] = { .beg = 25 + 5, .end = 745 + 5 }, - .vsyn_pol = 0, - .vsyn[0] = { .beg = 0 + 5, .end = 5 + 5}, -}; - -static const struct hdmi_timings hdmi_timings_1080p24 = { - .hact = { .beg = 830, .end = 2750 }, - .hsyn_pol = 0, - .hsyn = { .beg = 638, .end = 638 + 44 }, - .interlaced = 0, - .vact[0] = { .beg = 41 + 4, .end = 1121 + 4 }, - .vsyn_pol = 0, - .vsyn[0] = { .beg = 0 + 4, .end = 5 + 4}, -}; - -static const struct hdmi_timings hdmi_timings_1080p60 = { - .hact = { .beg = 280, .end = 2200 }, - .hsyn_pol = 0, - .hsyn = { .beg = 88, .end = 88 + 44 }, - .interlaced = 0, - .vact[0] = { .beg = 41 + 4, .end = 1121 + 4 }, - .vsyn_pol = 0, - .vsyn[0] = { .beg = 0 + 4, .end = 5 + 4}, -}; - -static const struct hdmi_timings hdmi_timings_1080i60 = { - .hact = { .beg = 280, .end = 2200 }, - .hsyn_pol = 0, - .hsyn = { .beg = 88, .end = 88 + 44 }, - .interlaced = 1, - .vact[0] = { .beg = 20 + 2, .end = 560 + 2 }, - .vact[1] = { .beg = 583 + 2, .end = 1123 + 2 }, - .vsyn_pol = 0, - .vsyn_off = 1100, - .vsyn[0] = { .beg = 0 + 2, .end = 5 + 2}, - .vsyn[1] = { .beg = 562 + 2, .end = 567 + 2}, -}; - -static const struct hdmi_timings hdmi_timings_1080i50 = { - .hact = { .beg = 720, .end = 2640 }, - .hsyn_pol = 0, - .hsyn = { .beg = 528, .end = 528 + 44 }, - .interlaced = 1, - .vact[0] = { .beg = 20 + 2, .end = 560 + 2 }, - .vact[1] = { .beg = 583 + 2, .end = 1123 + 2 }, - .vsyn_pol = 0, - .vsyn_off = 1320, - .vsyn[0] = { .beg = 0 + 2, .end = 5 + 2}, - .vsyn[1] = { .beg = 562 + 2, .end = 567 + 2}, -}; - -static const struct hdmi_timings hdmi_timings_1080p50 = { - .hact = { .beg = 720, .end = 2640 }, - .hsyn_pol = 0, - .hsyn = { .beg = 528, .end = 528 + 44 }, - .interlaced = 0, - .vact[0] = { .beg = 41 + 4, .end = 1121 + 4 }, - .vsyn_pol = 0, - .vsyn[0] = { .beg = 0 + 4, .end = 5 + 4}, -}; - -/* default hdmi_timings index of the timings configured on probe */ -#define HDMI_DEFAULT_TIMINGS_IDX (0) - -static const struct { - bool reduced_fps; - const struct v4l2_dv_timings dv_timings; - const struct hdmi_timings *hdmi_timings; -} hdmi_timings[] = { - { false, V4L2_DV_BT_CEA_720X480P59_94, &hdmi_timings_480p }, - { false, V4L2_DV_BT_CEA_720X576P50, &hdmi_timings_576p50 }, - { false, V4L2_DV_BT_CEA_1280X720P50, &hdmi_timings_720p50 }, - { true, V4L2_DV_BT_CEA_1280X720P60, &hdmi_timings_720p60 }, - { false, V4L2_DV_BT_CEA_1920X1080P24, &hdmi_timings_1080p24 }, - { false, V4L2_DV_BT_CEA_1920X1080P30, &hdmi_timings_1080p60 }, - { false, V4L2_DV_BT_CEA_1920X1080P50, &hdmi_timings_1080p50 }, - { false, V4L2_DV_BT_CEA_1920X1080I50, &hdmi_timings_1080i50 }, - { false, V4L2_DV_BT_CEA_1920X1080I60, &hdmi_timings_1080i60 }, - { false, V4L2_DV_BT_CEA_1920X1080P60, &hdmi_timings_1080p60 }, -}; - -static int hdmi_streamon(struct hdmi_device *hdev) -{ - struct device *dev = hdev->dev; - struct hdmi_resources *res = &hdev->res; - int ret, tries; - - dev_dbg(dev, "%s\n", __func__); - - ret = hdmi_conf_apply(hdev); - if (ret) - return ret; - - ret = v4l2_subdev_call(hdev->phy_sd, video, s_stream, 1); - if (ret) - return ret; - - /* waiting for HDMIPHY's PLL to get to steady state */ - for (tries = 100; tries; --tries) { - u32 val = hdmi_read(hdev, HDMI_PHY_STATUS); - if (val & HDMI_PHY_STATUS_READY) - break; - mdelay(1); - } - /* steady state not achieved */ - if (tries == 0) { - dev_err(dev, "hdmiphy's pll could not reach steady state.\n"); - v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); - hdmi_dumpregs(hdev, "hdmiphy - s_stream"); - return -EIO; - } - - /* starting MHL */ - ret = v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 1); - if (hdev->mhl_sd && ret) { - v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); - hdmi_dumpregs(hdev, "mhl - s_stream"); - return -EIO; - } - - /* hdmiphy clock is used for HDMI in streaming mode */ - clk_disable(res->sclk_hdmi); - clk_set_parent(res->sclk_hdmi, res->sclk_hdmiphy); - clk_enable(res->sclk_hdmi); - - /* enable HDMI and timing generator */ - hdmi_write_mask(hdev, HDMI_CON_0, ~0, HDMI_EN); - hdmi_write_mask(hdev, HDMI_TG_CMD, ~0, HDMI_TG_EN); - hdmi_dumpregs(hdev, "streamon"); - return 0; -} - -static int hdmi_streamoff(struct hdmi_device *hdev) -{ - struct device *dev = hdev->dev; - struct hdmi_resources *res = &hdev->res; - - dev_dbg(dev, "%s\n", __func__); - - hdmi_write_mask(hdev, HDMI_CON_0, 0, HDMI_EN); - hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_EN); - - /* pixel(vpll) clock is used for HDMI in config mode */ - clk_disable(res->sclk_hdmi); - clk_set_parent(res->sclk_hdmi, res->sclk_pixel); - clk_enable(res->sclk_hdmi); - - v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 0); - v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); - - hdmi_dumpregs(hdev, "streamoff"); - return 0; -} - -static int hdmi_s_stream(struct v4l2_subdev *sd, int enable) -{ - struct hdmi_device *hdev = sd_to_hdmi_dev(sd); - struct device *dev = hdev->dev; - - dev_dbg(dev, "%s(%d)\n", __func__, enable); - if (enable) - return hdmi_streamon(hdev); - return hdmi_streamoff(hdev); -} - -static int hdmi_resource_poweron(struct hdmi_resources *res) -{ - int ret; - - /* turn HDMI power on */ - ret = regulator_bulk_enable(res->regul_count, res->regul_bulk); - if (ret < 0) - return ret; - /* power-on hdmi physical interface */ - clk_enable(res->hdmiphy); - /* use VPP as parent clock; HDMIPHY is not working yet */ - clk_set_parent(res->sclk_hdmi, res->sclk_pixel); - /* turn clocks on */ - clk_enable(res->sclk_hdmi); - - return 0; -} - -static void hdmi_resource_poweroff(struct hdmi_resources *res) -{ - /* turn clocks off */ - clk_disable(res->sclk_hdmi); - /* power-off hdmiphy */ - clk_disable(res->hdmiphy); - /* turn HDMI power off */ - regulator_bulk_disable(res->regul_count, res->regul_bulk); -} - -static int hdmi_s_power(struct v4l2_subdev *sd, int on) -{ - struct hdmi_device *hdev = sd_to_hdmi_dev(sd); - int ret; - - if (on) - ret = pm_runtime_get_sync(hdev->dev); - else - ret = pm_runtime_put_sync(hdev->dev); - /* only values < 0 indicate errors */ - return ret < 0 ? ret : 0; -} - -static int hdmi_s_dv_timings(struct v4l2_subdev *sd, - struct v4l2_dv_timings *timings) -{ - struct hdmi_device *hdev = sd_to_hdmi_dev(sd); - struct device *dev = hdev->dev; - int i; - - for (i = 0; i < ARRAY_SIZE(hdmi_timings); i++) - if (v4l2_match_dv_timings(&hdmi_timings[i].dv_timings, - timings, 0, false)) - break; - if (i == ARRAY_SIZE(hdmi_timings)) { - dev_err(dev, "timings not supported\n"); - return -EINVAL; - } - hdev->cur_conf = hdmi_timings[i].hdmi_timings; - hdev->cur_conf_dirty = 1; - hdev->cur_timings = *timings; - if (!hdmi_timings[i].reduced_fps) - hdev->cur_timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS; - return 0; -} - -static int hdmi_g_dv_timings(struct v4l2_subdev *sd, - struct v4l2_dv_timings *timings) -{ - *timings = sd_to_hdmi_dev(sd)->cur_timings; - return 0; -} - -static int hdmi_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - struct hdmi_device *hdev = sd_to_hdmi_dev(sd); - const struct hdmi_timings *t = hdev->cur_conf; - - dev_dbg(hdev->dev, "%s\n", __func__); - if (!hdev->cur_conf) - return -EINVAL; - if (format->pad) - return -EINVAL; - - memset(fmt, 0, sizeof(*fmt)); - fmt->width = t->hact.end - t->hact.beg; - fmt->height = t->vact[0].end - t->vact[0].beg; - fmt->code = MEDIA_BUS_FMT_FIXED; /* means RGB888 */ - fmt->colorspace = V4L2_COLORSPACE_SRGB; - if (t->interlaced) { - fmt->field = V4L2_FIELD_INTERLACED; - fmt->height *= 2; - } else { - fmt->field = V4L2_FIELD_NONE; - } - return 0; -} - -static int hdmi_enum_dv_timings(struct v4l2_subdev *sd, - struct v4l2_enum_dv_timings *timings) -{ - if (timings->pad != 0) - return -EINVAL; - if (timings->index >= ARRAY_SIZE(hdmi_timings)) - return -EINVAL; - timings->timings = hdmi_timings[timings->index].dv_timings; - if (!hdmi_timings[timings->index].reduced_fps) - timings->timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS; - return 0; -} - -static int hdmi_dv_timings_cap(struct v4l2_subdev *sd, - struct v4l2_dv_timings_cap *cap) -{ - struct hdmi_device *hdev = sd_to_hdmi_dev(sd); - - if (cap->pad != 0) - return -EINVAL; - - /* Let the phy fill in the pixelclock range */ - v4l2_subdev_call(hdev->phy_sd, pad, dv_timings_cap, cap); - cap->type = V4L2_DV_BT_656_1120; - cap->bt.min_width = 720; - cap->bt.max_width = 1920; - cap->bt.min_height = 480; - cap->bt.max_height = 1080; - cap->bt.standards = V4L2_DV_BT_STD_CEA861; - cap->bt.capabilities = V4L2_DV_BT_CAP_INTERLACED | - V4L2_DV_BT_CAP_PROGRESSIVE; - return 0; -} - -static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = { - .s_power = hdmi_s_power, -}; - -static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = { - .s_dv_timings = hdmi_s_dv_timings, - .g_dv_timings = hdmi_g_dv_timings, - .s_stream = hdmi_s_stream, -}; - -static const struct v4l2_subdev_pad_ops hdmi_sd_pad_ops = { - .enum_dv_timings = hdmi_enum_dv_timings, - .dv_timings_cap = hdmi_dv_timings_cap, - .get_fmt = hdmi_get_fmt, -}; - -static const struct v4l2_subdev_ops hdmi_sd_ops = { - .core = &hdmi_sd_core_ops, - .video = &hdmi_sd_video_ops, - .pad = &hdmi_sd_pad_ops, -}; - -static int hdmi_runtime_suspend(struct device *dev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct hdmi_device *hdev = sd_to_hdmi_dev(sd); - - dev_dbg(dev, "%s\n", __func__); - v4l2_subdev_call(hdev->mhl_sd, core, s_power, 0); - hdmi_resource_poweroff(&hdev->res); - /* flag that device context is lost */ - hdev->cur_conf_dirty = 1; - return 0; -} - -static int hdmi_runtime_resume(struct device *dev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct hdmi_device *hdev = sd_to_hdmi_dev(sd); - int ret; - - dev_dbg(dev, "%s\n", __func__); - - ret = hdmi_resource_poweron(&hdev->res); - if (ret < 0) - return ret; - - /* starting MHL */ - ret = v4l2_subdev_call(hdev->mhl_sd, core, s_power, 1); - if (hdev->mhl_sd && ret) - goto fail; - - dev_dbg(dev, "poweron succeed\n"); - - return 0; - -fail: - hdmi_resource_poweroff(&hdev->res); - dev_err(dev, "poweron failed\n"); - - return ret; -} - -static const struct dev_pm_ops hdmi_pm_ops = { - .runtime_suspend = hdmi_runtime_suspend, - .runtime_resume = hdmi_runtime_resume, -}; - -static void hdmi_resource_clear_clocks(struct hdmi_resources *res) -{ - res->hdmi = ERR_PTR(-EINVAL); - res->sclk_hdmi = ERR_PTR(-EINVAL); - res->sclk_pixel = ERR_PTR(-EINVAL); - res->sclk_hdmiphy = ERR_PTR(-EINVAL); - res->hdmiphy = ERR_PTR(-EINVAL); -} - -static void hdmi_resources_cleanup(struct hdmi_device *hdev) -{ - struct hdmi_resources *res = &hdev->res; - - dev_dbg(hdev->dev, "HDMI resource cleanup\n"); - /* put clocks, power */ - if (res->regul_count) - regulator_bulk_free(res->regul_count, res->regul_bulk); - /* kfree is NULL-safe */ - kfree(res->regul_bulk); - if (!IS_ERR(res->hdmiphy)) - clk_put(res->hdmiphy); - if (!IS_ERR(res->sclk_hdmiphy)) - clk_put(res->sclk_hdmiphy); - if (!IS_ERR(res->sclk_pixel)) - clk_put(res->sclk_pixel); - if (!IS_ERR(res->sclk_hdmi)) - clk_put(res->sclk_hdmi); - if (!IS_ERR(res->hdmi)) - clk_put(res->hdmi); - memset(res, 0, sizeof(*res)); - hdmi_resource_clear_clocks(res); -} - -static int hdmi_resources_init(struct hdmi_device *hdev) -{ - struct device *dev = hdev->dev; - struct hdmi_resources *res = &hdev->res; - static char *supply[] = { - "hdmi-en", - "vdd", - "vdd_osc", - "vdd_pll", - }; - int i, ret; - - dev_dbg(dev, "HDMI resource init\n"); - - memset(res, 0, sizeof(*res)); - hdmi_resource_clear_clocks(res); - - /* get clocks, power */ - res->hdmi = clk_get(dev, "hdmi"); - if (IS_ERR(res->hdmi)) { - dev_err(dev, "failed to get clock 'hdmi'\n"); - goto fail; - } - res->sclk_hdmi = clk_get(dev, "sclk_hdmi"); - if (IS_ERR(res->sclk_hdmi)) { - dev_err(dev, "failed to get clock 'sclk_hdmi'\n"); - goto fail; - } - res->sclk_pixel = clk_get(dev, "sclk_pixel"); - if (IS_ERR(res->sclk_pixel)) { - dev_err(dev, "failed to get clock 'sclk_pixel'\n"); - goto fail; - } - res->sclk_hdmiphy = clk_get(dev, "sclk_hdmiphy"); - if (IS_ERR(res->sclk_hdmiphy)) { - dev_err(dev, "failed to get clock 'sclk_hdmiphy'\n"); - goto fail; - } - res->hdmiphy = clk_get(dev, "hdmiphy"); - if (IS_ERR(res->hdmiphy)) { - dev_err(dev, "failed to get clock 'hdmiphy'\n"); - goto fail; - } - res->regul_bulk = kcalloc(ARRAY_SIZE(supply), - sizeof(res->regul_bulk[0]), GFP_KERNEL); - if (!res->regul_bulk) { - dev_err(dev, "failed to get memory for regulators\n"); - goto fail; - } - for (i = 0; i < ARRAY_SIZE(supply); ++i) { - res->regul_bulk[i].supply = supply[i]; - res->regul_bulk[i].consumer = NULL; - } - - ret = regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk); - if (ret) { - dev_err(dev, "failed to get regulators\n"); - goto fail; - } - res->regul_count = ARRAY_SIZE(supply); - - return 0; -fail: - dev_err(dev, "HDMI resource init - failed\n"); - hdmi_resources_cleanup(hdev); - return -ENODEV; -} - -static int hdmi_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct resource *res; - struct i2c_adapter *adapter; - struct v4l2_subdev *sd; - struct hdmi_device *hdmi_dev = NULL; - struct s5p_hdmi_platform_data *pdata = dev->platform_data; - int ret; - - dev_dbg(dev, "probe start\n"); - - if (!pdata) { - dev_err(dev, "platform data is missing\n"); - ret = -ENODEV; - goto fail; - } - - hdmi_dev = devm_kzalloc(&pdev->dev, sizeof(*hdmi_dev), GFP_KERNEL); - if (!hdmi_dev) { - dev_err(dev, "out of memory\n"); - ret = -ENOMEM; - goto fail; - } - - hdmi_dev->dev = dev; - - ret = hdmi_resources_init(hdmi_dev); - if (ret) - goto fail; - - /* mapping HDMI registers */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(dev, "get memory resource failed.\n"); - ret = -ENXIO; - goto fail_init; - } - - hdmi_dev->regs = devm_ioremap(&pdev->dev, res->start, - resource_size(res)); - if (hdmi_dev->regs == NULL) { - dev_err(dev, "register mapping failed.\n"); - ret = -ENXIO; - goto fail_init; - } - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res == NULL) { - dev_err(dev, "get interrupt resource failed.\n"); - ret = -ENXIO; - goto fail_init; - } - - ret = devm_request_irq(&pdev->dev, res->start, hdmi_irq_handler, 0, - "hdmi", hdmi_dev); - if (ret) { - dev_err(dev, "request interrupt failed.\n"); - goto fail_init; - } - hdmi_dev->irq = res->start; - - /* setting v4l2 name to prevent WARN_ON in v4l2_device_register */ - strlcpy(hdmi_dev->v4l2_dev.name, dev_name(dev), - sizeof(hdmi_dev->v4l2_dev.name)); - /* passing NULL owner prevents driver from erasing drvdata */ - ret = v4l2_device_register(NULL, &hdmi_dev->v4l2_dev); - if (ret) { - dev_err(dev, "could not register v4l2 device.\n"); - goto fail_init; - } - - /* testing if hdmiphy info is present */ - if (!pdata->hdmiphy_info) { - dev_err(dev, "hdmiphy info is missing in platform data\n"); - ret = -ENXIO; - goto fail_vdev; - } - - adapter = i2c_get_adapter(pdata->hdmiphy_bus); - if (adapter == NULL) { - dev_err(dev, "hdmiphy adapter request failed\n"); - ret = -ENXIO; - goto fail_vdev; - } - - hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev, - adapter, pdata->hdmiphy_info, NULL); - /* on failure or not adapter is no longer useful */ - i2c_put_adapter(adapter); - if (hdmi_dev->phy_sd == NULL) { - dev_err(dev, "missing subdev for hdmiphy\n"); - ret = -ENODEV; - goto fail_vdev; - } - - /* initialization of MHL interface if present */ - if (pdata->mhl_info) { - adapter = i2c_get_adapter(pdata->mhl_bus); - if (adapter == NULL) { - dev_err(dev, "MHL adapter request failed\n"); - ret = -ENXIO; - goto fail_vdev; - } - - hdmi_dev->mhl_sd = v4l2_i2c_new_subdev_board( - &hdmi_dev->v4l2_dev, adapter, - pdata->mhl_info, NULL); - /* on failure or not adapter is no longer useful */ - i2c_put_adapter(adapter); - if (hdmi_dev->mhl_sd == NULL) { - dev_err(dev, "missing subdev for MHL\n"); - ret = -ENODEV; - goto fail_vdev; - } - } - - clk_enable(hdmi_dev->res.hdmi); - - pm_runtime_enable(dev); - - sd = &hdmi_dev->sd; - v4l2_subdev_init(sd, &hdmi_sd_ops); - sd->owner = THIS_MODULE; - - strlcpy(sd->name, "s5p-hdmi", sizeof(sd->name)); - hdmi_dev->cur_timings = - hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].dv_timings; - /* FIXME: missing fail timings is not supported */ - hdmi_dev->cur_conf = - hdmi_timings[HDMI_DEFAULT_TIMINGS_IDX].hdmi_timings; - hdmi_dev->cur_conf_dirty = 1; - - /* storing subdev for call that have only access to struct device */ - dev_set_drvdata(dev, sd); - - dev_info(dev, "probe successful\n"); - - return 0; - -fail_vdev: - v4l2_device_unregister(&hdmi_dev->v4l2_dev); - -fail_init: - hdmi_resources_cleanup(hdmi_dev); - -fail: - dev_err(dev, "probe failed\n"); - return ret; -} - -static int hdmi_remove(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct hdmi_device *hdmi_dev = sd_to_hdmi_dev(sd); - - pm_runtime_disable(dev); - clk_disable(hdmi_dev->res.hdmi); - v4l2_device_unregister(&hdmi_dev->v4l2_dev); - disable_irq(hdmi_dev->irq); - hdmi_resources_cleanup(hdmi_dev); - dev_info(dev, "remove successful\n"); - - return 0; -} - -static struct platform_driver hdmi_driver __refdata = { - .probe = hdmi_probe, - .remove = hdmi_remove, - .id_table = hdmi_driver_types, - .driver = { - .name = "s5p-hdmi", - .pm = &hdmi_pm_ops, - } -}; - -module_platform_driver(hdmi_driver); diff --git a/drivers/media/platform/s5p-tv/hdmiphy_drv.c b/drivers/media/platform/s5p-tv/hdmiphy_drv.c deleted file mode 100644 index aae652351aa8..000000000000 --- a/drivers/media/platform/s5p-tv/hdmiphy_drv.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Samsung HDMI Physical interface driver - * - * Copyright (C) 2010-2011 Samsung Electronics Co.Ltd - * Author: Tomasz Stanislawski - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -MODULE_AUTHOR("Tomasz Stanislawski "); -MODULE_DESCRIPTION("Samsung HDMI Physical interface driver"); -MODULE_LICENSE("GPL"); - -struct hdmiphy_conf { - unsigned long pixclk; - const u8 *data; -}; - -struct hdmiphy_ctx { - struct v4l2_subdev sd; - const struct hdmiphy_conf *conf_tab; -}; - -static const struct hdmiphy_conf hdmiphy_conf_s5pv210[] = { - { .pixclk = 27000000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD8, 0x10, 0x1C, 0x30, 0x40, - 0x6B, 0x10, 0x02, 0x52, 0xDF, 0xF2, 0x54, 0x87, - 0x84, 0x00, 0x30, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x22, 0x40, 0xE3, 0x26, 0x00, 0x00, 0x00, 0x00, } - }, - { .pixclk = 27027000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD4, 0x10, 0x9C, 0x09, 0x64, - 0x6B, 0x10, 0x02, 0x52, 0xDF, 0xF2, 0x54, 0x87, - 0x84, 0x00, 0x30, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x22, 0x40, 0xE2, 0x26, 0x00, 0x00, 0x00, 0x00, } - }, - { .pixclk = 74176000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD8, 0x10, 0x9C, 0xEF, 0x5B, - 0x6D, 0x10, 0x01, 0x52, 0xEF, 0xF3, 0x54, 0xB9, - 0x84, 0x00, 0x30, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x22, 0x40, 0xA5, 0x26, 0x01, 0x00, 0x00, 0x00, } - }, - { .pixclk = 74250000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD8, 0x10, 0x9C, 0xF8, 0x40, - 0x6A, 0x10, 0x01, 0x52, 0xFF, 0xF1, 0x54, 0xBA, - 0x84, 0x00, 0x10, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x22, 0x40, 0xA4, 0x26, 0x01, 0x00, 0x00, 0x00, } - }, - { /* end marker */ } -}; - -static const struct hdmiphy_conf hdmiphy_conf_exynos4210[] = { - { .pixclk = 27000000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD8, 0x10, 0x1C, 0x30, 0x40, - 0x6B, 0x10, 0x02, 0x51, 0xDF, 0xF2, 0x54, 0x87, - 0x84, 0x00, 0x30, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x22, 0x40, 0xE3, 0x26, 0x00, 0x00, 0x00, 0x00, } - }, - { .pixclk = 27027000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD4, 0x10, 0x9C, 0x09, 0x64, - 0x6B, 0x10, 0x02, 0x51, 0xDF, 0xF2, 0x54, 0x87, - 0x84, 0x00, 0x30, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x22, 0x40, 0xE2, 0x26, 0x00, 0x00, 0x00, 0x00, } - }, - { .pixclk = 74176000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD8, 0x10, 0x9C, 0xEF, 0x5B, - 0x6D, 0x10, 0x01, 0x51, 0xEF, 0xF3, 0x54, 0xB9, - 0x84, 0x00, 0x30, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x22, 0x40, 0xA5, 0x26, 0x01, 0x00, 0x00, 0x00, } - }, - { .pixclk = 74250000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD8, 0x10, 0x9C, 0xF8, 0x40, - 0x6A, 0x10, 0x01, 0x51, 0xFF, 0xF1, 0x54, 0xBA, - 0x84, 0x00, 0x10, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x22, 0x40, 0xA4, 0x26, 0x01, 0x00, 0x00, 0x00, } - }, - { .pixclk = 148352000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD8, 0x10, 0x9C, 0xEF, 0x5B, - 0x6D, 0x18, 0x00, 0x51, 0xEF, 0xF3, 0x54, 0xB9, - 0x84, 0x00, 0x30, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x11, 0x40, 0xA5, 0x26, 0x02, 0x00, 0x00, 0x00, } - }, - { .pixclk = 148500000, .data = (u8 [32]) { - 0x01, 0x05, 0x00, 0xD8, 0x10, 0x9C, 0xF8, 0x40, - 0x6A, 0x18, 0x00, 0x51, 0xFF, 0xF1, 0x54, 0xBA, - 0x84, 0x00, 0x10, 0x38, 0x00, 0x08, 0x10, 0xE0, - 0x11, 0x40, 0xA4, 0x26, 0x02, 0x00, 0x00, 0x00, } - }, - { /* end marker */ } -}; - -static const struct hdmiphy_conf hdmiphy_conf_exynos4212[] = { - { .pixclk = 27000000, .data = (u8 [32]) { - 0x01, 0x11, 0x2D, 0x75, 0x00, 0x01, 0x00, 0x08, - 0x82, 0x00, 0x0E, 0xD9, 0x45, 0xA0, 0x34, 0xC0, - 0x0B, 0x80, 0x12, 0x87, 0x08, 0x24, 0x24, 0x71, - 0x54, 0xE3, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, } - }, - { .pixclk = 27027000, .data = (u8 [32]) { - 0x01, 0x91, 0x2D, 0x72, 0x00, 0x64, 0x12, 0x08, - 0x43, 0x20, 0x0E, 0xD9, 0x45, 0xA0, 0x34, 0xC0, - 0x0B, 0x80, 0x12, 0x87, 0x08, 0x24, 0x24, 0x71, - 0x54, 0xE2, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, } - }, - { .pixclk = 74176000, .data = (u8 [32]) { - 0x01, 0x91, 0x3E, 0x35, 0x00, 0x5B, 0xDE, 0x08, - 0x82, 0x20, 0x73, 0xD9, 0x45, 0xA0, 0x34, 0xC0, - 0x0B, 0x80, 0x12, 0x87, 0x08, 0x24, 0x24, 0x52, - 0x54, 0xA5, 0x24, 0x01, 0x00, 0x00, 0x01, 0x00, } - }, - { .pixclk = 74250000, .data = (u8 [32]) { - 0x01, 0x91, 0x3E, 0x35, 0x00, 0x40, 0xF0, 0x08, - 0x82, 0x20, 0x73, 0xD9, 0x45, 0xA0, 0x34, 0xC0, - 0x0B, 0x80, 0x12, 0x87, 0x08, 0x24, 0x24, 0x52, - 0x54, 0xA4, 0x24, 0x01, 0x00, 0x00, 0x01, 0x00, } - }, - { .pixclk = 148500000, .data = (u8 [32]) { - 0x01, 0x91, 0x3E, 0x15, 0x00, 0x40, 0xF0, 0x08, - 0x82, 0x20, 0x73, 0xD9, 0x45, 0xA0, 0x34, 0xC0, - 0x0B, 0x80, 0x12, 0x87, 0x08, 0x24, 0x24, 0xA4, - 0x54, 0x4A, 0x25, 0x03, 0x00, 0x00, 0x01, 0x00, } - }, - { /* end marker */ } -}; - -static const struct hdmiphy_conf hdmiphy_conf_exynos4412[] = { - { .pixclk = 27000000, .data = (u8 [32]) { - 0x01, 0x11, 0x2D, 0x75, 0x40, 0x01, 0x00, 0x08, - 0x82, 0x00, 0x0E, 0xD9, 0x45, 0xA0, 0xAC, 0x80, - 0x08, 0x80, 0x11, 0x84, 0x02, 0x22, 0x44, 0x86, - 0x54, 0xE4, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, } - }, - { .pixclk = 27027000, .data = (u8 [32]) { - 0x01, 0x91, 0x2D, 0x72, 0x40, 0x64, 0x12, 0x08, - 0x43, 0x20, 0x0E, 0xD9, 0x45, 0xA0, 0xAC, 0x80, - 0x08, 0x80, 0x11, 0x84, 0x02, 0x22, 0x44, 0x86, - 0x54, 0xE3, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, } - }, - { .pixclk = 74176000, .data = (u8 [32]) { - 0x01, 0x91, 0x1F, 0x10, 0x40, 0x5B, 0xEF, 0x08, - 0x81, 0x20, 0xB9, 0xD8, 0x45, 0xA0, 0xAC, 0x80, - 0x08, 0x80, 0x11, 0x84, 0x02, 0x22, 0x44, 0x86, - 0x54, 0xA6, 0x24, 0x01, 0x00, 0x00, 0x01, 0x00, } - }, - { .pixclk = 74250000, .data = (u8 [32]) { - 0x01, 0x91, 0x1F, 0x10, 0x40, 0x40, 0xF8, 0x08, - 0x81, 0x20, 0xBA, 0xD8, 0x45, 0xA0, 0xAC, 0x80, - 0x08, 0x80, 0x11, 0x84, 0x02, 0x22, 0x44, 0x86, - 0x54, 0xA5, 0x24, 0x01, 0x00, 0x00, 0x01, 0x00, } - }, - { .pixclk = 148500000, .data = (u8 [32]) { - 0x01, 0x91, 0x1F, 0x00, 0x40, 0x40, 0xF8, 0x08, - 0x81, 0x20, 0xBA, 0xD8, 0x45, 0xA0, 0xAC, 0x80, - 0x08, 0x80, 0x11, 0x84, 0x02, 0x22, 0x44, 0x86, - 0x54, 0x4B, 0x25, 0x03, 0x00, 0x00, 0x01, 0x00, } - }, - { /* end marker */ } -}; - -static inline struct hdmiphy_ctx *sd_to_ctx(struct v4l2_subdev *sd) -{ - return container_of(sd, struct hdmiphy_ctx, sd); -} - -static const u8 *hdmiphy_find_conf(unsigned long pixclk, - const struct hdmiphy_conf *conf) -{ - for (; conf->pixclk; ++conf) - if (conf->pixclk == pixclk) - return conf->data; - return NULL; -} - -static int hdmiphy_s_power(struct v4l2_subdev *sd, int on) -{ - /* to be implemented */ - return 0; -} - -static int hdmiphy_s_dv_timings(struct v4l2_subdev *sd, - struct v4l2_dv_timings *timings) -{ - const u8 *data; - u8 buffer[32]; - int ret; - struct hdmiphy_ctx *ctx = sd_to_ctx(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct device *dev = &client->dev; - unsigned long pixclk = timings->bt.pixelclock; - - dev_info(dev, "s_dv_timings\n"); - if ((timings->bt.flags & V4L2_DV_FL_REDUCED_FPS) && pixclk == 74250000) - pixclk = 74176000; - data = hdmiphy_find_conf(pixclk, ctx->conf_tab); - if (!data) { - dev_err(dev, "format not supported\n"); - return -EINVAL; - } - - /* storing configuration to the device */ - memcpy(buffer, data, 32); - ret = i2c_master_send(client, buffer, 32); - if (ret != 32) { - dev_err(dev, "failed to configure HDMIPHY via I2C\n"); - return -EIO; - } - - return 0; -} - -static int hdmiphy_dv_timings_cap(struct v4l2_subdev *sd, - struct v4l2_dv_timings_cap *cap) -{ - if (cap->pad != 0) - return -EINVAL; - - cap->type = V4L2_DV_BT_656_1120; - /* The phy only determines the pixelclock, leave the other values - * at 0 to signify that we have no information for them. */ - cap->bt.min_pixelclock = 27000000; - cap->bt.max_pixelclock = 148500000; - return 0; -} - -static int hdmiphy_s_stream(struct v4l2_subdev *sd, int enable) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct device *dev = &client->dev; - u8 buffer[2]; - int ret; - - dev_info(dev, "s_stream(%d)\n", enable); - /* going to/from configuration from/to operation mode */ - buffer[0] = 0x1f; - buffer[1] = enable ? 0x80 : 0x00; - - ret = i2c_master_send(client, buffer, 2); - if (ret != 2) { - dev_err(dev, "stream (%d) failed\n", enable); - return -EIO; - } - return 0; -} - -static const struct v4l2_subdev_core_ops hdmiphy_core_ops = { - .s_power = hdmiphy_s_power, -}; - -static const struct v4l2_subdev_video_ops hdmiphy_video_ops = { - .s_dv_timings = hdmiphy_s_dv_timings, - .s_stream = hdmiphy_s_stream, -}; - -static const struct v4l2_subdev_pad_ops hdmiphy_pad_ops = { - .dv_timings_cap = hdmiphy_dv_timings_cap, -}; - -static const struct v4l2_subdev_ops hdmiphy_ops = { - .core = &hdmiphy_core_ops, - .video = &hdmiphy_video_ops, - .pad = &hdmiphy_pad_ops, -}; - -static int hdmiphy_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct hdmiphy_ctx *ctx; - - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); - if (!ctx) - return -ENOMEM; - - ctx->conf_tab = (struct hdmiphy_conf *)id->driver_data; - v4l2_i2c_subdev_init(&ctx->sd, client, &hdmiphy_ops); - - dev_info(&client->dev, "probe successful\n"); - return 0; -} - -static int hdmiphy_remove(struct i2c_client *client) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct hdmiphy_ctx *ctx = sd_to_ctx(sd); - - kfree(ctx); - dev_info(&client->dev, "remove successful\n"); - - return 0; -} - -static const struct i2c_device_id hdmiphy_id[] = { - { "hdmiphy", (unsigned long)hdmiphy_conf_exynos4210 }, - { "hdmiphy-s5pv210", (unsigned long)hdmiphy_conf_s5pv210 }, - { "hdmiphy-exynos4210", (unsigned long)hdmiphy_conf_exynos4210 }, - { "hdmiphy-exynos4212", (unsigned long)hdmiphy_conf_exynos4212 }, - { "hdmiphy-exynos4412", (unsigned long)hdmiphy_conf_exynos4412 }, - { }, -}; -MODULE_DEVICE_TABLE(i2c, hdmiphy_id); - -static struct i2c_driver hdmiphy_driver = { - .driver = { - .name = "s5p-hdmiphy", - }, - .probe = hdmiphy_probe, - .remove = hdmiphy_remove, - .id_table = hdmiphy_id, -}; - -module_i2c_driver(hdmiphy_driver); diff --git a/drivers/media/platform/s5p-tv/mixer.h b/drivers/media/platform/s5p-tv/mixer.h deleted file mode 100644 index 869f0ce86f6e..000000000000 --- a/drivers/media/platform/s5p-tv/mixer.h +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Samsung TV Mixer driver - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * - * Tomasz Stanislawski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundiation. either version 2 of the License, - * or (at your option) any later version - */ - -#ifndef SAMSUNG_MIXER_H -#define SAMSUNG_MIXER_H - -#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MIXER_DEBUG - #define DEBUG -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "regs-mixer.h" - -/** maximum number of output interfaces */ -#define MXR_MAX_OUTPUTS 2 -/** maximum number of input interfaces (layers) */ -#define MXR_MAX_LAYERS 3 -#define MXR_DRIVER_NAME "s5p-mixer" -/** maximal number of planes for every layer */ -#define MXR_MAX_PLANES 2 - -#define MXR_ENABLE 1 -#define MXR_DISABLE 0 - -/** description of a macroblock for packed formats */ -struct mxr_block { - /** vertical number of pixels in macroblock */ - unsigned int width; - /** horizontal number of pixels in macroblock */ - unsigned int height; - /** size of block in bytes */ - unsigned int size; -}; - -/** description of supported format */ -struct mxr_format { - /** format name/mnemonic */ - const char *name; - /** fourcc identifier */ - u32 fourcc; - /** colorspace identifier */ - enum v4l2_colorspace colorspace; - /** number of planes in image data */ - int num_planes; - /** description of block for each plane */ - struct mxr_block plane[MXR_MAX_PLANES]; - /** number of subframes in image data */ - int num_subframes; - /** specifies to which subframe belong given plane */ - int plane2subframe[MXR_MAX_PLANES]; - /** internal code, driver dependent */ - unsigned long cookie; -}; - -/** description of crop configuration for image */ -struct mxr_crop { - /** width of layer in pixels */ - unsigned int full_width; - /** height of layer in pixels */ - unsigned int full_height; - /** horizontal offset of first pixel to be displayed */ - unsigned int x_offset; - /** vertical offset of first pixel to be displayed */ - unsigned int y_offset; - /** width of displayed data in pixels */ - unsigned int width; - /** height of displayed data in pixels */ - unsigned int height; - /** indicate which fields are present in buffer */ - unsigned int field; -}; - -/** stages of geometry operations */ -enum mxr_geometry_stage { - MXR_GEOMETRY_SINK, - MXR_GEOMETRY_COMPOSE, - MXR_GEOMETRY_CROP, - MXR_GEOMETRY_SOURCE, -}; - -/* flag indicating that offset should be 0 */ -#define MXR_NO_OFFSET 0x80000000 - -/** description of transformation from source to destination image */ -struct mxr_geometry { - /** cropping for source image */ - struct mxr_crop src; - /** cropping for destination image */ - struct mxr_crop dst; - /** layer-dependant description of horizontal scaling */ - unsigned int x_ratio; - /** layer-dependant description of vertical scaling */ - unsigned int y_ratio; -}; - -/** instance of a buffer */ -struct mxr_buffer { - /** common v4l buffer stuff -- must be first */ - struct vb2_v4l2_buffer vb; - /** node for layer's lists */ - struct list_head list; -}; - - -/** internal states of layer */ -enum mxr_layer_state { - /** layers is not shown */ - MXR_LAYER_IDLE = 0, - /** layer is shown */ - MXR_LAYER_STREAMING, - /** state before STREAMOFF is finished */ - MXR_LAYER_STREAMING_FINISH, -}; - -/** forward declarations */ -struct mxr_device; -struct mxr_layer; - -/** callback for layers operation */ -struct mxr_layer_ops { - /* TODO: try to port it to subdev API */ - /** handler for resource release function */ - void (*release)(struct mxr_layer *); - /** setting buffer to HW */ - void (*buffer_set)(struct mxr_layer *, struct mxr_buffer *); - /** setting format and geometry in HW */ - void (*format_set)(struct mxr_layer *); - /** streaming stop/start */ - void (*stream_set)(struct mxr_layer *, int); - /** adjusting geometry */ - void (*fix_geometry)(struct mxr_layer *, - enum mxr_geometry_stage, unsigned long); -}; - -/** layer instance, a single window and content displayed on output */ -struct mxr_layer { - /** parent mixer device */ - struct mxr_device *mdev; - /** layer index (unique identifier) */ - int idx; - /** callbacks for layer methods */ - struct mxr_layer_ops ops; - /** format array */ - const struct mxr_format **fmt_array; - /** size of format array */ - unsigned long fmt_array_size; - - /** lock for protection of list and state fields */ - spinlock_t enq_slock; - /** list for enqueued buffers */ - struct list_head enq_list; - /** buffer currently owned by hardware in temporary registers */ - struct mxr_buffer *update_buf; - /** buffer currently owned by hardware in shadow registers */ - struct mxr_buffer *shadow_buf; - /** state of layer IDLE/STREAMING */ - enum mxr_layer_state state; - - /** mutex for protection of fields below */ - struct mutex mutex; - /** handler for video node */ - struct video_device vfd; - /** queue for output buffers */ - struct vb2_queue vb_queue; - /** current image format */ - const struct mxr_format *fmt; - /** current geometry of image */ - struct mxr_geometry geo; -}; - -/** description of mixers output interface */ -struct mxr_output { - /** name of output */ - char name[32]; - /** output subdev */ - struct v4l2_subdev *sd; - /** cookie used for configuration of registers */ - int cookie; -}; - -/** specify source of output subdevs */ -struct mxr_output_conf { - /** name of output (connector) */ - char *output_name; - /** name of module that generates output subdev */ - char *module_name; - /** cookie need for mixer HW */ - int cookie; -}; - -struct clk; -struct regulator; - -/** auxiliary resources used my mixer */ -struct mxr_resources { - /** interrupt index */ - int irq; - /** pointer to Mixer registers */ - void __iomem *mxr_regs; - /** pointer to Video Processor registers */ - void __iomem *vp_regs; - /** other resources, should used under mxr_device.mutex */ - struct clk *mixer; - struct clk *vp; - struct clk *sclk_mixer; - struct clk *sclk_hdmi; - struct clk *sclk_dac; -}; - -/* event flags used */ -enum mxr_devide_flags { - MXR_EVENT_VSYNC = 0, - MXR_EVENT_TOP = 1, -}; - -/** drivers instance */ -struct mxr_device { - /** master device */ - struct device *dev; - /** state of each layer */ - struct mxr_layer *layer[MXR_MAX_LAYERS]; - /** state of each output */ - struct mxr_output *output[MXR_MAX_OUTPUTS]; - /** number of registered outputs */ - int output_cnt; - - /* video resources */ - - /** V4L2 device */ - struct v4l2_device v4l2_dev; - /** event wait queue */ - wait_queue_head_t event_queue; - /** state flags */ - unsigned long event_flags; - - /** spinlock for protection of registers */ - spinlock_t reg_slock; - - /** mutex for protection of fields below */ - struct mutex mutex; - /** number of entities depndant on output configuration */ - int n_output; - /** number of users that do streaming */ - int n_streamer; - /** index of current output */ - int current_output; - /** auxiliary resources used my mixer */ - struct mxr_resources res; -}; - -/** transform device structure into mixer device */ -static inline struct mxr_device *to_mdev(struct device *dev) -{ - struct v4l2_device *vdev = dev_get_drvdata(dev); - return container_of(vdev, struct mxr_device, v4l2_dev); -} - -/** get current output data, should be called under mdev's mutex */ -static inline struct mxr_output *to_output(struct mxr_device *mdev) -{ - return mdev->output[mdev->current_output]; -} - -/** get current output subdev, should be called under mdev's mutex */ -static inline struct v4l2_subdev *to_outsd(struct mxr_device *mdev) -{ - struct mxr_output *out = to_output(mdev); - return out ? out->sd : NULL; -} - -/** forward declaration for mixer platform data */ -struct mxr_platform_data; - -/** acquiring common video resources */ -int mxr_acquire_video(struct mxr_device *mdev, - struct mxr_output_conf *output_cont, int output_count); - -/** releasing common video resources */ -void mxr_release_video(struct mxr_device *mdev); - -struct mxr_layer *mxr_graph_layer_create(struct mxr_device *mdev, int idx); -struct mxr_layer *mxr_vp_layer_create(struct mxr_device *mdev, int idx); -struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev, - int idx, char *name, const struct mxr_layer_ops *ops); - -void mxr_base_layer_release(struct mxr_layer *layer); -void mxr_layer_release(struct mxr_layer *layer); - -int mxr_base_layer_register(struct mxr_layer *layer); -void mxr_base_layer_unregister(struct mxr_layer *layer); - -unsigned long mxr_get_plane_size(const struct mxr_block *blk, - unsigned int width, unsigned int height); - -/** adds new consumer for mixer's power */ -int __must_check mxr_power_get(struct mxr_device *mdev); -/** removes consumer for mixer's power */ -void mxr_power_put(struct mxr_device *mdev); -/** add new client for output configuration */ -void mxr_output_get(struct mxr_device *mdev); -/** removes new client for output configuration */ -void mxr_output_put(struct mxr_device *mdev); -/** add new client for streaming */ -void mxr_streamer_get(struct mxr_device *mdev); -/** removes new client for streaming */ -void mxr_streamer_put(struct mxr_device *mdev); -/** returns format of data delivared to current output */ -void mxr_get_mbus_fmt(struct mxr_device *mdev, - struct v4l2_mbus_framefmt *mbus_fmt); - -/* Debug */ - -#define mxr_err(mdev, fmt, ...) dev_err(mdev->dev, fmt, ##__VA_ARGS__) -#define mxr_warn(mdev, fmt, ...) dev_warn(mdev->dev, fmt, ##__VA_ARGS__) -#define mxr_info(mdev, fmt, ...) dev_info(mdev->dev, fmt, ##__VA_ARGS__) - -#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MIXER_DEBUG - #define mxr_dbg(mdev, fmt, ...) dev_dbg(mdev->dev, fmt, ##__VA_ARGS__) -#else - #define mxr_dbg(mdev, fmt, ...) do { (void) mdev; } while (0) -#endif - -/* accessing Mixer's and Video Processor's registers */ - -void mxr_vsync_set_update(struct mxr_device *mdev, int en); -void mxr_reg_reset(struct mxr_device *mdev); -irqreturn_t mxr_irq_handler(int irq, void *dev_data); -void mxr_reg_s_output(struct mxr_device *mdev, int cookie); -void mxr_reg_streamon(struct mxr_device *mdev); -void mxr_reg_streamoff(struct mxr_device *mdev); -int mxr_reg_wait4vsync(struct mxr_device *mdev); -void mxr_reg_set_mbus_fmt(struct mxr_device *mdev, - struct v4l2_mbus_framefmt *fmt); -void mxr_reg_graph_layer_stream(struct mxr_device *mdev, int idx, int en); -void mxr_reg_graph_buffer(struct mxr_device *mdev, int idx, dma_addr_t addr); -void mxr_reg_graph_format(struct mxr_device *mdev, int idx, - const struct mxr_format *fmt, const struct mxr_geometry *geo); - -void mxr_reg_vp_layer_stream(struct mxr_device *mdev, int en); -void mxr_reg_vp_buffer(struct mxr_device *mdev, - dma_addr_t luma_addr[2], dma_addr_t chroma_addr[2]); -void mxr_reg_vp_format(struct mxr_device *mdev, - const struct mxr_format *fmt, const struct mxr_geometry *geo); -void mxr_reg_dump(struct mxr_device *mdev); - -#endif /* SAMSUNG_MIXER_H */ - diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c deleted file mode 100644 index 8a5d19469ddc..000000000000 --- a/drivers/media/platform/s5p-tv/mixer_drv.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Samsung TV Mixer driver - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * - * Tomasz Stanislawski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundiation. either version 2 of the License, - * or (at your option) any later version - */ - -#include "mixer.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Tomasz Stanislawski, "); -MODULE_DESCRIPTION("Samsung MIXER"); -MODULE_LICENSE("GPL"); - -/* --------- DRIVER PARAMETERS ---------- */ - -static struct mxr_output_conf mxr_output_conf[] = { - { - .output_name = "S5P HDMI connector", - .module_name = "s5p-hdmi", - .cookie = 1, - }, - { - .output_name = "S5P SDO connector", - .module_name = "s5p-sdo", - .cookie = 0, - }, -}; - -void mxr_get_mbus_fmt(struct mxr_device *mdev, - struct v4l2_mbus_framefmt *mbus_fmt) -{ - struct v4l2_subdev *sd; - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - int ret; - - mutex_lock(&mdev->mutex); - sd = to_outsd(mdev); - ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); - *mbus_fmt = fmt.format; - WARN(ret, "failed to get mbus_fmt for output %s\n", sd->name); - mutex_unlock(&mdev->mutex); -} - -void mxr_streamer_get(struct mxr_device *mdev) -{ - mutex_lock(&mdev->mutex); - ++mdev->n_streamer; - mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer); - if (mdev->n_streamer == 1) { - struct v4l2_subdev *sd = to_outsd(mdev); - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - struct v4l2_mbus_framefmt *mbus_fmt = &fmt.format; - struct mxr_resources *res = &mdev->res; - int ret; - - if (to_output(mdev)->cookie == 0) - clk_set_parent(res->sclk_mixer, res->sclk_dac); - else - clk_set_parent(res->sclk_mixer, res->sclk_hdmi); - mxr_reg_s_output(mdev, to_output(mdev)->cookie); - - ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); - WARN(ret, "failed to get mbus_fmt for output %s\n", sd->name); - ret = v4l2_subdev_call(sd, video, s_stream, 1); - WARN(ret, "starting stream failed for output %s\n", sd->name); - - mxr_reg_set_mbus_fmt(mdev, mbus_fmt); - mxr_reg_streamon(mdev); - ret = mxr_reg_wait4vsync(mdev); - WARN(ret, "failed to get vsync (%d) from output\n", ret); - } - mutex_unlock(&mdev->mutex); - mxr_reg_dump(mdev); - /* FIXME: what to do when streaming fails? */ -} - -void mxr_streamer_put(struct mxr_device *mdev) -{ - mutex_lock(&mdev->mutex); - --mdev->n_streamer; - mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer); - if (mdev->n_streamer == 0) { - int ret; - struct v4l2_subdev *sd = to_outsd(mdev); - - mxr_reg_streamoff(mdev); - /* vsync applies Mixer setup */ - ret = mxr_reg_wait4vsync(mdev); - WARN(ret, "failed to get vsync (%d) from output\n", ret); - ret = v4l2_subdev_call(sd, video, s_stream, 0); - WARN(ret, "stopping stream failed for output %s\n", sd->name); - } - WARN(mdev->n_streamer < 0, "negative number of streamers (%d)\n", - mdev->n_streamer); - mutex_unlock(&mdev->mutex); - mxr_reg_dump(mdev); -} - -void mxr_output_get(struct mxr_device *mdev) -{ - mutex_lock(&mdev->mutex); - ++mdev->n_output; - mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output); - /* turn on auxiliary driver */ - if (mdev->n_output == 1) - v4l2_subdev_call(to_outsd(mdev), core, s_power, 1); - mutex_unlock(&mdev->mutex); -} - -void mxr_output_put(struct mxr_device *mdev) -{ - mutex_lock(&mdev->mutex); - --mdev->n_output; - mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output); - /* turn on auxiliary driver */ - if (mdev->n_output == 0) - v4l2_subdev_call(to_outsd(mdev), core, s_power, 0); - WARN(mdev->n_output < 0, "negative number of output users (%d)\n", - mdev->n_output); - mutex_unlock(&mdev->mutex); -} - -int mxr_power_get(struct mxr_device *mdev) -{ - int ret = pm_runtime_get_sync(mdev->dev); - - /* returning 1 means that power is already enabled, - * so zero success be returned */ - if (ret < 0) - return ret; - return 0; -} - -void mxr_power_put(struct mxr_device *mdev) -{ - pm_runtime_put_sync(mdev->dev); -} - -/* --------- RESOURCE MANAGEMENT -------------*/ - -static int mxr_acquire_plat_resources(struct mxr_device *mdev, - struct platform_device *pdev) -{ - struct resource *res; - int ret; - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mxr"); - if (res == NULL) { - mxr_err(mdev, "get memory resource failed.\n"); - ret = -ENXIO; - goto fail; - } - - mdev->res.mxr_regs = ioremap(res->start, resource_size(res)); - if (mdev->res.mxr_regs == NULL) { - mxr_err(mdev, "register mapping failed.\n"); - ret = -ENXIO; - goto fail; - } - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vp"); - if (res == NULL) { - mxr_err(mdev, "get memory resource failed.\n"); - ret = -ENXIO; - goto fail_mxr_regs; - } - - mdev->res.vp_regs = ioremap(res->start, resource_size(res)); - if (mdev->res.vp_regs == NULL) { - mxr_err(mdev, "register mapping failed.\n"); - ret = -ENXIO; - goto fail_mxr_regs; - } - - res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "irq"); - if (res == NULL) { - mxr_err(mdev, "get interrupt resource failed.\n"); - ret = -ENXIO; - goto fail_vp_regs; - } - - ret = request_irq(res->start, mxr_irq_handler, 0, "s5p-mixer", mdev); - if (ret) { - mxr_err(mdev, "request interrupt failed.\n"); - goto fail_vp_regs; - } - mdev->res.irq = res->start; - - return 0; - -fail_vp_regs: - iounmap(mdev->res.vp_regs); - -fail_mxr_regs: - iounmap(mdev->res.mxr_regs); - -fail: - return ret; -} - -static void mxr_resource_clear_clocks(struct mxr_resources *res) -{ - res->mixer = ERR_PTR(-EINVAL); - res->vp = ERR_PTR(-EINVAL); - res->sclk_mixer = ERR_PTR(-EINVAL); - res->sclk_hdmi = ERR_PTR(-EINVAL); - res->sclk_dac = ERR_PTR(-EINVAL); -} - -static void mxr_release_plat_resources(struct mxr_device *mdev) -{ - free_irq(mdev->res.irq, mdev); - iounmap(mdev->res.vp_regs); - iounmap(mdev->res.mxr_regs); -} - -static void mxr_release_clocks(struct mxr_device *mdev) -{ - struct mxr_resources *res = &mdev->res; - - if (!IS_ERR(res->sclk_dac)) - clk_put(res->sclk_dac); - if (!IS_ERR(res->sclk_hdmi)) - clk_put(res->sclk_hdmi); - if (!IS_ERR(res->sclk_mixer)) - clk_put(res->sclk_mixer); - if (!IS_ERR(res->vp)) - clk_put(res->vp); - if (!IS_ERR(res->mixer)) - clk_put(res->mixer); -} - -static int mxr_acquire_clocks(struct mxr_device *mdev) -{ - struct mxr_resources *res = &mdev->res; - struct device *dev = mdev->dev; - - mxr_resource_clear_clocks(res); - - res->mixer = clk_get(dev, "mixer"); - if (IS_ERR(res->mixer)) { - mxr_err(mdev, "failed to get clock 'mixer'\n"); - goto fail; - } - res->vp = clk_get(dev, "vp"); - if (IS_ERR(res->vp)) { - mxr_err(mdev, "failed to get clock 'vp'\n"); - goto fail; - } - res->sclk_mixer = clk_get(dev, "sclk_mixer"); - if (IS_ERR(res->sclk_mixer)) { - mxr_err(mdev, "failed to get clock 'sclk_mixer'\n"); - goto fail; - } - res->sclk_hdmi = clk_get(dev, "sclk_hdmi"); - if (IS_ERR(res->sclk_hdmi)) { - mxr_err(mdev, "failed to get clock 'sclk_hdmi'\n"); - goto fail; - } - res->sclk_dac = clk_get(dev, "sclk_dac"); - if (IS_ERR(res->sclk_dac)) { - mxr_err(mdev, "failed to get clock 'sclk_dac'\n"); - goto fail; - } - - return 0; -fail: - mxr_release_clocks(mdev); - return -ENODEV; -} - -static int mxr_acquire_resources(struct mxr_device *mdev, - struct platform_device *pdev) -{ - int ret; - ret = mxr_acquire_plat_resources(mdev, pdev); - - if (ret) - goto fail; - - ret = mxr_acquire_clocks(mdev); - if (ret) - goto fail_plat; - - mxr_info(mdev, "resources acquired\n"); - return 0; - -fail_plat: - mxr_release_plat_resources(mdev); -fail: - mxr_err(mdev, "resources acquire failed\n"); - return ret; -} - -static void mxr_release_resources(struct mxr_device *mdev) -{ - mxr_release_clocks(mdev); - mxr_release_plat_resources(mdev); - memset(&mdev->res, 0, sizeof(mdev->res)); - mxr_resource_clear_clocks(&mdev->res); -} - -static void mxr_release_layers(struct mxr_device *mdev) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(mdev->layer); ++i) - if (mdev->layer[i]) - mxr_layer_release(mdev->layer[i]); -} - -static int mxr_acquire_layers(struct mxr_device *mdev, - struct mxr_platform_data *pdata) -{ - mdev->layer[0] = mxr_graph_layer_create(mdev, 0); - mdev->layer[1] = mxr_graph_layer_create(mdev, 1); - mdev->layer[2] = mxr_vp_layer_create(mdev, 0); - - if (!mdev->layer[0] || !mdev->layer[1] || !mdev->layer[2]) { - mxr_err(mdev, "failed to acquire layers\n"); - goto fail; - } - - return 0; - -fail: - mxr_release_layers(mdev); - return -ENODEV; -} - -/* ---------- POWER MANAGEMENT ----------- */ - -static int mxr_runtime_resume(struct device *dev) -{ - struct mxr_device *mdev = to_mdev(dev); - struct mxr_resources *res = &mdev->res; - int ret; - - mxr_dbg(mdev, "resume - start\n"); - mutex_lock(&mdev->mutex); - /* turn clocks on */ - ret = clk_prepare_enable(res->mixer); - if (ret < 0) { - dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n"); - goto fail; - } - ret = clk_prepare_enable(res->vp); - if (ret < 0) { - dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n"); - goto fail_mixer; - } - ret = clk_prepare_enable(res->sclk_mixer); - if (ret < 0) { - dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n"); - goto fail_vp; - } - /* apply default configuration */ - mxr_reg_reset(mdev); - mxr_dbg(mdev, "resume - finished\n"); - - mutex_unlock(&mdev->mutex); - return 0; - -fail_vp: - clk_disable_unprepare(res->vp); -fail_mixer: - clk_disable_unprepare(res->mixer); -fail: - mutex_unlock(&mdev->mutex); - dev_err(mdev->dev, "resume failed\n"); - return ret; -} - -static int mxr_runtime_suspend(struct device *dev) -{ - struct mxr_device *mdev = to_mdev(dev); - struct mxr_resources *res = &mdev->res; - mxr_dbg(mdev, "suspend - start\n"); - mutex_lock(&mdev->mutex); - /* turn clocks off */ - clk_disable_unprepare(res->sclk_mixer); - clk_disable_unprepare(res->vp); - clk_disable_unprepare(res->mixer); - mutex_unlock(&mdev->mutex); - mxr_dbg(mdev, "suspend - finished\n"); - return 0; -} - -static const struct dev_pm_ops mxr_pm_ops = { - .runtime_suspend = mxr_runtime_suspend, - .runtime_resume = mxr_runtime_resume, -}; - -/* --------- DRIVER INITIALIZATION ---------- */ - -static int mxr_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct mxr_platform_data *pdata = dev->platform_data; - struct mxr_device *mdev; - int ret; - - /* mdev does not exist yet so no mxr_dbg is used */ - dev_info(dev, "probe start\n"); - - mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); - if (!mdev) { - dev_err(dev, "not enough memory.\n"); - ret = -ENOMEM; - goto fail; - } - - /* setup pointer to master device */ - mdev->dev = dev; - - mutex_init(&mdev->mutex); - spin_lock_init(&mdev->reg_slock); - init_waitqueue_head(&mdev->event_queue); - - /* acquire resources: regs, irqs, clocks, regulators */ - ret = mxr_acquire_resources(mdev, pdev); - if (ret) - goto fail_mem; - - /* configure resources for video output */ - ret = mxr_acquire_video(mdev, mxr_output_conf, - ARRAY_SIZE(mxr_output_conf)); - if (ret) - goto fail_resources; - - /* configure layers */ - ret = mxr_acquire_layers(mdev, pdata); - if (ret) - goto fail_video; - - pm_runtime_enable(dev); - - mxr_info(mdev, "probe successful\n"); - return 0; - -fail_video: - mxr_release_video(mdev); - -fail_resources: - mxr_release_resources(mdev); - -fail_mem: - kfree(mdev); - -fail: - dev_info(dev, "probe failed\n"); - return ret; -} - -static int mxr_remove(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct mxr_device *mdev = to_mdev(dev); - - pm_runtime_disable(dev); - - mxr_release_layers(mdev); - mxr_release_video(mdev); - mxr_release_resources(mdev); - - kfree(mdev); - - dev_info(dev, "remove successful\n"); - return 0; -} - -static struct platform_driver mxr_driver __refdata = { - .probe = mxr_probe, - .remove = mxr_remove, - .driver = { - .name = MXR_DRIVER_NAME, - .pm = &mxr_pm_ops, - } -}; - -static int __init mxr_init(void) -{ - int i, ret; - static const char banner[] __initconst = - "Samsung TV Mixer driver, " - "(c) 2010-2011 Samsung Electronics Co., Ltd.\n"; - pr_info("%s\n", banner); - - /* Loading auxiliary modules */ - for (i = 0; i < ARRAY_SIZE(mxr_output_conf); ++i) - request_module(mxr_output_conf[i].module_name); - - ret = platform_driver_register(&mxr_driver); - if (ret != 0) { - pr_err("s5p-tv: registration of MIXER driver failed\n"); - return -ENXIO; - } - - return 0; -} -module_init(mxr_init); - -static void __exit mxr_exit(void) -{ - platform_driver_unregister(&mxr_driver); -} -module_exit(mxr_exit); diff --git a/drivers/media/platform/s5p-tv/mixer_grp_layer.c b/drivers/media/platform/s5p-tv/mixer_grp_layer.c deleted file mode 100644 index d4d2564f7de7..000000000000 --- a/drivers/media/platform/s5p-tv/mixer_grp_layer.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Samsung TV Mixer driver - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * - * Tomasz Stanislawski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundiation. either version 2 of the License, - * or (at your option) any later version - */ - -#include "mixer.h" - -#include - -/* FORMAT DEFINITIONS */ - -static const struct mxr_format mxr_fb_fmt_rgb565 = { - .name = "RGB565", - .fourcc = V4L2_PIX_FMT_RGB565, - .colorspace = V4L2_COLORSPACE_SRGB, - .num_planes = 1, - .plane = { - { .width = 1, .height = 1, .size = 2 }, - }, - .num_subframes = 1, - .cookie = 4, -}; - -static const struct mxr_format mxr_fb_fmt_argb1555 = { - .name = "ARGB1555", - .num_planes = 1, - .fourcc = V4L2_PIX_FMT_RGB555, - .colorspace = V4L2_COLORSPACE_SRGB, - .plane = { - { .width = 1, .height = 1, .size = 2 }, - }, - .num_subframes = 1, - .cookie = 5, -}; - -static const struct mxr_format mxr_fb_fmt_argb4444 = { - .name = "ARGB4444", - .num_planes = 1, - .fourcc = V4L2_PIX_FMT_RGB444, - .colorspace = V4L2_COLORSPACE_SRGB, - .plane = { - { .width = 1, .height = 1, .size = 2 }, - }, - .num_subframes = 1, - .cookie = 6, -}; - -static const struct mxr_format mxr_fb_fmt_argb8888 = { - .name = "ARGB8888", - .fourcc = V4L2_PIX_FMT_BGR32, - .colorspace = V4L2_COLORSPACE_SRGB, - .num_planes = 1, - .plane = { - { .width = 1, .height = 1, .size = 4 }, - }, - .num_subframes = 1, - .cookie = 7, -}; - -static const struct mxr_format *mxr_graph_format[] = { - &mxr_fb_fmt_rgb565, - &mxr_fb_fmt_argb1555, - &mxr_fb_fmt_argb4444, - &mxr_fb_fmt_argb8888, -}; - -/* AUXILIARY CALLBACKS */ - -static void mxr_graph_layer_release(struct mxr_layer *layer) -{ - mxr_base_layer_unregister(layer); - mxr_base_layer_release(layer); -} - -static void mxr_graph_buffer_set(struct mxr_layer *layer, - struct mxr_buffer *buf) -{ - dma_addr_t addr = 0; - - if (buf) - addr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); - mxr_reg_graph_buffer(layer->mdev, layer->idx, addr); -} - -static void mxr_graph_stream_set(struct mxr_layer *layer, int en) -{ - mxr_reg_graph_layer_stream(layer->mdev, layer->idx, en); -} - -static void mxr_graph_format_set(struct mxr_layer *layer) -{ - mxr_reg_graph_format(layer->mdev, layer->idx, - layer->fmt, &layer->geo); -} - -static inline unsigned int closest(unsigned int x, unsigned int a, - unsigned int b, unsigned long flags) -{ - unsigned int mid = (a + b) / 2; - - /* choosing closest value with constraints according to table: - * -------------+-----+-----+-----+-------+ - * flags | 0 | LE | GE | LE|GE | - * -------------+-----+-----+-----+-------+ - * x <= a | a | a | a | a | - * a < x <= mid | a | a | b | a | - * mid < x < b | b | a | b | b | - * b <= x | b | b | b | b | - * -------------+-----+-----+-----+-------+ - */ - - /* remove all non-constraint flags */ - flags &= V4L2_SEL_FLAG_LE | V4L2_SEL_FLAG_GE; - - if (x <= a) - return a; - if (x >= b) - return b; - if (flags == V4L2_SEL_FLAG_LE) - return a; - if (flags == V4L2_SEL_FLAG_GE) - return b; - if (x <= mid) - return a; - return b; -} - -static inline unsigned int do_center(unsigned int center, - unsigned int size, unsigned int upper, unsigned int flags) -{ - unsigned int lower; - - if (flags & MXR_NO_OFFSET) - return 0; - - lower = center - min(center, size / 2); - return min(lower, upper - size); -} - -static void mxr_graph_fix_geometry(struct mxr_layer *layer, - enum mxr_geometry_stage stage, unsigned long flags) -{ - struct mxr_geometry *geo = &layer->geo; - struct mxr_crop *src = &geo->src; - struct mxr_crop *dst = &geo->dst; - unsigned int x_center, y_center; - - switch (stage) { - - case MXR_GEOMETRY_SINK: /* nothing to be fixed here */ - flags = 0; - /* fall through */ - - case MXR_GEOMETRY_COMPOSE: - /* remember center of the area */ - x_center = dst->x_offset + dst->width / 2; - y_center = dst->y_offset + dst->height / 2; - /* round up/down to 2 multiple depending on flags */ - if (flags & V4L2_SEL_FLAG_LE) { - dst->width = round_down(dst->width, 2); - dst->height = round_down(dst->height, 2); - } else { - dst->width = round_up(dst->width, 2); - dst->height = round_up(dst->height, 2); - } - /* assure that compose rect is inside display area */ - dst->width = min(dst->width, dst->full_width); - dst->height = min(dst->height, dst->full_height); - - /* ensure that compose is reachable using 2x scaling */ - dst->width = min(dst->width, 2 * src->full_width); - dst->height = min(dst->height, 2 * src->full_height); - - /* setup offsets */ - dst->x_offset = do_center(x_center, dst->width, - dst->full_width, flags); - dst->y_offset = do_center(y_center, dst->height, - dst->full_height, flags); - flags = 0; - /* fall through */ - - case MXR_GEOMETRY_CROP: - /* remember center of the area */ - x_center = src->x_offset + src->width / 2; - y_center = src->y_offset + src->height / 2; - /* ensure that cropping area lies inside the buffer */ - if (src->full_width < dst->width) - src->width = dst->width / 2; - else - src->width = closest(src->width, dst->width / 2, - dst->width, flags); - - if (src->width == dst->width) - geo->x_ratio = 0; - else - geo->x_ratio = 1; - - if (src->full_height < dst->height) - src->height = dst->height / 2; - else - src->height = closest(src->height, dst->height / 2, - dst->height, flags); - - if (src->height == dst->height) - geo->y_ratio = 0; - else - geo->y_ratio = 1; - - /* setup offsets */ - src->x_offset = do_center(x_center, src->width, - src->full_width, flags); - src->y_offset = do_center(y_center, src->height, - src->full_height, flags); - flags = 0; - /* fall through */ - case MXR_GEOMETRY_SOURCE: - src->full_width = clamp_val(src->full_width, - src->width + src->x_offset, 32767); - src->full_height = clamp_val(src->full_height, - src->height + src->y_offset, 2047); - } -} - -/* PUBLIC API */ - -struct mxr_layer *mxr_graph_layer_create(struct mxr_device *mdev, int idx) -{ - struct mxr_layer *layer; - int ret; - const struct mxr_layer_ops ops = { - .release = mxr_graph_layer_release, - .buffer_set = mxr_graph_buffer_set, - .stream_set = mxr_graph_stream_set, - .format_set = mxr_graph_format_set, - .fix_geometry = mxr_graph_fix_geometry, - }; - char name[32]; - - sprintf(name, "graph%d", idx); - - layer = mxr_base_layer_create(mdev, idx, name, &ops); - if (layer == NULL) { - mxr_err(mdev, "failed to initialize layer(%d) base\n", idx); - goto fail; - } - - layer->fmt_array = mxr_graph_format; - layer->fmt_array_size = ARRAY_SIZE(mxr_graph_format); - - ret = mxr_base_layer_register(layer); - if (ret) - goto fail_layer; - - return layer; - -fail_layer: - mxr_base_layer_release(layer); - -fail: - return NULL; -} - diff --git a/drivers/media/platform/s5p-tv/mixer_reg.c b/drivers/media/platform/s5p-tv/mixer_reg.c deleted file mode 100644 index a0ec14a1da13..000000000000 --- a/drivers/media/platform/s5p-tv/mixer_reg.c +++ /dev/null @@ -1,551 +0,0 @@ -/* - * Samsung TV Mixer driver - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * - * Tomasz Stanislawski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundiation. either version 2 of the License, - * or (at your option) any later version - */ - -#include "mixer.h" -#include "regs-mixer.h" -#include "regs-vp.h" - -#include - -/* Register access subroutines */ - -static inline u32 vp_read(struct mxr_device *mdev, u32 reg_id) -{ - return readl(mdev->res.vp_regs + reg_id); -} - -static inline void vp_write(struct mxr_device *mdev, u32 reg_id, u32 val) -{ - writel(val, mdev->res.vp_regs + reg_id); -} - -static inline void vp_write_mask(struct mxr_device *mdev, u32 reg_id, - u32 val, u32 mask) -{ - u32 old = vp_read(mdev, reg_id); - - val = (val & mask) | (old & ~mask); - writel(val, mdev->res.vp_regs + reg_id); -} - -static inline u32 mxr_read(struct mxr_device *mdev, u32 reg_id) -{ - return readl(mdev->res.mxr_regs + reg_id); -} - -static inline void mxr_write(struct mxr_device *mdev, u32 reg_id, u32 val) -{ - writel(val, mdev->res.mxr_regs + reg_id); -} - -static inline void mxr_write_mask(struct mxr_device *mdev, u32 reg_id, - u32 val, u32 mask) -{ - u32 old = mxr_read(mdev, reg_id); - - val = (val & mask) | (old & ~mask); - writel(val, mdev->res.mxr_regs + reg_id); -} - -void mxr_vsync_set_update(struct mxr_device *mdev, int en) -{ - /* block update on vsync */ - mxr_write_mask(mdev, MXR_STATUS, en ? MXR_STATUS_SYNC_ENABLE : 0, - MXR_STATUS_SYNC_ENABLE); - vp_write(mdev, VP_SHADOW_UPDATE, en ? VP_SHADOW_UPDATE_ENABLE : 0); -} - -static void __mxr_reg_vp_reset(struct mxr_device *mdev) -{ - int tries = 100; - - vp_write(mdev, VP_SRESET, VP_SRESET_PROCESSING); - for (tries = 100; tries; --tries) { - /* waiting until VP_SRESET_PROCESSING is 0 */ - if (~vp_read(mdev, VP_SRESET) & VP_SRESET_PROCESSING) - break; - mdelay(10); - } - WARN(tries == 0, "failed to reset Video Processor\n"); -} - -static void mxr_reg_vp_default_filter(struct mxr_device *mdev); - -void mxr_reg_reset(struct mxr_device *mdev) -{ - unsigned long flags; - u32 val; /* value stored to register */ - - spin_lock_irqsave(&mdev->reg_slock, flags); - mxr_vsync_set_update(mdev, MXR_DISABLE); - - /* set output in RGB888 mode */ - mxr_write(mdev, MXR_CFG, MXR_CFG_OUT_RGB888); - - /* 16 beat burst in DMA */ - mxr_write_mask(mdev, MXR_STATUS, MXR_STATUS_16_BURST, - MXR_STATUS_BURST_MASK); - - /* setting default layer priority: layer1 > video > layer0 - * because typical usage scenario would be - * layer0 - framebuffer - * video - video overlay - * layer1 - OSD - */ - val = MXR_LAYER_CFG_GRP0_VAL(1); - val |= MXR_LAYER_CFG_VP_VAL(2); - val |= MXR_LAYER_CFG_GRP1_VAL(3); - mxr_write(mdev, MXR_LAYER_CFG, val); - - /* use dark gray background color */ - mxr_write(mdev, MXR_BG_COLOR0, 0x808080); - mxr_write(mdev, MXR_BG_COLOR1, 0x808080); - mxr_write(mdev, MXR_BG_COLOR2, 0x808080); - - /* setting graphical layers */ - - val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */ - val |= MXR_GRP_CFG_BLEND_PRE_MUL; /* premul mode */ - val |= MXR_GRP_CFG_ALPHA_VAL(0xff); /* non-transparent alpha */ - - /* the same configuration for both layers */ - mxr_write(mdev, MXR_GRAPHIC_CFG(0), val); - mxr_write(mdev, MXR_GRAPHIC_CFG(1), val); - - /* configuration of Video Processor Registers */ - __mxr_reg_vp_reset(mdev); - mxr_reg_vp_default_filter(mdev); - - /* enable all interrupts */ - mxr_write_mask(mdev, MXR_INT_EN, ~0, MXR_INT_EN_ALL); - - mxr_vsync_set_update(mdev, MXR_ENABLE); - spin_unlock_irqrestore(&mdev->reg_slock, flags); -} - -void mxr_reg_graph_format(struct mxr_device *mdev, int idx, - const struct mxr_format *fmt, const struct mxr_geometry *geo) -{ - u32 val; - unsigned long flags; - - spin_lock_irqsave(&mdev->reg_slock, flags); - mxr_vsync_set_update(mdev, MXR_DISABLE); - - /* setup format */ - mxr_write_mask(mdev, MXR_GRAPHIC_CFG(idx), - MXR_GRP_CFG_FORMAT_VAL(fmt->cookie), MXR_GRP_CFG_FORMAT_MASK); - - /* setup geometry */ - mxr_write(mdev, MXR_GRAPHIC_SPAN(idx), geo->src.full_width); - val = MXR_GRP_WH_WIDTH(geo->src.width); - val |= MXR_GRP_WH_HEIGHT(geo->src.height); - val |= MXR_GRP_WH_H_SCALE(geo->x_ratio); - val |= MXR_GRP_WH_V_SCALE(geo->y_ratio); - mxr_write(mdev, MXR_GRAPHIC_WH(idx), val); - - /* setup offsets in source image */ - val = MXR_GRP_SXY_SX(geo->src.x_offset); - val |= MXR_GRP_SXY_SY(geo->src.y_offset); - mxr_write(mdev, MXR_GRAPHIC_SXY(idx), val); - - /* setup offsets in display image */ - val = MXR_GRP_DXY_DX(geo->dst.x_offset); - val |= MXR_GRP_DXY_DY(geo->dst.y_offset); - mxr_write(mdev, MXR_GRAPHIC_DXY(idx), val); - - mxr_vsync_set_update(mdev, MXR_ENABLE); - spin_unlock_irqrestore(&mdev->reg_slock, flags); -} - -void mxr_reg_vp_format(struct mxr_device *mdev, - const struct mxr_format *fmt, const struct mxr_geometry *geo) -{ - unsigned long flags; - - spin_lock_irqsave(&mdev->reg_slock, flags); - mxr_vsync_set_update(mdev, MXR_DISABLE); - - vp_write_mask(mdev, VP_MODE, fmt->cookie, VP_MODE_FMT_MASK); - - /* setting size of input image */ - vp_write(mdev, VP_IMG_SIZE_Y, VP_IMG_HSIZE(geo->src.full_width) | - VP_IMG_VSIZE(geo->src.full_height)); - /* chroma height has to reduced by 2 to avoid chroma distorions */ - vp_write(mdev, VP_IMG_SIZE_C, VP_IMG_HSIZE(geo->src.full_width) | - VP_IMG_VSIZE(geo->src.full_height / 2)); - - vp_write(mdev, VP_SRC_WIDTH, geo->src.width); - vp_write(mdev, VP_SRC_HEIGHT, geo->src.height); - vp_write(mdev, VP_SRC_H_POSITION, - VP_SRC_H_POSITION_VAL(geo->src.x_offset)); - vp_write(mdev, VP_SRC_V_POSITION, geo->src.y_offset); - - vp_write(mdev, VP_DST_WIDTH, geo->dst.width); - vp_write(mdev, VP_DST_H_POSITION, geo->dst.x_offset); - if (geo->dst.field == V4L2_FIELD_INTERLACED) { - vp_write(mdev, VP_DST_HEIGHT, geo->dst.height / 2); - vp_write(mdev, VP_DST_V_POSITION, geo->dst.y_offset / 2); - } else { - vp_write(mdev, VP_DST_HEIGHT, geo->dst.height); - vp_write(mdev, VP_DST_V_POSITION, geo->dst.y_offset); - } - - vp_write(mdev, VP_H_RATIO, geo->x_ratio); - vp_write(mdev, VP_V_RATIO, geo->y_ratio); - - vp_write(mdev, VP_ENDIAN_MODE, VP_ENDIAN_MODE_LITTLE); - - mxr_vsync_set_update(mdev, MXR_ENABLE); - spin_unlock_irqrestore(&mdev->reg_slock, flags); - -} - -void mxr_reg_graph_buffer(struct mxr_device *mdev, int idx, dma_addr_t addr) -{ - u32 val = addr ? ~0 : 0; - unsigned long flags; - - spin_lock_irqsave(&mdev->reg_slock, flags); - mxr_vsync_set_update(mdev, MXR_DISABLE); - - if (idx == 0) - mxr_write_mask(mdev, MXR_CFG, val, MXR_CFG_GRP0_ENABLE); - else - mxr_write_mask(mdev, MXR_CFG, val, MXR_CFG_GRP1_ENABLE); - mxr_write(mdev, MXR_GRAPHIC_BASE(idx), addr); - - mxr_vsync_set_update(mdev, MXR_ENABLE); - spin_unlock_irqrestore(&mdev->reg_slock, flags); -} - -void mxr_reg_vp_buffer(struct mxr_device *mdev, - dma_addr_t luma_addr[2], dma_addr_t chroma_addr[2]) -{ - u32 val = luma_addr[0] ? ~0 : 0; - unsigned long flags; - - spin_lock_irqsave(&mdev->reg_slock, flags); - mxr_vsync_set_update(mdev, MXR_DISABLE); - - mxr_write_mask(mdev, MXR_CFG, val, MXR_CFG_VP_ENABLE); - vp_write_mask(mdev, VP_ENABLE, val, VP_ENABLE_ON); - /* TODO: fix tiled mode */ - vp_write(mdev, VP_TOP_Y_PTR, luma_addr[0]); - vp_write(mdev, VP_TOP_C_PTR, chroma_addr[0]); - vp_write(mdev, VP_BOT_Y_PTR, luma_addr[1]); - vp_write(mdev, VP_BOT_C_PTR, chroma_addr[1]); - - mxr_vsync_set_update(mdev, MXR_ENABLE); - spin_unlock_irqrestore(&mdev->reg_slock, flags); -} - -static void mxr_irq_layer_handle(struct mxr_layer *layer) -{ - struct list_head *head = &layer->enq_list; - struct mxr_buffer *done; - - /* skip non-existing layer */ - if (layer == NULL) - return; - - spin_lock(&layer->enq_slock); - if (layer->state == MXR_LAYER_IDLE) - goto done; - - done = layer->shadow_buf; - layer->shadow_buf = layer->update_buf; - - if (list_empty(head)) { - if (layer->state != MXR_LAYER_STREAMING) - layer->update_buf = NULL; - } else { - struct mxr_buffer *next; - next = list_first_entry(head, struct mxr_buffer, list); - list_del(&next->list); - layer->update_buf = next; - } - - layer->ops.buffer_set(layer, layer->update_buf); - - if (done && done != layer->shadow_buf) - vb2_buffer_done(&done->vb.vb2_buf, VB2_BUF_STATE_DONE); - -done: - spin_unlock(&layer->enq_slock); -} - -irqreturn_t mxr_irq_handler(int irq, void *dev_data) -{ - struct mxr_device *mdev = dev_data; - u32 i, val; - - spin_lock(&mdev->reg_slock); - val = mxr_read(mdev, MXR_INT_STATUS); - - /* wake up process waiting for VSYNC */ - if (val & MXR_INT_STATUS_VSYNC) { - set_bit(MXR_EVENT_VSYNC, &mdev->event_flags); - /* toggle TOP field event if working in interlaced mode */ - if (~mxr_read(mdev, MXR_CFG) & MXR_CFG_SCAN_PROGRASSIVE) - change_bit(MXR_EVENT_TOP, &mdev->event_flags); - wake_up(&mdev->event_queue); - /* vsync interrupt use different bit for read and clear */ - val &= ~MXR_INT_STATUS_VSYNC; - val |= MXR_INT_CLEAR_VSYNC; - } - - /* clear interrupts */ - mxr_write(mdev, MXR_INT_STATUS, val); - - spin_unlock(&mdev->reg_slock); - /* leave on non-vsync event */ - if (~val & MXR_INT_CLEAR_VSYNC) - return IRQ_HANDLED; - /* skip layer update on bottom field */ - if (!test_bit(MXR_EVENT_TOP, &mdev->event_flags)) - return IRQ_HANDLED; - for (i = 0; i < MXR_MAX_LAYERS; ++i) - mxr_irq_layer_handle(mdev->layer[i]); - return IRQ_HANDLED; -} - -void mxr_reg_s_output(struct mxr_device *mdev, int cookie) -{ - u32 val; - - val = cookie == 0 ? MXR_CFG_DST_SDO : MXR_CFG_DST_HDMI; - mxr_write_mask(mdev, MXR_CFG, val, MXR_CFG_DST_MASK); -} - -void mxr_reg_streamon(struct mxr_device *mdev) -{ - unsigned long flags; - - spin_lock_irqsave(&mdev->reg_slock, flags); - /* single write -> no need to block vsync update */ - - /* start MIXER */ - mxr_write_mask(mdev, MXR_STATUS, ~0, MXR_STATUS_REG_RUN); - set_bit(MXR_EVENT_TOP, &mdev->event_flags); - - spin_unlock_irqrestore(&mdev->reg_slock, flags); -} - -void mxr_reg_streamoff(struct mxr_device *mdev) -{ - unsigned long flags; - - spin_lock_irqsave(&mdev->reg_slock, flags); - /* single write -> no need to block vsync update */ - - /* stop MIXER */ - mxr_write_mask(mdev, MXR_STATUS, 0, MXR_STATUS_REG_RUN); - - spin_unlock_irqrestore(&mdev->reg_slock, flags); -} - -int mxr_reg_wait4vsync(struct mxr_device *mdev) -{ - long time_left; - - clear_bit(MXR_EVENT_VSYNC, &mdev->event_flags); - /* TODO: consider adding interruptible */ - time_left = wait_event_timeout(mdev->event_queue, - test_bit(MXR_EVENT_VSYNC, &mdev->event_flags), - msecs_to_jiffies(1000)); - if (time_left > 0) - return 0; - mxr_warn(mdev, "no vsync detected - timeout\n"); - return -ETIME; -} - -void mxr_reg_set_mbus_fmt(struct mxr_device *mdev, - struct v4l2_mbus_framefmt *fmt) -{ - u32 val = 0; - unsigned long flags; - - spin_lock_irqsave(&mdev->reg_slock, flags); - mxr_vsync_set_update(mdev, MXR_DISABLE); - - /* selecting colorspace accepted by output */ - if (fmt->colorspace == V4L2_COLORSPACE_JPEG) - val |= MXR_CFG_OUT_YUV444; - else - val |= MXR_CFG_OUT_RGB888; - - /* choosing between interlace and progressive mode */ - if (fmt->field == V4L2_FIELD_INTERLACED) - val |= MXR_CFG_SCAN_INTERLACE; - else - val |= MXR_CFG_SCAN_PROGRASSIVE; - - /* choosing between porper HD and SD mode */ - if (fmt->height == 480) - val |= MXR_CFG_SCAN_NTSC | MXR_CFG_SCAN_SD; - else if (fmt->height == 576) - val |= MXR_CFG_SCAN_PAL | MXR_CFG_SCAN_SD; - else if (fmt->height == 720) - val |= MXR_CFG_SCAN_HD_720 | MXR_CFG_SCAN_HD; - else if (fmt->height == 1080) - val |= MXR_CFG_SCAN_HD_1080 | MXR_CFG_SCAN_HD; - else - WARN(1, "unrecognized mbus height %u!\n", fmt->height); - - mxr_write_mask(mdev, MXR_CFG, val, MXR_CFG_SCAN_MASK | - MXR_CFG_OUT_MASK); - - val = (fmt->field == V4L2_FIELD_INTERLACED) ? ~0 : 0; - vp_write_mask(mdev, VP_MODE, val, - VP_MODE_LINE_SKIP | VP_MODE_FIELD_ID_AUTO_TOGGLING); - - mxr_vsync_set_update(mdev, MXR_ENABLE); - spin_unlock_irqrestore(&mdev->reg_slock, flags); -} - -void mxr_reg_graph_layer_stream(struct mxr_device *mdev, int idx, int en) -{ - /* no extra actions need to be done */ -} - -void mxr_reg_vp_layer_stream(struct mxr_device *mdev, int en) -{ - /* no extra actions need to be done */ -} - -static const u8 filter_y_horiz_tap8[] = { - 0, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 0, 0, 0, - 0, 2, 4, 5, 6, 6, 6, 6, - 6, 5, 5, 4, 3, 2, 1, 1, - 0, -6, -12, -16, -18, -20, -21, -20, - -20, -18, -16, -13, -10, -8, -5, -2, - 127, 126, 125, 121, 114, 107, 99, 89, - 79, 68, 57, 46, 35, 25, 16, 8, -}; - -static const u8 filter_y_vert_tap4[] = { - 0, -3, -6, -8, -8, -8, -8, -7, - -6, -5, -4, -3, -2, -1, -1, 0, - 127, 126, 124, 118, 111, 102, 92, 81, - 70, 59, 48, 37, 27, 19, 11, 5, - 0, 5, 11, 19, 27, 37, 48, 59, - 70, 81, 92, 102, 111, 118, 124, 126, - 0, 0, -1, -1, -2, -3, -4, -5, - -6, -7, -8, -8, -8, -8, -6, -3, -}; - -static const u8 filter_cr_horiz_tap4[] = { - 0, -3, -6, -8, -8, -8, -8, -7, - -6, -5, -4, -3, -2, -1, -1, 0, - 127, 126, 124, 118, 111, 102, 92, 81, - 70, 59, 48, 37, 27, 19, 11, 5, -}; - -static inline void mxr_reg_vp_filter_set(struct mxr_device *mdev, - int reg_id, const u8 *data, unsigned int size) -{ - /* assure 4-byte align */ - BUG_ON(size & 3); - for (; size; size -= 4, reg_id += 4, data += 4) { - u32 val = (data[0] << 24) | (data[1] << 16) | - (data[2] << 8) | data[3]; - vp_write(mdev, reg_id, val); - } -} - -static void mxr_reg_vp_default_filter(struct mxr_device *mdev) -{ - mxr_reg_vp_filter_set(mdev, VP_POLY8_Y0_LL, - filter_y_horiz_tap8, sizeof(filter_y_horiz_tap8)); - mxr_reg_vp_filter_set(mdev, VP_POLY4_Y0_LL, - filter_y_vert_tap4, sizeof(filter_y_vert_tap4)); - mxr_reg_vp_filter_set(mdev, VP_POLY4_C0_LL, - filter_cr_horiz_tap4, sizeof(filter_cr_horiz_tap4)); -} - -static void mxr_reg_mxr_dump(struct mxr_device *mdev) -{ -#define DUMPREG(reg_id) \ -do { \ - mxr_dbg(mdev, #reg_id " = %08x\n", \ - (u32)readl(mdev->res.mxr_regs + reg_id)); \ -} while (0) - - DUMPREG(MXR_STATUS); - DUMPREG(MXR_CFG); - DUMPREG(MXR_INT_EN); - DUMPREG(MXR_INT_STATUS); - - DUMPREG(MXR_LAYER_CFG); - DUMPREG(MXR_VIDEO_CFG); - - DUMPREG(MXR_GRAPHIC0_CFG); - DUMPREG(MXR_GRAPHIC0_BASE); - DUMPREG(MXR_GRAPHIC0_SPAN); - DUMPREG(MXR_GRAPHIC0_WH); - DUMPREG(MXR_GRAPHIC0_SXY); - DUMPREG(MXR_GRAPHIC0_DXY); - - DUMPREG(MXR_GRAPHIC1_CFG); - DUMPREG(MXR_GRAPHIC1_BASE); - DUMPREG(MXR_GRAPHIC1_SPAN); - DUMPREG(MXR_GRAPHIC1_WH); - DUMPREG(MXR_GRAPHIC1_SXY); - DUMPREG(MXR_GRAPHIC1_DXY); -#undef DUMPREG -} - -static void mxr_reg_vp_dump(struct mxr_device *mdev) -{ -#define DUMPREG(reg_id) \ -do { \ - mxr_dbg(mdev, #reg_id " = %08x\n", \ - (u32) readl(mdev->res.vp_regs + reg_id)); \ -} while (0) - - - DUMPREG(VP_ENABLE); - DUMPREG(VP_SRESET); - DUMPREG(VP_SHADOW_UPDATE); - DUMPREG(VP_FIELD_ID); - DUMPREG(VP_MODE); - DUMPREG(VP_IMG_SIZE_Y); - DUMPREG(VP_IMG_SIZE_C); - DUMPREG(VP_PER_RATE_CTRL); - DUMPREG(VP_TOP_Y_PTR); - DUMPREG(VP_BOT_Y_PTR); - DUMPREG(VP_TOP_C_PTR); - DUMPREG(VP_BOT_C_PTR); - DUMPREG(VP_ENDIAN_MODE); - DUMPREG(VP_SRC_H_POSITION); - DUMPREG(VP_SRC_V_POSITION); - DUMPREG(VP_SRC_WIDTH); - DUMPREG(VP_SRC_HEIGHT); - DUMPREG(VP_DST_H_POSITION); - DUMPREG(VP_DST_V_POSITION); - DUMPREG(VP_DST_WIDTH); - DUMPREG(VP_DST_HEIGHT); - DUMPREG(VP_H_RATIO); - DUMPREG(VP_V_RATIO); - -#undef DUMPREG -} - -void mxr_reg_dump(struct mxr_device *mdev) -{ - mxr_reg_mxr_dump(mdev); - mxr_reg_vp_dump(mdev); -} - diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c deleted file mode 100644 index ee74e2b44d69..000000000000 --- a/drivers/media/platform/s5p-tv/mixer_video.c +++ /dev/null @@ -1,1130 +0,0 @@ -/* - * Samsung TV Mixer driver - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * - * Tomasz Stanislawski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation. either version 2 of the License, - * or (at your option) any later version - */ - -#define pr_fmt(fmt) "s5p-tv (mixer): " fmt - -#include "mixer.h" - -#include -#include -#include -#include -#include -#include -#include - -static int find_reg_callback(struct device *dev, void *p) -{ - struct v4l2_subdev **sd = p; - - *sd = dev_get_drvdata(dev); - /* non-zero value stops iteration */ - return 1; -} - -static struct v4l2_subdev *find_and_register_subdev( - struct mxr_device *mdev, char *module_name) -{ - struct device_driver *drv; - struct v4l2_subdev *sd = NULL; - int ret; - - /* TODO: add waiting until probe is finished */ - drv = driver_find(module_name, &platform_bus_type); - if (!drv) { - mxr_warn(mdev, "module %s is missing\n", module_name); - return NULL; - } - /* driver refcnt is increased, it is safe to iterate over devices */ - ret = driver_for_each_device(drv, NULL, &sd, find_reg_callback); - /* ret == 0 means that find_reg_callback was never executed */ - if (sd == NULL) { - mxr_warn(mdev, "module %s provides no subdev!\n", module_name); - goto done; - } - /* v4l2_device_register_subdev detects if sd is NULL */ - ret = v4l2_device_register_subdev(&mdev->v4l2_dev, sd); - if (ret) { - mxr_warn(mdev, "failed to register subdev %s\n", sd->name); - sd = NULL; - } - -done: - return sd; -} - -int mxr_acquire_video(struct mxr_device *mdev, - struct mxr_output_conf *output_conf, int output_count) -{ - struct device *dev = mdev->dev; - struct v4l2_device *v4l2_dev = &mdev->v4l2_dev; - int i; - int ret = 0; - struct v4l2_subdev *sd; - - strlcpy(v4l2_dev->name, dev_name(mdev->dev), sizeof(v4l2_dev->name)); - /* prepare context for V4L2 device */ - ret = v4l2_device_register(dev, v4l2_dev); - if (ret) { - mxr_err(mdev, "could not register v4l2 device.\n"); - goto fail; - } - - vb2_dma_contig_set_max_seg_size(mdev->dev, DMA_BIT_MASK(32)); - - /* registering outputs */ - mdev->output_cnt = 0; - for (i = 0; i < output_count; ++i) { - struct mxr_output_conf *conf = &output_conf[i]; - struct mxr_output *out; - - sd = find_and_register_subdev(mdev, conf->module_name); - /* trying to register next output */ - if (sd == NULL) - continue; - out = kzalloc(sizeof(*out), GFP_KERNEL); - if (out == NULL) { - mxr_err(mdev, "no memory for '%s'\n", - conf->output_name); - ret = -ENOMEM; - /* registered subdevs are removed in fail_v4l2_dev */ - goto fail_output; - } - strlcpy(out->name, conf->output_name, sizeof(out->name)); - out->sd = sd; - out->cookie = conf->cookie; - mdev->output[mdev->output_cnt++] = out; - mxr_info(mdev, "added output '%s' from module '%s'\n", - conf->output_name, conf->module_name); - /* checking if maximal number of outputs is reached */ - if (mdev->output_cnt >= MXR_MAX_OUTPUTS) - break; - } - - if (mdev->output_cnt == 0) { - mxr_err(mdev, "failed to register any output\n"); - ret = -ENODEV; - /* skipping fail_output because there is nothing to free */ - goto fail_v4l2_dev; - } - - return 0; - -fail_output: - /* kfree is NULL-safe */ - for (i = 0; i < mdev->output_cnt; ++i) - kfree(mdev->output[i]); - memset(mdev->output, 0, sizeof(mdev->output)); - -fail_v4l2_dev: - /* NOTE: automatically unregister all subdevs */ - v4l2_device_unregister(v4l2_dev); - -fail: - return ret; -} - -void mxr_release_video(struct mxr_device *mdev) -{ - int i; - - /* kfree is NULL-safe */ - for (i = 0; i < mdev->output_cnt; ++i) - kfree(mdev->output[i]); - - vb2_dma_contig_clear_max_seg_size(mdev->dev); - v4l2_device_unregister(&mdev->v4l2_dev); -} - -static int mxr_querycap(struct file *file, void *priv, - struct v4l2_capability *cap) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - - strlcpy(cap->driver, MXR_DRIVER_NAME, sizeof(cap->driver)); - strlcpy(cap->card, layer->vfd.name, sizeof(cap->card)); - sprintf(cap->bus_info, "%d", layer->idx); - cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT_MPLANE; - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; - - return 0; -} - -static void mxr_geometry_dump(struct mxr_device *mdev, struct mxr_geometry *geo) -{ - mxr_dbg(mdev, "src.full_size = (%u, %u)\n", - geo->src.full_width, geo->src.full_height); - mxr_dbg(mdev, "src.size = (%u, %u)\n", - geo->src.width, geo->src.height); - mxr_dbg(mdev, "src.offset = (%u, %u)\n", - geo->src.x_offset, geo->src.y_offset); - mxr_dbg(mdev, "dst.full_size = (%u, %u)\n", - geo->dst.full_width, geo->dst.full_height); - mxr_dbg(mdev, "dst.size = (%u, %u)\n", - geo->dst.width, geo->dst.height); - mxr_dbg(mdev, "dst.offset = (%u, %u)\n", - geo->dst.x_offset, geo->dst.y_offset); - mxr_dbg(mdev, "ratio = (%u, %u)\n", - geo->x_ratio, geo->y_ratio); -} - -static void mxr_layer_default_geo(struct mxr_layer *layer) -{ - struct mxr_device *mdev = layer->mdev; - struct v4l2_mbus_framefmt mbus_fmt; - - memset(&layer->geo, 0, sizeof(layer->geo)); - - mxr_get_mbus_fmt(mdev, &mbus_fmt); - - layer->geo.dst.full_width = mbus_fmt.width; - layer->geo.dst.full_height = mbus_fmt.height; - layer->geo.dst.width = layer->geo.dst.full_width; - layer->geo.dst.height = layer->geo.dst.full_height; - layer->geo.dst.field = mbus_fmt.field; - - layer->geo.src.full_width = mbus_fmt.width; - layer->geo.src.full_height = mbus_fmt.height; - layer->geo.src.width = layer->geo.src.full_width; - layer->geo.src.height = layer->geo.src.full_height; - - mxr_geometry_dump(mdev, &layer->geo); - layer->ops.fix_geometry(layer, MXR_GEOMETRY_SINK, 0); - mxr_geometry_dump(mdev, &layer->geo); -} - -static void mxr_layer_update_output(struct mxr_layer *layer) -{ - struct mxr_device *mdev = layer->mdev; - struct v4l2_mbus_framefmt mbus_fmt; - - mxr_get_mbus_fmt(mdev, &mbus_fmt); - /* checking if update is needed */ - if (layer->geo.dst.full_width == mbus_fmt.width && - layer->geo.dst.full_height == mbus_fmt.width) - return; - - layer->geo.dst.full_width = mbus_fmt.width; - layer->geo.dst.full_height = mbus_fmt.height; - layer->geo.dst.field = mbus_fmt.field; - layer->ops.fix_geometry(layer, MXR_GEOMETRY_SINK, 0); - - mxr_geometry_dump(mdev, &layer->geo); -} - -static const struct mxr_format *find_format_by_fourcc( - struct mxr_layer *layer, unsigned long fourcc); -static const struct mxr_format *find_format_by_index( - struct mxr_layer *layer, unsigned long index); - -static int mxr_enum_fmt(struct file *file, void *priv, - struct v4l2_fmtdesc *f) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - const struct mxr_format *fmt; - - mxr_dbg(mdev, "%s\n", __func__); - fmt = find_format_by_index(layer, f->index); - if (fmt == NULL) - return -EINVAL; - - strlcpy(f->description, fmt->name, sizeof(f->description)); - f->pixelformat = fmt->fourcc; - - return 0; -} - -static unsigned int divup(unsigned int divident, unsigned int divisor) -{ - return (divident + divisor - 1) / divisor; -} - -unsigned long mxr_get_plane_size(const struct mxr_block *blk, - unsigned int width, unsigned int height) -{ - unsigned int bl_width = divup(width, blk->width); - unsigned int bl_height = divup(height, blk->height); - - return bl_width * bl_height * blk->size; -} - -static void mxr_mplane_fill(struct v4l2_plane_pix_format *planes, - const struct mxr_format *fmt, u32 width, u32 height) -{ - int i; - - /* checking if nothing to fill */ - if (!planes) - return; - - memset(planes, 0, sizeof(*planes) * fmt->num_subframes); - for (i = 0; i < fmt->num_planes; ++i) { - struct v4l2_plane_pix_format *plane = planes - + fmt->plane2subframe[i]; - const struct mxr_block *blk = &fmt->plane[i]; - u32 bl_width = divup(width, blk->width); - u32 bl_height = divup(height, blk->height); - u32 sizeimage = bl_width * bl_height * blk->size; - u32 bytesperline = bl_width * blk->size / blk->height; - - plane->sizeimage += sizeimage; - plane->bytesperline = max(plane->bytesperline, bytesperline); - } -} - -static int mxr_g_fmt(struct file *file, void *priv, - struct v4l2_format *f) -{ - struct mxr_layer *layer = video_drvdata(file); - struct v4l2_pix_format_mplane *pix = &f->fmt.pix_mp; - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - - pix->width = layer->geo.src.full_width; - pix->height = layer->geo.src.full_height; - pix->field = V4L2_FIELD_NONE; - pix->pixelformat = layer->fmt->fourcc; - pix->colorspace = layer->fmt->colorspace; - mxr_mplane_fill(pix->plane_fmt, layer->fmt, pix->width, pix->height); - - return 0; -} - -static int mxr_s_fmt(struct file *file, void *priv, - struct v4l2_format *f) -{ - struct mxr_layer *layer = video_drvdata(file); - const struct mxr_format *fmt; - struct v4l2_pix_format_mplane *pix; - struct mxr_device *mdev = layer->mdev; - struct mxr_geometry *geo = &layer->geo; - - mxr_dbg(mdev, "%s:%d\n", __func__, __LINE__); - - pix = &f->fmt.pix_mp; - fmt = find_format_by_fourcc(layer, pix->pixelformat); - if (fmt == NULL) { - mxr_warn(mdev, "not recognized fourcc: %08x\n", - pix->pixelformat); - return -EINVAL; - } - layer->fmt = fmt; - /* set source size to highest accepted value */ - geo->src.full_width = max(geo->dst.full_width, pix->width); - geo->src.full_height = max(geo->dst.full_height, pix->height); - layer->ops.fix_geometry(layer, MXR_GEOMETRY_SOURCE, 0); - mxr_geometry_dump(mdev, &layer->geo); - /* set cropping to total visible screen */ - geo->src.width = pix->width; - geo->src.height = pix->height; - geo->src.x_offset = 0; - geo->src.y_offset = 0; - /* assure consistency of geometry */ - layer->ops.fix_geometry(layer, MXR_GEOMETRY_CROP, MXR_NO_OFFSET); - mxr_geometry_dump(mdev, &layer->geo); - /* set full size to lowest possible value */ - geo->src.full_width = 0; - geo->src.full_height = 0; - layer->ops.fix_geometry(layer, MXR_GEOMETRY_SOURCE, 0); - mxr_geometry_dump(mdev, &layer->geo); - - /* returning results */ - mxr_g_fmt(file, priv, f); - - return 0; -} - -static int mxr_g_selection(struct file *file, void *fh, - struct v4l2_selection *s) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_geometry *geo = &layer->geo; - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - - if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && - s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) - return -EINVAL; - - switch (s->target) { - case V4L2_SEL_TGT_CROP: - s->r.left = geo->src.x_offset; - s->r.top = geo->src.y_offset; - s->r.width = geo->src.width; - s->r.height = geo->src.height; - break; - case V4L2_SEL_TGT_CROP_DEFAULT: - case V4L2_SEL_TGT_CROP_BOUNDS: - s->r.left = 0; - s->r.top = 0; - s->r.width = geo->src.full_width; - s->r.height = geo->src.full_height; - break; - case V4L2_SEL_TGT_COMPOSE: - case V4L2_SEL_TGT_COMPOSE_PADDED: - s->r.left = geo->dst.x_offset; - s->r.top = geo->dst.y_offset; - s->r.width = geo->dst.width; - s->r.height = geo->dst.height; - break; - case V4L2_SEL_TGT_COMPOSE_DEFAULT: - case V4L2_SEL_TGT_COMPOSE_BOUNDS: - s->r.left = 0; - s->r.top = 0; - s->r.width = geo->dst.full_width; - s->r.height = geo->dst.full_height; - break; - default: - return -EINVAL; - } - - return 0; -} - -/* returns 1 if rectangle 'a' is inside 'b' */ -static int mxr_is_rect_inside(struct v4l2_rect *a, struct v4l2_rect *b) -{ - if (a->left < b->left) - return 0; - if (a->top < b->top) - return 0; - if (a->left + a->width > b->left + b->width) - return 0; - if (a->top + a->height > b->top + b->height) - return 0; - return 1; -} - -static int mxr_s_selection(struct file *file, void *fh, - struct v4l2_selection *s) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_geometry *geo = &layer->geo; - struct mxr_crop *target = NULL; - enum mxr_geometry_stage stage; - struct mxr_geometry tmp; - struct v4l2_rect res; - - memset(&res, 0, sizeof(res)); - - mxr_dbg(layer->mdev, "%s: rect: %dx%d@%d,%d\n", __func__, - s->r.width, s->r.height, s->r.left, s->r.top); - - if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && - s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) - return -EINVAL; - - switch (s->target) { - /* ignore read-only targets */ - case V4L2_SEL_TGT_CROP_DEFAULT: - case V4L2_SEL_TGT_CROP_BOUNDS: - res.width = geo->src.full_width; - res.height = geo->src.full_height; - break; - - /* ignore read-only targets */ - case V4L2_SEL_TGT_COMPOSE_DEFAULT: - case V4L2_SEL_TGT_COMPOSE_BOUNDS: - res.width = geo->dst.full_width; - res.height = geo->dst.full_height; - break; - - case V4L2_SEL_TGT_CROP: - target = &geo->src; - stage = MXR_GEOMETRY_CROP; - break; - case V4L2_SEL_TGT_COMPOSE: - case V4L2_SEL_TGT_COMPOSE_PADDED: - target = &geo->dst; - stage = MXR_GEOMETRY_COMPOSE; - break; - default: - return -EINVAL; - } - /* apply change and update geometry if needed */ - if (target) { - /* backup current geometry if setup fails */ - memcpy(&tmp, geo, sizeof(tmp)); - - /* apply requested selection */ - target->x_offset = s->r.left; - target->y_offset = s->r.top; - target->width = s->r.width; - target->height = s->r.height; - - layer->ops.fix_geometry(layer, stage, s->flags); - - /* retrieve update selection rectangle */ - res.left = target->x_offset; - res.top = target->y_offset; - res.width = target->width; - res.height = target->height; - - mxr_geometry_dump(layer->mdev, &layer->geo); - } - - /* checking if the rectangle satisfies constraints */ - if ((s->flags & V4L2_SEL_FLAG_LE) && !mxr_is_rect_inside(&res, &s->r)) - goto fail; - if ((s->flags & V4L2_SEL_FLAG_GE) && !mxr_is_rect_inside(&s->r, &res)) - goto fail; - - /* return result rectangle */ - s->r = res; - - return 0; -fail: - /* restore old geometry, which is not touched if target is NULL */ - if (target) - memcpy(geo, &tmp, sizeof(tmp)); - return -ERANGE; -} - -static int mxr_enum_dv_timings(struct file *file, void *fh, - struct v4l2_enum_dv_timings *timings) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - int ret; - - timings->pad = 0; - - /* lock protects from changing sd_out */ - mutex_lock(&mdev->mutex); - ret = v4l2_subdev_call(to_outsd(mdev), pad, enum_dv_timings, timings); - mutex_unlock(&mdev->mutex); - - return ret ? -EINVAL : 0; -} - -static int mxr_s_dv_timings(struct file *file, void *fh, - struct v4l2_dv_timings *timings) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - int ret; - - /* lock protects from changing sd_out */ - mutex_lock(&mdev->mutex); - - /* timings change cannot be done while there is an entity - * dependent on output configuration - */ - if (mdev->n_output > 0) { - mutex_unlock(&mdev->mutex); - return -EBUSY; - } - - ret = v4l2_subdev_call(to_outsd(mdev), video, s_dv_timings, timings); - - mutex_unlock(&mdev->mutex); - - mxr_layer_update_output(layer); - - /* any failure should return EINVAL according to V4L2 doc */ - return ret ? -EINVAL : 0; -} - -static int mxr_g_dv_timings(struct file *file, void *fh, - struct v4l2_dv_timings *timings) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - int ret; - - /* lock protects from changing sd_out */ - mutex_lock(&mdev->mutex); - ret = v4l2_subdev_call(to_outsd(mdev), video, g_dv_timings, timings); - mutex_unlock(&mdev->mutex); - - return ret ? -EINVAL : 0; -} - -static int mxr_dv_timings_cap(struct file *file, void *fh, - struct v4l2_dv_timings_cap *cap) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - int ret; - - cap->pad = 0; - - /* lock protects from changing sd_out */ - mutex_lock(&mdev->mutex); - ret = v4l2_subdev_call(to_outsd(mdev), pad, dv_timings_cap, cap); - mutex_unlock(&mdev->mutex); - - return ret ? -EINVAL : 0; -} - -static int mxr_s_std(struct file *file, void *fh, v4l2_std_id norm) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - int ret; - - /* lock protects from changing sd_out */ - mutex_lock(&mdev->mutex); - - /* standard change cannot be done while there is an entity - * dependent on output configuration - */ - if (mdev->n_output > 0) { - mutex_unlock(&mdev->mutex); - return -EBUSY; - } - - ret = v4l2_subdev_call(to_outsd(mdev), video, s_std_output, norm); - - mutex_unlock(&mdev->mutex); - - mxr_layer_update_output(layer); - - return ret ? -EINVAL : 0; -} - -static int mxr_g_std(struct file *file, void *fh, v4l2_std_id *norm) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - int ret; - - /* lock protects from changing sd_out */ - mutex_lock(&mdev->mutex); - ret = v4l2_subdev_call(to_outsd(mdev), video, g_std_output, norm); - mutex_unlock(&mdev->mutex); - - return ret ? -EINVAL : 0; -} - -static int mxr_enum_output(struct file *file, void *fh, struct v4l2_output *a) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - struct mxr_output *out; - struct v4l2_subdev *sd; - - if (a->index >= mdev->output_cnt) - return -EINVAL; - out = mdev->output[a->index]; - BUG_ON(out == NULL); - sd = out->sd; - strlcpy(a->name, out->name, sizeof(a->name)); - - /* try to obtain supported tv norms */ - v4l2_subdev_call(sd, video, g_tvnorms_output, &a->std); - a->capabilities = 0; - if (sd->ops->video && sd->ops->video->s_dv_timings) - a->capabilities |= V4L2_OUT_CAP_DV_TIMINGS; - if (sd->ops->video && sd->ops->video->s_std_output) - a->capabilities |= V4L2_OUT_CAP_STD; - a->type = V4L2_OUTPUT_TYPE_ANALOG; - - return 0; -} - -static int mxr_s_output(struct file *file, void *fh, unsigned int i) -{ - struct video_device *vfd = video_devdata(file); - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - - if (i >= mdev->output_cnt || mdev->output[i] == NULL) - return -EINVAL; - - mutex_lock(&mdev->mutex); - if (mdev->n_output > 0) { - mutex_unlock(&mdev->mutex); - return -EBUSY; - } - mdev->current_output = i; - vfd->tvnorms = 0; - v4l2_subdev_call(to_outsd(mdev), video, g_tvnorms_output, - &vfd->tvnorms); - mutex_unlock(&mdev->mutex); - - /* update layers geometry */ - mxr_layer_update_output(layer); - - mxr_dbg(mdev, "tvnorms = %08llx\n", vfd->tvnorms); - - return 0; -} - -static int mxr_g_output(struct file *file, void *fh, unsigned int *p) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - - mutex_lock(&mdev->mutex); - *p = mdev->current_output; - mutex_unlock(&mdev->mutex); - - return 0; -} - -static int mxr_reqbufs(struct file *file, void *priv, - struct v4l2_requestbuffers *p) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - return vb2_reqbufs(&layer->vb_queue, p); -} - -static int mxr_querybuf(struct file *file, void *priv, struct v4l2_buffer *p) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - return vb2_querybuf(&layer->vb_queue, p); -} - -static int mxr_qbuf(struct file *file, void *priv, struct v4l2_buffer *p) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d(%d)\n", __func__, __LINE__, p->index); - return vb2_qbuf(&layer->vb_queue, p); -} - -static int mxr_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - return vb2_dqbuf(&layer->vb_queue, p, file->f_flags & O_NONBLOCK); -} - -static int mxr_expbuf(struct file *file, void *priv, - struct v4l2_exportbuffer *eb) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - return vb2_expbuf(&layer->vb_queue, eb); -} - -static int mxr_streamon(struct file *file, void *priv, enum v4l2_buf_type i) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - return vb2_streamon(&layer->vb_queue, i); -} - -static int mxr_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - return vb2_streamoff(&layer->vb_queue, i); -} - -static const struct v4l2_ioctl_ops mxr_ioctl_ops = { - .vidioc_querycap = mxr_querycap, - /* format handling */ - .vidioc_enum_fmt_vid_out_mplane = mxr_enum_fmt, - .vidioc_s_fmt_vid_out_mplane = mxr_s_fmt, - .vidioc_g_fmt_vid_out_mplane = mxr_g_fmt, - /* buffer control */ - .vidioc_reqbufs = mxr_reqbufs, - .vidioc_querybuf = mxr_querybuf, - .vidioc_qbuf = mxr_qbuf, - .vidioc_dqbuf = mxr_dqbuf, - .vidioc_expbuf = mxr_expbuf, - /* Streaming control */ - .vidioc_streamon = mxr_streamon, - .vidioc_streamoff = mxr_streamoff, - /* DV Timings functions */ - .vidioc_enum_dv_timings = mxr_enum_dv_timings, - .vidioc_s_dv_timings = mxr_s_dv_timings, - .vidioc_g_dv_timings = mxr_g_dv_timings, - .vidioc_dv_timings_cap = mxr_dv_timings_cap, - /* analog TV standard functions */ - .vidioc_s_std = mxr_s_std, - .vidioc_g_std = mxr_g_std, - /* Output handling */ - .vidioc_enum_output = mxr_enum_output, - .vidioc_s_output = mxr_s_output, - .vidioc_g_output = mxr_g_output, - /* selection ioctls */ - .vidioc_g_selection = mxr_g_selection, - .vidioc_s_selection = mxr_s_selection, -}; - -static int mxr_video_open(struct file *file) -{ - struct mxr_layer *layer = video_drvdata(file); - struct mxr_device *mdev = layer->mdev; - int ret = 0; - - mxr_dbg(mdev, "%s:%d\n", __func__, __LINE__); - if (mutex_lock_interruptible(&layer->mutex)) - return -ERESTARTSYS; - /* assure device probe is finished */ - wait_for_device_probe(); - /* creating context for file descriptor */ - ret = v4l2_fh_open(file); - if (ret) { - mxr_err(mdev, "v4l2_fh_open failed\n"); - goto unlock; - } - - /* leaving if layer is already initialized */ - if (!v4l2_fh_is_singular_file(file)) - goto unlock; - - /* FIXME: should power be enabled on open? */ - ret = mxr_power_get(mdev); - if (ret) { - mxr_err(mdev, "power on failed\n"); - goto fail_fh_open; - } - - ret = vb2_queue_init(&layer->vb_queue); - if (ret != 0) { - mxr_err(mdev, "failed to initialize vb2 queue\n"); - goto fail_power; - } - /* set default format, first on the list */ - layer->fmt = layer->fmt_array[0]; - /* setup default geometry */ - mxr_layer_default_geo(layer); - mutex_unlock(&layer->mutex); - - return 0; - -fail_power: - mxr_power_put(mdev); - -fail_fh_open: - v4l2_fh_release(file); - -unlock: - mutex_unlock(&layer->mutex); - - return ret; -} - -static unsigned int -mxr_video_poll(struct file *file, struct poll_table_struct *wait) -{ - struct mxr_layer *layer = video_drvdata(file); - unsigned int res; - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - - mutex_lock(&layer->mutex); - res = vb2_poll(&layer->vb_queue, file, wait); - mutex_unlock(&layer->mutex); - return res; -} - -static int mxr_video_mmap(struct file *file, struct vm_area_struct *vma) -{ - struct mxr_layer *layer = video_drvdata(file); - int ret; - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - - if (mutex_lock_interruptible(&layer->mutex)) - return -ERESTARTSYS; - ret = vb2_mmap(&layer->vb_queue, vma); - mutex_unlock(&layer->mutex); - return ret; -} - -static int mxr_video_release(struct file *file) -{ - struct mxr_layer *layer = video_drvdata(file); - - mxr_dbg(layer->mdev, "%s:%d\n", __func__, __LINE__); - mutex_lock(&layer->mutex); - if (v4l2_fh_is_singular_file(file)) { - vb2_queue_release(&layer->vb_queue); - mxr_power_put(layer->mdev); - } - v4l2_fh_release(file); - mutex_unlock(&layer->mutex); - return 0; -} - -static const struct v4l2_file_operations mxr_fops = { - .owner = THIS_MODULE, - .open = mxr_video_open, - .poll = mxr_video_poll, - .mmap = mxr_video_mmap, - .release = mxr_video_release, - .unlocked_ioctl = video_ioctl2, -}; - -static int queue_setup(struct vb2_queue *vq, - unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], - struct device *alloc_devs[]) -{ - struct mxr_layer *layer = vb2_get_drv_priv(vq); - const struct mxr_format *fmt = layer->fmt; - int i; - struct mxr_device *mdev = layer->mdev; - struct v4l2_plane_pix_format planes[3]; - - mxr_dbg(mdev, "%s\n", __func__); - /* checking if format was configured */ - if (fmt == NULL) - return -EINVAL; - mxr_dbg(mdev, "fmt = %s\n", fmt->name); - mxr_mplane_fill(planes, fmt, layer->geo.src.full_width, - layer->geo.src.full_height); - - *nplanes = fmt->num_subframes; - for (i = 0; i < fmt->num_subframes; ++i) { - sizes[i] = planes[i].sizeimage; - mxr_dbg(mdev, "size[%d] = %08x\n", i, sizes[i]); - } - - if (*nbuffers == 0) - *nbuffers = 1; - - return 0; -} - -static void buf_queue(struct vb2_buffer *vb) -{ - struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); - struct mxr_buffer *buffer = container_of(vbuf, struct mxr_buffer, vb); - struct mxr_layer *layer = vb2_get_drv_priv(vb->vb2_queue); - struct mxr_device *mdev = layer->mdev; - unsigned long flags; - - spin_lock_irqsave(&layer->enq_slock, flags); - list_add_tail(&buffer->list, &layer->enq_list); - spin_unlock_irqrestore(&layer->enq_slock, flags); - - mxr_dbg(mdev, "queuing buffer\n"); -} - -static int start_streaming(struct vb2_queue *vq, unsigned int count) -{ - struct mxr_layer *layer = vb2_get_drv_priv(vq); - struct mxr_device *mdev = layer->mdev; - unsigned long flags; - - mxr_dbg(mdev, "%s\n", __func__); - - /* block any changes in output configuration */ - mxr_output_get(mdev); - - mxr_layer_update_output(layer); - layer->ops.format_set(layer); - /* enabling layer in hardware */ - spin_lock_irqsave(&layer->enq_slock, flags); - layer->state = MXR_LAYER_STREAMING; - spin_unlock_irqrestore(&layer->enq_slock, flags); - - layer->ops.stream_set(layer, MXR_ENABLE); - mxr_streamer_get(mdev); - - return 0; -} - -static void mxr_watchdog(unsigned long arg) -{ - struct mxr_layer *layer = (struct mxr_layer *) arg; - struct mxr_device *mdev = layer->mdev; - unsigned long flags; - - mxr_err(mdev, "watchdog fired for layer %s\n", layer->vfd.name); - - spin_lock_irqsave(&layer->enq_slock, flags); - - if (layer->update_buf == layer->shadow_buf) - layer->update_buf = NULL; - if (layer->update_buf) { - vb2_buffer_done(&layer->update_buf->vb.vb2_buf, - VB2_BUF_STATE_ERROR); - layer->update_buf = NULL; - } - if (layer->shadow_buf) { - vb2_buffer_done(&layer->shadow_buf->vb.vb2_buf, - VB2_BUF_STATE_ERROR); - layer->shadow_buf = NULL; - } - spin_unlock_irqrestore(&layer->enq_slock, flags); -} - -static void stop_streaming(struct vb2_queue *vq) -{ - struct mxr_layer *layer = vb2_get_drv_priv(vq); - struct mxr_device *mdev = layer->mdev; - unsigned long flags; - struct timer_list watchdog; - struct mxr_buffer *buf, *buf_tmp; - - mxr_dbg(mdev, "%s\n", __func__); - - spin_lock_irqsave(&layer->enq_slock, flags); - - /* reset list */ - layer->state = MXR_LAYER_STREAMING_FINISH; - - /* set all buffer to be done */ - list_for_each_entry_safe(buf, buf_tmp, &layer->enq_list, list) { - list_del(&buf->list); - vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); - } - - spin_unlock_irqrestore(&layer->enq_slock, flags); - - /* give 1 seconds to complete to complete last buffers */ - setup_timer_on_stack(&watchdog, mxr_watchdog, - (unsigned long)layer); - mod_timer(&watchdog, jiffies + msecs_to_jiffies(1000)); - - /* wait until all buffers are goes to done state */ - vb2_wait_for_all_buffers(vq); - - /* stop timer if all synchronization is done */ - del_timer_sync(&watchdog); - destroy_timer_on_stack(&watchdog); - - /* stopping hardware */ - spin_lock_irqsave(&layer->enq_slock, flags); - layer->state = MXR_LAYER_IDLE; - spin_unlock_irqrestore(&layer->enq_slock, flags); - - /* disabling layer in hardware */ - layer->ops.stream_set(layer, MXR_DISABLE); - /* remove one streamer */ - mxr_streamer_put(mdev); - /* allow changes in output configuration */ - mxr_output_put(mdev); -} - -static struct vb2_ops mxr_video_qops = { - .queue_setup = queue_setup, - .buf_queue = buf_queue, - .wait_prepare = vb2_ops_wait_prepare, - .wait_finish = vb2_ops_wait_finish, - .start_streaming = start_streaming, - .stop_streaming = stop_streaming, -}; - -/* FIXME: try to put this functions to mxr_base_layer_create */ -int mxr_base_layer_register(struct mxr_layer *layer) -{ - struct mxr_device *mdev = layer->mdev; - int ret; - - ret = video_register_device(&layer->vfd, VFL_TYPE_GRABBER, -1); - if (ret) - mxr_err(mdev, "failed to register video device\n"); - else - mxr_info(mdev, "registered layer %s as /dev/video%d\n", - layer->vfd.name, layer->vfd.num); - return ret; -} - -void mxr_base_layer_unregister(struct mxr_layer *layer) -{ - video_unregister_device(&layer->vfd); -} - -void mxr_layer_release(struct mxr_layer *layer) -{ - if (layer->ops.release) - layer->ops.release(layer); -} - -void mxr_base_layer_release(struct mxr_layer *layer) -{ - kfree(layer); -} - -static void mxr_vfd_release(struct video_device *vdev) -{ - pr_info("video device release\n"); -} - -struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev, - int idx, char *name, const struct mxr_layer_ops *ops) -{ - struct mxr_layer *layer; - - layer = kzalloc(sizeof(*layer), GFP_KERNEL); - if (layer == NULL) { - mxr_err(mdev, "not enough memory for layer.\n"); - goto fail; - } - - layer->mdev = mdev; - layer->idx = idx; - layer->ops = *ops; - - spin_lock_init(&layer->enq_slock); - INIT_LIST_HEAD(&layer->enq_list); - mutex_init(&layer->mutex); - - layer->vfd = (struct video_device) { - .minor = -1, - .release = mxr_vfd_release, - .fops = &mxr_fops, - .vfl_dir = VFL_DIR_TX, - .ioctl_ops = &mxr_ioctl_ops, - }; - strlcpy(layer->vfd.name, name, sizeof(layer->vfd.name)); - - video_set_drvdata(&layer->vfd, layer); - layer->vfd.lock = &layer->mutex; - layer->vfd.v4l2_dev = &mdev->v4l2_dev; - - layer->vb_queue = (struct vb2_queue) { - .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF, - .drv_priv = layer, - .buf_struct_size = sizeof(struct mxr_buffer), - .ops = &mxr_video_qops, - .min_buffers_needed = 1, - .mem_ops = &vb2_dma_contig_memops, - .lock = &layer->mutex, - .dev = mdev->dev, - }; - - return layer; - -fail: - return NULL; -} - -static const struct mxr_format *find_format_by_fourcc( - struct mxr_layer *layer, unsigned long fourcc) -{ - int i; - - for (i = 0; i < layer->fmt_array_size; ++i) - if (layer->fmt_array[i]->fourcc == fourcc) - return layer->fmt_array[i]; - return NULL; -} - -static const struct mxr_format *find_format_by_index( - struct mxr_layer *layer, unsigned long index) -{ - if (index >= layer->fmt_array_size) - return NULL; - return layer->fmt_array[index]; -} - diff --git a/drivers/media/platform/s5p-tv/mixer_vp_layer.c b/drivers/media/platform/s5p-tv/mixer_vp_layer.c deleted file mode 100644 index 6fa6f673f53b..000000000000 --- a/drivers/media/platform/s5p-tv/mixer_vp_layer.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Samsung TV Mixer driver - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * - * Tomasz Stanislawski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundiation. either version 2 of the License, - * or (at your option) any later version - */ - -#include "mixer.h" - -#include "regs-vp.h" - -#include - -/* FORMAT DEFINITIONS */ -static const struct mxr_format mxr_fmt_nv12 = { - .name = "NV12", - .fourcc = V4L2_PIX_FMT_NV12, - .colorspace = V4L2_COLORSPACE_JPEG, - .num_planes = 2, - .plane = { - { .width = 1, .height = 1, .size = 1 }, - { .width = 2, .height = 2, .size = 2 }, - }, - .num_subframes = 1, - .cookie = VP_MODE_NV12 | VP_MODE_MEM_LINEAR, -}; - -static const struct mxr_format mxr_fmt_nv21 = { - .name = "NV21", - .fourcc = V4L2_PIX_FMT_NV21, - .colorspace = V4L2_COLORSPACE_JPEG, - .num_planes = 2, - .plane = { - { .width = 1, .height = 1, .size = 1 }, - { .width = 2, .height = 2, .size = 2 }, - }, - .num_subframes = 1, - .cookie = VP_MODE_NV21 | VP_MODE_MEM_LINEAR, -}; - -static const struct mxr_format mxr_fmt_nv12m = { - .name = "NV12 (mplane)", - .fourcc = V4L2_PIX_FMT_NV12M, - .colorspace = V4L2_COLORSPACE_JPEG, - .num_planes = 2, - .plane = { - { .width = 1, .height = 1, .size = 1 }, - { .width = 2, .height = 2, .size = 2 }, - }, - .num_subframes = 2, - .plane2subframe = {0, 1}, - .cookie = VP_MODE_NV12 | VP_MODE_MEM_LINEAR, -}; - -static const struct mxr_format mxr_fmt_nv12mt = { - .name = "NV12 tiled (mplane)", - .fourcc = V4L2_PIX_FMT_NV12MT, - .colorspace = V4L2_COLORSPACE_JPEG, - .num_planes = 2, - .plane = { - { .width = 128, .height = 32, .size = 4096 }, - { .width = 128, .height = 32, .size = 2048 }, - }, - .num_subframes = 2, - .plane2subframe = {0, 1}, - .cookie = VP_MODE_NV12 | VP_MODE_MEM_TILED, -}; - -static const struct mxr_format *mxr_video_format[] = { - &mxr_fmt_nv12, - &mxr_fmt_nv21, - &mxr_fmt_nv12m, - &mxr_fmt_nv12mt, -}; - -/* AUXILIARY CALLBACKS */ - -static void mxr_vp_layer_release(struct mxr_layer *layer) -{ - mxr_base_layer_unregister(layer); - mxr_base_layer_release(layer); -} - -static void mxr_vp_buffer_set(struct mxr_layer *layer, - struct mxr_buffer *buf) -{ - dma_addr_t luma_addr[2] = {0, 0}; - dma_addr_t chroma_addr[2] = {0, 0}; - - if (buf == NULL) { - mxr_reg_vp_buffer(layer->mdev, luma_addr, chroma_addr); - return; - } - luma_addr[0] = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); - if (layer->fmt->num_subframes == 2) { - chroma_addr[0] = - vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 1); - } else { - /* FIXME: mxr_get_plane_size compute integer division, - * which is slow and should not be performed in interrupt */ - chroma_addr[0] = luma_addr[0] + mxr_get_plane_size( - &layer->fmt->plane[0], layer->geo.src.full_width, - layer->geo.src.full_height); - } - if (layer->fmt->cookie & VP_MODE_MEM_TILED) { - luma_addr[1] = luma_addr[0] + 0x40; - chroma_addr[1] = chroma_addr[0] + 0x40; - } else { - luma_addr[1] = luma_addr[0] + layer->geo.src.full_width; - chroma_addr[1] = chroma_addr[0]; - } - mxr_reg_vp_buffer(layer->mdev, luma_addr, chroma_addr); -} - -static void mxr_vp_stream_set(struct mxr_layer *layer, int en) -{ - mxr_reg_vp_layer_stream(layer->mdev, en); -} - -static void mxr_vp_format_set(struct mxr_layer *layer) -{ - mxr_reg_vp_format(layer->mdev, layer->fmt, &layer->geo); -} - -static inline unsigned int do_center(unsigned int center, - unsigned int size, unsigned int upper, unsigned int flags) -{ - unsigned int lower; - - if (flags & MXR_NO_OFFSET) - return 0; - - lower = center - min(center, size / 2); - return min(lower, upper - size); -} - -static void mxr_vp_fix_geometry(struct mxr_layer *layer, - enum mxr_geometry_stage stage, unsigned long flags) -{ - struct mxr_geometry *geo = &layer->geo; - struct mxr_crop *src = &geo->src; - struct mxr_crop *dst = &geo->dst; - unsigned long x_center, y_center; - - switch (stage) { - - case MXR_GEOMETRY_SINK: /* nothing to be fixed here */ - case MXR_GEOMETRY_COMPOSE: - /* remember center of the area */ - x_center = dst->x_offset + dst->width / 2; - y_center = dst->y_offset + dst->height / 2; - - /* ensure that compose is reachable using 16x scaling */ - dst->width = clamp(dst->width, 8U, 16 * src->full_width); - dst->height = clamp(dst->height, 1U, 16 * src->full_height); - - /* setup offsets */ - dst->x_offset = do_center(x_center, dst->width, - dst->full_width, flags); - dst->y_offset = do_center(y_center, dst->height, - dst->full_height, flags); - flags = 0; /* remove possible MXR_NO_OFFSET flag */ - /* fall through */ - case MXR_GEOMETRY_CROP: - /* remember center of the area */ - x_center = src->x_offset + src->width / 2; - y_center = src->y_offset + src->height / 2; - - /* ensure scaling is between 0.25x .. 16x */ - src->width = clamp(src->width, round_up(dst->width / 16, 4), - dst->width * 4); - src->height = clamp(src->height, round_up(dst->height / 16, 4), - dst->height * 4); - - /* hardware limits */ - src->width = clamp(src->width, 32U, 2047U); - src->height = clamp(src->height, 4U, 2047U); - - /* setup offsets */ - src->x_offset = do_center(x_center, src->width, - src->full_width, flags); - src->y_offset = do_center(y_center, src->height, - src->full_height, flags); - - /* setting scaling ratio */ - geo->x_ratio = (src->width << 16) / dst->width; - geo->y_ratio = (src->height << 16) / dst->height; - /* fall through */ - - case MXR_GEOMETRY_SOURCE: - src->full_width = clamp(src->full_width, - ALIGN(src->width + src->x_offset, 8), 8192U); - src->full_height = clamp(src->full_height, - src->height + src->y_offset, 8192U); - } -} - -/* PUBLIC API */ - -struct mxr_layer *mxr_vp_layer_create(struct mxr_device *mdev, int idx) -{ - struct mxr_layer *layer; - int ret; - const struct mxr_layer_ops ops = { - .release = mxr_vp_layer_release, - .buffer_set = mxr_vp_buffer_set, - .stream_set = mxr_vp_stream_set, - .format_set = mxr_vp_format_set, - .fix_geometry = mxr_vp_fix_geometry, - }; - char name[32]; - - sprintf(name, "video%d", idx); - - layer = mxr_base_layer_create(mdev, idx, name, &ops); - if (layer == NULL) { - mxr_err(mdev, "failed to initialize layer(%d) base\n", idx); - goto fail; - } - - layer->fmt_array = mxr_video_format; - layer->fmt_array_size = ARRAY_SIZE(mxr_video_format); - - ret = mxr_base_layer_register(layer); - if (ret) - goto fail_layer; - - return layer; - -fail_layer: - mxr_base_layer_release(layer); - -fail: - return NULL; -} - diff --git a/drivers/media/platform/s5p-tv/regs-hdmi.h b/drivers/media/platform/s5p-tv/regs-hdmi.h deleted file mode 100644 index a889d1f57f28..000000000000 --- a/drivers/media/platform/s5p-tv/regs-hdmi.h +++ /dev/null @@ -1,146 +0,0 @@ -/* linux/arch/arm/mach-exynos4/include/mach/regs-hdmi.h - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * http://www.samsung.com/ - * - * HDMI register header file for Samsung TVOUT driver - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. -*/ - -#ifndef SAMSUNG_REGS_HDMI_H -#define SAMSUNG_REGS_HDMI_H - -/* - * Register part -*/ - -#define HDMI_CTRL_BASE(x) ((x) + 0x00000000) -#define HDMI_CORE_BASE(x) ((x) + 0x00010000) -#define HDMI_TG_BASE(x) ((x) + 0x00050000) - -/* Control registers */ -#define HDMI_INTC_CON HDMI_CTRL_BASE(0x0000) -#define HDMI_INTC_FLAG HDMI_CTRL_BASE(0x0004) -#define HDMI_HPD_STATUS HDMI_CTRL_BASE(0x000C) -#define HDMI_PHY_RSTOUT HDMI_CTRL_BASE(0x0014) -#define HDMI_PHY_VPLL HDMI_CTRL_BASE(0x0018) -#define HDMI_PHY_CMU HDMI_CTRL_BASE(0x001C) -#define HDMI_CORE_RSTOUT HDMI_CTRL_BASE(0x0020) - -/* Core registers */ -#define HDMI_CON_0 HDMI_CORE_BASE(0x0000) -#define HDMI_CON_1 HDMI_CORE_BASE(0x0004) -#define HDMI_CON_2 HDMI_CORE_BASE(0x0008) -#define HDMI_SYS_STATUS HDMI_CORE_BASE(0x0010) -#define HDMI_PHY_STATUS HDMI_CORE_BASE(0x0014) -#define HDMI_STATUS_EN HDMI_CORE_BASE(0x0020) -#define HDMI_HPD HDMI_CORE_BASE(0x0030) -#define HDMI_MODE_SEL HDMI_CORE_BASE(0x0040) -#define HDMI_BLUE_SCREEN_0 HDMI_CORE_BASE(0x0050) -#define HDMI_BLUE_SCREEN_1 HDMI_CORE_BASE(0x0054) -#define HDMI_BLUE_SCREEN_2 HDMI_CORE_BASE(0x0058) -#define HDMI_H_BLANK_0 HDMI_CORE_BASE(0x00A0) -#define HDMI_H_BLANK_1 HDMI_CORE_BASE(0x00A4) -#define HDMI_V_BLANK_0 HDMI_CORE_BASE(0x00B0) -#define HDMI_V_BLANK_1 HDMI_CORE_BASE(0x00B4) -#define HDMI_V_BLANK_2 HDMI_CORE_BASE(0x00B8) -#define HDMI_H_V_LINE_0 HDMI_CORE_BASE(0x00C0) -#define HDMI_H_V_LINE_1 HDMI_CORE_BASE(0x00C4) -#define HDMI_H_V_LINE_2 HDMI_CORE_BASE(0x00C8) -#define HDMI_VSYNC_POL HDMI_CORE_BASE(0x00E4) -#define HDMI_INT_PRO_MODE HDMI_CORE_BASE(0x00E8) -#define HDMI_V_BLANK_F_0 HDMI_CORE_BASE(0x0110) -#define HDMI_V_BLANK_F_1 HDMI_CORE_BASE(0x0114) -#define HDMI_V_BLANK_F_2 HDMI_CORE_BASE(0x0118) -#define HDMI_H_SYNC_GEN_0 HDMI_CORE_BASE(0x0120) -#define HDMI_H_SYNC_GEN_1 HDMI_CORE_BASE(0x0124) -#define HDMI_H_SYNC_GEN_2 HDMI_CORE_BASE(0x0128) -#define HDMI_V_SYNC_GEN_1_0 HDMI_CORE_BASE(0x0130) -#define HDMI_V_SYNC_GEN_1_1 HDMI_CORE_BASE(0x0134) -#define HDMI_V_SYNC_GEN_1_2 HDMI_CORE_BASE(0x0138) -#define HDMI_V_SYNC_GEN_2_0 HDMI_CORE_BASE(0x0140) -#define HDMI_V_SYNC_GEN_2_1 HDMI_CORE_BASE(0x0144) -#define HDMI_V_SYNC_GEN_2_2 HDMI_CORE_BASE(0x0148) -#define HDMI_V_SYNC_GEN_3_0 HDMI_CORE_BASE(0x0150) -#define HDMI_V_SYNC_GEN_3_1 HDMI_CORE_BASE(0x0154) -#define HDMI_V_SYNC_GEN_3_2 HDMI_CORE_BASE(0x0158) -#define HDMI_AVI_CON HDMI_CORE_BASE(0x0300) -#define HDMI_AVI_BYTE(n) HDMI_CORE_BASE(0x0320 + 4 * (n)) -#define HDMI_DC_CONTROL HDMI_CORE_BASE(0x05C0) -#define HDMI_VIDEO_PATTERN_GEN HDMI_CORE_BASE(0x05C4) -#define HDMI_HPD_GEN HDMI_CORE_BASE(0x05C8) - -/* Timing generator registers */ -#define HDMI_TG_CMD HDMI_TG_BASE(0x0000) -#define HDMI_TG_H_FSZ_L HDMI_TG_BASE(0x0018) -#define HDMI_TG_H_FSZ_H HDMI_TG_BASE(0x001C) -#define HDMI_TG_HACT_ST_L HDMI_TG_BASE(0x0020) -#define HDMI_TG_HACT_ST_H HDMI_TG_BASE(0x0024) -#define HDMI_TG_HACT_SZ_L HDMI_TG_BASE(0x0028) -#define HDMI_TG_HACT_SZ_H HDMI_TG_BASE(0x002C) -#define HDMI_TG_V_FSZ_L HDMI_TG_BASE(0x0030) -#define HDMI_TG_V_FSZ_H HDMI_TG_BASE(0x0034) -#define HDMI_TG_VSYNC_L HDMI_TG_BASE(0x0038) -#define HDMI_TG_VSYNC_H HDMI_TG_BASE(0x003C) -#define HDMI_TG_VSYNC2_L HDMI_TG_BASE(0x0040) -#define HDMI_TG_VSYNC2_H HDMI_TG_BASE(0x0044) -#define HDMI_TG_VACT_ST_L HDMI_TG_BASE(0x0048) -#define HDMI_TG_VACT_ST_H HDMI_TG_BASE(0x004C) -#define HDMI_TG_VACT_SZ_L HDMI_TG_BASE(0x0050) -#define HDMI_TG_VACT_SZ_H HDMI_TG_BASE(0x0054) -#define HDMI_TG_FIELD_CHG_L HDMI_TG_BASE(0x0058) -#define HDMI_TG_FIELD_CHG_H HDMI_TG_BASE(0x005C) -#define HDMI_TG_VACT_ST2_L HDMI_TG_BASE(0x0060) -#define HDMI_TG_VACT_ST2_H HDMI_TG_BASE(0x0064) -#define HDMI_TG_VSYNC_TOP_HDMI_L HDMI_TG_BASE(0x0078) -#define HDMI_TG_VSYNC_TOP_HDMI_H HDMI_TG_BASE(0x007C) -#define HDMI_TG_VSYNC_BOT_HDMI_L HDMI_TG_BASE(0x0080) -#define HDMI_TG_VSYNC_BOT_HDMI_H HDMI_TG_BASE(0x0084) -#define HDMI_TG_FIELD_TOP_HDMI_L HDMI_TG_BASE(0x0088) -#define HDMI_TG_FIELD_TOP_HDMI_H HDMI_TG_BASE(0x008C) -#define HDMI_TG_FIELD_BOT_HDMI_L HDMI_TG_BASE(0x0090) -#define HDMI_TG_FIELD_BOT_HDMI_H HDMI_TG_BASE(0x0094) - -/* - * Bit definition part - */ - -/* HDMI_INTC_CON */ -#define HDMI_INTC_EN_GLOBAL (1 << 6) -#define HDMI_INTC_EN_HPD_PLUG (1 << 3) -#define HDMI_INTC_EN_HPD_UNPLUG (1 << 2) - -/* HDMI_INTC_FLAG */ -#define HDMI_INTC_FLAG_HPD_PLUG (1 << 3) -#define HDMI_INTC_FLAG_HPD_UNPLUG (1 << 2) - -/* HDMI_PHY_RSTOUT */ -#define HDMI_PHY_SW_RSTOUT (1 << 0) - -/* HDMI_CORE_RSTOUT */ -#define HDMI_CORE_SW_RSTOUT (1 << 0) - -/* HDMI_CON_0 */ -#define HDMI_BLUE_SCR_EN (1 << 5) -#define HDMI_EN (1 << 0) - -/* HDMI_CON_2 */ -#define HDMI_DVI_PERAMBLE_EN (1 << 5) -#define HDMI_DVI_BAND_EN (1 << 1) - -/* HDMI_PHY_STATUS */ -#define HDMI_PHY_STATUS_READY (1 << 0) - -/* HDMI_MODE_SEL */ -#define HDMI_MODE_HDMI_EN (1 << 1) -#define HDMI_MODE_DVI_EN (1 << 0) -#define HDMI_MODE_MASK (3 << 0) - -/* HDMI_TG_CMD */ -#define HDMI_TG_FIELD_EN (1 << 1) -#define HDMI_TG_EN (1 << 0) - -#endif /* SAMSUNG_REGS_HDMI_H */ diff --git a/drivers/media/platform/s5p-tv/regs-mixer.h b/drivers/media/platform/s5p-tv/regs-mixer.h deleted file mode 100644 index 158abb43d0a4..000000000000 --- a/drivers/media/platform/s5p-tv/regs-mixer.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * http://www.samsung.com/ - * - * Mixer register header file for Samsung Mixer driver - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. -*/ -#ifndef SAMSUNG_REGS_MIXER_H -#define SAMSUNG_REGS_MIXER_H - -/* - * Register part - */ -#define MXR_STATUS 0x0000 -#define MXR_CFG 0x0004 -#define MXR_INT_EN 0x0008 -#define MXR_INT_STATUS 0x000C -#define MXR_LAYER_CFG 0x0010 -#define MXR_VIDEO_CFG 0x0014 -#define MXR_GRAPHIC0_CFG 0x0020 -#define MXR_GRAPHIC0_BASE 0x0024 -#define MXR_GRAPHIC0_SPAN 0x0028 -#define MXR_GRAPHIC0_SXY 0x002C -#define MXR_GRAPHIC0_WH 0x0030 -#define MXR_GRAPHIC0_DXY 0x0034 -#define MXR_GRAPHIC0_BLANK 0x0038 -#define MXR_GRAPHIC1_CFG 0x0040 -#define MXR_GRAPHIC1_BASE 0x0044 -#define MXR_GRAPHIC1_SPAN 0x0048 -#define MXR_GRAPHIC1_SXY 0x004C -#define MXR_GRAPHIC1_WH 0x0050 -#define MXR_GRAPHIC1_DXY 0x0054 -#define MXR_GRAPHIC1_BLANK 0x0058 -#define MXR_BG_CFG 0x0060 -#define MXR_BG_COLOR0 0x0064 -#define MXR_BG_COLOR1 0x0068 -#define MXR_BG_COLOR2 0x006C - -/* for parametrized access to layer registers */ -#define MXR_GRAPHIC_CFG(i) (0x0020 + (i) * 0x20) -#define MXR_GRAPHIC_BASE(i) (0x0024 + (i) * 0x20) -#define MXR_GRAPHIC_SPAN(i) (0x0028 + (i) * 0x20) -#define MXR_GRAPHIC_SXY(i) (0x002C + (i) * 0x20) -#define MXR_GRAPHIC_WH(i) (0x0030 + (i) * 0x20) -#define MXR_GRAPHIC_DXY(i) (0x0034 + (i) * 0x20) - -/* - * Bit definition part - */ - -/* generates mask for range of bits */ -#define MXR_MASK(high_bit, low_bit) \ - (((2 << ((high_bit) - (low_bit))) - 1) << (low_bit)) - -#define MXR_MASK_VAL(val, high_bit, low_bit) \ - (((val) << (low_bit)) & MXR_MASK(high_bit, low_bit)) - -/* bits for MXR_STATUS */ -#define MXR_STATUS_16_BURST (1 << 7) -#define MXR_STATUS_BURST_MASK (1 << 7) -#define MXR_STATUS_SYNC_ENABLE (1 << 2) -#define MXR_STATUS_REG_RUN (1 << 0) - -/* bits for MXR_CFG */ -#define MXR_CFG_OUT_YUV444 (0 << 8) -#define MXR_CFG_OUT_RGB888 (1 << 8) -#define MXR_CFG_OUT_MASK (1 << 8) -#define MXR_CFG_DST_SDO (0 << 7) -#define MXR_CFG_DST_HDMI (1 << 7) -#define MXR_CFG_DST_MASK (1 << 7) -#define MXR_CFG_SCAN_HD_720 (0 << 6) -#define MXR_CFG_SCAN_HD_1080 (1 << 6) -#define MXR_CFG_GRP1_ENABLE (1 << 5) -#define MXR_CFG_GRP0_ENABLE (1 << 4) -#define MXR_CFG_VP_ENABLE (1 << 3) -#define MXR_CFG_SCAN_INTERLACE (0 << 2) -#define MXR_CFG_SCAN_PROGRASSIVE (1 << 2) -#define MXR_CFG_SCAN_NTSC (0 << 1) -#define MXR_CFG_SCAN_PAL (1 << 1) -#define MXR_CFG_SCAN_SD (0 << 0) -#define MXR_CFG_SCAN_HD (1 << 0) -#define MXR_CFG_SCAN_MASK 0x47 - -/* bits for MXR_GRAPHICn_CFG */ -#define MXR_GRP_CFG_COLOR_KEY_DISABLE (1 << 21) -#define MXR_GRP_CFG_BLEND_PRE_MUL (1 << 20) -#define MXR_GRP_CFG_FORMAT_VAL(x) MXR_MASK_VAL(x, 11, 8) -#define MXR_GRP_CFG_FORMAT_MASK MXR_GRP_CFG_FORMAT_VAL(~0) -#define MXR_GRP_CFG_ALPHA_VAL(x) MXR_MASK_VAL(x, 7, 0) - -/* bits for MXR_GRAPHICn_WH */ -#define MXR_GRP_WH_H_SCALE(x) MXR_MASK_VAL(x, 28, 28) -#define MXR_GRP_WH_V_SCALE(x) MXR_MASK_VAL(x, 12, 12) -#define MXR_GRP_WH_WIDTH(x) MXR_MASK_VAL(x, 26, 16) -#define MXR_GRP_WH_HEIGHT(x) MXR_MASK_VAL(x, 10, 0) - -/* bits for MXR_GRAPHICn_SXY */ -#define MXR_GRP_SXY_SX(x) MXR_MASK_VAL(x, 26, 16) -#define MXR_GRP_SXY_SY(x) MXR_MASK_VAL(x, 10, 0) - -/* bits for MXR_GRAPHICn_DXY */ -#define MXR_GRP_DXY_DX(x) MXR_MASK_VAL(x, 26, 16) -#define MXR_GRP_DXY_DY(x) MXR_MASK_VAL(x, 10, 0) - -/* bits for MXR_INT_EN */ -#define MXR_INT_EN_VSYNC (1 << 11) -#define MXR_INT_EN_ALL (0x0f << 8) - -/* bit for MXR_INT_STATUS */ -#define MXR_INT_CLEAR_VSYNC (1 << 11) -#define MXR_INT_STATUS_VSYNC (1 << 0) - -/* bit for MXR_LAYER_CFG */ -#define MXR_LAYER_CFG_GRP1_VAL(x) MXR_MASK_VAL(x, 11, 8) -#define MXR_LAYER_CFG_GRP0_VAL(x) MXR_MASK_VAL(x, 7, 4) -#define MXR_LAYER_CFG_VP_VAL(x) MXR_MASK_VAL(x, 3, 0) - -#endif /* SAMSUNG_REGS_MIXER_H */ - diff --git a/drivers/media/platform/s5p-tv/regs-sdo.h b/drivers/media/platform/s5p-tv/regs-sdo.h deleted file mode 100644 index 6f22fbfe2f6c..000000000000 --- a/drivers/media/platform/s5p-tv/regs-sdo.h +++ /dev/null @@ -1,63 +0,0 @@ -/* drivers/media/platform/s5p-tv/regs-sdo.h - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * http://www.samsung.com/ - * - * SDO register description file - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef SAMSUNG_REGS_SDO_H -#define SAMSUNG_REGS_SDO_H - -/* - * Register part - */ - -#define SDO_CLKCON 0x0000 -#define SDO_CONFIG 0x0008 -#define SDO_VBI 0x0014 -#define SDO_DAC 0x003C -#define SDO_CCCON 0x0180 -#define SDO_IRQ 0x0280 -#define SDO_IRQMASK 0x0284 -#define SDO_VERSION 0x03D8 - -/* - * Bit definition part - */ - -/* SDO Clock Control Register (SDO_CLKCON) */ -#define SDO_TVOUT_SW_RESET (1 << 4) -#define SDO_TVOUT_CLOCK_READY (1 << 1) -#define SDO_TVOUT_CLOCK_ON (1 << 0) - -/* SDO Video Standard Configuration Register (SDO_CONFIG) */ -#define SDO_PROGRESSIVE (1 << 4) -#define SDO_NTSC_M 0 -#define SDO_PAL_M 1 -#define SDO_PAL_BGHID 2 -#define SDO_PAL_N 3 -#define SDO_PAL_NC 4 -#define SDO_NTSC_443 8 -#define SDO_PAL_60 9 -#define SDO_STANDARD_MASK 0xf - -/* SDO VBI Configuration Register (SDO_VBI) */ -#define SDO_CVBS_WSS_INS (1 << 14) -#define SDO_CVBS_CLOSED_CAPTION_MASK (3 << 12) - -/* SDO DAC Configuration Register (SDO_DAC) */ -#define SDO_POWER_ON_DAC (1 << 0) - -/* SDO Color Compensation On/Off Control (SDO_CCCON) */ -#define SDO_COMPENSATION_BHS_ADJ_OFF (1 << 4) -#define SDO_COMPENSATION_CVBS_COMP_OFF (1 << 0) - -/* SDO Interrupt Request Register (SDO_IRQ) */ -#define SDO_VSYNC_IRQ_PEND (1 << 0) - -#endif /* SAMSUNG_REGS_SDO_H */ diff --git a/drivers/media/platform/s5p-tv/regs-vp.h b/drivers/media/platform/s5p-tv/regs-vp.h deleted file mode 100644 index 6c63984e11e8..000000000000 --- a/drivers/media/platform/s5p-tv/regs-vp.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * http://www.samsung.com/ - * - * Video processor register header file for Samsung Mixer driver - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef SAMSUNG_REGS_VP_H -#define SAMSUNG_REGS_VP_H - -/* - * Register part - */ - -#define VP_ENABLE 0x0000 -#define VP_SRESET 0x0004 -#define VP_SHADOW_UPDATE 0x0008 -#define VP_FIELD_ID 0x000C -#define VP_MODE 0x0010 -#define VP_IMG_SIZE_Y 0x0014 -#define VP_IMG_SIZE_C 0x0018 -#define VP_PER_RATE_CTRL 0x001C -#define VP_TOP_Y_PTR 0x0028 -#define VP_BOT_Y_PTR 0x002C -#define VP_TOP_C_PTR 0x0030 -#define VP_BOT_C_PTR 0x0034 -#define VP_ENDIAN_MODE 0x03CC -#define VP_SRC_H_POSITION 0x0044 -#define VP_SRC_V_POSITION 0x0048 -#define VP_SRC_WIDTH 0x004C -#define VP_SRC_HEIGHT 0x0050 -#define VP_DST_H_POSITION 0x0054 -#define VP_DST_V_POSITION 0x0058 -#define VP_DST_WIDTH 0x005C -#define VP_DST_HEIGHT 0x0060 -#define VP_H_RATIO 0x0064 -#define VP_V_RATIO 0x0068 -#define VP_POLY8_Y0_LL 0x006C -#define VP_POLY4_Y0_LL 0x00EC -#define VP_POLY4_C0_LL 0x012C - -/* - * Bit definition part - */ - -/* generates mask for range of bits */ - -#define VP_MASK(high_bit, low_bit) \ - (((2 << ((high_bit) - (low_bit))) - 1) << (low_bit)) - -#define VP_MASK_VAL(val, high_bit, low_bit) \ - (((val) << (low_bit)) & VP_MASK(high_bit, low_bit)) - - /* VP_ENABLE */ -#define VP_ENABLE_ON (1 << 0) - -/* VP_SRESET */ -#define VP_SRESET_PROCESSING (1 << 0) - -/* VP_SHADOW_UPDATE */ -#define VP_SHADOW_UPDATE_ENABLE (1 << 0) - -/* VP_MODE */ -#define VP_MODE_NV12 (0 << 6) -#define VP_MODE_NV21 (1 << 6) -#define VP_MODE_LINE_SKIP (1 << 5) -#define VP_MODE_MEM_LINEAR (0 << 4) -#define VP_MODE_MEM_TILED (1 << 4) -#define VP_MODE_FMT_MASK (5 << 4) -#define VP_MODE_FIELD_ID_AUTO_TOGGLING (1 << 2) -#define VP_MODE_2D_IPC (1 << 1) - -/* VP_IMG_SIZE_Y */ -/* VP_IMG_SIZE_C */ -#define VP_IMG_HSIZE(x) VP_MASK_VAL(x, 29, 16) -#define VP_IMG_VSIZE(x) VP_MASK_VAL(x, 13, 0) - -/* VP_SRC_H_POSITION */ -#define VP_SRC_H_POSITION_VAL(x) VP_MASK_VAL(x, 14, 4) - -/* VP_ENDIAN_MODE */ -#define VP_ENDIAN_MODE_LITTLE (1 << 0) - -#endif /* SAMSUNG_REGS_VP_H */ diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c deleted file mode 100644 index c75d4354d182..000000000000 --- a/drivers/media/platform/s5p-tv/sdo_drv.c +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Samsung Standard Definition Output (SDO) driver - * - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * - * Tomasz Stanislawski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundiation. either version 2 of the License, - * or (at your option) any later version - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "regs-sdo.h" - -MODULE_AUTHOR("Tomasz Stanislawski, "); -MODULE_DESCRIPTION("Samsung Standard Definition Output (SDO)"); -MODULE_LICENSE("GPL"); - -#define SDO_DEFAULT_STD V4L2_STD_PAL - -struct sdo_format { - v4l2_std_id id; - /* all modes are 720 pixels wide */ - unsigned int height; - unsigned int cookie; -}; - -struct sdo_device { - /** pointer to device parent */ - struct device *dev; - /** base address of SDO registers */ - void __iomem *regs; - /** SDO interrupt */ - unsigned int irq; - /** DAC source clock */ - struct clk *sclk_dac; - /** DAC clock */ - struct clk *dac; - /** DAC physical interface */ - struct clk *dacphy; - /** clock for control of VPLL */ - struct clk *fout_vpll; - /** vpll rate before sdo stream was on */ - unsigned long vpll_rate; - /** regulator for SDO IP power */ - struct regulator *vdac; - /** regulator for SDO plug detection */ - struct regulator *vdet; - /** subdev used as device interface */ - struct v4l2_subdev sd; - /** current format */ - const struct sdo_format *fmt; -}; - -static inline struct sdo_device *sd_to_sdev(struct v4l2_subdev *sd) -{ - return container_of(sd, struct sdo_device, sd); -} - -static inline -void sdo_write_mask(struct sdo_device *sdev, u32 reg_id, u32 value, u32 mask) -{ - u32 old = readl(sdev->regs + reg_id); - value = (value & mask) | (old & ~mask); - writel(value, sdev->regs + reg_id); -} - -static inline -void sdo_write(struct sdo_device *sdev, u32 reg_id, u32 value) -{ - writel(value, sdev->regs + reg_id); -} - -static inline -u32 sdo_read(struct sdo_device *sdev, u32 reg_id) -{ - return readl(sdev->regs + reg_id); -} - -static irqreturn_t sdo_irq_handler(int irq, void *dev_data) -{ - struct sdo_device *sdev = dev_data; - - /* clear interrupt */ - sdo_write_mask(sdev, SDO_IRQ, ~0, SDO_VSYNC_IRQ_PEND); - return IRQ_HANDLED; -} - -static void sdo_reg_debug(struct sdo_device *sdev) -{ -#define DBGREG(reg_id) \ - dev_info(sdev->dev, #reg_id " = %08x\n", \ - sdo_read(sdev, reg_id)) - - DBGREG(SDO_CLKCON); - DBGREG(SDO_CONFIG); - DBGREG(SDO_VBI); - DBGREG(SDO_DAC); - DBGREG(SDO_IRQ); - DBGREG(SDO_IRQMASK); - DBGREG(SDO_VERSION); -} - -static const struct sdo_format sdo_format[] = { - { V4L2_STD_PAL_N, .height = 576, .cookie = SDO_PAL_N }, - { V4L2_STD_PAL_Nc, .height = 576, .cookie = SDO_PAL_NC }, - { V4L2_STD_PAL_M, .height = 480, .cookie = SDO_PAL_M }, - { V4L2_STD_PAL_60, .height = 480, .cookie = SDO_PAL_60 }, - { V4L2_STD_NTSC_443, .height = 480, .cookie = SDO_NTSC_443 }, - { V4L2_STD_PAL, .height = 576, .cookie = SDO_PAL_BGHID }, - { V4L2_STD_NTSC_M, .height = 480, .cookie = SDO_NTSC_M }, -}; - -static const struct sdo_format *sdo_find_format(v4l2_std_id id) -{ - int i; - for (i = 0; i < ARRAY_SIZE(sdo_format); ++i) - if (sdo_format[i].id & id) - return &sdo_format[i]; - return NULL; -} - -static int sdo_g_tvnorms_output(struct v4l2_subdev *sd, v4l2_std_id *std) -{ - *std = V4L2_STD_NTSC_M | V4L2_STD_PAL_M | V4L2_STD_PAL | - V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | - V4L2_STD_NTSC_443 | V4L2_STD_PAL_60; - return 0; -} - -static int sdo_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) -{ - struct sdo_device *sdev = sd_to_sdev(sd); - const struct sdo_format *fmt; - fmt = sdo_find_format(std); - if (fmt == NULL) - return -EINVAL; - sdev->fmt = fmt; - return 0; -} - -static int sdo_g_std_output(struct v4l2_subdev *sd, v4l2_std_id *std) -{ - *std = sd_to_sdev(sd)->fmt->id; - return 0; -} - -static int sdo_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - struct sdo_device *sdev = sd_to_sdev(sd); - - if (!sdev->fmt) - return -ENXIO; - if (format->pad) - return -EINVAL; - /* all modes are 720 pixels wide */ - fmt->width = 720; - fmt->height = sdev->fmt->height; - fmt->code = MEDIA_BUS_FMT_FIXED; - fmt->field = V4L2_FIELD_INTERLACED; - fmt->colorspace = V4L2_COLORSPACE_JPEG; - return 0; -} - -static int sdo_s_power(struct v4l2_subdev *sd, int on) -{ - struct sdo_device *sdev = sd_to_sdev(sd); - struct device *dev = sdev->dev; - int ret; - - dev_info(dev, "sdo_s_power(%d)\n", on); - - if (on) - ret = pm_runtime_get_sync(dev); - else - ret = pm_runtime_put_sync(dev); - - /* only values < 0 indicate errors */ - return ret < 0 ? ret : 0; -} - -static int sdo_streamon(struct sdo_device *sdev) -{ - int ret; - - /* set proper clock for Timing Generator */ - sdev->vpll_rate = clk_get_rate(sdev->fout_vpll); - ret = clk_set_rate(sdev->fout_vpll, 54000000); - if (ret < 0) { - dev_err(sdev->dev, "Failed to set vpll rate\n"); - return ret; - } - dev_info(sdev->dev, "fout_vpll.rate = %lu\n", - clk_get_rate(sdev->fout_vpll)); - /* enable clock in SDO */ - sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON); - ret = clk_prepare_enable(sdev->dacphy); - if (ret < 0) { - dev_err(sdev->dev, "clk_prepare_enable(dacphy) failed\n"); - goto fail; - } - /* enable DAC */ - sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC); - sdo_reg_debug(sdev); - return 0; - -fail: - sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); - clk_set_rate(sdev->fout_vpll, sdev->vpll_rate); - return ret; -} - -static int sdo_streamoff(struct sdo_device *sdev) -{ - int tries; - - sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC); - clk_disable_unprepare(sdev->dacphy); - sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); - for (tries = 100; tries; --tries) { - if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY) - break; - mdelay(1); - } - if (tries == 0) - dev_err(sdev->dev, "failed to stop streaming\n"); - clk_set_rate(sdev->fout_vpll, sdev->vpll_rate); - return tries ? 0 : -EIO; -} - -static int sdo_s_stream(struct v4l2_subdev *sd, int on) -{ - struct sdo_device *sdev = sd_to_sdev(sd); - return on ? sdo_streamon(sdev) : sdo_streamoff(sdev); -} - -static const struct v4l2_subdev_core_ops sdo_sd_core_ops = { - .s_power = sdo_s_power, -}; - -static const struct v4l2_subdev_video_ops sdo_sd_video_ops = { - .s_std_output = sdo_s_std_output, - .g_std_output = sdo_g_std_output, - .g_tvnorms_output = sdo_g_tvnorms_output, - .s_stream = sdo_s_stream, -}; - -static const struct v4l2_subdev_pad_ops sdo_sd_pad_ops = { - .get_fmt = sdo_get_fmt, -}; - -static const struct v4l2_subdev_ops sdo_sd_ops = { - .core = &sdo_sd_core_ops, - .video = &sdo_sd_video_ops, - .pad = &sdo_sd_pad_ops, -}; - -static int sdo_runtime_suspend(struct device *dev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct sdo_device *sdev = sd_to_sdev(sd); - - dev_info(dev, "suspend\n"); - regulator_disable(sdev->vdet); - regulator_disable(sdev->vdac); - clk_disable_unprepare(sdev->sclk_dac); - return 0; -} - -static int sdo_runtime_resume(struct device *dev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct sdo_device *sdev = sd_to_sdev(sd); - int ret; - - dev_info(dev, "resume\n"); - - ret = clk_prepare_enable(sdev->sclk_dac); - if (ret < 0) - return ret; - - ret = regulator_enable(sdev->vdac); - if (ret < 0) - goto dac_clk_dis; - - ret = regulator_enable(sdev->vdet); - if (ret < 0) - goto vdac_r_dis; - - /* software reset */ - sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_SW_RESET); - mdelay(10); - sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_SW_RESET); - - /* setting TV mode */ - sdo_write_mask(sdev, SDO_CONFIG, sdev->fmt->cookie, SDO_STANDARD_MASK); - /* XXX: forcing interlaced mode using undocumented bit */ - sdo_write_mask(sdev, SDO_CONFIG, 0, SDO_PROGRESSIVE); - /* turn all VBI off */ - sdo_write_mask(sdev, SDO_VBI, 0, SDO_CVBS_WSS_INS | - SDO_CVBS_CLOSED_CAPTION_MASK); - /* turn all post processing off */ - sdo_write_mask(sdev, SDO_CCCON, ~0, SDO_COMPENSATION_BHS_ADJ_OFF | - SDO_COMPENSATION_CVBS_COMP_OFF); - sdo_reg_debug(sdev); - return 0; - -vdac_r_dis: - regulator_disable(sdev->vdac); -dac_clk_dis: - clk_disable_unprepare(sdev->sclk_dac); - return ret; -} - -static const struct dev_pm_ops sdo_pm_ops = { - .runtime_suspend = sdo_runtime_suspend, - .runtime_resume = sdo_runtime_resume, -}; - -static int sdo_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct sdo_device *sdev; - struct resource *res; - int ret = 0; - struct clk *sclk_vpll; - - dev_info(dev, "probe start\n"); - sdev = devm_kzalloc(&pdev->dev, sizeof(*sdev), GFP_KERNEL); - if (!sdev) { - dev_err(dev, "not enough memory.\n"); - ret = -ENOMEM; - goto fail; - } - sdev->dev = dev; - - /* mapping registers */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(dev, "get memory resource failed.\n"); - ret = -ENXIO; - goto fail; - } - - sdev->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); - if (sdev->regs == NULL) { - dev_err(dev, "register mapping failed.\n"); - ret = -ENXIO; - goto fail; - } - - /* acquiring interrupt */ - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res == NULL) { - dev_err(dev, "get interrupt resource failed.\n"); - ret = -ENXIO; - goto fail; - } - ret = devm_request_irq(&pdev->dev, res->start, sdo_irq_handler, 0, - "s5p-sdo", sdev); - if (ret) { - dev_err(dev, "request interrupt failed.\n"); - goto fail; - } - sdev->irq = res->start; - - /* acquire clocks */ - sdev->sclk_dac = clk_get(dev, "sclk_dac"); - if (IS_ERR(sdev->sclk_dac)) { - dev_err(dev, "failed to get clock 'sclk_dac'\n"); - ret = PTR_ERR(sdev->sclk_dac); - goto fail; - } - sdev->dac = clk_get(dev, "dac"); - if (IS_ERR(sdev->dac)) { - dev_err(dev, "failed to get clock 'dac'\n"); - ret = PTR_ERR(sdev->dac); - goto fail_sclk_dac; - } - sdev->dacphy = clk_get(dev, "dacphy"); - if (IS_ERR(sdev->dacphy)) { - dev_err(dev, "failed to get clock 'dacphy'\n"); - ret = PTR_ERR(sdev->dacphy); - goto fail_dac; - } - sclk_vpll = clk_get(dev, "sclk_vpll"); - if (IS_ERR(sclk_vpll)) { - dev_err(dev, "failed to get clock 'sclk_vpll'\n"); - ret = PTR_ERR(sclk_vpll); - goto fail_dacphy; - } - clk_set_parent(sdev->sclk_dac, sclk_vpll); - clk_put(sclk_vpll); - sdev->fout_vpll = clk_get(dev, "fout_vpll"); - if (IS_ERR(sdev->fout_vpll)) { - dev_err(dev, "failed to get clock 'fout_vpll'\n"); - ret = PTR_ERR(sdev->fout_vpll); - goto fail_dacphy; - } - dev_info(dev, "fout_vpll.rate = %lu\n", clk_get_rate(sclk_vpll)); - - /* acquire regulator */ - sdev->vdac = devm_regulator_get(dev, "vdd33a_dac"); - if (IS_ERR(sdev->vdac)) { - dev_err(dev, "failed to get regulator 'vdac'\n"); - ret = PTR_ERR(sdev->vdac); - goto fail_fout_vpll; - } - sdev->vdet = devm_regulator_get(dev, "vdet"); - if (IS_ERR(sdev->vdet)) { - dev_err(dev, "failed to get regulator 'vdet'\n"); - ret = PTR_ERR(sdev->vdet); - goto fail_fout_vpll; - } - - /* enable gate for dac clock, because mixer uses it */ - ret = clk_prepare_enable(sdev->dac); - if (ret < 0) { - dev_err(dev, "clk_prepare_enable(dac) failed\n"); - goto fail_fout_vpll; - } - - /* configure power management */ - pm_runtime_enable(dev); - - /* configuration of interface subdevice */ - v4l2_subdev_init(&sdev->sd, &sdo_sd_ops); - sdev->sd.owner = THIS_MODULE; - strlcpy(sdev->sd.name, "s5p-sdo", sizeof(sdev->sd.name)); - - /* set default format */ - sdev->fmt = sdo_find_format(SDO_DEFAULT_STD); - BUG_ON(sdev->fmt == NULL); - - /* keeping subdev in device's private for use by other drivers */ - dev_set_drvdata(dev, &sdev->sd); - - dev_info(dev, "probe succeeded\n"); - return 0; - -fail_fout_vpll: - clk_put(sdev->fout_vpll); -fail_dacphy: - clk_put(sdev->dacphy); -fail_dac: - clk_put(sdev->dac); -fail_sclk_dac: - clk_put(sdev->sclk_dac); -fail: - dev_info(dev, "probe failed\n"); - return ret; -} - -static int sdo_remove(struct platform_device *pdev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(&pdev->dev); - struct sdo_device *sdev = sd_to_sdev(sd); - - pm_runtime_disable(&pdev->dev); - clk_disable_unprepare(sdev->dac); - clk_put(sdev->fout_vpll); - clk_put(sdev->dacphy); - clk_put(sdev->dac); - clk_put(sdev->sclk_dac); - - dev_info(&pdev->dev, "remove successful\n"); - return 0; -} - -static struct platform_driver sdo_driver __refdata = { - .probe = sdo_probe, - .remove = sdo_remove, - .driver = { - .name = "s5p-sdo", - .pm = &sdo_pm_ops, - } -}; - -module_platform_driver(sdo_driver); diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c b/drivers/media/platform/s5p-tv/sii9234_drv.c deleted file mode 100644 index 0a97f9ab4f76..000000000000 --- a/drivers/media/platform/s5p-tv/sii9234_drv.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Samsung MHL interface driver - * - * Copyright (C) 2011 Samsung Electronics Co.Ltd - * Author: Tomasz Stanislawski - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -MODULE_AUTHOR("Tomasz Stanislawski "); -MODULE_DESCRIPTION("Samsung MHL interface driver"); -MODULE_LICENSE("GPL"); - -struct sii9234_context { - struct i2c_client *client; - struct regulator *power; - int gpio_n_reset; - struct v4l2_subdev sd; -}; - -static inline struct sii9234_context *sd_to_context(struct v4l2_subdev *sd) -{ - return container_of(sd, struct sii9234_context, sd); -} - -static inline int sii9234_readb(struct i2c_client *client, int addr) -{ - return i2c_smbus_read_byte_data(client, addr); -} - -static inline int sii9234_writeb(struct i2c_client *client, int addr, int value) -{ - return i2c_smbus_write_byte_data(client, addr, value); -} - -static inline int sii9234_writeb_mask(struct i2c_client *client, int addr, - int value, int mask) -{ - int ret; - - ret = i2c_smbus_read_byte_data(client, addr); - if (ret < 0) - return ret; - ret = (ret & ~mask) | (value & mask); - return i2c_smbus_write_byte_data(client, addr, ret); -} - -static inline int sii9234_readb_idx(struct i2c_client *client, int addr) -{ - int ret; - ret = i2c_smbus_write_byte_data(client, 0xbc, addr >> 8); - if (ret < 0) - return ret; - ret = i2c_smbus_write_byte_data(client, 0xbd, addr & 0xff); - if (ret < 0) - return ret; - return i2c_smbus_read_byte_data(client, 0xbe); -} - -static inline int sii9234_writeb_idx(struct i2c_client *client, int addr, - int value) -{ - int ret; - ret = i2c_smbus_write_byte_data(client, 0xbc, addr >> 8); - if (ret < 0) - return ret; - ret = i2c_smbus_write_byte_data(client, 0xbd, addr & 0xff); - if (ret < 0) - return ret; - ret = i2c_smbus_write_byte_data(client, 0xbe, value); - return ret; -} - -static inline int sii9234_writeb_idx_mask(struct i2c_client *client, int addr, - int value, int mask) -{ - int ret; - - ret = sii9234_readb_idx(client, addr); - if (ret < 0) - return ret; - ret = (ret & ~mask) | (value & mask); - return sii9234_writeb_idx(client, addr, ret); -} - -static int sii9234_reset(struct sii9234_context *ctx) -{ - struct i2c_client *client = ctx->client; - struct device *dev = &client->dev; - int ret, tries; - - gpio_direction_output(ctx->gpio_n_reset, 1); - mdelay(1); - gpio_direction_output(ctx->gpio_n_reset, 0); - mdelay(1); - gpio_direction_output(ctx->gpio_n_reset, 1); - mdelay(1); - - /* going to TTPI mode */ - ret = sii9234_writeb(client, 0xc7, 0); - if (ret < 0) { - dev_err(dev, "failed to set TTPI mode\n"); - return ret; - } - for (tries = 0; tries < 100 ; ++tries) { - ret = sii9234_readb(client, 0x1b); - if (ret > 0) - break; - if (ret < 0) { - dev_err(dev, "failed to reset device\n"); - return -EIO; - } - mdelay(1); - } - if (tries == 100) { - dev_err(dev, "maximal number of tries reached\n"); - return -EIO; - } - - return 0; -} - -static int sii9234_verify_version(struct i2c_client *client) -{ - struct device *dev = &client->dev; - int family, rev, tpi_rev, dev_id, sub_id, hdcp, id; - - family = sii9234_readb(client, 0x1b); - rev = sii9234_readb(client, 0x1c) & 0x0f; - tpi_rev = sii9234_readb(client, 0x1d) & 0x7f; - dev_id = sii9234_readb_idx(client, 0x0103); - sub_id = sii9234_readb_idx(client, 0x0102); - hdcp = sii9234_readb(client, 0x30); - - if (family < 0 || rev < 0 || tpi_rev < 0 || dev_id < 0 || - sub_id < 0 || hdcp < 0) { - dev_err(dev, "failed to read chip's version\n"); - return -EIO; - } - - id = (dev_id << 8) | sub_id; - - dev_info(dev, "chip: SiL%02x family: %02x, rev: %02x\n", - id, family, rev); - dev_info(dev, "tpi_rev:%02x, hdcp: %02x\n", tpi_rev, hdcp); - if (id != 0x9234) { - dev_err(dev, "not supported chip\n"); - return -ENODEV; - } - - return 0; -} - -static u8 data[][3] = { -/* setup from driver created by doonsoo45.kim */ - { 0x01, 0x05, 0x04 }, /* Enable Auto soft reset on SCDT = 0 */ - { 0x01, 0x08, 0x35 }, /* Power Up TMDS Tx Core */ - { 0x01, 0x0d, 0x1c }, /* HDMI Transcode mode enable */ - { 0x01, 0x2b, 0x01 }, /* Enable HDCP Compliance workaround */ - { 0x01, 0x79, 0x40 }, /* daniel test...MHL_INT */ - { 0x01, 0x80, 0x34 }, /* Enable Rx PLL Clock Value */ - { 0x01, 0x90, 0x27 }, /* Enable CBUS discovery */ - { 0x01, 0x91, 0xe5 }, /* Skip RGND detection */ - { 0x01, 0x92, 0x46 }, /* Force MHD mode */ - { 0x01, 0x93, 0xdc }, /* Disable CBUS pull-up during RGND measurement */ - { 0x01, 0x94, 0x66 }, /* 1.8V CBUS VTH & GND threshold */ - { 0x01, 0x95, 0x31 }, /* RGND block & single discovery attempt */ - { 0x01, 0x96, 0x22 }, /* use 1K and 2K setting */ - { 0x01, 0xa0, 0x10 }, /* SIMG: Term mode */ - { 0x01, 0xa1, 0xfc }, /* Disable internal Mobile HD driver */ - { 0x01, 0xa3, 0xfa }, /* SIMG: Output Swing default EB, 3x Clk Mult */ - { 0x01, 0xa5, 0x80 }, /* SIMG: RGND Hysterisis, 3x mode for Beast */ - { 0x01, 0xa6, 0x0c }, /* SIMG: Swing Offset */ - { 0x02, 0x3d, 0x3f }, /* Power up CVCC 1.2V core */ - { 0x03, 0x00, 0x00 }, /* SIMG: correcting HW default */ - { 0x03, 0x11, 0x01 }, /* Enable TxPLL Clock */ - { 0x03, 0x12, 0x15 }, /* Enable Tx Clock Path & Equalizer */ - { 0x03, 0x13, 0x60 }, /* SIMG: Set termination value */ - { 0x03, 0x14, 0xf0 }, /* SIMG: Change CKDT level */ - { 0x03, 0x17, 0x07 }, /* SIMG: PLL Calrefsel */ - { 0x03, 0x1a, 0x20 }, /* VCO Cal */ - { 0x03, 0x22, 0xe0 }, /* SIMG: Auto EQ */ - { 0x03, 0x23, 0xc0 }, /* SIMG: Auto EQ */ - { 0x03, 0x24, 0xa0 }, /* SIMG: Auto EQ */ - { 0x03, 0x25, 0x80 }, /* SIMG: Auto EQ */ - { 0x03, 0x26, 0x60 }, /* SIMG: Auto EQ */ - { 0x03, 0x27, 0x40 }, /* SIMG: Auto EQ */ - { 0x03, 0x28, 0x20 }, /* SIMG: Auto EQ */ - { 0x03, 0x29, 0x00 }, /* SIMG: Auto EQ */ - { 0x03, 0x31, 0x0b }, /* SIMG: Rx PLL BW value from I2C BW ~ 4MHz */ - { 0x03, 0x45, 0x06 }, /* SIMG: DPLL Mode */ - { 0x03, 0x4b, 0x06 }, /* SIMG: Correcting HW default */ - { 0x03, 0x4c, 0xa0 }, /* Manual zone control */ - { 0x03, 0x4d, 0x02 }, /* SIMG: PLL Mode Value (order is important) */ -}; - -static int sii9234_set_internal(struct sii9234_context *ctx) -{ - struct i2c_client *client = ctx->client; - int i, ret; - - for (i = 0; i < ARRAY_SIZE(data); ++i) { - int addr = (data[i][0] << 8) | data[i][1]; - ret = sii9234_writeb_idx(client, addr, data[i][2]); - if (ret < 0) - return ret; - } - return 0; -} - -static int sii9234_runtime_suspend(struct device *dev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct sii9234_context *ctx = sd_to_context(sd); - struct i2c_client *client = ctx->client; - - dev_info(dev, "suspend start\n"); - - sii9234_writeb_mask(client, 0x1e, 3, 3); - regulator_disable(ctx->power); - - return 0; -} - -static int sii9234_runtime_resume(struct device *dev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct sii9234_context *ctx = sd_to_context(sd); - struct i2c_client *client = ctx->client; - int ret; - - dev_info(dev, "resume start\n"); - ret = regulator_enable(ctx->power); - if (ret < 0) - return ret; - - ret = sii9234_reset(ctx); - if (ret) - goto fail; - - /* enable tpi */ - ret = sii9234_writeb_mask(client, 0x1e, 1, 0); - if (ret < 0) - goto fail; - ret = sii9234_set_internal(ctx); - if (ret < 0) - goto fail; - - return 0; - -fail: - dev_err(dev, "failed to resume\n"); - regulator_disable(ctx->power); - - return ret; -} - -static const struct dev_pm_ops sii9234_pm_ops = { - .runtime_suspend = sii9234_runtime_suspend, - .runtime_resume = sii9234_runtime_resume, -}; - -static int sii9234_s_power(struct v4l2_subdev *sd, int on) -{ - struct sii9234_context *ctx = sd_to_context(sd); - int ret; - - if (on) - ret = pm_runtime_get_sync(&ctx->client->dev); - else - ret = pm_runtime_put(&ctx->client->dev); - /* only values < 0 indicate errors */ - return ret < 0 ? ret : 0; -} - -static int sii9234_s_stream(struct v4l2_subdev *sd, int enable) -{ - struct sii9234_context *ctx = sd_to_context(sd); - - /* (dis/en)able TDMS output */ - sii9234_writeb_mask(ctx->client, 0x1a, enable ? 0 : ~0 , 1 << 4); - return 0; -} - -static const struct v4l2_subdev_core_ops sii9234_core_ops = { - .s_power = sii9234_s_power, -}; - -static const struct v4l2_subdev_video_ops sii9234_video_ops = { - .s_stream = sii9234_s_stream, -}; - -static const struct v4l2_subdev_ops sii9234_ops = { - .core = &sii9234_core_ops, - .video = &sii9234_video_ops, -}; - -static int sii9234_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct device *dev = &client->dev; - struct sii9234_platform_data *pdata = dev->platform_data; - struct sii9234_context *ctx; - int ret; - - ctx = devm_kzalloc(&client->dev, sizeof(*ctx), GFP_KERNEL); - if (!ctx) { - dev_err(dev, "out of memory\n"); - ret = -ENOMEM; - goto fail; - } - ctx->client = client; - - ctx->power = devm_regulator_get(dev, "hdmi-en"); - if (IS_ERR(ctx->power)) { - dev_err(dev, "failed to acquire regulator hdmi-en\n"); - return PTR_ERR(ctx->power); - } - - ctx->gpio_n_reset = pdata->gpio_n_reset; - ret = devm_gpio_request(dev, ctx->gpio_n_reset, "MHL_RST"); - if (ret) { - dev_err(dev, "failed to acquire MHL_RST gpio\n"); - return ret; - } - - v4l2_i2c_subdev_init(&ctx->sd, client, &sii9234_ops); - - pm_runtime_enable(dev); - - /* enable device */ - ret = pm_runtime_get_sync(dev); - if (ret) - goto fail_pm; - - /* verify chip version */ - ret = sii9234_verify_version(client); - if (ret) - goto fail_pm_get; - - /* stop processing */ - pm_runtime_put(dev); - - dev_info(dev, "probe successful\n"); - - return 0; - -fail_pm_get: - pm_runtime_put_sync(dev); - -fail_pm: - pm_runtime_disable(dev); - -fail: - dev_err(dev, "probe failed\n"); - - return ret; -} - -static int sii9234_remove(struct i2c_client *client) -{ - struct device *dev = &client->dev; - - pm_runtime_disable(dev); - - dev_info(dev, "remove successful\n"); - - return 0; -} - - -static const struct i2c_device_id sii9234_id[] = { - { "SII9234", 0 }, - { }, -}; - -MODULE_DEVICE_TABLE(i2c, sii9234_id); -static struct i2c_driver sii9234_driver = { - .driver = { - .name = "sii9234", - .pm = &sii9234_pm_ops, - }, - .probe = sii9234_probe, - .remove = sii9234_remove, - .id_table = sii9234_id, -}; - -module_i2c_driver(sii9234_driver); From 9887c8642d40f517cbf78e324b252305f1ba4b05 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Tue, 7 Jun 2016 04:10:04 -0300 Subject: [PATCH 140/591] [media] dt/bindings: device tree description for AD5820 camera auto-focus coil Add documentation for ad5820 device tree binding. Signed-off-by: Pavel Machek Acked-by: Rob Herring Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../devicetree/bindings/media/i2c/ad5820.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/ad5820.txt diff --git a/Documentation/devicetree/bindings/media/i2c/ad5820.txt b/Documentation/devicetree/bindings/media/i2c/ad5820.txt new file mode 100644 index 000000000000..5940ca11c021 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/ad5820.txt @@ -0,0 +1,19 @@ +* Analog Devices AD5820 autofocus coil + +Required Properties: + + - compatible: Must contain "adi,ad5820" + + - reg: I2C slave address + + - VANA-supply: supply of voltage for VANA pin + +Example: + + ad5820: coil@c { + compatible = "adi,ad5820"; + reg = <0x0c>; + + VANA-supply = <&vaux4>; + }; + From bee3d51156113363e952674504833b4bc92cf15e Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 5 Aug 2016 07:26:11 -0300 Subject: [PATCH 141/591] [media] ad5820: Add driver for auto-focus coil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds support for AD5820 autofocus coil, found for example in Nokia N900 smartphone. Signed-off-by: Pavel Machek Acked-by: Pali Rohár Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/Kconfig | 7 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ad5820.c | 380 +++++++++++++++++++++++++++++++++++++ 3 files changed, 388 insertions(+) create mode 100644 drivers/media/i2c/ad5820.c diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index ce9006e10a30..c4df15a43d61 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -295,6 +295,13 @@ config VIDEO_ML86V7667 To compile this driver as a module, choose M here: the module will be called ml86v7667. +config VIDEO_AD5820 + tristate "AD5820 lens voice coil support" + depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER + ---help--- + This is a driver for the AD5820 camera lens voice coil. + It is used for example in Nokia N900 (RX-51). + config VIDEO_SAA7110 tristate "Philips SAA7110 video decoder" depends on VIDEO_V4L2 && I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 94f2c99e890d..0216af0f9281 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_VIDEO_SAA717X) += saa717x.o obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o +obj-$(CONFIG_VIDEO_AD5820) += ad5820.o obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o obj-$(CONFIG_VIDEO_ADV7180) += adv7180.o diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c new file mode 100644 index 000000000000..62cc1f54622f --- /dev/null +++ b/drivers/media/i2c/ad5820.c @@ -0,0 +1,380 @@ +/* + * drivers/media/i2c/ad5820.c + * + * AD5820 DAC driver for camera voice coil focus. + * + * Copyright (C) 2008 Nokia Corporation + * Copyright (C) 2007 Texas Instruments + * Copyright (C) 2016 Pavel Machek + * + * Contact: Tuukka Toivonen + * Sakari Ailus + * + * Based on af_d88.c by Texas Instruments. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#define AD5820_NAME "ad5820" + +/* Register definitions */ +#define AD5820_POWER_DOWN (1 << 15) +#define AD5820_DAC_SHIFT 4 +#define AD5820_RAMP_MODE_LINEAR (0 << 3) +#define AD5820_RAMP_MODE_64_16 (1 << 3) + +#define CODE_TO_RAMP_US(s) ((s) == 0 ? 0 : (1 << ((s) - 1)) * 50) +#define RAMP_US_TO_CODE(c) fls(((c) + ((c)>>1)) / 50) + +#define to_ad5820_device(sd) container_of(sd, struct ad5820_device, subdev) + +struct ad5820_device { + struct v4l2_subdev subdev; + struct ad5820_platform_data *platform_data; + struct regulator *vana; + + struct v4l2_ctrl_handler ctrls; + u32 focus_absolute; + u32 focus_ramp_time; + u32 focus_ramp_mode; + + struct mutex power_lock; + int power_count; + + int standby : 1; +}; + +static int ad5820_write(struct ad5820_device *coil, u16 data) +{ + struct i2c_client *client = v4l2_get_subdevdata(&coil->subdev); + struct i2c_msg msg; + int r; + + if (!client->adapter) + return -ENODEV; + + data = cpu_to_be16(data); + msg.addr = client->addr; + msg.flags = 0; + msg.len = 2; + msg.buf = (u8 *)&data; + + r = i2c_transfer(client->adapter, &msg, 1); + if (r < 0) { + dev_err(&client->dev, "write failed, error %d\n", r); + return r; + } + + return 0; +} + +/* + * Calculate status word and write it to the device based on current + * values of V4L2 controls. It is assumed that the stored V4L2 control + * values are properly limited and rounded. + */ +static int ad5820_update_hw(struct ad5820_device *coil) +{ + u16 status; + + status = RAMP_US_TO_CODE(coil->focus_ramp_time); + status |= coil->focus_ramp_mode + ? AD5820_RAMP_MODE_64_16 : AD5820_RAMP_MODE_LINEAR; + status |= coil->focus_absolute << AD5820_DAC_SHIFT; + + if (coil->standby) + status |= AD5820_POWER_DOWN; + + return ad5820_write(coil, status); +} + +/* + * Power handling + */ +static int ad5820_power_off(struct ad5820_device *coil, int standby) +{ + int ret = 0, ret2; + + /* + * Go to standby first as real power off my be denied by the hardware + * (single power line control for both coil and sensor). + */ + if (standby) { + coil->standby = 1; + ret = ad5820_update_hw(coil); + } + + ret2 = regulator_disable(coil->vana); + if (ret) + return ret; + return ret2; +} + +static int ad5820_power_on(struct ad5820_device *coil, int restore) +{ + int ret; + + ret = regulator_enable(coil->vana); + if (ret < 0) + return ret; + + if (restore) { + /* Restore the hardware settings. */ + coil->standby = 0; + ret = ad5820_update_hw(coil); + if (ret) + goto fail; + } + return 0; + +fail: + coil->standby = 1; + regulator_disable(coil->vana); + + return ret; +} + +/* + * V4L2 controls + */ +static int ad5820_set_ctrl(struct v4l2_ctrl *ctrl) +{ + struct ad5820_device *coil = + container_of(ctrl->handler, struct ad5820_device, ctrls); + + switch (ctrl->id) { + case V4L2_CID_FOCUS_ABSOLUTE: + coil->focus_absolute = ctrl->val; + return ad5820_update_hw(coil); + } + + return 0; +} + +static const struct v4l2_ctrl_ops ad5820_ctrl_ops = { + .s_ctrl = ad5820_set_ctrl, +}; + + +static int ad5820_init_controls(struct ad5820_device *coil) +{ + v4l2_ctrl_handler_init(&coil->ctrls, 1); + + /* + * V4L2_CID_FOCUS_ABSOLUTE + * + * Minimum current is 0 mA, maximum is 100 mA. Thus, 1 code is + * equivalent to 100/1023 = 0.0978 mA. Nevertheless, we do not use [mA] + * for focus position, because it is meaningless for user. Meaningful + * would be to use focus distance or even its inverse, but since the + * driver doesn't have sufficiently knowledge to do the conversion, we + * will just use abstract codes here. In any case, smaller value = focus + * position farther from camera. The default zero value means focus at + * infinity, and also least current consumption. + */ + v4l2_ctrl_new_std(&coil->ctrls, &ad5820_ctrl_ops, + V4L2_CID_FOCUS_ABSOLUTE, 0, 1023, 1, 0); + + if (coil->ctrls.error) + return coil->ctrls.error; + + coil->focus_absolute = 0; + coil->focus_ramp_time = 0; + coil->focus_ramp_mode = 0; + + coil->subdev.ctrl_handler = &coil->ctrls; + + return 0; +} + +/* + * V4L2 subdev operations + */ +static int ad5820_registered(struct v4l2_subdev *subdev) +{ + struct ad5820_device *coil = to_ad5820_device(subdev); + + return ad5820_init_controls(coil); +} + +static int +ad5820_set_power(struct v4l2_subdev *subdev, int on) +{ + struct ad5820_device *coil = to_ad5820_device(subdev); + int ret = 0; + + mutex_lock(&coil->power_lock); + + /* + * If the power count is modified from 0 to != 0 or from != 0 to 0, + * update the power state. + */ + if (coil->power_count == !on) { + ret = on ? ad5820_power_on(coil, 1) : ad5820_power_off(coil, 1); + if (ret < 0) + goto done; + } + + /* Update the power count. */ + coil->power_count += on ? 1 : -1; + WARN_ON(coil->power_count < 0); + +done: + mutex_unlock(&coil->power_lock); + return ret; +} + +static int ad5820_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) +{ + return ad5820_set_power(sd, 1); +} + +static int ad5820_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) +{ + return ad5820_set_power(sd, 0); +} + +static const struct v4l2_subdev_core_ops ad5820_core_ops = { + .s_power = ad5820_set_power, +}; + +static const struct v4l2_subdev_ops ad5820_ops = { + .core = &ad5820_core_ops, +}; + +static const struct v4l2_subdev_internal_ops ad5820_internal_ops = { + .registered = ad5820_registered, + .open = ad5820_open, + .close = ad5820_close, +}; + +/* + * I2C driver + */ +#ifdef CONFIG_PM + +static int ad5820_suspend(struct device *dev) +{ + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct ad5820_device *coil = to_ad5820_device(subdev); + + if (!coil->power_count) + return 0; + + return ad5820_power_off(coil, 0); +} + +static int ad5820_resume(struct device *dev) +{ + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct ad5820_device *coil = to_ad5820_device(subdev); + + if (!coil->power_count) + return 0; + + return ad5820_power_on(coil, 1); +} + +#else + +#define ad5820_suspend NULL +#define ad5820_resume NULL + +#endif /* CONFIG_PM */ + +static int ad5820_probe(struct i2c_client *client, + const struct i2c_device_id *devid) +{ + struct ad5820_device *coil; + int ret; + + coil = devm_kzalloc(&client->dev, sizeof(*coil), GFP_KERNEL); + if (!coil) + return -ENOMEM; + + coil->vana = devm_regulator_get(&client->dev, "VANA"); + if (IS_ERR(coil->vana)) { + ret = PTR_ERR(coil->vana); + if (ret != -EPROBE_DEFER) + dev_err(&client->dev, "could not get regulator for vana\n"); + return ret; + } + + mutex_init(&coil->power_lock); + + v4l2_i2c_subdev_init(&coil->subdev, client, &ad5820_ops); + coil->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; + coil->subdev.internal_ops = &ad5820_internal_ops; + strcpy(coil->subdev.name, "ad5820 focus"); + + ret = media_entity_pads_init(&coil->subdev.entity, 0, NULL); + if (ret < 0) + goto cleanup2; + + ret = v4l2_async_register_subdev(&coil->subdev); + if (ret < 0) + goto cleanup; + + return ret; + +cleanup2: + mutex_destroy(&coil->power_lock); +cleanup: + media_entity_cleanup(&coil->subdev.entity); + return ret; +} + +static int __exit ad5820_remove(struct i2c_client *client) +{ + struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct ad5820_device *coil = to_ad5820_device(subdev); + + v4l2_device_unregister_subdev(&coil->subdev); + v4l2_ctrl_handler_free(&coil->ctrls); + media_entity_cleanup(&coil->subdev.entity); + mutex_destroy(&coil->power_lock); + return 0; +} + +static const struct i2c_device_id ad5820_id_table[] = { + { AD5820_NAME, 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, ad5820_id_table); + +static SIMPLE_DEV_PM_OPS(ad5820_pm, ad5820_suspend, ad5820_resume); + +static struct i2c_driver ad5820_i2c_driver = { + .driver = { + .name = AD5820_NAME, + .pm = &ad5820_pm, + }, + .probe = ad5820_probe, + .remove = __exit_p(ad5820_remove), + .id_table = ad5820_id_table, +}; + +module_i2c_driver(ad5820_i2c_driver); + +MODULE_AUTHOR("Tuukka Toivonen"); +MODULE_DESCRIPTION("AD5820 camera lens driver"); +MODULE_LICENSE("GPL"); From 7e0739cd9c40752fc9d31cac86e3a31d5537be18 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 4 Aug 2016 05:51:12 -0300 Subject: [PATCH 142/591] [media] videodev2.h: fix sYCC/AdobeYCC default quantization range The default quantization range of the Y'CbCr encodings of sRGB and AdobeRGB are full range instead of limited range according to the corresponding standards. Fix this in the V4L2_MAP_QUANTIZATION_DEFAULT macro. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-007.rst | 4 ++-- include/uapi/linux/videodev2.h | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index f097268ffc54..c45d8794e8eb 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -367,7 +367,7 @@ The :ref:`adobergb` standard defines the colorspace used by computer graphics that use the AdobeRGB colorspace. This is also known as the :ref:`oprgb` standard. The default transfer function is ``V4L2_XFER_FUNC_ADOBERGB``. The default Y'CbCr encoding is -``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited +``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is full range. The chromaticities of the primary colors and the white reference are: @@ -448,7 +448,7 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. This transform is identical to one defined in SMPTE -170M/BT.601. The Y'CbCr quantization is limited range. +170M/BT.601. The Y'CbCr quantization is full range. .. _col-bt2020: diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 22bad8c741fe..0ec15222a6ca 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -345,8 +345,8 @@ enum v4l2_quantization { /* * The default for R'G'B' quantization is always full range, except * for the BT2020 colorspace. For Y'CbCr the quantization is always - * limited range, except for COLORSPACE_JPEG, SYCC, XV601 or XV709: - * those are full range. + * limited range, except for COLORSPACE_JPEG, SRGB, ADOBERGB, + * XV601 or XV709: those are full range. */ V4L2_QUANTIZATION_DEFAULT = 0, V4L2_QUANTIZATION_FULL_RANGE = 1, @@ -361,7 +361,8 @@ enum v4l2_quantization { #define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb, colsp, ycbcr_enc) \ (((is_rgb) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : \ (((is_rgb) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ - (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) ? \ + (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) || \ + (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == V4L2_COLORSPACE_SRGB ? \ V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) enum v4l2_priority { From d0a3a275e5676c547276f322eca4a789a570af19 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 4 Aug 2016 05:57:45 -0300 Subject: [PATCH 143/591] [media] vivid: don't mention the obsolete sYCC Y'CbCr encoding This encoding is identical to the 601 encoding. The old duplicate SYCC define is about to be removed for use in the kernel, so remove its use in vivid first. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vivid/vivid-ctrls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/vivid/vivid-ctrls.c b/drivers/media/platform/vivid/vivid-ctrls.c index b98089c95ef5..aceb38d9f7e7 100644 --- a/drivers/media/platform/vivid/vivid-ctrls.c +++ b/drivers/media/platform/vivid/vivid-ctrls.c @@ -761,7 +761,7 @@ static const char * const vivid_ctrl_ycbcr_enc_strings[] = { "Rec. 709", "xvYCC 601", "xvYCC 709", - "sYCC", + "", "BT.2020", "BT.2020 Constant Luminance", "SMPTE 240M", @@ -773,6 +773,7 @@ static const struct v4l2_ctrl_config vivid_ctrl_ycbcr_enc = { .id = VIVID_CID_YCBCR_ENC, .name = "Y'CbCr Encoding", .type = V4L2_CTRL_TYPE_MENU, + .menu_skip_mask = 1 << 5, .max = ARRAY_SIZE(vivid_ctrl_ycbcr_enc_strings) - 2, .qmenu = vivid_ctrl_ycbcr_enc_strings, }; From 1ee6dd5a918bd98dea20a2847f1ca15964dca952 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Aug 2016 08:21:38 -0300 Subject: [PATCH 144/591] [media] ad5820: fix one smatch warning drivers/media/i2c/ad5820.c:61:24: error: dubious one-bit signed bitfield Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ad5820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index 62cc1f54622f..d7ad5c1a1219 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -58,7 +58,7 @@ struct ad5820_device { struct mutex power_lock; int power_count; - int standby : 1; + unsigned int standby : 1; }; static int ad5820_write(struct ad5820_device *coil, u16 data) From 9ddbf68d264a8c2578dcb08d550dd00a273e12fa Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 4 Aug 2016 05:59:47 -0300 Subject: [PATCH 145/591] [media] v4l2-tpg-core: drop SYCC, use higher precision 601 conversion matrix The SYCC Y'CbCr encoding is identical to the 601 encoding. Since the SYCC define is about to be removed for use in the kernel we need to drop it in the TPG code as well. This patch also adds a 4th decimal to the 601 conversion matrix. That was specified by the sYCC spec and it makes sense to use this across the board. [mchehab@s-opensource.com: fix conflicts with LaTeX math expression patch] Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-007.rst | 30 +++++++++---------- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 14 ++++----- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index c45d8794e8eb..662302cfba8b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -97,11 +97,11 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: .. math:: - Y' = 0.299R' + 0.587G' + 0.114B' + Y' = 0.2990R' + 0.5870G' + 0.1140B' - Cb = -0.169R' - 0.331G' + 0.5B' + Cb = -0.1687R' - 0.3313G' + 0.5B' - Cr = 0.5R' - 0.419G' - 0.081B' + Cr = 0.5R' - 0.4187G' - 0.0813B' Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. This conversion to Y'CbCr is identical to the one defined in @@ -241,11 +241,11 @@ scaled and offset: .. math:: - Y' = \frac{219}{256} * (0.299R' + 0.587G' + 0.114B') + \frac{16}{256} + Y' = \frac{219}{256} * (0.2990R' + 0.5870G' + 0.1140B') + \frac{16}{256} - Cb = \frac{224}{256} * (-0.169R' - 0.331G' + 0.5B') + Cb = \frac{224}{256} * (-0.1687R' - 0.3313G' + 0.5B') - Cr = \frac{224}{256} * (0.5R' - 0.419G' - 0.081B') + Cr = \frac{224}{256} * (0.5R' - 0.4187G' - 0.0813B') Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. The non-standard xvYCC 709 or xvYCC 601 encodings can be @@ -440,11 +440,11 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: .. math:: - Y' = 0.299R' + 0.587G' + 0.114B' + Y' = 0.2990R' + 0.5870G' + 0.1140B' - Cb = -0.169R' - 0.331G' + 0.5B' + Cb = -0.1687R' - 0.3313G' + 0.5B' - Cr = 0.5R' - 0.419G' - 0.081B' + Cr = 0.5R' - 0.4187G' - 0.0813B' Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. This transform is identical to one defined in SMPTE @@ -842,11 +842,11 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: .. math:: - Y' = 0.299R' + 0.587G' + 0.114B' + Y' = 0.2990R' + 0.5870G' + 0.1140B' - Cb = -0.169R' - 0.331G' + 0.5B' + Cb = -0.1687R' - 0.3313G' + 0.5B' - Cr = 0.5R' - 0.419G' - 0.081B' + Cr = 0.5R' - 0.4187G' - 0.0813B' Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is @@ -940,11 +940,11 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: .. math:: - Y' = 0.299R' + 0.587G' + 0.114B' + Y' = 0.2990R' + 0.5870G' + 0.1140B' - Cb = -0.169R' - 0.331G' + 0.5B' + Cb = -0.1687R' - 0.3313G' + 0.5B' - Cr = 0.5R' - 0.419G' - 0.081B' + Cr = 0.5R' - 0.4187G' - 0.0813B' Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. The Y'CbCr quantization is limited range. This transform is diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c index 3ec3cebe62b9..1684810cab83 100644 --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c @@ -504,14 +504,14 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b, #define COEFF(v, r) ((int)(0.5 + (v) * (r) * 256.0)) static const int bt601[3][3] = { - { COEFF(0.299, 219), COEFF(0.587, 219), COEFF(0.114, 219) }, - { COEFF(-0.169, 224), COEFF(-0.331, 224), COEFF(0.5, 224) }, - { COEFF(0.5, 224), COEFF(-0.419, 224), COEFF(-0.081, 224) }, + { COEFF(0.299, 219), COEFF(0.587, 219), COEFF(0.114, 219) }, + { COEFF(-0.1687, 224), COEFF(-0.3313, 224), COEFF(0.5, 224) }, + { COEFF(0.5, 224), COEFF(-0.4187, 224), COEFF(-0.0813, 224) }, }; static const int bt601_full[3][3] = { - { COEFF(0.299, 255), COEFF(0.587, 255), COEFF(0.114, 255) }, - { COEFF(-0.169, 255), COEFF(-0.331, 255), COEFF(0.5, 255) }, - { COEFF(0.5, 255), COEFF(-0.419, 255), COEFF(-0.081, 255) }, + { COEFF(0.299, 255), COEFF(0.587, 255), COEFF(0.114, 255) }, + { COEFF(-0.1687, 255), COEFF(-0.3313, 255), COEFF(0.5, 255) }, + { COEFF(0.5, 255), COEFF(-0.4187, 255), COEFF(-0.0813, 255) }, }; static const int rec709[3][3] = { { COEFF(0.2126, 219), COEFF(0.7152, 219), COEFF(0.0722, 219) }, @@ -558,7 +558,6 @@ static void color_to_ycbcr(struct tpg_data *tpg, int r, int g, int b, switch (tpg->real_ycbcr_enc) { case V4L2_YCBCR_ENC_601: - case V4L2_YCBCR_ENC_SYCC: rgb2ycbcr(full ? bt601_full : bt601, r, g, b, y_offset, y, cb, cr); break; case V4L2_YCBCR_ENC_XV601: @@ -674,7 +673,6 @@ static void ycbcr_to_color(struct tpg_data *tpg, int y, int cb, int cr, switch (tpg->real_ycbcr_enc) { case V4L2_YCBCR_ENC_601: - case V4L2_YCBCR_ENC_SYCC: ycbcr2rgb(full ? bt601_full : bt601, y, cb, cr, y_offset, r, g, b); break; case V4L2_YCBCR_ENC_XV601: From adca8c8e251fdbdb6b28e3ef7a5ca24b597b82d8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 4 Aug 2016 06:01:48 -0300 Subject: [PATCH 146/591] [media] videodev2.h: put V4L2_YCBCR_ENC_SYCC under #ifndef __KERNEL__ This define is a duplicate of V4L2_YCBCR_ENC_601. So mark it as 'should not be used' and put it under #ifndef __KERNEL__ to prevent drivers from referring to it. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/uapi/linux/videodev2.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 0ec15222a6ca..5529741202b5 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -292,13 +292,11 @@ enum v4l2_ycbcr_encoding { * various colorspaces: * * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M, - * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and - * V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601 + * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_SRGB, + * V4L2_COLORSPACE_ADOBERGB and V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601 * * V4L2_COLORSPACE_REC709 and V4L2_COLORSPACE_DCI_P3: V4L2_YCBCR_ENC_709 * - * V4L2_COLORSPACE_SRGB: V4L2_YCBCR_ENC_SYCC - * * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020 * * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M @@ -317,8 +315,14 @@ enum v4l2_ycbcr_encoding { /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */ V4L2_YCBCR_ENC_XV709 = 4, - /* sYCC (Y'CbCr encoding of sRGB) */ +#ifndef __KERNEL__ + /* + * sYCC (Y'CbCr encoding of sRGB), identical to ENC_601. It was added + * originally due to a misunderstanding of the sYCC standard. It should + * not be used, instead use V4L2_YCBCR_ENC_601. + */ V4L2_YCBCR_ENC_SYCC = 5, +#endif /* BT.2020 Non-constant Luminance Y'CbCr */ V4L2_YCBCR_ENC_BT2020 = 6, From dda3aeaa16434482c2aec03c54262dd2bc9c357b Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 4 Aug 2016 06:09:03 -0300 Subject: [PATCH 147/591] [media] pixfmt.rst: drop V4L2_YCBCR_ENC_SYCC from the documentation The V4L2_YCBCR_ENC_SYCC encoding is identical to V4L2_YCBCR_ENC_601. Remove V4L2_YCBCR_ENC_SYCC from the documentation since it should not be used. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-006.rst | 10 ++-------- Documentation/media/uapi/v4l/pixfmt-007.rst | 12 ++++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-006.rst b/Documentation/media/uapi/v4l/pixfmt-006.rst index 56b691300158..574294ec0a89 100644 --- a/Documentation/media/uapi/v4l/pixfmt-006.rst +++ b/Documentation/media/uapi/v4l/pixfmt-006.rst @@ -229,23 +229,17 @@ needs to be filled in. - .. row 7 - - ``V4L2_YCBCR_ENC_SYCC`` - - - Use the extended gamut sYCC encoding. - - - .. row 8 - - ``V4L2_YCBCR_ENC_BT2020`` - Use the default non-constant luminance BT.2020 Y'CbCr encoding. - - .. row 9 + - .. row 8 - ``V4L2_YCBCR_ENC_BT2020_CONST_LUM`` - Use the constant luminance BT.2020 Yc'CbcCrc encoding. - - .. row 10 + - .. row 9 - ``V4L2_YCBCR_ENC_SMPTE_240M`` diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index 662302cfba8b..ab2fa3565fdd 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -261,7 +261,7 @@ Colorspace sRGB (V4L2_COLORSPACE_SRGB) The :ref:`srgb` standard defines the colorspace used by most webcams and computer graphics. The default transfer function is ``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is -``V4L2_YCBCR_ENC_SYCC``. The default Y'CbCr quantization is full range. +``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is full range. The chromaticities of the primary colors and the white reference are: @@ -339,8 +339,7 @@ Inverse Transfer function: L = ((L' + 0.055) / 1.055) ^{2.4}\text{, for }L' > 0.04045 The luminance (Y') and color difference (Cb and Cr) are obtained with -the following ``V4L2_YCBCR_ENC_SYCC`` encoding as defined by -:ref:`sycc`: +the following ``V4L2_YCBCR_ENC_601`` encoding as defined by :ref:`sycc`: .. math:: @@ -351,11 +350,8 @@ the following ``V4L2_YCBCR_ENC_SYCC`` encoding as defined by Cr = 0.5R' - 0.4187G' - 0.0813B' Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range -[-0.5…0.5]. The ``V4L2_YCBCR_ENC_SYCC`` quantization is always full -range. Although this Y'CbCr encoding looks very similar to the -``V4L2_YCBCR_ENC_XV601`` encoding, it is not. The -``V4L2_YCBCR_ENC_XV601`` scales and offsets the Y'CbCr values before -quantization, but this encoding does not do that. +[-0.5…0.5]. This transform is identical to one defined in SMPTE +170M/BT.601. The Y'CbCr quantization is full range. .. _col-adobergb: From 45d130d267d2ac7983ea43d26f100ae3916f003e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 4 Aug 2016 06:13:55 -0300 Subject: [PATCH 148/591] [media] pixfmt-007.rst: fix a messed up note in the DCI-P3 doc The text of the note included text that shouldn't have been part of the note. Move that out of the note into the proper place. [mchehab@s-opensource.com: fix a trivial merge conflict] Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-007.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index ab2fa3565fdd..28c57a28d219 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -573,15 +573,15 @@ Colorspace DCI-P3 (V4L2_COLORSPACE_DCI_P3) The :ref:`smpte431` standard defines the colorspace used by cinema projectors that use the DCI-P3 colorspace. The default transfer function is ``V4L2_XFER_FUNC_DCI_P3``. The default Y'CbCr encoding is -``V4L2_YCBCR_ENC_709``. +``V4L2_YCBCR_ENC_709``. The default Y'CbCr quantization is limited range. .. note:: - Note that this colorspace does not specify a + Note that this colorspace standard does not specify a Y'CbCr encoding since it is not meant to be encoded to Y'CbCr. So this - default Y'CbCr encoding was picked because it is the HDTV encoding. The - default Y'CbCr quantization is limited range. The chromaticities of the - primary colors and the white reference are: + default Y'CbCr encoding was picked because it is the HDTV encoding. + +The chromaticities of the primary colors and the white reference are: From 926605d05c9d5f9d43e17f0fc3dc906473325755 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 4 Aug 2016 06:15:41 -0300 Subject: [PATCH 149/591] [media] pixfmt-007.rst: fix copy-and-paste error in SMPTE-240M doc Instead of referring to Y', Cb and Cr, it referred to Yc', Cbc and Crc, which were accidentally copied from the BT.2020 constant luminance text. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-007.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index 28c57a28d219..f3e7f9e4c616 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -742,7 +742,7 @@ the following ``V4L2_YCBCR_ENC_SMPTE240M`` encoding: Cr = 0.5R' - 0.4451G' - 0.0549B' -Yc' is clamped to the range [0…1] and Cbc and Crc are clamped to the +Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range [-0.5…0.5]. The Y'CbCr quantization is limited range. From 95ad747e925299690c63bcc96c3f9bca640865bd Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 4 Aug 2016 19:00:22 -0300 Subject: [PATCH 150/591] [media] media: tw686x: Rework initial hardware configuration Currently, the hardware is not given a complete initial configuration. In order to fix this, this rather large commit reworks standard, frame format and input configuration. While at it, we introduce proper functions to configure each parameter, and as a result the code is a bit cleaner. Reported-by: Hans Verkuil Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw686x/tw686x-video.c | 139 ++++++++++++++---------- 1 file changed, 81 insertions(+), 58 deletions(-) diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index cdb16de770fe..be257d0257a6 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -672,30 +672,20 @@ static int tw686x_try_fmt_vid_cap(struct file *file, void *priv, return 0; } -static int tw686x_s_fmt_vid_cap(struct file *file, void *priv, - struct v4l2_format *f) +static int tw686x_set_format(struct tw686x_video_channel *vc, + unsigned int pixelformat, unsigned int width, + unsigned int height, bool realloc) { - struct tw686x_video_channel *vc = video_drvdata(file); struct tw686x_dev *dev = vc->dev; - u32 val, width, line_width, height; - unsigned long bitsperframe; + u32 val, dma_width, dma_height, dma_line_width; int err, pb; - if (vb2_is_busy(&vc->vidq)) - return -EBUSY; - - bitsperframe = vc->width * vc->height * vc->format->depth; - err = tw686x_try_fmt_vid_cap(file, priv, f); - if (err) - return err; - - vc->format = format_by_fourcc(f->fmt.pix.pixelformat); - vc->width = f->fmt.pix.width; - vc->height = f->fmt.pix.height; + vc->format = format_by_fourcc(pixelformat); + vc->width = width; + vc->height = height; /* We need new DMA buffers if the framesize has changed */ - if (dev->dma_ops->alloc && - bitsperframe != vc->width * vc->height * vc->format->depth) { + if (dev->dma_ops->alloc && realloc) { for (pb = 0; pb < 2; pb++) dev->dma_ops->free(vc, pb); @@ -739,14 +729,36 @@ static int tw686x_s_fmt_vid_cap(struct file *file, void *priv, reg_write(vc->dev, VDMA_CHANNEL_CONFIG[vc->ch], val); /* Program the DMA frame size */ - width = (vc->width * 2) & 0x7ff; - height = vc->height / 2; - line_width = (vc->width * 2) & 0x7ff; - val = (height << 22) | (line_width << 11) | width; + dma_width = (vc->width * 2) & 0x7ff; + dma_height = vc->height / 2; + dma_line_width = (vc->width * 2) & 0x7ff; + val = (dma_height << 22) | (dma_line_width << 11) | dma_width; reg_write(vc->dev, VDMA_WHP[vc->ch], val); return 0; } +static int tw686x_s_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct tw686x_video_channel *vc = video_drvdata(file); + unsigned long area; + bool realloc; + int err; + + if (vb2_is_busy(&vc->vidq)) + return -EBUSY; + + area = vc->width * vc->height; + err = tw686x_try_fmt_vid_cap(file, priv, f); + if (err) + return err; + + realloc = area != (f->fmt.pix.width * f->fmt.pix.height); + return tw686x_set_format(vc, f->fmt.pix.pixelformat, + f->fmt.pix.width, f->fmt.pix.height, + realloc); +} + static int tw686x_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { @@ -763,17 +775,9 @@ static int tw686x_querycap(struct file *file, void *priv, return 0; } -static int tw686x_s_std(struct file *file, void *priv, v4l2_std_id id) +static int tw686x_set_standard(struct tw686x_video_channel *vc, v4l2_std_id id) { - struct tw686x_video_channel *vc = video_drvdata(file); - struct v4l2_format f; - u32 val, ret; - - if (vc->video_standard == id) - return 0; - - if (vb2_is_busy(&vc->vidq)) - return -EBUSY; + u32 val; if (id & V4L2_STD_NTSC) val = 0; @@ -802,14 +806,31 @@ static int tw686x_s_std(struct file *file, void *priv, v4l2_std_id id) val |= (1 << (SYS_MODE_DMA_SHIFT + vc->ch)); reg_write(vc->dev, VIDEO_CONTROL1, val); + return 0; +} + +static int tw686x_s_std(struct file *file, void *priv, v4l2_std_id id) +{ + struct tw686x_video_channel *vc = video_drvdata(file); + struct v4l2_format f; + int ret; + + if (vc->video_standard == id) + return 0; + + if (vb2_is_busy(&vc->vidq)) + return -EBUSY; + + ret = tw686x_set_standard(vc, id); + if (ret) + return ret; /* * Adjust format after V4L2_STD_525_60/V4L2_STD_625_50 change, * calling g_fmt and s_fmt will sanitize the height * according to the standard. */ - ret = tw686x_g_fmt_vid_cap(file, priv, &f); - if (!ret) - tw686x_s_fmt_vid_cap(file, priv, &f); + tw686x_g_fmt_vid_cap(file, priv, &f); + tw686x_s_fmt_vid_cap(file, priv, &f); /* * Frame decimation depends on the chosen standard, @@ -928,10 +949,21 @@ static int tw686x_enum_fmt_vid_cap(struct file *file, void *priv, return 0; } +static void tw686x_set_input(struct tw686x_video_channel *vc, unsigned int i) +{ + u32 val; + + vc->input = i; + + val = reg_read(vc->dev, VDMA_CHANNEL_CONFIG[vc->ch]); + val &= ~(0x3 << 30); + val |= i << 30; + reg_write(vc->dev, VDMA_CHANNEL_CONFIG[vc->ch], val); +} + static int tw686x_s_input(struct file *file, void *priv, unsigned int i) { struct tw686x_video_channel *vc = video_drvdata(file); - u32 val; if (i >= TW686X_INPUTS_PER_CH) return -EINVAL; @@ -943,12 +975,7 @@ static int tw686x_s_input(struct file *file, void *priv, unsigned int i) if (vb2_is_busy(&vc->vidq)) return -EBUSY; - vc->input = i; - - val = reg_read(vc->dev, VDMA_CHANNEL_CONFIG[vc->ch]); - val &= ~(0x3 << 30); - val |= i << 30; - reg_write(vc->dev, VDMA_CHANNEL_CONFIG[vc->ch], val); + tw686x_set_input(vc, i); return 0; } @@ -1104,7 +1131,7 @@ void tw686x_video_free(struct tw686x_dev *dev) int tw686x_video_init(struct tw686x_dev *dev) { - unsigned int ch, val, pb; + unsigned int ch, val; int err; if (dev->dma_mode == TW686X_DMA_MODE_MEMCPY) @@ -1138,27 +1165,23 @@ int tw686x_video_init(struct tw686x_dev *dev) vc->ch = ch; /* default settings */ - vc->format = &formats[0]; - vc->video_standard = V4L2_STD_NTSC; - vc->width = TW686X_VIDEO_WIDTH; - vc->height = TW686X_VIDEO_HEIGHT(vc->video_standard); - vc->input = 0; + err = tw686x_set_standard(vc, V4L2_STD_NTSC); + if (err) + goto error; - reg_write(vc->dev, SDT[ch], 0); + err = tw686x_set_format(vc, formats[0].fourcc, + TW686X_VIDEO_WIDTH, + TW686X_VIDEO_HEIGHT(vc->video_standard), + true); + if (err) + goto error; + + tw686x_set_input(vc, 0); tw686x_set_framerate(vc, 30); - reg_write(dev, VDELAY_LO[ch], 0x14); reg_write(dev, HACTIVE_LO[ch], 0xd0); reg_write(dev, VIDEO_SIZE[ch], 0); - if (dev->dma_ops->alloc) { - for (pb = 0; pb < 2; pb++) { - err = dev->dma_ops->alloc(vc, pb); - if (err) - goto error; - } - } - vc->vidq.io_modes = VB2_READ | VB2_MMAP | VB2_DMABUF; vc->vidq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; vc->vidq.drv_priv = vc; From 4319233d79083ce8802f6af280954062c6e2e0fb Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 9 Aug 2016 13:03:55 -0300 Subject: [PATCH 151/591] [media] mtk-vcodec: constify venc_common_if structures The venc_common_if structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 2 +- drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c | 6 +++--- drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 6 +++--- drivers/media/platform/mtk-vcodec/venc_drv_if.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h index 94f0a425be42..b0cb3ed79585 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h @@ -240,7 +240,7 @@ struct mtk_vcodec_ctx { enum mtk_encode_param param_change; struct mtk_enc_params enc_params; - struct venc_common_if *enc_if; + const struct venc_common_if *enc_if; unsigned long drv_handle; int int_cond; diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c index 9a600525b3c1..532cd366eee7 100644 --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c @@ -664,16 +664,16 @@ static int h264_enc_deinit(unsigned long handle) return ret; } -static struct venc_common_if venc_h264_if = { +static const struct venc_common_if venc_h264_if = { h264_enc_init, h264_enc_encode, h264_enc_set_param, h264_enc_deinit, }; -struct venc_common_if *get_h264_enc_comm_if(void); +const struct venc_common_if *get_h264_enc_comm_if(void); -struct venc_common_if *get_h264_enc_comm_if(void) +const struct venc_common_if *get_h264_enc_comm_if(void) { return &venc_h264_if; } diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c index 60bbcd2a0510..bdf67808d0fe 100644 --- a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c @@ -471,16 +471,16 @@ static int vp8_enc_deinit(unsigned long handle) return ret; } -static struct venc_common_if venc_vp8_if = { +static const struct venc_common_if venc_vp8_if = { vp8_enc_init, vp8_enc_encode, vp8_enc_set_param, vp8_enc_deinit, }; -struct venc_common_if *get_vp8_enc_comm_if(void); +const struct venc_common_if *get_vp8_enc_comm_if(void); -struct venc_common_if *get_vp8_enc_comm_if(void) +const struct venc_common_if *get_vp8_enc_comm_if(void) { return &venc_vp8_if; } diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_if.c b/drivers/media/platform/mtk-vcodec/venc_drv_if.c index c4c83e7189c3..d02d5f1df279 100644 --- a/drivers/media/platform/mtk-vcodec/venc_drv_if.c +++ b/drivers/media/platform/mtk-vcodec/venc_drv_if.c @@ -26,8 +26,8 @@ #include "mtk_vcodec_enc_pm.h" #include "mtk_vpu.h" -struct venc_common_if *get_h264_enc_comm_if(void); -struct venc_common_if *get_vp8_enc_comm_if(void); +const struct venc_common_if *get_h264_enc_comm_if(void); +const struct venc_common_if *get_vp8_enc_comm_if(void); int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc) { From 20ff0166a52166c8a24eab54dac2523cf6010a6b Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:37 -0300 Subject: [PATCH 152/591] [media] media: dvb-frontends: rtl2832_sdr: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/rtl2832_sdr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c index 6e22af36b637..e038e886731b 100644 --- a/drivers/media/dvb-frontends/rtl2832_sdr.c +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c @@ -392,7 +392,6 @@ static int rtl2832_sdr_alloc_urbs(struct rtl2832_sdr_dev *dev) dev_dbg(&pdev->dev, "alloc urb=%d\n", i); dev->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); if (!dev->urb_list[i]) { - dev_dbg(&pdev->dev, "failed\n"); for (j = 0; j < i; j++) usb_free_urb(dev->urb_list[j]); return -ENOMEM; From 07d0320a86d63937ac13ab81b38949456ac2be0a Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:38 -0300 Subject: [PATCH 153/591] [media] media: radio: si470x: radio-si470x-usb: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/si470x/radio-si470x-usb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index 091d793f6583..4b132c29f290 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c @@ -627,7 +627,6 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, radio->int_in_urb = usb_alloc_urb(0, GFP_KERNEL); if (!radio->int_in_urb) { - dev_info(&intf->dev, "could not allocate int_in_urb"); retval = -ENOMEM; goto err_intbuffer; } From 15241919107ca2dee1edcd4d9ac3110205e580e7 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:39 -0300 Subject: [PATCH 154/591] [media] media: rc: imon: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/imon.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 65f80b8b9f7a..86cc70fe2534 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -2211,16 +2211,11 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf, goto exit; } rx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!rx_urb) { - dev_err(dev, "%s: usb_alloc_urb failed for IR urb", __func__); + if (!rx_urb) goto rx_urb_alloc_failed; - } tx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!tx_urb) { - dev_err(dev, "%s: usb_alloc_urb failed for display urb", - __func__); + if (!tx_urb) goto tx_urb_alloc_failed; - } mutex_init(&ictx->lock); spin_lock_init(&ictx->kc_lock); @@ -2305,10 +2300,8 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf, int ret = -ENOMEM; rx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!rx_urb) { - pr_err("usb_alloc_urb failed for IR urb\n"); + if (!rx_urb) goto rx_urb_alloc_failed; - } mutex_lock(&ictx->lock); From cd859c19d508e55a8f30c4db9551c6f8d634d9ef Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:40 -0300 Subject: [PATCH 155/591] [media] media: rc: redrat3: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/redrat3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 399f44d89a29..ec8016d9b009 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -970,10 +970,8 @@ static int redrat3_dev_probe(struct usb_interface *intf, /* set up bulk-in endpoint */ rr3->read_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!rr3->read_urb) { - dev_err(dev, "Read urb allocation failure\n"); + if (!rr3->read_urb) goto error; - } rr3->ep_in = ep_in; rr3->bulk_in_buf = usb_alloc_coherent(udev, From 80ae31974d31a3b8a8cc4cd0f12d47413d15aa5c Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:41 -0300 Subject: [PATCH 156/591] [media] media: usb: airspy: airspy: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/airspy/airspy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index fe031b06935f..3c556ee306cd 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c @@ -426,7 +426,6 @@ static int airspy_alloc_urbs(struct airspy *s) dev_dbg(s->dev, "alloc urb=%d\n", i); s->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); if (!s->urb_list[i]) { - dev_dbg(s->dev, "failed\n"); for (j = 0; j < i; j++) usb_free_urb(s->urb_list[j]); return -ENOMEM; From e291ec7b53556af8aedae6462b6fe00fbfea8537 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:42 -0300 Subject: [PATCH 157/591] [media] media: usb: as102: as102_usb_drv: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/as102/as102_usb_drv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/usb/as102/as102_usb_drv.c b/drivers/media/usb/as102/as102_usb_drv.c index 0e8030c071b8..68c3a80ce349 100644 --- a/drivers/media/usb/as102/as102_usb_drv.c +++ b/drivers/media/usb/as102/as102_usb_drv.c @@ -270,8 +270,6 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) urb = usb_alloc_urb(0, GFP_ATOMIC); if (urb == NULL) { - dev_dbg(&dev->bus_adap.usb_dev->dev, - "%s: usb_alloc_urb failed\n", __func__); as102_free_usb_stream_buffer(dev); return -ENOMEM; } From 26632658e87d29816bb443b2bebba1c995bbf910 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:43 -0300 Subject: [PATCH 158/591] [media] media: usb: au0828: au0828-video: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/au0828/au0828-video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index 82b026985868..13b8387082f2 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -245,7 +245,6 @@ static int au0828_init_isoc(struct au0828_dev *dev, int max_packets, for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { urb = usb_alloc_urb(max_packets, GFP_KERNEL); if (!urb) { - au0828_isocdbg("cannot alloc isoc_ctl.urb %i\n", i); au0828_uninit_isoc(dev); return -ENOMEM; } From fa460caf16805711a12c9897290962fed2b0ede9 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:44 -0300 Subject: [PATCH 159/591] [media] media: usb: cpia2: cpia2_usb: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cpia2/cpia2_usb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c index c1aa1ab2ece9..13620cdf0599 100644 --- a/drivers/media/usb/cpia2/cpia2_usb.c +++ b/drivers/media/usb/cpia2/cpia2_usb.c @@ -662,7 +662,6 @@ static int submit_urbs(struct camera_data *cam) } urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL); if (!urb) { - ERR("%s: usb_alloc_urb error!\n", __func__); for (j = 0; j < i; j++) usb_free_urb(cam->sbuf[j].urb); return -ENOMEM; From c86bc45d4185cf10d237956f8db5564ac160feb3 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:45 -0300 Subject: [PATCH 160/591] [media] media: usb: cx231xx: cx231xx-audio: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-audio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c index a6a9508418f8..4cd5fa91612f 100644 --- a/drivers/media/usb/cx231xx/cx231xx-audio.c +++ b/drivers/media/usb/cx231xx/cx231xx-audio.c @@ -293,7 +293,6 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) memset(dev->adev.transfer_buffer[i], 0x80, sb_size); urb = usb_alloc_urb(CX231XX_ISO_NUM_AUDIO_PACKETS, GFP_ATOMIC); if (!urb) { - dev_err(dev->dev, "usb_alloc_urb failed!\n"); for (j = 0; j < i; j++) { usb_free_urb(dev->adev.urb[j]); kfree(dev->adev.transfer_buffer[j]); @@ -355,7 +354,6 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev) memset(dev->adev.transfer_buffer[i], 0x80, sb_size); urb = usb_alloc_urb(CX231XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); if (!urb) { - dev_err(dev->dev, "usb_alloc_urb failed!\n"); for (j = 0; j < i; j++) { usb_free_urb(dev->adev.urb[j]); kfree(dev->adev.transfer_buffer[j]); From 0eca51b18339c94c6b6342e2b80d28cb33aaf342 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:46 -0300 Subject: [PATCH 161/591] [media] media: usb: cx231xx: cx231xx-core: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-core.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index 3e304bac3a70..7e4319172e46 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1054,8 +1054,6 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, for (i = 0; i < dev->video_mode.isoc_ctl.num_bufs; i++) { urb = usb_alloc_urb(max_packets, GFP_KERNEL); if (!urb) { - dev_err(dev->dev, - "cannot alloc isoc_ctl.urb %i\n", i); cx231xx_uninit_isoc(dev); return -ENOMEM; } @@ -1191,8 +1189,6 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets, for (i = 0; i < dev->video_mode.bulk_ctl.num_bufs; i++) { urb = usb_alloc_urb(0, GFP_KERNEL); if (!urb) { - dev_err(dev->dev, - "cannot alloc bulk_ctl.urb %i\n", i); cx231xx_uninit_bulk(dev); return -ENOMEM; } From 95bc112d795a2d118a2f08ce4034b19a60b62f3e Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:47 -0300 Subject: [PATCH 162/591] [media] media: usb: cx231xx: cx231xx-vbi: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-vbi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c b/drivers/media/usb/cx231xx/cx231xx-vbi.c index 15bb573b78ac..76e901920f6f 100644 --- a/drivers/media/usb/cx231xx/cx231xx-vbi.c +++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c @@ -442,8 +442,6 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, urb = usb_alloc_urb(0, GFP_KERNEL); if (!urb) { - dev_err(dev->dev, - "cannot alloc bulk_ctl.urb %i\n", i); cx231xx_uninit_vbi_isoc(dev); return -ENOMEM; } From abbde78f1d8218e343158a0d60da1eb7301c54e3 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:48 -0300 Subject: [PATCH 163/591] [media] media: usb: dvb-usb: dib0700_core: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dib0700_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index bf890c3d9cda..26797979ebce 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -783,10 +783,8 @@ int dib0700_rc_setup(struct dvb_usb_device *d, struct usb_interface *intf) /* Starting in firmware 1.20, the RC info is provided on a bulk pipe */ purb = usb_alloc_urb(0, GFP_KERNEL); - if (purb == NULL) { - err("rc usb alloc urb failed"); + if (purb == NULL) return -ENOMEM; - } purb->transfer_buffer = kzalloc(RC_MSG_SIZE_V1_20, GFP_KERNEL); if (purb->transfer_buffer == NULL) { From 6dabae400b7fed5cbe50fce6fbe30f086182ff6b Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:49 -0300 Subject: [PATCH 164/591] [media] media: usb: em28xx: em28xx-audio: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/em28xx/em28xx-audio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index 49a5f9532bd8..78f3687772bf 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -850,7 +850,6 @@ static int em28xx_audio_urb_init(struct em28xx *dev) urb = usb_alloc_urb(npackets, GFP_ATOMIC); if (!urb) { - em28xx_errdev("usb_alloc_urb failed!\n"); em28xx_audio_free_urb(dev); return -ENOMEM; } From ffcc82d8f56ec10caaaf9dd21aa3e275d7944e9d Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:50 -0300 Subject: [PATCH 165/591] [media] media: usb: em28xx: em28xx-core: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/em28xx/em28xx-core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index 37456079f490..eebd5d7088d0 100644 --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c @@ -934,7 +934,6 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk, for (i = 0; i < usb_bufs->num_bufs; i++) { urb = usb_alloc_urb(usb_bufs->num_packets, GFP_KERNEL); if (!urb) { - em28xx_err("cannot alloc usb_ctl.urb %i\n", i); em28xx_uninit_usb_xfer(dev, mode); return -ENOMEM; } From 60e3699946481eb10d7d8be1f28029649fc2c208 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:51 -0300 Subject: [PATCH 166/591] [media] media: usb: gspca: benq: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/benq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/gspca/benq.c b/drivers/media/usb/gspca/benq.c index 790baed33963..5fa67b78ad49 100644 --- a/drivers/media/usb/gspca/benq.c +++ b/drivers/media/usb/gspca/benq.c @@ -95,10 +95,8 @@ static int sd_start(struct gspca_dev *gspca_dev) #define SD_NPKT 32 for (n = 0; n < 4; n++) { urb = usb_alloc_urb(SD_NPKT, GFP_KERNEL); - if (!urb) { - pr_err("usb_alloc_urb failed\n"); + if (!urb) return -ENOMEM; - } gspca_dev->urb[n] = urb; urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev, SD_PKT_SZ * SD_NPKT, From 452b53f7f844d3fe9e9484fa16f7ebbe1e9b8c27 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:52 -0300 Subject: [PATCH 167/591] [media] media: usb: gspca: gspca: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/gspca.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c index b17bd7ebcb47..af2395a76d8b 100644 --- a/drivers/media/usb/gspca/gspca.c +++ b/drivers/media/usb/gspca/gspca.c @@ -795,10 +795,8 @@ static int create_urbs(struct gspca_dev *gspca_dev, for (n = 0; n < nurbs; n++) { urb = usb_alloc_urb(npkt, GFP_KERNEL); - if (!urb) { - pr_err("usb_alloc_urb failed\n"); + if (!urb) return -ENOMEM; - } gspca_dev->urb[n] = urb; urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev, bsize, From de46bfab79a372ccec8d32947b5fab9a2a10e801 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:53 -0300 Subject: [PATCH 168/591] [media] media: usb: gspca: konica: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/konica.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c index 0712b1bc90b4..40aaaa9c5f30 100644 --- a/drivers/media/usb/gspca/konica.c +++ b/drivers/media/usb/gspca/konica.c @@ -208,10 +208,8 @@ static int sd_start(struct gspca_dev *gspca_dev) packet_size = le16_to_cpu(alt->endpoint[i].desc.wMaxPacketSize); urb = usb_alloc_urb(SD_NPKT, GFP_KERNEL); - if (!urb) { - pr_err("usb_alloc_urb failed\n"); + if (!urb) return -ENOMEM; - } gspca_dev->urb[n] = urb; urb->transfer_buffer = usb_alloc_coherent(gspca_dev->dev, packet_size * SD_NPKT, From 1e55ef9689598787ed845a9970f238dfd473bf4e Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:54 -0300 Subject: [PATCH 169/591] [media] media: usb: hackrf: hackrf: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/hackrf/hackrf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index b1e229a44192..c2c8d12e9498 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c @@ -691,7 +691,6 @@ static int hackrf_alloc_urbs(struct hackrf_dev *dev, bool rcv) dev_dbg(dev->dev, "alloc urb=%d\n", i); dev->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); if (!dev->urb_list[i]) { - dev_dbg(dev->dev, "failed\n"); for (j = 0; j < i; j++) usb_free_urb(dev->urb_list[j]); return -ENOMEM; From 551f9d4655bc2b952c2b00879b706b668bc26816 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:55 -0300 Subject: [PATCH 170/591] [media] media: usb: hdpvr: hdpvr-video: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/hdpvr/hdpvr-video.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 2a3a8b470555..6d43d75493ea 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -155,10 +155,8 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count) buf->dev = dev; urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) { - v4l2_err(&dev->v4l2_dev, "cannot allocate urb\n"); + if (!urb) goto exit_urb; - } buf->urb = urb; mem = usb_alloc_coherent(dev->udev, dev->bulk_in_size, GFP_KERNEL, From 32dcb745ef750e38c60b9b6bbd74b95ae12e3f00 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:56 -0300 Subject: [PATCH 171/591] [media] media: usb: msi2500: msi2500: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/msi2500/msi2500.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c index e7f167d44c61..367eb7e2a31d 100644 --- a/drivers/media/usb/msi2500/msi2500.c +++ b/drivers/media/usb/msi2500/msi2500.c @@ -509,7 +509,6 @@ static int msi2500_isoc_init(struct msi2500_dev *dev) for (i = 0; i < MAX_ISO_BUFS; i++) { urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL); if (urb == NULL) { - dev_err(dev->dev, "Failed to allocate urb %d\n", i); msi2500_isoc_cleanup(dev); return -ENOMEM; } From 59b5d2497e2ffe11ef0c45f80ad693d9347daf9d Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:57 -0300 Subject: [PATCH 172/591] [media] media: usb: pwc: pwc-if: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/pwc/pwc-if.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index b51b27a3fd61..c4454c928776 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c @@ -410,7 +410,6 @@ retry: for (i = 0; i < MAX_ISO_BUFS; i++) { urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL); if (urb == NULL) { - PWC_ERROR("Failed to allocate urb %d\n", i); pwc_isoc_cleanup(pdev); return -ENOMEM; } From fc56da79930b1348a5aaed8fbeba0a279fd7b586 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:58 -0300 Subject: [PATCH 173/591] [media] media: usb: s2255: s2255drv: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/s2255/s2255drv.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 43ba71a7d02b..9458eb0ef66f 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -2113,11 +2113,8 @@ static int s2255_start_readpipe(struct s2255_dev *dev) pipe_info->state = 1; pipe_info->err_count = 0; pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!pipe_info->stream_urb) { - dev_err(&dev->udev->dev, - "ReadStream: Unable to alloc URB\n"); + if (!pipe_info->stream_urb) return -ENOMEM; - } /* transfer buffer allocated in board_init */ usb_fill_bulk_urb(pipe_info->stream_urb, dev->udev, pipe, @@ -2290,10 +2287,8 @@ static int s2255_probe(struct usb_interface *interface, } dev->fw_data->fw_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!dev->fw_data->fw_urb) { - dev_err(&interface->dev, "out of memory!\n"); + if (!dev->fw_data->fw_urb) goto errorFWURB; - } dev->fw_data->pfw_data = kzalloc(CHUNK_SIZE, GFP_KERNEL); if (!dev->fw_data->pfw_data) { From 9d849287d512ffbe01cdd0da9c4c1e468f7f72d8 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:03:59 -0300 Subject: [PATCH 174/591] [media] media: usb: stk1160: stk1160-video: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/stk1160/stk1160-video.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c index 6ecb0b48423f..ce8ebbe395a6 100644 --- a/drivers/media/usb/stk1160/stk1160-video.c +++ b/drivers/media/usb/stk1160/stk1160-video.c @@ -457,10 +457,8 @@ int stk1160_alloc_isoc(struct stk1160 *dev) for (i = 0; i < num_bufs; i++) { urb = usb_alloc_urb(max_packets, GFP_KERNEL); - if (!urb) { - stk1160_err("cannot alloc urb[%d]\n", i); + if (!urb) goto free_i_bufs; - } dev->isoc_ctl.urb[i] = urb; #ifndef CONFIG_DMA_NONCOHERENT From 2685b1d1d1cdd005c0c553632c4bf48d8b483722 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:04:00 -0300 Subject: [PATCH 175/591] [media] media: usb: stkwebcam: stk-webcam: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/stkwebcam/stk-webcam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index c21c4c004f97..db200c9d796d 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -452,10 +452,8 @@ static int stk_prepare_iso(struct stk_camera *dev) STK_ERROR("isobuf data already allocated\n"); if (dev->isobufs[i].urb == NULL) { urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL); - if (urb == NULL) { - STK_ERROR("Failed to allocate URB %d\n", i); + if (urb == NULL) goto isobufs_out; - } dev->isobufs[i].urb = urb; } else { STK_ERROR("Killing URB\n"); From b7eca8d43c6ea7054dd8f412158c7e465610d424 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:04:01 -0300 Subject: [PATCH 176/591] [media] media: usb: tm6000: tm6000-dvb: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/tm6000/tm6000-dvb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c index 095f5db1a790..0426b210383b 100644 --- a/drivers/media/usb/tm6000/tm6000-dvb.c +++ b/drivers/media/usb/tm6000/tm6000-dvb.c @@ -129,10 +129,8 @@ static int tm6000_start_stream(struct tm6000_core *dev) } dvb->bulk_urb = usb_alloc_urb(0, GFP_KERNEL); - if (dvb->bulk_urb == NULL) { - printk(KERN_ERR "tm6000: couldn't allocate urb\n"); + if (dvb->bulk_urb == NULL) return -ENOMEM; - } pipe = usb_rcvbulkpipe(dev->udev, dev->bulk_in.endp->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); From 7c240e8c0f029402b2a9948d7071cf1633bdea99 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:04:02 -0300 Subject: [PATCH 177/591] [media] media: usb: tm6000: tm6000-video: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/tm6000/tm6000-video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c index fa5e8bda2ae4..dee7e7d3d47d 100644 --- a/drivers/media/usb/tm6000/tm6000-video.c +++ b/drivers/media/usb/tm6000/tm6000-video.c @@ -635,7 +635,6 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev) for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { urb = usb_alloc_urb(max_packets, GFP_KERNEL); if (!urb) { - tm6000_err("cannot alloc isoc_ctl.urb %i\n", i); tm6000_uninit_isoc(dev); usb_free_urb(urb); return -ENOMEM; From aab74635045bba4624c2e3cb6953c45ac5953a91 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:04:03 -0300 Subject: [PATCH 178/591] [media] media: usb: usbvision: usbvision-core: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/usbvision/usbvision-core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c index 52ac4391582c..c23bf73a68ea 100644 --- a/drivers/media/usb/usbvision/usbvision-core.c +++ b/drivers/media/usb/usbvision/usbvision-core.c @@ -2303,11 +2303,8 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) struct urb *urb; urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); - if (urb == NULL) { - dev_err(&usbvision->dev->dev, - "%s: usb_alloc_urb() failed\n", __func__); + if (urb == NULL) return -ENOMEM; - } usbvision->sbuf[buf_idx].urb = urb; usbvision->sbuf[buf_idx].data = usb_alloc_coherent(usbvision->dev, From 50d286470cd5dd6a855a34b099dbed85b58688ed Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:04:04 -0300 Subject: [PATCH 179/591] [media] media: usb: zr364xx: zr364xx: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/zr364xx/zr364xx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c index 7433ba5c4bad..cc128db85723 100644 --- a/drivers/media/usb/zr364xx/zr364xx.c +++ b/drivers/media/usb/zr364xx/zr364xx.c @@ -1045,10 +1045,8 @@ static int zr364xx_start_readpipe(struct zr364xx_camera *cam) pipe_info->state = 1; pipe_info->err_count = 0; pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!pipe_info->stream_urb) { - dev_err(&cam->udev->dev, "ReadStream: Unable to alloc URB\n"); + if (!pipe_info->stream_urb) return -ENOMEM; - } /* transfer buffer allocated in board_init */ usb_fill_bulk_urb(pipe_info->stream_urb, cam->udev, pipe, From 29a3006e5209b5dde2d370b8de1e8c18c14040e7 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sat, 16 Jul 2016 05:32:34 -0300 Subject: [PATCH 180/591] [media] pvrusb2: Remove deprecated create_singlethread_workqueue The workqueue "workqueue" is involved in polling the pvrusb2 hardware (pvr2_hdw). It has a single work item(&hdw->workpoll) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in pvr2_hdw_destroy to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/usb/pvrusb2/pvrusb2-hdw-internal.h | 1 - drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 23 ++++++------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/usb/pvrusb2/pvrusb2-hdw-internal.h index 60141b16d731..23473a21319c 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw-internal.h @@ -170,7 +170,6 @@ struct pvr2_hdw { const struct pvr2_device_desc *hdw_desc; /* Kernel worker thread handling */ - struct workqueue_struct *workqueue; struct work_struct workpoll; /* Update driver state */ /* Video spigot */ diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index fe20fe4f2330..1eb4f7ba2967 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2624,7 +2624,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, if (cnt1 >= sizeof(hdw->name)) cnt1 = sizeof(hdw->name)-1; hdw->name[cnt1] = 0; - hdw->workqueue = create_singlethread_workqueue(hdw->name); INIT_WORK(&hdw->workpoll,pvr2_hdw_worker_poll); pvr2_trace(PVR2_TRACE_INIT,"Driver unit number is %d, name is %s", @@ -2651,11 +2650,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, del_timer_sync(&hdw->decoder_stabilization_timer); del_timer_sync(&hdw->encoder_run_timer); del_timer_sync(&hdw->encoder_wait_timer); - if (hdw->workqueue) { - flush_workqueue(hdw->workqueue); - destroy_workqueue(hdw->workqueue); - hdw->workqueue = NULL; - } + flush_work(&hdw->workpoll); usb_free_urb(hdw->ctl_read_urb); usb_free_urb(hdw->ctl_write_urb); kfree(hdw->ctl_read_buffer); @@ -2712,11 +2707,7 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw) { if (!hdw) return; pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_destroy: hdw=%p",hdw); - if (hdw->workqueue) { - flush_workqueue(hdw->workqueue); - destroy_workqueue(hdw->workqueue); - hdw->workqueue = NULL; - } + flush_work(&hdw->workpoll); del_timer_sync(&hdw->quiescent_timer); del_timer_sync(&hdw->decoder_stabilization_timer); del_timer_sync(&hdw->encoder_run_timer); @@ -4443,7 +4434,7 @@ static void pvr2_hdw_quiescent_timeout(unsigned long data) hdw->state_decoder_quiescent = !0; trace_stbit("state_decoder_quiescent",hdw->state_decoder_quiescent); hdw->state_stale = !0; - queue_work(hdw->workqueue,&hdw->workpoll); + schedule_work(&hdw->workpoll); } @@ -4454,7 +4445,7 @@ static void pvr2_hdw_decoder_stabilization_timeout(unsigned long data) hdw->state_decoder_ready = !0; trace_stbit("state_decoder_ready", hdw->state_decoder_ready); hdw->state_stale = !0; - queue_work(hdw->workqueue, &hdw->workpoll); + schedule_work(&hdw->workpoll); } @@ -4465,7 +4456,7 @@ static void pvr2_hdw_encoder_wait_timeout(unsigned long data) hdw->state_encoder_waitok = !0; trace_stbit("state_encoder_waitok",hdw->state_encoder_waitok); hdw->state_stale = !0; - queue_work(hdw->workqueue,&hdw->workpoll); + schedule_work(&hdw->workpoll); } @@ -4477,7 +4468,7 @@ static void pvr2_hdw_encoder_run_timeout(unsigned long data) hdw->state_encoder_runok = !0; trace_stbit("state_encoder_runok",hdw->state_encoder_runok); hdw->state_stale = !0; - queue_work(hdw->workqueue,&hdw->workpoll); + schedule_work(&hdw->workpoll); } } @@ -4991,7 +4982,7 @@ static void pvr2_hdw_state_sched(struct pvr2_hdw *hdw) if (hdw->state_stale) return; hdw->state_stale = !0; trace_stbit("state_stale",hdw->state_stale); - queue_work(hdw->workqueue,&hdw->workpoll); + schedule_work(&hdw->workpoll); } From c994be4a7c8471b950ed9baf4558ff488b127ec8 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sat, 16 Jul 2016 05:50:28 -0300 Subject: [PATCH 181/591] [media] gspca: sonixj: Remove deprecated create_singlethread_workqueue The workqueue "work_thread" is involved in updating the JPEG quality of the gspca_dev. It has a single work item(&sd->work) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in sd_stop0() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/sonixj.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/gspca/sonixj.c b/drivers/media/usb/gspca/sonixj.c index fd1c8706d86a..d49d76ec1421 100644 --- a/drivers/media/usb/gspca/sonixj.c +++ b/drivers/media/usb/gspca/sonixj.c @@ -54,7 +54,6 @@ struct sd { u32 exposure; struct work_struct work; - struct workqueue_struct *work_thread; u32 pktsz; /* (used by pkt_scan) */ u16 npkt; @@ -2485,7 +2484,6 @@ static int sd_start(struct gspca_dev *gspca_dev) sd->pktsz = sd->npkt = 0; sd->nchg = sd->short_mark = 0; - sd->work_thread = create_singlethread_workqueue(MODULE_NAME); return gspca_dev->usb_err; } @@ -2569,12 +2567,9 @@ static void sd_stop0(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - if (sd->work_thread != NULL) { - mutex_unlock(&gspca_dev->usb_lock); - destroy_workqueue(sd->work_thread); - mutex_lock(&gspca_dev->usb_lock); - sd->work_thread = NULL; - } + mutex_unlock(&gspca_dev->usb_lock); + flush_work(&sd->work); + mutex_lock(&gspca_dev->usb_lock); } static void do_autogain(struct gspca_dev *gspca_dev) @@ -2785,7 +2780,7 @@ marker_found: new_qual = QUALITY_MAX; if (new_qual != sd->quality) { sd->quality = new_qual; - queue_work(sd->work_thread, &sd->work); + schedule_work(&sd->work); } } } else { From 9570508386eeb192d3803a1ae4be16870f40a57f Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sat, 16 Jul 2016 05:52:19 -0300 Subject: [PATCH 182/591] [media] gspca: vicam: Remove deprecated create_singlethread_workqueue The workqueue "work_thread" is involved in streaming the camera data. It has a single work item(&sd->work_struct) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in sd_stop0() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/vicam.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/gspca/vicam.c b/drivers/media/usb/gspca/vicam.c index 103f6c4236b0..8860510c2f9c 100644 --- a/drivers/media/usb/gspca/vicam.c +++ b/drivers/media/usb/gspca/vicam.c @@ -47,7 +47,6 @@ MODULE_FIRMWARE(VICAM_FIRMWARE); struct sd { struct gspca_dev gspca_dev; /* !! must be the first item */ struct work_struct work_struct; - struct workqueue_struct *work_thread; }; /* The vicam sensor has a resolution of 512 x 244, with I believe square @@ -278,9 +277,7 @@ static int sd_start(struct gspca_dev *gspca_dev) if (ret < 0) return ret; - /* Start the workqueue function to do the streaming */ - sd->work_thread = create_singlethread_workqueue(MODULE_NAME); - queue_work(sd->work_thread, &sd->work_struct); + schedule_work(&sd->work_struct); return 0; } @@ -294,8 +291,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev) /* wait for the work queue to terminate */ mutex_unlock(&gspca_dev->usb_lock); /* This waits for vicam_dostream to finish */ - destroy_workqueue(dev->work_thread); - dev->work_thread = NULL; + flush_work(&dev->work_struct); mutex_lock(&gspca_dev->usb_lock); if (gspca_dev->present) From e59646895778f1e645b4e2f02d99aaec7a144ce1 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sat, 16 Jul 2016 05:53:48 -0300 Subject: [PATCH 183/591] [media] gspca: jl2005bcd: Remove deprecated create_singlethread_workqueue The workqueue "work_thread" is involved in streaming the camera data. It has a single work item(&sd->work_struct) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in sd_stop0() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/jl2005bcd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/gspca/jl2005bcd.c b/drivers/media/usb/gspca/jl2005bcd.c index 5b481fa43099..ac295f04bd18 100644 --- a/drivers/media/usb/gspca/jl2005bcd.c +++ b/drivers/media/usb/gspca/jl2005bcd.c @@ -45,7 +45,6 @@ struct sd { const struct v4l2_pix_format *cap_mode; /* Driver stuff */ struct work_struct work_struct; - struct workqueue_struct *work_thread; u8 frame_brightness; int block_size; /* block size of camera */ int vga; /* 1 if vga cam, 0 if cif cam */ @@ -477,9 +476,7 @@ static int sd_start(struct gspca_dev *gspca_dev) return -1; } - /* Start the workqueue function to do the streaming */ - sd->work_thread = create_singlethread_workqueue(MODULE_NAME); - queue_work(sd->work_thread, &sd->work_struct); + schedule_work(&sd->work_struct); return 0; } @@ -493,8 +490,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev) /* wait for the work queue to terminate */ mutex_unlock(&gspca_dev->usb_lock); /* This waits for sq905c_dostream to finish */ - destroy_workqueue(dev->work_thread); - dev->work_thread = NULL; + flush_work(&dev->work_struct); mutex_lock(&gspca_dev->usb_lock); } From 53eebd84c3ac2a81da94535594dba6ff637311dd Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sat, 16 Jul 2016 05:55:56 -0300 Subject: [PATCH 184/591] [media] gspca: finepix: Remove deprecated create_singlethread_workqueue The workqueue "work_thread" is involved in streaming the camera data. It has a single work item(&dev->work_struct) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Work item has been flushed in sd_stop0() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Acked-by: Frank Zago Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/finepix.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/gspca/finepix.c b/drivers/media/usb/gspca/finepix.c index 52bdb569760b..ae9a55d7bbbb 100644 --- a/drivers/media/usb/gspca/finepix.c +++ b/drivers/media/usb/gspca/finepix.c @@ -41,7 +41,6 @@ struct usb_fpix { struct gspca_dev gspca_dev; /* !! must be the first item */ struct work_struct work_struct; - struct workqueue_struct *work_thread; }; /* Delay after which claim the next frame. If the delay is too small, @@ -226,9 +225,7 @@ static int sd_start(struct gspca_dev *gspca_dev) /* Again, reset bulk in endpoint */ usb_clear_halt(gspca_dev->dev, gspca_dev->urb[0]->pipe); - /* Start the workqueue function to do the streaming */ - dev->work_thread = create_singlethread_workqueue(MODULE_NAME); - queue_work(dev->work_thread, &dev->work_struct); + schedule_work(&dev->work_struct); return 0; } @@ -241,9 +238,8 @@ static void sd_stop0(struct gspca_dev *gspca_dev) /* wait for the work queue to terminate */ mutex_unlock(&gspca_dev->usb_lock); - destroy_workqueue(dev->work_thread); + flush_work(&dev->work_struct); mutex_lock(&gspca_dev->usb_lock); - dev->work_thread = NULL; } /* Table of supported USB devices */ From 969ac39e3df0f76fdb534efc7060c77f22fb5ac5 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sat, 16 Jul 2016 08:04:41 -0300 Subject: [PATCH 185/591] [media] ad9389b: Remove deprecated create_singlethread_workqueue The workqueue work_queue is involved in EDID (Extended Display Identification Data) handling. It has a single work item(&state->edid_handler) and hence doesn't require ordering. It is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. &state->edid_handler is a self requeueing work item and it has been been sync cancelled in ad9389b_remove() to ensure that nothing is pending when the driver is disconnected. The unused label err_unreg has also been dropped. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ad9389b.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c index 0462f461e679..5fd23507c6d8 100644 --- a/drivers/media/i2c/ad9389b.c +++ b/drivers/media/i2c/ad9389b.c @@ -98,7 +98,6 @@ struct ad9389b_state { struct ad9389b_state_edid edid; /* Running counter of the number of detected EDIDs (for debugging) */ unsigned edid_detect_counter; - struct workqueue_struct *work_queue; struct delayed_work edid_handler; /* work entry */ }; @@ -843,8 +842,7 @@ static void ad9389b_edid_handler(struct work_struct *work) v4l2_dbg(1, debug, sd, "%s: edid read failed\n", __func__); ad9389b_s_power(sd, false); ad9389b_s_power(sd, true); - queue_delayed_work(state->work_queue, - &state->edid_handler, EDID_DELAY); + schedule_delayed_work(&state->edid_handler, EDID_DELAY); return; } } @@ -933,8 +931,7 @@ static void ad9389b_update_monitor_present_status(struct v4l2_subdev *sd) ad9389b_setup(sd); ad9389b_notify_monitor_detect(sd); state->edid.read_retries = EDID_MAX_RETRIES; - queue_delayed_work(state->work_queue, - &state->edid_handler, EDID_DELAY); + schedule_delayed_work(&state->edid_handler, EDID_DELAY); } else if (!(status & MASK_AD9389B_HPD_DETECT)) { v4l2_dbg(1, debug, sd, "%s: hotplug not detected\n", __func__); state->have_monitor = false; @@ -1065,8 +1062,7 @@ static bool ad9389b_check_edid_status(struct v4l2_subdev *sd) ad9389b_wr(sd, 0xc9, 0xf); ad9389b_wr(sd, 0xc4, state->edid.segments); state->edid.read_retries = EDID_MAX_RETRIES; - queue_delayed_work(state->work_queue, - &state->edid_handler, EDID_DELAY); + schedule_delayed_work(&state->edid_handler, EDID_DELAY); return false; } @@ -1170,13 +1166,6 @@ static int ad9389b_probe(struct i2c_client *client, const struct i2c_device_id * goto err_entity; } - state->work_queue = create_singlethread_workqueue(sd->name); - if (state->work_queue == NULL) { - v4l2_err(sd, "could not create workqueue\n"); - err = -ENOMEM; - goto err_unreg; - } - INIT_DELAYED_WORK(&state->edid_handler, ad9389b_edid_handler); state->dv_timings = dv1080p60; @@ -1187,8 +1176,6 @@ static int ad9389b_probe(struct i2c_client *client, const struct i2c_device_id * client->addr << 1, client->adapter->name); return 0; -err_unreg: - i2c_unregister_device(state->edid_i2c_client); err_entity: media_entity_cleanup(&sd->entity); err_hdl: @@ -1211,9 +1198,8 @@ static int ad9389b_remove(struct i2c_client *client) ad9389b_s_stream(sd, false); ad9389b_s_audio_stream(sd, false); ad9389b_init_setup(sd); - cancel_delayed_work(&state->edid_handler); + cancel_delayed_work_sync(&state->edid_handler); i2c_unregister_device(state->edid_i2c_client); - destroy_workqueue(state->work_queue); v4l2_device_unregister_subdev(sd); media_entity_cleanup(&sd->entity); v4l2_ctrl_handler_free(sd->ctrl_handler); From 605a74e62809396cfcb786934f12be84a0da2282 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 17 Jul 2016 06:03:15 -0300 Subject: [PATCH 186/591] [media] cobalt: support reduced fps Add support for reduced fps (i.e. 59.94 Hz instead of 60 Hz) for the HDMI output. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cobalt/cobalt-v4l2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c b/drivers/media/pci/cobalt/cobalt-v4l2.c index d05672fe9ff9..5c76637900d0 100644 --- a/drivers/media/pci/cobalt/cobalt-v4l2.c +++ b/drivers/media/pci/cobalt/cobalt-v4l2.c @@ -161,8 +161,11 @@ static void cobalt_enable_output(struct cobalt_stream *s) struct v4l2_subdev_format sd_fmt = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, }; + u64 clk = bt->pixelclock; - if (!cobalt_cpld_set_freq(cobalt, bt->pixelclock)) { + if (bt->flags & V4L2_DV_FL_REDUCED_FPS) + clk = div_u64(clk * 1000ULL, 1001); + if (!cobalt_cpld_set_freq(cobalt, clk)) { cobalt_err("pixelclock out of range\n"); return; } @@ -644,7 +647,7 @@ static int cobalt_s_dv_timings(struct file *file, void *priv_fh, return 0; } - if (v4l2_match_dv_timings(timings, &s->timings, 0, false)) + if (v4l2_match_dv_timings(timings, &s->timings, 0, true)) return 0; if (vb2_is_busy(&s->q)) From d8eddb15e4e436ec44464783687f0057a38fb013 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sun, 17 Jul 2016 17:52:49 -0300 Subject: [PATCH 187/591] [media] cec: Delete an unnecessary check before the function call "rc_free_device" The rc_free_device() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/cec/cec-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/media/cec/cec-core.c b/drivers/staging/media/cec/cec-core.c index 112a5fae12f5..80fcb692f4f5 100644 --- a/drivers/staging/media/cec/cec-core.c +++ b/drivers/staging/media/cec/cec-core.c @@ -354,8 +354,7 @@ void cec_delete_adapter(struct cec_adapter *adap) if (adap->kthread_config) kthread_stop(adap->kthread_config); #if IS_REACHABLE(CONFIG_RC_CORE) - if (adap->rc) - rc_free_device(adap->rc); + rc_free_device(adap->rc); #endif kfree(adap); } From fe094dad25ec28585a591db823c768af2b2be1f4 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Tue, 19 Jul 2016 14:54:16 -0300 Subject: [PATCH 188/591] [media] v4l2-common: Delete an unnecessary check before the function call "spi_unregister_device" The spi_unregister_device() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 5b808500e7e7..57cfe26a393f 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -291,7 +291,7 @@ struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, error: /* If we have a client but no subdev, then something went wrong and we must unregister the client. */ - if (spi && sd == NULL) + if (!sd) spi_unregister_device(spi); return sd; From c6e4b8c1d3a81a2611e0a045f1c1e34ad3fb092e Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Tue, 19 Jul 2016 16:24:26 -0300 Subject: [PATCH 189/591] [media] tw686x: Delete an unnecessary check before the function call "video_unregister_device" The video_unregister_device() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw686x/tw686x-video.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index be257d0257a6..24a813256c99 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -1120,8 +1120,7 @@ void tw686x_video_free(struct tw686x_dev *dev) for (ch = 0; ch < max_channels(dev); ch++) { struct tw686x_video_channel *vc = &dev->video_channels[ch]; - if (vc->device) - video_unregister_device(vc->device); + video_unregister_device(vc->device); if (dev->dma_ops->free) for (pb = 0; pb < 2; pb++) From ce5d6290df665bc4931ad01c38bbd4431318eec3 Mon Sep 17 00:00:00 2001 From: Steve Longerbeam Date: Tue, 19 Jul 2016 21:03:30 -0300 Subject: [PATCH 190/591] [media] media: adv7180: define more registers Replace hard-coded addresses with new register macro defines. No functional changes. Signed-off-by: Steve Longerbeam Acked-by: Lars-Peter Clausen Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv7180.c | 73 +++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 95cbc857f36e..cb83ebbe5131 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -56,10 +56,11 @@ #define ADV7182_REG_INPUT_VIDSEL 0x0002 +#define ADV7180_REG_OUTPUT_CONTROL 0x0003 #define ADV7180_REG_EXTENDED_OUTPUT_CONTROL 0x0004 #define ADV7180_EXTENDED_OUTPUT_CONTROL_NTSCDIS 0xC5 -#define ADV7180_REG_AUTODETECT_ENABLE 0x07 +#define ADV7180_REG_AUTODETECT_ENABLE 0x0007 #define ADV7180_AUTODETECT_DEFAULT 0x7f /* Contrast */ #define ADV7180_REG_CON 0x0008 /*Unsigned */ @@ -100,6 +101,20 @@ #define ADV7180_REG_IDENT 0x0011 #define ADV7180_ID_7180 0x18 +#define ADV7180_REG_STATUS3 0x0013 +#define ADV7180_REG_ANALOG_CLAMP_CTL 0x0014 +#define ADV7180_REG_SHAP_FILTER_CTL_1 0x0017 +#define ADV7180_REG_CTRL_2 0x001d +#define ADV7180_REG_VSYNC_FIELD_CTL_1 0x0031 +#define ADV7180_REG_MANUAL_WIN_CTL_1 0x003d +#define ADV7180_REG_MANUAL_WIN_CTL_2 0x003e +#define ADV7180_REG_MANUAL_WIN_CTL_3 0x003f +#define ADV7180_REG_LOCK_CNT 0x0051 +#define ADV7180_REG_CVBS_TRIM 0x0052 +#define ADV7180_REG_CLAMP_ADJ 0x005a +#define ADV7180_REG_RES_CIR 0x005f +#define ADV7180_REG_DIFF_MODE 0x0060 + #define ADV7180_REG_ICONF1 0x2040 #define ADV7180_ICONF1_ACTIVE_LOW 0x01 #define ADV7180_ICONF1_PSYNC_ONLY 0x10 @@ -129,9 +144,15 @@ #define ADV7180_REG_VPP_SLAVE_ADDR 0xFD #define ADV7180_REG_CSI_SLAVE_ADDR 0xFE -#define ADV7180_REG_FLCONTROL 0x40e0 +#define ADV7180_REG_ACE_CTRL1 0x4080 +#define ADV7180_REG_ACE_CTRL5 0x4084 +#define ADV7180_REG_FLCONTROL 0x40e0 #define ADV7180_FLCONTROL_FL_ENABLE 0x1 +#define ADV7180_REG_RST_CLAMP 0x809c +#define ADV7180_REG_AGC_ADJ1 0x80b6 +#define ADV7180_REG_AGC_ADJ2 0x80c0 + #define ADV7180_CSI_REG_PWRDN 0x00 #define ADV7180_CSI_PWRDN 0x80 @@ -886,16 +907,20 @@ static int adv7182_init(struct adv7180_state *state) /* ADI required writes */ if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) { - adv7180_write(state, 0x0003, 0x4e); - adv7180_write(state, 0x0004, 0x57); - adv7180_write(state, 0x001d, 0xc0); + adv7180_write(state, ADV7180_REG_OUTPUT_CONTROL, 0x4e); + adv7180_write(state, ADV7180_REG_EXTENDED_OUTPUT_CONTROL, 0x57); + adv7180_write(state, ADV7180_REG_CTRL_2, 0xc0); } else { if (state->chip_info->flags & ADV7180_FLAG_V2) - adv7180_write(state, 0x0004, 0x17); + adv7180_write(state, + ADV7180_REG_EXTENDED_OUTPUT_CONTROL, + 0x17); else - adv7180_write(state, 0x0004, 0x07); - adv7180_write(state, 0x0003, 0x0c); - adv7180_write(state, 0x001d, 0x40); + adv7180_write(state, + ADV7180_REG_EXTENDED_OUTPUT_CONTROL, + 0x07); + adv7180_write(state, ADV7180_REG_OUTPUT_CONTROL, 0x0c); + adv7180_write(state, ADV7180_REG_CTRL_2, 0x40); } adv7180_write(state, 0x0013, 0x00); @@ -972,8 +997,8 @@ static int adv7182_select_input(struct adv7180_state *state, unsigned int input) return ret; /* Reset clamp circuitry - ADI recommended writes */ - adv7180_write(state, 0x809c, 0x00); - adv7180_write(state, 0x809c, 0xff); + adv7180_write(state, ADV7180_REG_RST_CLAMP, 0x00); + adv7180_write(state, ADV7180_REG_RST_CLAMP, 0xff); input_type = adv7182_get_input_type(input); @@ -981,10 +1006,10 @@ static int adv7182_select_input(struct adv7180_state *state, unsigned int input) case ADV7182_INPUT_TYPE_CVBS: case ADV7182_INPUT_TYPE_DIFF_CVBS: /* ADI recommends to use the SH1 filter */ - adv7180_write(state, 0x0017, 0x41); + adv7180_write(state, ADV7180_REG_SHAP_FILTER_CTL_1, 0x41); break; default: - adv7180_write(state, 0x0017, 0x01); + adv7180_write(state, ADV7180_REG_SHAP_FILTER_CTL_1, 0x01); break; } @@ -994,21 +1019,21 @@ static int adv7182_select_input(struct adv7180_state *state, unsigned int input) lbias = adv7182_lbias_settings[input_type]; for (i = 0; i < ARRAY_SIZE(adv7182_lbias_settings[0]); i++) - adv7180_write(state, 0x0052 + i, lbias[i]); + adv7180_write(state, ADV7180_REG_CVBS_TRIM + i, lbias[i]); if (input_type == ADV7182_INPUT_TYPE_DIFF_CVBS) { /* ADI required writes to make differential CVBS work */ - adv7180_write(state, 0x005f, 0xa8); - adv7180_write(state, 0x005a, 0x90); - adv7180_write(state, 0x0060, 0xb0); - adv7180_write(state, 0x80b6, 0x08); - adv7180_write(state, 0x80c0, 0xa0); + adv7180_write(state, ADV7180_REG_RES_CIR, 0xa8); + adv7180_write(state, ADV7180_REG_CLAMP_ADJ, 0x90); + adv7180_write(state, ADV7180_REG_DIFF_MODE, 0xb0); + adv7180_write(state, ADV7180_REG_AGC_ADJ1, 0x08); + adv7180_write(state, ADV7180_REG_AGC_ADJ2, 0xa0); } else { - adv7180_write(state, 0x005f, 0xf0); - adv7180_write(state, 0x005a, 0xd0); - adv7180_write(state, 0x0060, 0x10); - adv7180_write(state, 0x80b6, 0x9c); - adv7180_write(state, 0x80c0, 0x00); + adv7180_write(state, ADV7180_REG_RES_CIR, 0xf0); + adv7180_write(state, ADV7180_REG_CLAMP_ADJ, 0xd0); + adv7180_write(state, ADV7180_REG_DIFF_MODE, 0x10); + adv7180_write(state, ADV7180_REG_AGC_ADJ1, 0x9c); + adv7180_write(state, ADV7180_REG_AGC_ADJ2, 0x00); } return 0; From 65d9e14a659520c554feea8ef17ee3109bd67ebd Mon Sep 17 00:00:00 2001 From: Steve Longerbeam Date: Tue, 19 Jul 2016 21:03:32 -0300 Subject: [PATCH 191/591] [media] media: adv7180: add power pin control Some targets control the ADV7180 power pin via a gpio, so add optional support for "powerdown" pin control. Signed-off-by: Steve Longerbeam Tested-by: Tim Harvey Acked-by: Lars-Peter Clausen Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../devicetree/bindings/media/i2c/adv7180.txt | 5 ++++ drivers/media/i2c/Kconfig | 2 +- drivers/media/i2c/adv7180.c | 27 +++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv7180.txt b/Documentation/devicetree/bindings/media/i2c/adv7180.txt index 0d501154dfb2..4da486f96ff6 100644 --- a/Documentation/devicetree/bindings/media/i2c/adv7180.txt +++ b/Documentation/devicetree/bindings/media/i2c/adv7180.txt @@ -15,6 +15,11 @@ Required Properties : "adi,adv7282" "adi,adv7282-m" +Optional Properties : +- powerdown-gpios: reference to the GPIO connected to the powerdown pin, + if any. + + Example: i2c0@1c22000 { diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index c4df15a43d61..92cc54401339 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -187,7 +187,7 @@ comment "Video decoders" config VIDEO_ADV7180 tristate "Analog Devices ADV7180 decoder" - depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API + depends on GPIOLIB && VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API ---help--- Support for the Analog Devices ADV7180 video decoder. diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index cb83ebbe5131..c367ad6f6327 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -213,6 +214,7 @@ struct adv7180_state { struct media_pad pad; struct mutex mutex; /* mutual excl. when accessing chip */ int irq; + struct gpio_desc *pwdn_gpio; v4l2_std_id curr_norm; bool powered; bool streaming; @@ -463,6 +465,19 @@ static int adv7180_g_std(struct v4l2_subdev *sd, v4l2_std_id *norm) return 0; } +static void adv7180_set_power_pin(struct adv7180_state *state, bool on) +{ + if (!state->pwdn_gpio) + return; + + if (on) { + gpiod_set_value_cansleep(state->pwdn_gpio, 0); + usleep_range(5000, 10000); + } else { + gpiod_set_value_cansleep(state->pwdn_gpio, 1); + } +} + static int adv7180_set_power(struct adv7180_state *state, bool on) { u8 val; @@ -1210,6 +1225,8 @@ static int init_device(struct adv7180_state *state) mutex_lock(&state->mutex); + adv7180_set_power_pin(state, true); + adv7180_write(state, ADV7180_REG_PWR_MAN, ADV7180_PWR_MAN_RES); usleep_range(5000, 10000); @@ -1279,6 +1296,14 @@ static int adv7180_probe(struct i2c_client *client, state->field = V4L2_FIELD_INTERLACED; state->chip_info = (struct adv7180_chip_info *)id->driver_data; + state->pwdn_gpio = devm_gpiod_get_optional(&client->dev, "powerdown", + GPIOD_OUT_HIGH); + if (IS_ERR(state->pwdn_gpio)) { + ret = PTR_ERR(state->pwdn_gpio); + v4l_err(client, "request for power pin failed: %d\n", ret); + return ret; + } + if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) { state->csi_client = i2c_new_dummy(client->adapter, ADV7180_DEFAULT_CSI_I2C_ADDR); @@ -1370,6 +1395,8 @@ static int adv7180_remove(struct i2c_client *client) if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2) i2c_unregister_device(state->csi_client); + adv7180_set_power_pin(state, false); + mutex_destroy(&state->mutex); return 0; From 10d5509c8d50a2c2f761a08a616530dced35e2d8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 14 Dec 2015 08:25:32 -0200 Subject: [PATCH 192/591] [media] v4l2: remove g/s_crop from video ops Replace all calls to g/s_crop by calls to the get/set_selection pad ops. Remove the old g/s_crop video ops since they are now no longer used. The cropcap video op is now only used to pass pixelaspect information, and is only needed if the pixelaspect is not 1:1. Signed-off-by: Hans Verkuil Cc: Guennadi Liakhovetski Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ak881x.c | 28 ++-- drivers/media/i2c/soc_camera/imx074.c | 42 +++--- drivers/media/i2c/soc_camera/mt9m001.c | 70 +++++----- drivers/media/i2c/soc_camera/mt9m111.c | 57 ++++---- drivers/media/i2c/soc_camera/mt9t031.c | 54 ++++---- drivers/media/i2c/soc_camera/mt9t112.c | 60 ++++---- drivers/media/i2c/soc_camera/mt9v022.c | 68 ++++----- drivers/media/i2c/soc_camera/ov2640.c | 41 +++--- drivers/media/i2c/soc_camera/ov5642.c | 53 +++---- drivers/media/i2c/soc_camera/ov6650.c | 74 +++++----- drivers/media/i2c/soc_camera/ov772x.c | 44 +++--- drivers/media/i2c/soc_camera/ov9640.c | 41 +++--- drivers/media/i2c/soc_camera/ov9740.c | 41 +++--- drivers/media/i2c/soc_camera/rj54n1cb0c.c | 52 +++---- drivers/media/i2c/soc_camera/tw9910.c | 49 +++---- drivers/media/i2c/tvp5150.c | 79 +++++------ drivers/media/platform/omap3isp/ispvideo.c | 88 +++++++----- drivers/media/platform/sh_vou.c | 15 +- .../media/platform/soc_camera/pxa_camera.c | 17 ++- drivers/media/platform/soc_camera/rcar_vin.c | 30 ++-- .../soc_camera/sh_mobile_ceu_camera.c | 38 +++-- .../media/platform/soc_camera/soc_camera.c | 130 +++++------------- .../platform/soc_camera/soc_camera_platform.c | 45 +++--- .../platform/soc_camera/soc_scale_crop.c | 97 +++++++------ .../platform/soc_camera/soc_scale_crop.h | 6 +- drivers/staging/media/omap4iss/iss_video.c | 99 +++++++++++++ include/media/soc_camera.h | 7 +- include/media/v4l2-subdev.h | 6 - 28 files changed, 751 insertions(+), 680 deletions(-) diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c index d9f2b6b76d59..3a795dcb7d8e 100644 --- a/drivers/media/i2c/ak881x.c +++ b/drivers/media/i2c/ak881x.c @@ -124,21 +124,27 @@ static int ak881x_enum_mbus_code(struct v4l2_subdev *sd, return 0; } -static int ak881x_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) +static int ak881x_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct ak881x *ak881x = to_ak881x(client); - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = 720; - a->bounds.height = ak881x->lines; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = 720; + sel->r.height = ak881x->lines; + return 0; + default: + return -EINVAL; + } } static int ak881x_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std) @@ -207,13 +213,13 @@ static struct v4l2_subdev_core_ops ak881x_subdev_core_ops = { }; static struct v4l2_subdev_video_ops ak881x_subdev_video_ops = { - .cropcap = ak881x_cropcap, .s_std_output = ak881x_s_std_output, .s_stream = ak881x_s_stream, }; static const struct v4l2_subdev_pad_ops ak881x_subdev_pad_ops = { .enum_mbus_code = ak881x_enum_mbus_code, + .get_selection = ak881x_get_selection, .set_fmt = ak881x_fill_fmt, .get_fmt = ak881x_fill_fmt, }; diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c index f68c2352c63c..05b55cfe8147 100644 --- a/drivers/media/i2c/soc_camera/imx074.c +++ b/drivers/media/i2c/soc_camera/imx074.c @@ -209,31 +209,26 @@ static int imx074_get_fmt(struct v4l2_subdev *sd, return 0; } -static int imx074_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int imx074_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - struct v4l2_rect *rect = &a->c; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - rect->top = 0; - rect->left = 0; - rect->width = IMX074_WIDTH; - rect->height = IMX074_HEIGHT; + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = IMX074_WIDTH; + sel->r.height = IMX074_HEIGHT; - return 0; -} - -static int imx074_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = IMX074_WIDTH; - a->bounds.height = IMX074_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP: + return 0; + default: + return -EINVAL; + } } static int imx074_enum_mbus_code(struct v4l2_subdev *sd, @@ -278,8 +273,6 @@ static int imx074_g_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops imx074_subdev_video_ops = { .s_stream = imx074_s_stream, - .g_crop = imx074_g_crop, - .cropcap = imx074_cropcap, .g_mbus_config = imx074_g_mbus_config, }; @@ -289,6 +282,7 @@ static struct v4l2_subdev_core_ops imx074_subdev_core_ops = { static const struct v4l2_subdev_pad_ops imx074_subdev_pad_ops = { .enum_mbus_code = imx074_enum_mbus_code, + .get_selection = imx074_get_selection, .get_fmt = imx074_get_fmt, .set_fmt = imx074_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/mt9m001.c b/drivers/media/i2c/soc_camera/mt9m001.c index 69becc358659..3d6378d4491c 100644 --- a/drivers/media/i2c/soc_camera/mt9m001.c +++ b/drivers/media/i2c/soc_camera/mt9m001.c @@ -171,13 +171,19 @@ static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) return 0; } -static int mt9m001_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int mt9m001_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); - struct v4l2_rect rect = a->c; - int ret; + struct v4l2_rect rect = sel->r; const u16 hblank = 9, vblank = 25; + int ret; + + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; if (mt9m001->fmts == mt9m001_colour_fmts) /* @@ -225,29 +231,30 @@ static int mt9m001_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) return ret; } -static int mt9m001_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int mt9m001_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); - a->c = mt9m001->rect; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int mt9m001_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = MT9M001_COLUMN_SKIP; - a->bounds.top = MT9M001_ROW_SKIP; - a->bounds.width = MT9M001_MAX_WIDTH; - a->bounds.height = MT9M001_MAX_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = MT9M001_COLUMN_SKIP; + sel->r.top = MT9M001_ROW_SKIP; + sel->r.width = MT9M001_MAX_WIDTH; + sel->r.height = MT9M001_MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = mt9m001->rect; + return 0; + default: + return -EINVAL; + } } static int mt9m001_get_fmt(struct v4l2_subdev *sd, @@ -275,18 +282,18 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd, { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); - struct v4l2_crop a = { - .c = { - .left = mt9m001->rect.left, - .top = mt9m001->rect.top, - .width = mf->width, - .height = mf->height, - }, + struct v4l2_subdev_selection sel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = V4L2_SEL_TGT_CROP, + .r.left = mt9m001->rect.left, + .r.top = mt9m001->rect.top, + .r.width = mf->width, + .r.height = mf->height, }; int ret; /* No support for scaling so far, just crop. TODO: use skipping */ - ret = mt9m001_s_crop(sd, &a); + ret = mt9m001_set_selection(sd, NULL, &sel); if (!ret) { mf->width = mt9m001->rect.width; mf->height = mt9m001->rect.height; @@ -625,9 +632,6 @@ static int mt9m001_s_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops mt9m001_subdev_video_ops = { .s_stream = mt9m001_s_stream, - .s_crop = mt9m001_s_crop, - .g_crop = mt9m001_g_crop, - .cropcap = mt9m001_cropcap, .g_mbus_config = mt9m001_g_mbus_config, .s_mbus_config = mt9m001_s_mbus_config, }; @@ -638,6 +642,8 @@ static const struct v4l2_subdev_sensor_ops mt9m001_subdev_sensor_ops = { static const struct v4l2_subdev_pad_ops mt9m001_subdev_pad_ops = { .enum_mbus_code = mt9m001_enum_mbus_code, + .get_selection = mt9m001_get_selection, + .set_selection = mt9m001_set_selection, .get_fmt = mt9m001_get_fmt, .set_fmt = mt9m001_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index 6dfaead6aaa8..6c8d1123658c 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c @@ -383,14 +383,18 @@ static int mt9m111_reset(struct mt9m111 *mt9m111) return ret; } -static int mt9m111_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int mt9m111_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - struct v4l2_rect rect = a->c; - struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9m111 *mt9m111 = to_mt9m111(client); + struct v4l2_rect rect = sel->r; int width, height; int ret; - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; if (mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR8_1X8 || @@ -421,30 +425,30 @@ static int mt9m111_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) return ret; } -static int mt9m111_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int mt9m111_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9m111 *mt9m111 = to_mt9m111(client); - a->c = mt9m111->rect; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - return 0; -} - -static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) return -EINVAL; - a->bounds.left = MT9M111_MIN_DARK_COLS; - a->bounds.top = MT9M111_MIN_DARK_ROWS; - a->bounds.width = MT9M111_MAX_WIDTH; - a->bounds.height = MT9M111_MAX_HEIGHT; - a->defrect = a->bounds; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = MT9M111_MIN_DARK_COLS; + sel->r.top = MT9M111_MIN_DARK_ROWS; + sel->r.width = MT9M111_MAX_WIDTH; + sel->r.height = MT9M111_MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = mt9m111->rect; + return 0; + default: + return -EINVAL; + } } static int mt9m111_get_fmt(struct v4l2_subdev *sd, @@ -867,14 +871,13 @@ static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, } static struct v4l2_subdev_video_ops mt9m111_subdev_video_ops = { - .s_crop = mt9m111_s_crop, - .g_crop = mt9m111_g_crop, - .cropcap = mt9m111_cropcap, .g_mbus_config = mt9m111_g_mbus_config, }; static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = { .enum_mbus_code = mt9m111_enum_mbus_code, + .get_selection = mt9m111_get_selection, + .set_selection = mt9m111_set_selection, .get_fmt = mt9m111_get_fmt, .set_fmt = mt9m111_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/mt9t031.c b/drivers/media/i2c/soc_camera/mt9t031.c index 5c8e3ffe3b27..3aa5569065ad 100644 --- a/drivers/media/i2c/soc_camera/mt9t031.c +++ b/drivers/media/i2c/soc_camera/mt9t031.c @@ -264,7 +264,7 @@ static int mt9t031_set_params(struct i2c_client *client, /* * The caller provides a supported format, as guaranteed by - * .set_fmt(FORMAT_TRY), soc_camera_s_crop() and soc_camera_cropcap() + * .set_fmt(FORMAT_TRY), soc_camera_s_selection() and soc_camera_cropcap() */ if (ret >= 0) ret = reg_write(client, MT9T031_COLUMN_START, rect->left); @@ -294,11 +294,17 @@ static int mt9t031_set_params(struct i2c_client *client, return ret < 0 ? ret : 0; } -static int mt9t031_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int mt9t031_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - struct v4l2_rect rect = a->c; struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9t031 *mt9t031 = to_mt9t031(client); + struct v4l2_rect rect = sel->r; + + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; rect.width = ALIGN(rect.width, 2); rect.height = ALIGN(rect.height, 2); @@ -312,29 +318,30 @@ static int mt9t031_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) return mt9t031_set_params(client, &rect, mt9t031->xskip, mt9t031->yskip); } -static int mt9t031_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int mt9t031_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9t031 *mt9t031 = to_mt9t031(client); - a->c = mt9t031->rect; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int mt9t031_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = MT9T031_COLUMN_SKIP; - a->bounds.top = MT9T031_ROW_SKIP; - a->bounds.width = MT9T031_MAX_WIDTH; - a->bounds.height = MT9T031_MAX_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = MT9T031_COLUMN_SKIP; + sel->r.top = MT9T031_ROW_SKIP; + sel->r.width = MT9T031_MAX_WIDTH; + sel->r.height = MT9T031_MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = mt9t031->rect; + return 0; + default: + return -EINVAL; + } } static int mt9t031_get_fmt(struct v4l2_subdev *sd, @@ -721,9 +728,6 @@ static int mt9t031_s_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops mt9t031_subdev_video_ops = { .s_stream = mt9t031_s_stream, - .s_crop = mt9t031_s_crop, - .g_crop = mt9t031_g_crop, - .cropcap = mt9t031_cropcap, .g_mbus_config = mt9t031_g_mbus_config, .s_mbus_config = mt9t031_s_mbus_config, }; @@ -734,6 +738,8 @@ static const struct v4l2_subdev_sensor_ops mt9t031_subdev_sensor_ops = { static const struct v4l2_subdev_pad_ops mt9t031_subdev_pad_ops = { .enum_mbus_code = mt9t031_enum_mbus_code, + .get_selection = mt9t031_get_selection, + .set_selection = mt9t031_set_selection, .get_fmt = mt9t031_get_fmt, .set_fmt = mt9t031_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/mt9t112.c b/drivers/media/i2c/soc_camera/mt9t112.c index 6a1b2a9f9a09..2ef22241ec14 100644 --- a/drivers/media/i2c/soc_camera/mt9t112.c +++ b/drivers/media/i2c/soc_camera/mt9t112.c @@ -867,39 +867,48 @@ static int mt9t112_set_params(struct mt9t112_priv *priv, return 0; } -static int mt9t112_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = MAX_WIDTH; - a->bounds.height = MAX_HEIGHT; - a->defrect.left = 0; - a->defrect.top = 0; - a->defrect.width = VGA_WIDTH; - a->defrect.height = VGA_HEIGHT; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; -} - -static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int mt9t112_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9t112_priv *priv = to_mt9t112(client); - a->c = priv->frame; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = MAX_WIDTH; + sel->r.height = MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = VGA_WIDTH; + sel->r.height = VGA_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = priv->frame; + return 0; + default: + return -EINVAL; + } } -static int mt9t112_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int mt9t112_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9t112_priv *priv = to_mt9t112(client); - const struct v4l2_rect *rect = &a->c; + const struct v4l2_rect *rect = &sel->r; + + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; return mt9t112_set_params(priv, rect, priv->format->code); } @@ -1024,15 +1033,14 @@ static int mt9t112_s_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops mt9t112_subdev_video_ops = { .s_stream = mt9t112_s_stream, - .cropcap = mt9t112_cropcap, - .g_crop = mt9t112_g_crop, - .s_crop = mt9t112_s_crop, .g_mbus_config = mt9t112_g_mbus_config, .s_mbus_config = mt9t112_s_mbus_config, }; static const struct v4l2_subdev_pad_ops mt9t112_subdev_pad_ops = { .enum_mbus_code = mt9t112_enum_mbus_code, + .get_selection = mt9t112_get_selection, + .set_selection = mt9t112_set_selection, .get_fmt = mt9t112_get_fmt, .set_fmt = mt9t112_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c index 2721e583bfa0..6a14ab5e4f2d 100644 --- a/drivers/media/i2c/soc_camera/mt9v022.c +++ b/drivers/media/i2c/soc_camera/mt9v022.c @@ -276,14 +276,20 @@ static int mt9v022_s_stream(struct v4l2_subdev *sd, int enable) return 0; } -static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int mt9v022_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9v022 *mt9v022 = to_mt9v022(client); - struct v4l2_rect rect = a->c; + struct v4l2_rect rect = sel->r; int min_row, min_blank; int ret; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; + /* Bayer format - even size lengths */ if (mt9v022->fmts == mt9v022_colour_fmts) { rect.width = ALIGN(rect.width, 2); @@ -350,29 +356,30 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) return 0; } -static int mt9v022_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int mt9v022_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9v022 *mt9v022 = to_mt9v022(client); - a->c = mt9v022->rect; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int mt9v022_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = MT9V022_COLUMN_SKIP; - a->bounds.top = MT9V022_ROW_SKIP; - a->bounds.width = MT9V022_MAX_WIDTH; - a->bounds.height = MT9V022_MAX_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = MT9V022_COLUMN_SKIP; + sel->r.top = MT9V022_ROW_SKIP; + sel->r.width = MT9V022_MAX_WIDTH; + sel->r.height = MT9V022_MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = mt9v022->rect; + return 0; + default: + return -EINVAL; + } } static int mt9v022_get_fmt(struct v4l2_subdev *sd, @@ -400,13 +407,13 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd, { struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9v022 *mt9v022 = to_mt9v022(client); - struct v4l2_crop a = { - .c = { - .left = mt9v022->rect.left, - .top = mt9v022->rect.top, - .width = mf->width, - .height = mf->height, - }, + struct v4l2_subdev_selection sel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = V4L2_SEL_TGT_CROP, + .r.left = mt9v022->rect.left, + .r.top = mt9v022->rect.top, + .r.width = mf->width, + .r.height = mf->height, }; int ret; @@ -430,7 +437,7 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd, } /* No support for scaling on this camera, just crop. */ - ret = mt9v022_s_crop(sd, &a); + ret = mt9v022_set_selection(sd, NULL, &sel); if (!ret) { mf->width = mt9v022->rect.width; mf->height = mt9v022->rect.height; @@ -853,9 +860,6 @@ static int mt9v022_s_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops mt9v022_subdev_video_ops = { .s_stream = mt9v022_s_stream, - .s_crop = mt9v022_s_crop, - .g_crop = mt9v022_g_crop, - .cropcap = mt9v022_cropcap, .g_mbus_config = mt9v022_g_mbus_config, .s_mbus_config = mt9v022_s_mbus_config, }; @@ -866,6 +870,8 @@ static const struct v4l2_subdev_sensor_ops mt9v022_subdev_sensor_ops = { static const struct v4l2_subdev_pad_ops mt9v022_subdev_pad_ops = { .enum_mbus_code = mt9v022_enum_mbus_code, + .get_selection = mt9v022_get_selection, + .set_selection = mt9v022_set_selection, .get_fmt = mt9v022_get_fmt, .set_fmt = mt9v022_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index 9b4f5deec748..56de18263359 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c @@ -928,29 +928,25 @@ static int ov2640_enum_mbus_code(struct v4l2_subdev *sd, return 0; } -static int ov2640_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int ov2640_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - a->c.left = 0; - a->c.top = 0; - a->c.width = UXGA_WIDTH; - a->c.height = UXGA_HEIGHT; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int ov2640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = UXGA_WIDTH; - a->bounds.height = UXGA_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP: + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = UXGA_WIDTH; + sel->r.height = UXGA_HEIGHT; + return 0; + default: + return -EINVAL; + } } static int ov2640_video_probe(struct i2c_client *client) @@ -1024,13 +1020,12 @@ static int ov2640_g_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops ov2640_subdev_video_ops = { .s_stream = ov2640_s_stream, - .cropcap = ov2640_cropcap, - .g_crop = ov2640_g_crop, .g_mbus_config = ov2640_g_mbus_config, }; static const struct v4l2_subdev_pad_ops ov2640_subdev_pad_ops = { .enum_mbus_code = ov2640_enum_mbus_code, + .get_selection = ov2640_get_selection, .get_fmt = ov2640_get_fmt, .set_fmt = ov2640_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c index bab9ac0c1764..3d185bd622a3 100644 --- a/drivers/media/i2c/soc_camera/ov5642.c +++ b/drivers/media/i2c/soc_camera/ov5642.c @@ -850,13 +850,19 @@ static int ov5642_enum_mbus_code(struct v4l2_subdev *sd, return 0; } -static int ov5642_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int ov5642_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct ov5642 *priv = to_ov5642(client); - struct v4l2_rect rect = a->c; + struct v4l2_rect rect = sel->r; int ret; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; + v4l_bound_align_image(&rect.width, 48, OV5642_MAX_WIDTH, 1, &rect.height, 32, OV5642_MAX_HEIGHT, 1, 0); @@ -878,32 +884,30 @@ static int ov5642_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) return ret; } -static int ov5642_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int ov5642_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct ov5642 *priv = to_ov5642(client); - struct v4l2_rect *rect = &a->c; - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) return -EINVAL; - *rect = priv->crop_rect; - - return 0; -} - -static int ov5642_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = OV5642_MAX_WIDTH; - a->bounds.height = OV5642_MAX_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = OV5642_MAX_WIDTH; + sel->r.height = OV5642_MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = priv->crop_rect; + return 0; + default: + return -EINVAL; + } } static int ov5642_g_mbus_config(struct v4l2_subdev *sd, @@ -940,14 +944,13 @@ static int ov5642_s_power(struct v4l2_subdev *sd, int on) } static struct v4l2_subdev_video_ops ov5642_subdev_video_ops = { - .s_crop = ov5642_s_crop, - .g_crop = ov5642_g_crop, - .cropcap = ov5642_cropcap, .g_mbus_config = ov5642_g_mbus_config, }; static const struct v4l2_subdev_pad_ops ov5642_subdev_pad_ops = { .enum_mbus_code = ov5642_enum_mbus_code, + .get_selection = ov5642_get_selection, + .set_selection = ov5642_set_selection, .get_fmt = ov5642_get_fmt, .set_fmt = ov5642_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c index 1f8af1ee8352..4bf2995e1cb8 100644 --- a/drivers/media/i2c/soc_camera/ov6650.c +++ b/drivers/media/i2c/soc_camera/ov6650.c @@ -432,25 +432,43 @@ static int ov6650_s_power(struct v4l2_subdev *sd, int on) return soc_camera_set_power(&client->dev, ssdd, priv->clk, on); } -static int ov6650_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int ov6650_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct ov6650 *priv = to_ov6650(client); - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->c = priv->rect; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = DEF_HSTRT << 1; + sel->r.top = DEF_VSTRT << 1; + sel->r.width = W_CIF; + sel->r.height = H_CIF; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = priv->rect; + return 0; + default: + return -EINVAL; + } } -static int ov6650_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int ov6650_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct ov6650 *priv = to_ov6650(client); - struct v4l2_rect rect = a->c; + struct v4l2_rect rect = sel->r; int ret; - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; rect.left = ALIGN(rect.left, 2); @@ -483,22 +501,6 @@ static int ov6650_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) return ret; } -static int ov6650_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - - a->bounds.left = DEF_HSTRT << 1; - a->bounds.top = DEF_VSTRT << 1; - a->bounds.width = W_CIF; - a->bounds.height = H_CIF; - a->defrect = a->bounds; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; -} - static int ov6650_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *format) @@ -549,16 +551,15 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) struct soc_camera_sense *sense = icd->sense; struct ov6650 *priv = to_ov6650(client); bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect); - struct v4l2_crop a = { - .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, - .c = { - .left = priv->rect.left + (priv->rect.width >> 1) - - (mf->width >> (1 - half_scale)), - .top = priv->rect.top + (priv->rect.height >> 1) - - (mf->height >> (1 - half_scale)), - .width = mf->width << half_scale, - .height = mf->height << half_scale, - }, + struct v4l2_subdev_selection sel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = V4L2_SEL_TGT_CROP, + .r.left = priv->rect.left + (priv->rect.width >> 1) - + (mf->width >> (1 - half_scale)), + .r.top = priv->rect.top + (priv->rect.height >> 1) - + (mf->height >> (1 - half_scale)), + .r.width = mf->width << half_scale, + .r.height = mf->height << half_scale, }; u32 code = mf->code; unsigned long mclk, pclk; @@ -672,7 +673,7 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) dev_dbg(&client->dev, "pixel clock divider: %ld.%ld\n", mclk / pclk, 10 * mclk % pclk / pclk); - ret = ov6650_s_crop(sd, &a); + ret = ov6650_set_selection(sd, NULL, &sel); if (!ret) ret = ov6650_reg_rmw(client, REG_COMA, coma_set, coma_mask); if (!ret) @@ -943,9 +944,6 @@ static int ov6650_s_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops ov6650_video_ops = { .s_stream = ov6650_s_stream, - .cropcap = ov6650_cropcap, - .g_crop = ov6650_g_crop, - .s_crop = ov6650_s_crop, .g_parm = ov6650_g_parm, .s_parm = ov6650_s_parm, .g_mbus_config = ov6650_g_mbus_config, @@ -954,6 +952,8 @@ static struct v4l2_subdev_video_ops ov6650_video_ops = { static const struct v4l2_subdev_pad_ops ov6650_pad_ops = { .enum_mbus_code = ov6650_enum_mbus_code, + .get_selection = ov6650_get_selection, + .set_selection = ov6650_set_selection, .get_fmt = ov6650_get_fmt, .set_fmt = ov6650_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c index a43410c1e254..7e68762b3a4b 100644 --- a/drivers/media/i2c/soc_camera/ov772x.c +++ b/drivers/media/i2c/soc_camera/ov772x.c @@ -851,29 +851,28 @@ ov772x_set_fmt_error: return ret; } -static int ov772x_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int ov772x_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - a->c.left = 0; - a->c.top = 0; - a->c.width = VGA_WIDTH; - a->c.height = VGA_HEIGHT; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int ov772x_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = OV772X_MAX_WIDTH; - a->bounds.height = OV772X_MAX_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + sel->r.left = 0; + sel->r.top = 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.width = OV772X_MAX_WIDTH; + sel->r.height = OV772X_MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r.width = VGA_WIDTH; + sel->r.height = VGA_HEIGHT; + return 0; + default: + return -EINVAL; + } } static int ov772x_get_fmt(struct v4l2_subdev *sd, @@ -1030,13 +1029,12 @@ static int ov772x_g_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops ov772x_subdev_video_ops = { .s_stream = ov772x_s_stream, - .cropcap = ov772x_cropcap, - .g_crop = ov772x_g_crop, .g_mbus_config = ov772x_g_mbus_config, }; static const struct v4l2_subdev_pad_ops ov772x_subdev_pad_ops = { .enum_mbus_code = ov772x_enum_mbus_code, + .get_selection = ov772x_get_selection, .get_fmt = ov772x_get_fmt, .set_fmt = ov772x_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/ov9640.c b/drivers/media/i2c/soc_camera/ov9640.c index 8caae1c07541..8c93c57af71c 100644 --- a/drivers/media/i2c/soc_camera/ov9640.c +++ b/drivers/media/i2c/soc_camera/ov9640.c @@ -561,29 +561,25 @@ static int ov9640_enum_mbus_code(struct v4l2_subdev *sd, return 0; } -static int ov9640_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int ov9640_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - a->c.left = 0; - a->c.top = 0; - a->c.width = W_SXGA; - a->c.height = H_SXGA; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int ov9640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = W_SXGA; - a->bounds.height = H_SXGA; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + sel->r.left = 0; + sel->r.top = 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP: + sel->r.width = W_SXGA; + sel->r.height = H_SXGA; + return 0; + default: + return -EINVAL; + } } static int ov9640_video_probe(struct i2c_client *client) @@ -667,13 +663,12 @@ static int ov9640_g_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops ov9640_video_ops = { .s_stream = ov9640_s_stream, - .cropcap = ov9640_cropcap, - .g_crop = ov9640_g_crop, .g_mbus_config = ov9640_g_mbus_config, }; static const struct v4l2_subdev_pad_ops ov9640_pad_ops = { .enum_mbus_code = ov9640_enum_mbus_code, + .get_selection = ov9640_get_selection, .set_fmt = ov9640_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/ov9740.c b/drivers/media/i2c/soc_camera/ov9740.c index 03a7fc7316ae..0da632d7d33a 100644 --- a/drivers/media/i2c/soc_camera/ov9740.c +++ b/drivers/media/i2c/soc_camera/ov9740.c @@ -737,29 +737,25 @@ static int ov9740_enum_mbus_code(struct v4l2_subdev *sd, return 0; } -static int ov9740_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) +static int ov9740_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = OV9740_MAX_WIDTH; - a->bounds.height = OV9740_MAX_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int ov9740_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) -{ - a->c.left = 0; - a->c.top = 0; - a->c.width = OV9740_MAX_WIDTH; - a->c.height = OV9740_MAX_HEIGHT; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP: + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = OV9740_MAX_WIDTH; + sel->r.height = OV9740_MAX_HEIGHT; + return 0; + default: + return -EINVAL; + } } /* Set status of additional camera capabilities */ @@ -914,8 +910,6 @@ static int ov9740_g_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops ov9740_video_ops = { .s_stream = ov9740_s_stream, - .cropcap = ov9740_cropcap, - .g_crop = ov9740_g_crop, .g_mbus_config = ov9740_g_mbus_config, }; @@ -929,6 +923,7 @@ static struct v4l2_subdev_core_ops ov9740_core_ops = { static const struct v4l2_subdev_pad_ops ov9740_pad_ops = { .enum_mbus_code = ov9740_enum_mbus_code, + .get_selection = ov9740_get_selection, .set_fmt = ov9740_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/rj54n1cb0c.c b/drivers/media/i2c/soc_camera/rj54n1cb0c.c index aa7bfbb4ad71..bc8ec59a3fbd 100644 --- a/drivers/media/i2c/soc_camera/rj54n1cb0c.c +++ b/drivers/media/i2c/soc_camera/rj54n1cb0c.c @@ -538,15 +538,21 @@ static int rj54n1_commit(struct i2c_client *client) static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h, s32 *out_w, s32 *out_h); -static int rj54n1_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int rj54n1_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct rj54n1 *rj54n1 = to_rj54n1(client); - const struct v4l2_rect *rect = &a->c; + const struct v4l2_rect *rect = &sel->r; int dummy = 0, output_w, output_h, input_w = rect->width, input_h = rect->height; int ret; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; + /* arbitrary minimum width and height, edges unimportant */ soc_camera_limit_side(&dummy, &input_w, RJ54N1_COLUMN_SKIP, 8, RJ54N1_MAX_WIDTH); @@ -573,29 +579,30 @@ static int rj54n1_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) return 0; } -static int rj54n1_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int rj54n1_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct rj54n1 *rj54n1 = to_rj54n1(client); - a->c = rj54n1->rect; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int rj54n1_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - a->bounds.left = RJ54N1_COLUMN_SKIP; - a->bounds.top = RJ54N1_ROW_SKIP; - a->bounds.width = RJ54N1_MAX_WIDTH; - a->bounds.height = RJ54N1_MAX_HEIGHT; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = RJ54N1_COLUMN_SKIP; + sel->r.top = RJ54N1_ROW_SKIP; + sel->r.width = RJ54N1_MAX_WIDTH; + sel->r.height = RJ54N1_MAX_HEIGHT; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = rj54n1->rect; + return 0; + default: + return -EINVAL; + } } static int rj54n1_get_fmt(struct v4l2_subdev *sd, @@ -1246,15 +1253,14 @@ static int rj54n1_s_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops rj54n1_subdev_video_ops = { .s_stream = rj54n1_s_stream, - .g_crop = rj54n1_g_crop, - .s_crop = rj54n1_s_crop, - .cropcap = rj54n1_cropcap, .g_mbus_config = rj54n1_g_mbus_config, .s_mbus_config = rj54n1_s_mbus_config, }; static const struct v4l2_subdev_pad_ops rj54n1_subdev_pad_ops = { .enum_mbus_code = rj54n1_enum_mbus_code, + .get_selection = rj54n1_get_selection, + .set_selection = rj54n1_set_selection, .get_fmt = rj54n1_get_fmt, .set_fmt = rj54n1_set_fmt, }; diff --git a/drivers/media/i2c/soc_camera/tw9910.c b/drivers/media/i2c/soc_camera/tw9910.c index 06aff81787a7..4002c07f3857 100644 --- a/drivers/media/i2c/soc_camera/tw9910.c +++ b/drivers/media/i2c/soc_camera/tw9910.c @@ -676,44 +676,28 @@ tw9910_set_fmt_error: return ret; } -static int tw9910_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int tw9910_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct tw9910_priv *priv = to_tw9910(client); - a->c.left = 0; - a->c.top = 0; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; + /* Only CROP, CROP_DEFAULT and CROP_BOUNDS are supported */ + if (sel->target > V4L2_SEL_TGT_CROP_BOUNDS) + return -EINVAL; + + sel->r.left = 0; + sel->r.top = 0; if (priv->norm & V4L2_STD_NTSC) { - a->c.width = 640; - a->c.height = 480; + sel->r.width = 640; + sel->r.height = 480; } else { - a->c.width = 768; - a->c.height = 576; + sel->r.width = 768; + sel->r.height = 576; } - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - return 0; -} - -static int tw9910_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct tw9910_priv *priv = to_tw9910(client); - - a->bounds.left = 0; - a->bounds.top = 0; - if (priv->norm & V4L2_STD_NTSC) { - a->bounds.width = 640; - a->bounds.height = 480; - } else { - a->bounds.width = 768; - a->bounds.height = 576; - } - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - return 0; } @@ -921,8 +905,6 @@ static struct v4l2_subdev_video_ops tw9910_subdev_video_ops = { .s_std = tw9910_s_std, .g_std = tw9910_g_std, .s_stream = tw9910_s_stream, - .cropcap = tw9910_cropcap, - .g_crop = tw9910_g_crop, .g_mbus_config = tw9910_g_mbus_config, .s_mbus_config = tw9910_s_mbus_config, .g_tvnorms = tw9910_g_tvnorms, @@ -930,6 +912,7 @@ static struct v4l2_subdev_video_ops tw9910_subdev_video_ops = { static const struct v4l2_subdev_pad_ops tw9910_subdev_pad_ops = { .enum_mbus_code = tw9910_enum_mbus_code, + .get_selection = tw9910_get_selection, .get_fmt = tw9910_get_fmt, .set_fmt = tw9910_set_fmt, }; diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index 0b6d46c453bf..b7648fda519c 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -871,19 +871,22 @@ static int tvp5150_fill_fmt(struct v4l2_subdev *sd, return 0; } -static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +static int tvp5150_set_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - struct v4l2_rect rect = a->c; struct tvp5150 *decoder = to_tvp5150(sd); + struct v4l2_rect rect = sel->r; v4l2_std_id std; - unsigned int hmax; + int hmax; + + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; v4l2_dbg(1, debug, sd, "%s left=%d, top=%d, width=%d, height=%d\n", __func__, rect.left, rect.top, rect.width, rect.height); - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - /* tvp5150 has some special limits */ rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT); rect.width = clamp_t(unsigned int, rect.width, @@ -924,44 +927,39 @@ static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) return 0; } -static int tvp5150_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +static int tvp5150_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { - struct tvp5150 *decoder = to_tvp5150(sd); - - a->c = decoder->rect; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - return 0; -} - -static int tvp5150_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) -{ - struct tvp5150 *decoder = to_tvp5150(sd); + struct tvp5150 *decoder = container_of(sd, struct tvp5150, sd); v4l2_std_id std; - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) return -EINVAL; - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = TVP5150_H_MAX; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = TVP5150_H_MAX; - /* Calculate height based on current standard */ - if (decoder->norm == V4L2_STD_ALL) - std = tvp5150_read_std(sd); - else - std = decoder->norm; - - if (std & V4L2_STD_525_60) - a->bounds.height = TVP5150_V_MAX_525_60; - else - a->bounds.height = TVP5150_V_MAX_OTHERS; - - a->defrect = a->bounds; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + /* Calculate height based on current standard */ + if (decoder->norm == V4L2_STD_ALL) + std = tvp5150_read_std(sd); + else + std = decoder->norm; + if (std & V4L2_STD_525_60) + sel->r.height = TVP5150_V_MAX_525_60; + else + sel->r.height = TVP5150_V_MAX_OTHERS; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = decoder->rect; + return 0; + default: + return -EINVAL; + } } static int tvp5150_g_mbus_config(struct v4l2_subdev *sd, @@ -1233,9 +1231,6 @@ static const struct v4l2_subdev_video_ops tvp5150_video_ops = { .s_std = tvp5150_s_std, .s_stream = tvp5150_s_stream, .s_routing = tvp5150_s_routing, - .s_crop = tvp5150_s_crop, - .g_crop = tvp5150_g_crop, - .cropcap = tvp5150_cropcap, .g_mbus_config = tvp5150_g_mbus_config, }; @@ -1251,6 +1246,8 @@ static const struct v4l2_subdev_pad_ops tvp5150_pad_ops = { .enum_frame_size = tvp5150_enum_frame_size, .set_fmt = tvp5150_fill_fmt, .get_fmt = tvp5150_fill_fmt, + .get_selection = tvp5150_get_selection, + .set_selection = tvp5150_set_selection, }; static const struct v4l2_subdev_ops tvp5150_ops = { diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index 7d9f35976d18..7354469670b7 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c @@ -772,40 +772,45 @@ isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format) } static int -isp_video_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropcap) -{ - struct isp_video *video = video_drvdata(file); - struct v4l2_subdev *subdev; - int ret; - - subdev = isp_video_remote_subdev(video, NULL); - if (subdev == NULL) - return -EINVAL; - - mutex_lock(&video->mutex); - ret = v4l2_subdev_call(subdev, video, cropcap, cropcap); - mutex_unlock(&video->mutex); - - return ret == -ENOIOCTLCMD ? -ENOTTY : ret; -} - -static int -isp_video_get_crop(struct file *file, void *fh, struct v4l2_crop *crop) +isp_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel) { struct isp_video *video = video_drvdata(file); struct v4l2_subdev_format format; struct v4l2_subdev *subdev; + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = sel->target, + }; u32 pad; int ret; + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + break; + case V4L2_SEL_TGT_COMPOSE: + case V4L2_SEL_TGT_COMPOSE_BOUNDS: + case V4L2_SEL_TGT_COMPOSE_DEFAULT: + if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + break; + default: + return -EINVAL; + } subdev = isp_video_remote_subdev(video, &pad); if (subdev == NULL) return -EINVAL; - /* Try the get crop operation first and fallback to get format if not + /* Try the get selection operation first and fallback to get format if not * implemented. */ - ret = v4l2_subdev_call(subdev, video, g_crop, crop); + sdsel.pad = pad; + ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, &sdsel); + if (!ret) + sel->r = sdsel.r; if (ret != -ENOIOCTLCMD) return ret; @@ -815,28 +820,50 @@ isp_video_get_crop(struct file *file, void *fh, struct v4l2_crop *crop) if (ret < 0) return ret == -ENOIOCTLCMD ? -ENOTTY : ret; - crop->c.left = 0; - crop->c.top = 0; - crop->c.width = format.format.width; - crop->c.height = format.format.height; + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = format.format.width; + sel->r.height = format.format.height; return 0; } static int -isp_video_set_crop(struct file *file, void *fh, const struct v4l2_crop *crop) +isp_video_set_selection(struct file *file, void *fh, struct v4l2_selection *sel) { struct isp_video *video = video_drvdata(file); struct v4l2_subdev *subdev; + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = sel->target, + .flags = sel->flags, + .r = sel->r, + }; + u32 pad; int ret; - subdev = isp_video_remote_subdev(video, NULL); + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + break; + case V4L2_SEL_TGT_COMPOSE: + if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + break; + default: + return -EINVAL; + } + subdev = isp_video_remote_subdev(video, &pad); if (subdev == NULL) return -EINVAL; + sdsel.pad = pad; mutex_lock(&video->mutex); - ret = v4l2_subdev_call(subdev, video, s_crop, crop); + ret = v4l2_subdev_call(subdev, pad, set_selection, NULL, &sdsel); mutex_unlock(&video->mutex); + if (!ret) + sel->r = sdsel.r; return ret == -ENOIOCTLCMD ? -ENOTTY : ret; } @@ -1252,9 +1279,8 @@ static const struct v4l2_ioctl_ops isp_video_ioctl_ops = { .vidioc_g_fmt_vid_out = isp_video_get_format, .vidioc_s_fmt_vid_out = isp_video_set_format, .vidioc_try_fmt_vid_out = isp_video_try_format, - .vidioc_cropcap = isp_video_cropcap, - .vidioc_g_crop = isp_video_get_crop, - .vidioc_s_crop = isp_video_set_crop, + .vidioc_g_selection = isp_video_get_selection, + .vidioc_s_selection = isp_video_set_selection, .vidioc_g_parm = isp_video_get_param, .vidioc_s_parm = isp_video_set_param, .vidioc_reqbufs = isp_video_reqbufs, diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index e1f39b4cf1cd..4ee7b1570f62 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c @@ -937,7 +937,10 @@ static int sh_vou_s_selection(struct file *file, void *fh, { struct v4l2_rect *rect = &sel->r; struct sh_vou_device *vou_dev = video_drvdata(file); - struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; + struct v4l2_subdev_selection sd_sel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = V4L2_SEL_TGT_COMPOSE, + }; struct v4l2_pix_format *pix = &vou_dev->pix; struct sh_vou_geometry geo; struct v4l2_subdev_format format = { @@ -978,14 +981,14 @@ static int sh_vou_s_selection(struct file *file, void *fh, geo.in_height = pix->height; /* Configure the encoder one-to-one, position at 0, ignore errors */ - sd_crop.c.width = geo.output.width; - sd_crop.c.height = geo.output.height; + sd_sel.r.width = geo.output.width; + sd_sel.r.height = geo.output.height; /* - * We first issue a S_CROP, so that the subsequent S_FMT delivers the + * We first issue a S_SELECTION, so that the subsequent S_FMT delivers the * final encoder configuration. */ - v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, video, - s_crop, &sd_crop); + v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, pad, + set_selection, NULL, &sd_sel); format.format.width = geo.output.width; format.format.height = geo.output.height; ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, pad, diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 2aaf4a8f71a0..ebbe514d64e2 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -1280,10 +1280,10 @@ static int pxa_camera_check_frame(u32 width, u32 height) (width & 0x01); } -static int pxa_camera_set_crop(struct soc_camera_device *icd, - const struct v4l2_crop *a) +static int pxa_camera_set_selection(struct soc_camera_device *icd, + struct v4l2_selection *sel) { - const struct v4l2_rect *rect = &a->c; + const struct v4l2_rect *rect = &sel->r; struct device *dev = icd->parent; struct soc_camera_host *ici = to_soc_camera_host(dev); struct pxa_camera_dev *pcdev = ici->priv; @@ -1298,13 +1298,19 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, struct v4l2_mbus_framefmt *mf = &fmt.format; struct pxa_cam *cam = icd->host_priv; u32 fourcc = icd->current_fmt->host_fmt->fourcc; + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = sel->target, + .flags = sel->flags, + .r = sel->r, + }; int ret; /* If PCLK is used to latch data from the sensor, check sense */ if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) icd->sense = &sense; - ret = v4l2_subdev_call(sd, video, s_crop, a); + ret = v4l2_subdev_call(sd, pad, set_selection, NULL, &sdsel); icd->sense = NULL; @@ -1313,6 +1319,7 @@ static int pxa_camera_set_crop(struct soc_camera_device *icd, rect->width, rect->height, rect->left, rect->top); return ret; } + sel->r = sdsel.r; ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); if (ret < 0) @@ -1592,7 +1599,7 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = { .remove = pxa_camera_remove_device, .clock_start = pxa_camera_clock_start, .clock_stop = pxa_camera_clock_stop, - .set_crop = pxa_camera_set_crop, + .set_selection = pxa_camera_set_selection, .get_formats = pxa_camera_get_formats, .put_formats = pxa_camera_put_formats, .set_fmt = pxa_camera_set_fmt, diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c index 9c137522c660..077f12d1575f 100644 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c @@ -515,7 +515,7 @@ struct rcar_vin_cam { unsigned int out_width; unsigned int out_height; /* - * User window from S_CROP / G_CROP, produced by client cropping and + * User window from S_SELECTION / G_SELECTION, produced by client cropping and * scaling, VIN scaling and VIN cropping, mapped back onto the client * input window */ @@ -1471,16 +1471,15 @@ static void rcar_vin_put_formats(struct soc_camera_device *icd) icd->host_priv = NULL; } -static int rcar_vin_set_crop(struct soc_camera_device *icd, - const struct v4l2_crop *a) +static int rcar_vin_set_selection(struct soc_camera_device *icd, + struct v4l2_selection *sel) { - struct v4l2_crop a_writable = *a; - const struct v4l2_rect *rect = &a_writable.c; + const struct v4l2_rect *rect = &sel->r; struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct rcar_vin_priv *priv = ici->priv; - struct v4l2_crop cam_crop; + struct v4l2_selection cam_sel; struct rcar_vin_cam *cam = icd->host_priv; - struct v4l2_rect *cam_rect = &cam_crop.c; + struct v4l2_rect *cam_rect = &cam_sel.r; struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct device *dev = icd->parent; struct v4l2_subdev_format fmt = { @@ -1490,15 +1489,15 @@ static int rcar_vin_set_crop(struct soc_camera_device *icd, u32 vnmc; int ret, i; - dev_dbg(dev, "S_CROP(%ux%u@%u:%u)\n", rect->width, rect->height, + dev_dbg(dev, "S_SELECTION(%ux%u@%u:%u)\n", rect->width, rect->height, rect->left, rect->top); /* During camera cropping its output window can change too, stop VIN */ capture_stop_preserve(priv, &vnmc); dev_dbg(dev, "VNMC_REG 0x%x\n", vnmc); - /* Apply iterative camera S_CROP for new input window. */ - ret = soc_camera_client_s_crop(sd, &a_writable, &cam_crop, + /* Apply iterative camera S_SELECTION for new input window. */ + ret = soc_camera_client_s_selection(sd, sel, &cam_sel, &cam->rect, &cam->subrect); if (ret < 0) return ret; @@ -1551,13 +1550,12 @@ static int rcar_vin_set_crop(struct soc_camera_device *icd, return ret; } -static int rcar_vin_get_crop(struct soc_camera_device *icd, - struct v4l2_crop *a) +static int rcar_vin_get_selection(struct soc_camera_device *icd, + struct v4l2_selection *sel) { struct rcar_vin_cam *cam = icd->host_priv; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->c = cam->subrect; + sel->r = cam->subrect; return 0; } @@ -1824,8 +1822,8 @@ static struct soc_camera_host_ops rcar_vin_host_ops = { .remove = rcar_vin_remove_device, .get_formats = rcar_vin_get_formats, .put_formats = rcar_vin_put_formats, - .get_crop = rcar_vin_get_crop, - .set_crop = rcar_vin_set_crop, + .get_selection = rcar_vin_get_selection, + .set_selection = rcar_vin_set_selection, .try_fmt = rcar_vin_try_fmt, .set_fmt = rcar_vin_set_fmt, .poll = rcar_vin_poll, diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 05eafe3a421e..e5571c8a368e 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c @@ -134,7 +134,7 @@ struct sh_mobile_ceu_cam { unsigned int width; unsigned int height; /* - * User window from S_CROP / G_CROP, produced by client cropping and + * User window from S_SELECTION / G_SELECTION, produced by client cropping and * scaling, CEU scaling and CEU cropping, mapped back onto the client * input window */ @@ -1109,17 +1109,16 @@ static void sh_mobile_ceu_put_formats(struct soc_camera_device *icd) * Documentation/video4linux/sh_mobile_ceu_camera.txt for a description of * scaling and cropping algorithms and for the meaning of referenced here steps. */ -static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, - const struct v4l2_crop *a) +static int sh_mobile_ceu_set_selection(struct soc_camera_device *icd, + struct v4l2_selection *sel) { - struct v4l2_crop a_writable = *a; - const struct v4l2_rect *rect = &a_writable.c; + struct v4l2_rect *rect = &sel->r; struct device *dev = icd->parent; struct soc_camera_host *ici = to_soc_camera_host(dev); struct sh_mobile_ceu_dev *pcdev = ici->priv; - struct v4l2_crop cam_crop; + struct v4l2_selection cam_sel; struct sh_mobile_ceu_cam *cam = icd->host_priv; - struct v4l2_rect *cam_rect = &cam_crop.c; + struct v4l2_rect *cam_rect = &cam_sel.r; struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct v4l2_subdev_format fmt = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, @@ -1131,7 +1130,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, u32 capsr, cflcr; int ret; - dev_geo(dev, "S_CROP(%ux%u@%u:%u)\n", rect->width, rect->height, + dev_geo(dev, "S_SELECTION(%ux%u@%u:%u)\n", rect->width, rect->height, rect->left, rect->top); /* During camera cropping its output window can change too, stop CEU */ @@ -1139,10 +1138,10 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, dev_dbg(dev, "CAPSR 0x%x, CFLCR 0x%x\n", capsr, pcdev->cflcr); /* - * 1. - 2. Apply iterative camera S_CROP for new input window, read back + * 1. - 2. Apply iterative camera S_SELECTION for new input window, read back * actual camera rectangle. */ - ret = soc_camera_client_s_crop(sd, &a_writable, &cam_crop, + ret = soc_camera_client_s_selection(sd, sel, &cam_sel, &cam->rect, &cam->subrect); if (ret < 0) return ret; @@ -1251,13 +1250,12 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, return ret; } -static int sh_mobile_ceu_get_crop(struct soc_camera_device *icd, - struct v4l2_crop *a) +static int sh_mobile_ceu_get_selection(struct soc_camera_device *icd, + struct v4l2_selection *sel) { struct sh_mobile_ceu_cam *cam = icd->host_priv; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->c = cam->subrect; + sel->r = cam->subrect; return 0; } @@ -1499,8 +1497,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, return ret; } -static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, - const struct v4l2_crop *a) +static int sh_mobile_ceu_set_liveselection(struct soc_camera_device *icd, + struct v4l2_selection *sel) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); struct soc_camera_host *ici = to_soc_camera_host(icd->parent); @@ -1519,7 +1517,7 @@ static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, "Client failed to stop the stream: %d\n", ret); else /* Do the crop, if it fails, there's nothing more we can do */ - sh_mobile_ceu_set_crop(icd, a); + sh_mobile_ceu_set_selection(icd, sel); dev_geo(icd->parent, "Output after crop: %ux%u\n", icd->user_width, icd->user_height); @@ -1600,9 +1598,9 @@ static struct soc_camera_host_ops sh_mobile_ceu_host_ops = { .clock_stop = sh_mobile_ceu_clock_stop, .get_formats = sh_mobile_ceu_get_formats, .put_formats = sh_mobile_ceu_put_formats, - .get_crop = sh_mobile_ceu_get_crop, - .set_crop = sh_mobile_ceu_set_crop, - .set_livecrop = sh_mobile_ceu_set_livecrop, + .get_selection = sh_mobile_ceu_get_selection, + .set_selection = sh_mobile_ceu_set_selection, + .set_liveselection = sh_mobile_ceu_set_liveselection, .set_fmt = sh_mobile_ceu_set_fmt, .try_fmt = sh_mobile_ceu_try_fmt, .poll = sh_mobile_ceu_poll, diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 46c7186f7867..edd1c1de4e33 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -581,7 +581,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, dev_dbg(icd->pdev, "S_FMT(%c%c%c%c, %ux%u)\n", pixfmtstr(pix->pixelformat), pix->width, pix->height); - /* We always call try_fmt() before set_fmt() or set_crop() */ + /* We always call try_fmt() before set_fmt() or set_selection() */ ret = soc_camera_try_fmt(icd, f); if (ret < 0) return ret; @@ -1025,72 +1025,6 @@ static int soc_camera_streamoff(struct file *file, void *priv, return ret; } -static int soc_camera_cropcap(struct file *file, void *fh, - struct v4l2_cropcap *a) -{ - struct soc_camera_device *icd = file->private_data; - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - - return ici->ops->cropcap(icd, a); -} - -static int soc_camera_g_crop(struct file *file, void *fh, - struct v4l2_crop *a) -{ - struct soc_camera_device *icd = file->private_data; - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - int ret; - - ret = ici->ops->get_crop(icd, a); - - return ret; -} - -/* - * According to the V4L2 API, drivers shall not update the struct v4l2_crop - * argument with the actual geometry, instead, the user shall use G_CROP to - * retrieve it. - */ -static int soc_camera_s_crop(struct file *file, void *fh, - const struct v4l2_crop *a) -{ - struct soc_camera_device *icd = file->private_data; - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - const struct v4l2_rect *rect = &a->c; - struct v4l2_crop current_crop; - int ret; - - if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - - dev_dbg(icd->pdev, "S_CROP(%ux%u@%u:%u)\n", - rect->width, rect->height, rect->left, rect->top); - - current_crop.type = a->type; - - /* If get_crop fails, we'll let host and / or client drivers decide */ - ret = ici->ops->get_crop(icd, ¤t_crop); - - /* Prohibit window size change with initialised buffers */ - if (ret < 0) { - dev_err(icd->pdev, - "S_CROP denied: getting current crop failed\n"); - } else if ((a->c.width == current_crop.c.width && - a->c.height == current_crop.c.height) || - !is_streaming(ici, icd)) { - /* same size or not streaming - use .set_crop() */ - ret = ici->ops->set_crop(icd, a); - } else if (ici->ops->set_livecrop) { - ret = ici->ops->set_livecrop(icd, a); - } else { - dev_err(icd->pdev, - "S_CROP denied: queue initialised and sizes differ\n"); - ret = -EBUSY; - } - - return ret; -} - static int soc_camera_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { @@ -1101,9 +1035,6 @@ static int soc_camera_g_selection(struct file *file, void *fh, if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - if (!ici->ops->get_selection) - return -ENOTTY; - return ici->ops->get_selection(icd, s); } @@ -1135,10 +1066,11 @@ static int soc_camera_s_selection(struct file *file, void *fh, return -EBUSY; } - if (!ici->ops->set_selection) - return -ENOTTY; - - ret = ici->ops->set_selection(icd, s); + if (s->target == V4L2_SEL_TGT_CROP && is_streaming(ici, icd) && + ici->ops->set_liveselection) + ret = ici->ops->set_liveselection(icd, s); + else + ret = ici->ops->set_selection(icd, s); if (!ret && s->target == V4L2_SEL_TGT_COMPOSE) { icd->user_width = s->r.width; @@ -1881,23 +1813,40 @@ static int soc_camera_remove(struct soc_camera_device *icd) return 0; } -static int default_cropcap(struct soc_camera_device *icd, - struct v4l2_cropcap *a) +static int default_g_selection(struct soc_camera_device *icd, + struct v4l2_selection *sel) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - return v4l2_subdev_call(sd, video, cropcap, a); + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = sel->target, + }; + int ret; + + ret = v4l2_subdev_call(sd, pad, get_selection, NULL, &sdsel); + if (ret) + return ret; + sel->r = sdsel.r; + return 0; } -static int default_g_crop(struct soc_camera_device *icd, struct v4l2_crop *a) +static int default_s_selection(struct soc_camera_device *icd, + struct v4l2_selection *sel) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - return v4l2_subdev_call(sd, video, g_crop, a); -} + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = sel->target, + .flags = sel->flags, + .r = sel->r, + }; + int ret; -static int default_s_crop(struct soc_camera_device *icd, const struct v4l2_crop *a) -{ - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - return v4l2_subdev_call(sd, video, s_crop, a); + ret = v4l2_subdev_call(sd, pad, set_selection, NULL, &sdsel); + if (ret) + return ret; + sel->r = sdsel.r; + return 0; } static int default_g_parm(struct soc_camera_device *icd, @@ -1968,12 +1917,10 @@ int soc_camera_host_register(struct soc_camera_host *ici) !ici->v4l2_dev.dev) return -EINVAL; - if (!ici->ops->set_crop) - ici->ops->set_crop = default_s_crop; - if (!ici->ops->get_crop) - ici->ops->get_crop = default_g_crop; - if (!ici->ops->cropcap) - ici->ops->cropcap = default_cropcap; + if (!ici->ops->set_selection) + ici->ops->set_selection = default_s_selection; + if (!ici->ops->get_selection) + ici->ops->get_selection = default_g_selection; if (!ici->ops->set_parm) ici->ops->set_parm = default_s_parm; if (!ici->ops->get_parm) @@ -2126,9 +2073,6 @@ static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = { .vidioc_expbuf = soc_camera_expbuf, .vidioc_streamon = soc_camera_streamon, .vidioc_streamoff = soc_camera_streamoff, - .vidioc_cropcap = soc_camera_cropcap, - .vidioc_g_crop = soc_camera_g_crop, - .vidioc_s_crop = soc_camera_s_crop, .vidioc_g_selection = soc_camera_g_selection, .vidioc_s_selection = soc_camera_s_selection, .vidioc_g_parm = soc_camera_g_parm, diff --git a/drivers/media/platform/soc_camera/soc_camera_platform.c b/drivers/media/platform/soc_camera/soc_camera_platform.c index a51d2a42998c..534d6c3c6d60 100644 --- a/drivers/media/platform/soc_camera/soc_camera_platform.c +++ b/drivers/media/platform/soc_camera/soc_camera_platform.c @@ -76,35 +76,27 @@ static int soc_camera_platform_enum_mbus_code(struct v4l2_subdev *sd, return 0; } -static int soc_camera_platform_g_crop(struct v4l2_subdev *sd, - struct v4l2_crop *a) +static int soc_camera_platform_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) { struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); - a->c.left = 0; - a->c.top = 0; - a->c.width = p->format.width; - a->c.height = p->format.height; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) + return -EINVAL; - return 0; -} - -static int soc_camera_platform_cropcap(struct v4l2_subdev *sd, - struct v4l2_cropcap *a) -{ - struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); - - a->bounds.left = 0; - a->bounds.top = 0; - a->bounds.width = p->format.width; - a->bounds.height = p->format.height; - a->defrect = a->bounds; - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - a->pixelaspect.numerator = 1; - a->pixelaspect.denominator = 1; - - return 0; + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP: + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = p->format.width; + sel->r.height = p->format.height; + return 0; + default: + return -EINVAL; + } } static int soc_camera_platform_g_mbus_config(struct v4l2_subdev *sd, @@ -120,13 +112,12 @@ static int soc_camera_platform_g_mbus_config(struct v4l2_subdev *sd, static struct v4l2_subdev_video_ops platform_subdev_video_ops = { .s_stream = soc_camera_platform_s_stream, - .cropcap = soc_camera_platform_cropcap, - .g_crop = soc_camera_platform_g_crop, .g_mbus_config = soc_camera_platform_g_mbus_config, }; static const struct v4l2_subdev_pad_ops platform_subdev_pad_ops = { .enum_mbus_code = soc_camera_platform_enum_mbus_code, + .get_selection = soc_camera_platform_get_selection, .get_fmt = soc_camera_platform_fill_fmt, .set_fmt = soc_camera_platform_fill_fmt, }; diff --git a/drivers/media/platform/soc_camera/soc_scale_crop.c b/drivers/media/platform/soc_camera/soc_scale_crop.c index bda29bc1b933..f77252d6ccd3 100644 --- a/drivers/media/platform/soc_camera/soc_scale_crop.c +++ b/drivers/media/platform/soc_camera/soc_scale_crop.c @@ -40,24 +40,22 @@ static bool is_inside(const struct v4l2_rect *r1, const struct v4l2_rect *r2) /* Get and store current client crop */ int soc_camera_client_g_rect(struct v4l2_subdev *sd, struct v4l2_rect *rect) { - struct v4l2_crop crop; - struct v4l2_cropcap cap; + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = V4L2_SEL_TGT_CROP, + }; int ret; - crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - ret = v4l2_subdev_call(sd, video, g_crop, &crop); + ret = v4l2_subdev_call(sd, pad, get_selection, NULL, &sdsel); if (!ret) { - *rect = crop.c; + *rect = sdsel.r; return ret; } - /* Camera driver doesn't support .g_crop(), assume default rectangle */ - cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - ret = v4l2_subdev_call(sd, video, cropcap, &cap); + sdsel.target = V4L2_SEL_TGT_CROP_DEFAULT; + ret = v4l2_subdev_call(sd, pad, get_selection, NULL, &sdsel); if (!ret) - *rect = cap.defrect; + *rect = sdsel.r; return ret; } @@ -93,17 +91,27 @@ static void update_subrect(struct v4l2_rect *rect, struct v4l2_rect *subrect) * 2. if (1) failed, try to double the client image until we get one big enough * 3. if (2) failed, try to request the maximum image */ -int soc_camera_client_s_crop(struct v4l2_subdev *sd, - struct v4l2_crop *crop, struct v4l2_crop *cam_crop, +int soc_camera_client_s_selection(struct v4l2_subdev *sd, + struct v4l2_selection *sel, struct v4l2_selection *cam_sel, struct v4l2_rect *target_rect, struct v4l2_rect *subrect) { - struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = sel->target, + .flags = sel->flags, + .r = sel->r, + }; + struct v4l2_subdev_selection bounds = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = V4L2_SEL_TGT_CROP_BOUNDS, + }; + struct v4l2_rect *rect = &sel->r, *cam_rect = &cam_sel->r; struct device *dev = sd->v4l2_dev->dev; - struct v4l2_cropcap cap; int ret; unsigned int width, height; - v4l2_subdev_call(sd, video, s_crop, crop); + v4l2_subdev_call(sd, pad, set_selection, NULL, &sdsel); + sel->r = sdsel.r; ret = soc_camera_client_g_rect(sd, cam_rect); if (ret < 0) return ret; @@ -113,29 +121,29 @@ int soc_camera_client_s_crop(struct v4l2_subdev *sd, * be within camera cropcap bounds */ if (!memcmp(rect, cam_rect, sizeof(*rect))) { - /* Even if camera S_CROP failed, but camera rectangle matches */ - dev_dbg(dev, "Camera S_CROP successful for %dx%d@%d:%d\n", + /* Even if camera S_SELECTION failed, but camera rectangle matches */ + dev_dbg(dev, "Camera S_SELECTION successful for %dx%d@%d:%d\n", rect->width, rect->height, rect->left, rect->top); *target_rect = *cam_rect; return 0; } /* Try to fix cropping, that camera hasn't managed to set */ - dev_geo(dev, "Fix camera S_CROP for %dx%d@%d:%d to %dx%d@%d:%d\n", + dev_geo(dev, "Fix camera S_SELECTION for %dx%d@%d:%d to %dx%d@%d:%d\n", cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top, rect->width, rect->height, rect->left, rect->top); /* We need sensor maximum rectangle */ - ret = v4l2_subdev_call(sd, video, cropcap, &cap); + ret = v4l2_subdev_call(sd, pad, get_selection, NULL, &bounds); if (ret < 0) return ret; /* Put user requested rectangle within sensor bounds */ - soc_camera_limit_side(&rect->left, &rect->width, cap.bounds.left, 2, - cap.bounds.width); - soc_camera_limit_side(&rect->top, &rect->height, cap.bounds.top, 4, - cap.bounds.height); + soc_camera_limit_side(&rect->left, &rect->width, sdsel.r.left, 2, + bounds.r.width); + soc_camera_limit_side(&rect->top, &rect->height, sdsel.r.top, 4, + bounds.r.height); /* * Popular special case - some cameras can only handle fixed sizes like @@ -150,7 +158,7 @@ int soc_camera_client_s_crop(struct v4l2_subdev *sd, */ while (!ret && (is_smaller(cam_rect, rect) || is_inside(cam_rect, rect)) && - (cap.bounds.width > width || cap.bounds.height > height)) { + (bounds.r.width > width || bounds.r.height > height)) { width *= 2; height *= 2; @@ -168,36 +176,40 @@ int soc_camera_client_s_crop(struct v4l2_subdev *sd, * Instead we just drop to the left and top bounds. */ if (cam_rect->left > rect->left) - cam_rect->left = cap.bounds.left; + cam_rect->left = bounds.r.left; if (cam_rect->left + cam_rect->width < rect->left + rect->width) cam_rect->width = rect->left + rect->width - cam_rect->left; if (cam_rect->top > rect->top) - cam_rect->top = cap.bounds.top; + cam_rect->top = bounds.r.top; if (cam_rect->top + cam_rect->height < rect->top + rect->height) cam_rect->height = rect->top + rect->height - cam_rect->top; - v4l2_subdev_call(sd, video, s_crop, cam_crop); + sdsel.r = *cam_rect; + v4l2_subdev_call(sd, pad, set_selection, NULL, &sdsel); + *cam_rect = sdsel.r; ret = soc_camera_client_g_rect(sd, cam_rect); - dev_geo(dev, "Camera S_CROP %d for %dx%d@%d:%d\n", ret, + dev_geo(dev, "Camera S_SELECTION %d for %dx%d@%d:%d\n", ret, cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top); } - /* S_CROP must not modify the rectangle */ + /* S_SELECTION must not modify the rectangle */ if (is_smaller(cam_rect, rect) || is_inside(cam_rect, rect)) { /* * The camera failed to configure a suitable cropping, * we cannot use the current rectangle, set to max */ - *cam_rect = cap.bounds; - v4l2_subdev_call(sd, video, s_crop, cam_crop); + sdsel.r = bounds.r; + v4l2_subdev_call(sd, pad, set_selection, NULL, &sdsel); + *cam_rect = sdsel.r; + ret = soc_camera_client_g_rect(sd, cam_rect); - dev_geo(dev, "Camera S_CROP %d for max %dx%d@%d:%d\n", ret, + dev_geo(dev, "Camera S_SELECTION %d for max %dx%d@%d:%d\n", ret, cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top); } @@ -209,7 +221,7 @@ int soc_camera_client_s_crop(struct v4l2_subdev *sd, return ret; } -EXPORT_SYMBOL(soc_camera_client_s_crop); +EXPORT_SYMBOL(soc_camera_client_s_selection); /* Iterative set_fmt, also updates cached client crop on success */ static int client_set_fmt(struct soc_camera_device *icd, @@ -221,7 +233,10 @@ static int client_set_fmt(struct soc_camera_device *icd, struct device *dev = icd->parent; struct v4l2_mbus_framefmt *mf = &format->format; unsigned int width = mf->width, height = mf->height, tmp_w, tmp_h; - struct v4l2_cropcap cap; + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = V4L2_SEL_TGT_CROP_BOUNDS, + }; bool host_1to1; int ret; @@ -243,16 +258,14 @@ static int client_set_fmt(struct soc_camera_device *icd, if (!host_can_scale) goto update_cache; - cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - ret = v4l2_subdev_call(sd, video, cropcap, &cap); + ret = v4l2_subdev_call(sd, pad, get_selection, NULL, &sdsel); if (ret < 0) return ret; - if (max_width > cap.bounds.width) - max_width = cap.bounds.width; - if (max_height > cap.bounds.height) - max_height = cap.bounds.height; + if (max_width > sdsel.r.width) + max_width = sdsel.r.width; + if (max_height > sdsel.r.height) + max_height = sdsel.r.height; /* Camera set a format, but geometry is not precise, try to improve */ tmp_w = mf->width; diff --git a/drivers/media/platform/soc_camera/soc_scale_crop.h b/drivers/media/platform/soc_camera/soc_scale_crop.h index 184a30dff541..9ca469312a1f 100644 --- a/drivers/media/platform/soc_camera/soc_scale_crop.h +++ b/drivers/media/platform/soc_camera/soc_scale_crop.h @@ -16,7 +16,7 @@ struct soc_camera_device; -struct v4l2_crop; +struct v4l2_selection; struct v4l2_mbus_framefmt; struct v4l2_pix_format; struct v4l2_rect; @@ -31,8 +31,8 @@ static inline unsigned int soc_camera_shift_scale(unsigned int size, #define soc_camera_calc_scale(in, shift, out) soc_camera_shift_scale(in, shift, out) int soc_camera_client_g_rect(struct v4l2_subdev *sd, struct v4l2_rect *rect); -int soc_camera_client_s_crop(struct v4l2_subdev *sd, - struct v4l2_crop *crop, struct v4l2_crop *cam_crop, +int soc_camera_client_s_selection(struct v4l2_subdev *sd, + struct v4l2_selection *sel, struct v4l2_selection *cam_sel, struct v4l2_rect *target_rect, struct v4l2_rect *subrect); int soc_camera_client_scale(struct soc_camera_device *icd, struct v4l2_rect *rect, struct v4l2_rect *subrect, diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index 90b7ff56722d..c16927ac8eb0 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -645,6 +645,103 @@ iss_video_try_format(struct file *file, void *fh, struct v4l2_format *format) return 0; } +static int +iss_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel) +{ + struct iss_video *video = video_drvdata(file); + struct v4l2_subdev_format format; + struct v4l2_subdev *subdev; + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = sel->target, + }; + u32 pad; + int ret; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + break; + case V4L2_SEL_TGT_COMPOSE: + case V4L2_SEL_TGT_COMPOSE_BOUNDS: + case V4L2_SEL_TGT_COMPOSE_DEFAULT: + if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + break; + default: + return -EINVAL; + } + subdev = iss_video_remote_subdev(video, &pad); + if (subdev == NULL) + return -EINVAL; + + /* Try the get selection operation first and fallback to get format if not + * implemented. + */ + sdsel.pad = pad; + ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, &sdsel); + if (!ret) + sel->r = sdsel.r; + if (ret != -ENOIOCTLCMD) + return ret; + + format.pad = pad; + format.which = V4L2_SUBDEV_FORMAT_ACTIVE; + ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &format); + if (ret < 0) + return ret == -ENOIOCTLCMD ? -ENOTTY : ret; + + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = format.format.width; + sel->r.height = format.format.height; + + return 0; +} + +static int +iss_video_set_selection(struct file *file, void *fh, struct v4l2_selection *sel) +{ + struct iss_video *video = video_drvdata(file); + struct v4l2_subdev *subdev; + struct v4l2_subdev_selection sdsel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .target = sel->target, + .flags = sel->flags, + .r = sel->r, + }; + u32 pad; + int ret; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + break; + case V4L2_SEL_TGT_COMPOSE: + if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + break; + default: + return -EINVAL; + } + subdev = iss_video_remote_subdev(video, &pad); + if (subdev == NULL) + return -EINVAL; + + sdsel.pad = pad; + mutex_lock(&video->mutex); + ret = v4l2_subdev_call(subdev, pad, set_selection, NULL, &sdsel); + mutex_unlock(&video->mutex); + if (!ret) + sel->r = sdsel.r; + + return ret == -ENOIOCTLCMD ? -ENOTTY : ret; +} + static int iss_video_get_param(struct file *file, void *fh, struct v4l2_streamparm *a) { @@ -971,6 +1068,8 @@ static const struct v4l2_ioctl_ops iss_video_ioctl_ops = { .vidioc_g_fmt_vid_out = iss_video_get_format, .vidioc_s_fmt_vid_out = iss_video_set_format, .vidioc_try_fmt_vid_out = iss_video_try_format, + .vidioc_g_selection = iss_video_get_selection, + .vidioc_s_selection = iss_video_set_selection, .vidioc_g_parm = iss_video_get_param, .vidioc_s_parm = iss_video_set_param, .vidioc_reqbufs = iss_video_reqbufs, diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 97aa13314bfd..1a15c3e4efd3 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -105,16 +105,13 @@ struct soc_camera_host_ops { int (*get_formats)(struct soc_camera_device *, unsigned int, struct soc_camera_format_xlate *); void (*put_formats)(struct soc_camera_device *); - int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *); - int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *); - int (*set_crop)(struct soc_camera_device *, const struct v4l2_crop *); int (*get_selection)(struct soc_camera_device *, struct v4l2_selection *); int (*set_selection)(struct soc_camera_device *, struct v4l2_selection *); /* - * The difference to .set_crop() is, that .set_livecrop is not allowed + * The difference to .set_selection() is, that .set_liveselection is not allowed * to change the output sizes */ - int (*set_livecrop)(struct soc_camera_device *, const struct v4l2_crop *); + int (*set_liveselection)(struct soc_camera_device *, struct v4l2_selection *); int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); void (*init_videobuf)(struct videobuf_queue *, diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 2a2240c99b30..22ea819ada95 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -360,10 +360,6 @@ struct v4l2_mbus_frame_desc { * * @cropcap: callback for %VIDIOC_CROPCAP ioctl handler code. * - * @g_crop: callback for %VIDIOC_G_CROP ioctl handler code. - * - * @s_crop: callback for %VIDIOC_S_CROP ioctl handler code. - * * @g_parm: callback for %VIDIOC_G_PARM ioctl handler code. * * @s_parm: callback for %VIDIOC_S_PARM ioctl handler code. @@ -403,8 +399,6 @@ struct v4l2_subdev_video_ops { int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); int (*s_stream)(struct v4l2_subdev *sd, int enable); int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc); - int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); - int (*s_crop)(struct v4l2_subdev *sd, const struct v4l2_crop *crop); int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); int (*g_frame_interval)(struct v4l2_subdev *sd, From b714fb006482f23d4439e6916ce922225aa3fe38 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 3 Jul 2016 07:05:16 -0300 Subject: [PATCH 193/591] [media] bttv: convert g/s_crop to g/s_selection This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/bt8xx/bttv-driver.c | 59 ++++++++++++++++++--------- drivers/media/pci/bt8xx/bttvp.h | 2 +- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index df54e17ef864..97b91a9f9fa9 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -2804,30 +2804,44 @@ static int bttv_cropcap(struct file *file, void *priv, cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) return -EINVAL; - *cap = bttv_tvnorms[btv->tvnorm].cropcap; + /* defrect and bounds are set via g_selection */ + cap->pixelaspect = bttv_tvnorms[btv->tvnorm].cropcap.pixelaspect; return 0; } -static int bttv_g_crop(struct file *file, void *f, struct v4l2_crop *crop) +static int bttv_g_selection(struct file *file, void *f, struct v4l2_selection *sel) { struct bttv_fh *fh = f; struct bttv *btv = fh->btv; - if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && - crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && + sel->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) return -EINVAL; - /* No fh->do_crop = 1; because btv->crop[1] may be - inconsistent with fh->width or fh->height and apps - do not expect a change here. */ - - crop->c = btv->crop[!!fh->do_crop].rect; + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + /* + * No fh->do_crop = 1; because btv->crop[1] may be + * inconsistent with fh->width or fh->height and apps + * do not expect a change here. + */ + sel->r = btv->crop[!!fh->do_crop].rect; + break; + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r = bttv_tvnorms[btv->tvnorm].cropcap.defrect; + break; + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r = bttv_tvnorms[btv->tvnorm].cropcap.bounds; + break; + default: + return -EINVAL; + } return 0; } -static int bttv_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) +static int bttv_s_selection(struct file *file, void *f, struct v4l2_selection *sel) { struct bttv_fh *fh = f; struct bttv *btv = fh->btv; @@ -2839,8 +2853,11 @@ static int bttv_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) __s32 b_right; __s32 b_bottom; - if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && - crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && + sel->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) + return -EINVAL; + + if (sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; /* Make sure tvnorm, vbi_end and the current cropping @@ -2864,22 +2881,24 @@ static int bttv_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) } /* Min. scaled size 48 x 32. */ - c.rect.left = clamp_t(s32, crop->c.left, b_left, b_right - 48); + c.rect.left = clamp_t(s32, sel->r.left, b_left, b_right - 48); c.rect.left = min(c.rect.left, (__s32) MAX_HDELAY); - c.rect.width = clamp_t(s32, crop->c.width, + c.rect.width = clamp_t(s32, sel->r.width, 48, b_right - c.rect.left); - c.rect.top = clamp_t(s32, crop->c.top, b_top, b_bottom - 32); + c.rect.top = clamp_t(s32, sel->r.top, b_top, b_bottom - 32); /* Top and height must be a multiple of two. */ c.rect.top = (c.rect.top + 1) & ~1; - c.rect.height = clamp_t(s32, crop->c.height, + c.rect.height = clamp_t(s32, sel->r.height, 32, b_bottom - c.rect.top); c.rect.height = (c.rect.height + 1) & ~1; bttv_crop_calc_limits(&c); + sel->r = c.rect; + btv->crop[1] = c; fh->do_crop = 1; @@ -3047,10 +3066,10 @@ static int bttv_open(struct file *file) which only change on request. These are stored in btv->crop[1]. However for compatibility with V4L apps and cropping unaware V4L2 apps we now reset the cropping parameters as seen through - this fh, which is to say VIDIOC_G_CROP and scaling limit checks + this fh, which is to say VIDIOC_G_SELECTION and scaling limit checks will use btv->crop[0], the default cropping parameters for the current video standard, and VIDIOC_S_FMT will not implicitely - change the cropping parameters until VIDIOC_S_CROP has been + change the cropping parameters until VIDIOC_S_SELECTION has been called. */ fh->do_crop = !reset_crop; /* module parameter */ @@ -3159,8 +3178,8 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = { .vidioc_streamoff = bttv_streamoff, .vidioc_g_tuner = bttv_g_tuner, .vidioc_s_tuner = bttv_s_tuner, - .vidioc_g_crop = bttv_g_crop, - .vidioc_s_crop = bttv_s_crop, + .vidioc_g_selection = bttv_g_selection, + .vidioc_s_selection = bttv_s_selection, .vidioc_g_fbuf = bttv_g_fbuf, .vidioc_s_fbuf = bttv_s_fbuf, .vidioc_overlay = bttv_overlay, diff --git a/drivers/media/pci/bt8xx/bttvp.h b/drivers/media/pci/bt8xx/bttvp.h index b1e0023f923c..9efc4559fa8e 100644 --- a/drivers/media/pci/bt8xx/bttvp.h +++ b/drivers/media/pci/bt8xx/bttvp.h @@ -232,7 +232,7 @@ struct bttv_fh { const struct bttv_format *ovfmt; struct bttv_overlay ov; - /* Application called VIDIOC_S_CROP. */ + /* Application called VIDIOC_S_SELECTION. */ int do_crop; /* vbi capture */ From d1d094618eb24abb03a56fea7bcc6d848acb7880 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 3 Jul 2016 07:12:05 -0300 Subject: [PATCH 194/591] [media] omap_vout: convert g/s_crop to g/s_selection This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/omap/omap_vout.c | 55 +++++++++++++------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index 6b01e126fe73..e668dde6d857 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c @@ -1247,36 +1247,33 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh, return 0; } -static int vidioc_cropcap(struct file *file, void *fh, - struct v4l2_cropcap *cropcap) +static int vidioc_g_selection(struct file *file, void *fh, struct v4l2_selection *sel) { struct omap_vout_device *vout = fh; struct v4l2_pix_format *pix = &vout->pix; - if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) return -EINVAL; - /* Width and height are always even */ - cropcap->bounds.width = pix->width & ~1; - cropcap->bounds.height = pix->height & ~1; - - omap_vout_default_crop(&vout->pix, &vout->fbuf, &cropcap->defrect); - cropcap->pixelaspect.numerator = 1; - cropcap->pixelaspect.denominator = 1; + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + sel->r = vout->crop; + break; + case V4L2_SEL_TGT_CROP_DEFAULT: + omap_vout_default_crop(&vout->pix, &vout->fbuf, &sel->r); + break; + case V4L2_SEL_TGT_CROP_BOUNDS: + /* Width and height are always even */ + sel->r.width = pix->width & ~1; + sel->r.height = pix->height & ~1; + break; + default: + return -EINVAL; + } return 0; } -static int vidioc_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) -{ - struct omap_vout_device *vout = fh; - - if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) - return -EINVAL; - crop->c = vout->crop; - return 0; -} - -static int vidioc_s_crop(struct file *file, void *fh, const struct v4l2_crop *crop) +static int vidioc_s_selection(struct file *file, void *fh, struct v4l2_selection *sel) { int ret = -EINVAL; struct omap_vout_device *vout = fh; @@ -1285,6 +1282,12 @@ static int vidioc_s_crop(struct file *file, void *fh, const struct v4l2_crop *cr struct omap_video_timings *timing; struct omap_dss_device *dssdev; + if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + + if (sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; + if (vout->streaming) return -EBUSY; @@ -1309,9 +1312,8 @@ static int vidioc_s_crop(struct file *file, void *fh, const struct v4l2_crop *cr vout->fbuf.fmt.width = timing->x_res; } - if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) - ret = omap_vout_new_crop(&vout->pix, &vout->crop, &vout->win, - &vout->fbuf, &crop->c); + ret = omap_vout_new_crop(&vout->pix, &vout->crop, &vout->win, + &vout->fbuf, &sel->r); s_crop_err: mutex_unlock(&vout->lock); @@ -1780,9 +1782,8 @@ static const struct v4l2_ioctl_ops vout_ioctl_ops = { .vidioc_try_fmt_vid_out_overlay = vidioc_try_fmt_vid_overlay, .vidioc_s_fmt_vid_out_overlay = vidioc_s_fmt_vid_overlay, .vidioc_g_fmt_vid_out_overlay = vidioc_g_fmt_vid_overlay, - .vidioc_cropcap = vidioc_cropcap, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_s_crop = vidioc_s_crop, + .vidioc_g_selection = vidioc_g_selection, + .vidioc_s_selection = vidioc_s_selection, .vidioc_reqbufs = vidioc_reqbufs, .vidioc_querybuf = vidioc_querybuf, .vidioc_qbuf = vidioc_qbuf, From 802d62c1db166d4ef5a27c81b372437a409b033e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 3 Jul 2016 07:39:00 -0300 Subject: [PATCH 195/591] [media] saa7134: convert g/s_crop to g/s_selection This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/saa7134/saa7134-video.c | 39 ++++++++++++++++------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 8a6ebd087889..20baa22afc42 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -1659,8 +1659,6 @@ static int saa7134_cropcap(struct file *file, void *priv, if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) return -EINVAL; - cap->bounds = dev->crop_bounds; - cap->defrect = dev->crop_defrect; cap->pixelaspect.numerator = 1; cap->pixelaspect.denominator = 1; if (dev->tvnorm->id & V4L2_STD_525_60) { @@ -1674,25 +1672,41 @@ static int saa7134_cropcap(struct file *file, void *priv, return 0; } -static int saa7134_g_crop(struct file *file, void *f, struct v4l2_crop *crop) +static int saa7134_g_selection(struct file *file, void *f, struct v4l2_selection *sel) { struct saa7134_dev *dev = video_drvdata(file); - if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && - crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && + sel->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) return -EINVAL; - crop->c = dev->crop_current; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + sel->r = dev->crop_current; + break; + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r = dev->crop_defrect; + break; + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r = dev->crop_bounds; + break; + default: + return -EINVAL; + } return 0; } -static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) +static int saa7134_s_selection(struct file *file, void *f, struct v4l2_selection *sel) { struct saa7134_dev *dev = video_drvdata(file); struct v4l2_rect *b = &dev->crop_bounds; struct v4l2_rect *c = &dev->crop_current; - if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && - crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && + sel->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) + return -EINVAL; + + if (sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; if (dev->overlay_owner) @@ -1700,7 +1714,7 @@ static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *cr if (vb2_is_streaming(&dev->video_vbq)) return -EBUSY; - *c = crop->c; + *c = sel->r; if (c->top < b->top) c->top = b->top; if (c->top > b->top + b->height) @@ -1714,6 +1728,7 @@ static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *cr c->left = b->left + b->width; if (c->width > b->left - c->left + b->width) c->width = b->left - c->left + b->width; + sel->r = *c; return 0; } @@ -1989,8 +2004,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_streamoff = vb2_ioctl_streamoff, .vidioc_g_tuner = saa7134_g_tuner, .vidioc_s_tuner = saa7134_s_tuner, - .vidioc_g_crop = saa7134_g_crop, - .vidioc_s_crop = saa7134_s_crop, + .vidioc_g_selection = saa7134_g_selection, + .vidioc_s_selection = saa7134_s_selection, .vidioc_g_fbuf = saa7134_g_fbuf, .vidioc_s_fbuf = saa7134_s_fbuf, .vidioc_overlay = saa7134_overlay, From 540da0258c6a8fe2d7ca3ee6fecb21ab75a6bbc7 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 3 Jul 2016 08:28:28 -0300 Subject: [PATCH 196/591] [media] zoran: convert g/s_crop to g/s_selection This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/zoran/zoran_driver.c | 119 +++++++++++-------------- 1 file changed, 52 insertions(+), 67 deletions(-) diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c index 80caa70c6360..d6b631add216 100644 --- a/drivers/media/pci/zoran/zoran_driver.c +++ b/drivers/media/pci/zoran/zoran_driver.c @@ -2365,94 +2365,80 @@ static int zoran_s_output(struct file *file, void *__fh, unsigned int output) } /* cropping (sub-frame capture) */ -static int zoran_cropcap(struct file *file, void *__fh, - struct v4l2_cropcap *cropcap) +static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selection *sel) { struct zoran_fh *fh = __fh; struct zoran *zr = fh->zr; - int type = cropcap->type, res = 0; - memset(cropcap, 0, sizeof(*cropcap)); - cropcap->type = type; + if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && + sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; - if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && - (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || - fh->map_mode == ZORAN_MAP_MODE_RAW)) { + if (fh->map_mode == ZORAN_MAP_MODE_RAW) { dprintk(1, KERN_ERR - "%s: VIDIOC_CROPCAP - subcapture only supported for compressed capture\n", + "%s: VIDIOC_G_SELECTION - subcapture only supported for compressed capture\n", ZR_DEVNAME(zr)); - res = -EINVAL; - return res; + return -EINVAL; } - cropcap->bounds.top = cropcap->bounds.left = 0; - cropcap->bounds.width = BUZ_MAX_WIDTH; - cropcap->bounds.height = BUZ_MAX_HEIGHT; - cropcap->defrect.top = cropcap->defrect.left = 0; - cropcap->defrect.width = BUZ_MIN_WIDTH; - cropcap->defrect.height = BUZ_MIN_HEIGHT; - return res; + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + sel->r.top = fh->jpg_settings.img_y; + sel->r.left = fh->jpg_settings.img_x; + sel->r.width = fh->jpg_settings.img_width; + sel->r.height = fh->jpg_settings.img_height; + break; + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.top = sel->r.left = 0; + sel->r.width = BUZ_MIN_WIDTH; + sel->r.height = BUZ_MIN_HEIGHT; + break; + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r.top = sel->r.left = 0; + sel->r.width = BUZ_MAX_WIDTH; + sel->r.height = BUZ_MAX_HEIGHT; + break; + default: + return -EINVAL; + } + return 0; } -static int zoran_g_crop(struct file *file, void *__fh, struct v4l2_crop *crop) +static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selection *sel) { struct zoran_fh *fh = __fh; struct zoran *zr = fh->zr; - int type = crop->type, res = 0; - - memset(crop, 0, sizeof(*crop)); - crop->type = type; - - if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && - (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || - fh->map_mode == ZORAN_MAP_MODE_RAW)) { - dprintk(1, - KERN_ERR - "%s: VIDIOC_G_CROP - subcapture only supported for compressed capture\n", - ZR_DEVNAME(zr)); - res = -EINVAL; - return res; - } - - crop->c.top = fh->jpg_settings.img_y; - crop->c.left = fh->jpg_settings.img_x; - crop->c.width = fh->jpg_settings.img_width; - crop->c.height = fh->jpg_settings.img_height; - return res; -} - -static int zoran_s_crop(struct file *file, void *__fh, const struct v4l2_crop *crop) -{ - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - int res = 0; struct zoran_jpg_settings settings; + int res; + + if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && + sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + if (sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; + + if (fh->map_mode == ZORAN_MAP_MODE_RAW) { + dprintk(1, KERN_ERR + "%s: VIDIOC_S_SELECTION - subcapture only supported for compressed capture\n", + ZR_DEVNAME(zr)); + return -EINVAL; + } settings = fh->jpg_settings; if (fh->buffers.allocated) { dprintk(1, KERN_ERR - "%s: VIDIOC_S_CROP - cannot change settings while active\n", + "%s: VIDIOC_S_SELECTION - cannot change settings while active\n", ZR_DEVNAME(zr)); - res = -EBUSY; - return res; - } - - if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && - (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || - fh->map_mode == ZORAN_MAP_MODE_RAW)) { - dprintk(1, KERN_ERR - "%s: VIDIOC_G_CROP - subcapture only supported for compressed capture\n", - ZR_DEVNAME(zr)); - res = -EINVAL; - return res; + return -EBUSY; } /* move into a form that we understand */ - settings.img_x = crop->c.left; - settings.img_y = crop->c.top; - settings.img_width = crop->c.width; - settings.img_height = crop->c.height; + settings.img_x = sel->r.left; + settings.img_y = sel->r.top; + settings.img_width = sel->r.width; + settings.img_height = sel->r.height; /* check validity */ res = zoran_check_jpg_settings(zr, &settings, 0); @@ -2808,9 +2794,8 @@ zoran_mmap (struct file *file, static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_querycap = zoran_querycap, - .vidioc_cropcap = zoran_cropcap, - .vidioc_s_crop = zoran_s_crop, - .vidioc_g_crop = zoran_g_crop, + .vidioc_s_selection = zoran_s_selection, + .vidioc_g_selection = zoran_g_selection, .vidioc_enum_input = zoran_enum_input, .vidioc_g_input = zoran_g_input, .vidioc_s_input = zoran_s_input, From ffc2a6bb55b2b7c873535c35b7e1ced763ff8bfe Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 3 Jul 2016 08:28:43 -0300 Subject: [PATCH 197/591] [media] vpfe_capture: convert g/s_crop to g/s_selection This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil Cc: Prabhakar Lad Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/davinci/vpfe_capture.c | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 7767e072d623..6efb2f1631c4 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c @@ -1610,38 +1610,53 @@ static int vpfe_cropcap(struct file *file, void *priv, v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_cropcap\n"); - if (vpfe_dev->std_index >= ARRAY_SIZE(vpfe_standards)) + if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; + /* If std_index is invalid, then just return (== 1:1 aspect) */ + if (vpfe_dev->std_index >= ARRAY_SIZE(vpfe_standards)) + return 0; - memset(crop, 0, sizeof(struct v4l2_cropcap)); - crop->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - crop->bounds.width = crop->defrect.width = - vpfe_standards[vpfe_dev->std_index].width; - crop->bounds.height = crop->defrect.height = - vpfe_standards[vpfe_dev->std_index].height; crop->pixelaspect = vpfe_standards[vpfe_dev->std_index].pixelaspect; return 0; } -static int vpfe_g_crop(struct file *file, void *priv, - struct v4l2_crop *crop) +static int vpfe_g_selection(struct file *file, void *priv, + struct v4l2_selection *sel) { struct vpfe_device *vpfe_dev = video_drvdata(file); - v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_g_crop\n"); + v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_g_selection\n"); - crop->c = vpfe_dev->crop; + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + sel->r = vpfe_dev->crop; + break; + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r.width = vpfe_standards[vpfe_dev->std_index].width; + sel->r.height = vpfe_standards[vpfe_dev->std_index].height; + break; + default: + return -EINVAL; + } return 0; } -static int vpfe_s_crop(struct file *file, void *priv, - const struct v4l2_crop *crop) +static int vpfe_s_selection(struct file *file, void *priv, + struct v4l2_selection *sel) { struct vpfe_device *vpfe_dev = video_drvdata(file); - struct v4l2_rect rect = crop->c; + struct v4l2_rect rect = sel->r; int ret = 0; - v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_crop\n"); + v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_selection\n"); + + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; if (vpfe_dev->started) { /* make sure streaming is not started */ @@ -1669,7 +1684,7 @@ static int vpfe_s_crop(struct file *file, void *priv, vpfe_dev->std_info.active_pixels) || (rect.top + rect.height > vpfe_dev->std_info.active_lines)) { - v4l2_err(&vpfe_dev->v4l2_dev, "Error in S_CROP params\n"); + v4l2_err(&vpfe_dev->v4l2_dev, "Error in S_SELECTION params\n"); ret = -EINVAL; goto unlock_out; } @@ -1682,6 +1697,7 @@ static int vpfe_s_crop(struct file *file, void *priv, vpfe_dev->fmt.fmt.pix.bytesperline * vpfe_dev->fmt.fmt.pix.height; vpfe_dev->crop = rect; + sel->r = rect; unlock_out: mutex_unlock(&vpfe_dev->lock); return ret; @@ -1760,8 +1776,8 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = { .vidioc_streamon = vpfe_streamon, .vidioc_streamoff = vpfe_streamoff, .vidioc_cropcap = vpfe_cropcap, - .vidioc_g_crop = vpfe_g_crop, - .vidioc_s_crop = vpfe_s_crop, + .vidioc_g_selection = vpfe_g_selection, + .vidioc_s_selection = vpfe_s_selection, .vidioc_default = vpfe_param_handler, }; From 516aca33333d8ea61c1bc0879ed080cbdf196199 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 3 Jul 2016 07:53:31 -0300 Subject: [PATCH 198/591] [media] vpbe_display: convert g/s_crop to g/s_selection This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil Cc: Prabhakar Lad Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/davinci/vpbe_display.c | 65 +++++++++++-------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 0b1709e96673..a9bc0175e4d3 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -440,7 +440,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev, /* * Application initially set the image format. Current display * size is obtained from the vpbe display controller. expected_xsize - * and expected_ysize are set through S_CROP ioctl. Based on this, + * and expected_ysize are set through S_SELECTION ioctl. Based on this, * driver will calculate the scale factors for vertical and * horizontal direction so that the image is displayed scaled * and expanded. Application uses expansion to display the image @@ -649,24 +649,23 @@ static int vpbe_display_querycap(struct file *file, void *priv, return 0; } -static int vpbe_display_s_crop(struct file *file, void *priv, - const struct v4l2_crop *crop) +static int vpbe_display_s_selection(struct file *file, void *priv, + struct v4l2_selection *sel) { struct vpbe_layer *layer = video_drvdata(file); struct vpbe_display *disp_dev = layer->disp_dev; struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; struct osd_layer_config *cfg = &layer->layer_info.config; struct osd_state *osd_device = disp_dev->osd_device; - struct v4l2_rect rect = crop->c; + struct v4l2_rect rect = sel->r; int ret; v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, - "VIDIOC_S_CROP, layer id = %d\n", layer->device_id); + "VIDIOC_S_SELECTION, layer id = %d\n", layer->device_id); - if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) { - v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buf type\n"); + if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || + sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; - } if (rect.top < 0) rect.top = 0; @@ -714,32 +713,45 @@ static int vpbe_display_s_crop(struct file *file, void *priv, else osd_device->ops.set_interpolation_filter(osd_device, 0); + sel->r = rect; return 0; } -static int vpbe_display_g_crop(struct file *file, void *priv, - struct v4l2_crop *crop) +static int vpbe_display_g_selection(struct file *file, void *priv, + struct v4l2_selection *sel) { struct vpbe_layer *layer = video_drvdata(file); struct osd_layer_config *cfg = &layer->layer_info.config; struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev; struct osd_state *osd_device = layer->disp_dev->osd_device; - struct v4l2_rect *rect = &crop->c; + struct v4l2_rect *rect = &sel->r; v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, - "VIDIOC_G_CROP, layer id = %d\n", + "VIDIOC_G_SELECTION, layer id = %d\n", layer->device_id); - if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) { - v4l2_err(&vpbe_dev->v4l2_dev, "Invalid buf type\n"); + if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + osd_device->ops.get_layer_config(osd_device, + layer->layer_info.id, cfg); + rect->top = cfg->ypos; + rect->left = cfg->xpos; + rect->width = cfg->xsize; + rect->height = cfg->ysize; + break; + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP_BOUNDS: + rect->left = 0; + rect->top = 0; + rect->width = vpbe_dev->current_timings.xres; + rect->height = vpbe_dev->current_timings.yres; + break; + default: return -EINVAL; } - osd_device->ops.get_layer_config(osd_device, - layer->layer_info.id, cfg); - rect->top = cfg->ypos; - rect->left = cfg->xpos; - rect->width = cfg->xsize; - rect->height = cfg->ysize; return 0; } @@ -752,13 +764,10 @@ static int vpbe_display_cropcap(struct file *file, void *priv, v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_CROPCAP ioctl\n"); - cropcap->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - cropcap->bounds.left = 0; - cropcap->bounds.top = 0; - cropcap->bounds.width = vpbe_dev->current_timings.xres; - cropcap->bounds.height = vpbe_dev->current_timings.yres; + if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + cropcap->pixelaspect = vpbe_dev->current_timings.aspect; - cropcap->defrect = cropcap->bounds; return 0; } @@ -1251,8 +1260,8 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = { .vidioc_expbuf = vb2_ioctl_expbuf, .vidioc_cropcap = vpbe_display_cropcap, - .vidioc_g_crop = vpbe_display_g_crop, - .vidioc_s_crop = vpbe_display_s_crop, + .vidioc_g_selection = vpbe_display_g_selection, + .vidioc_s_selection = vpbe_display_s_selection, .vidioc_s_std = vpbe_display_s_std, .vidioc_g_std = vpbe_display_g_std, From 1f981a48dc89c40019819464d71185cc37096dfa Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 3 Jul 2016 08:14:17 -0300 Subject: [PATCH 199/591] [media] pvrusb2: convert g/s_crop to g/s_selection This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil Cc: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 81 +++++++++++++++--------- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 81f788b7b242..2cc4d2b6f810 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -719,64 +719,85 @@ static int pvr2_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cap) return ret; } -static int pvr2_g_crop(struct file *file, void *priv, struct v4l2_crop *crop) +static int pvr2_g_selection(struct file *file, void *priv, + struct v4l2_selection *sel) { struct pvr2_v4l2_fh *fh = file->private_data; struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; + struct v4l2_cropcap cap; int val = 0; int ret; - if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - ret = pvr2_ctrl_get_value( - pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPL), &val); - if (ret != 0) + + cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + ret = pvr2_ctrl_get_value( + pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPL), &val); + if (ret != 0) + return -EINVAL; + sel->r.left = val; + ret = pvr2_ctrl_get_value( + pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPT), &val); + if (ret != 0) + return -EINVAL; + sel->r.top = val; + ret = pvr2_ctrl_get_value( + pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPW), &val); + if (ret != 0) + return -EINVAL; + sel->r.width = val; + ret = pvr2_ctrl_get_value( + pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPH), &val); + if (ret != 0) + return -EINVAL; + sel->r.height = val; + break; + case V4L2_SEL_TGT_CROP_DEFAULT: + ret = pvr2_hdw_get_cropcap(hdw, &cap); + sel->r = cap.defrect; + break; + case V4L2_SEL_TGT_CROP_BOUNDS: + ret = pvr2_hdw_get_cropcap(hdw, &cap); + sel->r = cap.bounds; + break; + default: return -EINVAL; - crop->c.left = val; - ret = pvr2_ctrl_get_value( - pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPT), &val); - if (ret != 0) - return -EINVAL; - crop->c.top = val; - ret = pvr2_ctrl_get_value( - pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPW), &val); - if (ret != 0) - return -EINVAL; - crop->c.width = val; - ret = pvr2_ctrl_get_value( - pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPH), &val); - if (ret != 0) - return -EINVAL; - crop->c.height = val; - return 0; + } + return ret; } -static int pvr2_s_crop(struct file *file, void *priv, const struct v4l2_crop *crop) +static int pvr2_s_selection(struct file *file, void *priv, + struct v4l2_selection *sel) { struct pvr2_v4l2_fh *fh = file->private_data; struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; int ret; - if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || + sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; ret = pvr2_ctrl_set_value( pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPL), - crop->c.left); + sel->r.left); if (ret != 0) return -EINVAL; ret = pvr2_ctrl_set_value( pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPT), - crop->c.top); + sel->r.top); if (ret != 0) return -EINVAL; ret = pvr2_ctrl_set_value( pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPW), - crop->c.width); + sel->r.width); if (ret != 0) return -EINVAL; ret = pvr2_ctrl_set_value( pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPH), - crop->c.height); + sel->r.height); if (ret != 0) return -EINVAL; return 0; @@ -798,8 +819,8 @@ static const struct v4l2_ioctl_ops pvr2_ioctl_ops = { .vidioc_enumaudio = pvr2_enumaudio, .vidioc_enum_input = pvr2_enum_input, .vidioc_cropcap = pvr2_cropcap, - .vidioc_s_crop = pvr2_s_crop, - .vidioc_g_crop = pvr2_g_crop, + .vidioc_s_selection = pvr2_s_selection, + .vidioc_g_selection = pvr2_g_selection, .vidioc_g_input = pvr2_g_input, .vidioc_s_input = pvr2_s_input, .vidioc_g_frequency = pvr2_g_frequency, From ecf37493f4bda87b77c83a4f64132e287cb55fc8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 4 Jul 2016 05:08:01 -0300 Subject: [PATCH 200/591] [media] v4l2-subdev: rename cropcap to g_pixelaspect The old cropcap video op is now only used to pass the pixelaspect ratio, so rename it. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv7180.c | 12 ++++++------ drivers/media/platform/rcar-vin/rcar-v4l2.c | 2 +- include/media/v4l2-subdev.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index c367ad6f6327..515ea6ae41d7 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -761,16 +761,16 @@ static int adv7180_g_mbus_config(struct v4l2_subdev *sd, return 0; } -static int adv7180_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *cropcap) +static int adv7180_g_pixelaspect(struct v4l2_subdev *sd, struct v4l2_fract *aspect) { struct adv7180_state *state = to_state(sd); if (state->curr_norm & V4L2_STD_525_60) { - cropcap->pixelaspect.numerator = 11; - cropcap->pixelaspect.denominator = 10; + aspect->numerator = 11; + aspect->denominator = 10; } else { - cropcap->pixelaspect.numerator = 54; - cropcap->pixelaspect.denominator = 59; + aspect->numerator = 54; + aspect->denominator = 59; } return 0; @@ -823,7 +823,7 @@ static const struct v4l2_subdev_video_ops adv7180_video_ops = { .g_input_status = adv7180_g_input_status, .s_routing = adv7180_s_routing, .g_mbus_config = adv7180_g_mbus_config, - .cropcap = adv7180_cropcap, + .g_pixelaspect = adv7180_g_pixelaspect, .g_tvnorms = adv7180_g_tvnorms, .s_stream = adv7180_s_stream, }; diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index d0e9d65b9cf3..62ca7e35517e 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -385,7 +385,7 @@ static int rvin_cropcap(struct file *file, void *priv, if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - return v4l2_subdev_call(sd, video, cropcap, crop); + return v4l2_subdev_call(sd, video, g_pixelaspect, &crop->pixelaspect); } static int rvin_enum_input(struct file *file, void *priv, diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 22ea819ada95..de5117a01b98 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -358,7 +358,7 @@ struct v4l2_mbus_frame_desc { * @s_stream: used to notify the driver that a video stream will start or has * stopped. * - * @cropcap: callback for %VIDIOC_CROPCAP ioctl handler code. + * @g_pixelaspect: callback to return the pixelaspect ratio. * * @g_parm: callback for %VIDIOC_G_PARM ioctl handler code. * @@ -398,7 +398,7 @@ struct v4l2_subdev_video_ops { int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std); int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); int (*s_stream)(struct v4l2_subdev *sd, int enable); - int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc); + int (*g_pixelaspect)(struct v4l2_subdev *sd, struct v4l2_fract *aspect); int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); int (*g_frame_interval)(struct v4l2_subdev *sd, From 0d0abef8d457c96dbb388cac5d3aec81650d8036 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 20 Jul 2016 09:31:25 -0300 Subject: [PATCH 201/591] [media] vivid: return -ENODATA if the current input doesn't support g/s_selection Returning -EINVAL indicates wrong arguments, but that's not the case here. Returning -ENOTTY is also no option, since the ioctl is implemented, but it just is not valid for this input. So use -ENODATA instead. This is also used elsewhere when an ioctl isn't valid for a specific input. In this case G/S_SELECTION returned -EINVAL for the webcam input. That input doesn't support cropping, instead it uses ENUM_FRAMESIZES to enumerate a list of discrete frame sizes. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vivid/vivid-vid-cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index d404a7ce33a4..d5c84ecf2027 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -823,7 +823,7 @@ int vivid_vid_cap_g_selection(struct file *file, void *priv, if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (vivid_is_webcam(dev)) - return -EINVAL; + return -ENODATA; sel->r.left = sel->r.top = 0; switch (sel->target) { @@ -872,7 +872,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (vivid_is_webcam(dev)) - return -EINVAL; + return -ENODATA; switch (s->target) { case V4L2_SEL_TGT_CROP: From 3f8d56b0223d18b58597331cdf8422348dd51870 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 20 Jul 2016 09:39:42 -0300 Subject: [PATCH 202/591] [media] media: doc-rst: document ENODATA for cropping ioctls Document that the cropping ioctls can return ENODATA if the operation isn't supported for the current input or output. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-cropcap.rst | 3 +++ Documentation/media/uapi/v4l/vidioc-g-crop.rst | 3 +++ Documentation/media/uapi/v4l/vidioc-g-selection.rst | 3 +++ 3 files changed, 9 insertions(+) diff --git a/Documentation/media/uapi/v4l/vidioc-cropcap.rst b/Documentation/media/uapi/v4l/vidioc-cropcap.rst index b41fdd69054b..9b7c99eef717 100644 --- a/Documentation/media/uapi/v4l/vidioc-cropcap.rst +++ b/Documentation/media/uapi/v4l/vidioc-cropcap.rst @@ -167,3 +167,6 @@ appropriately. The generic error codes are described at the EINVAL The struct :ref:`v4l2_cropcap ` ``type`` is invalid. + +ENODATA + Cropping is not supported for this input or output. diff --git a/Documentation/media/uapi/v4l/vidioc-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-g-crop.rst index d4b0607162c5..1689b0c523d7 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-crop.rst @@ -112,3 +112,6 @@ Return Value On success 0 is returned, on error -1 and the ``errno`` variable is set appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. + +ENODATA + Cropping is not supported for this input or output. diff --git a/Documentation/media/uapi/v4l/vidioc-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-g-selection.rst index 34be08541ed8..85b5afa48474 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-selection.rst @@ -211,6 +211,9 @@ ERANGE ``r`` rectangle to satisfy all constraints given in the ``flags`` argument. +ENODATA + Selection is not supported for this input or output. + EBUSY It is not possible to apply change of the selection rectangle at the moment. Usually because streaming is in progress. From f22bede31378119e439758ea56f4f79462199a0d Mon Sep 17 00:00:00 2001 From: Ricardo Ribalda Date: Fri, 22 Jul 2016 16:09:06 -0300 Subject: [PATCH 203/591] [media] Documentation: Fix V4L2_CTRL_FLAG_VOLATILE V4L2_CTRL_FLAG_VOLATILE behaviour when V4L2_CTRL_FLAG_EXECUTE_ON_WRITE is set was not properly explained. Also set some hyperlink to ease the Documentation browsing. Credit-to: Hans Verkuil [mchehab@s-opensource.com: fix a trivial merge conflict] Reported-by: Dimitrios Katsaros Signed-off-by: Ricardo Ribalda Delgado Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index 5817264e11ca..db3ad928ec1c 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -754,10 +754,12 @@ See also the examples in :ref:`control`. .. note:: - Setting a new value for a volatile control will have no - effect and no ``V4L2_EVENT_CTRL_CH_VALUE`` will be sent, unless - the ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` flag (see below) is - also set. Otherwise the new value will just be ignored. + Setting a new value for a volatile control will be ignored + unless + :ref:`V4L2_CTRL_FLAG_EXECUTE_ON_WRITE ` + is also set. + Setting a new value for a volatile control will *never* trigger a + :ref:`V4L2_EVENT_CTRL_CH_VALUE ` event. - .. row 9 @@ -773,6 +775,7 @@ See also the examples in :ref:`control`. payload of the control. - .. row 10 + .. _FLAG_EXECUTE_ON_WRITE: - ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` From f223c30f1ee9d327df2761f0546c413aabe8f356 Mon Sep 17 00:00:00 2001 From: Florian Echtler Date: Tue, 31 May 2016 17:15:31 -0300 Subject: [PATCH 204/591] [media] sur40: properly report a single frame rate of 60 FPS The device hardware is always running at 60 FPS, so report this both via PARM_IOCTL and ENUM_FRAMEINTERVALS. [hans.verkuil@cisco.com: fix suspect indent checkpatch warning] [mchehab@s-opensource.com: fix a trivial merge conflict] Signed-off-by: Martin Kaltenbrunner Signed-off-by: Florian Echtler Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/input/touchscreen/sur40.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index 3967d8c651cc..aefb6e11f88a 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c @@ -839,6 +839,19 @@ static int sur40_vidioc_g_fmt(struct file *file, void *priv, return 0; } +static int sur40_ioctl_parm(struct file *file, void *priv, + struct v4l2_streamparm *p) +{ + if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + p->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; + p->parm.capture.timeperframe.numerator = 1; + p->parm.capture.timeperframe.denominator = 60; + p->parm.capture.readbuffers = 3; + return 0; +} + static int sur40_vidioc_enum_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f) { @@ -870,14 +883,14 @@ static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv, { struct sur40_state *sur40 = video_drvdata(file); - if ((f->index > 1) || ((f->pixel_format != V4L2_TCH_FMT_TU08) + if ((f->index > 0) || ((f->pixel_format != V4L2_TCH_FMT_TU08) && (f->pixel_format != V4L2_PIX_FMT_GREY)) || (f->width != sur40->pix_fmt.width) || (f->height != sur40->pix_fmt.height)) return -EINVAL; f->type = V4L2_FRMIVAL_TYPE_DISCRETE; - f->discrete.denominator = 60/(f->index+1); + f->discrete.denominator = 60; f->discrete.numerator = 1; return 0; } @@ -937,6 +950,9 @@ static const struct v4l2_ioctl_ops sur40_video_ioctl_ops = { .vidioc_enum_framesizes = sur40_vidioc_enum_framesizes, .vidioc_enum_frameintervals = sur40_vidioc_enum_frameintervals, + .vidioc_g_parm = sur40_ioctl_parm, + .vidioc_s_parm = sur40_ioctl_parm, + .vidioc_enum_input = sur40_vidioc_enum_input, .vidioc_g_input = sur40_vidioc_g_input, .vidioc_s_input = sur40_vidioc_s_input, From 14150723659af133e4b205ccf6ff8d93c1384014 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 20 Jul 2016 13:07:55 -0300 Subject: [PATCH 205/591] [media] vb2: include lengths in dmabuf qbuf debug message If the VIDIOC_QBUF ioctl fails due a wrong dmabuf length, it's useful to get the invalid and minimum lengths as a debug info. Before this patch: vb2-core: __qbuf_dmabuf: invalid dmabuf length for plane 1 After this patch: vb2-core: __qbuf_dmabuf: invalid dmabuf length 221248 for plane 1, minimum length 410880 Signed-off-by: Javier Martinez Canillas Acked-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index ca8ffeb56d72..3d595186309a 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1228,8 +1228,10 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb) planes[plane].length = dbuf->size; if (planes[plane].length < vb->planes[plane].min_length) { - dprintk(1, "invalid dmabuf length for plane %d\n", - plane); + dprintk(1, "invalid dmabuf length %u for plane %d, " + "minimum length %u\n", + planes[plane].length, plane, + vb->planes[plane].min_length); dma_buf_put(dbuf); ret = -EINVAL; goto err; From 82019205e3a8fc687c4ee6538b57039884be4ccc Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 20 Jul 2016 13:18:25 -0300 Subject: [PATCH 206/591] [media] vb2: remove TODO comment for dma-buf in QBUF There is a TODO comment about the dma-buf being mapped in VIDIOC_QBUF instead of doing it closer to when the actual DMA is going to happen when the buffers are queued in the driver (i.e: __enqueue_in_driver). But there is a reason to do it earlier in QBUF, and is that userspace has no way to know if a exported dma-buf can be imported successfully and so relies on QBUF succeeding as indication that the dma-buf mapped. If QBUF fails, the application can fallback to another streaming I/O method. But moving the dma-buf mapping later when queueing the buffers can be too late for userspace to recover, since it may had dropped the buffer(s) already when it knows that the dma-buf mapping failed. So remove the TODO instead and change the comment to explain this. Suggested-by: Hans Verkuil Signed-off-by: Javier Martinez Canillas Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 3d595186309a..f50ff6f33c6f 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1273,9 +1273,10 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb) vb->planes[plane].mem_priv = mem_priv; } - /* TODO: This pins the buffer(s) with dma_buf_map_attachment()).. but - * really we want to do this just before the DMA, not while queueing - * the buffer(s).. + /* + * This pins the buffer(s) with dma_buf_map_attachment()). It's done + * here instead just before the DMA, while queueing the buffer(s) so + * userspace knows sooner rather than later if the dma-buf map fails. */ for (plane = 0; plane < vb->num_planes; ++plane) { ret = call_memop(vb, map_dmabuf, vb->planes[plane].mem_priv); From 0ff657b0f6120cb53f98b1b42c87af34670edff5 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 21 Jul 2016 09:14:02 -0300 Subject: [PATCH 207/591] [media] vb2: don't return NULL for alloc and get_userptr ops Always return an ERR_PTR() instead of NULL. This makes the behavior of alloc, get_userptr and attach_dmabuf the same. Update the documentation in videobuf2-core.h as well. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-core.c | 12 ++++++++---- drivers/media/v4l2-core/videobuf2-dma-sg.c | 13 +++++++------ drivers/media/v4l2-core/videobuf2-vmalloc.c | 13 ++++++++----- include/media/videobuf2-core.h | 6 +++--- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index f50ff6f33c6f..71d8bd8dcc81 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -198,6 +198,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb) q->is_output ? DMA_TO_DEVICE : DMA_FROM_DEVICE; void *mem_priv; int plane; + int ret = -ENOMEM; /* * Allocate memory for all planes in this buffer @@ -209,8 +210,11 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb) mem_priv = call_ptr_memop(vb, alloc, q->alloc_devs[plane] ? : q->dev, q->dma_attrs, size, dma_dir, q->gfp_flags); - if (IS_ERR_OR_NULL(mem_priv)) + if (IS_ERR(mem_priv)) { + if (mem_priv) + ret = PTR_ERR(mem_priv); goto free; + } /* Associate allocator private data with this plane */ vb->planes[plane].mem_priv = mem_priv; @@ -224,7 +228,7 @@ free: vb->planes[plane - 1].mem_priv = NULL; } - return -ENOMEM; + return ret; } /** @@ -1136,10 +1140,10 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const void *pb) q->alloc_devs[plane] ? : q->dev, planes[plane].m.userptr, planes[plane].length, dma_dir); - if (IS_ERR_OR_NULL(mem_priv)) { + if (IS_ERR(mem_priv)) { dprintk(1, "failed acquiring userspace " "memory for plane %d\n", plane); - ret = mem_priv ? PTR_ERR(mem_priv) : -EINVAL; + ret = PTR_ERR(mem_priv); goto err; } vb->planes[plane].mem_priv = mem_priv; diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index bd82d709ee82..e0165c10b82f 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c @@ -104,11 +104,12 @@ static void *vb2_dma_sg_alloc(struct device *dev, unsigned long dma_attrs, int ret; int num_pages; - if (WARN_ON(dev == NULL)) - return NULL; + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) - return NULL; + return ERR_PTR(-ENOMEM); buf->vaddr = NULL; buf->dma_dir = dma_dir; @@ -166,7 +167,7 @@ fail_pages_alloc: kfree(buf->pages); fail_pages_array_alloc: kfree(buf); - return NULL; + return ERR_PTR(-ENOMEM); } static void vb2_dma_sg_put(void *buf_priv) @@ -226,7 +227,7 @@ static void *vb2_dma_sg_get_userptr(struct device *dev, unsigned long vaddr, buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) - return NULL; + return ERR_PTR(-ENOMEM); buf->vaddr = NULL; buf->dev = dev; @@ -266,7 +267,7 @@ userptr_fail_sgtable: vb2_destroy_framevec(vec); userptr_fail_pfnvec: kfree(buf); - return NULL; + return ERR_PTR(-ENOMEM); } /* diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c index c2820a6e164d..ab3227b75c84 100644 --- a/drivers/media/v4l2-core/videobuf2-vmalloc.c +++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c @@ -41,7 +41,7 @@ static void *vb2_vmalloc_alloc(struct device *dev, unsigned long attrs, buf = kzalloc(sizeof(*buf), GFP_KERNEL | gfp_flags); if (!buf) - return NULL; + return ERR_PTR(-ENOMEM); buf->size = size; buf->vaddr = vmalloc_user(buf->size); @@ -53,7 +53,7 @@ static void *vb2_vmalloc_alloc(struct device *dev, unsigned long attrs, if (!buf->vaddr) { pr_debug("vmalloc of size %ld failed\n", buf->size); kfree(buf); - return NULL; + return ERR_PTR(-ENOMEM); } atomic_inc(&buf->refcount); @@ -77,17 +77,20 @@ static void *vb2_vmalloc_get_userptr(struct device *dev, unsigned long vaddr, struct vb2_vmalloc_buf *buf; struct frame_vector *vec; int n_pages, offset, i; + int ret = -ENOMEM; buf = kzalloc(sizeof(*buf), GFP_KERNEL); if (!buf) - return NULL; + return ERR_PTR(-ENOMEM); buf->dma_dir = dma_dir; offset = vaddr & ~PAGE_MASK; buf->size = size; vec = vb2_create_framevec(vaddr, size, dma_dir == DMA_FROM_DEVICE); - if (IS_ERR(vec)) + if (IS_ERR(vec)) { + ret = PTR_ERR(vec); goto fail_pfnvec_create; + } buf->vec = vec; n_pages = frame_vector_count(vec); if (frame_vector_to_pages(vec) < 0) { @@ -117,7 +120,7 @@ fail_map: fail_pfnvec_create: kfree(buf); - return NULL; + return ERR_PTR(ret); } static void vb2_vmalloc_put_userptr(void *buf_priv) diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index a4a9a55a0c42..b6546db670ca 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -33,7 +33,7 @@ struct vb2_threadio_data; /** * struct vb2_mem_ops - memory handling/memory allocator operations * @alloc: allocate video memory and, optionally, allocator private data, - * return NULL on failure or a pointer to allocator private, + * return ERR_PTR() on failure or a pointer to allocator private, * per-buffer data on success; the returned private structure * will then be passed as buf_priv argument to other ops in this * structure. Additional gfp_flags to use when allocating the @@ -50,14 +50,14 @@ struct vb2_threadio_data; * USERPTR memory types; vaddr is the address passed to the * videobuf layer when queuing a video buffer of USERPTR type; * should return an allocator private per-buffer structure - * associated with the buffer on success, NULL on failure; + * associated with the buffer on success, ERR_PTR() on failure; * the returned private structure will then be passed as buf_priv * argument to other ops in this structure. * @put_userptr: inform the allocator that a USERPTR buffer will no longer * be used. * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation; * used for DMABUF memory types; dev is the alloc device - * dbuf is the shared dma_buf; returns NULL on failure; + * dbuf is the shared dma_buf; returns ERR_PTR() on failure; * allocator private per-buffer structure on success; * this needs to be used for further accesses to the buffer. * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF From 10791829eb52d572915ef621f06e134488d4b204 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 21 Jul 2016 09:14:03 -0300 Subject: [PATCH 208/591] [media] vb2: add WARN_ONs checking if a valid struct device was passed The dma-contig and dma-sg memops require a valid struct device for the DMA to be handled correctly. Call WARN_ON and return ERR_PTR(-EINVAL) if it was NULL. Setting the correct device pointer was forgotten in several new driver submissions. This was caught during code review, but it really should be caught in the code. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 9 +++++++++ drivers/media/v4l2-core/videobuf2-dma-sg.c | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 59fa204b15f3..fb6a177be461 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -141,6 +141,9 @@ static void *vb2_dc_alloc(struct device *dev, unsigned long attrs, { struct vb2_dc_buf *buf; + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -493,6 +496,9 @@ static void *vb2_dc_get_userptr(struct device *dev, unsigned long vaddr, return ERR_PTR(-EINVAL); } + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -673,6 +679,9 @@ static void *vb2_dc_attach_dmabuf(struct device *dev, struct dma_buf *dbuf, if (dbuf->size < size) return ERR_PTR(-EFAULT); + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + buf = kzalloc(sizeof(*buf), GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index e0165c10b82f..ecff8f492c4f 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c @@ -225,6 +225,9 @@ static void *vb2_dma_sg_get_userptr(struct device *dev, unsigned long vaddr, struct sg_table *sgt; struct frame_vector *vec; + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -607,6 +610,9 @@ static void *vb2_dma_sg_attach_dmabuf(struct device *dev, struct dma_buf *dbuf, struct vb2_dma_sg_buf *buf; struct dma_buf_attachment *dba; + if (WARN_ON(!dev)) + return ERR_PTR(-EINVAL); + if (dbuf->size < size) return ERR_PTR(-EFAULT); From bb77c5776b5f39e2e12898ad73df0ce2f08a42ce Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 13 Aug 2016 10:17:04 -0300 Subject: [PATCH 209/591] [media] vidioc-g-dv-timings.rst: document the v4l2_bt_timings reserved field This field was never documented, and neither was it mentioned that it should be zeroed by the application. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index d75bf6742c5d..f143a6b3d927 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -227,6 +227,14 @@ EBUSY - Several flags giving more information about the format. See :ref:`dv-bt-flags` for a description of the flags. + - .. row 17 + + - __u32 + + - ``reserved[14]`` + + - Reserved for future extensions. Drivers and applications must set + the array to zero. .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| From 2ba775d0f643a070ff0820a3059572871d947e6a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Aug 2016 10:27:38 -0300 Subject: [PATCH 210/591] [media] extended-controls.rst: fix a build warning /devel/v4l/patchwork/Documentation/media/uapi/v4l/extended-controls.rst:2116: WARNING: Inline literal start-string without end-string. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/extended-controls.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 9c6aff3e97c1..1f1518e4859d 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -2112,8 +2112,8 @@ enum v4l2_mpeg_video_h264_sei_fp_arrangement_type - .. _v4l2-mpeg-video-h264-fmo-map-type: -``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE`` ```` - (enum) +``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE`` + (enum) enum v4l2_mpeg_video_h264_fmo_map_type - When using FMO, the map type divides the image in different scan From 34d1324edd3154105b7a3985c6c4384d602f2ab6 Mon Sep 17 00:00:00 2001 From: Andrey Utkin Date: Wed, 20 Jul 2016 10:07:12 -0300 Subject: [PATCH 211/591] [media] pci: Add tw5864 driver Support for boards based on Techwell TW5864 chip which provides multichannel video & audio grabbing and encoding (H.264, MJPEG, ADPCM G.726). This submission implements only H.264 encoding of all channels at D1 resolution. Thanks to Mark Thompson for help, and for contribution of H.264 startcode emulation prevention code. Signed-off-by: Andrey Utkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 8 + drivers/media/pci/Kconfig | 1 + drivers/media/pci/Makefile | 1 + drivers/media/pci/tw5864/Kconfig | 11 + drivers/media/pci/tw5864/Makefile | 3 + drivers/media/pci/tw5864/tw5864-core.c | 359 ++++ drivers/media/pci/tw5864/tw5864-h264.c | 259 +++ drivers/media/pci/tw5864/tw5864-reg.h | 2133 +++++++++++++++++++++++ drivers/media/pci/tw5864/tw5864-util.c | 37 + drivers/media/pci/tw5864/tw5864-video.c | 1514 ++++++++++++++++ drivers/media/pci/tw5864/tw5864.h | 205 +++ 11 files changed, 4531 insertions(+) create mode 100644 drivers/media/pci/tw5864/Kconfig create mode 100644 drivers/media/pci/tw5864/Makefile create mode 100644 drivers/media/pci/tw5864/tw5864-core.c create mode 100644 drivers/media/pci/tw5864/tw5864-h264.c create mode 100644 drivers/media/pci/tw5864/tw5864-reg.h create mode 100644 drivers/media/pci/tw5864/tw5864-util.c create mode 100644 drivers/media/pci/tw5864/tw5864-video.c create mode 100644 drivers/media/pci/tw5864/tw5864.h diff --git a/MAINTAINERS b/MAINTAINERS index 998fd6b767f2..0a16a820fd56 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11839,6 +11839,14 @@ T: git git://linuxtv.org/media_tree.git S: Odd fixes F: drivers/media/usb/tm6000/ +TW5864 VIDEO4LINUX DRIVER +M: Bluecherry Maintainers +M: Andrey Utkin +M: Andrey Utkin +L: linux-media@vger.kernel.org +S: Supported +F: drivers/media/pci/tw5864/ + TW68 VIDEO4LINUX DRIVER M: Hans Verkuil L: linux-media@vger.kernel.org diff --git a/drivers/media/pci/Kconfig b/drivers/media/pci/Kconfig index 4f6467fbaeb4..da28e68c87d8 100644 --- a/drivers/media/pci/Kconfig +++ b/drivers/media/pci/Kconfig @@ -13,6 +13,7 @@ if MEDIA_CAMERA_SUPPORT source "drivers/media/pci/meye/Kconfig" source "drivers/media/pci/solo6x10/Kconfig" source "drivers/media/pci/sta2x11/Kconfig" +source "drivers/media/pci/tw5864/Kconfig" source "drivers/media/pci/tw68/Kconfig" source "drivers/media/pci/tw686x/Kconfig" source "drivers/media/pci/zoran/Kconfig" diff --git a/drivers/media/pci/Makefile b/drivers/media/pci/Makefile index 2e54c36441f7..a7e8af0f64a7 100644 --- a/drivers/media/pci/Makefile +++ b/drivers/media/pci/Makefile @@ -31,3 +31,4 @@ obj-$(CONFIG_VIDEO_MEYE) += meye/ obj-$(CONFIG_STA2X11_VIP) += sta2x11/ obj-$(CONFIG_VIDEO_SOLO6X10) += solo6x10/ obj-$(CONFIG_VIDEO_COBALT) += cobalt/ +obj-$(CONFIG_VIDEO_TW5864) += tw5864/ diff --git a/drivers/media/pci/tw5864/Kconfig b/drivers/media/pci/tw5864/Kconfig new file mode 100644 index 000000000000..760fb11dfeae --- /dev/null +++ b/drivers/media/pci/tw5864/Kconfig @@ -0,0 +1,11 @@ +config VIDEO_TW5864 + tristate "Techwell TW5864 video/audio grabber and encoder" + depends on VIDEO_DEV && PCI && VIDEO_V4L2 + select VIDEOBUF2_DMA_CONTIG + ---help--- + Support for boards based on Techwell TW5864 chip which provides + multichannel video & audio grabbing and encoding (H.264, MJPEG, + ADPCM G.726). + + To compile this driver as a module, choose M here: the + module will be called tw5864. diff --git a/drivers/media/pci/tw5864/Makefile b/drivers/media/pci/tw5864/Makefile new file mode 100644 index 000000000000..4fc8b3b1a45a --- /dev/null +++ b/drivers/media/pci/tw5864/Makefile @@ -0,0 +1,3 @@ +tw5864-objs := tw5864-core.o tw5864-video.o tw5864-h264.o tw5864-util.o + +obj-$(CONFIG_VIDEO_TW5864) += tw5864.o diff --git a/drivers/media/pci/tw5864/tw5864-core.c b/drivers/media/pci/tw5864/tw5864-core.c new file mode 100644 index 000000000000..440cd7bb8d04 --- /dev/null +++ b/drivers/media/pci/tw5864/tw5864-core.c @@ -0,0 +1,359 @@ +/* + * TW5864 driver - core functions + * + * Copyright (C) 2016 Bluecherry, LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tw5864.h" +#include "tw5864-reg.h" + +MODULE_DESCRIPTION("V4L2 driver module for tw5864-based multimedia capture & encoding devices"); +MODULE_AUTHOR("Bluecherry Maintainers "); +MODULE_AUTHOR("Andrey Utkin "); +MODULE_LICENSE("GPL"); + +/* + * BEWARE OF KNOWN ISSUES WITH VIDEO QUALITY + * + * This driver was developed by Bluecherry LLC by deducing behaviour of + * original manufacturer's driver, from both source code and execution traces. + * It is known that there are some artifacts on output video with this driver: + * - on all known hardware samples: random pixels of wrong color (mostly + * white, red or blue) appearing and disappearing on sequences of P-frames; + * - on some hardware samples (known with H.264 core version e006:2800): + * total madness on P-frames: blocks of wrong luminance; blocks of wrong + * colors "creeping" across the picture. + * There is a workaround for both issues: avoid P-frames by setting GOP size + * to 1. To do that, run this command on device files created by this driver: + * + * v4l2-ctl --device /dev/videoX --set-ctrl=video_gop_size=1 + * + * These issues are not decoding errors; all produced H.264 streams are decoded + * properly. Streams without P-frames don't have these artifacts so it's not + * analog-to-digital conversion issues nor internal memory errors; we conclude + * it's internal H.264 encoder issues. + * We cannot even check the original driver's behaviour because it has never + * worked properly at all in our development environment. So these issues may + * be actually related to firmware or hardware. However it may be that there's + * just some more register settings missing in the driver which would please + * the hardware. + * Manufacturer didn't help much on our inquiries, but feel free to disturb + * again the support of Intersil (owner of former Techwell). + */ + +/* take first free /dev/videoX indexes by default */ +static unsigned int video_nr[] = {[0 ... (TW5864_INPUTS - 1)] = -1 }; + +module_param_array(video_nr, int, NULL, 0444); +MODULE_PARM_DESC(video_nr, "video devices numbers array"); + +/* + * Please add any new PCI IDs to: http://pci-ids.ucw.cz. This keeps + * the PCI ID database up to date. Note that the entries must be + * added under vendor 0x1797 (Techwell Inc.) as subsystem IDs. + */ +static const struct pci_device_id tw5864_pci_tbl[] = { + {PCI_DEVICE(PCI_VENDOR_ID_TECHWELL, PCI_DEVICE_ID_TECHWELL_5864)}, + {0,} +}; + +void tw5864_irqmask_apply(struct tw5864_dev *dev) +{ + tw_writel(TW5864_INTR_ENABLE_L, dev->irqmask & 0xffff); + tw_writel(TW5864_INTR_ENABLE_H, (dev->irqmask >> 16)); +} + +static void tw5864_interrupts_disable(struct tw5864_dev *dev) +{ + unsigned long flags; + + spin_lock_irqsave(&dev->slock, flags); + dev->irqmask = 0; + tw5864_irqmask_apply(dev); + spin_unlock_irqrestore(&dev->slock, flags); +} + +static void tw5864_timer_isr(struct tw5864_dev *dev); +static void tw5864_h264_isr(struct tw5864_dev *dev); + +static irqreturn_t tw5864_isr(int irq, void *dev_id) +{ + struct tw5864_dev *dev = dev_id; + u32 status; + + status = tw_readl(TW5864_INTR_STATUS_L) | + tw_readl(TW5864_INTR_STATUS_H) << 16; + if (!status) + return IRQ_NONE; + + tw_writel(TW5864_INTR_CLR_L, 0xffff); + tw_writel(TW5864_INTR_CLR_H, 0xffff); + + if (status & TW5864_INTR_VLC_DONE) + tw5864_h264_isr(dev); + + if (status & TW5864_INTR_TIMER) + tw5864_timer_isr(dev); + + if (!(status & (TW5864_INTR_TIMER | TW5864_INTR_VLC_DONE))) { + dev_dbg(&dev->pci->dev, "Unknown interrupt, status 0x%08X\n", + status); + } + + return IRQ_HANDLED; +} + +static void tw5864_h264_isr(struct tw5864_dev *dev) +{ + int channel = tw_readl(TW5864_DSP) & TW5864_DSP_ENC_CHN; + struct tw5864_input *input = &dev->inputs[channel]; + int cur_frame_index, next_frame_index; + struct tw5864_h264_frame *cur_frame, *next_frame; + unsigned long flags; + + spin_lock_irqsave(&dev->slock, flags); + + cur_frame_index = dev->h264_buf_w_index; + next_frame_index = (cur_frame_index + 1) % H264_BUF_CNT; + cur_frame = &dev->h264_buf[cur_frame_index]; + next_frame = &dev->h264_buf[next_frame_index]; + + if (next_frame_index != dev->h264_buf_r_index) { + cur_frame->vlc_len = tw_readl(TW5864_VLC_LENGTH) << 2; + cur_frame->checksum = tw_readl(TW5864_VLC_CRC_REG); + cur_frame->input = input; + cur_frame->timestamp = ktime_get_ns(); + cur_frame->seqno = input->frame_seqno; + cur_frame->gop_seqno = input->frame_gop_seqno; + + dev->h264_buf_w_index = next_frame_index; + tasklet_schedule(&dev->tasklet); + + cur_frame = next_frame; + + spin_lock_irqsave(&input->slock, flags); + input->frame_seqno++; + input->frame_gop_seqno++; + if (input->frame_gop_seqno >= input->gop) + input->frame_gop_seqno = 0; + spin_unlock_irqrestore(&input->slock, flags); + } else { + dev_err(&dev->pci->dev, + "Skipped frame on input %d because all buffers busy\n", + channel); + } + + dev->encoder_busy = 0; + + spin_unlock_irqrestore(&dev->slock, flags); + + tw_writel(TW5864_VLC_STREAM_BASE_ADDR, cur_frame->vlc.dma_addr); + tw_writel(TW5864_MV_STREAM_BASE_ADDR, cur_frame->mv.dma_addr); + + /* Additional ack for this interrupt */ + tw_writel(TW5864_VLC_DSP_INTR, 0x00000001); + tw_writel(TW5864_PCI_INTR_STATUS, TW5864_VLC_DONE_INTR); +} + +static void tw5864_input_deadline_update(struct tw5864_input *input) +{ + input->new_frame_deadline = jiffies + msecs_to_jiffies(1000); +} + +static void tw5864_timer_isr(struct tw5864_dev *dev) +{ + unsigned long flags; + int i; + int encoder_busy; + + /* Additional ack for this interrupt */ + tw_writel(TW5864_PCI_INTR_STATUS, TW5864_TIMER_INTR); + + spin_lock_irqsave(&dev->slock, flags); + encoder_busy = dev->encoder_busy; + spin_unlock_irqrestore(&dev->slock, flags); + + if (encoder_busy) + return; + + /* + * Traversing inputs in round-robin fashion, starting from next to the + * last processed one + */ + for (i = 0; i < TW5864_INPUTS; i++) { + int next_input = (i + dev->next_input) % TW5864_INPUTS; + struct tw5864_input *input = &dev->inputs[next_input]; + int raw_buf_id; /* id of internal buf with last raw frame */ + + spin_lock_irqsave(&input->slock, flags); + if (!input->enabled) + goto next; + + /* Check if new raw frame is available */ + raw_buf_id = tw_mask_shift_readl(TW5864_SENIF_ORG_FRM_PTR1, 0x3, + 2 * input->nr); + + if (input->buf_id != raw_buf_id) { + input->buf_id = raw_buf_id; + tw5864_input_deadline_update(input); + spin_unlock_irqrestore(&input->slock, flags); + + spin_lock_irqsave(&dev->slock, flags); + dev->encoder_busy = 1; + dev->next_input = (next_input + 1) % TW5864_INPUTS; + spin_unlock_irqrestore(&dev->slock, flags); + + tw5864_request_encoded_frame(input); + break; + } + + /* No new raw frame; check if channel is stuck */ + if (time_is_after_jiffies(input->new_frame_deadline)) { + /* If stuck, request new raw frames again */ + tw_mask_shift_writel(TW5864_ENC_BUF_PTR_REC1, 0x3, + 2 * input->nr, input->buf_id + 3); + tw5864_input_deadline_update(input); + } +next: + spin_unlock_irqrestore(&input->slock, flags); + } +} + +static int tw5864_initdev(struct pci_dev *pci_dev, + const struct pci_device_id *pci_id) +{ + struct tw5864_dev *dev; + int err; + + dev = devm_kzalloc(&pci_dev->dev, sizeof(*dev), GFP_KERNEL); + if (!dev) + return -ENOMEM; + + snprintf(dev->name, sizeof(dev->name), "tw5864:%s", pci_name(pci_dev)); + + err = v4l2_device_register(&pci_dev->dev, &dev->v4l2_dev); + if (err) + return err; + + /* pci init */ + dev->pci = pci_dev; + err = pci_enable_device(pci_dev); + if (err) { + dev_err(&dev->pci->dev, "pci_enable_device() failed\n"); + goto unreg_v4l2; + } + + pci_set_master(pci_dev); + + err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); + if (err) { + dev_err(&dev->pci->dev, "32 bit PCI DMA is not supported\n"); + goto disable_pci; + } + + /* get mmio */ + err = pci_request_regions(pci_dev, dev->name); + if (err) { + dev_err(&dev->pci->dev, "Cannot request regions for MMIO\n"); + goto disable_pci; + } + dev->mmio = pci_ioremap_bar(pci_dev, 0); + if (!dev->mmio) { + err = -EIO; + dev_err(&dev->pci->dev, "can't ioremap() MMIO memory\n"); + goto release_mmio; + } + + spin_lock_init(&dev->slock); + + dev_info(&pci_dev->dev, "TW5864 hardware version: %04x\n", + tw_readl(TW5864_HW_VERSION)); + dev_info(&pci_dev->dev, "TW5864 H.264 core version: %04x:%04x\n", + tw_readl(TW5864_H264REV), + tw_readl(TW5864_UNDECLARED_H264REV_PART2)); + + err = tw5864_video_init(dev, video_nr); + if (err) + goto unmap_mmio; + + /* get irq */ + err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw5864_isr, + IRQF_SHARED, "tw5864", dev); + if (err < 0) { + dev_err(&dev->pci->dev, "can't get IRQ %d\n", pci_dev->irq); + goto fini_video; + } + + dev_info(&pci_dev->dev, "Note: there are known video quality issues. For details\n"); + dev_info(&pci_dev->dev, "see the comment in drivers/media/pci/tw5864/tw5864-core.c.\n"); + + return 0; + +fini_video: + tw5864_video_fini(dev); +unmap_mmio: + iounmap(dev->mmio); +release_mmio: + pci_release_regions(pci_dev); +disable_pci: + pci_disable_device(pci_dev); +unreg_v4l2: + v4l2_device_unregister(&dev->v4l2_dev); + return err; +} + +static void tw5864_finidev(struct pci_dev *pci_dev) +{ + struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); + struct tw5864_dev *dev = + container_of(v4l2_dev, struct tw5864_dev, v4l2_dev); + + /* shutdown subsystems */ + tw5864_interrupts_disable(dev); + + /* unregister */ + tw5864_video_fini(dev); + + /* release resources */ + iounmap(dev->mmio); + release_mem_region(pci_resource_start(pci_dev, 0), + pci_resource_len(pci_dev, 0)); + + v4l2_device_unregister(&dev->v4l2_dev); + devm_kfree(&pci_dev->dev, dev); +} + +static struct pci_driver tw5864_pci_driver = { + .name = "tw5864", + .id_table = tw5864_pci_tbl, + .probe = tw5864_initdev, + .remove = tw5864_finidev, +}; + +module_pci_driver(tw5864_pci_driver); diff --git a/drivers/media/pci/tw5864/tw5864-h264.c b/drivers/media/pci/tw5864/tw5864-h264.c new file mode 100644 index 000000000000..330d200f52cd --- /dev/null +++ b/drivers/media/pci/tw5864/tw5864-h264.c @@ -0,0 +1,259 @@ +/* + * TW5864 driver - H.264 headers generation functions + * + * Copyright (C) 2016 Bluecherry, LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include + +#include "tw5864.h" + +static u8 marker[] = { 0x00, 0x00, 0x00, 0x01 }; + +/* + * Exponential-Golomb coding functions + * + * These functions are used for generation of H.264 bitstream headers. + * + * This code is derived from tw5864 reference driver by manufacturers, which + * itself apparently was derived from x264 project. + */ + +/* Bitstream writing context */ +struct bs { + u8 *buf; /* pointer to buffer beginning */ + u8 *buf_end; /* pointer to buffer end */ + u8 *ptr; /* pointer to current byte in buffer */ + unsigned int bits_left; /* number of available bits in current byte */ +}; + +static void bs_init(struct bs *s, void *buf, int size) +{ + s->buf = buf; + s->ptr = buf; + s->buf_end = s->ptr + size; + s->bits_left = 8; +} + +static int bs_len(struct bs *s) +{ + return s->ptr - s->buf; +} + +static void bs_write(struct bs *s, int count, u32 bits) +{ + if (s->ptr >= s->buf_end - 4) + return; + while (count > 0) { + if (count < 32) + bits &= (1 << count) - 1; + if (count < s->bits_left) { + *s->ptr = (*s->ptr << count) | bits; + s->bits_left -= count; + break; + } + *s->ptr = (*s->ptr << s->bits_left) | + (bits >> (count - s->bits_left)); + count -= s->bits_left; + s->ptr++; + s->bits_left = 8; + } +} + +static void bs_write1(struct bs *s, u32 bit) +{ + if (s->ptr < s->buf_end) { + *s->ptr <<= 1; + *s->ptr |= bit; + s->bits_left--; + if (s->bits_left == 0) { + s->ptr++; + s->bits_left = 8; + } + } +} + +static void bs_write_ue(struct bs *s, u32 val) +{ + if (val == 0) { + bs_write1(s, 1); + } else { + val++; + bs_write(s, 2 * fls(val) - 1, val); + } +} + +static void bs_write_se(struct bs *s, int val) +{ + bs_write_ue(s, val <= 0 ? -val * 2 : val * 2 - 1); +} + +static void bs_rbsp_trailing(struct bs *s) +{ + bs_write1(s, 1); + if (s->bits_left != 8) + bs_write(s, s->bits_left, 0x00); +} + +/* H.264 headers generation functions */ + +static int tw5864_h264_gen_sps_rbsp(u8 *buf, size_t size, int width, int height) +{ + struct bs bs, *s; + + s = &bs; + bs_init(s, buf, size); + bs_write(s, 8, 0x42); /* profile_idc, baseline */ + bs_write(s, 1, 1); /* constraint_set0_flag */ + bs_write(s, 1, 1); /* constraint_set1_flag */ + bs_write(s, 1, 0); /* constraint_set2_flag */ + bs_write(s, 5, 0); /* reserved_zero_5bits */ + bs_write(s, 8, 0x1e); /* level_idc */ + bs_write_ue(s, 0); /* seq_parameter_set_id */ + bs_write_ue(s, ilog2(MAX_GOP_SIZE) - 4); /* log2_max_frame_num_minus4 */ + bs_write_ue(s, 0); /* pic_order_cnt_type */ + /* log2_max_pic_order_cnt_lsb_minus4 */ + bs_write_ue(s, ilog2(MAX_GOP_SIZE) - 4); + bs_write_ue(s, 1); /* num_ref_frames */ + bs_write(s, 1, 0); /* gaps_in_frame_num_value_allowed_flag */ + bs_write_ue(s, width / 16 - 1); /* pic_width_in_mbs_minus1 */ + bs_write_ue(s, height / 16 - 1); /* pic_height_in_map_units_minus1 */ + bs_write(s, 1, 1); /* frame_mbs_only_flag */ + bs_write(s, 1, 0); /* direct_8x8_inference_flag */ + bs_write(s, 1, 0); /* frame_cropping_flag */ + bs_write(s, 1, 0); /* vui_parameters_present_flag */ + bs_rbsp_trailing(s); + return bs_len(s); +} + +static int tw5864_h264_gen_pps_rbsp(u8 *buf, size_t size, int qp) +{ + struct bs bs, *s; + + s = &bs; + bs_init(s, buf, size); + bs_write_ue(s, 0); /* pic_parameter_set_id */ + bs_write_ue(s, 0); /* seq_parameter_set_id */ + bs_write(s, 1, 0); /* entropy_coding_mode_flag */ + bs_write(s, 1, 0); /* pic_order_present_flag */ + bs_write_ue(s, 0); /* num_slice_groups_minus1 */ + bs_write_ue(s, 0); /* i_num_ref_idx_l0_active_minus1 */ + bs_write_ue(s, 0); /* i_num_ref_idx_l1_active_minus1 */ + bs_write(s, 1, 0); /* weighted_pred_flag */ + bs_write(s, 2, 0); /* weighted_bipred_idc */ + bs_write_se(s, qp - 26); /* pic_init_qp_minus26 */ + bs_write_se(s, qp - 26); /* pic_init_qs_minus26 */ + bs_write_se(s, 0); /* chroma_qp_index_offset */ + bs_write(s, 1, 0); /* deblocking_filter_control_present_flag */ + bs_write(s, 1, 0); /* constrained_intra_pred_flag */ + bs_write(s, 1, 0); /* redundant_pic_cnt_present_flag */ + bs_rbsp_trailing(s); + return bs_len(s); +} + +static int tw5864_h264_gen_slice_head(u8 *buf, size_t size, + unsigned int idr_pic_id, + unsigned int frame_gop_seqno, + int *tail_nb_bits, u8 *tail) +{ + struct bs bs, *s; + int is_i_frame = frame_gop_seqno == 0; + + s = &bs; + bs_init(s, buf, size); + bs_write_ue(s, 0); /* first_mb_in_slice */ + bs_write_ue(s, is_i_frame ? 2 : 5); /* slice_type - I or P */ + bs_write_ue(s, 0); /* pic_parameter_set_id */ + bs_write(s, ilog2(MAX_GOP_SIZE), frame_gop_seqno); /* frame_num */ + if (is_i_frame) + bs_write_ue(s, idr_pic_id); + + /* pic_order_cnt_lsb */ + bs_write(s, ilog2(MAX_GOP_SIZE), frame_gop_seqno); + + if (is_i_frame) { + bs_write1(s, 0); /* no_output_of_prior_pics_flag */ + bs_write1(s, 0); /* long_term_reference_flag */ + } else { + bs_write1(s, 0); /* num_ref_idx_active_override_flag */ + bs_write1(s, 0); /* ref_pic_list_reordering_flag_l0 */ + bs_write1(s, 0); /* adaptive_ref_pic_marking_mode_flag */ + } + + bs_write_se(s, 0); /* slice_qp_delta */ + + if (s->bits_left != 8) { + *tail = ((s->ptr[0]) << s->bits_left); + *tail_nb_bits = 8 - s->bits_left; + } else { + *tail = 0; + *tail_nb_bits = 0; + } + + return bs_len(s); +} + +void tw5864_h264_put_stream_header(u8 **buf, size_t *space_left, int qp, + int width, int height) +{ + int nal_len; + + /* SPS */ + memcpy(*buf, marker, sizeof(marker)); + *buf += 4; + *space_left -= 4; + + **buf = 0x67; /* SPS NAL header */ + *buf += 1; + *space_left -= 1; + + nal_len = tw5864_h264_gen_sps_rbsp(*buf, *space_left, width, height); + *buf += nal_len; + *space_left -= nal_len; + + /* PPS */ + memcpy(*buf, marker, sizeof(marker)); + *buf += 4; + *space_left -= 4; + + **buf = 0x68; /* PPS NAL header */ + *buf += 1; + *space_left -= 1; + + nal_len = tw5864_h264_gen_pps_rbsp(*buf, *space_left, qp); + *buf += nal_len; + *space_left -= nal_len; +} + +void tw5864_h264_put_slice_header(u8 **buf, size_t *space_left, + unsigned int idr_pic_id, + unsigned int frame_gop_seqno, + int *tail_nb_bits, u8 *tail) +{ + int nal_len; + + memcpy(*buf, marker, sizeof(marker)); + *buf += 4; + *space_left -= 4; + + /* Frame NAL header */ + **buf = (frame_gop_seqno == 0) ? 0x25 : 0x21; + *buf += 1; + *space_left -= 1; + + nal_len = tw5864_h264_gen_slice_head(*buf, *space_left, idr_pic_id, + frame_gop_seqno, tail_nb_bits, + tail); + *buf += nal_len; + *space_left -= nal_len; +} diff --git a/drivers/media/pci/tw5864/tw5864-reg.h b/drivers/media/pci/tw5864/tw5864-reg.h new file mode 100644 index 000000000000..92a1b077ef8a --- /dev/null +++ b/drivers/media/pci/tw5864/tw5864-reg.h @@ -0,0 +1,2133 @@ +/* + * TW5864 driver - registers description + * + * Copyright (C) 2016 Bluecherry, LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/* According to TW5864_datasheet_0.6d.pdf, tw5864b1-ds.pdf */ + +/* Register Description - Direct Map Space */ +/* 0x0000 ~ 0x1ffc - H264 Register Map */ +/* [15:0] The Version register for H264 core (Read Only) */ +#define TW5864_H264REV 0x0000 + +#define TW5864_EMU 0x0004 +/* Define controls in register TW5864_EMU */ +/* DDR controller enabled */ +#define TW5864_EMU_EN_DDR BIT(0) +/* Enable bit for Inter module */ +#define TW5864_EMU_EN_ME BIT(1) +/* Enable bit for Sensor Interface module */ +#define TW5864_EMU_EN_SEN BIT(2) +/* Enable bit for Host Burst Access */ +#define TW5864_EMU_EN_BHOST BIT(3) +/* Enable bit for Loop Filter module */ +#define TW5864_EMU_EN_LPF BIT(4) +/* Enable bit for PLBK module */ +#define TW5864_EMU_EN_PLBK BIT(5) +/* + * Video Frame mapping in DDR + * 00 CIF + * 01 D1 + * 10 Reserved + * 11 Reserved + * + */ +#define TW5864_DSP_FRAME_TYPE (3 << 6) +#define TW5864_DSP_FRAME_TYPE_D1 BIT(6) + +#define TW5864_UNDECLARED_H264REV_PART2 0x0008 + +#define TW5864_SLICE 0x000c +/* Define controls in register TW5864_SLICE */ +/* VLC Slice end flag */ +#define TW5864_VLC_SLICE_END BIT(0) +/* Master Slice End Flag */ +#define TW5864_MAS_SLICE_END BIT(4) +/* Host to start a new slice Address */ +#define TW5864_START_NSLICE BIT(15) + +/* + * [15:0] Two bit for each channel (channel 0 ~ 7). Each two bits are the buffer + * pointer for the last encoded frame of the corresponding channel. + */ +#define TW5864_ENC_BUF_PTR_REC1 0x0010 + +/* [5:0] DSP_MB_QP and [15:10] DSP_LPF_OFFSET */ +#define TW5864_DSP_QP 0x0018 +/* Define controls in register TW5864_DSP_QP */ +/* [5:0] H264 QP Value for codec */ +#define TW5864_DSP_MB_QP 0x003f +/* + * [15:10] H264 LPF_OFFSET Address + * (Default 0) + */ +#define TW5864_DSP_LPF_OFFSET 0xfc00 + +#define TW5864_DSP_CODEC 0x001c +/* Define controls in register TW5864_DSP_CODEC */ +/* + * 0: Encode (TW5864 Default) + * 1: Decode + */ +#define TW5864_DSP_CODEC_MODE BIT(0) +/* + * 0->3 4 VLC data buffer in DDR (1M each) + * 0->7 8 VLC data buffer in DDR (512k each) + */ +#define TW5864_VLC_BUF_ID (7 << 2) +/* + * 0 4CIF in 1 MB + * 1 1CIF in 1 MB + */ +#define TW5864_CIF_MAP_MD BIT(6) +/* + * 0 2 falf D1 in 1 MB + * 1 1 half D1 in 1 MB + */ +#define TW5864_HD1_MAP_MD BIT(7) +/* VLC Stream valid */ +#define TW5864_VLC_VLD BIT(8) +/* MV Vector Valid */ +#define TW5864_MV_VECT_VLD BIT(9) +/* MV Flag Valid */ +#define TW5864_MV_FLAG_VLD BIT(10) + +#define TW5864_DSP_SEN 0x0020 +/* Define controls in register TW5864_DSP_SEN */ +/* Org Buffer Base for Luma (default 0) */ +#define TW5864_DSP_SEN_PIC_LU 0x000f +/* Org Buffer Base for Chroma (default 4) */ +#define TW5864_DSP_SEN_PIC_CHM 0x00f0 +/* Maximum Number of Buffers (default 4) */ +#define TW5864_DSP_SEN_PIC_MAX 0x0700 +/* + * Original Frame D1 or HD1 switch + * (Default 0) + */ +#define TW5864_DSP_SEN_HFULL 0x1000 + +#define TW5864_DSP_REF_PIC 0x0024 +/* Define controls in register TW5864_DSP_REF_PIC */ +/* Ref Buffer Base for Luma (default 0) */ +#define TW5864_DSP_REF_PIC_LU 0x000f +/* Ref Buffer Base for Chroma (default 4) */ +#define TW5864_DSP_REF_PIC_CHM 0x00f0 +/* Maximum Number of Buffers (default 4) */ +#define TW5864_DSP_REF_PIC_MAX 0x0700 + +/* [15:0] SEN_EN_CH[n] SENIF original frame capture enable for each channel */ +#define TW5864_SEN_EN_CH 0x0028 + +#define TW5864_DSP 0x002c +/* Define controls in register TW5864_DSP */ +/* The ID for channel selected for encoding operation */ +#define TW5864_DSP_ENC_CHN 0x000f +/* See DSP_MB_DELAY below */ +#define TW5864_DSP_MB_WAIT 0x0010 +/* + * DSP Chroma Switch + * 0 DDRB + * 1 DDRA + */ +#define TW5864_DSP_CHROM_SW 0x0020 +/* VLC Flow Control: 1 for enable */ +#define TW5864_DSP_FLW_CNTL 0x0040 +/* + * If DSP_MB_WAIT == 0, MB delay is DSP_MB_DELAY * 16 + * If DSP_MB_DELAY == 1, MB delay is DSP_MB_DELAY * 128 + */ +#define TW5864_DSP_MB_DELAY 0x0f00 + +#define TW5864_DDR 0x0030 +/* Define controls in register TW5864_DDR */ +/* DDR Single Access Page Number */ +#define TW5864_DDR_PAGE_CNTL 0x00ff +/* DDR-DPR Burst Read Enable */ +#define TW5864_DDR_BRST_EN BIT(13) +/* + * DDR A/B Select as HOST access + * 0 Select DDRA + * 1 Select DDRB + */ +#define TW5864_DDR_AB_SEL BIT(14) +/* + * DDR Access Mode Select + * 0 Single R/W Access (Host <-> DDR) + * 1 Burst R/W Access (Host <-> DPR) + */ +#define TW5864_DDR_MODE BIT(15) + +/* The original frame capture pointer. Two bits for each channel */ +/* SENIF_ORG_FRM_PTR [15:0] */ +#define TW5864_SENIF_ORG_FRM_PTR1 0x0038 +/* SENIF_ORG_FRM_PTR [31:16] */ +#define TW5864_SENIF_ORG_FRM_PTR2 0x003c + +#define TW5864_DSP_SEN_MODE 0x0040 +/* Define controls in register TW5864_DSP_SEN_MODE */ +#define TW5864_DSP_SEN_MODE_CH0 0x000f +#define TW5864_DSP_SEN_MODE_CH1 0x00f0 + +/* + * [15:0]: ENC_BUF_PTR_REC[31:16] Two bit for each channel (channel 8 ~ 15). + * Each two bits are the buffer pointer for the last encoded frame of a channel + */ +#define TW5864_ENC_BUF_PTR_REC2 0x004c + +/* Current MV Flag Status Pointer for Channel n. (Read only) */ +/* + * [1:0] CH0_MV_PTR, ..., [15:14] CH7_MV_PTR + */ +#define TW5864_CH_MV_PTR1 0x0060 +/* + * [1:0] CH8_MV_PTR, ..., [15:14] CH15_MV_PTR + */ +#define TW5864_CH_MV_PTR2 0x0064 + +/* + * [15:0] Reset Current MV Flag Status Pointer for Channel n (one bit each) + */ +#define TW5864_RST_MV_PTR 0x0068 +#define TW5864_INTERLACING 0x0200 +/* Define controls in register TW5864_INTERLACING */ +/* + * Inter_Mode Start. 2-nd bit? A guess. Missing in datasheet. Without this bit + * set, the output video is interlaced (stripy). + */ +#define TW5864_DSP_INTER_ST BIT(1) +/* Deinterlacer Enable */ +#define TW5864_DI_EN BIT(2) +/* + * De-interlacer Mode + * 1 Shuffled frame + * 0 Normal Un-Shuffled Frame + */ +#define TW5864_DI_MD BIT(3) +/* + * Down scale original frame in X direction + * 11: Un-used + * 10: down-sample to 1/4 + * 01: down-sample to 1/2 + * 00: down-sample disabled + */ +#define TW5864_DSP_DWN_X (3 << 4) +/* + * Down scale original frame in Y direction + * 11: Un-used + * 10: down-sample to 1/4 + * 01: down-sample to 1/2 + * 00: down-sample disabled + */ +#define TW5864_DSP_DWN_Y (3 << 6) +/* + * 1 Dual Stream + * 0 Single Stream + */ +#define TW5864_DUAL_STR BIT(8) + +#define TW5864_DSP_REF 0x0204 +/* Define controls in register TW5864_DSP_REF */ +/* Number of reference frame (Default 1 for TW5864B) */ +#define TW5864_DSP_REF_FRM 0x000f +/* Window size */ +#define TW5864_DSP_WIN_SIZE 0x02f0 + +#define TW5864_DSP_SKIP 0x0208 +/* Define controls in register TW5864_DSP_SKIP */ +/* + * Skip Offset Enable bit + * 0 DSP_SKIP_OFFSET value is not used (default 8) + * 1 DSP_SKIP_OFFSET value is used in HW + */ +#define TW5864_DSP_SKIP_OFEN 0x0080 +/* Skip mode cost offset (default 8) */ +#define TW5864_DSP_SKIP_OFFSET 0x007f + +#define TW5864_MOTION_SEARCH_ETC 0x020c +/* Define controls in register TW5864_MOTION_SEARCH_ETC */ +/* Enable quarter pel search mode */ +#define TW5864_QPEL_EN BIT(0) +/* Enable half pel search mode */ +#define TW5864_HPEL_EN BIT(1) +/* Enable motion search mode */ +#define TW5864_ME_EN BIT(2) +/* Enable Intra mode */ +#define TW5864_INTRA_EN BIT(3) +/* Enable Skip Mode */ +#define TW5864_SKIP_EN BIT(4) +/* Search Option (Default 2"b01) */ +#define TW5864_SRCH_OPT (3 << 5) + +#define TW5864_DSP_ENC_REC 0x0210 +/* Define controls in register TW5864_DSP_ENC_REC */ +/* Reference Buffer Pointer for encoding */ +#define TW5864_DSP_ENC_REF_PTR 0x0007 +/* Reconstruct Buffer pointer */ +#define TW5864_DSP_REC_BUF_PTR 0x7000 + +/* [15:0] Lambda Value for H264 */ +#define TW5864_DSP_REF_MVP_LAMBDA 0x0214 + +#define TW5864_DSP_PIC_MAX_MB 0x0218 +/* Define controls in register TW5864_DSP_PIC_MAX_MB */ +/* The MB number in Y direction for a frame */ +#define TW5864_DSP_PIC_MAX_MB_Y 0x007f +/* The MB number in X direction for a frame */ +#define TW5864_DSP_PIC_MAX_MB_X 0x7f00 + +/* The original frame pointer for encoding */ +#define TW5864_DSP_ENC_ORG_PTR_REG 0x021c +/* Mask to use with TW5864_DSP_ENC_ORG_PTR */ +#define TW5864_DSP_ENC_ORG_PTR_MASK 0x7000 +/* Number of bits to shift with TW5864_DSP_ENC_ORG_PTR */ +#define TW5864_DSP_ENC_ORG_PTR_SHIFT 12 + +/* DDR base address of OSD rectangle attribute data */ +#define TW5864_DSP_OSD_ATTRI_BASE 0x0220 +/* OSD enable bit for each channel */ +#define TW5864_DSP_OSD_ENABLE 0x0228 + +/* 0x0280 ~ 0x029c – Motion Vector for 1st 4x4 Block, e.g., 80 (X), 84 (Y) */ +#define TW5864_ME_MV_VEC1 0x0280 +/* 0x02a0 ~ 0x02bc – Motion Vector for 2nd 4x4 Block, e.g., A0 (X), A4 (Y) */ +#define TW5864_ME_MV_VEC2 0x02a0 +/* 0x02c0 ~ 0x02dc – Motion Vector for 3rd 4x4 Block, e.g., C0 (X), C4 (Y) */ +#define TW5864_ME_MV_VEC3 0x02c0 +/* 0x02e0 ~ 0x02fc – Motion Vector for 4th 4x4 Block, e.g., E0 (X), E4 (Y) */ +#define TW5864_ME_MV_VEC4 0x02e0 + +/* + * [5:0] + * if (intra16x16_cost < (intra4x4_cost+dsp_i4x4_offset)) + * Intra_mode = intra16x16_mode + * Else + * Intra_mode = intra4x4_mode + */ +#define TW5864_DSP_I4x4_OFFSET 0x040c + +/* + * [6:4] + * 0x5 Only 4x4 + * 0x6 Only 16x16 + * 0x7 16x16 & 4x4 + */ +#define TW5864_DSP_INTRA_MODE 0x0410 +#define TW5864_DSP_INTRA_MODE_SHIFT 4 +#define TW5864_DSP_INTRA_MODE_MASK (7 << 4) +#define TW5864_DSP_INTRA_MODE_4x4 0x5 +#define TW5864_DSP_INTRA_MODE_16x16 0x6 +#define TW5864_DSP_INTRA_MODE_4x4_AND_16x16 0x7 +/* + * [5:0] WEIGHT Factor for I4x4 cost calculation (QP dependent) + */ +#define TW5864_DSP_I4x4_WEIGHT 0x0414 + +/* + * [7:0] Offset used to affect Intra/ME model decision + * If (me_cost < intra_cost + dsp_resid_mode_offset) + * Pred_Mode = me_mode + * Else + * Pred_mode = intra_mode + */ +#define TW5864_DSP_RESID_MODE_OFFSET 0x0604 + +/* 0x0800 ~ 0x09ff - Quantization TABLE Values */ +#define TW5864_QUAN_TAB 0x0800 + +/* Valid channel value [0; f], frame value [0; 3] */ +#define TW5864_RT_CNTR_CH_FRM(channel, frame) \ + (0x0c00 | (channel << 4) | (frame << 2)) + +#define TW5864_FRAME_BUS1 0x0d00 +/* + * 1 Progressive in part A in bus n + * 0 Interlaced in part A in bus n + */ +#define TW5864_PROG_A BIT(0) +/* + * 1 Progressive in part B in bus n + * 0 Interlaced in part B in bus n + */ +#define TW5864_PROG_B BIT(1) +/* + * 1 Frame Mode in bus n + * 0 Field Mode in bus n + */ +#define TW5864_FRAME BIT(2) +/* + * 0 4CIF in bus n + * 1 1D1 + 4 CIF in bus n + * 2 2D1 in bus n + */ +#define TW5864_BUS_D1 (3 << 3) +/* Bus 1 goes in TW5864_FRAME_BUS1 in [4:0] */ +/* Bus 2 goes in TW5864_FRAME_BUS1 in [12:8] */ +#define TW5864_FRAME_BUS2 0x0d04 +/* Bus 3 goes in TW5864_FRAME_BUS2 in [4:0] */ +/* Bus 4 goes in TW5864_FRAME_BUS2 in [12:8] */ + +/* [15:0] Horizontal Mirror for channel n */ +#define TW5864_SENIF_HOR_MIR 0x0d08 +/* [15:0] Vertical Mirror for channel n */ +#define TW5864_SENIF_VER_MIR 0x0d0c + +/* + * FRAME_WIDTH_BUSn_A + * 0x15f: 4 CIF + * 0x2cf: 1 D1 + 3 CIF + * 0x2cf: 2 D1 + * FRAME_WIDTH_BUSn_B + * 0x15f: 4 CIF + * 0x2cf: 1 D1 + 3 CIF + * 0x2cf: 2 D1 + * FRAME_HEIGHT_BUSn_A + * 0x11f: 4CIF (PAL) + * 0x23f: 1D1 + 3CIF (PAL) + * 0x23f: 2 D1 (PAL) + * 0x0ef: 4CIF (NTSC) + * 0x1df: 1D1 + 3CIF (NTSC) + * 0x1df: 2 D1 (NTSC) + * FRAME_HEIGHT_BUSn_B + * 0x11f: 4CIF (PAL) + * 0x23f: 1D1 + 3CIF (PAL) + * 0x23f: 2 D1 (PAL) + * 0x0ef: 4CIF (NTSC) + * 0x1df: 1D1 + 3CIF (NTSC) + * 0x1df: 2 D1 (NTSC) + */ +#define TW5864_FRAME_WIDTH_BUS_A(bus) (0x0d10 + 0x0010 * bus) +#define TW5864_FRAME_WIDTH_BUS_B(bus) (0x0d14 + 0x0010 * bus) +#define TW5864_FRAME_HEIGHT_BUS_A(bus) (0x0d18 + 0x0010 * bus) +#define TW5864_FRAME_HEIGHT_BUS_B(bus) (0x0d1c + 0x0010 * bus) + +/* + * 1: the bus mapped Channel n Full D1 + * 0: the bus mapped Channel n Half D1 + */ +#define TW5864_FULL_HALF_FLAG 0x0d50 + +/* + * 0 The bus mapped Channel select partA Mode + * 1 The bus mapped Channel select partB Mode + */ +#define TW5864_FULL_HALF_MODE_SEL 0x0d54 + +#define TW5864_VLC 0x1000 +/* Define controls in register TW5864_VLC */ +/* QP Value used by H264 CAVLC */ +#define TW5864_VLC_SLICE_QP 0x003f +/* + * Swap byte order of VLC stream in d-word. + * 1 Normal (VLC output= [31:0]) + * 0 Swap (VLC output={[23:16],[31:24],[7:0], [15:8]}) + */ +#define TW5864_VLC_BYTE_SWP BIT(6) +/* Enable Adding 03 circuit for VLC stream */ +#define TW5864_VLC_ADD03_EN BIT(7) +/* Number of bit for VLC bit Align */ +#define TW5864_VLC_BIT_ALIGN_SHIFT 8 +#define TW5864_VLC_BIT_ALIGN_MASK (0x1f << 8) +/* + * Synchronous Interface select for VLC Stream + * 1 CDC_VLCS_MAS read VLC stream + * 0 CPU read VLC stream + */ +#define TW5864_VLC_INF_SEL BIT(13) +/* Enable VLC overflow control */ +#define TW5864_VLC_OVFL_CNTL BIT(14) +/* + * 1 PCI Master Mode + * 0 Non PCI Master Mode + */ +#define TW5864_VLC_PCI_SEL BIT(15) +/* + * 0 Enable Adding 03 to VLC header and stream + * 1 Disable Adding 03 to VLC header of "00000001" + */ +#define TW5864_VLC_A03_DISAB BIT(16) +/* + * Status of VLC stream in DDR (one bit for each buffer) + * 1 VLC is ready in buffer n (HW set) + * 0 VLC is not ready in buffer n (SW clear) + */ +#define TW5864_VLC_BUF_RDY_SHIFT 24 +#define TW5864_VLC_BUF_RDY_MASK (0xff << 24) + +/* Total number of bit in the slice */ +#define TW5864_SLICE_TOTAL_BIT 0x1004 +/* Total number of bit in the residue */ +#define TW5864_RES_TOTAL_BIT 0x1008 + +#define TW5864_VLC_BUF 0x100c +/* Define controls in register TW5864_VLC_BUF */ +/* VLC BK0 full status, write ‘1’ to clear */ +#define TW5864_VLC_BK0_FULL BIT(0) +/* VLC BK1 full status, write ‘1’ to clear */ +#define TW5864_VLC_BK1_FULL BIT(1) +/* VLC end slice status, write ‘1’ to clear */ +#define TW5864_VLC_END_SLICE BIT(2) +/* VLC Buffer overflow status, write ‘1’ to clear */ +#define TW5864_DSP_RD_OF BIT(3) +/* VLC string length in either buffer 0 or 1 at end of frame */ +#define TW5864_VLC_STREAM_LEN_SHIFT 4 +#define TW5864_VLC_STREAM_LEN_MASK (0x1ff << 4) + +/* [15:0] Total coefficient number in a frame */ +#define TW5864_TOTAL_COEF_NO 0x1010 +/* [0] VLC Encoder Interrupt. Write ‘1’ to clear */ +#define TW5864_VLC_DSP_INTR 0x1014 +/* [31:0] VLC stream CRC checksum */ +#define TW5864_VLC_STREAM_CRC 0x1018 + +#define TW5864_VLC_RD 0x101c +/* Define controls in register TW5864_VLC_RD */ +/* + * 1 Read VLC lookup Memory + * 0 Read VLC Stream Memory + */ +#define TW5864_VLC_RD_MEM BIT(0) +/* + * 1 Read VLC Stream Memory in burst mode + * 0 Read VLC Stream Memory in single mode + */ +#define TW5864_VLC_RD_BRST BIT(1) + +/* 0x2000 ~ 0x2ffc -- H264 Stream Memory Map */ +/* + * A word is 4 bytes. I.e., + * VLC_STREAM_MEM[0] address: 0x2000 + * VLC_STREAM_MEM[1] address: 0x2004 + * ... + * VLC_STREAM_MEM[3FF] address: 0x2ffc + */ +#define TW5864_VLC_STREAM_MEM_START 0x2000 +#define TW5864_VLC_STREAM_MEM_MAX_OFFSET 0x3ff +#define TW5864_VLC_STREAM_MEM(offset) (TW5864_VLC_STREAM_MEM_START + 4 * offset) + +/* 0x4000 ~ 0x4ffc -- Audio Register Map */ +/* [31:0] config 1ms cnt = Realtime clk/1000 */ +#define TW5864_CFG_1MS_CNT 0x4000 + +#define TW5864_ADPCM 0x4004 +/* Define controls in register TW5864_ADPCM */ +/* ADPCM decoder enable */ +#define TW5864_ADPCM_DEC BIT(0) +/* ADPCM input data enable */ +#define TW5864_ADPCM_IN_DATA BIT(1) +/* ADPCM encoder enable */ +#define TW5864_ADPCM_ENC BIT(2) + +#define TW5864_AUD 0x4008 +/* Define controls in register TW5864_AUD */ +/* Record path PCM Audio enable bit for each channel */ +#define TW5864_AUD_ORG_CH_EN 0x00ff +/* Speaker path PCM Audio Enable */ +#define TW5864_SPK_ORG_EN BIT(16) +/* + * 0 16bit + * 1 8bit + */ +#define TW5864_AD_BIT_MODE BIT(17) +#define TW5864_AUD_TYPE_SHIFT 18 +/* + * 0 PCM + * 3 ADPCM + */ +#define TW5864_AUD_TYPE (0xf << 18) +#define TW5864_AUD_SAMPLE_RATE_SHIFT 22 +/* + * 0 8K + * 1 16K + */ +#define TW5864_AUD_SAMPLE_RATE (3 << 22) +/* Channel ID used to select audio channel (0 to 16) for loopback */ +#define TW5864_TESTLOOP_CHID_SHIFT 24 +#define TW5864_TESTLOOP_CHID (0x1f << 24) +/* Enable AD Loopback Test */ +#define TW5864_TEST_ADLOOP_EN BIT(30) +/* + * 0 Asynchronous Mode or PCI target mode + * 1 PCI Initiator Mode + */ +#define TW5864_AUD_MODE BIT(31) + +#define TW5864_AUD_ADPCM 0x400c +/* Define controls in register TW5864_AUD_ADPCM */ +/* Record path ADPCM audio channel enable, one bit for each */ +#define TW5864_AUD_ADPCM_CH_EN 0x00ff +/* Speaker path ADPCM audio channel enable */ +#define TW5864_SPK_ADPCM_EN BIT(16) + +#define TW5864_PC_BLOCK_ADPCM_RD_NO 0x4018 +#define TW5864_PC_BLOCK_ADPCM_RD_NO_MASK 0x1f + +/* + * For ADPCM_ENC_WR_PTR, ADPCM_ENC_RD_PTR (see below): + * Bit[2:0] ch0 + * Bit[5:3] ch1 + * Bit[8:6] ch2 + * Bit[11:9] ch3 + * Bit[14:12] ch4 + * Bit[17:15] ch5 + * Bit[20:18] ch6 + * Bit[23:21] ch7 + * Bit[26:24] ch8 + * Bit[29:27] ch9 + * Bit[32:30] ch10 + * Bit[35:33] ch11 + * Bit[38:36] ch12 + * Bit[41:39] ch13 + * Bit[44:42] ch14 + * Bit[47:45] ch15 + * Bit[50:48] ch16 + */ +#define TW5864_ADPCM_ENC_XX_MASK 0x3fff +#define TW5864_ADPCM_ENC_XX_PTR2_SHIFT 30 +/* ADPCM_ENC_WR_PTR[29:0] */ +#define TW5864_ADPCM_ENC_WR_PTR1 0x401c +/* ADPCM_ENC_WR_PTR[50:30] */ +#define TW5864_ADPCM_ENC_WR_PTR2 0x4020 + +/* ADPCM_ENC_RD_PTR[29:0] */ +#define TW5864_ADPCM_ENC_RD_PTR1 0x4024 +/* ADPCM_ENC_RD_PTR[50:30] */ +#define TW5864_ADPCM_ENC_RD_PTR2 0x4028 + +/* [3:0] rd ch0, [7:4] rd ch1, [11:8] wr ch0, [15:12] wr ch1 */ +#define TW5864_ADPCM_DEC_RD_WR_PTR 0x402c + +/* + * For TW5864_AD_ORIG_WR_PTR, TW5864_AD_ORIG_RD_PTR: + * Bit[3:0] ch0 + * Bit[7:4] ch1 + * Bit[11:8] ch2 + * Bit[15:12] ch3 + * Bit[19:16] ch4 + * Bit[23:20] ch5 + * Bit[27:24] ch6 + * Bit[31:28] ch7 + * Bit[35:32] ch8 + * Bit[39:36] ch9 + * Bit[43:40] ch10 + * Bit[47:44] ch11 + * Bit[51:48] ch12 + * Bit[55:52] ch13 + * Bit[59:56] ch14 + * Bit[63:60] ch15 + * Bit[67:64] ch16 + */ +/* AD_ORIG_WR_PTR[31:0] */ +#define TW5864_AD_ORIG_WR_PTR1 0x4030 +/* AD_ORIG_WR_PTR[63:32] */ +#define TW5864_AD_ORIG_WR_PTR2 0x4034 +/* AD_ORIG_WR_PTR[67:64] */ +#define TW5864_AD_ORIG_WR_PTR3 0x4038 + +/* AD_ORIG_RD_PTR[31:0] */ +#define TW5864_AD_ORIG_RD_PTR1 0x403c +/* AD_ORIG_RD_PTR[63:32] */ +#define TW5864_AD_ORIG_RD_PTR2 0x4040 +/* AD_ORIG_RD_PTR[67:64] */ +#define TW5864_AD_ORIG_RD_PTR3 0x4044 + +#define TW5864_PC_BLOCK_ORIG_RD_NO 0x4048 +#define TW5864_PC_BLOCK_ORIG_RD_NO_MASK 0x1f + +#define TW5864_PCI_AUD 0x404c +/* Define controls in register TW5864_PCI_AUD */ +/* + * The register is applicable to PCI initiator mode only. Used to select PCM(0) + * or ADPCM(1) audio data sent to PC. One bit for each channel + */ +#define TW5864_PCI_DATA_SEL 0xffff +/* + * Audio flow control mode selection bit. + * 0 Flow control disabled. TW5864 continuously sends audio frame to PC + * (initiator mode) + * 1 Flow control enabled + */ +#define TW5864_PCI_FLOW_EN BIT(16) +/* + * When PCI_FLOW_EN is set, PCI need to toggle this bit to send an audio frame + * to PC. One toggle to send one frame. + */ +#define TW5864_PCI_AUD_FRM_EN BIT(17) + +/* [1:0] CS valid to data valid CLK cycles when writing operation */ +#define TW5864_CS2DAT_CNT 0x8000 +/* [2:0] Data valid signal width by system clock cycles */ +#define TW5864_DATA_VLD_WIDTH 0x8004 + +#define TW5864_SYNC 0x8008 +/* Define controls in register TW5864_SYNC */ +/* + * 0 vlc stream to syncrous port + * 1 vlc stream to ddr buffers + */ +#define TW5864_SYNC_CFG BIT(7) +/* + * 0 SYNC Address sampled on Rising edge + * 1 SYNC Address sampled on Falling edge + */ +#define TW5864_SYNC_ADR_EDGE BIT(0) +#define TW5864_VLC_STR_DELAY_SHIFT 1 +/* + * 0 No system delay + * 1 One system clock delay + * 2 Two system clock delay + * 3 Three system clock delay + */ +#define TW5864_VLC_STR_DELAY (3 << 1) +/* + * 0 Rising edge output + * 1 Falling edge output + */ +#define TW5864_VLC_OUT_EDGE BIT(3) + +/* + * [1:0] + * 2’b00 phase set to 180 degree + * 2’b01 phase set to 270 degree + * 2’b10 phase set to 0 degree + * 2’b11 phase set to 90 degree + */ +#define TW5864_I2C_PHASE_CFG 0x800c + +/* + * The system / DDR clock (166 MHz) is generated with an on-chip system clock + * PLL (SYSPLL) using input crystal clock of 27 MHz. The system clock PLL + * frequency is controlled with the following equation. + * CLK_OUT = CLK_IN * (M+1) / ((N+1) * P) + * SYSPLL_M M parameter + * SYSPLL_N N parameter + * SYSPLL_P P parameter + */ +/* SYSPLL_M[7:0] */ +#define TW5864_SYSPLL1 0x8018 +/* Define controls in register TW5864_SYSPLL1 */ +#define TW5864_SYSPLL_M_LOW 0x00ff + +/* [2:0]: SYSPLL_M[10:8], [7:3]: SYSPLL_N[4:0] */ +#define TW5864_SYSPLL2 0x8019 +/* Define controls in register TW5864_SYSPLL2 */ +#define TW5864_SYSPLL_M_HI 0x07 +#define TW5864_SYSPLL_N_LOW_SHIFT 3 +#define TW5864_SYSPLL_N_LOW (0x1f << 3) + +/* + * [1:0]: SYSPLL_N[6:5], [3:2]: SYSPLL_P, [4]: SYSPLL_IREF, [7:5]: SYSPLL_CP_SEL + */ +#define TW5864_SYSPLL3 0x8020 +/* Define controls in register TW5864_SYSPLL3 */ +#define TW5864_SYSPLL_N_HI 0x03 +#define TW5864_SYSPLL_P_SHIFT 2 +#define TW5864_SYSPLL_P (0x03 << 2) +/* + * SYSPLL bias current control + * 0 Lower current (default) + * 1 30% higher current + */ +#define TW5864_SYSPLL_IREF BIT(4) +/* + * SYSPLL charge pump current selection + * 0 1,5 uA + * 1 4 uA + * 2 9 uA + * 3 19 uA + * 4 39 uA + * 5 79 uA + * 6 159 uA + * 7 319 uA + */ +#define TW5864_SYSPLL_CP_SEL_SHIFT 5 +#define TW5864_SYSPLL_CP_SEL (0x07 << 5) + +/* + * [1:0]: SYSPLL_VCO, [3:2]: SYSPLL_LP_X8, [5:4]: SYSPLL_ICP_SEL, + * [6]: SYSPLL_LPF_5PF, [7]: SYSPLL_ED_SEL + */ +#define TW5864_SYSPLL4 0x8021 +/* Define controls in register TW5864_SYSPLL4 */ +/* + * SYSPLL_VCO VCO Range selection + * 00 5 ~ 75 MHz + * 01 50 ~ 140 MHz + * 10 110 ~ 320 MHz + * 11 270 ~ 700 MHz + */ +#define TW5864_SYSPLL_VCO 0x03 +#define TW5864_SYSPLL_LP_X8_SHIFT 2 +/* + * Loop resister + * 0 38.5K ohms + * 1 6.6K ohms (default) + * 2 2.2K ohms + * 3 1.1K ohms + */ +#define TW5864_SYSPLL_LP_X8 (0x03 << 2) +#define TW5864_SYSPLL_ICP_SEL_SHIFT 4 +/* + * PLL charge pump fine tune + * 00 x1 (default) + * 01 x1/2 + * 10 x1/7 + * 11 x1/8 + */ +#define TW5864_SYSPLL_ICP_SEL (0x03 << 4) +/* + * PLL low pass filter phase margin adjustment + * 0 no 5pF (default) + * 1 5pF added + */ +#define TW5864_SYSPLL_LPF_5PF BIT(6) +/* + * PFD select edge for detection + * 0 Falling edge (default) + * 1 Rising edge + */ +#define TW5864_SYSPLL_ED_SEL BIT(7) + +/* [0]: SYSPLL_RST, [4]: SYSPLL_PD */ +#define TW5864_SYSPLL5 0x8024 +/* Define controls in register TW5864_SYSPLL5 */ +/* Reset SYSPLL */ +#define TW5864_SYSPLL_RST BIT(0) +/* Power down SYSPLL */ +#define TW5864_SYSPLL_PD BIT(4) + +#define TW5864_PLL_CFG 0x801c +/* Define controls in register TW5864_PLL_CFG */ +/* + * Issue Soft Reset from Async Host Interface / PCI Interface clock domain. + * Become valid after sync to the xtal clock domain. This bit is set only if + * LOAD register bit is also set to 1. + */ +#define TW5864_SRST BIT(0) +/* + * Issue SYSPLL (166 MHz) configuration latch from Async host interface / PCI + * Interface clock domain. The configuration setting becomes effective only if + * LOAD register bit is also set to 1. + */ +#define TW5864_SYSPLL_CFG BIT(2) +/* + * Issue SPLL (108 MHz) configuration load from Async host interface / PCI + * Interface clock domain. The configuration setting becomes effective only if + * the LOAD register bit is also set to 1. + */ +#define TW5864_SPLL_CFG BIT(4) +/* + * Set this bit to latch the SRST, SYSPLL_CFG, SPLL_CFG setting into the xtal + * clock domain to restart the PLL. This bit is self cleared. + */ +#define TW5864_LOAD BIT(3) + +/* SPLL_IREF, SPLL_LPX4, SPLL_CPX4, SPLL_PD, SPLL_DBG */ +#define TW5864_SPLL 0x8028 + +/* 0x8800 ~ 0x88fc -- Interrupt Register Map */ +/* + * Trigger mode of interrupt source 0 ~ 15 + * 1 Edge trigger mode + * 0 Level trigger mode + */ +#define TW5864_TRIGGER_MODE_L 0x8800 +/* Trigger mode of interrupt source 16 ~ 31 */ +#define TW5864_TRIGGER_MODE_H 0x8804 +/* Enable of interrupt source 0 ~ 15 */ +#define TW5864_INTR_ENABLE_L 0x8808 +/* Enable of interrupt source 16 ~ 31 */ +#define TW5864_INTR_ENABLE_H 0x880c +/* Clear interrupt command of interrupt source 0 ~ 15 */ +#define TW5864_INTR_CLR_L 0x8810 +/* Clear interrupt command of interrupt source 16 ~ 31 */ +#define TW5864_INTR_CLR_H 0x8814 +/* + * Assertion of interrupt source 0 ~ 15 + * 1 High level or pos-edge is assertion + * 0 Low level or neg-edge is assertion + */ +#define TW5864_INTR_ASSERT_L 0x8818 +/* Assertion of interrupt source 16 ~ 31 */ +#define TW5864_INTR_ASSERT_H 0x881c +/* + * Output level of interrupt + * 1 Interrupt output is high assertion + * 0 Interrupt output is low assertion + */ +#define TW5864_INTR_OUT_LEVEL 0x8820 +/* + * Status of interrupt source 0 ~ 15 + * Bit[0]: VLC 4k RAM interrupt + * Bit[1]: BURST DDR RAM interrupt + * Bit[2]: MV DSP interrupt + * Bit[3]: video lost interrupt + * Bit[4]: gpio 0 interrupt + * Bit[5]: gpio 1 interrupt + * Bit[6]: gpio 2 interrupt + * Bit[7]: gpio 3 interrupt + * Bit[8]: gpio 4 interrupt + * Bit[9]: gpio 5 interrupt + * Bit[10]: gpio 6 interrupt + * Bit[11]: gpio 7 interrupt + * Bit[12]: JPEG interrupt + * Bit[13:15]: Reserved + */ +#define TW5864_INTR_STATUS_L 0x8838 +/* + * Status of interrupt source 16 ~ 31 + * Bit[0]: Reserved + * Bit[1]: VLC done interrupt + * Bit[2]: Reserved + * Bit[3]: AD Vsync interrupt + * Bit[4]: Preview eof interrupt + * Bit[5]: Preview overflow interrupt + * Bit[6]: Timer interrupt + * Bit[7]: Reserved + * Bit[8]: Audio eof interrupt + * Bit[9]: I2C done interrupt + * Bit[10]: AD interrupt + * Bit[11:15]: Reserved + */ +#define TW5864_INTR_STATUS_H 0x883c + +/* Defines of interrupt bits, united for both low and high word registers */ +#define TW5864_INTR_VLC_RAM BIT(0) +#define TW5864_INTR_BURST BIT(1) +#define TW5864_INTR_MV_DSP BIT(2) +#define TW5864_INTR_VIN_LOST BIT(3) +/* n belongs to [0; 7] */ +#define TW5864_INTR_GPIO(n) (1 << (4 + n)) +#define TW5864_INTR_JPEG BIT(12) +#define TW5864_INTR_VLC_DONE BIT(17) +#define TW5864_INTR_AD_VSYNC BIT(19) +#define TW5864_INTR_PV_EOF BIT(20) +#define TW5864_INTR_PV_OVERFLOW BIT(21) +#define TW5864_INTR_TIMER BIT(22) +#define TW5864_INTR_AUD_EOF BIT(24) +#define TW5864_INTR_I2C_DONE BIT(25) +#define TW5864_INTR_AD BIT(26) + +/* 0x9000 ~ 0x920c -- Video Capture (VIF) Register Map */ +/* + * H264EN_CH_STATUS[n] Status of Vsync synchronized H264EN_CH_EN (Read Only) + * 1 Channel Enabled + * 0 Channel Disabled + */ +#define TW5864_H264EN_CH_STATUS 0x9000 +/* + * [15:0] H264EN_CH_EN[n] H264 Encoding Path Enable for channel + * 1 Channel Enabled + * 0 Channel Disabled + */ +#define TW5864_H264EN_CH_EN 0x9004 +/* + * H264EN_CH_DNS[n] H264 Encoding Path Downscale Video Decoder Input for + * channel n + * 1 Downscale Y to 1/2 + * 0 Does not downscale + */ +#define TW5864_H264EN_CH_DNS 0x9008 +/* + * H264EN_CH_PROG[n] H264 Encoding Path channel n is progressive + * 1 Progressive (Not valid for TW5864) + * 0 Interlaced (TW5864 default) + */ +#define TW5864_H264EN_CH_PROG 0x900c +/* + * [3:0] H264EN_BUS_MAX_CH[n] + * H264 Encoding Path maximum number of channel on BUS n + * 0 Max 4 channels + * 1 Max 2 channels + */ +#define TW5864_H264EN_BUS_MAX_CH 0x9010 + +/* + * H264EN_RATE_MAX_LINE_n H264 Encoding path Rate Mapping Maximum Line Number + * on Bus n + */ +#define TW5864_H264EN_RATE_MAX_LINE_EVEN 0x1f +#define TW5864_H264EN_RATE_MAX_LINE_ODD_SHIFT 5 +#define TW5864_H264EN_RATE_MAX_LINE_ODD (0x1f << 5) +/* + * [4:0] H264EN_RATE_MAX_LINE_0 + * [9:5] H264EN_RATE_MAX_LINE_1 + */ +#define TW5864_H264EN_RATE_MAX_LINE_REG1 0x9014 +/* + * [4:0] H264EN_RATE_MAX_LINE_2 + * [9:5] H264EN_RATE_MAX_LINE_3 + */ +#define TW5864_H264EN_RATE_MAX_LINE_REG2 0x9018 + +/* + * H264EN_CHn_FMT H264 Encoding Path Format configuration of Channel n + * 00 D1 (For D1 and hD1 frame) + * 01 (Reserved) + * 10 (Reserved) + * 11 D1 with 1/2 size in X (for CIF frame) + * Note: To be used with 0x9008 register to configure the frame size + */ +/* + * [1:0]: H264EN_CH0_FMT, + * ..., [15:14]: H264EN_CH7_FMT + */ +#define TW5864_H264EN_CH_FMT_REG1 0x9020 +/* + * [1:0]: H264EN_CH8_FMT (?), + * ..., [15:14]: H264EN_CH15_FMT (?) + */ +#define TW5864_H264EN_CH_FMT_REG2 0x9024 + +/* + * H264EN_RATE_CNTL_BUSm_CHn H264 Encoding Path BUS m Rate Control for Channel n + */ +#define TW5864_H264EN_RATE_CNTL_LO_WORD(bus, channel) \ + (0x9100 + bus * 0x20 + channel * 0x08) +#define TW5864_H264EN_RATE_CNTL_HI_WORD(bus, channel) \ + (0x9104 + bus * 0x20 + channel * 0x08) + +/* + * H264EN_BUSm_MAP_CHn The 16-to-1 MUX configuration register for each encoding + * channel (total of 16 channels). Four bits for each channel. + */ +#define TW5864_H264EN_BUS0_MAP 0x9200 +#define TW5864_H264EN_BUS1_MAP 0x9204 +#define TW5864_H264EN_BUS2_MAP 0x9208 +#define TW5864_H264EN_BUS3_MAP 0x920c + +/* This register is not defined in datasheet, but used in reference driver */ +#define TW5864_UNDECLARED_ERROR_FLAGS_0x9218 0x9218 + +#define TW5864_GPIO1 0x9800 +#define TW5864_GPIO2 0x9804 +/* Define controls in registers TW5864_GPIO1, TW5864_GPIO2 */ +/* GPIO DATA of Group n */ +#define TW5864_GPIO_DATA 0x00ff +#define TW5864_GPIO_OEN_SHIFT 8 +/* GPIO Output Enable of Group n */ +#define TW5864_GPIO_OEN (0xff << 8) + +/* 0xa000 ~ 0xa8ff – DDR Controller Register Map */ +/* DDR Controller A */ +/* + * [2:0] Data valid counter after read command to DDR. This is the delay value + * to show how many cycles the data will be back from DDR after we issue a read + * command. + */ +#define TW5864_RD_ACK_VLD_MUX 0xa000 + +#define TW5864_DDR_PERIODS 0xa004 +/* Define controls in register TW5864_DDR_PERIODS */ +/* + * Tras value, the minimum cycle of active to precharge command period, + * default is 7 + */ +#define TW5864_TRAS_CNT_MAX 0x000f +/* + * Trfc value, the minimum cycle of refresh to active or refresh command period, + * default is 4"hf + */ +#define TW5864_RFC_CNT_MAX_SHIFT 8 +#define TW5864_RFC_CNT_MAX (0x0f << 8) +/* + * Trcd value, the minimum cycle of active to internal read/write command + * period, default is 4"h2 + */ +#define TW5864_TCD_CNT_MAX_SHIFT 4 +#define TW5864_TCD_CNT_MAX (0x0f << 4) +/* Twr value, write recovery time, default is 4"h3 */ +#define TW5864_TWR_CNT_MAX_SHIFT 12 +#define TW5864_TWR_CNT_MAX (0x0f << 12) + +/* + * [2:0] CAS latency, the delay cycle between internal read command and the + * availability of the first bit of output data, default is 3 + */ +#define TW5864_CAS_LATENCY 0xa008 +/* + * [15:0] Maximum average periodic refresh, the value is based on the current + * frequency to match 7.8mcs + */ +#define TW5864_DDR_REF_CNTR_MAX 0xa00c +/* + * DDR_ON_CHIP_MAP [1:0] + * 0 256M DDR on board + * 1 512M DDR on board + * 2 1G DDR on board + * DDR_ON_CHIP_MAP [2] + * 0 Only one DDR chip + * 1 Two DDR chips + */ +#define TW5864_DDR_ON_CHIP_MAP 0xa01c +#define TW5864_DDR_SELFTEST_MODE 0xa020 +/* Define controls in register TW5864_DDR_SELFTEST_MODE */ +/* + * 0 Common read/write mode + * 1 DDR self-test mode + */ +#define TW5864_MASTER_MODE BIT(0) +/* + * 0 DDR self-test single read/write + * 1 DDR self-test burst read/write + */ +#define TW5864_SINGLE_PROC BIT(1) +/* + * 0 DDR self-test write command + * 1 DDR self-test read command + */ +#define TW5864_WRITE_FLAG BIT(2) +#define TW5864_DATA_MODE_SHIFT 4 +/* + * 0 write 32'haaaa5555 to DDR + * 1 write 32'hffffffff to DDR + * 2 write 32'hha5a55a5a to DDR + * 3 write increasing data to DDR + */ +#define TW5864_DATA_MODE (0x3 << 4) + +/* [7:0] The maximum data of one burst in DDR self-test mode */ +#define TW5864_BURST_CNTR_MAX 0xa024 +/* [15:0] The maximum burst counter (bit 15~0) in DDR self-test mode */ +#define TW5864_DDR_PROC_CNTR_MAX_L 0xa028 +/* The maximum burst counter (bit 31~16) in DDR self-test mode */ +#define TW5864_DDR_PROC_CNTR_MAX_H 0xa02c +/* [0]: Start one DDR self-test */ +#define TW5864_DDR_SELF_TEST_CMD 0xa030 +/* The maximum error counter (bit 15 ~ 0) in DDR self-test */ +#define TW5864_ERR_CNTR_L 0xa034 + +#define TW5864_ERR_CNTR_H_AND_FLAG 0xa038 +/* Define controls in register TW5864_ERR_CNTR_H_AND_FLAG */ +/* The maximum error counter (bit 30 ~ 16) in DDR self-test */ +#define TW5864_ERR_CNTR_H_MASK 0x3fff +/* DDR self-test end flag */ +#define TW5864_END_FLAG 0x8000 + +/* + * DDR Controller B: same as 0xa000 ~ 0xa038, but add TW5864_DDR_B_OFFSET to all + * addresses + */ +#define TW5864_DDR_B_OFFSET 0x0800 + +/* 0xb004 ~ 0xb018 – HW version/ARB12 Register Map */ +/* [15:0] Default is C013 */ +#define TW5864_HW_VERSION 0xb004 + +#define TW5864_REQS_ENABLE 0xb010 +/* Define controls in register TW5864_REQS_ENABLE */ +/* Audio data in to DDR enable (default 1) */ +#define TW5864_AUD_DATA_IN_ENB BIT(0) +/* Audio encode request to DDR enable (default 1) */ +#define TW5864_AUD_ENC_REQ_ENB BIT(1) +/* Audio decode request0 to DDR enable (default 1) */ +#define TW5864_AUD_DEC_REQ0_ENB BIT(2) +/* Audio decode request1 to DDR enable (default 1) */ +#define TW5864_AUD_DEC_REQ1_ENB BIT(3) +/* VLC stream request to DDR enable (default 1) */ +#define TW5864_VLC_STRM_REQ_ENB BIT(4) +/* H264 MV request to DDR enable (default 1) */ +#define TW5864_DVM_MV_REQ_ENB BIT(5) +/* mux_core MVD request to DDR enable (default 1) */ +#define TW5864_MVD_REQ_ENB BIT(6) +/* mux_core MVD temp data request to DDR enable (default 1) */ +#define TW5864_MVD_TMP_REQ_ENB BIT(7) +/* JPEG request to DDR enable (default 1) */ +#define TW5864_JPEG_REQ_ENB BIT(8) +/* mv_flag request to DDR enable (default 1) */ +#define TW5864_MV_FLAG_REQ_ENB BIT(9) + +#define TW5864_ARB12 0xb018 +/* Define controls in register TW5864_ARB12 */ +/* ARB12 Enable (default 1) */ +#define TW5864_ARB12_ENB BIT(15) +/* ARB12 maximum value of time out counter (default 15"h1FF) */ +#define TW5864_ARB12_TIME_OUT_CNT 0x7fff + +/* 0xb800 ~ 0xb80c -- Indirect Access Register Map */ +/* + * Spec says: + * In order to access the indirect register space, the following procedure is + * followed. + * But reference driver implementation, and current driver, too, does it + * differently. + * + * Write Registers: + * (1) Write IND_DATA at 0xb804 ~ 0xb807 + * (2) Read BUSY flag from 0xb803. Wait until BUSY signal is 0. + * (3) Write IND_ADDR at 0xb800 ~ 0xb801. Set R/W to "1", ENABLE to "1" + * Read Registers: + * (1) Read BUSY flag from 0xb803. Wait until BUSY signal is 0. + * (2) Write IND_ADDR at 0xb800 ~ 0xb801. Set R/W to "0", ENABLE to "1" + * (3) Read BUSY flag from 0xb803. Wait until BUSY signal is 0. + * (4) Read IND_DATA from 0xb804 ~ 0xb807 + */ +#define TW5864_IND_CTL 0xb800 +/* Define controls in register TW5864_IND_CTL */ +/* Address used to access indirect register space */ +#define TW5864_IND_ADDR 0x0000ffff +/* Wait until this bit is "0" before using indirect access */ +#define TW5864_BUSY BIT(31) +/* Activate the indirect access. This bit is self cleared */ +#define TW5864_ENABLE BIT(25) +/* Read/Write command */ +#define TW5864_RW BIT(24) + +/* [31:0] Data used to read/write indirect register space */ +#define TW5864_IND_DATA 0xb804 + +/* 0xc000 ~ 0xc7fc -- Preview Register Map */ +/* Mostly skipped this section. */ +/* + * [15:0] Status of Vsync Synchronized PCI_PV_CH_EN (Read Only) + * 1 Channel Enabled + * 0 Channel Disabled + */ +#define TW5864_PCI_PV_CH_STATUS 0xc000 +/* + * [15:0] PCI Preview Path Enable for channel n + * 1 Channel Enable + * 0 Channel Disable + */ +#define TW5864_PCI_PV_CH_EN 0xc004 + +/* 0xc800 ~ 0xc804 -- JPEG Capture Register Map */ +/* Skipped. */ +/* 0xd000 ~ 0xd0fc -- JPEG Control Register Map */ +/* Skipped. */ + +/* 0xe000 ~ 0xfc04 – Motion Vector Register Map */ + +/* ME Motion Vector data (Four Byte Each) 0xe000 ~ 0xe7fc */ +#define TW5864_ME_MV_VEC_START 0xe000 +#define TW5864_ME_MV_VEC_MAX_OFFSET 0x1ff +#define TW5864_ME_MV_VEC(offset) (TW5864_ME_MV_VEC_START + 4 * offset) + +#define TW5864_MV 0xfc00 +/* Define controls in register TW5864_MV */ +/* mv bank0 full status , write "1" to clear */ +#define TW5864_MV_BK0_FULL BIT(0) +/* mv bank1 full status , write "1" to clear */ +#define TW5864_MV_BK1_FULL BIT(1) +/* slice end status; write "1" to clear */ +#define TW5864_MV_EOF BIT(2) +/* mv encode interrupt status; write "1" to clear */ +#define TW5864_MV_DSP_INTR BIT(3) +/* mv write memory overflow, write "1" to clear */ +#define TW5864_DSP_WR_OF BIT(4) +#define TW5864_MV_LEN_SHIFT 5 +/* mv stream length */ +#define TW5864_MV_LEN (0xff << 5) +/* The configured status bit written into bit 15 of 0xfc04 */ +#define TW5864_MPI_DDR_SEL BIT(13) + +#define TW5864_MPI_DDR_SEL_REG 0xfc04 +/* Define controls in register TW5864_MPI_DDR_SEL_REG */ +/* + * SW configure register + * 0 MV is saved in internal DPR + * 1 MV is saved in DDR + */ +#define TW5864_MPI_DDR_SEL2 BIT(15) + +/* 0x18000 ~ 0x181fc – PCI Master/Slave Control Map */ +#define TW5864_PCI_INTR_STATUS 0x18000 +/* Define controls in register TW5864_PCI_INTR_STATUS */ +/* vlc done */ +#define TW5864_VLC_DONE_INTR BIT(1) +/* ad vsync */ +#define TW5864_AD_VSYNC_INTR BIT(3) +/* preview eof */ +#define TW5864_PREV_EOF_INTR BIT(4) +/* preview overflow interrupt */ +#define TW5864_PREV_OVERFLOW_INTR BIT(5) +/* timer interrupt */ +#define TW5864_TIMER_INTR BIT(6) +/* audio eof */ +#define TW5864_AUDIO_EOF_INTR BIT(8) +/* IIC done */ +#define TW5864_IIC_DONE_INTR BIT(24) +/* ad interrupt (e.g.: video lost, video format changed) */ +#define TW5864_AD_INTR_REG BIT(25) + +#define TW5864_PCI_INTR_CTL 0x18004 +/* Define controls in register TW5864_PCI_INTR_CTL */ +/* master enable */ +#define TW5864_PCI_MAST_ENB BIT(0) +/* mvd&vlc master enable */ +#define TW5864_MVD_VLC_MAST_ENB 0x06 +/* (Need to set 0 in TW5864A) */ +#define TW5864_AD_MAST_ENB BIT(3) +/* preview master enable */ +#define TW5864_PREV_MAST_ENB BIT(4) +/* preview overflow enable */ +#define TW5864_PREV_OVERFLOW_ENB BIT(5) +/* timer interrupt enable */ +#define TW5864_TIMER_INTR_ENB BIT(6) +/* JPEG master (push mode) enable */ +#define TW5864_JPEG_MAST_ENB BIT(7) +#define TW5864_AU_MAST_ENB_CHN_SHIFT 8 +/* audio master channel enable */ +#define TW5864_AU_MAST_ENB_CHN (0xffff << 8) +/* IIC interrupt enable */ +#define TW5864_IIC_INTR_ENB BIT(24) +/* ad interrupt enable */ +#define TW5864_AD_INTR_ENB BIT(25) +/* target burst enable */ +#define TW5864_PCI_TAR_BURST_ENB BIT(26) +/* vlc stream burst enable */ +#define TW5864_PCI_VLC_BURST_ENB BIT(27) +/* ddr burst enable (1 enable, and must set DDR_BRST_EN) */ +#define TW5864_PCI_DDR_BURST_ENB BIT(28) + +/* + * Because preview and audio have 16 channels separately, so using this + * registers to indicate interrupt status for every channels. This is secondary + * interrupt status register. OR operating of the PREV_INTR_REG is + * PREV_EOF_INTR, OR operating of the AU_INTR_REG bits is AUDIO_EOF_INTR + */ +#define TW5864_PREV_AND_AU_INTR 0x18008 +/* Define controls in register TW5864_PREV_AND_AU_INTR */ +/* preview eof interrupt flag */ +#define TW5864_PREV_INTR_REG 0x0000ffff +#define TW5864_AU_INTR_REG_SHIFT 16 +/* audio eof interrupt flag */ +#define TW5864_AU_INTR_REG (0xffff << 16) + +#define TW5864_MASTER_ENB_REG 0x1800c +/* Define controls in register TW5864_MASTER_ENB_REG */ +/* master enable */ +#define TW5864_PCI_VLC_INTR_ENB BIT(1) +/* mvd and vlc master enable */ +#define TW5864_PCI_PREV_INTR_ENB BIT(4) +/* ad vsync master enable */ +#define TW5864_PCI_PREV_OF_INTR_ENB BIT(5) +/* jpeg master enable */ +#define TW5864_PCI_JPEG_INTR_ENB BIT(7) +/* preview master enable */ +#define TW5864_PCI_AUD_INTR_ENB BIT(8) + +/* + * Every channel of preview and audio have ping-pong buffers in system memory, + * this register is the buffer flag to notify software which buffer is been + * operated. + */ +#define TW5864_PREV_AND_AU_BUF_FLAG 0x18010 +/* Define controls in register TW5864_PREV_AND_AU_BUF_FLAG */ +/* preview buffer A/B flag */ +#define TW5864_PREV_BUF_FLAG 0xffff +#define TW5864_AUDIO_BUF_FLAG_SHIFT 16 +/* audio buffer A/B flag */ +#define TW5864_AUDIO_BUF_FLAG (0xffff << 16) + +#define TW5864_IIC 0x18014 +/* Define controls in register TW5864_IIC */ +/* register data */ +#define TW5864_IIC_DATA 0x00ff +#define TW5864_IIC_REG_ADDR_SHIFT 8 +/* register addr */ +#define TW5864_IIC_REG_ADDR (0xff << 8) +/* rd/wr flag rd=1,wr=0 */ +#define TW5864_IIC_RW BIT(16) +#define TW5864_IIC_DEV_ADDR_SHIFT 17 +/* device addr */ +#define TW5864_IIC_DEV_ADDR (0x7f << 17) +/* + * iic done, software kick off one time iic transaction through setting this + * bit to 1. Then poll this bit, value 1 indicate iic transaction have + * completed, if read, valid data have been stored in iic_data + */ +#define TW5864_IIC_DONE BIT(24) + +#define TW5864_RST_AND_IF_INFO 0x18018 +/* Define controls in register TW5864_RST_AND_IF_INFO */ +/* application software soft reset */ +#define TW5864_APP_SOFT_RST BIT(0) +#define TW5864_PCI_INF_VERSION_SHIFT 16 +/* PCI interface version, read only */ +#define TW5864_PCI_INF_VERSION (0xffff << 16) + +/* vlc stream crc value, it is calculated in pci module */ +#define TW5864_VLC_CRC_REG 0x1801c +/* + * vlc max length, it is defined by software based on software assign memory + * space for vlc + */ +#define TW5864_VLC_MAX_LENGTH 0x18020 +/* vlc length of one frame */ +#define TW5864_VLC_LENGTH 0x18024 +/* vlc original crc value */ +#define TW5864_VLC_INTRA_CRC_I_REG 0x18028 +/* vlc original crc value */ +#define TW5864_VLC_INTRA_CRC_O_REG 0x1802c +/* mv stream crc value, it is calculated in pci module */ +#define TW5864_VLC_PAR_CRC_REG 0x18030 +/* mv length */ +#define TW5864_VLC_PAR_LENGTH_REG 0x18034 +/* mv original crc value */ +#define TW5864_VLC_PAR_I_REG 0x18038 +/* mv original crc value */ +#define TW5864_VLC_PAR_O_REG 0x1803c + +/* + * Configuration register for 9[or 10] CIFs or 1D1+15QCIF Preview mode. + * PREV_PCI_ENB_CHN[0] Enable 9th preview channel (9CIF prev) or 1D1 channel in + * (1D1+15QCIF prev) + * PREV_PCI_ENB_CHN[1] Enable 10th preview channel + */ +#define TW5864_PREV_PCI_ENB_CHN 0x18040 +/* Description skipped. */ +#define TW5864_PREV_FRAME_FORMAT_IN 0x18044 +/* IIC enable */ +#define TW5864_IIC_ENB 0x18048 +/* + * Timer interrupt interval + * 0 1ms + * 1 2ms + * 2 4ms + * 3 8ms + */ +#define TW5864_PCI_INTTM_SCALE 0x1804c + +/* + * The above register is pci base address registers. Application software will + * initialize them to tell chip where the corresponding stream will be dumped + * to. Application software will select appropriate base address interval based + * on the stream length. + */ +/* VLC stream base address */ +#define TW5864_VLC_STREAM_BASE_ADDR 0x18080 +/* MV stream base address */ +#define TW5864_MV_STREAM_BASE_ADDR 0x18084 +/* 0x180a0 – 0x180bc: audio burst base address. Skipped. */ +/* 0x180c0 ~ 0x180dc – JPEG Push Mode Buffer Base Address. Skipped. */ +/* 0x18100 – 0x1817c: preview burst base address. Skipped. */ + +/* 0x80000 ~ 0x87fff -- DDR Burst RW Register Map */ +#define TW5864_DDR_CTL 0x80000 +/* Define controls in register TW5864_DDR_CTL */ +#define TW5864_BRST_LENGTH_SHIFT 2 +/* Length of 32-bit data burst */ +#define TW5864_BRST_LENGTH (0x3fff << 2) +/* + * Burst Read/Write + * 0 Read Burst from DDR + * 1 Write Burst to DDR + */ +#define TW5864_BRST_RW BIT(16) +/* Begin a new DDR Burst. This bit is self cleared */ +#define TW5864_NEW_BRST_CMD BIT(17) +/* DDR Burst End Flag */ +#define TW5864_BRST_END BIT(24) +/* Enable Error Interrupt for Single DDR Access */ +#define TW5864_SING_ERR_INTR BIT(25) +/* Enable Error Interrupt for Burst DDR Access */ +#define TW5864_BRST_ERR_INTR BIT(26) +/* Enable Interrupt for End of DDR Burst Access */ +#define TW5864_BRST_END_INTR BIT(27) +/* DDR Single Access Error Flag */ +#define TW5864_SINGLE_ERR BIT(28) +/* DDR Single Access Busy Flag */ +#define TW5864_SINGLE_BUSY BIT(29) +/* DDR Burst Access Error Flag */ +#define TW5864_BRST_ERR BIT(30) +/* DDR Burst Access Busy Flag */ +#define TW5864_BRST_BUSY BIT(31) + +/* [27:0] DDR Access Address. Bit [1:0] has to be 0 */ +#define TW5864_DDR_ADDR 0x80004 +/* DDR Access Internal Buffer Address. Bit [1:0] has to be 0 */ +#define TW5864_DPR_BUF_ADDR 0x80008 +/* SRAM Buffer MPI Access Space. Totally 16 KB */ +#define TW5864_DPR_BUF_START 0x84000 +/* 0x84000 - 0x87ffc */ +#define TW5864_DPR_BUF_SIZE 0x4000 + +/* Indirect Map Space */ +/* + * The indirect space is accessed through 0xb800 ~ 0xb807 registers in direct + * access space + */ +/* Analog Video / Audio Decoder / Encoder */ +/* Allowed channel values: [0; 3] */ +/* Read-only register */ +#define TW5864_INDIR_VIN_0(channel) (0x000 + channel * 0x010) +/* Define controls in register TW5864_INDIR_VIN_0 */ +/* + * 1 Video not present. (sync is not detected in number of consecutive line + * periods specified by MISSCNT register) + * 0 Video detected. + */ +#define TW5864_INDIR_VIN_0_VDLOSS BIT(7) +/* + * 1 Horizontal sync PLL is locked to the incoming video source. + * 0 Horizontal sync PLL is not locked. + */ +#define TW5864_INDIR_VIN_0_HLOCK BIT(6) +/* + * 1 Sub-carrier PLL is locked to the incoming video source. + * 0 Sub-carrier PLL is not locked. + */ +#define TW5864_INDIR_VIN_0_SLOCK BIT(5) +/* + * 1 Even field is being decoded. + * 0 Odd field is being decoded. + */ +#define TW5864_INDIR_VIN_0_FLD BIT(4) +/* + * 1 Vertical logic is locked to the incoming video source. + * 0 Vertical logic is not locked. + */ +#define TW5864_INDIR_VIN_0_VLOCK BIT(3) +/* + * 1 No color burst signal detected. + * 0 Color burst signal detected. + */ +#define TW5864_INDIR_VIN_0_MONO BIT(1) +/* + * 0 60Hz source detected + * 1 50Hz source detected + * The actual vertical scanning frequency depends on the current standard + * invoked. + */ +#define TW5864_INDIR_VIN_0_DET50 BIT(0) + +#define TW5864_INDIR_VIN_1(channel) (0x001 + channel * 0x010) +/* VCR signal indicator. Read-only. */ +#define TW5864_INDIR_VIN_1_VCR BIT(7) +/* Weak signal indicator 2. Read-only. */ +#define TW5864_INDIR_VIN_1_WKAIR BIT(6) +/* Weak signal indicator controlled by WKTH. Read-only. */ +#define TW5864_INDIR_VIN_1_WKAIR1 BIT(5) +/* + * 1 = Standard signal + * 0 = Non-standard signal + * Read-only + */ +#define TW5864_INDIR_VIN_1_VSTD BIT(4) +/* + * 1 = Non-interlaced signal + * 0 = interlaced signal + * Read-only + */ +#define TW5864_INDIR_VIN_1_NINTL BIT(3) +/* + * Vertical Sharpness Control. Writable. + * 0 = None (default) + * 7 = Highest + * **Note: VSHP must be set to ‘0’ if COMB = 0 + */ +#define TW5864_INDIR_VIN_1_VSHP 0x07 + +/* HDELAY_XY[7:0] */ +#define TW5864_INDIR_VIN_2_HDELAY_XY_LO(channel) (0x002 + channel * 0x010) +/* HACTIVE_XY[7:0] */ +#define TW5864_INDIR_VIN_3_HACTIVE_XY_LO(channel) (0x003 + channel * 0x010) +/* VDELAY_XY[7:0] */ +#define TW5864_INDIR_VIN_4_VDELAY_XY_LO(channel) (0x004 + channel * 0x010) +/* VACTIVE_XY[7:0] */ +#define TW5864_INDIR_VIN_5_VACTIVE_XY_LO(channel) (0x005 + channel * 0x010) + +#define TW5864_INDIR_VIN_6(channel) (0x006 + channel * 0x010) +/* Define controls in register TW5864_INDIR_VIN_6 */ +#define TW5864_INDIR_VIN_6_HDELAY_XY_HI 0x03 +#define TW5864_INDIR_VIN_6_HACTIVE_XY_HI_SHIFT 2 +#define TW5864_INDIR_VIN_6_HACTIVE_XY_HI (0x03 << 2) +#define TW5864_INDIR_VIN_6_VDELAY_XY_HI BIT(4) +#define TW5864_INDIR_VIN_6_VACTIVE_XY_HI BIT(5) + +/* + * HDELAY_XY This 10bit register defines the starting location of horizontal + * active pixel for display / record path. A unit is 1 pixel. The default value + * is 0x00f for NTSC and 0x00a for PAL. + * + * HACTIVE_XY This 10bit register defines the number of horizontal active pixel + * for display / record path. A unit is 1 pixel. The default value is decimal + * 720. + * + * VDELAY_XY This 9bit register defines the starting location of vertical + * active for display / record path. A unit is 1 line. The default value is + * decimal 6. + * + * VACTIVE_XY This 9bit register defines the number of vertical active lines + * for display / record path. A unit is 1 line. The default value is decimal + * 240. + */ + +/* HUE These bits control the color hue as 2's complement number. They have + * value from +36o (7Fh) to -36o (80h) with an increment of 2.8o. The 2 LSB has + * no effect. The positive value gives greenish tone and negative value gives + * purplish tone. The default value is 0o (00h). This is effective only on NTSC + * system. The default is 00h. + */ +#define TW5864_INDIR_VIN_7_HUE(channel) (0x007 + channel * 0x010) + +#define TW5864_INDIR_VIN_8(channel) (0x008 + channel * 0x010) +/* Define controls in register TW5864_INDIR_VIN_8 */ +/* + * This bit controls the center frequency of the peaking filter. + * The corresponding gain adjustment is HFLT. + * 0 Low + * 1 center + */ +#define TW5864_INDIR_VIN_8_SCURVE BIT(7) +/* CTI level selection. The default is 1. + * 0 None + * 3 Highest + */ +#define TW5864_INDIR_VIN_8_CTI_SHIFT 4 +#define TW5864_INDIR_VIN_8_CTI (0x03 << 4) + +/* + * These bits control the amount of sharpness enhancement on the luminance + * signals. There are 16 levels of control with "0" having no effect on the + * output image. 1 through 15 provides sharpness enhancement with "F" being the + * strongest. The default is 1. + */ +#define TW5864_INDIR_VIN_8_SHARPNESS 0x0f + +/* + * These bits control the luminance contrast gain. A value of 100 (64h) has a + * gain of 1. The range adjustment is from 0% to 255% at 1% per step. The + * default is 64h. + */ +#define TW5864_INDIR_VIN_9_CNTRST(channel) (0x009 + channel * 0x010) + +/* + * These bits control the brightness. They have value of –128 to 127 in 2's + * complement form. Positive value increases brightness. A value 0 has no + * effect on the data. The default is 00h. + */ +#define TW5864_INDIR_VIN_A_BRIGHT(channel) (0x00a + channel * 0x010) + +/* + * These bits control the digital gain adjustment to the U (or Cb) component of + * the digital video signal. The color saturation can be adjusted by adjusting + * the U and V color gain components by the same amount in the normal + * situation. The U and V can also be adjusted independently to provide greater + * flexibility. The range of adjustment is 0 to 200%. A value of 128 (80h) has + * gain of 100%. The default is 80h. + */ +#define TW5864_INDIR_VIN_B_SAT_U(channel) (0x00b + channel * 0x010) + +/* + * These bits control the digital gain adjustment to the V (or Cr) component of + * the digital video signal. The color saturation can be adjusted by adjusting + * the U and V color gain components by the same amount in the normal + * situation. The U and V can also be adjusted independently to provide greater + * flexibility. The range of adjustment is 0 to 200%. A value of 128 (80h) has + * gain of 100%. The default is 80h. + */ +#define TW5864_INDIR_VIN_C_SAT_V(channel) (0x00c + channel * 0x010) + +/* Read-only */ +#define TW5864_INDIR_VIN_D(channel) (0x00d + channel * 0x010) +/* Define controls in register TW5864_INDIR_VIN_D */ +/* Macrovision color stripe detection may be un-reliable */ +#define TW5864_INDIR_VIN_D_CSBAD BIT(3) +/* Macrovision AGC pulse detected */ +#define TW5864_INDIR_VIN_D_MCVSN BIT(2) +/* Macrovision color stripe protection burst detected */ +#define TW5864_INDIR_VIN_D_CSTRIPE BIT(1) +/* + * This bit is valid only when color stripe protection is detected, i.e. if + * CSTRIPE=1, + * 1 Type 2 color stripe protection + * 0 Type 3 color stripe protection + */ +#define TW5864_INDIR_VIN_D_CTYPE2 BIT(0) + +/* Read-only */ +#define TW5864_INDIR_VIN_E(channel) (0x00e + channel * 0x010) +/* Define controls in register TW5864_INDIR_VIN_E */ +/* + * Read-only. + * 0 Idle + * 1 Detection in progress + */ +#define TW5864_INDIR_VIN_E_DETSTUS BIT(7) +/* + * STDNOW Current standard invoked + * 0 NTSC (M) + * 1 PAL (B, D, G, H, I) + * 2 SECAM + * 3 NTSC4.43 + * 4 PAL (M) + * 5 PAL (CN) + * 6 PAL 60 + * 7 Not valid + */ +#define TW5864_INDIR_VIN_E_STDNOW_SHIFT 4 +#define TW5864_INDIR_VIN_E_STDNOW (0x07 << 4) + +/* + * 1 Disable the shadow registers + * 0 Enable VACTIVE and HDELAY shadow registers value depending on STANDARD. + * (Default) + */ +#define TW5864_INDIR_VIN_E_ATREG BIT(3) +/* + * STANDARD Standard selection + * 0 NTSC (M) + * 1 PAL (B, D, G, H, I) + * 2 SECAM + * 3 NTSC4.43 + * 4 PAL (M) + * 5 PAL (CN) + * 6 PAL 60 + * 7 Auto detection (Default) + */ +#define TW5864_INDIR_VIN_E_STANDARD 0x07 + +#define TW5864_INDIR_VIN_F(channel) (0x00f + channel * 0x010) +/* Define controls in register TW5864_INDIR_VIN_F */ +/* + * 1 Writing 1 to this bit will manually initiate the auto format detection + * process. This bit is a self-clearing bit + * 0 Manual initiation of auto format detection is done. (Default) + */ +#define TW5864_INDIR_VIN_F_ATSTART BIT(7) +/* Enable recognition of PAL60 (Default) */ +#define TW5864_INDIR_VIN_F_PAL60EN BIT(6) +/* Enable recognition of PAL (CN). (Default) */ +#define TW5864_INDIR_VIN_F_PALCNEN BIT(5) +/* Enable recognition of PAL (M). (Default) */ +#define TW5864_INDIR_VIN_F_PALMEN BIT(4) +/* Enable recognition of NTSC 4.43. (Default) */ +#define TW5864_INDIR_VIN_F_NTSC44EN BIT(3) +/* Enable recognition of SECAM. (Default) */ +#define TW5864_INDIR_VIN_F_SECAMEN BIT(2) +/* Enable recognition of PAL (B, D, G, H, I). (Default) */ +#define TW5864_INDIR_VIN_F_PALBEN BIT(1) +/* Enable recognition of NTSC (M). (Default) */ +#define TW5864_INDIR_VIN_F_NTSCEN BIT(0) + +/* Some registers skipped. */ + +/* Use falling edge to sample VD1-VD4 from 54 MHz to 108 MHz */ +#define TW5864_INDIR_VD_108_POL 0x041 +#define TW5864_INDIR_VD_108_POL_VD12 BIT(0) +#define TW5864_INDIR_VD_108_POL_VD34 BIT(1) +#define TW5864_INDIR_VD_108_POL_BOTH \ + (TW5864_INDIR_VD_108_POL_VD12 | TW5864_INDIR_VD_108_POL_VD34) + +/* Some registers skipped. */ + +/* + * Audio Input ADC gain control + * 0 0.25 + * 1 0.31 + * 2 0.38 + * 3 0.44 + * 4 0.50 + * 5 0.63 + * 6 0.75 + * 7 0.88 + * 8 1.00 (default) + * 9 1.25 + * 10 1.50 + * 11 1.75 + * 12 2.00 + * 13 2.25 + * 14 2.50 + * 15 2.75 + */ +/* [3:0] channel 0, [7:4] channel 1 */ +#define TW5864_INDIR_AIGAIN1 0x060 +/* [3:0] channel 2, [7:4] channel 3 */ +#define TW5864_INDIR_AIGAIN2 0x061 + +/* Some registers skipped */ + +#define TW5864_INDIR_AIN_0x06D 0x06d +/* Define controls in register TW5864_INDIR_AIN_0x06D */ +/* + * LAWMD Select u-Law/A-Law/PCM/SB data output format on ADATR and ADATM pin. + * 0 PCM output (default) + * 1 SB (Signed MSB bit in PCM data is inverted) output + * 2 u-Law output + * 3 A-Law output + */ +#define TW5864_INDIR_AIN_LAWMD_SHIFT 6 +#define TW5864_INDIR_AIN_LAWMD (0x03 << 6) +/* + * Disable the mixing ratio value for all audio. + * 0 Apply individual mixing ratio value for each audio (default) + * 1 Apply nominal value for all audio commonly + */ +#define TW5864_INDIR_AIN_MIX_DERATIO BIT(5) +/* + * Enable the mute function for audio channel AINn when n is 0 to 3. It effects + * only for mixing. When n = 4, it enable the mute function of the playback + * audio input. It effects only for single chip or the last stage chip + * 0 Normal + * 1 Muted (default) + */ +#define TW5864_INDIR_AIN_MIX_MUTE 0x1f + +/* Some registers skipped */ + +#define TW5864_INDIR_AIN_0x0E3 0x0e3 +/* Define controls in register TW5864_INDIR_AIN_0x0E3 */ +/* + * ADATP signal is coming from external ADPCM decoder, instead of on-chip ADPCM + * decoder + */ +#define TW5864_INDIR_AIN_0x0E3_EXT_ADATP BIT(7) +/* ACLKP output signal polarity inverse */ +#define TW5864_INDIR_AIN_0x0E3_ACLKPPOLO BIT(6) +/* + * ACLKR input signal polarity inverse. + * 0 Not inversed (Default) + * 1 Inversed + */ +#define TW5864_INDIR_AIN_0x0E3_ACLKRPOL BIT(5) +/* + * ACLKP input signal polarity inverse. + * 0 Not inversed (Default) + * 1 Inversed + */ +#define TW5864_INDIR_AIN_0x0E3_ACLKPPOLI BIT(4) +/* + * ACKI [21:0] control automatic set up with AFMD registers + * This mode is only effective when ACLKRMASTER=1 + * 0 ACKI [21:0] registers set up ACKI control + * 1 ACKI control is automatically set up by AFMD register values + */ +#define TW5864_INDIR_AIN_0x0E3_AFAUTO BIT(3) +/* + * AFAUTO control mode + * 0 8kHz setting (Default) + * 1 16kHz setting + * 2 32kHz setting + * 3 44.1kHz setting + * 4 48kHz setting + */ +#define TW5864_INDIR_AIN_0x0E3_AFMD 0x07 + +#define TW5864_INDIR_AIN_0x0E4 0x0e4 +/* Define controls in register TW5864_INDIR_AIN_0x0ED */ +/* + * 8bit I2S Record output mode. + * 0 L/R half length separated output (Default). + * 1 One continuous packed output equal to DSP output format. + */ +#define TW5864_INDIR_AIN_0x0E4_I2S8MODE BIT(7) +/* + * Audio Clock Master ACLKR output wave format. + * 0 High periods is one 27MHz clock period (default). + * 1 Almost duty 50-50% clock output on ACLKR pin. If this mode is selected, two + * times bigger number value need to be set up on the ACKI register. If + * AFAUTO=1, ACKI control is automatically set up even if MASCKMD=1. + */ +#define TW5864_INDIR_AIN_0x0E4_MASCKMD BIT(6) +/* Playback ACLKP/ASYNP/ADATP input data MSB-LSB swapping */ +#define TW5864_INDIR_AIN_0x0E4_PBINSWAP BIT(5) +/* + * ASYNR input signal delay. + * 0 No delay + * 1 Add one 27MHz period delay in ASYNR signal input + */ +#define TW5864_INDIR_AIN_0x0E4_ASYNRDLY BIT(4) +/* + * ASYNP input signal delay. + * 0 no delay + * 1 add one 27MHz period delay in ASYNP signal input + */ +#define TW5864_INDIR_AIN_0x0E4_ASYNPDLY BIT(3) +/* + * ADATP input data delay by one ACLKP clock. + * 0 No delay (Default). This is for I2S type 1T delay input interface. + * 1 Add 1 ACLKP clock delay in ADATP input data. This is for left-justified + * type 0T delay input interface. + */ +#define TW5864_INDIR_AIN_0x0E4_ADATPDLY BIT(2) +/* + * Select u-Law/A-Law/PCM/SB data input format on ADATP pin. + * 0 PCM input (Default) + * 1 SB (Signed MSB bit in PCM data is inverted) input + * 2 u-Law input + * 3 A-Law input + */ +#define TW5864_INDIR_AIN_0x0E4_INLAWMD 0x03 + +/* + * Enable state register updating and interrupt request of audio AIN5 detection + * for each input + */ +#define TW5864_INDIR_AIN_A5DETENA 0x0e5 + +/* Some registers skipped */ + +/* + * [7:3]: DEV_ID The TW5864 product ID code is 01000 + * [2:0]: REV_ID The revision number is 0h + */ +#define TW5864_INDIR_ID 0x0fe + +#define TW5864_INDIR_IN_PIC_WIDTH(channel) (0x200 + 4 * channel) +#define TW5864_INDIR_IN_PIC_HEIGHT(channel) (0x201 + 4 * channel) +#define TW5864_INDIR_OUT_PIC_WIDTH(channel) (0x202 + 4 * channel) +#define TW5864_INDIR_OUT_PIC_HEIGHT(channel) (0x203 + 4 * channel) +/* + * Interrupt status register from the front-end. Write "1" to each bit to clear + * the interrupt + * 15:0 Motion detection interrupt for channel 0 ~ 15 + * 31:16 Night detection interrupt for channel 0 ~ 15 + * 47:32 Blind detection interrupt for channel 0 ~ 15 + * 63:48 No video interrupt for channel 0 ~ 15 + * 79:64 Line mode underflow interrupt for channel 0 ~ 15 + * 95:80 Line mode overflow interrupt for channel 0 ~ 15 + */ +/* 0x2d0~0x2d7: [63:0] bits */ +#define TW5864_INDIR_INTERRUPT1 0x2d0 +/* 0x2e0~0x2e3: [95:64] bits */ +#define TW5864_INDIR_INTERRUPT2 0x2e0 + +/* + * Interrupt mask register for interrupts in 0x2d0 ~ 0x2d7 + * 15:0 Motion detection interrupt for channel 0 ~ 15 + * 31:16 Night detection interrupt for channel 0 ~ 15 + * 47:32 Blind detection interrupt for channel 0 ~ 15 + * 63:48 No video interrupt for channel 0 ~ 15 + * 79:64 Line mode underflow interrupt for channel 0 ~ 15 + * 95:80 Line mode overflow interrupt for channel 0 ~ 15 + */ +/* 0x2d8~0x2df: [63:0] bits */ +#define TW5864_INDIR_INTERRUPT_MASK1 0x2d8 +/* 0x2e8~0x2eb: [95:64] bits */ +#define TW5864_INDIR_INTERRUPT_MASK2 0x2e8 + +/* [11:0]: Interrupt summary register for interrupts & interrupt mask from in + * 0x2d0 ~ 0x2d7 and 0x2d8 ~ 0x2df + * bit 0: interrupt occurs in 0x2d0 & 0x2d8 + * bit 1: interrupt occurs in 0x2d1 & 0x2d9 + * bit 2: interrupt occurs in 0x2d2 & 0x2da + * bit 3: interrupt occurs in 0x2d3 & 0x2db + * bit 4: interrupt occurs in 0x2d4 & 0x2dc + * bit 5: interrupt occurs in 0x2d5 & 0x2dd + * bit 6: interrupt occurs in 0x2d6 & 0x2de + * bit 7: interrupt occurs in 0x2d7 & 0x2df + * bit 8: interrupt occurs in 0x2e0 & 0x2e8 + * bit 9: interrupt occurs in 0x2e1 & 0x2e9 + * bit 10: interrupt occurs in 0x2e2 & 0x2ea + * bit 11: interrupt occurs in 0x2e3 & 0x2eb + */ +#define TW5864_INDIR_INTERRUPT_SUMMARY 0x2f0 + +/* Motion / Blind / Night Detection */ +/* valid value for channel is [0:15] */ +#define TW5864_INDIR_DETECTION_CTL0(channel) (0x300 + channel * 0x08) +/* Define controls in register TW5864_INDIR_DETECTION_CTL0 */ +/* + * Disable the motion and blind detection. + * 0 Enable motion and blind detection (default) + * 1 Disable motion and blind detection + */ +#define TW5864_INDIR_DETECTION_CTL0_MD_DIS BIT(5) +/* + * Request to start motion detection on manual trigger mode + * 0 None Operation (default) + * 1 Request to start motion detection + */ +#define TW5864_INDIR_DETECTION_CTL0_MD_STRB BIT(3) +/* + * Select the trigger mode of motion detection + * 0 Automatic trigger mode of motion detection (default) + * 1 Manual trigger mode for motion detection + */ +#define TW5864_INDIR_DETECTION_CTL0_MD_STRB_EN BIT(2) +/* + * Define the threshold of cell for blind detection. + * 0 Low threshold (More sensitive) (default) + * : : + * 3 High threshold (Less sensitive) + */ +#define TW5864_INDIR_DETECTION_CTL0_BD_CELSENS 0x03 + +#define TW5864_INDIR_DETECTION_CTL1(channel) (0x301 + channel * 0x08) +/* Define controls in register TW5864_INDIR_DETECTION_CTL1 */ +/* + * Control the temporal sensitivity of motion detector. + * 0 More Sensitive (default) + * : : + * 15 Less Sensitive + */ +#define TW5864_INDIR_DETECTION_CTL1_MD_TMPSENS_SHIFT 4 +#define TW5864_INDIR_DETECTION_CTL1_MD_TMPSENS (0x0f << 4) +/* + * Adjust the horizontal starting position for motion detection + * 0 0 pixel (default) + * : : + * 15 15 pixels + */ +#define TW5864_INDIR_DETECTION_CTL1_MD_PIXEL_OS 0x0f + +#define TW5864_INDIR_DETECTION_CTL2(channel) (0x302 + channel * 0x08) +/* Define controls in register TW5864_INDIR_DETECTION_CTL2 */ +/* + * Control the updating time of reference field for motion detection. + * 0 Update reference field every field (default) + * 1 Update reference field according to MD_SPEED + */ +#define TW5864_INDIR_DETECTION_CTL2_MD_REFFLD BIT(7) +/* + * Select the field for motion detection. + * 0 Detecting motion for only odd field (default) + * 1 Detecting motion for only even field + * 2 Detecting motion for any field + * 3 Detecting motion for both odd and even field + */ +#define TW5864_INDIR_DETECTION_CTL2_MD_FIELD_SHIFT 5 +#define TW5864_INDIR_DETECTION_CTL2_MD_FIELD (0x03 << 5) +/* + * Control the level sensitivity of motion detector. + * 0 More sensitive (default) + * : : + * 15 Less sensitive + */ +#define TW5864_INDIR_DETECTION_CTL2_MD_LVSENS 0x1f + +#define TW5864_INDIR_DETECTION_CTL3(channel) (0x303 + channel * 0x08) +/* Define controls in register TW5864_INDIR_DETECTION_CTL3 */ +/* + * Define the threshold of sub-cell number for motion detection. + * 0 Motion is detected if 1 sub-cell has motion (More sensitive) (default) + * 1 Motion is detected if 2 sub-cells have motion + * 2 Motion is detected if 3 sub-cells have motion + * 3 Motion is detected if 4 sub-cells have motion (Less sensitive) + */ +#define TW5864_INDIR_DETECTION_CTL3_MD_CELSENS_SHIFT 6 +#define TW5864_INDIR_DETECTION_CTL3_MD_CELSENS (0x03 << 6) +/* + * Control the velocity of motion detector. + * Large value is suitable for slow motion detection. + * In MD_DUAL_EN = 1, MD_SPEED should be limited to 0 ~ 31. + * 0 1 field intervals (default) + * 1 2 field intervals + * : : + * 61 62 field intervals + * 62 63 field intervals + * 63 Not supported + */ +#define TW5864_INDIR_DETECTION_CTL3_MD_SPEED 0x3f + +#define TW5864_INDIR_DETECTION_CTL4(channel) (0x304 + channel * 0x08) +/* Define controls in register TW5864_INDIR_DETECTION_CTL4 */ +/* + * Control the spatial sensitivity of motion detector. + * 0 More Sensitive (default) + * : : + * 15 Less Sensitive + */ +#define TW5864_INDIR_DETECTION_CTL4_MD_SPSENS_SHIFT 4 +#define TW5864_INDIR_DETECTION_CTL4_MD_SPSENS (0x0f << 4) +/* + * Define the threshold of level for blind detection. + * 0 Low threshold (More sensitive) (default) + * : : + * 15 High threshold (Less sensitive) + */ +#define TW5864_INDIR_DETECTION_CTL4_BD_LVSENS 0x0f + +#define TW5864_INDIR_DETECTION_CTL5(channel) (0x305 + channel * 0x08) +/* + * Define the threshold of temporal sensitivity for night detection. + * 0 Low threshold (More sensitive) (default) + * : : + * 15 High threshold (Less sensitive) + */ +#define TW5864_INDIR_DETECTION_CTL5_ND_TMPSENS_SHIFT 4 +#define TW5864_INDIR_DETECTION_CTL5_ND_TMPSENS (0x0f << 4) +/* + * Define the threshold of level for night detection. + * 0 Low threshold (More sensitive) (default) + * : : + * 3 High threshold (Less sensitive) + */ +#define TW5864_INDIR_DETECTION_CTL5_ND_LVSENS 0x0f + +/* + * [11:0] The base address of the motion detection buffer. This address is in + * unit of 64K bytes. The generated DDR address will be {MD_BASE_ADDR, + * 16"h0000}. The default value should be 12"h000 + */ +#define TW5864_INDIR_MD_BASE_ADDR 0x380 + +/* + * This controls the channel of the motion detection result shown in register + * 0x3a0 ~ 0x3b7. Before reading back motion result, always set this first. + */ +#define TW5864_INDIR_RGR_MOTION_SEL 0x382 + +/* [15:0] MD strobe has been performed at channel n (read only) */ +#define TW5864_INDIR_MD_STRB 0x386 +/* NO_VIDEO Detected from channel n (read only) */ +#define TW5864_INDIR_NOVID_DET 0x388 +/* Motion Detected from channel n (read only) */ +#define TW5864_INDIR_MD_DET 0x38a +/* Blind Detected from channel n (read only) */ +#define TW5864_INDIR_BD_DET 0x38c +/* Night Detected from channel n (read only) */ +#define TW5864_INDIR_ND_DET 0x38e + +/* 192 bit motion flag of the channel specified by RGR_MOTION_SEL in 0x382 */ +#define TW5864_INDIR_MOTION_FLAG 0x3a0 +#define TW5864_INDIR_MOTION_FLAG_BYTE_COUNT 24 + +/* + * [9:0] The motion cell count of a specific channel selected by 0x382. This is + * for DI purpose + */ +#define TW5864_INDIR_MD_DI_CNT 0x3b8 +/* The motion detection cell sensitivity for DI purpose */ +#define TW5864_INDIR_MD_DI_CELLSENS 0x3ba +/* The motion detection threshold level for DI purpose */ +#define TW5864_INDIR_MD_DI_LVSENS 0x3bb + +/* 192 bit motion mask of the channel specified by MASK_CH_SEL in 0x3fe */ +#define TW5864_INDIR_MOTION_MASK 0x3e0 +#define TW5864_INDIR_MOTION_MASK_BYTE_COUNT 24 + +/* [4:0] The channel selection to access masks in 0x3e0 ~ 0x3f7 */ +#define TW5864_INDIR_MASK_CH_SEL 0x3fe + +/* Clock PLL / Analog IP Control */ +/* Some registers skipped */ + +#define TW5864_INDIR_DDRA_DLL_DQS_SEL0 0xee6 +#define TW5864_INDIR_DDRA_DLL_DQS_SEL1 0xee7 +#define TW5864_INDIR_DDRA_DLL_CLK90_SEL 0xee8 +#define TW5864_INDIR_DDRA_DLL_TEST_SEL_AND_TAP_S 0xee9 + +#define TW5864_INDIR_DDRB_DLL_DQS_SEL0 0xeeb +#define TW5864_INDIR_DDRB_DLL_DQS_SEL1 0xeec +#define TW5864_INDIR_DDRB_DLL_CLK90_SEL 0xeed +#define TW5864_INDIR_DDRB_DLL_TEST_SEL_AND_TAP_S 0xeee + +#define TW5864_INDIR_RESET 0xef0 +#define TW5864_INDIR_RESET_VD BIT(7) +#define TW5864_INDIR_RESET_DLL BIT(6) +#define TW5864_INDIR_RESET_MUX_CORE BIT(5) + +#define TW5864_INDIR_PV_VD_CK_POL 0xefd +#define TW5864_INDIR_PV_VD_CK_POL_PV(channel) BIT(channel) +#define TW5864_INDIR_PV_VD_CK_POL_VD(channel) BIT(channel + 4) + +#define TW5864_INDIR_CLK0_SEL 0xefe +#define TW5864_INDIR_CLK0_SEL_VD_SHIFT 0 +#define TW5864_INDIR_CLK0_SEL_VD_MASK 0x3 +#define TW5864_INDIR_CLK0_SEL_PV_SHIFT 2 +#define TW5864_INDIR_CLK0_SEL_PV_MASK (0x3 << 2) +#define TW5864_INDIR_CLK0_SEL_PV2_SHIFT 4 +#define TW5864_INDIR_CLK0_SEL_PV2_MASK (0x3 << 4) diff --git a/drivers/media/pci/tw5864/tw5864-util.c b/drivers/media/pci/tw5864/tw5864-util.c new file mode 100644 index 000000000000..771eef235755 --- /dev/null +++ b/drivers/media/pci/tw5864/tw5864-util.c @@ -0,0 +1,37 @@ +#include "tw5864.h" + +void tw5864_indir_writeb(struct tw5864_dev *dev, u16 addr, u8 data) +{ + int retries = 30000; + + while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries) + ; + if (!retries) + dev_err(&dev->pci->dev, + "tw_indir_writel() retries exhausted before writing\n"); + + tw_writel(TW5864_IND_DATA, data); + tw_writel(TW5864_IND_CTL, addr << 2 | TW5864_RW | TW5864_ENABLE); +} + +u8 tw5864_indir_readb(struct tw5864_dev *dev, u16 addr) +{ + int retries = 30000; + + while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries) + ; + if (!retries) + dev_err(&dev->pci->dev, + "tw_indir_readl() retries exhausted before reading\n"); + + tw_writel(TW5864_IND_CTL, addr << 2 | TW5864_ENABLE); + + retries = 30000; + while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries) + ; + if (!retries) + dev_err(&dev->pci->dev, + "tw_indir_readl() retries exhausted at reading\n"); + + return tw_readl(TW5864_IND_DATA); +} diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c new file mode 100644 index 000000000000..3461ba9162e7 --- /dev/null +++ b/drivers/media/pci/tw5864/tw5864-video.c @@ -0,0 +1,1514 @@ +/* + * TW5864 driver - video encoding functions + * + * Copyright (C) 2016 Bluecherry, LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include + +#include "tw5864.h" +#include "tw5864-reg.h" + +#define QUANTIZATION_TABLE_LEN 96 +#define VLC_LOOKUP_TABLE_LEN 1024 + +static const u16 forward_quantization_table[QUANTIZATION_TABLE_LEN] = { + 0x3333, 0x1f82, 0x3333, 0x1f82, 0x1f82, 0x147b, 0x1f82, 0x147b, + 0x3333, 0x1f82, 0x3333, 0x1f82, 0x1f82, 0x147b, 0x1f82, 0x147b, + 0x2e8c, 0x1d42, 0x2e8c, 0x1d42, 0x1d42, 0x1234, 0x1d42, 0x1234, + 0x2e8c, 0x1d42, 0x2e8c, 0x1d42, 0x1d42, 0x1234, 0x1d42, 0x1234, + 0x2762, 0x199a, 0x2762, 0x199a, 0x199a, 0x1062, 0x199a, 0x1062, + 0x2762, 0x199a, 0x2762, 0x199a, 0x199a, 0x1062, 0x199a, 0x1062, + 0x2492, 0x16c1, 0x2492, 0x16c1, 0x16c1, 0x0e3f, 0x16c1, 0x0e3f, + 0x2492, 0x16c1, 0x2492, 0x16c1, 0x16c1, 0x0e3f, 0x16c1, 0x0e3f, + 0x2000, 0x147b, 0x2000, 0x147b, 0x147b, 0x0d1b, 0x147b, 0x0d1b, + 0x2000, 0x147b, 0x2000, 0x147b, 0x147b, 0x0d1b, 0x147b, 0x0d1b, + 0x1c72, 0x11cf, 0x1c72, 0x11cf, 0x11cf, 0x0b4d, 0x11cf, 0x0b4d, + 0x1c72, 0x11cf, 0x1c72, 0x11cf, 0x11cf, 0x0b4d, 0x11cf, 0x0b4d +}; + +static const u16 inverse_quantization_table[QUANTIZATION_TABLE_LEN] = { + 0x800a, 0x800d, 0x800a, 0x800d, 0x800d, 0x8010, 0x800d, 0x8010, + 0x800a, 0x800d, 0x800a, 0x800d, 0x800d, 0x8010, 0x800d, 0x8010, + 0x800b, 0x800e, 0x800b, 0x800e, 0x800e, 0x8012, 0x800e, 0x8012, + 0x800b, 0x800e, 0x800b, 0x800e, 0x800e, 0x8012, 0x800e, 0x8012, + 0x800d, 0x8010, 0x800d, 0x8010, 0x8010, 0x8014, 0x8010, 0x8014, + 0x800d, 0x8010, 0x800d, 0x8010, 0x8010, 0x8014, 0x8010, 0x8014, + 0x800e, 0x8012, 0x800e, 0x8012, 0x8012, 0x8017, 0x8012, 0x8017, + 0x800e, 0x8012, 0x800e, 0x8012, 0x8012, 0x8017, 0x8012, 0x8017, + 0x8010, 0x8014, 0x8010, 0x8014, 0x8014, 0x8019, 0x8014, 0x8019, + 0x8010, 0x8014, 0x8010, 0x8014, 0x8014, 0x8019, 0x8014, 0x8019, + 0x8012, 0x8017, 0x8012, 0x8017, 0x8017, 0x801d, 0x8017, 0x801d, + 0x8012, 0x8017, 0x8012, 0x8017, 0x8017, 0x801d, 0x8017, 0x801d +}; + +static const u16 encoder_vlc_lookup_table[VLC_LOOKUP_TABLE_LEN] = { + 0x011, 0x000, 0x000, 0x000, 0x065, 0x021, 0x000, 0x000, 0x087, 0x064, + 0x031, 0x000, 0x097, 0x086, 0x075, 0x053, 0x0a7, 0x096, 0x085, 0x063, + 0x0b7, 0x0a6, 0x095, 0x074, 0x0df, 0x0b6, 0x0a5, 0x084, 0x0db, 0x0de, + 0x0b5, 0x094, 0x0d8, 0x0da, 0x0dd, 0x0a4, 0x0ef, 0x0ee, 0x0d9, 0x0b4, + 0x0eb, 0x0ea, 0x0ed, 0x0dc, 0x0ff, 0x0fe, 0x0e9, 0x0ec, 0x0fb, 0x0fa, + 0x0fd, 0x0e8, 0x10f, 0x0f1, 0x0f9, 0x0fc, 0x10b, 0x10e, 0x10d, 0x0f8, + 0x107, 0x10a, 0x109, 0x10c, 0x104, 0x106, 0x105, 0x108, 0x023, 0x000, + 0x000, 0x000, 0x06b, 0x022, 0x000, 0x000, 0x067, 0x057, 0x033, 0x000, + 0x077, 0x06a, 0x069, 0x045, 0x087, 0x066, 0x065, 0x044, 0x084, 0x076, + 0x075, 0x056, 0x097, 0x086, 0x085, 0x068, 0x0bf, 0x096, 0x095, 0x064, + 0x0bb, 0x0be, 0x0bd, 0x074, 0x0cf, 0x0ba, 0x0b9, 0x094, 0x0cb, 0x0ce, + 0x0cd, 0x0bc, 0x0c8, 0x0ca, 0x0c9, 0x0b8, 0x0df, 0x0de, 0x0dd, 0x0cc, + 0x0db, 0x0da, 0x0d9, 0x0dc, 0x0d7, 0x0eb, 0x0d6, 0x0d8, 0x0e9, 0x0e8, + 0x0ea, 0x0d1, 0x0e7, 0x0e6, 0x0e5, 0x0e4, 0x04f, 0x000, 0x000, 0x000, + 0x06f, 0x04e, 0x000, 0x000, 0x06b, 0x05f, 0x04d, 0x000, 0x068, 0x05c, + 0x05e, 0x04c, 0x07f, 0x05a, 0x05b, 0x04b, 0x07b, 0x058, 0x059, 0x04a, + 0x079, 0x06e, 0x06d, 0x049, 0x078, 0x06a, 0x069, 0x048, 0x08f, 0x07e, + 0x07d, 0x05d, 0x08b, 0x08e, 0x07a, 0x06c, 0x09f, 0x08a, 0x08d, 0x07c, + 0x09b, 0x09e, 0x089, 0x08c, 0x098, 0x09a, 0x09d, 0x088, 0x0ad, 0x097, + 0x099, 0x09c, 0x0a9, 0x0ac, 0x0ab, 0x0aa, 0x0a5, 0x0a8, 0x0a7, 0x0a6, + 0x0a1, 0x0a4, 0x0a3, 0x0a2, 0x021, 0x000, 0x000, 0x000, 0x067, 0x011, + 0x000, 0x000, 0x064, 0x066, 0x031, 0x000, 0x063, 0x073, 0x072, 0x065, + 0x062, 0x083, 0x082, 0x070, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x011, 0x010, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x011, 0x021, 0x020, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x023, 0x022, 0x021, 0x020, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x023, 0x022, 0x021, 0x031, + 0x030, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x023, 0x022, 0x033, 0x032, 0x031, 0x030, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x023, 0x030, + 0x031, 0x033, 0x032, 0x035, 0x034, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x037, 0x036, 0x035, 0x034, 0x033, 0x032, + 0x031, 0x041, 0x051, 0x061, 0x071, 0x081, 0x091, 0x0a1, 0x0b1, 0x000, + 0x002, 0x000, 0x0e4, 0x011, 0x0f4, 0x002, 0x024, 0x003, 0x005, 0x012, + 0x034, 0x013, 0x065, 0x024, 0x013, 0x063, 0x015, 0x022, 0x075, 0x034, + 0x044, 0x023, 0x023, 0x073, 0x054, 0x033, 0x033, 0x004, 0x043, 0x014, + 0x011, 0x043, 0x014, 0x001, 0x025, 0x015, 0x035, 0x025, 0x064, 0x055, + 0x045, 0x035, 0x074, 0x065, 0x085, 0x0d5, 0x012, 0x095, 0x055, 0x045, + 0x095, 0x0e5, 0x084, 0x075, 0x022, 0x0a5, 0x094, 0x085, 0x032, 0x0b5, + 0x003, 0x0c5, 0x001, 0x044, 0x0a5, 0x032, 0x0b5, 0x094, 0x0c5, 0x0a4, + 0x0a4, 0x054, 0x0d5, 0x0b4, 0x0b4, 0x064, 0x0f5, 0x0f5, 0x053, 0x0d4, + 0x0e5, 0x0c4, 0x105, 0x105, 0x0c4, 0x074, 0x063, 0x0e4, 0x0d4, 0x084, + 0x073, 0x0f4, 0x004, 0x005, 0x000, 0x053, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x011, 0x021, 0x031, 0x030, 0x011, 0x021, 0x020, 0x000, + 0x011, 0x010, 0x000, 0x000, 0x011, 0x033, 0x032, 0x043, 0x042, 0x053, + 0x052, 0x063, 0x062, 0x073, 0x072, 0x083, 0x082, 0x093, 0x092, 0x091, + 0x037, 0x036, 0x035, 0x034, 0x033, 0x045, 0x044, 0x043, 0x042, 0x053, + 0x052, 0x063, 0x062, 0x061, 0x060, 0x000, 0x045, 0x037, 0x036, 0x035, + 0x044, 0x043, 0x034, 0x033, 0x042, 0x053, 0x052, 0x061, 0x051, 0x060, + 0x000, 0x000, 0x053, 0x037, 0x045, 0x044, 0x036, 0x035, 0x034, 0x043, + 0x033, 0x042, 0x052, 0x051, 0x050, 0x000, 0x000, 0x000, 0x045, 0x044, + 0x043, 0x037, 0x036, 0x035, 0x034, 0x033, 0x042, 0x051, 0x041, 0x050, + 0x000, 0x000, 0x000, 0x000, 0x061, 0x051, 0x037, 0x036, 0x035, 0x034, + 0x033, 0x032, 0x041, 0x031, 0x060, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x061, 0x051, 0x035, 0x034, 0x033, 0x023, 0x032, 0x041, 0x031, 0x060, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x061, 0x041, 0x051, 0x033, + 0x023, 0x022, 0x032, 0x031, 0x060, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x061, 0x060, 0x041, 0x023, 0x022, 0x031, 0x021, 0x051, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x051, 0x050, + 0x031, 0x023, 0x022, 0x021, 0x041, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x040, 0x041, 0x031, 0x032, 0x011, 0x033, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x040, 0x041, 0x021, 0x011, 0x031, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x030, 0x031, 0x011, 0x021, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x020, 0x021, 0x011, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x010, 0x011, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000 +}; + +static const unsigned int lambda_lookup_table[] = { + 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, + 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, + 0x0040, 0x0040, 0x0040, 0x0040, 0x0060, 0x0060, 0x0060, 0x0080, + 0x0080, 0x0080, 0x00a0, 0x00c0, 0x00c0, 0x00e0, 0x0100, 0x0120, + 0x0140, 0x0160, 0x01a0, 0x01c0, 0x0200, 0x0240, 0x0280, 0x02e0, + 0x0320, 0x03a0, 0x0400, 0x0480, 0x0500, 0x05a0, 0x0660, 0x0720, + 0x0800, 0x0900, 0x0a20, 0x0b60 +}; + +static const unsigned int intra4x4_lambda3[] = { + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 3, 3, 3, 4, + 4, 4, 5, 6, 6, 7, 8, 9, + 10, 11, 13, 14, 16, 18, 20, 23, + 25, 29, 32, 36, 40, 45, 51, 57, + 64, 72, 81, 91 +}; + +static v4l2_std_id tw5864_get_v4l2_std(enum tw5864_vid_std std); +static enum tw5864_vid_std tw5864_from_v4l2_std(v4l2_std_id v4l2_std); + +static void tw5864_handle_frame_task(unsigned long data); +static void tw5864_handle_frame(struct tw5864_h264_frame *frame); +static void tw5864_frame_interval_set(struct tw5864_input *input); + +static int tw5864_queue_setup(struct vb2_queue *q, unsigned int *num_buffers, + unsigned int *num_planes, unsigned int sizes[], + struct device *alloc_ctxs[]) +{ + if (*num_planes) + return sizes[0] < H264_VLC_BUF_SIZE ? -EINVAL : 0; + + sizes[0] = H264_VLC_BUF_SIZE; + *num_planes = 1; + + return 0; +} + +static void tw5864_buf_queue(struct vb2_buffer *vb) +{ + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + struct vb2_queue *vq = vb->vb2_queue; + struct tw5864_input *dev = vb2_get_drv_priv(vq); + struct tw5864_buf *buf = container_of(vbuf, struct tw5864_buf, vb); + unsigned long flags; + + spin_lock_irqsave(&dev->slock, flags); + list_add_tail(&buf->list, &dev->active); + spin_unlock_irqrestore(&dev->slock, flags); +} + +static int tw5864_input_std_get(struct tw5864_input *input, + enum tw5864_vid_std *std) +{ + struct tw5864_dev *dev = input->root; + u8 std_reg = tw_indir_readb(TW5864_INDIR_VIN_E(input->nr)); + + *std = (std_reg & 0x70) >> 4; + + if (std_reg & 0x80) { + dev_dbg(&dev->pci->dev, + "Video format detection is in progress, please wait\n"); + return -EAGAIN; + } + + return 0; +} + +static int tw5864_enable_input(struct tw5864_input *input) +{ + struct tw5864_dev *dev = input->root; + int nr = input->nr; + unsigned long flags; + int d1_width = 720; + int d1_height; + int frame_width_bus_value = 0; + int frame_height_bus_value = 0; + int reg_frame_bus = 0x1c; + int fmt_reg_value = 0; + int downscale_enabled = 0; + + dev_dbg(&dev->pci->dev, "Enabling channel %d\n", nr); + + input->frame_seqno = 0; + input->frame_gop_seqno = 0; + input->h264_idr_pic_id = 0; + + input->reg_dsp_qp = input->qp; + input->reg_dsp_ref_mvp_lambda = lambda_lookup_table[input->qp]; + input->reg_dsp_i4x4_weight = intra4x4_lambda3[input->qp]; + input->reg_emu = TW5864_EMU_EN_LPF | TW5864_EMU_EN_BHOST + | TW5864_EMU_EN_SEN | TW5864_EMU_EN_ME | TW5864_EMU_EN_DDR; + input->reg_dsp = nr /* channel id */ + | TW5864_DSP_CHROM_SW + | ((0xa << 8) & TW5864_DSP_MB_DELAY) + ; + + input->resolution = D1; + + d1_height = (input->std == STD_NTSC) ? 480 : 576; + + input->width = d1_width; + input->height = d1_height; + + input->reg_interlacing = 0x4; + + switch (input->resolution) { + case D1: + frame_width_bus_value = 0x2cf; + frame_height_bus_value = input->height - 1; + reg_frame_bus = 0x1c; + fmt_reg_value = 0; + downscale_enabled = 0; + input->reg_dsp_codec |= TW5864_CIF_MAP_MD | TW5864_HD1_MAP_MD; + input->reg_emu |= TW5864_DSP_FRAME_TYPE_D1; + input->reg_interlacing = TW5864_DI_EN | TW5864_DSP_INTER_ST; + + tw_setl(TW5864_FULL_HALF_FLAG, 1 << nr); + break; + case HD1: + input->height /= 2; + input->width /= 2; + frame_width_bus_value = 0x2cf; + frame_height_bus_value = input->height * 2 - 1; + reg_frame_bus = 0x1c; + fmt_reg_value = 0; + downscale_enabled = 0; + input->reg_dsp_codec |= TW5864_HD1_MAP_MD; + input->reg_emu |= TW5864_DSP_FRAME_TYPE_D1; + + tw_clearl(TW5864_FULL_HALF_FLAG, 1 << nr); + + break; + case CIF: + input->height /= 4; + input->width /= 2; + frame_width_bus_value = 0x15f; + frame_height_bus_value = input->height * 2 - 1; + reg_frame_bus = 0x07; + fmt_reg_value = 1; + downscale_enabled = 1; + input->reg_dsp_codec |= TW5864_CIF_MAP_MD; + + tw_clearl(TW5864_FULL_HALF_FLAG, 1 << nr); + break; + case QCIF: + input->height /= 4; + input->width /= 4; + frame_width_bus_value = 0x15f; + frame_height_bus_value = input->height * 2 - 1; + reg_frame_bus = 0x07; + fmt_reg_value = 1; + downscale_enabled = 1; + input->reg_dsp_codec |= TW5864_CIF_MAP_MD; + + tw_clearl(TW5864_FULL_HALF_FLAG, 1 << nr); + break; + } + + /* analog input width / 4 */ + tw_indir_writeb(TW5864_INDIR_IN_PIC_WIDTH(nr), d1_width / 4); + tw_indir_writeb(TW5864_INDIR_IN_PIC_HEIGHT(nr), d1_height / 4); + + /* output width / 4 */ + tw_indir_writeb(TW5864_INDIR_OUT_PIC_WIDTH(nr), input->width / 4); + tw_indir_writeb(TW5864_INDIR_OUT_PIC_HEIGHT(nr), input->height / 4); + + tw_writel(TW5864_DSP_PIC_MAX_MB, + ((input->width / 16) << 8) | (input->height / 16)); + + tw_writel(TW5864_FRAME_WIDTH_BUS_A(nr), + frame_width_bus_value); + tw_writel(TW5864_FRAME_WIDTH_BUS_B(nr), + frame_width_bus_value); + tw_writel(TW5864_FRAME_HEIGHT_BUS_A(nr), + frame_height_bus_value); + tw_writel(TW5864_FRAME_HEIGHT_BUS_B(nr), + (frame_height_bus_value + 1) / 2 - 1); + + tw5864_frame_interval_set(input); + + if (downscale_enabled) + tw_setl(TW5864_H264EN_CH_DNS, 1 << nr); + + tw_mask_shift_writel(TW5864_H264EN_CH_FMT_REG1, 0x3, 2 * nr, + fmt_reg_value); + + tw_mask_shift_writel((nr < 2 + ? TW5864_H264EN_RATE_MAX_LINE_REG1 + : TW5864_H264EN_RATE_MAX_LINE_REG2), + 0x1f, 5 * (nr % 2), + input->std == STD_NTSC ? 29 : 24); + + tw_mask_shift_writel((nr < 2) ? TW5864_FRAME_BUS1 : + TW5864_FRAME_BUS2, 0xff, (nr % 2) * 8, + reg_frame_bus); + + spin_lock_irqsave(&dev->slock, flags); + input->enabled = 1; + spin_unlock_irqrestore(&dev->slock, flags); + + return 0; +} + +void tw5864_request_encoded_frame(struct tw5864_input *input) +{ + struct tw5864_dev *dev = input->root; + u32 enc_buf_id_new; + + tw_setl(TW5864_DSP_CODEC, TW5864_CIF_MAP_MD | TW5864_HD1_MAP_MD); + tw_writel(TW5864_EMU, input->reg_emu); + tw_writel(TW5864_INTERLACING, input->reg_interlacing); + tw_writel(TW5864_DSP, input->reg_dsp); + + tw_writel(TW5864_DSP_QP, input->reg_dsp_qp); + tw_writel(TW5864_DSP_REF_MVP_LAMBDA, input->reg_dsp_ref_mvp_lambda); + tw_writel(TW5864_DSP_I4x4_WEIGHT, input->reg_dsp_i4x4_weight); + tw_mask_shift_writel(TW5864_DSP_INTRA_MODE, TW5864_DSP_INTRA_MODE_MASK, + TW5864_DSP_INTRA_MODE_SHIFT, + TW5864_DSP_INTRA_MODE_16x16); + + if (input->frame_gop_seqno == 0) { + /* Produce I-frame */ + tw_writel(TW5864_MOTION_SEARCH_ETC, TW5864_INTRA_EN); + input->h264_idr_pic_id++; + input->h264_idr_pic_id &= TW5864_DSP_REF_FRM; + } else { + /* Produce P-frame */ + tw_writel(TW5864_MOTION_SEARCH_ETC, TW5864_INTRA_EN | + TW5864_ME_EN | BIT(5) /* SRCH_OPT default */); + } + tw5864_prepare_frame_headers(input); + tw_writel(TW5864_VLC, + TW5864_VLC_PCI_SEL | + ((input->tail_nb_bits + 24) << TW5864_VLC_BIT_ALIGN_SHIFT) | + input->reg_dsp_qp); + + enc_buf_id_new = tw_mask_shift_readl(TW5864_ENC_BUF_PTR_REC1, 0x3, + 2 * input->nr); + tw_writel(TW5864_DSP_ENC_ORG_PTR_REG, + enc_buf_id_new << TW5864_DSP_ENC_ORG_PTR_SHIFT); + tw_writel(TW5864_DSP_ENC_REC, + enc_buf_id_new << 12 | ((enc_buf_id_new + 3) & 3)); + + tw_writel(TW5864_SLICE, TW5864_START_NSLICE); + tw_writel(TW5864_SLICE, 0); +} + +static int tw5864_disable_input(struct tw5864_input *input) +{ + struct tw5864_dev *dev = input->root; + unsigned long flags; + + dev_dbg(&dev->pci->dev, "Disabling channel %d\n", input->nr); + + spin_lock_irqsave(&dev->slock, flags); + input->enabled = 0; + spin_unlock_irqrestore(&dev->slock, flags); + return 0; +} + +static int tw5864_start_streaming(struct vb2_queue *q, unsigned int count) +{ + struct tw5864_input *input = vb2_get_drv_priv(q); + int ret; + + ret = tw5864_enable_input(input); + if (!ret) + return 0; + + while (!list_empty(&input->active)) { + struct tw5864_buf *buf = list_entry(input->active.next, + struct tw5864_buf, list); + + list_del(&buf->list); + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED); + } + return ret; +} + +static void tw5864_stop_streaming(struct vb2_queue *q) +{ + unsigned long flags; + struct tw5864_input *input = vb2_get_drv_priv(q); + + tw5864_disable_input(input); + + spin_lock_irqsave(&input->slock, flags); + if (input->vb) { + vb2_buffer_done(&input->vb->vb.vb2_buf, VB2_BUF_STATE_ERROR); + input->vb = NULL; + } + while (!list_empty(&input->active)) { + struct tw5864_buf *buf = list_entry(input->active.next, + struct tw5864_buf, list); + + list_del(&buf->list); + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); + } + spin_unlock_irqrestore(&input->slock, flags); +} + +static struct vb2_ops tw5864_video_qops = { + .queue_setup = tw5864_queue_setup, + .buf_queue = tw5864_buf_queue, + .start_streaming = tw5864_start_streaming, + .stop_streaming = tw5864_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, +}; + +static int tw5864_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct tw5864_input *input = + container_of(ctrl->handler, struct tw5864_input, hdl); + struct tw5864_dev *dev = input->root; + unsigned long flags; + + switch (ctrl->id) { + case V4L2_CID_BRIGHTNESS: + tw_indir_writeb(TW5864_INDIR_VIN_A_BRIGHT(input->nr), + (u8)ctrl->val); + break; + case V4L2_CID_HUE: + tw_indir_writeb(TW5864_INDIR_VIN_7_HUE(input->nr), + (u8)ctrl->val); + break; + case V4L2_CID_CONTRAST: + tw_indir_writeb(TW5864_INDIR_VIN_9_CNTRST(input->nr), + (u8)ctrl->val); + break; + case V4L2_CID_SATURATION: + tw_indir_writeb(TW5864_INDIR_VIN_B_SAT_U(input->nr), + (u8)ctrl->val); + tw_indir_writeb(TW5864_INDIR_VIN_C_SAT_V(input->nr), + (u8)ctrl->val); + break; + case V4L2_CID_MPEG_VIDEO_GOP_SIZE: + input->gop = ctrl->val; + return 0; + case V4L2_CID_MPEG_VIDEO_H264_MIN_QP: + spin_lock_irqsave(&input->slock, flags); + input->qp = ctrl->val; + input->reg_dsp_qp = input->qp; + input->reg_dsp_ref_mvp_lambda = lambda_lookup_table[input->qp]; + input->reg_dsp_i4x4_weight = intra4x4_lambda3[input->qp]; + spin_unlock_irqrestore(&input->slock, flags); + return 0; + case V4L2_CID_DETECT_MD_GLOBAL_THRESHOLD: + memset(input->md_threshold_grid_values, ctrl->val, + sizeof(input->md_threshold_grid_values)); + return 0; + case V4L2_CID_DETECT_MD_MODE: + return 0; + case V4L2_CID_DETECT_MD_THRESHOLD_GRID: + /* input->md_threshold_grid_ctrl->p_new.p_u16 contains data */ + memcpy(input->md_threshold_grid_values, + input->md_threshold_grid_ctrl->p_new.p_u16, + sizeof(input->md_threshold_grid_values)); + return 0; + } + return 0; +} + +static int tw5864_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct tw5864_input *input = video_drvdata(file); + + f->fmt.pix.width = 720; + switch (input->std) { + default: + WARN_ON_ONCE(1); + case STD_NTSC: + f->fmt.pix.height = 480; + break; + case STD_PAL: + case STD_SECAM: + f->fmt.pix.height = 576; + break; + } + f->fmt.pix.field = V4L2_FIELD_INTERLACED; + f->fmt.pix.pixelformat = V4L2_PIX_FMT_H264; + f->fmt.pix.sizeimage = H264_VLC_BUF_SIZE; + f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; + return 0; +} + +static int tw5864_enum_input(struct file *file, void *priv, + struct v4l2_input *i) +{ + struct tw5864_input *input = video_drvdata(file); + struct tw5864_dev *dev = input->root; + + u8 indir_0x000 = tw_indir_readb(TW5864_INDIR_VIN_0(input->nr)); + u8 indir_0x00d = tw_indir_readb(TW5864_INDIR_VIN_D(input->nr)); + u8 v1 = indir_0x000; + u8 v2 = indir_0x00d; + + if (i->index) + return -EINVAL; + + i->type = V4L2_INPUT_TYPE_CAMERA; + snprintf(i->name, sizeof(i->name), "Encoder %d", input->nr); + i->std = TW5864_NORMS; + if (v1 & (1 << 7)) + i->status |= V4L2_IN_ST_NO_SYNC; + if (!(v1 & (1 << 6))) + i->status |= V4L2_IN_ST_NO_H_LOCK; + if (v1 & (1 << 2)) + i->status |= V4L2_IN_ST_NO_SIGNAL; + if (v1 & (1 << 1)) + i->status |= V4L2_IN_ST_NO_COLOR; + if (v2 & (1 << 2)) + i->status |= V4L2_IN_ST_MACROVISION; + + return 0; +} + +static int tw5864_g_input(struct file *file, void *priv, unsigned int *i) +{ + *i = 0; + return 0; +} + +static int tw5864_s_input(struct file *file, void *priv, unsigned int i) +{ + if (i) + return -EINVAL; + return 0; +} + +static int tw5864_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + struct tw5864_input *input = video_drvdata(file); + + strcpy(cap->driver, "tw5864"); + snprintf(cap->card, sizeof(cap->card), "TW5864 Encoder %d", + input->nr); + sprintf(cap->bus_info, "PCI:%s", pci_name(input->root->pci)); + return 0; +} + +static int tw5864_querystd(struct file *file, void *priv, v4l2_std_id *std) +{ + struct tw5864_input *input = video_drvdata(file); + enum tw5864_vid_std tw_std; + int ret; + + ret = tw5864_input_std_get(input, &tw_std); + if (ret) + return ret; + *std = tw5864_get_v4l2_std(tw_std); + + return 0; +} + +static int tw5864_g_std(struct file *file, void *priv, v4l2_std_id *std) +{ + struct tw5864_input *input = video_drvdata(file); + + *std = input->v4l2_std; + return 0; +} + +static int tw5864_s_std(struct file *file, void *priv, v4l2_std_id std) +{ + struct tw5864_input *input = video_drvdata(file); + struct tw5864_dev *dev = input->root; + + input->v4l2_std = std; + input->std = tw5864_from_v4l2_std(std); + tw_indir_writeb(TW5864_INDIR_VIN_E(input->nr), input->std); + return 0; +} + +static int tw5864_enum_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_fmtdesc *f) +{ + if (f->index) + return -EINVAL; + + f->pixelformat = V4L2_PIX_FMT_H264; + + return 0; +} + +static int tw5864_subscribe_event(struct v4l2_fh *fh, + const struct v4l2_event_subscription *sub) +{ + switch (sub->type) { + case V4L2_EVENT_CTRL: + return v4l2_ctrl_subscribe_event(fh, sub); + case V4L2_EVENT_MOTION_DET: + /* + * Allow for up to 30 events (1 second for NTSC) to be stored. + */ + return v4l2_event_subscribe(fh, sub, 30, NULL); + } + return -EINVAL; +} + +static void tw5864_frame_interval_set(struct tw5864_input *input) +{ + /* + * This register value seems to follow such approach: In each second + * interval, when processing Nth frame, it checks Nth bit of register + * value and, if the bit is 1, it processes the frame, otherwise the + * frame is discarded. + * So unary representation would work, but more or less equal gaps + * between the frames should be preserved. + * + * For 1 FPS - 0x00000001 + * 00000000 00000000 00000000 00000001 + * + * For max FPS - set all 25/30 lower bits: + * 00111111 11111111 11111111 11111111 (NTSC) + * 00000001 11111111 11111111 11111111 (PAL) + * + * For half of max FPS - use such pattern: + * 00010101 01010101 01010101 01010101 (NTSC) + * 00000001 01010101 01010101 01010101 (PAL) + * + * Et cetera. + * + * The value supplied to hardware is capped by mask of 25/30 lower bits. + */ + struct tw5864_dev *dev = input->root; + u32 unary_framerate = 0; + int shift = 0; + int std_max_fps = input->std == STD_NTSC ? 30 : 25; + + for (shift = 0; shift < std_max_fps; shift += input->frame_interval) + unary_framerate |= 0x00000001 << shift; + + tw_writel(TW5864_H264EN_RATE_CNTL_LO_WORD(input->nr, 0), + unary_framerate >> 16); + tw_writel(TW5864_H264EN_RATE_CNTL_HI_WORD(input->nr, 0), + unary_framerate & 0xffff); +} + +static int tw5864_frameinterval_get(struct tw5864_input *input, + struct v4l2_fract *frameinterval) +{ + switch (input->std) { + case STD_NTSC: + frameinterval->numerator = 1001; + frameinterval->denominator = 30000; + break; + case STD_PAL: + case STD_SECAM: + frameinterval->numerator = 1; + frameinterval->denominator = 25; + break; + default: + WARN(1, "tw5864_frameinterval_get requested for unknown std %d\n", + input->std); + return -EINVAL; + } + + return 0; +} + +static int tw5864_enum_framesizes(struct file *file, void *priv, + struct v4l2_frmsizeenum *fsize) +{ + struct tw5864_input *input = video_drvdata(file); + + if (fsize->index > 0) + return -EINVAL; + if (fsize->pixel_format != V4L2_PIX_FMT_H264) + return -EINVAL; + + fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; + fsize->discrete.width = 720; + fsize->discrete.height = input->std == STD_NTSC ? 480 : 576; + + return 0; +} + +static int tw5864_enum_frameintervals(struct file *file, void *priv, + struct v4l2_frmivalenum *fintv) +{ + struct tw5864_input *input = video_drvdata(file); + struct v4l2_fract frameinterval; + int std_max_fps = input->std == STD_NTSC ? 30 : 25; + struct v4l2_frmsizeenum fsize = { .index = fintv->index, + .pixel_format = fintv->pixel_format }; + int ret; + + ret = tw5864_enum_framesizes(file, priv, &fsize); + if (ret) + return ret; + + if (fintv->width != fsize.discrete.width || + fintv->height != fsize.discrete.height) + return -EINVAL; + + fintv->type = V4L2_FRMIVAL_TYPE_STEPWISE; + + ret = tw5864_frameinterval_get(input, &frameinterval); + fintv->stepwise.step = frameinterval; + fintv->stepwise.min = frameinterval; + fintv->stepwise.max = frameinterval; + fintv->stepwise.max.numerator *= std_max_fps; + + return ret; +} + +static int tw5864_g_parm(struct file *file, void *priv, + struct v4l2_streamparm *sp) +{ + struct tw5864_input *input = video_drvdata(file); + struct v4l2_captureparm *cp = &sp->parm.capture; + int ret; + + cp->capability = V4L2_CAP_TIMEPERFRAME; + + ret = tw5864_frameinterval_get(input, &cp->timeperframe); + cp->timeperframe.numerator *= input->frame_interval; + cp->capturemode = 0; + cp->readbuffers = 2; + + return ret; +} + +static int tw5864_s_parm(struct file *file, void *priv, + struct v4l2_streamparm *sp) +{ + struct tw5864_input *input = video_drvdata(file); + struct v4l2_fract *t = &sp->parm.capture.timeperframe; + struct v4l2_fract time_base; + int ret; + + ret = tw5864_frameinterval_get(input, &time_base); + if (ret) + return ret; + + if (!t->numerator || !t->denominator) { + t->numerator = time_base.numerator * input->frame_interval; + t->denominator = time_base.denominator; + } else if (t->denominator != time_base.denominator) { + t->numerator = t->numerator * time_base.denominator / + t->denominator; + t->denominator = time_base.denominator; + } + + input->frame_interval = t->numerator / time_base.numerator; + if (input->frame_interval < 1) + input->frame_interval = 1; + tw5864_frame_interval_set(input); + return tw5864_g_parm(file, priv, sp); +} + +static const struct v4l2_ctrl_ops tw5864_ctrl_ops = { + .s_ctrl = tw5864_s_ctrl, +}; + +static const struct v4l2_file_operations video_fops = { + .owner = THIS_MODULE, + .open = v4l2_fh_open, + .release = vb2_fop_release, + .read = vb2_fop_read, + .poll = vb2_fop_poll, + .mmap = vb2_fop_mmap, + .unlocked_ioctl = video_ioctl2, +}; + +#ifdef CONFIG_VIDEO_ADV_DEBUG + +#define INDIR_SPACE_MAP_SHIFT 0x100000 + +static int tw5864_g_reg(struct file *file, void *fh, + struct v4l2_dbg_register *reg) +{ + struct tw5864_input *input = video_drvdata(file); + struct tw5864_dev *dev = input->root; + + if (reg->reg < INDIR_SPACE_MAP_SHIFT) { + if (reg->reg > 0x87fff) + return -EINVAL; + reg->size = 4; + reg->val = tw_readl(reg->reg); + } else { + __u64 indir_addr = reg->reg - INDIR_SPACE_MAP_SHIFT; + + if (indir_addr > 0xefe) + return -EINVAL; + reg->size = 1; + reg->val = tw_indir_readb(reg->reg); + } + return 0; +} + +static int tw5864_s_reg(struct file *file, void *fh, + const struct v4l2_dbg_register *reg) +{ + struct tw5864_input *input = video_drvdata(file); + struct tw5864_dev *dev = input->root; + + if (reg->reg < INDIR_SPACE_MAP_SHIFT) { + if (reg->reg > 0x87fff) + return -EINVAL; + tw_writel(reg->reg, reg->val); + } else { + __u64 indir_addr = reg->reg - INDIR_SPACE_MAP_SHIFT; + + if (indir_addr > 0xefe) + return -EINVAL; + tw_indir_writeb(reg->reg, reg->val); + } + return 0; +} +#endif + +static const struct v4l2_ioctl_ops video_ioctl_ops = { + .vidioc_querycap = tw5864_querycap, + .vidioc_enum_fmt_vid_cap = tw5864_enum_fmt_vid_cap, + .vidioc_reqbufs = vb2_ioctl_reqbufs, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_expbuf = vb2_ioctl_expbuf, + .vidioc_querystd = tw5864_querystd, + .vidioc_s_std = tw5864_s_std, + .vidioc_g_std = tw5864_g_std, + .vidioc_enum_input = tw5864_enum_input, + .vidioc_g_input = tw5864_g_input, + .vidioc_s_input = tw5864_s_input, + .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamoff = vb2_ioctl_streamoff, + .vidioc_try_fmt_vid_cap = tw5864_fmt_vid_cap, + .vidioc_s_fmt_vid_cap = tw5864_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = tw5864_fmt_vid_cap, + .vidioc_log_status = v4l2_ctrl_log_status, + .vidioc_subscribe_event = tw5864_subscribe_event, + .vidioc_unsubscribe_event = v4l2_event_unsubscribe, + .vidioc_enum_framesizes = tw5864_enum_framesizes, + .vidioc_enum_frameintervals = tw5864_enum_frameintervals, + .vidioc_s_parm = tw5864_s_parm, + .vidioc_g_parm = tw5864_g_parm, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .vidioc_g_register = tw5864_g_reg, + .vidioc_s_register = tw5864_s_reg, +#endif +}; + +static struct video_device tw5864_video_template = { + .name = "tw5864_video", + .fops = &video_fops, + .ioctl_ops = &video_ioctl_ops, + .release = video_device_release_empty, + .tvnorms = TW5864_NORMS, + .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | + V4L2_CAP_STREAMING, +}; + +/* Motion Detection Threshold matrix */ +static const struct v4l2_ctrl_config tw5864_md_thresholds = { + .ops = &tw5864_ctrl_ops, + .id = V4L2_CID_DETECT_MD_THRESHOLD_GRID, + .dims = {MD_CELLS_HOR, MD_CELLS_VERT}, + .def = 14, + /* See tw5864_md_metric_from_mvd() */ + .max = 2 * 0x0f, + .step = 1, +}; + +static int tw5864_video_input_init(struct tw5864_input *dev, int video_nr); +static void tw5864_video_input_fini(struct tw5864_input *dev); +static void tw5864_encoder_tables_upload(struct tw5864_dev *dev); + +int tw5864_video_init(struct tw5864_dev *dev, int *video_nr) +{ + int i; + int ret; + unsigned long flags; + int last_dma_allocated = -1; + int last_input_nr_registered = -1; + + for (i = 0; i < H264_BUF_CNT; i++) { + struct tw5864_h264_frame *frame = &dev->h264_buf[i]; + + frame->vlc.addr = dma_alloc_coherent(&dev->pci->dev, + H264_VLC_BUF_SIZE, + &frame->vlc.dma_addr, + GFP_KERNEL | GFP_DMA32); + if (!frame->vlc.addr) { + dev_err(&dev->pci->dev, "dma alloc fail\n"); + ret = -ENOMEM; + goto free_dma; + } + frame->mv.addr = dma_alloc_coherent(&dev->pci->dev, + H264_MV_BUF_SIZE, + &frame->mv.dma_addr, + GFP_KERNEL | GFP_DMA32); + if (!frame->mv.addr) { + dev_err(&dev->pci->dev, "dma alloc fail\n"); + ret = -ENOMEM; + dma_free_coherent(&dev->pci->dev, H264_VLC_BUF_SIZE, + frame->vlc.addr, frame->vlc.dma_addr); + goto free_dma; + } + last_dma_allocated = i; + } + + tw5864_encoder_tables_upload(dev); + + /* Picture is distorted without this block */ + /* use falling edge to sample 54M to 108M */ + tw_indir_writeb(TW5864_INDIR_VD_108_POL, TW5864_INDIR_VD_108_POL_BOTH); + tw_indir_writeb(TW5864_INDIR_CLK0_SEL, 0x00); + + tw_indir_writeb(TW5864_INDIR_DDRA_DLL_DQS_SEL0, 0x02); + tw_indir_writeb(TW5864_INDIR_DDRA_DLL_DQS_SEL1, 0x02); + tw_indir_writeb(TW5864_INDIR_DDRA_DLL_CLK90_SEL, 0x02); + tw_indir_writeb(TW5864_INDIR_DDRB_DLL_DQS_SEL0, 0x02); + tw_indir_writeb(TW5864_INDIR_DDRB_DLL_DQS_SEL1, 0x02); + tw_indir_writeb(TW5864_INDIR_DDRB_DLL_CLK90_SEL, 0x02); + + /* video input reset */ + tw_indir_writeb(TW5864_INDIR_RESET, 0); + tw_indir_writeb(TW5864_INDIR_RESET, TW5864_INDIR_RESET_VD | + TW5864_INDIR_RESET_DLL | TW5864_INDIR_RESET_MUX_CORE); + msleep(20); + + /* + * Select Part A mode for all channels. + * tw_setl instead of tw_clearl for Part B mode. + * + * I guess "Part B" is primarily for downscaled version of same channel + * which goes in Part A of same bus + */ + tw_writel(TW5864_FULL_HALF_MODE_SEL, 0); + + tw_indir_writeb(TW5864_INDIR_PV_VD_CK_POL, + TW5864_INDIR_PV_VD_CK_POL_VD(0) | + TW5864_INDIR_PV_VD_CK_POL_VD(1) | + TW5864_INDIR_PV_VD_CK_POL_VD(2) | + TW5864_INDIR_PV_VD_CK_POL_VD(3)); + + spin_lock_irqsave(&dev->slock, flags); + dev->encoder_busy = 0; + dev->h264_buf_r_index = 0; + dev->h264_buf_w_index = 0; + tw_writel(TW5864_VLC_STREAM_BASE_ADDR, + dev->h264_buf[dev->h264_buf_w_index].vlc.dma_addr); + tw_writel(TW5864_MV_STREAM_BASE_ADDR, + dev->h264_buf[dev->h264_buf_w_index].mv.dma_addr); + spin_unlock_irqrestore(&dev->slock, flags); + + tw_writel(TW5864_SEN_EN_CH, 0x000f); + tw_writel(TW5864_H264EN_CH_EN, 0x000f); + + tw_writel(TW5864_H264EN_BUS0_MAP, 0x00000000); + tw_writel(TW5864_H264EN_BUS1_MAP, 0x00001111); + tw_writel(TW5864_H264EN_BUS2_MAP, 0x00002222); + tw_writel(TW5864_H264EN_BUS3_MAP, 0x00003333); + + /* + * Quote from Intersil (manufacturer): + * 0x0038 is managed by HW, and by default it won't pass the pointer set + * at 0x0010. So if you don't do encoding, 0x0038 should stay at '3' + * (with 4 frames in buffer). If you encode one frame and then move + * 0x0010 to '1' for example, HW will take one more frame and set it to + * buffer #0, and then you should see 0x0038 is set to '0'. There is + * only one HW encoder engine, so 4 channels cannot get encoded + * simultaneously. But each channel does have its own buffer (for + * original frames and reconstructed frames). So there is no problem to + * manage encoding for 4 channels at same time and no need to force + * I-frames in switching channels. + * End of quote. + * + * If we set 0x0010 (TW5864_ENC_BUF_PTR_REC1) to 0 (for any channel), we + * have no "rolling" (until we change this value). + * If we set 0x0010 (TW5864_ENC_BUF_PTR_REC1) to 0x3, it starts to roll + * continuously together with 0x0038. + */ + tw_writel(TW5864_ENC_BUF_PTR_REC1, 0x00ff); + tw_writel(TW5864_PCI_INTTM_SCALE, 0); + + tw_writel(TW5864_INTERLACING, TW5864_DI_EN); + tw_writel(TW5864_MASTER_ENB_REG, TW5864_PCI_VLC_INTR_ENB); + tw_writel(TW5864_PCI_INTR_CTL, + TW5864_TIMER_INTR_ENB | TW5864_PCI_MAST_ENB | + TW5864_MVD_VLC_MAST_ENB); + + dev->irqmask |= TW5864_INTR_VLC_DONE | TW5864_INTR_TIMER; + tw5864_irqmask_apply(dev); + + tasklet_init(&dev->tasklet, tw5864_handle_frame_task, + (unsigned long)dev); + + for (i = 0; i < TW5864_INPUTS; i++) { + dev->inputs[i].root = dev; + dev->inputs[i].nr = i; + ret = tw5864_video_input_init(&dev->inputs[i], video_nr[i]); + if (ret) + goto fini_video_inputs; + last_input_nr_registered = i; + } + + return 0; + +fini_video_inputs: + for (i = last_input_nr_registered; i >= 0; i--) + tw5864_video_input_fini(&dev->inputs[i]); + + tasklet_kill(&dev->tasklet); + +free_dma: + for (i = last_dma_allocated; i >= 0; i--) { + dma_free_coherent(&dev->pci->dev, H264_VLC_BUF_SIZE, + dev->h264_buf[i].vlc.addr, + dev->h264_buf[i].vlc.dma_addr); + dma_free_coherent(&dev->pci->dev, H264_MV_BUF_SIZE, + dev->h264_buf[i].mv.addr, + dev->h264_buf[i].mv.dma_addr); + } + + return ret; +} + +static int tw5864_video_input_init(struct tw5864_input *input, int video_nr) +{ + struct tw5864_dev *dev = input->root; + int ret; + struct v4l2_ctrl_handler *hdl = &input->hdl; + + mutex_init(&input->lock); + spin_lock_init(&input->slock); + + /* setup video buffers queue */ + INIT_LIST_HEAD(&input->active); + input->vidq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + input->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; + input->vidq.io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF; + input->vidq.ops = &tw5864_video_qops; + input->vidq.mem_ops = &vb2_dma_contig_memops; + input->vidq.drv_priv = input; + input->vidq.gfp_flags = 0; + input->vidq.buf_struct_size = sizeof(struct tw5864_buf); + input->vidq.lock = &input->lock; + input->vidq.min_buffers_needed = 2; + input->vidq.dev = &input->root->pci->dev; + ret = vb2_queue_init(&input->vidq); + if (ret) + goto free_mutex; + + input->vdev = tw5864_video_template; + input->vdev.v4l2_dev = &input->root->v4l2_dev; + input->vdev.lock = &input->lock; + input->vdev.queue = &input->vidq; + video_set_drvdata(&input->vdev, input); + + /* Initialize the device control structures */ + v4l2_ctrl_handler_init(hdl, 6); + v4l2_ctrl_new_std(hdl, &tw5864_ctrl_ops, + V4L2_CID_BRIGHTNESS, -128, 127, 1, 0); + v4l2_ctrl_new_std(hdl, &tw5864_ctrl_ops, + V4L2_CID_CONTRAST, 0, 255, 1, 100); + v4l2_ctrl_new_std(hdl, &tw5864_ctrl_ops, + V4L2_CID_SATURATION, 0, 255, 1, 128); + v4l2_ctrl_new_std(hdl, &tw5864_ctrl_ops, V4L2_CID_HUE, -128, 127, 1, 0); + v4l2_ctrl_new_std(hdl, &tw5864_ctrl_ops, V4L2_CID_MPEG_VIDEO_GOP_SIZE, + 1, MAX_GOP_SIZE, 1, GOP_SIZE); + v4l2_ctrl_new_std(hdl, &tw5864_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_MIN_QP, 28, 51, 1, QP_VALUE); + v4l2_ctrl_new_std_menu(hdl, &tw5864_ctrl_ops, + V4L2_CID_DETECT_MD_MODE, + V4L2_DETECT_MD_MODE_THRESHOLD_GRID, 0, + V4L2_DETECT_MD_MODE_DISABLED); + v4l2_ctrl_new_std(hdl, &tw5864_ctrl_ops, + V4L2_CID_DETECT_MD_GLOBAL_THRESHOLD, + tw5864_md_thresholds.min, tw5864_md_thresholds.max, + tw5864_md_thresholds.step, tw5864_md_thresholds.def); + input->md_threshold_grid_ctrl = + v4l2_ctrl_new_custom(hdl, &tw5864_md_thresholds, NULL); + if (hdl->error) { + ret = hdl->error; + goto free_v4l2_hdl; + } + input->vdev.ctrl_handler = hdl; + v4l2_ctrl_handler_setup(hdl); + + input->qp = QP_VALUE; + input->gop = GOP_SIZE; + input->frame_interval = 1; + + ret = video_register_device(&input->vdev, VFL_TYPE_GRABBER, video_nr); + if (ret) + goto free_v4l2_hdl; + + dev_info(&input->root->pci->dev, "Registered video device %s\n", + video_device_node_name(&input->vdev)); + + /* + * Set default video standard. Doesn't matter which, the detected value + * will be found out by VIDIOC_QUERYSTD handler. + */ + input->v4l2_std = V4L2_STD_NTSC_M; + input->std = STD_NTSC; + + tw_indir_writeb(TW5864_INDIR_VIN_E(video_nr), 0x07); + /* to initiate auto format recognition */ + tw_indir_writeb(TW5864_INDIR_VIN_F(video_nr), 0xff); + + return 0; + +free_v4l2_hdl: + v4l2_ctrl_handler_free(hdl); + vb2_queue_release(&input->vidq); +free_mutex: + mutex_destroy(&input->lock); + + return ret; +} + +static void tw5864_video_input_fini(struct tw5864_input *dev) +{ + video_unregister_device(&dev->vdev); + v4l2_ctrl_handler_free(&dev->hdl); + vb2_queue_release(&dev->vidq); +} + +void tw5864_video_fini(struct tw5864_dev *dev) +{ + int i; + + tasklet_kill(&dev->tasklet); + + for (i = 0; i < TW5864_INPUTS; i++) + tw5864_video_input_fini(&dev->inputs[i]); + + for (i = 0; i < H264_BUF_CNT; i++) { + dma_free_coherent(&dev->pci->dev, H264_VLC_BUF_SIZE, + dev->h264_buf[i].vlc.addr, + dev->h264_buf[i].vlc.dma_addr); + dma_free_coherent(&dev->pci->dev, H264_MV_BUF_SIZE, + dev->h264_buf[i].mv.addr, + dev->h264_buf[i].mv.dma_addr); + } +} + +void tw5864_prepare_frame_headers(struct tw5864_input *input) +{ + struct tw5864_buf *vb = input->vb; + u8 *dst; + size_t dst_space; + unsigned long flags; + u8 *sl_hdr; + unsigned long space_before_sl_hdr; + + if (!vb) { + spin_lock_irqsave(&input->slock, flags); + if (list_empty(&input->active)) { + spin_unlock_irqrestore(&input->slock, flags); + input->vb = NULL; + return; + } + vb = list_first_entry(&input->active, struct tw5864_buf, list); + list_del(&vb->list); + spin_unlock_irqrestore(&input->slock, flags); + } + + dst = vb2_plane_vaddr(&vb->vb.vb2_buf, 0); + dst_space = vb2_plane_size(&vb->vb.vb2_buf, 0); + + /* + * Low-level bitstream writing functions don't have a fine way to say + * correctly that supplied buffer is too small. So we just check there + * and warn, and don't care at lower level. + * Currently all headers take below 32 bytes. + * The buffer is supposed to have plenty of free space at this point, + * anyway. + */ + if (WARN_ON_ONCE(dst_space < 128)) + return; + + /* + * Generate H264 headers: + * If this is first frame, put SPS and PPS + */ + if (input->frame_gop_seqno == 0) + tw5864_h264_put_stream_header(&dst, &dst_space, input->qp, + input->width, input->height); + + /* Put slice header */ + sl_hdr = dst; + space_before_sl_hdr = dst_space; + tw5864_h264_put_slice_header(&dst, &dst_space, input->h264_idr_pic_id, + input->frame_gop_seqno, + &input->tail_nb_bits, &input->tail); + input->vb = vb; + input->buf_cur_ptr = dst; + input->buf_cur_space_left = dst_space; +} + +/* + * Returns heuristic motion detection metric value from known components of + * hardware-provided Motion Vector Data. + */ +static unsigned int tw5864_md_metric_from_mvd(u32 mvd) +{ + /* + * Format of motion vector data exposed by tw5864, according to + * manufacturer: + * mv_x 10 bits + * mv_y 10 bits + * non_zero_members 8 bits + * mb_type 3 bits + * reserved 1 bit + * + * non_zero_members: number of non-zero residuals in each macro block + * after quantization + * + * unsigned int reserved = mvd >> 31; + * unsigned int mb_type = (mvd >> 28) & 0x7; + * unsigned int non_zero_members = (mvd >> 20) & 0xff; + */ + unsigned int mv_y = (mvd >> 10) & 0x3ff; + unsigned int mv_x = mvd & 0x3ff; + + /* heuristic: */ + mv_x &= 0x0f; + mv_y &= 0x0f; + + return mv_y + mv_x; +} + +static int tw5864_is_motion_triggered(struct tw5864_h264_frame *frame) +{ + struct tw5864_input *input = frame->input; + u32 *mv = (u32 *)frame->mv.addr; + int i; + int detected = 0; + + for (i = 0; i < MD_CELLS; i++) { + const u16 thresh = input->md_threshold_grid_values[i]; + const unsigned int metric = tw5864_md_metric_from_mvd(mv[i]); + + if (metric > thresh) + detected = 1; + + if (detected) + break; + } + return detected; +} + +static void tw5864_handle_frame_task(unsigned long data) +{ + struct tw5864_dev *dev = (struct tw5864_dev *)data; + unsigned long flags; + int batch_size = H264_BUF_CNT; + + spin_lock_irqsave(&dev->slock, flags); + while (dev->h264_buf_r_index != dev->h264_buf_w_index && batch_size--) { + struct tw5864_h264_frame *frame = + &dev->h264_buf[dev->h264_buf_r_index]; + + spin_unlock_irqrestore(&dev->slock, flags); + dma_sync_single_for_cpu(&dev->pci->dev, frame->vlc.dma_addr, + H264_VLC_BUF_SIZE, DMA_FROM_DEVICE); + dma_sync_single_for_cpu(&dev->pci->dev, frame->mv.dma_addr, + H264_MV_BUF_SIZE, DMA_FROM_DEVICE); + tw5864_handle_frame(frame); + dma_sync_single_for_device(&dev->pci->dev, frame->vlc.dma_addr, + H264_VLC_BUF_SIZE, DMA_FROM_DEVICE); + dma_sync_single_for_device(&dev->pci->dev, frame->mv.dma_addr, + H264_MV_BUF_SIZE, DMA_FROM_DEVICE); + spin_lock_irqsave(&dev->slock, flags); + + dev->h264_buf_r_index++; + dev->h264_buf_r_index %= H264_BUF_CNT; + } + spin_unlock_irqrestore(&dev->slock, flags); +} + +#ifdef DEBUG +static u32 tw5864_vlc_checksum(u32 *data, int len) +{ + u32 val, count_len = len; + + val = *data++; + while (((count_len >> 2) - 1) > 0) { + val ^= *data++; + count_len -= 4; + } + val ^= htonl((len >> 2)); + return val; +} +#endif + +static void tw5864_handle_frame(struct tw5864_h264_frame *frame) +{ +#define SKIP_VLCBUF_BYTES 3 + struct tw5864_input *input = frame->input; + struct tw5864_dev *dev = input->root; + struct tw5864_buf *vb; + struct vb2_v4l2_buffer *v4l2_buf; + int frame_len = frame->vlc_len - SKIP_VLCBUF_BYTES; + u8 *dst = input->buf_cur_ptr; + u8 tail_mask, vlc_mask = 0; + int i; + u8 vlc_first_byte = ((u8 *)(frame->vlc.addr + SKIP_VLCBUF_BYTES))[0]; + unsigned long flags; + int zero_run; + u8 *src; + u8 *src_end; + +#ifdef DEBUG + if (frame->checksum != + tw5864_vlc_checksum((u32 *)frame->vlc.addr, frame_len)) + dev_err(&dev->pci->dev, + "Checksum of encoded frame doesn't match!\n"); +#endif + + spin_lock_irqsave(&input->slock, flags); + vb = input->vb; + input->vb = NULL; + spin_unlock_irqrestore(&input->slock, flags); + + v4l2_buf = to_vb2_v4l2_buffer(&vb->vb.vb2_buf); + + if (!vb) { /* Gone because of disabling */ + dev_dbg(&dev->pci->dev, "vb is empty, dropping frame\n"); + return; + } + + /* + * Check for space. + * Mind the overhead of startcode emulation prevention. + */ + if (input->buf_cur_space_left < frame_len * 5 / 4) { + dev_err_once(&dev->pci->dev, + "Left space in vb2 buffer, %d bytes, is less than considered safely enough to put frame of length %d. Dropping this frame.\n", + input->buf_cur_space_left, frame_len); + return; + } + + for (i = 0; i < 8 - input->tail_nb_bits; i++) + vlc_mask |= 1 << i; + tail_mask = (~vlc_mask) & 0xff; + + dst[0] = (input->tail & tail_mask) | (vlc_first_byte & vlc_mask); + frame_len--; + dst++; + + /* H.264 startcode emulation prevention */ + src = frame->vlc.addr + SKIP_VLCBUF_BYTES + 1; + src_end = src + frame_len; + zero_run = 0; + for (; src < src_end; src++) { + if (zero_run < 2) { + if (*src == 0) + ++zero_run; + else + zero_run = 0; + } else { + if ((*src & ~0x03) == 0) + *dst++ = 0x03; + zero_run = *src == 0; + } + *dst++ = *src; + } + + vb2_set_plane_payload(&vb->vb.vb2_buf, 0, + dst - (u8 *)vb2_plane_vaddr(&vb->vb.vb2_buf, 0)); + + vb->vb.vb2_buf.timestamp = frame->timestamp; + v4l2_buf->field = V4L2_FIELD_INTERLACED; + v4l2_buf->sequence = frame->seqno; + + /* Check for motion flags */ + if (frame->gop_seqno /* P-frame */ && + tw5864_is_motion_triggered(frame)) { + struct v4l2_event ev = { + .type = V4L2_EVENT_MOTION_DET, + .u.motion_det = { + .flags = V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ, + .frame_sequence = v4l2_buf->sequence, + }, + }; + + v4l2_event_queue(&input->vdev, &ev); + } + + vb2_buffer_done(&vb->vb.vb2_buf, VB2_BUF_STATE_DONE); +} + +static v4l2_std_id tw5864_get_v4l2_std(enum tw5864_vid_std std) +{ + switch (std) { + case STD_NTSC: return V4L2_STD_NTSC_M; + case STD_PAL: return V4L2_STD_PAL_B; + case STD_SECAM: return V4L2_STD_SECAM_B; + case STD_NTSC443: return V4L2_STD_NTSC_443; + case STD_PAL_M: return V4L2_STD_PAL_M; + case STD_PAL_CN: return V4L2_STD_PAL_Nc; + case STD_PAL_60: return V4L2_STD_PAL_60; + case STD_INVALID: return V4L2_STD_UNKNOWN; + } + return 0; +} + +static enum tw5864_vid_std tw5864_from_v4l2_std(v4l2_std_id v4l2_std) +{ + if (v4l2_std & V4L2_STD_NTSC_M) + return STD_NTSC; + if (v4l2_std & V4L2_STD_PAL_B) + return STD_PAL; + if (v4l2_std & V4L2_STD_SECAM_B) + return STD_SECAM; + if (v4l2_std & V4L2_STD_NTSC_443) + return STD_NTSC443; + if (v4l2_std & V4L2_STD_PAL_M) + return STD_PAL_M; + if (v4l2_std & V4L2_STD_PAL_Nc) + return STD_PAL_CN; + if (v4l2_std & V4L2_STD_PAL_60) + return STD_PAL_60; + + return STD_INVALID; +} + +static void tw5864_encoder_tables_upload(struct tw5864_dev *dev) +{ + int i; + + tw_writel(TW5864_VLC_RD, 0x1); + for (i = 0; i < VLC_LOOKUP_TABLE_LEN; i++) { + tw_writel((TW5864_VLC_STREAM_MEM_START + i * 4), + encoder_vlc_lookup_table[i]); + } + tw_writel(TW5864_VLC_RD, 0x0); + + for (i = 0; i < QUANTIZATION_TABLE_LEN; i++) { + tw_writel((TW5864_QUAN_TAB + i * 4), + forward_quantization_table[i]); + } + + for (i = 0; i < QUANTIZATION_TABLE_LEN; i++) { + tw_writel((TW5864_QUAN_TAB + i * 4), + inverse_quantization_table[i]); + } +} diff --git a/drivers/media/pci/tw5864/tw5864.h b/drivers/media/pci/tw5864/tw5864.h new file mode 100644 index 000000000000..f5de9f6ef119 --- /dev/null +++ b/drivers/media/pci/tw5864/tw5864.h @@ -0,0 +1,205 @@ +/* + * TW5864 driver - common header file + * + * Copyright (C) 2016 Bluecherry, LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "tw5864-reg.h" + +#define PCI_DEVICE_ID_TECHWELL_5864 0x5864 + +#define TW5864_NORMS V4L2_STD_ALL + +/* ----------------------------------------------------------- */ +/* card configuration */ + +#define TW5864_INPUTS 4 + +/* The TW5864 uses 192 (16x12) detection cells in full screen for motion + * detection. Each detection cell is composed of 44 pixels and 20 lines for + * NTSC and 24 lines for PAL. + */ +#define MD_CELLS_HOR 16 +#define MD_CELLS_VERT 12 +#define MD_CELLS (MD_CELLS_HOR * MD_CELLS_VERT) + +#define H264_VLC_BUF_SIZE 0x80000 +#define H264_MV_BUF_SIZE 0x2000 /* device writes 5396 bytes */ +#define QP_VALUE 28 +#define MAX_GOP_SIZE 255 +#define GOP_SIZE MAX_GOP_SIZE + +enum resolution { + D1 = 1, + HD1 = 2, /* half d1 - 360x(240|288) */ + CIF = 3, + QCIF = 4, +}; + +/* ----------------------------------------------------------- */ +/* device / file handle status */ + +struct tw5864_dev; /* forward delclaration */ + +/* buffer for one video/vbi/ts frame */ +struct tw5864_buf { + struct vb2_v4l2_buffer vb; + struct list_head list; + + unsigned int size; +}; + +struct tw5864_dma_buf { + void *addr; + dma_addr_t dma_addr; +}; + +enum tw5864_vid_std { + STD_NTSC = 0, /* NTSC (M) */ + STD_PAL = 1, /* PAL (B, D, G, H, I) */ + STD_SECAM = 2, /* SECAM */ + STD_NTSC443 = 3, /* NTSC4.43 */ + STD_PAL_M = 4, /* PAL (M) */ + STD_PAL_CN = 5, /* PAL (CN) */ + STD_PAL_60 = 6, /* PAL 60 */ + STD_INVALID = 7, + STD_AUTO = 7, +}; + +struct tw5864_input { + int nr; /* input number */ + struct tw5864_dev *root; + struct mutex lock; /* used for vidq and vdev */ + spinlock_t slock; /* used for sync between ISR, tasklet & V4L2 API */ + struct video_device vdev; + struct v4l2_ctrl_handler hdl; + struct vb2_queue vidq; + struct list_head active; + enum resolution resolution; + unsigned int width, height; + unsigned int frame_seqno; + unsigned int frame_gop_seqno; + unsigned int h264_idr_pic_id; + int enabled; + enum tw5864_vid_std std; + v4l2_std_id v4l2_std; + int tail_nb_bits; + u8 tail; + u8 *buf_cur_ptr; + int buf_cur_space_left; + + u32 reg_interlacing; + u32 reg_vlc; + u32 reg_dsp_codec; + u32 reg_dsp; + u32 reg_emu; + u32 reg_dsp_qp; + u32 reg_dsp_ref_mvp_lambda; + u32 reg_dsp_i4x4_weight; + u32 buf_id; + + struct tw5864_buf *vb; + + struct v4l2_ctrl *md_threshold_grid_ctrl; + u16 md_threshold_grid_values[12 * 16]; + int qp; + int gop; + + /* + * In (1/MAX_FPS) units. + * For max FPS (default), set to 1. + * For 1 FPS, set to e.g. 32. + */ + int frame_interval; + unsigned long new_frame_deadline; +}; + +struct tw5864_h264_frame { + struct tw5864_dma_buf vlc; + struct tw5864_dma_buf mv; + int vlc_len; + u32 checksum; + struct tw5864_input *input; + u64 timestamp; + unsigned int seqno; + unsigned int gop_seqno; +}; + +/* global device status */ +struct tw5864_dev { + spinlock_t slock; /* used for sync between ISR, tasklet & V4L2 API */ + struct v4l2_device v4l2_dev; + struct tw5864_input inputs[TW5864_INPUTS]; +#define H264_BUF_CNT 4 + struct tw5864_h264_frame h264_buf[H264_BUF_CNT]; + int h264_buf_r_index; + int h264_buf_w_index; + + struct tasklet_struct tasklet; + + int encoder_busy; + /* Input number to check next for ready raw picture (in RR fashion) */ + int next_input; + + /* pci i/o */ + char name[64]; + struct pci_dev *pci; + void __iomem *mmio; + u32 irqmask; +}; + +#define tw_readl(reg) readl(dev->mmio + reg) +#define tw_mask_readl(reg, mask) \ + (tw_readl(reg) & (mask)) +#define tw_mask_shift_readl(reg, mask, shift) \ + (tw_mask_readl((reg), ((mask) << (shift))) >> (shift)) + +#define tw_writel(reg, value) writel((value), dev->mmio + reg) +#define tw_mask_writel(reg, mask, value) \ + tw_writel(reg, (tw_readl(reg) & ~(mask)) | ((value) & (mask))) +#define tw_mask_shift_writel(reg, mask, shift, value) \ + tw_mask_writel((reg), ((mask) << (shift)), ((value) << (shift))) + +#define tw_setl(reg, bit) tw_writel((reg), tw_readl(reg) | (bit)) +#define tw_clearl(reg, bit) tw_writel((reg), tw_readl(reg) & ~(bit)) + +u8 tw5864_indir_readb(struct tw5864_dev *dev, u16 addr); +#define tw_indir_readb(addr) tw5864_indir_readb(dev, addr) +void tw5864_indir_writeb(struct tw5864_dev *dev, u16 addr, u8 data); +#define tw_indir_writeb(addr, data) tw5864_indir_writeb(dev, addr, data) + +void tw5864_irqmask_apply(struct tw5864_dev *dev); +int tw5864_video_init(struct tw5864_dev *dev, int *video_nr); +void tw5864_video_fini(struct tw5864_dev *dev); +void tw5864_prepare_frame_headers(struct tw5864_input *input); +void tw5864_h264_put_stream_header(u8 **buf, size_t *space_left, int qp, + int width, int height); +void tw5864_h264_put_slice_header(u8 **buf, size_t *space_left, + unsigned int idr_pic_id, + unsigned int frame_gop_seqno, + int *tail_nb_bits, u8 *tail); +void tw5864_request_encoded_frame(struct tw5864_input *input); From cf460a14ce7a3b84d24c4937d440ac388c7608a1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 14 Aug 2016 06:37:29 -0300 Subject: [PATCH 212/591] [media] tw5864: add missing HAS_DMA dependency Fix this warning: warning: (VIDEO_TW5864 && VIDEO_MEDIATEK_VCODEC) selects VIDEOBUF2_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA) This driver depends on HAS_DMA. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw5864/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/pci/tw5864/Kconfig b/drivers/media/pci/tw5864/Kconfig index 760fb11dfeae..87c8f327e2d4 100644 --- a/drivers/media/pci/tw5864/Kconfig +++ b/drivers/media/pci/tw5864/Kconfig @@ -1,6 +1,7 @@ config VIDEO_TW5864 tristate "Techwell TW5864 video/audio grabber and encoder" depends on VIDEO_DEV && PCI && VIDEO_V4L2 + depends on HAS_DMA select VIDEOBUF2_DMA_CONTIG ---help--- Support for boards based on Techwell TW5864 chip which provides From 617e901a12adf8bc9b8d2c41db0eccc7debab8d0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Aug 2016 13:26:50 -0300 Subject: [PATCH 213/591] [media] tw5864: remove double irq lock code As warned by smatch: drivers/media/pci/tw5864/tw5864-core.c:160 tw5864_h264_isr() error: double lock 'irqsave:flags' drivers/media/pci/tw5864/tw5864-core.c:174 tw5864_h264_isr() error: double unlock 'irqsave:flags' Remove the IRQ duplicated lock. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw5864/tw5864-core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/pci/tw5864/tw5864-core.c b/drivers/media/pci/tw5864/tw5864-core.c index 440cd7bb8d04..e3d884e963c0 100644 --- a/drivers/media/pci/tw5864/tw5864-core.c +++ b/drivers/media/pci/tw5864/tw5864-core.c @@ -157,12 +157,10 @@ static void tw5864_h264_isr(struct tw5864_dev *dev) cur_frame = next_frame; - spin_lock_irqsave(&input->slock, flags); input->frame_seqno++; input->frame_gop_seqno++; if (input->frame_gop_seqno >= input->gop) input->frame_gop_seqno = 0; - spin_unlock_irqrestore(&input->slock, flags); } else { dev_err(&dev->pci->dev, "Skipped frame on input %d because all buffers busy\n", From b9b048d9f92ac3c146d03ae2f6a96c628b5e3b8e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Aug 2016 13:28:49 -0300 Subject: [PATCH 214/591] [media] tw5864: remove two unused vars Remove those two vars that aren't used, as reported by smatch: drivers/media/pci/tw5864/tw5864-video.c: In function 'tw5864_prepare_frame_headers': drivers/media/pci/tw5864/tw5864-video.c:1219:16: warning: variable 'space_before_sl_hdr' set but not used [-Wunused-but-set-variable] unsigned long space_before_sl_hdr; ^~~~~~~~~~~~~~~~~~~ drivers/media/pci/tw5864/tw5864-video.c:1218:6: warning: variable 'sl_hdr' set but not used [-Wunused-but-set-variable] u8 *sl_hdr; ^~~~~~ Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw5864/tw5864-video.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c index 3461ba9162e7..6c1685aeaea9 100644 --- a/drivers/media/pci/tw5864/tw5864-video.c +++ b/drivers/media/pci/tw5864/tw5864-video.c @@ -1215,8 +1215,6 @@ void tw5864_prepare_frame_headers(struct tw5864_input *input) u8 *dst; size_t dst_space; unsigned long flags; - u8 *sl_hdr; - unsigned long space_before_sl_hdr; if (!vb) { spin_lock_irqsave(&input->slock, flags); @@ -1253,8 +1251,6 @@ void tw5864_prepare_frame_headers(struct tw5864_input *input) input->width, input->height); /* Put slice header */ - sl_hdr = dst; - space_before_sl_hdr = dst_space; tw5864_h264_put_slice_header(&dst, &dst_space, input->h264_idr_pic_id, input->frame_gop_seqno, &input->tail_nb_bits, &input->tail); From 3b2aa383b3bc4e16ee15a145f8d9575a73779337 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 16 Jun 2016 18:40:32 -0300 Subject: [PATCH 215/591] [media] s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP The driver doesn't set the struct v4l2_capability cap_info field so the v4l2-compliance tool reports the following errors for VIDIOC_QUERYCAP: Required ioctls: VIDIOC_QUERYCAP returned 0 (Success) fail: v4l2-compliance.cpp(304): string empty fail: v4l2-compliance.cpp(528): check_ustring(vcap.bus_info, sizeof(vcap.bus_info)) test VIDIOC_QUERYCAP: FAIL This patch fixes by setting the field in VIDIOC_QUERYCAP ioctl handler: Required ioctls: VIDIOC_QUERYCAP returned 0 (Success) test VIDIOC_QUERYCAP: OK Signed-off-by: Javier Martinez Canillas Acked-by: Jacek Anaszewski Acked-by: Hans Verkuil Reviewed-by: Shuah Khan Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 785e6936c881..4e0b3c8f08d5 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1256,7 +1256,8 @@ static int s5p_jpeg_querycap(struct file *file, void *priv, strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder", sizeof(cap->card)); } - cap->bus_info[0] = 0; + snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", + dev_name(ctx->jpeg->dev)); cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; return 0; From 4f355cb5676039b98232bb86d4ed1542eaa9e0be Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 23 Mar 2016 21:41:40 -0300 Subject: [PATCH 216/591] [media] exynos4-is: Fix fimc_is_parse_sensor_config() nodes handling The same struct device_node * is used for looking up the I2C sensor, OF graph endpoint and port. So the reference count is incremented but not decremented for the endpoint and port nodes. Fix this by having separate pointers for each node looked up. Signed-off-by: Javier Martinez Canillas Tested-by: Nicolas Dufresne Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos4-is/fimc-is.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 32ca55f16677..13c779de79fd 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -165,6 +165,7 @@ static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index, struct device_node *node) { struct fimc_is_sensor *sensor = &is->sensor[index]; + struct device_node *ep, *port; u32 tmp = 0; int ret; @@ -175,22 +176,25 @@ static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index, return -EINVAL; } - node = of_graph_get_next_endpoint(node, NULL); - if (!node) + ep = of_graph_get_next_endpoint(node, NULL); + if (!ep) return -ENXIO; - node = of_graph_get_remote_port(node); - if (!node) + port = of_graph_get_remote_port(ep); + of_node_put(ep); + if (!port) return -ENXIO; /* Use MIPI-CSIS channel id to determine the ISP I2C bus index. */ - ret = of_property_read_u32(node, "reg", &tmp); + ret = of_property_read_u32(port, "reg", &tmp); if (ret < 0) { dev_err(&is->pdev->dev, "reg property not found at: %s\n", - node->full_name); + port->full_name); + of_node_put(port); return ret; } + of_node_put(port); sensor->i2c_bus = tmp - FIMC_INPUT_MIPI_CSI2_0; return 0; } From b9f19f00d6be84ce099be4a403c37036398080c7 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 16 Jun 2016 18:40:33 -0300 Subject: [PATCH 217/591] [media] s5p-jpeg: only fill driver's name in capabilities driver field The driver fills in both the struct v4l2_capability driver and card fields the same values, that is the driver's name plus the information if the dev is a decoder or an encoder. But the driver field has a fixed length of 16 bytes so the filled data is truncated: Driver Info (not using libv4l2): Driver name : s5p-jpeg decode Card type : s5p-jpeg decoder Bus info : platform:11f50000.jpeg Driver version: 4.7.0 Also, this field should only contain the driver's name so use just that. The information if the device is a decoder or an encoder is in the card type field anyways. Signed-off-by: Javier Martinez Canillas Acked-by: Jacek Anaszewski Acked-by: Hans Verkuil Reviewed-by: Shuah Khan Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 4e0b3c8f08d5..47e7eab84d7b 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1246,12 +1246,12 @@ static int s5p_jpeg_querycap(struct file *file, void *priv, struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv); if (ctx->mode == S5P_JPEG_ENCODE) { - strlcpy(cap->driver, S5P_JPEG_M2M_NAME " encoder", + strlcpy(cap->driver, S5P_JPEG_M2M_NAME, sizeof(cap->driver)); strlcpy(cap->card, S5P_JPEG_M2M_NAME " encoder", sizeof(cap->card)); } else { - strlcpy(cap->driver, S5P_JPEG_M2M_NAME " decoder", + strlcpy(cap->driver, S5P_JPEG_M2M_NAME, sizeof(cap->driver)); strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder", sizeof(cap->card)); From 3a5a2ac064a316e01baa543ba3e1e8b3265c486a Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 16 Jun 2016 18:40:34 -0300 Subject: [PATCH 218/591] [media] gsc-m2m: add device name sufix to bus_info capatiliby field The driver doesn't set the device in the struct v4l2_capability bus_info field so v4l2-compliance reports the following error for VIDIOC_QUERYCAP: Required ioctls: fail: v4l2-compliance.cpp(537): missing bus_info prefix ('platform') test VIDIOC_QUERYCAP: FAIL This patch fixes this by filling also the device besides the bus. Signed-off-by: Javier Martinez Canillas Acked-by: Hans Verkuil Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos-gsc/gsc-m2m.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index ec6494cbdd45..725ee8f0b2cc 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -279,7 +279,8 @@ static int gsc_m2m_querycap(struct file *file, void *fh, strlcpy(cap->driver, gsc->pdev->name, sizeof(cap->driver)); strlcpy(cap->card, gsc->pdev->name, sizeof(cap->card)); - strlcpy(cap->bus_info, "platform", sizeof(cap->bus_info)); + snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", + dev_name(&gsc->pdev->dev)); cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE; From a4a4b15c6858bf4dc383ec7b601abb7635b6875e Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 16 Jun 2016 18:40:35 -0300 Subject: [PATCH 219/591] [media] gsc-m2m: improve v4l2_capability driver and card fields According to the V4L2 documentation the driver and card fields should be used to identify the driver and the device but the gsc-m2m driver fills those field using the platform device name, which in turn is the name of the device DT node. So not only the filled information isn't correct but also the same values are used in the driver, card and bus_info fields. Before this patch: Driver Info (not using libv4l2): Driver name : 13e00000.video- Card type : 13e00000.video-scaler Bus info : platform:13e00000.video-scaler Driver version: 4.7.0 After this patch: Driver Info (not using libv4l2): Driver name : exynos-gsc Card type : exynos-gsc gscaler Bus info : platform:13e00000.video-scaler Driver version: 4.7.0 Signed-off-by: Javier Martinez Canillas Acked-by: Hans Verkuil Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos-gsc/gsc-m2m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 725ee8f0b2cc..c019db81b8c2 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -277,8 +277,8 @@ static int gsc_m2m_querycap(struct file *file, void *fh, struct gsc_ctx *ctx = fh_to_ctx(fh); struct gsc_dev *gsc = ctx->gsc_dev; - strlcpy(cap->driver, gsc->pdev->name, sizeof(cap->driver)); - strlcpy(cap->card, gsc->pdev->name, sizeof(cap->card)); + strlcpy(cap->driver, GSC_MODULE_NAME, sizeof(cap->driver)); + strlcpy(cap->card, GSC_MODULE_NAME " gscaler", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(&gsc->pdev->dev)); cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE | From d188b679f49f5eca7f2d19465de2f6f004344aca Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 8 Jul 2016 11:12:00 -0300 Subject: [PATCH 220/591] [media] media: Doc s5p-mfc add missing fields to s5p_mfc_dev structure definition Add missing documentation for s5p_mfc_dev structure definition. Signed-off-by: Shuah Khan Reviewed-by: Javier Martinez Canillas Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 373e346fce3e..46b99f28cbd7 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -292,7 +292,9 @@ struct s5p_mfc_priv_buf { * @warn_start: hardware error code from which warnings start * @mfc_ops: ops structure holding HW operation function pointers * @mfc_cmds: cmd structure holding HW commands function pointers + * @mfc_regs: structure holding MFC registers * @fw_ver: loaded firmware sub-version + * risc_on: flag indicates RISC is on or off * */ struct s5p_mfc_dev { From d695c12c57feae371c943e019af920bc8b732dfb Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Fri, 8 Jul 2016 19:29:25 -0300 Subject: [PATCH 221/591] [media] media: s5p-mfc fix invalid memory access from s5p_mfc_release() If s5p_mfc_release() runs after s5p_mfc_remove(), the former will access invalid s5p_mfc_dev pointer saved in the s5p_mfc_ctx and runs into kernel paging request errors. Clear ctx dev pointer in s5p_mfc_remove() and change s5p_mfc_release() to avoid work that requires ctx->dev. odroid kernel: Unable to handle kernel paging request at virtual address f17c1104 odroid kernel: pgd = ebca4000 odroid kernel: [f17c1104] *pgd=6e23d811, *pte=00000000, *ppte=00000000 odroid kernel: Internal error: Oops: 807 [#1] PREEMPT SMP ARM odroid kernel: Modules linked in: cpufreq_userspace cpufreq_powersave cpufreq_conservative s5p_mfc s5p_jpeg v4l2_mem2mem videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_core v4l2_common videodev media odroid kernel: Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) odroid kernel: task: c2241400 ti: e7018000 task.ti: e7018000 odroid kernel: PC is at s5p_mfc_reset+0x40/0x28c [s5p_mfc] odroid kernel: LR is at s5p_mfc_reset+0x34/0x28c [s5p_mfc] odroid kernel: pc : [] lr : [] psr: 60010013 odroid kernel: [] (s5p_mfc_reset [s5p_mfc]) from [] (s5p_mfc_deinit_hw+0x14/0x3c [s5p_mfc]) odroid kernel: [] (s5p_mfc_deinit_hw [s5p_mfc]) from [] (s5p_mfc_release+0xac/0x1c4 [s5p_mfc]) odroid kernel: [] (s5p_mfc_release [s5p_mfc]) from [] (v4l2_release+0x38/0x74 [videodev]) odroid kernel: [] (v4l2_release [videodev]) from [] (__fput+0x80/0x1c8) odroid kernel: [] (__fput) from [] (task_work_run+0x94/0xc8) odroid kernel: [] (task_work_run) from [] (do_work_pending+0x7c/0xa4) odroid kernel: [] (do_work_pending) from [] (slow_work_pending+0xc/0x20) odroid kernel: Code: eb3edacc e5953078 e3a06000 e2833c11 (e5836004) Signed-off-by: Shuah Khan Tested-by: Luis de Bethencourt Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 72 ++++++++++++++++-------- 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index e3f104fafd0a..69c91c01b997 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -924,39 +924,50 @@ static int s5p_mfc_release(struct file *file) struct s5p_mfc_ctx *ctx = fh_to_ctx(file->private_data); struct s5p_mfc_dev *dev = ctx->dev; + /* if dev is null, do cleanup that doesn't need dev */ mfc_debug_enter(); - mutex_lock(&dev->mfc_mutex); + if (dev) + mutex_lock(&dev->mfc_mutex); s5p_mfc_clock_on(); vb2_queue_release(&ctx->vq_src); vb2_queue_release(&ctx->vq_dst); - /* Mark context as idle */ - clear_work_bit_irqsave(ctx); - /* If instance was initialised and not yet freed, - * return instance and free resources */ - if (ctx->state != MFCINST_FREE && ctx->state != MFCINST_INIT) { - mfc_debug(2, "Has to free instance\n"); - s5p_mfc_close_mfc_inst(dev, ctx); - } - /* hardware locking scheme */ - if (dev->curr_ctx == ctx->num) - clear_bit(0, &dev->hw_lock); - dev->num_inst--; - if (dev->num_inst == 0) { - mfc_debug(2, "Last instance\n"); - s5p_mfc_deinit_hw(dev); - del_timer_sync(&dev->watchdog_timer); - if (s5p_mfc_power_off() < 0) - mfc_err("Power off failed\n"); + if (dev) { + /* Mark context as idle */ + clear_work_bit_irqsave(ctx); + /* + * If instance was initialised and not yet freed, + * return instance and free resources + */ + if (ctx->state != MFCINST_FREE && ctx->state != MFCINST_INIT) { + mfc_debug(2, "Has to free instance\n"); + s5p_mfc_close_mfc_inst(dev, ctx); + } + /* hardware locking scheme */ + if (dev->curr_ctx == ctx->num) + clear_bit(0, &dev->hw_lock); + dev->num_inst--; + if (dev->num_inst == 0) { + mfc_debug(2, "Last instance\n"); + s5p_mfc_deinit_hw(dev); + del_timer_sync(&dev->watchdog_timer); + if (s5p_mfc_power_off() < 0) + mfc_err("Power off failed\n"); + } } mfc_debug(2, "Shutting down clock\n"); s5p_mfc_clock_off(); - dev->ctx[ctx->num] = NULL; + if (dev) + dev->ctx[ctx->num] = NULL; s5p_mfc_dec_ctrls_delete(ctx); v4l2_fh_del(&ctx->fh); - v4l2_fh_exit(&ctx->fh); + /* vdev is gone if dev is null */ + if (dev) + v4l2_fh_exit(&ctx->fh); kfree(ctx); mfc_debug_leave(); - mutex_unlock(&dev->mfc_mutex); + if (dev) + mutex_unlock(&dev->mfc_mutex); + return 0; } @@ -1298,9 +1309,26 @@ err_dma: static int s5p_mfc_remove(struct platform_device *pdev) { struct s5p_mfc_dev *dev = platform_get_drvdata(pdev); + struct s5p_mfc_ctx *ctx; + int i; v4l2_info(&dev->v4l2_dev, "Removing %s\n", pdev->name); + /* + * Clear ctx dev pointer to avoid races between s5p_mfc_remove() + * and s5p_mfc_release() and s5p_mfc_release() accessing ctx->dev + * after s5p_mfc_remove() is run during unbind. + */ + mutex_lock(&dev->mfc_mutex); + for (i = 0; i < MFC_NUM_CONTEXTS; i++) { + ctx = dev->ctx[i]; + if (!ctx) + continue; + /* clear ctx->dev */ + ctx->dev = NULL; + } + mutex_unlock(&dev->mfc_mutex); + del_timer_sync(&dev->watchdog_timer); flush_workqueue(dev->watchdog_workqueue); destroy_workqueue(dev->watchdog_workqueue); From 02d9a33a028f46e4b924ea00b4bbcde3a1243100 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Mon, 11 Jul 2016 21:29:43 -0300 Subject: [PATCH 222/591] [media] media: s5p-mfc remove void function return statement Remove void function return statement Signed-off-by: Shuah Khan Reviewed-by: Javier Martinez Canillas Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 69c91c01b997..43842dac530a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -494,7 +494,6 @@ static void s5p_mfc_handle_error(struct s5p_mfc_dev *dev, s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev); s5p_mfc_clock_off(); wake_up_dev(dev, reason, err); - return; } /* Header parsing interrupt handling */ From 05b72d439208f94ad2333d6323835f89890a3a9f Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Tue, 12 Jul 2016 08:27:59 -0300 Subject: [PATCH 223/591] [media] s5p-mfc: remove redundant return value check of platform_get_resource() Remove unneeded error handling on the result of a call to platform_get_resource() when the value is passed to devm_ioremap_resource(). Signed-off-by: Wei Yongjun Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 43842dac530a..afa80be77f96 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1168,10 +1168,6 @@ static int s5p_mfc_probe(struct platform_device *pdev) dev->variant = mfc_get_drv_data(pdev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(&pdev->dev, "failed to get io resource\n"); - return -ENOENT; - } dev->regs_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(dev->regs_base)) return PTR_ERR(dev->regs_base); From 8fe47dca12011d3afebf85cb9837c22e346af243 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Tue, 12 Jul 2016 14:28:30 -0300 Subject: [PATCH 224/591] [media] media: s5p-mfc Fix misspelled error message and checkpatch errors Fix misspelled error message and existing checkpatch errors in the error message conditional. WARNING: suspect code indent for conditional statements (8, 24) if (ctx->state != MFCINST_HEAD_PARSED && [...] mfc_err("Can not get crop information\n"); Signed-off-by: Shuah Khan Reviewed-by: Javier Martinez Canillas Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 47c997d9e8cb..52081ddc9bf2 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -776,11 +776,12 @@ static int vidioc_g_crop(struct file *file, void *priv, u32 left, right, top, bottom; if (ctx->state != MFCINST_HEAD_PARSED && - ctx->state != MFCINST_RUNNING && ctx->state != MFCINST_FINISHING - && ctx->state != MFCINST_FINISHED) { - mfc_err("Cannont set crop\n"); - return -EINVAL; - } + ctx->state != MFCINST_RUNNING && + ctx->state != MFCINST_FINISHING && + ctx->state != MFCINST_FINISHED) { + mfc_err("Can not get crop information\n"); + return -EINVAL; + } if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) { left = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_h, ctx); right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT; From 06f0a57f35cda9d4941695472008105d34c0d626 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Thu, 14 Jul 2016 11:40:22 -0300 Subject: [PATCH 225/591] [media] media: s5p-mfc remove unnecessary error messages Removed unnecessary error message as appropriate error code is returned. Changed error message into a debug. Signed-off-by: Shuah Khan Reviewed-by: Javier Martinez Canillas Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index afa80be77f96..ffb9c53fca2c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -758,7 +758,6 @@ static int s5p_mfc_open(struct file *file) /* Allocate memory for context */ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) { - mfc_err("Not enough memory\n"); ret = -ENOMEM; goto err_alloc; } @@ -775,7 +774,7 @@ static int s5p_mfc_open(struct file *file) while (dev->ctx[ctx->num]) { ctx->num++; if (ctx->num >= MFC_NUM_CONTEXTS) { - mfc_err("Too many open contexts\n"); + mfc_debug(2, "Too many open contexts\n"); ret = -EBUSY; goto err_no_ctx; } From 605b89206140172080d3c467380821ba6ef9ce1f Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Thu, 14 Jul 2016 17:01:56 -0300 Subject: [PATCH 226/591] [media] media: s5p-jpeg add missing blank lines after declarations Missing blank lines after declarations are making it hard to read the code. Fix them and also fix other checkpatch warnings at the same time. Signed-off-by: Shuah Khan Acked-by: Jacek Anaszewski Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 47e7eab84d7b..dde9d3598c48 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -537,6 +537,7 @@ static const u32 fourcc_to_dwngrd_schema_id[] = { static int s5p_jpeg_get_dwngrd_sch_id_by_fourcc(u32 fourcc) { int i; + for (i = 0; i < ARRAY_SIZE(fourcc_to_dwngrd_schema_id); ++i) { if (fourcc_to_dwngrd_schema_id[i] == fourcc) return i; @@ -1274,7 +1275,8 @@ static int enum_fmt(struct s5p_jpeg_fmt *sjpeg_formats, int n, if (num == f->index) break; /* Correct type but haven't reached our index yet, - * just increment per-type index */ + * just increment per-type index + */ ++num; } } @@ -1350,6 +1352,7 @@ static int s5p_jpeg_g_fmt(struct file *file, void *priv, struct v4l2_format *f) pix->bytesperline = 0; if (q_data->fmt->fourcc != V4L2_PIX_FMT_JPEG) { u32 bpl = q_data->w; + if (q_data->fmt->colplanes == 1) bpl = (bpl * q_data->fmt->depth) >> 3; pix->bytesperline = bpl; @@ -1375,6 +1378,7 @@ static struct s5p_jpeg_fmt *s5p_jpeg_find_format(struct s5p_jpeg_ctx *ctx, for (k = 0; k < ARRAY_SIZE(sjpeg_formats); k++) { struct s5p_jpeg_fmt *fmt = &sjpeg_formats[k]; + if (fmt->fourcc == pixelformat && fmt->flags & fmt_flag && fmt->flags & ctx->jpeg->variant->fmt_ver_flag) { @@ -1432,7 +1436,8 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct s5p_jpeg_fmt *fmt, return -EINVAL; /* V4L2 specification suggests the driver corrects the format struct - * if any of the dimensions is unsupported */ + * if any of the dimensions is unsupported + */ if (q_type == FMT_TYPE_OUTPUT) jpeg_bound_align_image(ctx, &pix->width, S5P_JPEG_MIN_WIDTH, S5P_JPEG_MAX_WIDTH, 0, @@ -2490,6 +2495,7 @@ static void s5p_jpeg_buf_queue(struct vb2_buffer *vb) if (ctx->mode == S5P_JPEG_DECODE && vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { struct s5p_jpeg_q_data tmp, *q_data; + ctx->hdr_parsed = s5p_jpeg_parse_hdr(&tmp, (unsigned long)vb2_plane_vaddr(vb, 0), min((unsigned long)ctx->out_q.size, @@ -3017,7 +3023,8 @@ static int s5p_jpeg_resume(struct device *dev) static const struct dev_pm_ops s5p_jpeg_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(s5p_jpeg_suspend, s5p_jpeg_resume) - SET_RUNTIME_PM_OPS(s5p_jpeg_runtime_suspend, s5p_jpeg_runtime_resume, NULL) + SET_RUNTIME_PM_OPS(s5p_jpeg_runtime_suspend, s5p_jpeg_runtime_resume, + NULL) }; static struct s5p_jpeg_variant s5p_jpeg_drvdata = { From ed90013e40af2bb703ecaed39dc2422c70006a34 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sat, 16 Jul 2016 05:30:25 -0300 Subject: [PATCH 227/591] [media] s5p-mfc: Remove deprecated create_singlethread_workqueue alloc_workqueue replaces deprecated create_singlethread_workqueue(). The MFC device driver is a v4l2 driver which can encode/decode video raw/elementary streams and has support for all popular video codecs. The driver's watchdog_workqueue has been replaced with system_wq since it queues a single work item, &dev->watchdog_work, which calls for no ordering requirement. The work item is involved in running the watchdog timer and is not being used on a memory reclaim path. Work item has been flushed in s5p_mfc_remove() to ensure that there are no pending tasks while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index ffb9c53fca2c..0a5b8f5e011e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -153,7 +153,7 @@ static void s5p_mfc_watchdog(unsigned long arg) * error. Now it is time to kill all instances and * reset the MFC. */ mfc_err("Time out during waiting for HW\n"); - queue_work(dev->watchdog_workqueue, &dev->watchdog_work); + schedule_work(&dev->watchdog_work); } dev->watchdog_timer.expires = jiffies + msecs_to_jiffies(MFC_WATCHDOG_INTERVAL); @@ -1246,7 +1246,6 @@ static int s5p_mfc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dev); dev->hw_lock = 0; - dev->watchdog_workqueue = create_singlethread_workqueue(S5P_MFC_NAME); INIT_WORK(&dev->watchdog_work, s5p_mfc_watchdog_worker); atomic_set(&dev->watchdog_cnt, 0); init_timer(&dev->watchdog_timer); @@ -1324,8 +1323,7 @@ static int s5p_mfc_remove(struct platform_device *pdev) mutex_unlock(&dev->mfc_mutex); del_timer_sync(&dev->watchdog_timer); - flush_workqueue(dev->watchdog_workqueue); - destroy_workqueue(dev->watchdog_workqueue); + flush_work(&dev->watchdog_work); video_unregister_device(dev->vfd_enc); video_unregister_device(dev->vfd_dec); From c7930f37c1300d7ca4d8ee1b80ca28c3d889c255 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 9 Aug 2016 08:35:15 -0300 Subject: [PATCH 228/591] [media] exynos4-is: fimc-is-i2c: don't print error when adding adapter fails The core will do this for us now. Signed-off-by: Wolfram Sang Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos4-is/fimc-is-i2c.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is-i2c.c b/drivers/media/platform/exynos4-is/fimc-is-i2c.c index 7521aa59b064..fd888ef447a9 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-i2c.c +++ b/drivers/media/platform/exynos4-is/fimc-is-i2c.c @@ -56,11 +56,8 @@ static int fimc_is_i2c_probe(struct platform_device *pdev) i2c_adap->class = I2C_CLASS_SPD; ret = i2c_add_adapter(i2c_adap); - if (ret < 0) { - dev_err(&pdev->dev, "failed to add I2C bus %s\n", - node->full_name); + if (ret < 0) return ret; - } platform_set_drvdata(pdev, isp_i2c); From 69d4a521586ef93db94451afa5072ec3f6bee401 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Wed, 3 Aug 2016 15:10:09 -0300 Subject: [PATCH 229/591] [media] VIDEO_MEDIATEK_VPU should depend on HAS_DMA If NO_DMA=y: ERROR: "bad_dma_ops" [drivers/media/platform/mtk-vpu/mtk-vpu.ko] undefined! Add a dependency on HAS_DMA to fix this. Signed-off-by: Geert Uytterhoeven Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 7843e8f3d37d..46f14ddeee65 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -155,7 +155,7 @@ config VIDEO_CODA config VIDEO_MEDIATEK_VPU tristate "Mediatek Video Processor Unit" - depends on VIDEO_DEV && VIDEO_V4L2 + depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA depends on ARCH_MEDIATEK || COMPILE_TEST ---help--- This driver provides downloading VPU firmware and From b956fb2d2e562a344df41a8f2fc51314bac5b300 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 4 Aug 2016 05:31:22 -0300 Subject: [PATCH 230/591] [media] adv7511: fix error return code in adv7511_probe() Fix to return error code -ENOMEM from the i2c client register error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv7511.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c index 53030d631653..5ba0f21bcfe4 100644 --- a/drivers/media/i2c/adv7511.c +++ b/drivers/media/i2c/adv7511.c @@ -1898,6 +1898,7 @@ static int adv7511_probe(struct i2c_client *client, const struct i2c_device_id * state->i2c_cec_addr >> 1); if (state->i2c_cec == NULL) { v4l2_err(sd, "failed to register cec i2c client\n"); + err = -ENOMEM; goto err_unreg_edid; } adv7511_wr(sd, 0xe2, 0x00); /* power up cec section */ From 38e699bc79b3b59503540dee4afa3a0174ad8616 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 9 Aug 2016 08:35:13 -0300 Subject: [PATCH 231/591] [media] media: pci: netup_unidvb: don't print error when adding adapter fails The core will do this for us now. Signed-off-by: Wolfram Sang Acked-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c index c09c52bc6eab..b49e4f9788e8 100644 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c @@ -327,11 +327,8 @@ static int netup_i2c_init(struct netup_unidvb_dev *ndev, int bus_num) i2c->adap.dev.parent = &ndev->pci_dev->dev; i2c_set_adapdata(&i2c->adap, i2c); ret = i2c_add_adapter(&i2c->adap); - if (ret) { - dev_err(&ndev->pci_dev->dev, - "%s(): failed to add I2C adapter\n", __func__); + if (ret) return ret; - } dev_info(&ndev->pci_dev->dev, "%s(): registered I2C bus %d at 0x%x\n", __func__, From 49cd08e699c3fca1262fccd3826c7c17f2292bf1 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 9 Aug 2016 08:35:16 -0300 Subject: [PATCH 232/591] [media] media: usb: dvb-usb-v2: dvb_usb_core: don't print error when adding adapter fails The core will do this for us now. Signed-off-by: Wolfram Sang Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index 3fbb2cd19f5e..a8e6624fbe83 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c @@ -82,8 +82,6 @@ static int dvb_usbv2_i2c_init(struct dvb_usb_device *d) ret = i2c_add_adapter(&d->i2c_adap); if (ret < 0) { d->i2c_adap.algo = NULL; - dev_err(&d->udev->dev, "%s: i2c_add_adapter() failed=%d\n", - KBUILD_MODNAME, ret); goto err; } From b325c98b90e22402be1524db810107508a6edfe6 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Tue, 9 Aug 2016 08:35:14 -0300 Subject: [PATCH 233/591] [media] media: pci: pt3: don't print error when adding adapter fails The core will do this for us now. Signed-off-by: Wolfram Sang Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/pt3/pt3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c index eff5e9f51ace..7fb649e523f4 100644 --- a/drivers/media/pci/pt3/pt3.c +++ b/drivers/media/pci/pt3/pt3.c @@ -798,10 +798,8 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) strlcpy(i2c->name, DRV_NAME, sizeof(i2c->name)); i2c_set_adapdata(i2c, pt3); ret = i2c_add_adapter(i2c); - if (ret < 0) { - dev_err(&pdev->dev, "Failed to add i2c adapter\n"); + if (ret < 0) goto err_i2cbuf; - } for (i = 0; i < PT3_NUM_FE; i++) { ret = pt3_alloc_adapter(pt3, i); From ba75faf43dc60744608ffa1412fdeceff2126cbc Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 9 Aug 2016 12:36:41 -0300 Subject: [PATCH 234/591] [media] rcar-fcp: Make sure rcar_fcp_enable() returns 0 on success When resuming from suspend-to-RAM on r8a7795/salvator-x: dpm_run_callback(): pm_genpd_resume_noirq+0x0/0x90 returns 1 PM: Device fe940000.fdp1 failed to resume noirq: error 1 dpm_run_callback(): pm_genpd_resume_noirq+0x0/0x90 returns 1 PM: Device fe944000.fdp1 failed to resume noirq: error 1 dpm_run_callback(): pm_genpd_resume_noirq+0x0/0x90 returns 1 PM: Device fe948000.fdp1 failed to resume noirq: error 1 According to its documentation, rcar_fcp_enable() returns 0 on success or a negative error code if an error occurs. Hence fdp1_pm_runtime_resume() and vsp1_pm_runtime_resume() forward its return value to their callers. However, rcar_fcp_enable() forwards the return value of pm_runtime_get_sync(), which can actually be 1 on success, leading to the resume failure above. To fix this, consider only negative values returned by pm_runtime_get_sync() to be failures. Fixes: 7b49235e83b2347c ("[media] v4l: Add Renesas R-Car FCP driver") Signed-off-by: Geert Uytterhoeven Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-fcp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c index 6a7bcc3028b1..bc50c69ee0c5 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c @@ -99,10 +99,16 @@ EXPORT_SYMBOL_GPL(rcar_fcp_put); */ int rcar_fcp_enable(struct rcar_fcp_device *fcp) { + int error; + if (!fcp) return 0; - return pm_runtime_get_sync(fcp->dev); + error = pm_runtime_get_sync(fcp->dev); + if (error < 0) + return error; + + return 0; } EXPORT_SYMBOL_GPL(rcar_fcp_enable); From dd9ad4fbf0cecfe9a823d6a18707af394eb9af21 Mon Sep 17 00:00:00 2001 From: Stephen Backway Date: Tue, 9 Aug 2016 19:43:40 -0300 Subject: [PATCH 235/591] [media] cx23885: Add support for Hauppauge WinTV quadHD ATSC version Add support for the Hauppauge WinTV quadHD ATSC version. IR support has not been provided, all 4 tuners, demodulators etc are working. Further documentation can be found on Linux TV wiki. Signed-off-by: Stephen Backway Signed-off-by: Mauro Carvalho Chehab --- .../media/v4l-drivers/cx23885-cardlist.rst | 1 + drivers/media/pci/cx23885/cx23885-cards.c | 29 +++++ drivers/media/pci/cx23885/cx23885-dvb.c | 100 ++++++++++++++++++ drivers/media/pci/cx23885/cx23885.h | 3 +- 4 files changed, 132 insertions(+), 1 deletion(-) diff --git a/Documentation/media/v4l-drivers/cx23885-cardlist.rst b/Documentation/media/v4l-drivers/cx23885-cardlist.rst index ded3b9139317..f38003255b9a 100644 --- a/Documentation/media/v4l-drivers/cx23885-cardlist.rst +++ b/Documentation/media/v4l-drivers/cx23885-cardlist.rst @@ -60,3 +60,4 @@ cx23885 cards list 54 -> ViewCast 260e [1576:0260] 55 -> ViewCast 460e [1576:0460] 56 -> Hauppauge WinTV-QuadHD-DVB [0070:6a28,0070:6b28] + 57 -> Hauppauge WinTV-QuadHD-ATSC [0070:6a18,0070:6b18] diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 4abf50f2694f..99ba8d6328f0 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -770,6 +770,11 @@ struct cx23885_board cx23885_boards[] = { .portb = CX23885_MPEG_DVB, .portc = CX23885_MPEG_DVB, }, + [CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC] = { + .name = "Hauppauge WinTV-QuadHD-ATSC", + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, + }, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -1073,6 +1078,14 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x0070, .subdevice = 0x6b28, .card = CX23885_BOARD_HAUPPAUGE_QUADHD_DVB, /* Tuner Pair 2 */ + }, { + .subvendor = 0x0070, + .subdevice = 0x6a18, + .card = CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC, /* Tuner Pair 1 */ + }, { + .subvendor = 0x0070, + .subdevice = 0x6b18, + .card = CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC, /* Tuner Pair 2 */ }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -1278,6 +1291,18 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) /* WinTV-QuadHD (DVB) Tuner Pair 2 (PCIe, IR, half height, DVB-T/T2/C, DVB-T/T2/C */ break; + case 165100: + /* + * WinTV-QuadHD (ATSC) Tuner Pair 1 (PCIe, IR, half height, + * ATSC, ATSC + */ + break; + case 165101: + /* + * WinTV-QuadHD (DVB) Tuner Pair 2 (PCIe, IR, half height, + * ATSC, ATSC + */ + break; default: printk(KERN_WARNING "%s: warning: " "unknown hauppauge model #%d\n", @@ -1751,6 +1776,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) break; case CX23885_BOARD_HAUPPAUGE_HVR5525: case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: + case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: /* * HVR5525 GPIO Details: * GPIO-00 IR_WIDE @@ -1826,6 +1852,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: case CX23885_BOARD_HAUPPAUGE_HVR1210: case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: + case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: /* FIXME: Implement me */ break; case CX23885_BOARD_HAUPPAUGE_HVR1270: @@ -2025,6 +2052,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE: case CX23885_BOARD_HAUPPAUGE_HVR5525: case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: + case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: if (dev->i2c_bus[0].i2c_rc == 0) hauppauge_eeprom(dev, eeprom+0xc0); break; @@ -2171,6 +2199,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; break; case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB: + case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ ts1->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index e5748a93c479..c5daa2306155 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -74,6 +74,7 @@ #include "sp2.h" #include "m88ds3103.h" #include "m88rs6000t.h" +#include "lgdt3306a.h" static unsigned int debug; @@ -574,6 +575,30 @@ static struct stb6100_config prof_8000_stb6100_config = { .refclock = 27000000, }; +static struct lgdt3306a_config hauppauge_quadHD_ATSC_a_config = { + .i2c_addr = 0x59, + .qam_if_khz = 4000, + .vsb_if_khz = 3250, + .deny_i2c_rptr = 1, /* Disabled */ + .spectral_inversion = 0, /* Disabled */ + .mpeg_mode = LGDT3306A_MPEG_SERIAL, + .tpclk_edge = LGDT3306A_TPCLK_RISING_EDGE, + .tpvalid_polarity = LGDT3306A_TP_VALID_HIGH, + .xtalMHz = 25, /* 24 or 25 */ +}; + +static struct lgdt3306a_config hauppauge_quadHD_ATSC_b_config = { + .i2c_addr = 0x0e, + .qam_if_khz = 4000, + .vsb_if_khz = 3250, + .deny_i2c_rptr = 1, /* Disabled */ + .spectral_inversion = 0, /* Disabled */ + .mpeg_mode = LGDT3306A_MPEG_SERIAL, + .tpclk_edge = LGDT3306A_TPCLK_RISING_EDGE, + .tpvalid_polarity = LGDT3306A_TP_VALID_HIGH, + .xtalMHz = 25, /* 24 or 25 */ +}; + static int p8000_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage voltage) { @@ -2365,6 +2390,81 @@ static int dvb_register(struct cx23885_tsport *port) break; } break; + case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC: + switch (port->nr) { + /* port b - Terrestrial/cable */ + case 1: + /* attach frontend */ + i2c_bus = &dev->i2c_bus[0]; + fe0->dvb.frontend = dvb_attach(lgdt3306a_attach, + &hauppauge_quadHD_ATSC_a_config, &i2c_bus->i2c_adap); + if (fe0->dvb.frontend == NULL) + break; + + /* attach tuner */ + memset(&si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = fe0->dvb.frontend; + si2157_config.if_port = 1; + si2157_config.inversion = 1; + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "si2157", I2C_NAME_SIZE); + info.addr = 0x60; + info.platform_data = &si2157_config; + request_module("%s", info.type); + client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); + if (!client_tuner || !client_tuner->dev.driver) { + module_put(client_demod->dev.driver->owner); + i2c_unregister_device(client_demod); + port->i2c_client_demod = NULL; + goto frontend_detach; + } + if (!try_module_get(client_tuner->dev.driver->owner)) { + i2c_unregister_device(client_tuner); + module_put(client_demod->dev.driver->owner); + i2c_unregister_device(client_demod); + port->i2c_client_demod = NULL; + goto frontend_detach; + } + port->i2c_client_tuner = client_tuner; + break; + + /* port c - terrestrial/cable */ + case 2: + /* attach frontend */ + i2c_bus = &dev->i2c_bus[0]; + fe0->dvb.frontend = dvb_attach(lgdt3306a_attach, + &hauppauge_quadHD_ATSC_b_config, &i2c_bus->i2c_adap); + if (fe0->dvb.frontend == NULL) + break; + + /* attach tuner */ + memset(&si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = fe0->dvb.frontend; + si2157_config.if_port = 1; + si2157_config.inversion = 1; + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "si2157", I2C_NAME_SIZE); + info.addr = 0x62; + info.platform_data = &si2157_config; + request_module("%s", info.type); + client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, &info); + if (!client_tuner || !client_tuner->dev.driver) { + module_put(client_demod->dev.driver->owner); + i2c_unregister_device(client_demod); + port->i2c_client_demod = NULL; + goto frontend_detach; + } + if (!try_module_get(client_tuner->dev.driver->owner)) { + i2c_unregister_device(client_tuner); + module_put(client_demod->dev.driver->owner); + i2c_unregister_device(client_demod); + port->i2c_client_demod = NULL; + goto frontend_detach; + } + port->i2c_client_tuner = client_tuner; + break; + } + break; default: printk(KERN_INFO "%s: The frontend of your DVB/ATSC card " diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index 24a0a6c5b501..2ebece93d111 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -103,7 +103,8 @@ #define CX23885_BOARD_HAUPPAUGE_STARBURST 53 #define CX23885_BOARD_VIEWCAST_260E 54 #define CX23885_BOARD_VIEWCAST_460E 55 -#define CX23885_BOARD_HAUPPAUGE_QUADHD_DVB 56 +#define CX23885_BOARD_HAUPPAUGE_QUADHD_DVB 56 +#define CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC 57 #define GPIO_0 0x00000001 #define GPIO_1 0x00000002 From d259a5eed91de0e96be62ab51c6c6a812f26f04d Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Wed, 10 Aug 2016 02:54:41 -0300 Subject: [PATCH 236/591] [media] drxd_hard: Add missing error code assignment before test It is likely that checking the result of the 2nd 'read16' is expected here. Signed-off-by: Christophe JAILLET Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/drxk_hard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c index b975da099929..c595adc61c6f 100644 --- a/drivers/media/dvb-frontends/drxk_hard.c +++ b/drivers/media/dvb-frontends/drxk_hard.c @@ -6448,7 +6448,7 @@ static int get_strength(struct drxk_state *state, u64 *strength) return status; /* SCU c.o.c. */ - read16(state, SCU_RAM_AGC_RF_IACCU_HI_CO__A, &scu_coc); + status = read16(state, SCU_RAM_AGC_RF_IACCU_HI_CO__A, &scu_coc); if (status < 0) return status; From bb5147aa42777efe8fec262eab579cfba4500133 Mon Sep 17 00:00:00 2001 From: Liu Ying Date: Thu, 11 Aug 2016 02:10:10 -0300 Subject: [PATCH 237/591] [media] media-entity.h: remove redundant macro definition for gobj_to_link() The macro gobj_to_link() is defined twice in media-entity.h. Let's remove one. Signed-off-by: Liu Ying Signed-off-by: Mauro Carvalho Chehab --- include/media/media-entity.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 09b03c17784d..afd61713ea3b 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -520,9 +520,6 @@ static inline bool media_entity_enum_intersects( #define gobj_to_link(gobj) \ container_of(gobj, struct media_link, graph_obj) -#define gobj_to_link(gobj) \ - container_of(gobj, struct media_link, graph_obj) - #define gobj_to_pad(gobj) \ container_of(gobj, struct media_pad, graph_obj) From f598a6e362bb287a50085ffe0c3c8506127919f9 Mon Sep 17 00:00:00 2001 From: Liu Ying Date: Thu, 11 Aug 2016 02:10:09 -0300 Subject: [PATCH 238/591] [media] media-entity.h: Correct KernelDoc of media_entity_enum_empty() The function media_entity_enum_empty() returns true when the bitmap of the input parameter media entity enumeration is empty instead of marked. This patch corrects the return value description of the function. Signed-off-by: Liu Ying Signed-off-by: Mauro Carvalho Chehab --- include/media/media-entity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/media/media-entity.h b/include/media/media-entity.h index afd61713ea3b..fa874ad4870e 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -486,7 +486,7 @@ media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, * * @ent_enum: Entity enumeration * - * Returns true if the entity was marked. + * Returns true if the entity was empty. */ static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) { From 6a21b728732390deb75536dd9253d958ca9223d0 Mon Sep 17 00:00:00 2001 From: Liu Ying Date: Thu, 11 Aug 2016 02:10:11 -0300 Subject: [PATCH 239/591] [media] media-entity.h: remove redundant macro definition for gobj_to_pad() The macro gobj_to_pad() is defined twice in media-entity.h. Let's remove one. Signed-off-by: Liu Ying Signed-off-by: Mauro Carvalho Chehab --- include/media/media-entity.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/media/media-entity.h b/include/media/media-entity.h index fa874ad4870e..7bf6885dd37f 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -520,9 +520,6 @@ static inline bool media_entity_enum_intersects( #define gobj_to_link(gobj) \ container_of(gobj, struct media_link, graph_obj) -#define gobj_to_pad(gobj) \ - container_of(gobj, struct media_pad, graph_obj) - #define gobj_to_intf(gobj) \ container_of(gobj, struct media_interface, graph_obj) From fc49071766ed371268cc03b868cf97f21ad3f273 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Thu, 11 Aug 2016 07:18:37 -0300 Subject: [PATCH 240/591] [media] v4l: Do not allow re-registering sub-devices Albeit not prohibited explicitly, re-registering sub-devices generated a big, loud warning which quite likely soon was followed by a crash. What followed was re-initialising a media entity, driver's registered() callback being called and re-adding a list entry to a list. Prevent this by returning an error if a sub-device is already registered. [mchehab@s-opensource.com: reorder logic to check if !sd before dereferencing it] Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index 06fa5f1b2cff..62bbed76dbbc 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -160,12 +160,9 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, int err; /* Check for valid input */ - if (v4l2_dev == NULL || sd == NULL || !sd->name[0]) + if (!v4l2_dev || !sd || sd->v4l2_dev || !sd->name[0]) return -EINVAL; - /* Warn if we apparently re-register a subdev */ - WARN_ON(sd->v4l2_dev != NULL); - /* * The reason to acquire the module here is to avoid unloading * a module of sub-device which is registered to a media From 5a08bc008d8ee9573bc84161ef864f6c9553a6b0 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 11 Aug 2016 13:28:15 -0300 Subject: [PATCH 241/591] [media] tvp5150: use sd internal ops .registered instead .registered_async The driver is using the struct v4l2_subdev_core_ops .registered_async callback to register the connector entities and create the pad links after the subdev entity has been registered with the media device. But the .registered_async callback isn't needed since the v4l2 core already calls the struct v4l2_subdev_internal_ops .registered callback in v4l2_device_register_subdev(), after media_device_register_entity(). So, use the .registered() callback instead of the .registered_async() that is going to be removed in a following patch since isn't needed. Suggested-by: Sakari Ailus Signed-off-by: Javier Martinez Canillas Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/tvp5150.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index b7648fda519c..4740da39d698 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -1171,7 +1171,7 @@ static int tvp5150_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) return 0; } -static int tvp5150_registered_async(struct v4l2_subdev *sd) +static int tvp5150_registered(struct v4l2_subdev *sd) { #ifdef CONFIG_MEDIA_CONTROLLER struct tvp5150 *decoder = to_tvp5150(sd); @@ -1220,7 +1220,6 @@ static const struct v4l2_subdev_core_ops tvp5150_core_ops = { .g_register = tvp5150_g_register, .s_register = tvp5150_s_register, #endif - .registered_async = tvp5150_registered_async, }; static const struct v4l2_subdev_tuner_ops tvp5150_tuner_ops = { @@ -1258,6 +1257,10 @@ static const struct v4l2_subdev_ops tvp5150_ops = { .pad = &tvp5150_pad_ops, }; +static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = { + .registered = tvp5150_registered, +}; + /**************************************************************************** I2C Client & Driver @@ -1471,6 +1474,7 @@ static int tvp5150_probe(struct i2c_client *c, } v4l2_i2c_subdev_init(sd, c, &tvp5150_ops); + sd->internal_ops = &tvp5150_internal_ops; sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; #if defined(CONFIG_MEDIA_CONTROLLER) From a53d2f299dc83340c695e153363a2f21641d5f58 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 11 Aug 2016 13:28:16 -0300 Subject: [PATCH 242/591] [media] v4l2-async: remove unneeded .registered_async callback The v4l2_subdev_core_ops .registered_async callback was added to notify a subdev when its entity has been registered with the media device, to allow for example to modify the media graph (i.e: adding entities/links). But that's not needed since there is already a .registered callback in struct v4l2_subdev_internal_ops that's called after the entity has been registered with the media device in v4l2_device_register_subdev(). Suggested-by: Sakari Ailus Signed-off-by: Javier Martinez Canillas Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-async.c | 7 ------- include/media/v4l2-subdev.h | 3 --- 2 files changed, 10 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index a4b224d92572..5bada202b2d3 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -119,13 +119,6 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier, return ret; } - ret = v4l2_subdev_call(sd, core, registered_async); - if (ret < 0 && ret != -ENOIOCTLCMD) { - if (notifier->unbind) - notifier->unbind(notifier, sd, asd); - return ret; - } - if (list_empty(¬ifier->waiting) && notifier->complete) return notifier->complete(notifier); diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index de5117a01b98..6e1d044e3ee8 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -184,8 +184,6 @@ struct v4l2_subdev_io_pin_config { * for it to be warned when the value of a control changes. * * @unsubscribe_event: remove event subscription from the control framework. - * - * @registered_async: the subdevice has been registered async. */ struct v4l2_subdev_core_ops { int (*log_status)(struct v4l2_subdev *sd); @@ -211,7 +209,6 @@ struct v4l2_subdev_core_ops { struct v4l2_event_subscription *sub); int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh, struct v4l2_event_subscription *sub); - int (*registered_async)(struct v4l2_subdev *sd); }; /** From c07c8ba8443c25c3372c712c62204ec86b6e38ad Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:23:39 -0300 Subject: [PATCH 243/591] [media] staging: media: lirc: lirc_imon: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_imon.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index ff1926ca1f96..a183e68ec320 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -797,16 +797,11 @@ static int imon_probe(struct usb_interface *interface, goto free_rbuf; } rx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!rx_urb) { - dev_err(dev, "%s: usb_alloc_urb failed for IR urb\n", __func__); + if (!rx_urb) goto free_lirc_buf; - } tx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!tx_urb) { - dev_err(dev, "%s: usb_alloc_urb failed for display urb\n", - __func__); + if (!tx_urb) goto free_rx_urb; - } mutex_init(&context->ctx_lock); context->vfd_proto_6p = vfd_proto_6p; From 5e015c0e6d1e83bff625f2596d8e123f616002fe Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 11 Aug 2016 18:23:40 -0300 Subject: [PATCH 244/591] [media] staging: media: lirc: lirc_sasem: don't print error when allocating urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_sasem.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index 2218d0042030..b080fde6d740 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -758,17 +758,12 @@ static int sasem_probe(struct usb_interface *interface, } rx_urb = usb_alloc_urb(0, GFP_KERNEL); if (!rx_urb) { - dev_err(&interface->dev, - "%s: usb_alloc_urb failed for IR urb\n", __func__); alloc_status = 5; goto alloc_status_switch; } if (vfd_ep_found) { tx_urb = usb_alloc_urb(0, GFP_KERNEL); if (!tx_urb) { - dev_err(&interface->dev, - "%s: usb_alloc_urb failed for VFD urb", - __func__); alloc_status = 6; goto alloc_status_switch; } From fd3223966cac9e6c3751b43c500963e9c71356f0 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sat, 13 Aug 2016 15:16:54 -0300 Subject: [PATCH 245/591] [media] helene: fix memory leak when heleno_x_pon fails The error return path of failed calls to heleno_x_pon leak memory because priv is not kfree'd. Fix this by kfree'ing priv before returning. Signed-off-by: Colin Ian King Acked-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/helene.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c index 97a8982740a6..3d1cd5fa4904 100644 --- a/drivers/media/dvb-frontends/helene.c +++ b/drivers/media/dvb-frontends/helene.c @@ -987,8 +987,10 @@ struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe, if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); - if (helene_x_pon(priv) != 0) + if (helene_x_pon(priv) != 0) { + kfree(priv); return NULL; + } if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); @@ -1021,8 +1023,10 @@ struct dvb_frontend *helene_attach(struct dvb_frontend *fe, if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); - if (helene_x_pon(priv) != 0) + if (helene_x_pon(priv) != 0) { + kfree(priv); return NULL; + } if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); From 708c05b8faf6ac82808bc416902ca23770190ee1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 15 Aug 2016 05:10:15 -0300 Subject: [PATCH 246/591] [media] media-types.rst: fix typo Fix copy-and-paste error: the radio devices are /dev/radio, not /dev/vbi. Signed-off-by: Hans Verkuil < Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/mediactl/media-types.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/mediactl/media-types.rst b/Documentation/media/uapi/mediactl/media-types.rst index c3a23108b99d..3e03dc2e6003 100644 --- a/Documentation/media/uapi/mediactl/media-types.rst +++ b/Documentation/media/uapi/mediactl/media-types.rst @@ -413,7 +413,7 @@ Types and flags used to represent the media graph elements - Device node interface for radio (V4L) - - typically, /dev/vbi? + - typically, /dev/radio? - .. row 9 From 15d6e91a2a77c7552e90b34925b210590244d4cb Mon Sep 17 00:00:00 2001 From: Stanimir Varbanov Date: Tue, 16 Aug 2016 06:09:42 -0300 Subject: [PATCH 247/591] [media] media: v4l2-ctrls: append missing h264 profile string This appends missing "Stereo High" h264 profile string. Without it the v4l2 compliance would crash kernel with NULL pointer dereference at: [ 26.882278] [] std_validate+0x378/0x42c [ 26.886967] [] set_ctrl+0x8c/0x134 [ 26.892521] [] v4l2_s_ctrl+0x90/0xf4 [ 26.897555] [] v4l_s_ctrl+0x4c/0x110 [ 26.902503] [] __video_do_ioctl+0x240/0x2b4 [ 26.907625] [] video_usercopy+0x33c/0x46c [ 26.913441] [] video_ioctl2+0x14/0x1c [ 26.918822] [] v4l2_ioctl+0xe0/0x110 [ 26.924032] [] do_vfs_ioctl+0xb4/0x764 [ 26.929238] [] SyS_ioctl+0x84/0x98 [ 26.934707] [] __sys_trace_return+0x0/0x4 Signed-off-by: Stanimir Varbanov Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-ctrls.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index f7abfad9ad23..adc2147fcff7 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -361,6 +361,7 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "Scalable Baseline", "Scalable High", "Scalable High Intra", + "Stereo High", "Multiview High", NULL, }; From 8eb14e8084b0f39dbf23dcd0c263fc2fac862048 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 17 Aug 2016 14:26:28 -0300 Subject: [PATCH 248/591] [media] vb2: Fix vb2_core_dqbuf() kernel-doc The kernel-doc has the wrong function name and also the pindex parameter is missing in the documentation. Signed-off-by: Javier Martinez Canillas Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 71d8bd8dcc81..bfe85879c563 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1733,8 +1733,9 @@ static void __vb2_dqbuf(struct vb2_buffer *vb) } /** - * vb2_dqbuf() - Dequeue a buffer to the userspace + * vb2_core_dqbuf() - Dequeue a buffer to the userspace * @q: videobuf2 queue + * @pindex: pointer to the buffer index. May be NULL * @pb: buffer structure passed from userspace to vidioc_dqbuf handler * in driver * @nonblocking: if true, this call will not sleep waiting for a buffer if no From fb6609280db902bd5d34445fba1c926e95e63914 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Fri, 19 Aug 2016 05:04:54 -0300 Subject: [PATCH 249/591] [media] dvb_frontend: Use memdup_user() rather than duplicating its implementation * Reuse existing functionality from memdup_user() instead of keeping duplicate source code. This issue was detected by using the Coccinelle software. * Return directly if this copy operation failed. * Replace the specification of data structures by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/dvb_frontend.c | 28 ++++++--------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index be99c8dbc5f8..01511e5a5566 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -1969,17 +1969,9 @@ static int dvb_frontend_ioctl_properties(struct file *file, if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS)) return -EINVAL; - tvp = kmalloc(tvps->num * sizeof(struct dtv_property), GFP_KERNEL); - if (!tvp) { - err = -ENOMEM; - goto out; - } - - if (copy_from_user(tvp, (void __user *)tvps->props, - tvps->num * sizeof(struct dtv_property))) { - err = -EFAULT; - goto out; - } + tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); + if (IS_ERR(tvp)) + return PTR_ERR(tvp); for (i = 0; i < tvps->num; i++) { err = dtv_property_process_set(fe, tvp + i, file); @@ -2002,17 +1994,9 @@ static int dvb_frontend_ioctl_properties(struct file *file, if ((tvps->num == 0) || (tvps->num > DTV_IOCTL_MAX_MSGS)) return -EINVAL; - tvp = kmalloc(tvps->num * sizeof(struct dtv_property), GFP_KERNEL); - if (!tvp) { - err = -ENOMEM; - goto out; - } - - if (copy_from_user(tvp, (void __user *)tvps->props, - tvps->num * sizeof(struct dtv_property))) { - err = -EFAULT; - goto out; - } + tvp = memdup_user(tvps->props, tvps->num * sizeof(*tvp)); + if (IS_ERR(tvp)) + return PTR_ERR(tvp); /* * Let's use our own copy of property cache, in order to From 6d232c80158ae5a6fb497e0462d52c57c4459439 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Aug 2016 22:02:57 -0300 Subject: [PATCH 250/591] docs-rst: kernel-doc: better output struct members Right now, for a struct, kernel-doc produces the following output: .. c:type:: struct v4l2_prio_state stores the priority states **Definition** :: struct v4l2_prio_state { atomic_t prios[4]; }; **Members** ``atomic_t prios[4]`` array with elements to store the array priorities Putting a member name in verbatim and adding a continuation line causes the LaTeX output to generate something like: item[atomic_t prios\[4\]] array with elements to store the array priorities Everything inside "item" is non-breakable, with may produce lines bigger than the column width. Also, for function members, like: int (* rx_read) (struct v4l2_subdev *sd, u8 *buf, size_t count,ssize_t *num); It puts the name of the member at the end, like: int (*) (struct v4l2_subdev *sd, u8 *buf, size_t count,ssize_t *num) read With is very confusing. The best is to highlight what really matters: the member name. is a secondary information. So, change kernel-doc, for it to produce the output on a different way: **Members** ``prios[4]`` array with elements to store the array priorities Also, as the type is not part of LaTeX "item[]", LaTeX will split it into multiple lines, if needed. So, both LaTeX/PDF and HTML outputs will look good. It should be noticed, however, that the way Sphinx LaTeX output handles things like: Foo bar is different than the HTML output. On HTML, it will produce something like: **Foo** bar While, on LaTeX, it puts both foo and bar at the same line, like: **Foo** bar Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index ba081c7636a2..d225e178aa1b 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -2000,7 +2000,7 @@ sub output_struct_rst(%) { ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; $type = $args{'parametertypes'}{$parameter}; print_lineno($parameterdesc_start_lines{$parameter_name}); - print "``$type $parameter``\n"; + print "``" . $parameter . "``\n"; output_highlight_rst($args{'parameterdescs'}{$parameter_name}); print "\n"; } From a769de07edfd7881d17bf6c6fa014a0e176beb8b Mon Sep 17 00:00:00 2001 From: Jannik Becher Date: Sun, 21 Aug 2016 15:44:20 -0300 Subject: [PATCH 251/591] [media] drivers: hackrf: fixed a coding style issue changed 'unsigned' to 'unsigned int' to obtain the coding style. Signed-off-by: Jannik Becher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/hackrf/hackrf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index c2c8d12e9498..662d5090a12e 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c @@ -129,7 +129,7 @@ struct hackrf_dev { struct list_head rx_buffer_list; struct list_head tx_buffer_list; spinlock_t buffer_list_lock; /* Protects buffer_list */ - unsigned sequence; /* Buffer sequence counter */ + unsigned int sequence; /* Buffer sequence counter */ unsigned int vb_full; /* vb is full and packets dropped */ unsigned int vb_empty; /* vb is empty and packets dropped */ From b1cb50beaf0e82161f4da0e10188cce1c33db44a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 23 Aug 2016 03:48:37 -0300 Subject: [PATCH 252/591] [media] redrat3: fix sparse warning Fix this sparse warning: drivers/media/rc/redrat3.c:490:18: warning: incorrect type in assignment (different base types) drivers/media/rc/redrat3.c:495:9: warning: cast to restricted __be32 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/redrat3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index ec8016d9b009..8d7df6dfcb20 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -480,7 +480,7 @@ static int redrat3_set_timeout(struct rc_dev *rc_dev, unsigned int timeoutns) struct redrat3_dev *rr3 = rc_dev->priv; struct usb_device *udev = rr3->udev; struct device *dev = rr3->dev; - u32 *timeout; + __be32 *timeout; int ret; timeout = kmalloc(sizeof(*timeout), GFP_KERNEL); From 8c87a44c96f2863198183add3e5c59f5982c6d00 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 23 Aug 2016 10:39:39 -0300 Subject: [PATCH 253/591] [media] m2m-deinterlace: Fix error print during probe v4l2_err() can not be used for printing error for missing interleaved support in DMA as this point the pcdev->v4l2_dev is not valid. Signed-off-by: Peter Ujfalusi Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/m2m-deinterlace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index 0fcb5c78031d..5a5dec348f4d 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -1016,7 +1016,7 @@ static int deinterlace_probe(struct platform_device *pdev) return -ENODEV; if (!dma_has_cap(DMA_INTERLEAVE, pcdev->dma_chan->device->cap_mask)) { - v4l2_err(&pcdev->v4l2_dev, "DMA does not support INTERLEAVE\n"); + dev_err(&pdev->dev, "DMA does not support INTERLEAVE\n"); goto rel_dma; } From 7c142bfee6cbcd90b1847a708e22d461a1dfa38b Mon Sep 17 00:00:00 2001 From: Baoquan He Date: Wed, 24 Aug 2016 13:06:45 +0800 Subject: [PATCH 254/591] docs: kernel-parameter: Improve the description of nr_cpus and maxcpus From the old description people still can't get what's the exact difference between nr_cpus and maxcpus. Especially in kdump kernel nr_cpus is always suggested if it's implemented in the ARCH. The reason is nr_cpus is used to limit the max number of possible cpu in system, the sum of already plugged cpus and hot plug cpus can't exceed its value. However maxcpus is used to limit how many cpus are allowed to be brought up during bootup. Signed-off-by: Baoquan He Signed-off-by: Jonathan Corbet --- Documentation/kernel-parameters.txt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 20557efa8bce..1fa28092ec00 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -2161,10 +2161,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. than or equal to this physical address is ignored. maxcpus= [SMP] Maximum number of processors that an SMP kernel - should make use of. maxcpus=n : n >= 0 limits the - kernel to using 'n' processors. n=0 is a special case, - it is equivalent to "nosmp", which also disables - the IO APIC. + will bring up during bootup. maxcpus=n : n >= 0 limits + the kernel to bring up 'n' processors. Surely after + bootup you can bring up the other plugged cpu by executing + "echo 1 > /sys/devices/system/cpu/cpuX/online". So maxcpus + only takes effect during system bootup. + While n=0 is a special case, it is equivalent to "nosmp", + which also disables the IO APIC. max_loop= [LOOP] The number of loop block devices that get (loop.max_loop) unconditionally pre-created at init time. The default @@ -2773,9 +2776,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. nr_cpus= [SMP] Maximum number of processors that an SMP kernel could support. nr_cpus=n : n >= 1 limits the kernel to - supporting 'n' processors. Later in runtime you can not - use hotplug cpu feature to put more cpu back to online. - just like you compile the kernel NR_CPUS=n + support 'n' processors. It could be larger than the + number of already plugged CPU during bootup, later in + runtime you can physically add extra cpu until it reaches + n. So during boot up some boot time memory for per-cpu + variables need be pre-allocated for later physical cpu + hot plugging. nr_uarts= [SERIAL] maximum number of UARTs to be registered. From d37c43ce1975c1c3f28064bf3ebd2876e177bad8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 20:20:57 -0300 Subject: [PATCH 255/591] docs-rst: improve typedef parser Improve the parser to handle typedefs like: typedef bool v4l2_check_dv_timings_fnc(const struct v4l2_dv_timings *t, void *handle); Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index d225e178aa1b..ad6d4e495f3f 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -2190,7 +2190,9 @@ sub dump_typedef($$) { $x =~ s@/\*.*?\*/@@gos; # strip comments. # Parse function prototypes - if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/) { + if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || + $x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) { + # Function typedefs $return_type = $1; $declaration_name = $2; From 82801d065b4915d030e7f63212d146a75042aa91 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 20:20:58 -0300 Subject: [PATCH 256/591] docs-rst: kernel-doc: fix typedef output in RST format When using a typedef function like this one: typedef bool v4l2_check_dv_timings_fnc (const struct v4l2_dv_timings * t, void * handle); The Sphinx C domain expects it to create a c:type: reference, as that's the way it creates the type references when parsing a c:function:: declaration. So, a declaration like: .. c:function:: bool v4l2_valid_dv_timings (const struct v4l2_dv_timings * t, const struct v4l2_dv_timings_cap * cap, v4l2_check_dv_timings_fnc fnc, void * fnc_handle) Will create a cross reference for :c:type:`v4l2_check_dv_timings_fnc`. So, when outputting such typedefs in RST format, we need to handle this special case, as otherwise it will produce those warnings: ./include/media/v4l2-dv-timings.h:43: WARNING: c:type reference target not found: v4l2_check_dv_timings_fnc ./include/media/v4l2-dv-timings.h:60: WARNING: c:type reference target not found: v4l2_check_dv_timings_fnc ./include/media/v4l2-dv-timings.h:81: WARNING: c:type reference target not found: v4l2_check_dv_timings_fnc So, change the kernel-doc script to produce a RST output for the above typedef as: .. c:type:: v4l2_check_dv_timings_fnc **Typedef**: timings check callback **Syntax** ``bool v4l2_check_dv_timings_fnc (const struct v4l2_dv_timings * t, void * handle);`` Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index ad6d4e495f3f..301bf874cac8 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1831,13 +1831,22 @@ sub output_function_rst(%) { my %args = %{$_[0]}; my ($parameter, $section); my $oldprefix = $lineprefix; - my $start; + my $start = ""; - print ".. c:function:: "; - if ($args{'functiontype'} ne "") { - $start = $args{'functiontype'} . " " . $args{'function'} . " ("; + if ($args{'typedef'}) { + print ".. c:type:: ". $args{'function'} . "\n\n"; + print_lineno($declaration_start_line); + print " **Typedef**: "; + $lineprefix = ""; + output_highlight_rst($args{'purpose'}); + $start = "\n\n**Syntax**\n\n ``"; } else { - $start = $args{'function'} . " ("; + print ".. c:function:: "; + } + if ($args{'functiontype'} ne "") { + $start .= $args{'functiontype'} . " " . $args{'function'} . " ("; + } else { + $start .= $args{'function'} . " ("; } print $start; @@ -1856,11 +1865,15 @@ sub output_function_rst(%) { print $type . " " . $parameter; } } - print ")\n\n"; - print_lineno($declaration_start_line); - $lineprefix = " "; - output_highlight_rst($args{'purpose'}); - print "\n"; + if ($args{'typedef'}) { + print ");``\n\n"; + } else { + print ")\n\n"; + print_lineno($declaration_start_line); + $lineprefix = " "; + output_highlight_rst($args{'purpose'}); + print "\n"; + } print "**Parameters**\n\n"; $lineprefix = " "; @@ -2203,6 +2216,7 @@ sub dump_typedef($$) { output_declaration($declaration_name, 'function', {'function' => $declaration_name, + 'typedef' => 1, 'module' => $modulename, 'functiontype' => $return_type, 'parameterlist' => \@parameterlist, From b62b9d81a06f60ae4ad5f7a9c969f5b9680e2829 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 24 Aug 2016 15:35:24 +0200 Subject: [PATCH 257/591] docs: sphinx-extensions: add metadata parallel-safe The setup() function of a Sphinx-extension can return a dictionary. This is treated by Sphinx as metadata of the extension [1]. With metadata "parallel_read_safe = True" a extension is marked as save for "parallel reading of source". This is needed if you want build in parallel with N processes. E.g.: make SPHINXOPTS=-j4 htmldocs will no longer log warnings like: WARNING: the foobar extension does not declare if it is safe for parallel reading, assuming it isn't - please ask the extension author to check and make it explicit. Add metadata to extensions: * kernel-doc * flat-table * kernel-include [1] http://www.sphinx-doc.org/en/stable/extdev/#extension-metadata Signed-off-by: Markus Heiser Tested-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- Documentation/sphinx/kernel-doc.py | 8 ++++++++ Documentation/sphinx/kernel_include.py | 7 +++++++ Documentation/sphinx/rstFlatTable.py | 6 ++++++ 3 files changed, 21 insertions(+) mode change 100644 => 100755 Documentation/sphinx/rstFlatTable.py diff --git a/Documentation/sphinx/kernel-doc.py b/Documentation/sphinx/kernel-doc.py index f6920c0af6ee..d15e07f36881 100644 --- a/Documentation/sphinx/kernel-doc.py +++ b/Documentation/sphinx/kernel-doc.py @@ -39,6 +39,8 @@ from docutils.parsers.rst import directives from sphinx.util.compat import Directive from sphinx.ext.autodoc import AutodocReporter +__version__ = '1.0' + class KernelDocDirective(Directive): """Extract kernel-doc comments from the specified file""" required_argument = 1 @@ -139,3 +141,9 @@ def setup(app): app.add_config_value('kerneldoc_verbosity', 1, 'env') app.add_directive('kernel-doc', KernelDocDirective) + + return dict( + version = __version__, + parallel_read_safe = True, + parallel_write_safe = True + ) diff --git a/Documentation/sphinx/kernel_include.py b/Documentation/sphinx/kernel_include.py index db5738238733..f523aa68a36b 100755 --- a/Documentation/sphinx/kernel_include.py +++ b/Documentation/sphinx/kernel_include.py @@ -39,11 +39,18 @@ from docutils.parsers.rst import directives from docutils.parsers.rst.directives.body import CodeBlock, NumberLines from docutils.parsers.rst.directives.misc import Include +__version__ = '1.0' + # ============================================================================== def setup(app): # ============================================================================== app.add_directive("kernel-include", KernelInclude) + return dict( + version = __version__, + parallel_read_safe = True, + parallel_write_safe = True + ) # ============================================================================== class KernelInclude(Include): diff --git a/Documentation/sphinx/rstFlatTable.py b/Documentation/sphinx/rstFlatTable.py old mode 100644 new mode 100755 index 26db852e3c74..55f275793028 --- a/Documentation/sphinx/rstFlatTable.py +++ b/Documentation/sphinx/rstFlatTable.py @@ -73,6 +73,12 @@ def setup(app): roles.register_local_role('cspan', c_span) roles.register_local_role('rspan', r_span) + return dict( + version = __version__, + parallel_read_safe = True, + parallel_write_safe = True + ) + # ============================================================================== def c_span(name, rawtext, text, lineno, inliner, options=None, content=None): # ============================================================================== From cd21379b169827bb4314b72641511593ed9ba2b6 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 24 Aug 2016 17:36:14 +0200 Subject: [PATCH 258/591] doc-rst: generic way to build PDF of sub-folders This extends the method to build only sub-folders to the targets "latexdocs" and "pdfdocs". To do so, a conf.py in the sub-folder is required, where the latex_documents of the sub-folder are defined. E.g. to build only gpu's PDF add the following to the Documentation/gpu/conf.py:: +latex_documents = [ + ("index", "gpu.tex", "Linux GPU Driver Developer's Guide", + "The kernel development community", "manual"), +] and run: make SPHINXDIRS=gpu pdfdocs Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/Makefile.sphinx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx index 894cfaa41f55..92deea30b183 100644 --- a/Documentation/Makefile.sphinx +++ b/Documentation/Makefile.sphinx @@ -71,12 +71,12 @@ ifeq ($(HAVE_PDFLATEX),0) $(warning The 'xelatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.) @echo " SKIP Sphinx $@ target." else # HAVE_PDFLATEX - @$(call loop_cmd,sphinx,latex,.,latex,.) + @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var))) endif # HAVE_PDFLATEX pdfdocs: latexdocs ifneq ($(HAVE_PDFLATEX),0) - $(Q)$(MAKE) PDFLATEX=xelatex LATEXOPTS="-interaction=nonstopmode" -C $(BUILDDIR)/latex + $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=xelatex LATEXOPTS="-interaction=nonstopmode" -C $(BUILDDIR)/$(var)/latex) endif # HAVE_PDFLATEX epubdocs: From 951499710be258b85c135ee1f7ebe5f7a4b7ac91 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 24 Aug 2016 17:36:15 +0200 Subject: [PATCH 259/591] doc-rst: define PDF's of the media folder To build only the PDF of the media folder run:: make SPHINXDIRS=media pdfdocs Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/media/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/media/conf.py b/Documentation/media/conf.py index 77cb2bbd9461..bef927bc4659 100644 --- a/Documentation/media/conf.py +++ b/Documentation/media/conf.py @@ -3,3 +3,8 @@ project = 'Linux Media Subsystem Documentation' tags.add("subproject") + +latex_documents = [ + ('index', 'media.tex', 'Linux Media Subsystem Documentation', + 'The kernel development community', 'manual'), +] From 36dba13bda9e33ed22b8c8bcff5283a2d54578da Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Sep 2016 07:21:18 -0300 Subject: [PATCH 260/591] [media] tda18271: use prefix on all printk messages Some messages have a hardcoded prefix; others not. Use the pr_fmt() to ensure that all messages will use the same prefix. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/tuners/tda18271-fe.c | 11 ++++++----- drivers/media/tuners/tda18271-priv.h | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/tuners/tda18271-fe.c b/drivers/media/tuners/tda18271-fe.c index f8620741bb5f..2d50e8b1dce1 100644 --- a/drivers/media/tuners/tda18271-fe.c +++ b/drivers/media/tuners/tda18271-fe.c @@ -18,11 +18,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include #include "tda18271-priv.h" #include "tda8290.h" +#include +#include + int tda18271_debug; module_param_named(debug, tda18271_debug, int, 0644); MODULE_PARM_DESC(debug, "set debug level " @@ -646,7 +647,7 @@ static int tda18271_calc_rf_filter_curve(struct dvb_frontend *fe) unsigned int i; int ret; - tda_info("tda18271: performing RF tracking filter calibration\n"); + tda_info("performing RF tracking filter calibration\n"); /* wait for die temperature stabilization */ msleep(200); @@ -692,12 +693,12 @@ static int tda18271c2_rf_cal_init(struct dvb_frontend *fe) if (tda_fail(ret)) goto fail; - tda_info("tda18271: RF tracking filter calibration complete\n"); + tda_info("RF tracking filter calibration complete\n"); priv->cal_initialized = true; goto end; fail: - tda_info("tda18271: RF tracking filter calibration failed!\n"); + tda_info("RF tracking filter calibration failed!\n"); end: return ret; } diff --git a/drivers/media/tuners/tda18271-priv.h b/drivers/media/tuners/tda18271-priv.h index cc80f544af34..0bcc735a0427 100644 --- a/drivers/media/tuners/tda18271-priv.h +++ b/drivers/media/tuners/tda18271-priv.h @@ -21,6 +21,8 @@ #ifndef __TDA18271_PRIV_H__ #define __TDA18271_PRIV_H__ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include From bc0495c41d397a85a8c8828bcb13e49a8d293762 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Sep 2016 07:21:27 -0300 Subject: [PATCH 261/591] [media] tea5767: use module prefix on printed messages use pr_fmt() & friends for error messages to output like: [ 9.651721] tea5767: Chip ID is not zero. It is not a TEA5767 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/tuners/tea5767.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/tuners/tea5767.c b/drivers/media/tuners/tea5767.c index 36e85d81acb2..cd535cd4c071 100644 --- a/drivers/media/tuners/tea5767.c +++ b/drivers/media/tuners/tea5767.c @@ -10,6 +10,8 @@ * from their contributions on DScaler. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -370,17 +372,18 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr) { struct tuner_i2c_props i2c = { .adap = i2c_adap, .addr = i2c_addr }; unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + int rc; if ((rc = tuner_i2c_xfer_recv(&i2c, buffer, 7))< 5) { - printk(KERN_WARNING "It is not a TEA5767. Received %i bytes.\n", rc); + pr_warn("It is not a TEA5767. Received %i bytes.\n", rc); return -EINVAL; } /* If all bytes are the same then it's a TV tuner and not a tea5767 */ if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && buffer[0] == buffer[3] && buffer[0] == buffer[4]) { - printk(KERN_WARNING "All bytes are equal. It is not a TEA5767\n"); + pr_warn("All bytes are equal. It is not a TEA5767\n"); return -EINVAL; } @@ -390,7 +393,7 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr) * Byte 5: bit 7:0 : == 0 */ if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) { - printk(KERN_WARNING "Chip ID is not zero. It is not a TEA5767\n"); + pr_warn("Chip ID is not zero. It is not a TEA5767\n"); return -EINVAL; } From dafb65fb98d85d8e78405e82c83e81975e5d5480 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Sep 2016 10:16:18 -0300 Subject: [PATCH 262/591] [media] mb86a20s: fix the locking logic On this frontend, it takes a while to start output normal TS data. That only happens on state S9. On S8, the TS output is enabled, but it is not reliable enough. However, the zigzag loop is too fast to let it sync. As, on practical tests, the zigzag software loop doesn't seem to be helping, but just slowing down the tuning, let's switch to hardware algorithm, as the tuners used on such devices are capable of work with frequency drifts without any help from software. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/mb86a20s.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c index 41325328a22e..a9fb7d45d9ca 100644 --- a/drivers/media/dvb-frontends/mb86a20s.c +++ b/drivers/media/dvb-frontends/mb86a20s.c @@ -318,7 +318,11 @@ static int mb86a20s_read_status(struct dvb_frontend *fe, enum fe_status *status) if (val >= 7) *status |= FE_HAS_SYNC; - if (val >= 8) /* Maybe 9? */ + /* + * Actually, on state S8, it starts receiving TS, but the TS + * output is only on normal state after the transition to S9. + */ + if (val >= 9) *status |= FE_HAS_LOCK; dev_dbg(&state->i2c->dev, "%s: Status = 0x%02x (state = %d)\n", @@ -2058,6 +2062,11 @@ static void mb86a20s_release(struct dvb_frontend *fe) kfree(state); } +static int mb86a20s_get_frontend_algo(struct dvb_frontend *fe) +{ + return DVBFE_ALGO_HW; +} + static struct dvb_frontend_ops mb86a20s_ops; struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config, @@ -2130,6 +2139,7 @@ static struct dvb_frontend_ops mb86a20s_ops = { .read_status = mb86a20s_read_status_and_stats, .read_signal_strength = mb86a20s_read_signal_strength_from_cache, .tune = mb86a20s_tune, + .get_frontend_algo = mb86a20s_get_frontend_algo, }; MODULE_DESCRIPTION("DVB Frontend module for Fujitsu mb86A20s hardware"); From 505a0ea706fc1db4381baa6c6bd2e596e730a55e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Sep 2016 10:43:53 -0300 Subject: [PATCH 263/591] [media] mb86a20s: fix demod settings With the current settings, only one channel locks properly. That's likely because, when this driver was written, Brazil were still using experimental transmissions. Change it to reproduce the settings used by the newer drivers. That makes it lock on other channels. Tested with both PixelView SBTVD Hybrid (cx231xx-based) and C3Tech Digital Duo HDTV/SDTV (em28xx-based) devices. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/mb86a20s.c | 92 ++++++++++++-------------- 1 file changed, 42 insertions(+), 50 deletions(-) diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c index a9fb7d45d9ca..fe79358b035e 100644 --- a/drivers/media/dvb-frontends/mb86a20s.c +++ b/drivers/media/dvb-frontends/mb86a20s.c @@ -71,25 +71,27 @@ static struct regdata mb86a20s_init1[] = { }; static struct regdata mb86a20s_init2[] = { - { 0x28, 0x22 }, { 0x29, 0x00 }, { 0x2a, 0x1f }, { 0x2b, 0xf0 }, + { 0x50, 0xd1 }, { 0x51, 0x22 }, + { 0x39, 0x01 }, + { 0x71, 0x00 }, { 0x3b, 0x21 }, - { 0x3c, 0x38 }, + { 0x3c, 0x3a }, { 0x01, 0x0d }, - { 0x04, 0x08 }, { 0x05, 0x03 }, + { 0x04, 0x08 }, { 0x05, 0x05 }, { 0x04, 0x0e }, { 0x05, 0x00 }, - { 0x04, 0x0f }, { 0x05, 0x37 }, - { 0x04, 0x0b }, { 0x05, 0x78 }, + { 0x04, 0x0f }, { 0x05, 0x14 }, + { 0x04, 0x0b }, { 0x05, 0x8c }, { 0x04, 0x00 }, { 0x05, 0x00 }, - { 0x04, 0x01 }, { 0x05, 0x1e }, - { 0x04, 0x02 }, { 0x05, 0x07 }, - { 0x04, 0x03 }, { 0x05, 0xd0 }, + { 0x04, 0x01 }, { 0x05, 0x07 }, + { 0x04, 0x02 }, { 0x05, 0x0f }, + { 0x04, 0x03 }, { 0x05, 0xa0 }, { 0x04, 0x09 }, { 0x05, 0x00 }, { 0x04, 0x0a }, { 0x05, 0xff }, - { 0x04, 0x27 }, { 0x05, 0x00 }, + { 0x04, 0x27 }, { 0x05, 0x64 }, { 0x04, 0x28 }, { 0x05, 0x00 }, - { 0x04, 0x1e }, { 0x05, 0x00 }, - { 0x04, 0x29 }, { 0x05, 0x64 }, - { 0x04, 0x32 }, { 0x05, 0x02 }, + { 0x04, 0x1e }, { 0x05, 0xff }, + { 0x04, 0x29 }, { 0x05, 0x0a }, + { 0x04, 0x32 }, { 0x05, 0x0a }, { 0x04, 0x14 }, { 0x05, 0x02 }, { 0x04, 0x04 }, { 0x05, 0x00 }, { 0x04, 0x05 }, { 0x05, 0x22 }, @@ -97,8 +99,6 @@ static struct regdata mb86a20s_init2[] = { { 0x04, 0x07 }, { 0x05, 0xd8 }, { 0x04, 0x12 }, { 0x05, 0x00 }, { 0x04, 0x13 }, { 0x05, 0xff }, - { 0x04, 0x15 }, { 0x05, 0x4e }, - { 0x04, 0x16 }, { 0x05, 0x20 }, /* * On this demod, when the bit count reaches the count below, @@ -152,42 +152,36 @@ static struct regdata mb86a20s_init2[] = { { 0x50, 0x51 }, { 0x51, 0x04 }, /* MER symbol 4 */ { 0x45, 0x04 }, /* CN symbol 4 */ { 0x48, 0x04 }, /* CN manual mode */ - + { 0x50, 0xd5 }, { 0x51, 0x01 }, { 0x50, 0xd6 }, { 0x51, 0x1f }, { 0x50, 0xd2 }, { 0x51, 0x03 }, - { 0x50, 0xd7 }, { 0x51, 0xbf }, - { 0x28, 0x74 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0xff }, - { 0x28, 0x46 }, { 0x29, 0x00 }, { 0x2a, 0x1a }, { 0x2b, 0x0c }, - - { 0x04, 0x40 }, { 0x05, 0x00 }, - { 0x28, 0x00 }, { 0x2b, 0x08 }, - { 0x28, 0x05 }, { 0x2b, 0x00 }, + { 0x50, 0xd7 }, { 0x51, 0x3f }, { 0x1c, 0x01 }, - { 0x28, 0x06 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x1f }, - { 0x28, 0x07 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x18 }, - { 0x28, 0x08 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x12 }, - { 0x28, 0x09 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x30 }, - { 0x28, 0x0a }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x37 }, - { 0x28, 0x0b }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x02 }, - { 0x28, 0x0c }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x09 }, - { 0x28, 0x0d }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x06 }, - { 0x28, 0x0e }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x7b }, - { 0x28, 0x0f }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x76 }, - { 0x28, 0x10 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x7d }, - { 0x28, 0x11 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x08 }, - { 0x28, 0x12 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0b }, - { 0x28, 0x13 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x00 }, - { 0x28, 0x14 }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0xf2 }, - { 0x28, 0x15 }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0xf3 }, - { 0x28, 0x16 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x05 }, - { 0x28, 0x17 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x16 }, - { 0x28, 0x18 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0f }, - { 0x28, 0x19 }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0xef }, - { 0x28, 0x1a }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0xd8 }, - { 0x28, 0x1b }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0xf1 }, - { 0x28, 0x1c }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x3d }, - { 0x28, 0x1d }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x94 }, - { 0x28, 0x1e }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0xba }, + { 0x28, 0x06 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x03 }, + { 0x28, 0x07 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0d }, + { 0x28, 0x08 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x02 }, + { 0x28, 0x09 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x01 }, + { 0x28, 0x0a }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x21 }, + { 0x28, 0x0b }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x29 }, + { 0x28, 0x0c }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x16 }, + { 0x28, 0x0d }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x31 }, + { 0x28, 0x0e }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0e }, + { 0x28, 0x0f }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x4e }, + { 0x28, 0x10 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x46 }, + { 0x28, 0x11 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0f }, + { 0x28, 0x12 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x56 }, + { 0x28, 0x13 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x35 }, + { 0x28, 0x14 }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0xbe }, + { 0x28, 0x15 }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0x84 }, + { 0x28, 0x16 }, { 0x29, 0x00 }, { 0x2a, 0x03 }, { 0x2b, 0xee }, + { 0x28, 0x17 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x98 }, + { 0x28, 0x18 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x9f }, + { 0x28, 0x19 }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0xb2 }, + { 0x28, 0x1a }, { 0x29, 0x00 }, { 0x2a, 0x06 }, { 0x2b, 0xc2 }, + { 0x28, 0x1b }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0x4a }, + { 0x28, 0x1c }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0xbc }, + { 0x28, 0x1d }, { 0x29, 0x00 }, { 0x2a, 0x04 }, { 0x2b, 0xba }, + { 0x28, 0x1e }, { 0x29, 0x00 }, { 0x2a, 0x06 }, { 0x2b, 0x14 }, { 0x50, 0x1e }, { 0x51, 0x5d }, { 0x50, 0x22 }, { 0x51, 0x00 }, { 0x50, 0x23 }, { 0x51, 0xc8 }, @@ -196,9 +190,7 @@ static struct regdata mb86a20s_init2[] = { { 0x50, 0x26 }, { 0x51, 0x00 }, { 0x50, 0x27 }, { 0x51, 0xc3 }, { 0x50, 0x39 }, { 0x51, 0x02 }, - { 0xec, 0x0f }, - { 0xeb, 0x1f }, - { 0x28, 0x6a }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x00 }, + { 0x50, 0xd5 }, { 0x51, 0x01 }, { 0xd0, 0x00 }, }; From 1871d718a9db649b70f0929d2778dc01bc49b286 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Sep 2016 09:56:33 -0300 Subject: [PATCH 264/591] [media] cx231xx: don't return error on success The cx231xx_set_agc_analog_digital_mux_select() callers expect it to return 0 or an error. Returning a positive value makes the first attempt to switch between analog/digital to fail. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-avcore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c b/drivers/media/usb/cx231xx/cx231xx-avcore.c index 491913778bcc..2f52d66b4dae 100644 --- a/drivers/media/usb/cx231xx/cx231xx-avcore.c +++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c @@ -1264,7 +1264,10 @@ int cx231xx_set_agc_analog_digital_mux_select(struct cx231xx *dev, dev->board.agc_analog_digital_select_gpio, analog_or_digital); - return status; + if (status < 0) + return status; + + return 0; } int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3) From 24b923f073ac37eb744f56a2c7f77107b8219ab2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Sep 2016 10:06:39 -0300 Subject: [PATCH 265/591] [media] cx231xx: fix GPIOs for Pixelview SBTVD hybrid This device uses GPIOs: 28 to switch between analog and digital modes: on digital mode, it should be set to 1. The code that sets it on analog mode is OK, but it misses the logic that sets it on digital mode. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-cards.c | 2 +- drivers/media/usb/cx231xx/cx231xx-core.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index c63248a18823..72c246bfaa1c 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -486,7 +486,7 @@ struct cx231xx_board cx231xx_boards[] = { .output_mode = OUT_MODE_VIP11, .demod_xfer_mode = 0, .ctl_pin_status_mask = 0xFFFFFFC4, - .agc_analog_digital_select_gpio = 0x00, /* According with PV cxPolaris.inf file */ + .agc_analog_digital_select_gpio = 0x1c, .tuner_sif_gpio = -1, .tuner_scl_gpio = -1, .tuner_sda_gpio = -1, diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index 7e4319172e46..97730cb2f591 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -712,6 +712,7 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode) break; case CX231XX_BOARD_CNXT_RDE_253S: case CX231XX_BOARD_CNXT_RDU_253S: + case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID: errCode = cx231xx_set_agc_analog_digital_mux_select(dev, 1); break; case CX231XX_BOARD_HAUPPAUGE_EXETER: @@ -738,7 +739,7 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode) case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID: case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL: case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC: - errCode = cx231xx_set_agc_analog_digital_mux_select(dev, 0); + errCode = cx231xx_set_agc_analog_digital_mux_select(dev, 0); break; default: break; From dc4af7821f4b74c06e536162d43614a95c51ffe5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Sep 2016 10:08:17 -0300 Subject: [PATCH 266/591] [media] cx231xx: prints error code if can't switch TV mode If something bad happens when switching between digital and analog mode, prints an error and outputs the returned code. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index 97730cb2f591..59b72264a0bf 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -746,7 +746,14 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode) } } - return errCode ? -EINVAL : 0; + if (errCode < 0) { + dev_err(dev->dev, "Failed to set devmode to %s: error: %i", + dev->mode == CX231XX_DIGITAL_MODE ? "digital" : "analog", + errCode); + return errCode; + } + + return 0; } EXPORT_SYMBOL_GPL(cx231xx_set_mode); From 7adc79980da0a227ecb778b949ed250463599d4d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Sep 2016 14:36:16 -0300 Subject: [PATCH 267/591] [media] cx231xx-core: fix GPIO comments The number of the cx231xx REQ for GPIO register set/get are wrong. They should follow what's there at cx231xx-pcb-cfg.h. Noticed while checking the cx231xx parser at the v4l-utils. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index 59b72264a0bf..a4f49a83f869 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1475,14 +1475,14 @@ int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val, /* set request */ if (!request) { if (direction) - ven_req.bRequest = VRT_GET_GPIO; /* 0x8 gpio */ + ven_req.bRequest = VRT_GET_GPIO; /* 0x9 gpio */ else - ven_req.bRequest = VRT_SET_GPIO; /* 0x9 gpio */ + ven_req.bRequest = VRT_SET_GPIO; /* 0x8 gpio */ } else { if (direction) - ven_req.bRequest = VRT_GET_GPIE; /* 0xa gpie */ + ven_req.bRequest = VRT_GET_GPIE; /* 0xb gpie */ else - ven_req.bRequest = VRT_SET_GPIE; /* 0xb gpie */ + ven_req.bRequest = VRT_SET_GPIE; /* 0xa gpie */ } /* set index value */ From 4001dfb4b54dc4b7e5e765f686766e3db88d175b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Sep 2016 05:41:53 -0300 Subject: [PATCH 268/591] [media] cx231xx-i2c: handle errors with cx231xx_get_i2c_adap() The cx231xx_get_i2c_adap() function should return the I2C adapter that will be used to talk with a device. It should never be NULL, as otherwise the driver will try to dereference a null pointer. We might instead fix the callers, but if this condition ever happens, it is really a driver bug, because i2c_port should always be a value from enum CX231XX_I2C_MASTER_PORT. Found when checking the code due to this bug: [ 39.769021] BUG: unable to handle kernel NULL pointer dereference at 0000000000000002 [ 39.769105] IP: [] i2c_master_send+0x13/0x70 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 473cd3433fe5..3e7982ef180a 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -608,7 +608,7 @@ struct i2c_adapter *cx231xx_get_i2c_adap(struct cx231xx *dev, int i2c_port) case I2C_1_MUX_3: return dev->muxc->adapter[1]; default: - return NULL; + BUG(); } } EXPORT_SYMBOL_GPL(cx231xx_get_i2c_adap); From 461af077d349b11106ca084e9ef2973a753d33ff Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Sep 2016 05:56:37 -0300 Subject: [PATCH 269/591] [media] cx231xx: can't proceed if I2C bus register fails The driver should not ignore errors while registering the I2C bus, as this device can't even minimally work without the buses, as it uses those buses internally to talk with the several IP blocks inside the chip. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-core.c | 28 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c index a4f49a83f869..8b099fe1d592 100644 --- a/drivers/media/usb/cx231xx/cx231xx-core.c +++ b/drivers/media/usb/cx231xx/cx231xx-core.c @@ -1324,15 +1324,29 @@ int cx231xx_dev_init(struct cx231xx *dev) dev->i2c_bus[2].i2c_reserve = 0; /* register I2C buses */ - cx231xx_i2c_register(&dev->i2c_bus[0]); - cx231xx_i2c_register(&dev->i2c_bus[1]); - cx231xx_i2c_register(&dev->i2c_bus[2]); - - errCode = cx231xx_i2c_mux_create(dev); + errCode = cx231xx_i2c_register(&dev->i2c_bus[0]); + if (errCode < 0) + return errCode; + errCode = cx231xx_i2c_register(&dev->i2c_bus[1]); + if (errCode < 0) + return errCode; + errCode = cx231xx_i2c_register(&dev->i2c_bus[2]); + if (errCode < 0) + return errCode; + + errCode = cx231xx_i2c_mux_create(dev); + if (errCode < 0) { + dev_err(dev->dev, + "%s: Failed to create I2C mux\n", __func__); + return errCode; + } + errCode = cx231xx_i2c_mux_register(dev, 0); + if (errCode < 0) + return errCode; + + errCode = cx231xx_i2c_mux_register(dev, 1); if (errCode < 0) return errCode; - cx231xx_i2c_mux_register(dev, 0); - cx231xx_i2c_mux_register(dev, 1); /* scan the real bus segments in the order of physical port numbers */ cx231xx_do_i2c_scan(dev, I2C_0); From 3c59bb4750659bf893e12fd9728a1ebbda930018 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Sep 2016 06:55:59 -0300 Subject: [PATCH 270/591] [media] cx231xx-cards: unregister IR earlier Without this patch, a bug is issued when the module is removed: [ 1417.425863] cx231xx 1-3.1.4:1.1: Cx231xx dvb Extension removed [ 1417.571923] BUG: unable to handle kernel paging request at ffffffffc081a024 [ 1417.571962] IP: [] string+0x24/0x80 [ 1417.571987] PGD 1c09067 PUD 1c0b067 PMD 88e653067 PTE 0 [ 1417.572013] Oops: 0000 [#1] SMP [ 1417.572026] Modules linked in: mb86a20s dvb_core cx231xx_alsa ir_kbd_i2c(-) tda18271 tea5767 tuner cx25840 cx231xx i2c_mux videobuf_vmalloc tveeprom cx2341x videobuf_core rc_core v4l2_common videodev media bnep usblp fuse xt_CHECKSUM iptable_mangle tun ebtable_filter ebtables ip6table_filter ip6_tables xt_physdev br_netfilter bridge nf_log_ipv4 nf_log_common xt_LOG xt_conntrack ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack cpufreq_stats vfat fat snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel snd_hda_intel snd_hda_codec kvm snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm irqbypass crct10dif_pclmul iTCO_wdt crc32_pclmul nfsd hci_uart iTCO_vendor_support [ 1417.572317] snd_timer ghash_clmulni_intel btbcm intel_cstate btqca snd intel_uncore btintel intel_rapl_perf mei_me bluetooth mei shpchp soundcore pcspkr i2c_i801 auth_rpcgss wmi acpi_als kfifo_buf nfs_acl industrialio rfkill lockd pinctrl_sunrisepoint pinctrl_intel tpm_tis tpm intel_lpss_acpi intel_lpss acpi_pad grace sunrpc binfmt_misc hid_logitech_hidpp hid_logitech_dj 8021q garp stp llc mrp i915 i2c_algo_bit drm_kms_helper drm e1000e sdhci_pci sdhci mmc_core crc32c_intel ptp pps_core video i2c_hid fjes analog gameport joydev [last unloaded: rc_pixelview_002t] [ 1417.572487] CPU: 4 PID: 24493 Comm: rmmod Tainted: G W 4.7.0+ #2 [ 1417.572504] Hardware name: /NUC6i7KYB, BIOS KYSKLi70.86A.0041.2016.0817.1130 08/17/2016 [ 1417.572526] task: ffff880894b81e80 ti: ffff880896bdc000 task.ti: ffff880896bdc000 [ 1417.572544] RIP: 0010:[] [] string+0x24/0x80 [ 1417.572564] RSP: 0018:ffff880896bdfbe8 EFLAGS: 00010286 [ 1417.572577] RAX: ffffffffc081a025 RBX: ffff8808935aa15c RCX: ffff0a00ffffff04 [ 1417.572594] RDX: ffffffffc081a024 RSI: ffffffffffffffff RDI: ffff8808935aa15c [ 1417.572610] RBP: ffff880896bdfbe8 R08: fffffffffffffffe R09: ffff8808935aa91c [ 1417.572628] R10: ffffffffc07b85d6 R11: 0000000000000000 R12: ffff8808935aa91c [ 1417.572644] R13: 00000000000007c5 R14: ffffffffc07b85dd R15: ffffffffc07b85dd [ 1417.572662] FS: 00007f5a5392d700(0000) GS:ffff8808bed00000(0000) knlGS:0000000000000000 [ 1417.572681] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1417.572705] CR2: ffffffffc081a024 CR3: 0000000897188000 CR4: 00000000003406e0 [ 1417.572735] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1417.572761] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1417.572778] Stack: [ 1417.572785] ffff880896bdfc48 ffffffff813dcf77 0000000000000005 ffff8808935aa157 [ 1417.572806] ffff880896bdfc58 ffff0a00ffffff04 000000009d27375e ffff8808935aa000 [ 1417.572829] 0000000000000800 ffff880896182800 0000000000000000 ffff88089e898ae0 [ 1417.572850] Call Trace: [ 1417.572860] [] vsnprintf+0x2d7/0x500 [ 1417.572873] [] add_uevent_var+0x82/0x120 [ 1417.572890] [] rc_dev_uevent+0x2d/0x60 [rc_core] [ 1417.572907] [] dev_uevent+0xd9/0x2d0 [ 1417.572921] [] kobject_uevent_env+0x2d9/0x4f0 [ 1417.572938] [] kobject_uevent+0xb/0x10 [ 1417.572954] [] device_del+0x18f/0x260 [ 1417.572974] [] ? kobject_put+0x27/0x50 [ 1417.572998] [] rc_unregister_device+0x75/0xb0 [rc_core] [ 1417.573028] [] ir_remove+0x23/0x30 [ir_kbd_i2c] [ 1417.573055] [] i2c_device_remove+0x58/0xb0 [ 1417.573078] [] __device_release_driver+0xa1/0x160 [ 1417.573102] [] driver_detach+0xa6/0xb0 [ 1417.573122] [] bus_remove_driver+0x55/0xd0 [ 1417.573146] [] driver_unregister+0x2c/0x50 [ 1417.573168] [] i2c_del_driver+0x22/0x50 [ 1417.573194] [] ir_kbd_driver_exit+0x10/0x46c [ir_kbd_i2c] [ 1417.573227] [] SyS_delete_module+0x1b8/0x220 [ 1417.573254] [] entry_SYSCALL_64_fastpath+0x1a/0xa4 [ 1417.573279] Code: eb e9 76 ff ff ff 90 55 49 89 f1 48 89 ce 48 c1 fe 30 48 81 fa ff 0f 00 00 48 89 e5 4c 8d 46 ff 76 40 48 85 f6 74 4e 48 8d 42 01 <0f> b6 12 84 d2 74 43 49 01 c0 31 f6 eb 0c 48 83 c0 01 0f b6 50 [ 1417.573437] RIP [] string+0x24/0x80 [ 1417.573455] RSP [ 1417.573465] CR2: ffffffffc081a024 [ 1417.580053] ---[ end trace 4ca9e2eced326a62 ]--- Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-cards.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 72c246bfaa1c..36bc25494319 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -1186,12 +1186,12 @@ static void cx231xx_unregister_media_device(struct cx231xx *dev) */ void cx231xx_release_resources(struct cx231xx *dev) { + cx231xx_ir_exit(dev); + cx231xx_release_analog_resources(dev); cx231xx_remove_from_devlist(dev); - cx231xx_ir_exit(dev); - /* Release I2C buses */ cx231xx_dev_uninit(dev); From 073fe63513edfc7f072fa35c6fd23c919d1b8a03 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sat, 13 Dec 2014 18:53:37 -0200 Subject: [PATCH 271/591] [media] smiapp: Unify enforced and need-based 8-bit read Unify enforced 8-bit read access with that based on actual need. Signed-off-by: Sakari Ailus Reviewed-by: Sebastian Reichel Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/smiapp/smiapp-regs.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-regs.c b/drivers/media/i2c/smiapp/smiapp-regs.c index 6b6c20b61397..1e501c06d18c 100644 --- a/drivers/media/i2c/smiapp/smiapp-regs.c +++ b/drivers/media/i2c/smiapp/smiapp-regs.c @@ -188,7 +188,8 @@ int smiapp_read_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val) SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY)); } -int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val) +static int smiapp_read_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val, + bool force8) { int rval; @@ -199,21 +200,20 @@ int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val) if (rval < 0) return rval; + if (force8) + return __smiapp_read(sensor, reg, val, true); + return smiapp_read_no_quirk(sensor, reg, val); } +int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val) +{ + return smiapp_read_quirk(sensor, reg, val, false); +} + int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val) { - int rval; - - *val = 0; - rval = smiapp_call_quirk(sensor, reg_access, false, ®, val); - if (rval == -ENOIOCTLCMD) - return 0; - if (rval < 0) - return rval; - - return __smiapp_read(sensor, reg, val, true); + return smiapp_read_quirk(sensor, reg, val, true); } int smiapp_write_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val) From 697a521fbc6dd6f64489d0feeb09631b227fcd67 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Thu, 11 Aug 2016 07:43:50 -0300 Subject: [PATCH 272/591] [media] smiapp: Rename smiapp_platform_data as smiapp_hwconfig This is really configuration to the driver originating from DT or elsewhere. Do not call it platform data. Signed-off-by: Sakari Ailus Reviewed-by: Sebastian Reichel Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/smiapp/smiapp-core.c | 140 ++++++++++++------------ drivers/media/i2c/smiapp/smiapp-quirk.c | 4 +- drivers/media/i2c/smiapp/smiapp.h | 2 +- include/media/i2c/smiapp.h | 2 +- 4 files changed, 74 insertions(+), 74 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index d08ab6c8357c..92a6859b45ab 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -625,12 +625,12 @@ static int smiapp_init_late_controls(struct smiapp_sensor *sensor) 0, max_value, 1, max_value); } - for (max = 0; sensor->platform_data->op_sys_clock[max + 1]; max++); + for (max = 0; sensor->hwcfg->op_sys_clock[max + 1]; max++); sensor->link_freq = v4l2_ctrl_new_int_menu( &sensor->src->ctrl_handler, &smiapp_ctrl_ops, V4L2_CID_LINK_FREQ, __fls(*valid_link_freqs), - __ffs(*valid_link_freqs), sensor->platform_data->op_sys_clock); + __ffs(*valid_link_freqs), sensor->hwcfg->op_sys_clock); return sensor->src->ctrl_handler.error; } @@ -833,8 +833,8 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) pll->bits_per_pixel = f->compressed; - for (j = 0; sensor->platform_data->op_sys_clock[j]; j++) { - pll->link_freq = sensor->platform_data->op_sys_clock[j]; + for (j = 0; sensor->hwcfg->op_sys_clock[j]; j++) { + pll->link_freq = sensor->hwcfg->op_sys_clock[j]; rval = smiapp_pll_try(sensor, pll); dev_dbg(&client->dev, "link freq %u Hz, bpp %u %s\n", @@ -1032,22 +1032,22 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor) int rval; u32 val; - client->addr = sensor->platform_data->i2c_addr_dfl; + client->addr = sensor->hwcfg->i2c_addr_dfl; rval = smiapp_write(sensor, SMIAPP_REG_U8_CCI_ADDRESS_CONTROL, - sensor->platform_data->i2c_addr_alt << 1); + sensor->hwcfg->i2c_addr_alt << 1); if (rval) return rval; - client->addr = sensor->platform_data->i2c_addr_alt; + client->addr = sensor->hwcfg->i2c_addr_alt; /* verify addr change went ok */ rval = smiapp_read(sensor, SMIAPP_REG_U8_CCI_ADDRESS_CONTROL, &val); if (rval) return rval; - if (val != sensor->platform_data->i2c_addr_alt << 1) + if (val != sensor->hwcfg->i2c_addr_alt << 1) return -ENODEV; return 0; @@ -1061,13 +1061,13 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor) static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor) { struct smiapp_flash_strobe_parms *strobe_setup; - unsigned int ext_freq = sensor->platform_data->ext_clk; + unsigned int ext_freq = sensor->hwcfg->ext_clk; u32 tmp; u32 strobe_adjustment; u32 strobe_width_high_rs; int rval; - strobe_setup = sensor->platform_data->strobe_setup; + strobe_setup = sensor->hwcfg->strobe_setup; /* * How to calculate registers related to strobe length. Please @@ -1179,7 +1179,7 @@ static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor) strobe_setup->trigger); out: - sensor->platform_data->strobe_setup->trigger = 0; + sensor->hwcfg->strobe_setup->trigger = 0; return rval; } @@ -1201,9 +1201,9 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) } usleep_range(1000, 1000); - if (sensor->platform_data->set_xclk) - rval = sensor->platform_data->set_xclk( - &sensor->src->sd, sensor->platform_data->ext_clk); + if (sensor->hwcfg->set_xclk) + rval = sensor->hwcfg->set_xclk( + &sensor->src->sd, sensor->hwcfg->ext_clk); else rval = clk_prepare_enable(sensor->ext_clk); if (rval < 0) { @@ -1212,10 +1212,10 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) } usleep_range(1000, 1000); - if (gpio_is_valid(sensor->platform_data->xshutdown)) - gpio_set_value(sensor->platform_data->xshutdown, 1); + if (gpio_is_valid(sensor->hwcfg->xshutdown)) + gpio_set_value(sensor->hwcfg->xshutdown, 1); - sleep = SMIAPP_RESET_DELAY(sensor->platform_data->ext_clk); + sleep = SMIAPP_RESET_DELAY(sensor->hwcfg->ext_clk); usleep_range(sleep, sleep); /* @@ -1229,7 +1229,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) * is found. */ - if (sensor->platform_data->i2c_addr_alt) { + if (sensor->hwcfg->i2c_addr_alt) { rval = smiapp_change_cci_addr(sensor); if (rval) { dev_err(&client->dev, "cci address change error\n"); @@ -1244,7 +1244,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) goto out_cci_addr_fail; } - if (sensor->platform_data->i2c_addr_alt) { + if (sensor->hwcfg->i2c_addr_alt) { rval = smiapp_change_cci_addr(sensor); if (rval) { dev_err(&client->dev, "cci address change error\n"); @@ -1261,14 +1261,14 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) rval = smiapp_write( sensor, SMIAPP_REG_U16_EXTCLK_FREQUENCY_MHZ, - sensor->platform_data->ext_clk / (1000000 / (1 << 8))); + sensor->hwcfg->ext_clk / (1000000 / (1 << 8))); if (rval) { dev_err(&client->dev, "extclk frequency set failed\n"); goto out_cci_addr_fail; } rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_LANE_MODE, - sensor->platform_data->lanes - 1); + sensor->hwcfg->lanes - 1); if (rval) { dev_err(&client->dev, "csi lane mode set failed\n"); goto out_cci_addr_fail; @@ -1282,7 +1282,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) } rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_SIGNALLING_MODE, - sensor->platform_data->csi_signalling_mode); + sensor->hwcfg->csi_signalling_mode); if (rval) { dev_err(&client->dev, "csi signalling mode set failed\n"); goto out_cci_addr_fail; @@ -1322,10 +1322,10 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) return 0; out_cci_addr_fail: - if (gpio_is_valid(sensor->platform_data->xshutdown)) - gpio_set_value(sensor->platform_data->xshutdown, 0); - if (sensor->platform_data->set_xclk) - sensor->platform_data->set_xclk(&sensor->src->sd, 0); + if (gpio_is_valid(sensor->hwcfg->xshutdown)) + gpio_set_value(sensor->hwcfg->xshutdown, 0); + if (sensor->hwcfg->set_xclk) + sensor->hwcfg->set_xclk(&sensor->src->sd, 0); else clk_disable_unprepare(sensor->ext_clk); @@ -1343,15 +1343,15 @@ static void smiapp_power_off(struct smiapp_sensor *sensor) * really see a power off and next time the cci address change * will fail. So do a soft reset explicitly here. */ - if (sensor->platform_data->i2c_addr_alt) + if (sensor->hwcfg->i2c_addr_alt) smiapp_write(sensor, SMIAPP_REG_U8_SOFTWARE_RESET, SMIAPP_SOFTWARE_RESET); - if (gpio_is_valid(sensor->platform_data->xshutdown)) - gpio_set_value(sensor->platform_data->xshutdown, 0); - if (sensor->platform_data->set_xclk) - sensor->platform_data->set_xclk(&sensor->src->sd, 0); + if (gpio_is_valid(sensor->hwcfg->xshutdown)) + gpio_set_value(sensor->hwcfg->xshutdown, 0); + if (sensor->hwcfg->set_xclk) + sensor->hwcfg->set_xclk(&sensor->src->sd, 0); else clk_disable_unprepare(sensor->ext_clk); usleep_range(5000, 5000); @@ -1491,8 +1491,8 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor) if ((sensor->limits[SMIAPP_LIMIT_FLASH_MODE_CAPABILITY] & (SMIAPP_FLASH_MODE_CAPABILITY_SINGLE_STROBE | SMIAPP_FLASH_MODE_CAPABILITY_MULTIPLE_STROBE)) && - sensor->platform_data->strobe_setup != NULL && - sensor->platform_data->strobe_setup->trigger != 0) { + sensor->hwcfg->strobe_setup != NULL && + sensor->hwcfg->strobe_setup->trigger != 0) { rval = smiapp_setup_flash_strobe(sensor); if (rval) goto out; @@ -2309,7 +2309,7 @@ smiapp_sysfs_nvm_read(struct device *dev, struct device_attribute *attr, if (!sensor->nvm_size) { /* NVM not read yet - read it now */ - sensor->nvm_size = sensor->platform_data->nvm_size; + sensor->nvm_size = sensor->hwcfg->nvm_size; if (smiapp_set_power(subdev, 1) < 0) return -ENODEV; if (smiapp_read_nvm(sensor, sensor->nvm)) { @@ -2554,7 +2554,7 @@ static int smiapp_init(struct smiapp_sensor *sensor) return PTR_ERR(sensor->vana); } - if (!sensor->platform_data->set_xclk) { + if (!sensor->hwcfg->set_xclk) { sensor->ext_clk = devm_clk_get(&client->dev, NULL); if (IS_ERR(sensor->ext_clk)) { dev_err(&client->dev, "could not get clock\n"); @@ -2562,23 +2562,23 @@ static int smiapp_init(struct smiapp_sensor *sensor) } rval = clk_set_rate(sensor->ext_clk, - sensor->platform_data->ext_clk); + sensor->hwcfg->ext_clk); if (rval < 0) { dev_err(&client->dev, "unable to set clock freq to %u\n", - sensor->platform_data->ext_clk); + sensor->hwcfg->ext_clk); return rval; } } - if (gpio_is_valid(sensor->platform_data->xshutdown)) { + if (gpio_is_valid(sensor->hwcfg->xshutdown)) { rval = devm_gpio_request_one( - &client->dev, sensor->platform_data->xshutdown, 0, + &client->dev, sensor->hwcfg->xshutdown, 0, "SMIA++ xshutdown"); if (rval < 0) { dev_err(&client->dev, "unable to acquire reset gpio %d\n", - sensor->platform_data->xshutdown); + sensor->hwcfg->xshutdown); return rval; } } @@ -2612,7 +2612,7 @@ static int smiapp_init(struct smiapp_sensor *sensor) * * Rotation also changes the bayer pattern. */ - if (sensor->platform_data->module_board_orient == + if (sensor->hwcfg->module_board_orient == SMIAPP_MODULE_BOARD_ORIENT_180) sensor->hvflip_inv_mask = SMIAPP_IMAGE_ORIENTATION_HFLIP | SMIAPP_IMAGE_ORIENTATION_VFLIP; @@ -2661,9 +2661,9 @@ static int smiapp_init(struct smiapp_sensor *sensor) /* SMIA++ NVM initialization - it will be read from the sensor * when it is first requested by userspace. */ - if (sensor->minfo.smiapp_version && sensor->platform_data->nvm_size) { + if (sensor->minfo.smiapp_version && sensor->hwcfg->nvm_size) { sensor->nvm = devm_kzalloc(&client->dev, - sensor->platform_data->nvm_size, GFP_KERNEL); + sensor->hwcfg->nvm_size, GFP_KERNEL); if (sensor->nvm == NULL) { dev_err(&client->dev, "nvm buf allocation failed\n"); rval = -ENOMEM; @@ -2706,8 +2706,8 @@ static int smiapp_init(struct smiapp_sensor *sensor) /* prepare PLL configuration input values */ pll->bus_type = SMIAPP_PLL_BUS_TYPE_CSI2; - pll->csi2.lanes = sensor->platform_data->lanes; - pll->ext_clk_freq_hz = sensor->platform_data->ext_clk; + pll->csi2.lanes = sensor->hwcfg->lanes; + pll->ext_clk_freq_hz = sensor->hwcfg->ext_clk; pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN]; /* Profile 0 sensors have no separate OP clock branch. */ if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0) @@ -2984,9 +2984,9 @@ static int smiapp_resume(struct device *dev) #endif /* CONFIG_PM */ -static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev) +static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev) { - struct smiapp_platform_data *pdata; + struct smiapp_hwconfig *hwcfg; struct v4l2_of_endpoint *bus_cfg; struct device_node *ep; int i; @@ -3003,58 +3003,58 @@ static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev) if (IS_ERR(bus_cfg)) goto out_err; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) + hwcfg = devm_kzalloc(dev, sizeof(*hwcfg), GFP_KERNEL); + if (!hwcfg) goto out_err; switch (bus_cfg->bus_type) { case V4L2_MBUS_CSI2: - pdata->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2; + hwcfg->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2; break; /* FIXME: add CCP2 support. */ default: goto out_err; } - pdata->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes; - dev_dbg(dev, "lanes %u\n", pdata->lanes); + hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes; + dev_dbg(dev, "lanes %u\n", hwcfg->lanes); /* xshutdown GPIO is optional */ - pdata->xshutdown = of_get_named_gpio(dev->of_node, "reset-gpios", 0); + hwcfg->xshutdown = of_get_named_gpio(dev->of_node, "reset-gpios", 0); /* NVM size is not mandatory */ of_property_read_u32(dev->of_node, "nokia,nvm-size", - &pdata->nvm_size); + &hwcfg->nvm_size); rval = of_property_read_u32(dev->of_node, "clock-frequency", - &pdata->ext_clk); + &hwcfg->ext_clk); if (rval) { dev_warn(dev, "can't get clock-frequency\n"); goto out_err; } - dev_dbg(dev, "reset %d, nvm %d, clk %d, csi %d\n", pdata->xshutdown, - pdata->nvm_size, pdata->ext_clk, pdata->csi_signalling_mode); + dev_dbg(dev, "reset %d, nvm %d, clk %d, csi %d\n", hwcfg->xshutdown, + hwcfg->nvm_size, hwcfg->ext_clk, hwcfg->csi_signalling_mode); if (!bus_cfg->nr_of_link_frequencies) { dev_warn(dev, "no link frequencies defined\n"); goto out_err; } - pdata->op_sys_clock = devm_kcalloc( + hwcfg->op_sys_clock = devm_kcalloc( dev, bus_cfg->nr_of_link_frequencies + 1 /* guardian */, - sizeof(*pdata->op_sys_clock), GFP_KERNEL); - if (!pdata->op_sys_clock) + sizeof(*hwcfg->op_sys_clock), GFP_KERNEL); + if (!hwcfg->op_sys_clock) goto out_err; for (i = 0; i < bus_cfg->nr_of_link_frequencies; i++) { - pdata->op_sys_clock[i] = bus_cfg->link_frequencies[i]; - dev_dbg(dev, "freq %d: %lld\n", i, pdata->op_sys_clock[i]); + hwcfg->op_sys_clock[i] = bus_cfg->link_frequencies[i]; + dev_dbg(dev, "freq %d: %lld\n", i, hwcfg->op_sys_clock[i]); } v4l2_of_free_endpoint(bus_cfg); of_node_put(ep); - return pdata; + return hwcfg; out_err: v4l2_of_free_endpoint(bus_cfg); @@ -3066,17 +3066,17 @@ static int smiapp_probe(struct i2c_client *client, const struct i2c_device_id *devid) { struct smiapp_sensor *sensor; - struct smiapp_platform_data *pdata = smiapp_get_pdata(&client->dev); + struct smiapp_hwconfig *hwcfg = smiapp_get_hwconfig(&client->dev); int rval; - if (pdata == NULL) + if (hwcfg == NULL) return -ENODEV; sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); if (sensor == NULL) return -ENOMEM; - sensor->platform_data = pdata; + sensor->hwcfg = hwcfg; mutex_init(&sensor->mutex); mutex_init(&sensor->power_mutex); sensor->src = &sensor->ssds[sensor->ssds_used]; @@ -3119,10 +3119,10 @@ static int smiapp_remove(struct i2c_client *client) v4l2_async_unregister_subdev(subdev); if (sensor->power_count) { - if (gpio_is_valid(sensor->platform_data->xshutdown)) - gpio_set_value(sensor->platform_data->xshutdown, 0); - if (sensor->platform_data->set_xclk) - sensor->platform_data->set_xclk(&sensor->src->sd, 0); + if (gpio_is_valid(sensor->hwcfg->xshutdown)) + gpio_set_value(sensor->hwcfg->xshutdown, 0); + if (sensor->hwcfg->set_xclk) + sensor->hwcfg->set_xclk(&sensor->src->sd, 0); else clk_disable_unprepare(sensor->ext_clk); sensor->power_count = 0; diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.c b/drivers/media/i2c/smiapp/smiapp-quirk.c index abf9ea7a0fb7..d7e22bc9812e 100644 --- a/drivers/media/i2c/smiapp/smiapp-quirk.c +++ b/drivers/media/i2c/smiapp/smiapp-quirk.c @@ -178,13 +178,13 @@ static int jt8ev1_post_poweron(struct smiapp_sensor *sensor) if (rval < 0) return rval; - switch (sensor->platform_data->ext_clk) { + switch (sensor->hwcfg->ext_clk) { case 9600000: return smiapp_write_8s(sensor, regs_96, ARRAY_SIZE(regs_96)); default: dev_warn(&client->dev, "no MSRs for %d Hz ext_clk\n", - sensor->platform_data->ext_clk); + sensor->hwcfg->ext_clk); return 0; } } diff --git a/drivers/media/i2c/smiapp/smiapp.h b/drivers/media/i2c/smiapp/smiapp.h index 2174f89a00db..6ff095ae5faf 100644 --- a/drivers/media/i2c/smiapp/smiapp.h +++ b/drivers/media/i2c/smiapp/smiapp.h @@ -197,7 +197,7 @@ struct smiapp_sensor { struct smiapp_subdev *binner; struct smiapp_subdev *scaler; struct smiapp_subdev *pixel_array; - struct smiapp_platform_data *platform_data; + struct smiapp_hwconfig *hwcfg; struct regulator *vana; struct clk *ext_clk; u32 limits[SMIAPP_LIMIT_LAST]; diff --git a/include/media/i2c/smiapp.h b/include/media/i2c/smiapp.h index 029142ddb95c..a4a1b510c9d3 100644 --- a/include/media/i2c/smiapp.h +++ b/include/media/i2c/smiapp.h @@ -57,7 +57,7 @@ struct smiapp_flash_strobe_parms { u8 trigger; }; -struct smiapp_platform_data { +struct smiapp_hwconfig { /* * Change the cci address if i2c_addr_alt is set. * Both default and alternate cci addr need to be present From 51d2d72b669dab689f18923ec2aba24bc3ccc161 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Mon, 29 Aug 2016 17:28:25 -0300 Subject: [PATCH 273/591] [media] smiapp: Return -EPROBE_DEFER if the clock cannot be obtained The clock may be provided by a driver which is yet to probe. Print the actual error code as well. Signed-off-by: Sakari Ailus Reviewed-by: Sebastian Reichel Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/smiapp/smiapp-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 92a6859b45ab..103e33583f68 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -2557,8 +2557,9 @@ static int smiapp_init(struct smiapp_sensor *sensor) if (!sensor->hwcfg->set_xclk) { sensor->ext_clk = devm_clk_get(&client->dev, NULL); if (IS_ERR(sensor->ext_clk)) { - dev_err(&client->dev, "could not get clock\n"); - return PTR_ERR(sensor->ext_clk); + dev_err(&client->dev, "could not get clock (%ld)\n", + PTR_ERR(sensor->ext_clk)); + return -EPROBE_DEFER; } rval = clk_set_rate(sensor->ext_clk, From 7374300191c862a785dbf4c5f3d7b52ee00c7b45 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sat, 13 Aug 2016 12:49:17 -0300 Subject: [PATCH 274/591] [media] smiapp: Constify the regs argument to smiapp_write_8s() The data may now be const as well. Signed-off-by: Sakari Ailus Reviewed-by: Sebastian Reichel Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/smiapp/smiapp-quirk.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-quirk.c b/drivers/media/i2c/smiapp/smiapp-quirk.c index d7e22bc9812e..cb128eae9c54 100644 --- a/drivers/media/i2c/smiapp/smiapp-quirk.c +++ b/drivers/media/i2c/smiapp/smiapp-quirk.c @@ -26,7 +26,7 @@ static int smiapp_write_8(struct smiapp_sensor *sensor, u16 reg, u8 val) } static int smiapp_write_8s(struct smiapp_sensor *sensor, - struct smiapp_reg_8 *regs, int len) + const struct smiapp_reg_8 *regs, int len) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; @@ -71,7 +71,7 @@ static int jt8ew9_limits(struct smiapp_sensor *sensor) static int jt8ew9_post_poweron(struct smiapp_sensor *sensor) { - struct smiapp_reg_8 regs[] = { + const struct smiapp_reg_8 regs[] = { { 0x30a3, 0xd8 }, /* Output port control : LVDS ports only */ { 0x30ae, 0x00 }, /* 0x0307 pll_multiplier maximum value on PLL input 9.6MHz ( 19.2MHz is divided on pre_pll_div) */ { 0x30af, 0xd0 }, /* 0x0307 pll_multiplier maximum value on PLL input 9.6MHz ( 19.2MHz is divided on pre_pll_div) */ @@ -115,7 +115,7 @@ const struct smiapp_quirk smiapp_jt8ew9_quirk = { static int imx125es_post_poweron(struct smiapp_sensor *sensor) { /* Taken from v02. No idea what the other two are. */ - struct smiapp_reg_8 regs[] = { + const struct smiapp_reg_8 regs[] = { /* * 0x3302: clk during frame blanking: * 0x00 - HS mode, 0x01 - LP11 @@ -145,8 +145,7 @@ static int jt8ev1_post_poweron(struct smiapp_sensor *sensor) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; - - struct smiapp_reg_8 regs[] = { + const struct smiapp_reg_8 regs[] = { { 0x3031, 0xcd }, /* For digital binning (EQ_MONI) */ { 0x30a3, 0xd0 }, /* FLASH STROBE enable */ { 0x3237, 0x00 }, /* For control of pulse timing for ADC */ @@ -167,8 +166,7 @@ static int jt8ev1_post_poweron(struct smiapp_sensor *sensor) { 0x33cf, 0xec }, /* For Black sun */ { 0x3328, 0x80 }, /* Ugh. No idea what's this. */ }; - - struct smiapp_reg_8 regs_96[] = { + const struct smiapp_reg_8 regs_96[] = { { 0x30ae, 0x00 }, /* For control of ADC clock */ { 0x30af, 0xd0 }, { 0x30b0, 0x01 }, From 567716c5817cbcc482f70724d7f98aa6702c6e4c Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sat, 13 Aug 2016 12:46:50 -0300 Subject: [PATCH 275/591] [media] smiapp: Switch to gpiod API for GPIO control Switch from the old gpio API to the new descriptor based gpiod API. Signed-off-by: Sakari Ailus Reviewed-by: Sebastian Reichel Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/smiapp/smiapp-core.c | 36 ++++++++------------------ drivers/media/i2c/smiapp/smiapp.h | 1 + include/media/i2c/smiapp.h | 3 --- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 103e33583f68..061f44a611c1 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -24,8 +24,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -1212,8 +1212,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) } usleep_range(1000, 1000); - if (gpio_is_valid(sensor->hwcfg->xshutdown)) - gpio_set_value(sensor->hwcfg->xshutdown, 1); + gpiod_set_value(sensor->xshutdown, 1); sleep = SMIAPP_RESET_DELAY(sensor->hwcfg->ext_clk); usleep_range(sleep, sleep); @@ -1322,8 +1321,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) return 0; out_cci_addr_fail: - if (gpio_is_valid(sensor->hwcfg->xshutdown)) - gpio_set_value(sensor->hwcfg->xshutdown, 0); + gpiod_set_value(sensor->xshutdown, 0); if (sensor->hwcfg->set_xclk) sensor->hwcfg->set_xclk(&sensor->src->sd, 0); else @@ -1348,8 +1346,7 @@ static void smiapp_power_off(struct smiapp_sensor *sensor) SMIAPP_REG_U8_SOFTWARE_RESET, SMIAPP_SOFTWARE_RESET); - if (gpio_is_valid(sensor->hwcfg->xshutdown)) - gpio_set_value(sensor->hwcfg->xshutdown, 0); + gpiod_set_value(sensor->xshutdown, 0); if (sensor->hwcfg->set_xclk) sensor->hwcfg->set_xclk(&sensor->src->sd, 0); else @@ -2572,17 +2569,10 @@ static int smiapp_init(struct smiapp_sensor *sensor) } } - if (gpio_is_valid(sensor->hwcfg->xshutdown)) { - rval = devm_gpio_request_one( - &client->dev, sensor->hwcfg->xshutdown, 0, - "SMIA++ xshutdown"); - if (rval < 0) { - dev_err(&client->dev, - "unable to acquire reset gpio %d\n", - sensor->hwcfg->xshutdown); - return rval; - } - } + sensor->xshutdown = devm_gpiod_get_optional(&client->dev, "xshutdown", + GPIOD_OUT_LOW); + if (IS_ERR(sensor->xshutdown)) + return PTR_ERR(sensor->xshutdown); rval = smiapp_power_on(sensor); if (rval) @@ -3020,9 +3010,6 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev) hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes; dev_dbg(dev, "lanes %u\n", hwcfg->lanes); - /* xshutdown GPIO is optional */ - hwcfg->xshutdown = of_get_named_gpio(dev->of_node, "reset-gpios", 0); - /* NVM size is not mandatory */ of_property_read_u32(dev->of_node, "nokia,nvm-size", &hwcfg->nvm_size); @@ -3034,8 +3021,8 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev) goto out_err; } - dev_dbg(dev, "reset %d, nvm %d, clk %d, csi %d\n", hwcfg->xshutdown, - hwcfg->nvm_size, hwcfg->ext_clk, hwcfg->csi_signalling_mode); + dev_dbg(dev, "nvm %d, clk %d, csi %d\n", hwcfg->nvm_size, + hwcfg->ext_clk, hwcfg->csi_signalling_mode); if (!bus_cfg->nr_of_link_frequencies) { dev_warn(dev, "no link frequencies defined\n"); @@ -3120,8 +3107,7 @@ static int smiapp_remove(struct i2c_client *client) v4l2_async_unregister_subdev(subdev); if (sensor->power_count) { - if (gpio_is_valid(sensor->hwcfg->xshutdown)) - gpio_set_value(sensor->hwcfg->xshutdown, 0); + gpiod_set_value(sensor->xshutdown, 0); if (sensor->hwcfg->set_xclk) sensor->hwcfg->set_xclk(&sensor->src->sd, 0); else diff --git a/drivers/media/i2c/smiapp/smiapp.h b/drivers/media/i2c/smiapp/smiapp.h index 6ff095ae5faf..c504bd8f36b8 100644 --- a/drivers/media/i2c/smiapp/smiapp.h +++ b/drivers/media/i2c/smiapp/smiapp.h @@ -200,6 +200,7 @@ struct smiapp_sensor { struct smiapp_hwconfig *hwcfg; struct regulator *vana; struct clk *ext_clk; + struct gpio_desc *xshutdown; u32 limits[SMIAPP_LIMIT_LAST]; u8 nbinning_subtypes; struct smiapp_binning_subtype binning_subtypes[SMIAPP_BINNING_SUBTYPES]; diff --git a/include/media/i2c/smiapp.h b/include/media/i2c/smiapp.h index a4a1b510c9d3..eacc3f4e3deb 100644 --- a/include/media/i2c/smiapp.h +++ b/include/media/i2c/smiapp.h @@ -36,8 +36,6 @@ #define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE 1 #define SMIAPP_CSI_SIGNALLING_MODE_CSI2 2 -#define SMIAPP_NO_XSHUTDOWN -1 - /* * Sometimes due to board layout considerations the camera module can be * mounted rotated. The typical rotation used is 180 degrees which can be @@ -77,7 +75,6 @@ struct smiapp_hwconfig { struct smiapp_flash_strobe_parms *strobe_setup; int (*set_xclk)(struct v4l2_subdev *sd, int hz); - int32_t xshutdown; /* gpio or SMIAPP_NO_XSHUTDOWN */ }; #endif /* __SMIAPP_H_ */ From e62c30e76829d46bf11d170fd81b735f13a014ac Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Wed, 31 Aug 2016 09:38:54 -0300 Subject: [PATCH 276/591] [media] smiapp: Remove set_xclk() callback from hwconfig The clock framework is generally so well supported that there's no reason to keep this one around. Signed-off-by: Sakari Ailus Reviewed-by: Sebastian Reichel Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/smiapp/smiapp-core.c | 49 +++++++++----------------- include/media/i2c/smiapp.h | 2 -- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 061f44a611c1..d8b78c678f77 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -1201,11 +1201,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) } usleep_range(1000, 1000); - if (sensor->hwcfg->set_xclk) - rval = sensor->hwcfg->set_xclk( - &sensor->src->sd, sensor->hwcfg->ext_clk); - else - rval = clk_prepare_enable(sensor->ext_clk); + rval = clk_prepare_enable(sensor->ext_clk); if (rval < 0) { dev_dbg(&client->dev, "failed to enable xclk\n"); goto out_xclk_fail; @@ -1322,10 +1318,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) out_cci_addr_fail: gpiod_set_value(sensor->xshutdown, 0); - if (sensor->hwcfg->set_xclk) - sensor->hwcfg->set_xclk(&sensor->src->sd, 0); - else - clk_disable_unprepare(sensor->ext_clk); + clk_disable_unprepare(sensor->ext_clk); out_xclk_fail: regulator_disable(sensor->vana); @@ -1347,10 +1340,7 @@ static void smiapp_power_off(struct smiapp_sensor *sensor) SMIAPP_SOFTWARE_RESET); gpiod_set_value(sensor->xshutdown, 0); - if (sensor->hwcfg->set_xclk) - sensor->hwcfg->set_xclk(&sensor->src->sd, 0); - else - clk_disable_unprepare(sensor->ext_clk); + clk_disable_unprepare(sensor->ext_clk); usleep_range(5000, 5000); regulator_disable(sensor->vana); sensor->streaming = false; @@ -2551,22 +2541,20 @@ static int smiapp_init(struct smiapp_sensor *sensor) return PTR_ERR(sensor->vana); } - if (!sensor->hwcfg->set_xclk) { - sensor->ext_clk = devm_clk_get(&client->dev, NULL); - if (IS_ERR(sensor->ext_clk)) { - dev_err(&client->dev, "could not get clock (%ld)\n", - PTR_ERR(sensor->ext_clk)); - return -EPROBE_DEFER; - } + sensor->ext_clk = devm_clk_get(&client->dev, NULL); + if (IS_ERR(sensor->ext_clk)) { + dev_err(&client->dev, "could not get clock (%ld)\n", + PTR_ERR(sensor->ext_clk)); + return -EPROBE_DEFER; + } - rval = clk_set_rate(sensor->ext_clk, - sensor->hwcfg->ext_clk); - if (rval < 0) { - dev_err(&client->dev, - "unable to set clock freq to %u\n", - sensor->hwcfg->ext_clk); - return rval; - } + rval = clk_set_rate(sensor->ext_clk, + sensor->hwcfg->ext_clk); + if (rval < 0) { + dev_err(&client->dev, + "unable to set clock freq to %u\n", + sensor->hwcfg->ext_clk); + return rval; } sensor->xshutdown = devm_gpiod_get_optional(&client->dev, "xshutdown", @@ -3108,10 +3096,7 @@ static int smiapp_remove(struct i2c_client *client) if (sensor->power_count) { gpiod_set_value(sensor->xshutdown, 0); - if (sensor->hwcfg->set_xclk) - sensor->hwcfg->set_xclk(&sensor->src->sd, 0); - else - clk_disable_unprepare(sensor->ext_clk); + clk_disable_unprepare(sensor->ext_clk); sensor->power_count = 0; } diff --git a/include/media/i2c/smiapp.h b/include/media/i2c/smiapp.h index eacc3f4e3deb..635007e7441a 100644 --- a/include/media/i2c/smiapp.h +++ b/include/media/i2c/smiapp.h @@ -73,8 +73,6 @@ struct smiapp_hwconfig { enum smiapp_module_board_orient module_board_orient; struct smiapp_flash_strobe_parms *strobe_setup; - - int (*set_xclk)(struct v4l2_subdev *sd, int hz); }; #endif /* __SMIAPP_H_ */ From c6517b78153a1ffb401d8c3ec329effd3ee19036 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Fri, 2 Sep 2016 15:42:24 -0700 Subject: [PATCH 277/591] doc: ioctl: Add some clarifications to botching-up-ioctls - The guide currently says to pad the structure to a multiple of 64-bits. This is not necessary in cases where the structure contains no 64-bit types. Clarify this concept to avoid unnecessary padding. - When using __u64 to hold user pointers, blindly trying to do a cast to a void __user * may generate a warning on 32-bit systems about a cast from an integer to a pointer of different size. There is a macro to deal with this which hides an ugly double cast. Add a reference to this macro. Signed-off-by: Laura Abbott Acked-by: Arnd Bergmann Signed-off-by: Jonathan Corbet --- Documentation/ioctl/botching-up-ioctls.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Documentation/ioctl/botching-up-ioctls.txt b/Documentation/ioctl/botching-up-ioctls.txt index cc30b14791cb..36138c632f7a 100644 --- a/Documentation/ioctl/botching-up-ioctls.txt +++ b/Documentation/ioctl/botching-up-ioctls.txt @@ -34,15 +34,18 @@ will need to add a a 32-bit compat layer: 64-bit platforms do. So we always need padding to the natural size to get this right. - * Pad the entire struct to a multiple of 64-bits - the structure size will - otherwise differ on 32-bit versus 64-bit. Having a different structure size - hurts when passing arrays of structures to the kernel, or if the kernel - checks the structure size, which e.g. the drm core does. + * Pad the entire struct to a multiple of 64-bits if the structure contains + 64-bit types - the structure size will otherwise differ on 32-bit versus + 64-bit. Having a different structure size hurts when passing arrays of + structures to the kernel, or if the kernel checks the structure size, which + e.g. the drm core does. * Pointers are __u64, cast from/to a uintprt_t on the userspace side and from/to a void __user * in the kernel. Try really hard not to delay this conversion or worse, fiddle the raw __u64 through your code since that - diminishes the checking tools like sparse can provide. + diminishes the checking tools like sparse can provide. The macro + u64_to_user_ptr can be used in the kernel to avoid warnings about integers + and pointres of different sizes. Basics From 2836a2f5bd8516ae3c1a9b8bd76aea2160e5d092 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Sat, 27 Aug 2016 12:29:59 +1000 Subject: [PATCH 278/591] documentation/scsi: Remove nodisconnect parameter The driver that used the 'nodisconnect' parameter was removed in commit 565bae6a4a8f ("[SCSI] 53c7xx: kill driver"). Related documentation was cleaned up in commit f37a7238d379 ("[SCSI] 53c7xx: fix removal fallout"), except for the remaining two mentions that are removed here. Signed-off-by: Finn Thain Reviewed-by: Geert Uytterhoeven Signed-off-by: Jonathan Corbet --- Documentation/kernel-parameters.txt | 2 -- Documentation/scsi/scsi-parameters.txt | 2 -- 2 files changed, 4 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 1fa28092ec00..861f57514fbd 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -2574,8 +2574,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. nodelayacct [KNL] Disable per-task delay accounting - nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. - nodsp [SH] Disable hardware DSP at boot time. noefi Disable EFI runtime services support. diff --git a/Documentation/scsi/scsi-parameters.txt b/Documentation/scsi/scsi-parameters.txt index 1241ac11edb1..d5ae6ced6be3 100644 --- a/Documentation/scsi/scsi-parameters.txt +++ b/Documentation/scsi/scsi-parameters.txt @@ -79,8 +79,6 @@ parameters may be changed at runtime by the command ncr53c8xx= [HW,SCSI] - nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. - osst= [HW,SCSI] SCSI Tape Driver Format: , See also Documentation/scsi/st.txt. From 9d9cce7f10dc8d7a5fc6ef4e537e17664234605a Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes Date: Tue, 23 Aug 2016 09:00:45 +0100 Subject: [PATCH 279/591] x86: fix memory ranges in mm documentation This is a trivial fix to correct upper bound addresses to always be inclusive. Previously, the majority of ranges specified were inclusive with a small minority specifying an exclusive upper bound. This patch fixes this inconsistency. Signed-off-by: Lorenzo Stoakes Signed-off-by: Jonathan Corbet --- Documentation/x86/x86_64/mm.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt index 8c7dd5957ae1..5724092db811 100644 --- a/Documentation/x86/x86_64/mm.txt +++ b/Documentation/x86/x86_64/mm.txt @@ -12,13 +12,13 @@ ffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap space ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB) ... unused hole ... -ffffec0000000000 - fffffc0000000000 (=44 bits) kasan shadow memory (16TB) +ffffec0000000000 - fffffbffffffffff (=44 bits) kasan shadow memory (16TB) ... unused hole ... ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks ... unused hole ... -ffffffef00000000 - ffffffff00000000 (=64 GB) EFI region mapping space +ffffffef00000000 - fffffffeffffffff (=64 GB) EFI region mapping space ... unused hole ... -ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 0 +ffffffff80000000 - ffffffff9fffffff (=512 MB) kernel text mapping, from phys 0 ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole From ef00028b20481647431ca8bffe5469fb86cf154f Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Fri, 26 Aug 2016 07:14:08 -0600 Subject: [PATCH 280/591] docs: make kernel-doc handle varargs properly As far as I can tell, the handling of "..." arguments has never worked right, so any documentation provided was ignored in favor of "variable arguments." This makes kernel-doc handle "@...:" as documented. It does *not* fix spots in kerneldoc comments that don't follow that convention, but they are no more broken than before. Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 301bf874cac8..c5918951a8d3 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -412,7 +412,7 @@ my $doc_com_body = '\s*\* ?'; my $doc_decl = $doc_com . '(\w+)'; # @params and a strictly limited set of supported section names my $doc_sect = $doc_com . - '\s*(\@\w+|description|context|returns?|notes?|examples?)\s*:(.*)'; + '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)'; my $doc_content = $doc_com_body . '(.*)'; my $doc_block = $doc_com . 'DOC:\s*(.*)?'; my $doc_inline_start = '^\s*/\*\*\s*$'; @@ -2351,6 +2351,7 @@ sub push_parameter($$$) { if ($type eq "" && $param =~ /\.\.\.$/) { + $param = "..."; if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") { $parameterdescs{$param} = "variable arguments"; } From 5219f18aaf00f9f9ba572b3817e394043388d4ef Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Wed, 24 Aug 2016 16:31:15 -0600 Subject: [PATCH 281/591] docs: Special-case function-pointer parameters in kernel-doc Add yet another regex to kernel-doc to trap @param() references separately and not produce corrupt RST markup. Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index c5918951a8d3..93721f3c91bf 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -212,6 +212,7 @@ my $anon_struct_union = 0; my $type_constant = '\%([-_\w]+)'; my $type_func = '(\w+)\(\)'; my $type_param = '\@(\w+)'; +my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params my $type_struct = '\&((struct\s*)*[_\w]+)'; my $type_struct_xml = '\\&((struct\s*)*[_\w]+)'; my $type_env = '(\$\w+)'; @@ -292,6 +293,7 @@ my @highlights_rst = ( # Note: need to escape () to avoid func matching later [$type_member_func, "\\:c\\:type\\:`\$1\$2\\\\(\\\\) <\$1>`"], [$type_member, "\\:c\\:type\\:`\$1\$2 <\$1>`"], + [$type_fp_param, "**\$1\\\\(\\\\)**"], [$type_func, "\\:c\\:func\\:`\$1()`"], [$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"], [$type_enum_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"], From 70fc1f547a91c137913a23a0f7a4a89c33930c6a Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sat, 20 Aug 2016 13:24:56 -0600 Subject: [PATCH 282/591] docs: Pull the HSI documentation together The HSI subsystem documentation was split across hsi.txt and the device-drivers docbook. Now that the latter has been converted to Sphinx, pull in the HSI document so that it's all in one place. Acked-by: Sebastian Reichel Signed-off-by: Jonathan Corbet --- .../driver-api/serial-interfaces.rst | 82 ++++++++++++++++++- Documentation/hsi.txt | 75 ----------------- MAINTAINERS | 2 +- 3 files changed, 79 insertions(+), 80 deletions(-) delete mode 100644 Documentation/hsi.txt diff --git a/Documentation/driver-api/serial-interfaces.rst b/Documentation/driver-api/serial-interfaces.rst index d0d65e58c14b..07c58971a322 100644 --- a/Documentation/driver-api/serial-interfaces.rst +++ b/Documentation/driver-api/serial-interfaces.rst @@ -102,10 +102,84 @@ i2c_adapter devices which don't support those I2C operations. High Speed Synchronous Serial Interface (HSI) ============================================= -High Speed Synchronous Serial Interface (HSI) is a serial interface -mainly used for connecting application engines (APE) with cellular modem -engines (CMT) in cellular handsets. HSI provides multiplexing for up to -16 logical channels, low-latency and full duplex communication. +1. Introduction +--------------- + +High Speed Syncronous Interface (HSI) is a fullduplex, low latency protocol, +that is optimized for die-level interconnect between an Application Processor +and a Baseband chipset. It has been specified by the MIPI alliance in 2003 and +implemented by multiple vendors since then. + +The HSI interface supports full duplex communication over multiple channels +(typically 8) and is capable of reaching speeds up to 200 Mbit/s. + +The serial protocol uses two signals, DATA and FLAG as combined data and clock +signals and an additional READY signal for flow control. An additional WAKE +signal can be used to wakeup the chips from standby modes. The signals are +commonly prefixed by AC for signals going from the application die to the +cellular die and CA for signals going the other way around. + +:: + + +------------+ +---------------+ + | Cellular | | Application | + | Die | | Die | + | | - - - - - - CAWAKE - - - - - - >| | + | T|------------ CADATA ------------>|R | + | X|------------ CAFLAG ------------>|X | + | |<----------- ACREADY ------------| | + | | | | + | | | | + | |< - - - - - ACWAKE - - - - - - -| | + | R|<----------- ACDATA -------------|T | + | X|<----------- ACFLAG -------------|X | + | |------------ CAREADY ----------->| | + | | | | + | | | | + +------------+ +---------------+ + +2. HSI Subsystem in Linux +------------------------- + +In the Linux kernel the hsi subsystem is supposed to be used for HSI devices. +The hsi subsystem contains drivers for hsi controllers including support for +multi-port controllers and provides a generic API for using the HSI ports. + +It also contains HSI client drivers, which make use of the generic API to +implement a protocol used on the HSI interface. These client drivers can +use an arbitrary number of channels. + +3. hsi-char Device +------------------ + +Each port automatically registers a generic client driver called hsi_char, +which provides a charecter device for userspace representing the HSI port. +It can be used to communicate via HSI from userspace. Userspace may +configure the hsi_char device using the following ioctl commands: + +HSC_RESET + flush the HSI port + +HSC_SET_PM + enable or disable the client. + +HSC_SEND_BREAK + send break + +HSC_SET_RX + set RX configuration + +HSC_GET_RX + get RX configuration + +HSC_SET_TX + set TX configuration + +HSC_GET_TX + get TX configuration + +The kernel HSI API +------------------ .. kernel-doc:: include/linux/hsi/hsi.h :internal: diff --git a/Documentation/hsi.txt b/Documentation/hsi.txt deleted file mode 100644 index 6ac6cd51852a..000000000000 --- a/Documentation/hsi.txt +++ /dev/null @@ -1,75 +0,0 @@ -HSI - High-speed Synchronous Serial Interface - -1. Introduction -~~~~~~~~~~~~~~~ - -High Speed Syncronous Interface (HSI) is a fullduplex, low latency protocol, -that is optimized for die-level interconnect between an Application Processor -and a Baseband chipset. It has been specified by the MIPI alliance in 2003 and -implemented by multiple vendors since then. - -The HSI interface supports full duplex communication over multiple channels -(typically 8) and is capable of reaching speeds up to 200 Mbit/s. - -The serial protocol uses two signals, DATA and FLAG as combined data and clock -signals and an additional READY signal for flow control. An additional WAKE -signal can be used to wakeup the chips from standby modes. The signals are -commonly prefixed by AC for signals going from the application die to the -cellular die and CA for signals going the other way around. - -+------------+ +---------------+ -| Cellular | | Application | -| Die | | Die | -| | - - - - - - CAWAKE - - - - - - >| | -| T|------------ CADATA ------------>|R | -| X|------------ CAFLAG ------------>|X | -| |<----------- ACREADY ------------| | -| | | | -| | | | -| |< - - - - - ACWAKE - - - - - - -| | -| R|<----------- ACDATA -------------|T | -| X|<----------- ACFLAG -------------|X | -| |------------ CAREADY ----------->| | -| | | | -| | | | -+------------+ +---------------+ - -2. HSI Subsystem in Linux -~~~~~~~~~~~~~~~~~~~~~~~~~ - -In the Linux kernel the hsi subsystem is supposed to be used for HSI devices. -The hsi subsystem contains drivers for hsi controllers including support for -multi-port controllers and provides a generic API for using the HSI ports. - -It also contains HSI client drivers, which make use of the generic API to -implement a protocol used on the HSI interface. These client drivers can -use an arbitrary number of channels. - -3. hsi-char Device -~~~~~~~~~~~~~~~~~~ - -Each port automatically registers a generic client driver called hsi_char, -which provides a charecter device for userspace representing the HSI port. -It can be used to communicate via HSI from userspace. Userspace may -configure the hsi_char device using the following ioctl commands: - -* HSC_RESET: - - flush the HSI port - -* HSC_SET_PM - - enable or disable the client. - -* HSC_SEND_BREAK - - send break - -* HSC_SET_RX - - set RX configuration - -* HSC_GET_RX - - get RX configuration - -* HSC_SET_TX - - set TX configuration - -* HSC_GET_TX - - get TX configuration diff --git a/MAINTAINERS b/MAINTAINERS index 810723537aa5..769a2fd4af72 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5606,7 +5606,7 @@ M: Sebastian Reichel T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git S: Maintained F: Documentation/ABI/testing/sysfs-bus-hsi -F: Documentation/hsi.txt +F: Documentation/device-drivers/serial-interfaces.rst F: drivers/hsi/ F: include/linux/hsi/ F: include/uapi/linux/hsi/ From 5e995786850e78b7950f6979a6bdd3990abc89cd Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Tue, 6 Sep 2016 07:15:24 -0600 Subject: [PATCH 283/591] docs: split up serial-interfaces.rst It never made sense to keep these documents together; move each into its own file. Drop the section numbering on hsi.txt on its way to its own file. Suggested-by: Sebastian Reichel Signed-off-by: Jonathan Corbet --- Documentation/driver-api/hsi.rst | 88 ++++++++ Documentation/driver-api/i2c.rst | 46 +++++ Documentation/driver-api/index.rst | 4 +- .../driver-api/serial-interfaces.rst | 189 ------------------ Documentation/driver-api/spi.rst | 53 +++++ 5 files changed, 190 insertions(+), 190 deletions(-) create mode 100644 Documentation/driver-api/hsi.rst create mode 100644 Documentation/driver-api/i2c.rst delete mode 100644 Documentation/driver-api/serial-interfaces.rst create mode 100644 Documentation/driver-api/spi.rst diff --git a/Documentation/driver-api/hsi.rst b/Documentation/driver-api/hsi.rst new file mode 100644 index 000000000000..f9cec02b72a1 --- /dev/null +++ b/Documentation/driver-api/hsi.rst @@ -0,0 +1,88 @@ +High Speed Synchronous Serial Interface (HSI) +============================================= + +Introduction +--------------- + +High Speed Syncronous Interface (HSI) is a fullduplex, low latency protocol, +that is optimized for die-level interconnect between an Application Processor +and a Baseband chipset. It has been specified by the MIPI alliance in 2003 and +implemented by multiple vendors since then. + +The HSI interface supports full duplex communication over multiple channels +(typically 8) and is capable of reaching speeds up to 200 Mbit/s. + +The serial protocol uses two signals, DATA and FLAG as combined data and clock +signals and an additional READY signal for flow control. An additional WAKE +signal can be used to wakeup the chips from standby modes. The signals are +commonly prefixed by AC for signals going from the application die to the +cellular die and CA for signals going the other way around. + +:: + + +------------+ +---------------+ + | Cellular | | Application | + | Die | | Die | + | | - - - - - - CAWAKE - - - - - - >| | + | T|------------ CADATA ------------>|R | + | X|------------ CAFLAG ------------>|X | + | |<----------- ACREADY ------------| | + | | | | + | | | | + | |< - - - - - ACWAKE - - - - - - -| | + | R|<----------- ACDATA -------------|T | + | X|<----------- ACFLAG -------------|X | + | |------------ CAREADY ----------->| | + | | | | + | | | | + +------------+ +---------------+ + +HSI Subsystem in Linux +------------------------- + +In the Linux kernel the hsi subsystem is supposed to be used for HSI devices. +The hsi subsystem contains drivers for hsi controllers including support for +multi-port controllers and provides a generic API for using the HSI ports. + +It also contains HSI client drivers, which make use of the generic API to +implement a protocol used on the HSI interface. These client drivers can +use an arbitrary number of channels. + +hsi-char Device +------------------ + +Each port automatically registers a generic client driver called hsi_char, +which provides a charecter device for userspace representing the HSI port. +It can be used to communicate via HSI from userspace. Userspace may +configure the hsi_char device using the following ioctl commands: + +HSC_RESET + flush the HSI port + +HSC_SET_PM + enable or disable the client. + +HSC_SEND_BREAK + send break + +HSC_SET_RX + set RX configuration + +HSC_GET_RX + get RX configuration + +HSC_SET_TX + set TX configuration + +HSC_GET_TX + get TX configuration + +The kernel HSI API +------------------ + +.. kernel-doc:: include/linux/hsi/hsi.h + :internal: + +.. kernel-doc:: drivers/hsi/hsi_core.c + :export: + diff --git a/Documentation/driver-api/i2c.rst b/Documentation/driver-api/i2c.rst new file mode 100644 index 000000000000..f3939f7852bd --- /dev/null +++ b/Documentation/driver-api/i2c.rst @@ -0,0 +1,46 @@ +I\ :sup:`2`\ C and SMBus Subsystem +================================== + +I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for +the "Inter-IC" bus, a simple bus protocol which is widely used where low +data rate communications suffice. Since it's also a licensed trademark, +some vendors use another name (such as "Two-Wire Interface", TWI) for +the same bus. I2C only needs two signals (SCL for clock, SDA for data), +conserving board real estate and minimizing signal quality issues. Most +I2C devices use seven bit addresses, and bus speeds of up to 400 kHz; +there's a high speed extension (3.4 MHz) that's not yet found wide use. +I2C is a multi-master bus; open drain signaling is used to arbitrate +between masters, as well as to handshake and to synchronize clocks from +slower clients. + +The Linux I2C programming interfaces support only the master side of bus +interactions, not the slave side. The programming interface is +structured around two kinds of driver, and two kinds of device. An I2C +"Adapter Driver" abstracts the controller hardware; it binds to a +physical device (perhaps a PCI device or platform_device) and exposes a +:c:type:`struct i2c_adapter ` representing each +I2C bus segment it manages. On each I2C bus segment will be I2C devices +represented by a :c:type:`struct i2c_client `. +Those devices will be bound to a :c:type:`struct i2c_driver +`, which should follow the standard Linux driver +model. (At this writing, a legacy model is more widely used.) There are +functions to perform various I2C protocol operations; at this writing +all such functions are usable only from task context. + +The System Management Bus (SMBus) is a sibling protocol. Most SMBus +systems are also I2C conformant. The electrical constraints are tighter +for SMBus, and it standardizes particular protocol messages and idioms. +Controllers that support I2C can also support most SMBus operations, but +SMBus controllers don't support all the protocol options that an I2C +controller will. There are functions to perform various SMBus protocol +operations, either using I2C primitives or by issuing SMBus commands to +i2c_adapter devices which don't support those I2C operations. + +.. kernel-doc:: include/linux/i2c.h + :internal: + +.. kernel-doc:: drivers/i2c/i2c-boardinfo.c + :functions: i2c_register_board_info + +.. kernel-doc:: drivers/i2c/i2c-core.c + :export: diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst index b50c41011e47..8e259c5d0322 100644 --- a/Documentation/driver-api/index.rst +++ b/Documentation/driver-api/index.rst @@ -20,5 +20,7 @@ available subsections can be seen below. sound frame-buffer input - serial-interfaces + spi + i2c + hsi miscellaneous diff --git a/Documentation/driver-api/serial-interfaces.rst b/Documentation/driver-api/serial-interfaces.rst deleted file mode 100644 index 07c58971a322..000000000000 --- a/Documentation/driver-api/serial-interfaces.rst +++ /dev/null @@ -1,189 +0,0 @@ -Serial Peripheral Interface (SPI) -================================= - -SPI is the "Serial Peripheral Interface", widely used with embedded -systems because it is a simple and efficient interface: basically a -multiplexed shift register. Its three signal wires hold a clock (SCK, -often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data -line, and a "Master In, Slave Out" (MISO) data line. SPI is a full -duplex protocol; for each bit shifted out the MOSI line (one per clock) -another is shifted in on the MISO line. Those bits are assembled into -words of various sizes on the way to and from system memory. An -additional chipselect line is usually active-low (nCS); four signals are -normally used for each peripheral, plus sometimes an interrupt. - -The SPI bus facilities listed here provide a generalized interface to -declare SPI busses and devices, manage them according to the standard -Linux driver model, and perform input/output operations. At this time, -only "master" side interfaces are supported, where Linux talks to SPI -peripherals and does not implement such a peripheral itself. (Interfaces -to support implementing SPI slaves would necessarily look different.) - -The programming interface is structured around two kinds of driver, and -two kinds of device. A "Controller Driver" abstracts the controller -hardware, which may be as simple as a set of GPIO pins or as complex as -a pair of FIFOs connected to dual DMA engines on the other side of the -SPI shift register (maximizing throughput). Such drivers bridge between -whatever bus they sit on (often the platform bus) and SPI, and expose -the SPI side of their device as a :c:type:`struct spi_master -`. SPI devices are children of that master, -represented as a :c:type:`struct spi_device ` and -manufactured from :c:type:`struct spi_board_info -` descriptors which are usually provided by -board-specific initialization code. A :c:type:`struct spi_driver -` is called a "Protocol Driver", and is bound to a -spi_device using normal driver model calls. - -The I/O model is a set of queued messages. Protocol drivers submit one -or more :c:type:`struct spi_message ` objects, -which are processed and completed asynchronously. (There are synchronous -wrappers, however.) Messages are built from one or more -:c:type:`struct spi_transfer ` objects, each of -which wraps a full duplex SPI transfer. A variety of protocol tweaking -options are needed, because different chips adopt very different -policies for how they use the bits transferred with SPI. - -.. kernel-doc:: include/linux/spi/spi.h - :internal: - -.. kernel-doc:: drivers/spi/spi.c - :functions: spi_register_board_info - -.. kernel-doc:: drivers/spi/spi.c - :export: - -I\ :sup:`2`\ C and SMBus Subsystem -================================== - -I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for -the "Inter-IC" bus, a simple bus protocol which is widely used where low -data rate communications suffice. Since it's also a licensed trademark, -some vendors use another name (such as "Two-Wire Interface", TWI) for -the same bus. I2C only needs two signals (SCL for clock, SDA for data), -conserving board real estate and minimizing signal quality issues. Most -I2C devices use seven bit addresses, and bus speeds of up to 400 kHz; -there's a high speed extension (3.4 MHz) that's not yet found wide use. -I2C is a multi-master bus; open drain signaling is used to arbitrate -between masters, as well as to handshake and to synchronize clocks from -slower clients. - -The Linux I2C programming interfaces support only the master side of bus -interactions, not the slave side. The programming interface is -structured around two kinds of driver, and two kinds of device. An I2C -"Adapter Driver" abstracts the controller hardware; it binds to a -physical device (perhaps a PCI device or platform_device) and exposes a -:c:type:`struct i2c_adapter ` representing each -I2C bus segment it manages. On each I2C bus segment will be I2C devices -represented by a :c:type:`struct i2c_client `. -Those devices will be bound to a :c:type:`struct i2c_driver -`, which should follow the standard Linux driver -model. (At this writing, a legacy model is more widely used.) There are -functions to perform various I2C protocol operations; at this writing -all such functions are usable only from task context. - -The System Management Bus (SMBus) is a sibling protocol. Most SMBus -systems are also I2C conformant. The electrical constraints are tighter -for SMBus, and it standardizes particular protocol messages and idioms. -Controllers that support I2C can also support most SMBus operations, but -SMBus controllers don't support all the protocol options that an I2C -controller will. There are functions to perform various SMBus protocol -operations, either using I2C primitives or by issuing SMBus commands to -i2c_adapter devices which don't support those I2C operations. - -.. kernel-doc:: include/linux/i2c.h - :internal: - -.. kernel-doc:: drivers/i2c/i2c-boardinfo.c - :functions: i2c_register_board_info - -.. kernel-doc:: drivers/i2c/i2c-core.c - :export: - -High Speed Synchronous Serial Interface (HSI) -============================================= - -1. Introduction ---------------- - -High Speed Syncronous Interface (HSI) is a fullduplex, low latency protocol, -that is optimized for die-level interconnect between an Application Processor -and a Baseband chipset. It has been specified by the MIPI alliance in 2003 and -implemented by multiple vendors since then. - -The HSI interface supports full duplex communication over multiple channels -(typically 8) and is capable of reaching speeds up to 200 Mbit/s. - -The serial protocol uses two signals, DATA and FLAG as combined data and clock -signals and an additional READY signal for flow control. An additional WAKE -signal can be used to wakeup the chips from standby modes. The signals are -commonly prefixed by AC for signals going from the application die to the -cellular die and CA for signals going the other way around. - -:: - - +------------+ +---------------+ - | Cellular | | Application | - | Die | | Die | - | | - - - - - - CAWAKE - - - - - - >| | - | T|------------ CADATA ------------>|R | - | X|------------ CAFLAG ------------>|X | - | |<----------- ACREADY ------------| | - | | | | - | | | | - | |< - - - - - ACWAKE - - - - - - -| | - | R|<----------- ACDATA -------------|T | - | X|<----------- ACFLAG -------------|X | - | |------------ CAREADY ----------->| | - | | | | - | | | | - +------------+ +---------------+ - -2. HSI Subsystem in Linux -------------------------- - -In the Linux kernel the hsi subsystem is supposed to be used for HSI devices. -The hsi subsystem contains drivers for hsi controllers including support for -multi-port controllers and provides a generic API for using the HSI ports. - -It also contains HSI client drivers, which make use of the generic API to -implement a protocol used on the HSI interface. These client drivers can -use an arbitrary number of channels. - -3. hsi-char Device ------------------- - -Each port automatically registers a generic client driver called hsi_char, -which provides a charecter device for userspace representing the HSI port. -It can be used to communicate via HSI from userspace. Userspace may -configure the hsi_char device using the following ioctl commands: - -HSC_RESET - flush the HSI port - -HSC_SET_PM - enable or disable the client. - -HSC_SEND_BREAK - send break - -HSC_SET_RX - set RX configuration - -HSC_GET_RX - get RX configuration - -HSC_SET_TX - set TX configuration - -HSC_GET_TX - get TX configuration - -The kernel HSI API ------------------- - -.. kernel-doc:: include/linux/hsi/hsi.h - :internal: - -.. kernel-doc:: drivers/hsi/hsi_core.c - :export: - diff --git a/Documentation/driver-api/spi.rst b/Documentation/driver-api/spi.rst new file mode 100644 index 000000000000..f64cb666498a --- /dev/null +++ b/Documentation/driver-api/spi.rst @@ -0,0 +1,53 @@ +Serial Peripheral Interface (SPI) +================================= + +SPI is the "Serial Peripheral Interface", widely used with embedded +systems because it is a simple and efficient interface: basically a +multiplexed shift register. Its three signal wires hold a clock (SCK, +often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data +line, and a "Master In, Slave Out" (MISO) data line. SPI is a full +duplex protocol; for each bit shifted out the MOSI line (one per clock) +another is shifted in on the MISO line. Those bits are assembled into +words of various sizes on the way to and from system memory. An +additional chipselect line is usually active-low (nCS); four signals are +normally used for each peripheral, plus sometimes an interrupt. + +The SPI bus facilities listed here provide a generalized interface to +declare SPI busses and devices, manage them according to the standard +Linux driver model, and perform input/output operations. At this time, +only "master" side interfaces are supported, where Linux talks to SPI +peripherals and does not implement such a peripheral itself. (Interfaces +to support implementing SPI slaves would necessarily look different.) + +The programming interface is structured around two kinds of driver, and +two kinds of device. A "Controller Driver" abstracts the controller +hardware, which may be as simple as a set of GPIO pins or as complex as +a pair of FIFOs connected to dual DMA engines on the other side of the +SPI shift register (maximizing throughput). Such drivers bridge between +whatever bus they sit on (often the platform bus) and SPI, and expose +the SPI side of their device as a :c:type:`struct spi_master +`. SPI devices are children of that master, +represented as a :c:type:`struct spi_device ` and +manufactured from :c:type:`struct spi_board_info +` descriptors which are usually provided by +board-specific initialization code. A :c:type:`struct spi_driver +` is called a "Protocol Driver", and is bound to a +spi_device using normal driver model calls. + +The I/O model is a set of queued messages. Protocol drivers submit one +or more :c:type:`struct spi_message ` objects, +which are processed and completed asynchronously. (There are synchronous +wrappers, however.) Messages are built from one or more +:c:type:`struct spi_transfer ` objects, each of +which wraps a full duplex SPI transfer. A variety of protocol tweaking +options are needed, because different chips adopt very different +policies for how they use the bits transferred with SPI. + +.. kernel-doc:: include/linux/spi/spi.h + :internal: + +.. kernel-doc:: drivers/spi/spi.c + :functions: spi_register_board_info + +.. kernel-doc:: drivers/spi/spi.c + :export: From d36bbab661d9da8dec97acd2d9647e86c70187e8 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Tue, 6 Sep 2016 07:22:03 -0600 Subject: [PATCH 284/591] docs: Don't format internal MPT docs This is the driver API document, so the internal stuff is just noise here. Signed-off-by: Jonathan Corbet --- Documentation/driver-api/message-based.rst | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Documentation/driver-api/message-based.rst b/Documentation/driver-api/message-based.rst index ef5867a7de20..18ff94ef6d8e 100644 --- a/Documentation/driver-api/message-based.rst +++ b/Documentation/driver-api/message-based.rst @@ -7,24 +7,6 @@ Fusion message devices .. kernel-doc:: drivers/message/fusion/mptbase.c :export: -.. kernel-doc:: drivers/message/fusion/mptbase.c - :internal: - .. kernel-doc:: drivers/message/fusion/mptscsih.c :export: -.. kernel-doc:: drivers/message/fusion/mptscsih.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptctl.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptspi.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptfc.c - :internal: - -.. kernel-doc:: drivers/message/fusion/mptlan.c - :internal: - From 43c784aab772e9527e2e369f6e1f6d6d1dd63866 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sun, 14 Aug 2016 17:20:26 -0300 Subject: [PATCH 285/591] [media] media/i2c: Delete owner assignment The field "owner" is set by core. Thus delete an extra initialisation. Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Signed-off-by: Markus Elfring Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ad9389b.c | 1 - drivers/media/i2c/adv7183.c | 1 - drivers/media/i2c/adv7393.c | 1 - drivers/media/i2c/cs3308.c | 1 - drivers/media/i2c/s5k4ecgx.c | 1 - drivers/media/i2c/s5k6a3.c | 1 - drivers/media/i2c/ths8200.c | 1 - drivers/media/i2c/tlv320aic23b.c | 1 - drivers/media/i2c/tvp514x.c | 1 - drivers/media/i2c/tvp7002.c | 1 - drivers/media/i2c/vs6624.c | 1 - 11 files changed, 11 deletions(-) diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c index 5fd23507c6d8..50f354144ee7 100644 --- a/drivers/media/i2c/ad9389b.c +++ b/drivers/media/i2c/ad9389b.c @@ -1217,7 +1217,6 @@ MODULE_DEVICE_TABLE(i2c, ad9389b_id); static struct i2c_driver ad9389b_driver = { .driver = { - .owner = THIS_MODULE, .name = "ad9389b", }, .probe = ad9389b_probe, diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c index 2bec737881e9..04eecda74d66 100644 --- a/drivers/media/i2c/adv7183.c +++ b/drivers/media/i2c/adv7183.c @@ -644,7 +644,6 @@ MODULE_DEVICE_TABLE(i2c, adv7183_id); static struct i2c_driver adv7183_driver = { .driver = { - .owner = THIS_MODULE, .name = "adv7183", }, .probe = adv7183_probe, diff --git a/drivers/media/i2c/adv7393.c b/drivers/media/i2c/adv7393.c index 76d987476e35..f19ad4ecd11e 100644 --- a/drivers/media/i2c/adv7393.c +++ b/drivers/media/i2c/adv7393.c @@ -456,7 +456,6 @@ MODULE_DEVICE_TABLE(i2c, adv7393_id); static struct i2c_driver adv7393_driver = { .driver = { - .owner = THIS_MODULE, .name = "adv7393", }, .probe = adv7393_probe, diff --git a/drivers/media/i2c/cs3308.c b/drivers/media/i2c/cs3308.c index d28b4f37fe5f..7da5f69cace6 100644 --- a/drivers/media/i2c/cs3308.c +++ b/drivers/media/i2c/cs3308.c @@ -127,7 +127,6 @@ MODULE_DEVICE_TABLE(i2c, cs3308_id); static struct i2c_driver cs3308_driver = { .driver = { - .owner = THIS_MODULE, .name = "cs3308", }, .probe = cs3308_probe, diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c index 8a0f22da590f..6ebcf254989a 100644 --- a/drivers/media/i2c/s5k4ecgx.c +++ b/drivers/media/i2c/s5k4ecgx.c @@ -1019,7 +1019,6 @@ MODULE_DEVICE_TABLE(i2c, s5k4ecgx_id); static struct i2c_driver v4l2_i2c_driver = { .driver = { - .owner = THIS_MODULE, .name = S5K4ECGX_DRIVER_NAME, }, .probe = s5k4ecgx_probe, diff --git a/drivers/media/i2c/s5k6a3.c b/drivers/media/i2c/s5k6a3.c index cbe4711e9b31..b1ecb44f9f14 100644 --- a/drivers/media/i2c/s5k6a3.c +++ b/drivers/media/i2c/s5k6a3.c @@ -376,7 +376,6 @@ static struct i2c_driver s5k6a3_driver = { .driver = { .of_match_table = of_match_ptr(s5k6a3_of_match), .name = S5K6A3_DRV_NAME, - .owner = THIS_MODULE, }, .probe = s5k6a3_probe, .remove = s5k6a3_remove, diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c index 73fc42bc2de6..42340e364cea 100644 --- a/drivers/media/i2c/ths8200.c +++ b/drivers/media/i2c/ths8200.c @@ -499,7 +499,6 @@ MODULE_DEVICE_TABLE(of, ths8200_of_match); static struct i2c_driver ths8200_driver = { .driver = { - .owner = THIS_MODULE, .name = "ths8200", .of_match_table = of_match_ptr(ths8200_of_match), }, diff --git a/drivers/media/i2c/tlv320aic23b.c b/drivers/media/i2c/tlv320aic23b.c index 0370dd89f1fc..2e06c06cac9b 100644 --- a/drivers/media/i2c/tlv320aic23b.c +++ b/drivers/media/i2c/tlv320aic23b.c @@ -210,7 +210,6 @@ MODULE_DEVICE_TABLE(i2c, tlv320aic23b_id); static struct i2c_driver tlv320aic23b_driver = { .driver = { - .owner = THIS_MODULE, .name = "tlv320aic23b", }, .probe = tlv320aic23b_probe, diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c index 7cdd94842938..7cf749fc7143 100644 --- a/drivers/media/i2c/tvp514x.c +++ b/drivers/media/i2c/tvp514x.c @@ -1233,7 +1233,6 @@ MODULE_DEVICE_TABLE(of, tvp514x_of_match); static struct i2c_driver tvp514x_driver = { .driver = { .of_match_table = of_match_ptr(tvp514x_of_match), - .owner = THIS_MODULE, .name = TVP514X_MODULE_NAME, }, .probe = tvp514x_probe, diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index 4df640c3aa40..3dc3341c4896 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c @@ -1086,7 +1086,6 @@ MODULE_DEVICE_TABLE(of, tvp7002_of_match); static struct i2c_driver tvp7002_driver = { .driver = { .of_match_table = of_match_ptr(tvp7002_of_match), - .owner = THIS_MODULE, .name = TVP7002_MODULE_NAME, }, .probe = tvp7002_probe, diff --git a/drivers/media/i2c/vs6624.c b/drivers/media/i2c/vs6624.c index 4c72a18c0b8c..be4cb7a8bdeb 100644 --- a/drivers/media/i2c/vs6624.c +++ b/drivers/media/i2c/vs6624.c @@ -863,7 +863,6 @@ MODULE_DEVICE_TABLE(i2c, vs6624_id); static struct i2c_driver vs6624_driver = { .driver = { - .owner = THIS_MODULE, .name = "vs6624", }, .probe = vs6624_probe, From 3a549beef9563c9a8f740dcdb002d18879ee91a6 Mon Sep 17 00:00:00 2001 From: Tiffany Lin Date: Sun, 14 Aug 2016 23:15:33 -0300 Subject: [PATCH 286/591] [media] vcodec: mediatek: Add g/s_selection support for V4L2 Encoder This patch add g/s_selection for MT8173 V4L2 Encoder. Only output queue support g/s_selection to configure crop. The top/left of active rectangle should always be (0,0) Signed-off-by: Tiffany Lin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../platform/mtk-vcodec/mtk_vcodec_enc.c | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 3ed3f2d31df5..b1f0acbae50b 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -631,6 +631,69 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv, return vidioc_try_fmt(f, fmt); } +static int vidioc_venc_g_selection(struct file *file, void *priv, + struct v4l2_selection *s) +{ + struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); + struct mtk_q_data *q_data; + + if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + + q_data = mtk_venc_get_q_data(ctx, s->type); + if (!q_data) + return -EINVAL; + + switch (s->target) { + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP_BOUNDS: + s->r.top = 0; + s->r.left = 0; + s->r.width = q_data->coded_width; + s->r.height = q_data->coded_height; + break; + case V4L2_SEL_TGT_CROP: + s->r.top = 0; + s->r.left = 0; + s->r.width = q_data->visible_width; + s->r.height = q_data->visible_height; + break; + default: + return -EINVAL; + } + + return 0; +} + +static int vidioc_venc_s_selection(struct file *file, void *priv, + struct v4l2_selection *s) +{ + struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv); + struct mtk_q_data *q_data; + + if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + + q_data = mtk_venc_get_q_data(ctx, s->type); + if (!q_data) + return -EINVAL; + + switch (s->target) { + case V4L2_SEL_TGT_CROP: + /* Only support crop from (0,0) */ + s->r.top = 0; + s->r.left = 0; + s->r.width = min(s->r.width, q_data->coded_width); + s->r.height = min(s->r.height, q_data->coded_height); + q_data->visible_width = s->r.width; + q_data->visible_height = s->r.height; + break; + default: + return -EINVAL; + } + return 0; +} + static int vidioc_venc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { @@ -689,6 +752,9 @@ const struct v4l2_ioctl_ops mtk_venc_ioctl_ops = { .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs, .vidioc_prepare_buf = v4l2_m2m_ioctl_prepare_buf, + + .vidioc_g_selection = vidioc_venc_g_selection, + .vidioc_s_selection = vidioc_venc_s_selection, }; static int vb2ops_venc_queue_setup(struct vb2_queue *vq, From ae54913517f0705b92fe812c8c3f2ec37f542c99 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Mon, 15 Aug 2016 02:01:56 -0300 Subject: [PATCH 287/591] [media] radio-si470x-i2c: Delete owner assignment The field "owner" is set by core. Thus delete an extra initialisation. Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Signed-off-by: Markus Elfring Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/si470x/radio-si470x-i2c.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 471d6a8ae8a4..ee0470a3196b 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -509,7 +509,6 @@ static SIMPLE_DEV_PM_OPS(si470x_i2c_pm, si470x_i2c_suspend, si470x_i2c_resume); static struct i2c_driver si470x_i2c_driver = { .driver = { .name = "si470x", - .owner = THIS_MODULE, #ifdef CONFIG_PM_SLEEP .pm = &si470x_i2c_pm, #endif From a2fdc9df5e02ac3ab91d7888372cbe9512273171 Mon Sep 17 00:00:00 2001 From: Johan Fjeldtvedt Date: Mon, 22 Aug 2016 06:04:51 -0300 Subject: [PATCH 288/591] [media] cec: allow configuration both from within driver and from user space It makes sense for adapters such as the Pulse-Eight to be configurable both from within the driver and from user space, so remove the requirement that drivers only can call cec_s_log_addrs or cec_s_phys_addr if they don't expose those capabilities to user space. Signed-off-by: Johan Fjeldtvedt Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/cec/cec-adap.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c index b2393bbacb26..608e3e7915e0 100644 --- a/drivers/staging/media/cec/cec-adap.c +++ b/drivers/staging/media/cec/cec-adap.c @@ -1153,8 +1153,6 @@ void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block) if (IS_ERR_OR_NULL(adap)) return; - if (WARN_ON(adap->capabilities & CEC_CAP_PHYS_ADDR)) - return; mutex_lock(&adap->lock); __cec_s_phys_addr(adap, phys_addr, block); mutex_unlock(&adap->lock); @@ -1295,8 +1293,6 @@ int cec_s_log_addrs(struct cec_adapter *adap, { int err; - if (WARN_ON(adap->capabilities & CEC_CAP_LOG_ADDRS)) - return -EINVAL; mutex_lock(&adap->lock); err = __cec_s_log_addrs(adap, log_addrs, block); mutex_unlock(&adap->lock); From 05f3e58b8633590b1319db22646dd78ba6de2660 Mon Sep 17 00:00:00 2001 From: Johan Fjeldtvedt Date: Mon, 22 Aug 2016 06:04:52 -0300 Subject: [PATCH 289/591] [media] pulse8-cec: serialize communication with adapter Make sending messages to the adapter serialized within the driver. send_and_wait is split into send_and_wait_once, which only sends once and checks for the result, and the higher level send_and_wait, which performs locking and retries. Signed-off-by: Johan Fjeldtvedt Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/pulse8-cec/pulse8-cec.c | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index 94f8590492dc..dcda68a569a7 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c @@ -99,6 +99,7 @@ struct pulse8 { unsigned int idx; bool escape; bool started; + struct mutex write_lock; }; static void pulse8_irq_work_handler(struct work_struct *work) @@ -233,8 +234,9 @@ static int pulse8_send(struct serio *serio, const u8 *command, u8 cmd_len) return err; } -static int pulse8_send_and_wait(struct pulse8 *pulse8, - const u8 *cmd, u8 cmd_len, u8 response, u8 size) +static int pulse8_send_and_wait_once(struct pulse8 *pulse8, + const u8 *cmd, u8 cmd_len, + u8 response, u8 size) { int err; @@ -250,24 +252,8 @@ static int pulse8_send_and_wait(struct pulse8 *pulse8, if ((pulse8->data[0] & 0x3f) == MSGCODE_COMMAND_REJECTED && cmd[0] != MSGCODE_SET_CONTROLLED && cmd[0] != MSGCODE_SET_AUTO_ENABLED && - cmd[0] != MSGCODE_GET_BUILDDATE) { - u8 cmd_sc[2]; - - cmd_sc[0] = MSGCODE_SET_CONTROLLED; - cmd_sc[1] = 1; - err = pulse8_send_and_wait(pulse8, cmd_sc, 2, - MSGCODE_COMMAND_ACCEPTED, 1); - if (err) - return err; - init_completion(&pulse8->cmd_done); - - err = pulse8_send(pulse8->serio, cmd, cmd_len); - if (err) - return err; - - if (!wait_for_completion_timeout(&pulse8->cmd_done, HZ)) - return -ETIMEDOUT; - } + cmd[0] != MSGCODE_GET_BUILDDATE) + return -ENOTTY; if (response && ((pulse8->data[0] & 0x3f) != response || pulse8->len < size + 1)) { dev_info(pulse8->dev, "transmit: failed %02x\n", @@ -277,6 +263,31 @@ static int pulse8_send_and_wait(struct pulse8 *pulse8, return 0; } +static int pulse8_send_and_wait(struct pulse8 *pulse8, + const u8 *cmd, u8 cmd_len, u8 response, u8 size) +{ + u8 cmd_sc[2]; + int err; + + mutex_lock(&pulse8->write_lock); + err = pulse8_send_and_wait_once(pulse8, cmd, cmd_len, response, size); + + if (err == -ENOTTY) { + cmd_sc[0] = MSGCODE_SET_CONTROLLED; + cmd_sc[1] = 1; + err = pulse8_send_and_wait_once(pulse8, cmd_sc, 2, + MSGCODE_COMMAND_ACCEPTED, 1); + if (err) + goto unlock; + err = pulse8_send_and_wait_once(pulse8, cmd, cmd_len, + response, size); + } + +unlock: + mutex_unlock(&pulse8->write_lock); + return err == -ENOTTY ? -EIO : err; +} + static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio) { u8 *data = pulse8->data + 1; @@ -453,6 +464,7 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv) pulse8->dev = &serio->dev; serio_set_drvdata(serio, pulse8); INIT_WORK(&pulse8->work, pulse8_irq_work_handler); + mutex_init(&pulse8->write_lock); err = serio_open(serio, drv); if (err) From 89c2e228718cf0d545de7a589e971dbbe70cb8a3 Mon Sep 17 00:00:00 2001 From: Johan Fjeldtvedt Date: Mon, 22 Aug 2016 06:04:53 -0300 Subject: [PATCH 290/591] [media] pulse8-cec: add notes about behavior in autonomous mode The pulse8 dongle has some quirky behaviors when in autonomous mode. Document these. Signed-off-by: Johan Fjeldtvedt Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/pulse8-cec/pulse8-cec.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index dcda68a569a7..3361f4acfdaf 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c @@ -10,6 +10,29 @@ * this archive for more details. */ +/* + * Notes: + * + * - Devices with firmware version < 2 do not store their configuration in + * EEPROM. + * + * - In autonomous mode, only messages from a TV will be acknowledged, even + * polling messages. Upon receiving a message from a TV, the dongle will + * respond to messages from any logical address. + * + * - In autonomous mode, the dongle will by default reply Feature Abort + * [Unrecognized Opcode] when it receives Give Device Vendor ID. It will + * however observe vendor ID's reported by other devices and possibly + * alter this behavior. When TV's (and TV's only) report that their vendor ID + * is LG (0x00e091), the dongle will itself reply that it has the same vendor + * ID, and it will respond to at least one vendor specific command. + * + * - In autonomous mode, the dongle is known to attempt wakeup if it receives + * ["Power On"], ["Power] or ["Power Toggle"], or if it + * receives with its own physical address. It also does this + * if it receives [0x03 0x00] from an LG TV. + */ + #include #include #include From e28a6c8b3fcc166254596bbbf9ebe45facfa48eb Mon Sep 17 00:00:00 2001 From: Johan Fjeldtvedt Date: Mon, 22 Aug 2016 06:04:54 -0300 Subject: [PATCH 291/591] [media] pulse8-cec: sync configuration with adapter When the configuration is changed, they are also written to the adapter. This allows the adapter to continue operating in autonomous mode with the same settings when it is disconnected from the driver (typically by going into suspend). For adapters with firmware version 2 or greater, the settings are also persisted in EEPROM. A new module parameter is added to optionally also use the configuration already present in the adapter when it is connected. This option is enabled by default. When a new configuration is written, the autonomous mode is automatically enabled. When the device is unconfigured, autonomous mode is disabled. Signed-off-by: Johan Fjeldtvedt Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/pulse8-cec/pulse8-cec.c | 266 +++++++++++++++--- 1 file changed, 228 insertions(+), 38 deletions(-) diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index 3361f4acfdaf..e27eca307a38 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c @@ -51,8 +51,11 @@ MODULE_DESCRIPTION("Pulse Eight HDMI CEC driver"); MODULE_LICENSE("GPL"); static int debug; +static int persistent_config = 1; module_param(debug, int, 0644); +module_param(persistent_config, int, 0644); MODULE_PARM_DESC(debug, "debug level (0-1)"); +MODULE_PARM_DESC(persistent_config, "read config from persistent memory (0-1)"); enum pulse8_msgcodes { MSGCODE_NOTHING = 0, @@ -109,12 +112,16 @@ enum pulse8_msgcodes { #define DATA_SIZE 256 +#define PING_PERIOD (15 * HZ) + struct pulse8 { struct device *dev; struct serio *serio; struct cec_adapter *adap; + unsigned int vers; struct completion cmd_done; struct work_struct work; + struct delayed_work ping_eeprom_work; struct cec_msg rx_msg; u8 data[DATA_SIZE]; unsigned int len; @@ -122,9 +129,15 @@ struct pulse8 { unsigned int idx; bool escape; bool started; + struct mutex config_lock; struct mutex write_lock; + bool config_pending; + bool restoring_config; + bool autonomous; }; +static void pulse8_ping_eeprom_work_handler(struct work_struct *work); + static void pulse8_irq_work_handler(struct work_struct *work) { struct pulse8 *pulse8 = @@ -229,6 +242,7 @@ static void pulse8_disconnect(struct serio *serio) struct pulse8 *pulse8 = serio_get_drvdata(serio); cec_unregister_adapter(pulse8->adap); + cancel_delayed_work_sync(&pulse8->ping_eeprom_work); dev_info(&serio->dev, "disconnected\n"); serio_close(serio); serio_set_drvdata(serio, NULL); @@ -311,14 +325,15 @@ unlock: return err == -ENOTTY ? -EIO : err; } -static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio) +static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, + struct cec_log_addrs *log_addrs, u16 *pa) { u8 *data = pulse8->data + 1; - unsigned int count = 0; - unsigned int vers = 0; u8 cmd[2]; int err; + pulse8->vers = 0; + cmd[0] = MSGCODE_PING; err = pulse8_send_and_wait(pulse8, cmd, 1, MSGCODE_COMMAND_ACCEPTED, 0); @@ -328,10 +343,10 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio) if (err) return err; - vers = (data[0] << 8) | data[1]; + pulse8->vers = (data[0] << 8) | data[1]; - dev_info(pulse8->dev, "Firmware version %04x\n", vers); - if (vers < 2) + dev_info(pulse8->dev, "Firmware version %04x\n", pulse8->vers); + if (pulse8->vers < 2) return 0; cmd[0] = MSGCODE_GET_BUILDDATE; @@ -348,37 +363,103 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); } + if (err) + return err; - do { - if (count) - msleep(500); - cmd[0] = MSGCODE_SET_AUTO_ENABLED; - cmd[1] = 0; - err = pulse8_send_and_wait(pulse8, cmd, 2, - MSGCODE_COMMAND_ACCEPTED, 1); - if (err && count == 0) { - dev_info(pulse8->dev, "No Auto Enabled supported\n"); - return 0; - } + dev_dbg(pulse8->dev, "Persistent config:\n"); + cmd[0] = MSGCODE_GET_AUTO_ENABLED; + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); + if (err) + return err; + pulse8->autonomous = data[0]; + dev_dbg(pulse8->dev, "Autonomous mode: %s", + data[0] ? "on" : "off"); - cmd[0] = MSGCODE_GET_AUTO_ENABLED; - if (!err) - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); - if (!err && !data[0]) { - cmd[0] = MSGCODE_WRITE_EEPROM; - err = pulse8_send_and_wait(pulse8, cmd, 1, - MSGCODE_COMMAND_ACCEPTED, 1); - cmd[0] = MSGCODE_GET_AUTO_ENABLED; - if (!err) - err = pulse8_send_and_wait(pulse8, cmd, 1, - cmd[0], 1); - } - } while (!err && data[0] && count++ < 5); + cmd[0] = MSGCODE_GET_DEVICE_TYPE; + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); + if (err) + return err; + log_addrs->primary_device_type[0] = data[0]; + dev_dbg(pulse8->dev, "Primary device type: %d\n", data[0]); + switch (log_addrs->primary_device_type[0]) { + case CEC_OP_PRIM_DEVTYPE_TV: + log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_TV; + break; + case CEC_OP_PRIM_DEVTYPE_RECORD: + log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_RECORD; + break; + case CEC_OP_PRIM_DEVTYPE_TUNER: + log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_TUNER; + break; + case CEC_OP_PRIM_DEVTYPE_PLAYBACK: + log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK; + break; + case CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM: + log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK; + break; + case CEC_OP_PRIM_DEVTYPE_SWITCH: + log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED; + break; + case CEC_OP_PRIM_DEVTYPE_PROCESSOR: + log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_SPECIFIC; + break; + default: + log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED; + dev_info(pulse8->dev, "Unknown Primary Device Type: %d\n", + log_addrs->primary_device_type[0]); + break; + } - if (!err && data[0]) - err = -EIO; + cmd[0] = MSGCODE_GET_LOGICAL_ADDRESS_MASK; + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 2); + if (err) + return err; + log_addrs->log_addr_mask = (data[0] << 8) | data[1]; + dev_dbg(pulse8->dev, "Logical address ACK mask: %x\n", + log_addrs->log_addr_mask); + if (log_addrs->log_addr_mask) + log_addrs->num_log_addrs = 1; - return err; + cmd[0] = MSGCODE_GET_PHYSICAL_ADDRESS; + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); + if (err) + return err; + *pa = (data[0] << 8) | data[1]; + dev_dbg(pulse8->dev, "Physical address: %x.%x.%x.%x\n", + cec_phys_addr_exp(*pa)); + + cmd[0] = MSGCODE_GET_HDMI_VERSION; + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); + if (err) + return err; + log_addrs->cec_version = data[0]; + dev_dbg(pulse8->dev, "CEC version: %d\n", log_addrs->cec_version); + + cmd[0] = MSGCODE_GET_OSD_NAME; + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 0); + if (err) + return err; + strncpy(log_addrs->osd_name, data, 13); + dev_dbg(pulse8->dev, "OSD name: %s\n", log_addrs->osd_name); + + return 0; +} + +static int pulse8_apply_persistent_config(struct pulse8 *pulse8, + struct cec_log_addrs *log_addrs, + u16 pa) +{ + int err; + + err = cec_s_log_addrs(pulse8->adap, log_addrs, false); + if (err) + return err; + + cec_s_phys_addr(pulse8->adap, pa, false); + if (err) + return err; + + return 0; } static int pulse8_cec_adap_enable(struct cec_adapter *adap, bool enable) @@ -398,9 +479,11 @@ static int pulse8_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) { struct pulse8 *pulse8 = adap->priv; u16 mask = 0; - u8 cmd[3]; - int err; + u16 pa = adap->phys_addr; + u8 cmd[16]; + int err = 0; + mutex_lock(&pulse8->config_lock); if (log_addr != CEC_LOG_ADDR_INVALID) mask = 1 << log_addr; cmd[0] = MSGCODE_SET_ACK_MASK; @@ -408,8 +491,72 @@ static int pulse8_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) cmd[2] = mask & 0xff; err = pulse8_send_and_wait(pulse8, cmd, 3, MSGCODE_COMMAND_ACCEPTED, 0); - if (mask == 0) - return 0; + if ((err && mask != 0) || pulse8->restoring_config) + goto unlock; + + cmd[0] = MSGCODE_SET_AUTO_ENABLED; + cmd[1] = log_addr == CEC_LOG_ADDR_INVALID ? 0 : 1; + err = pulse8_send_and_wait(pulse8, cmd, 2, + MSGCODE_COMMAND_ACCEPTED, 0); + if (err) + goto unlock; + pulse8->autonomous = cmd[1]; + if (log_addr == CEC_LOG_ADDR_INVALID) + goto unlock; + + cmd[0] = MSGCODE_SET_DEVICE_TYPE; + cmd[1] = adap->log_addrs.primary_device_type[0]; + err = pulse8_send_and_wait(pulse8, cmd, 2, + MSGCODE_COMMAND_ACCEPTED, 0); + if (err) + goto unlock; + + cmd[0] = MSGCODE_SET_DEFAULT_LOGICAL_ADDRESS; + cmd[1] = log_addr; + err = pulse8_send_and_wait(pulse8, cmd, 2, + MSGCODE_COMMAND_ACCEPTED, 0); + if (err) + goto unlock; + + cmd[0] = MSGCODE_SET_PHYSICAL_ADDRESS; + cmd[1] = pa >> 8; + cmd[2] = pa & 0xff; + err = pulse8_send_and_wait(pulse8, cmd, 3, + MSGCODE_COMMAND_ACCEPTED, 0); + if (err) + goto unlock; + + cmd[0] = MSGCODE_SET_HDMI_VERSION; + cmd[1] = adap->log_addrs.cec_version; + err = pulse8_send_and_wait(pulse8, cmd, 2, + MSGCODE_COMMAND_ACCEPTED, 0); + if (err) + goto unlock; + + if (adap->log_addrs.osd_name[0]) { + size_t osd_len = strlen(adap->log_addrs.osd_name); + char *osd_str = cmd + 1; + + cmd[0] = MSGCODE_SET_OSD_NAME; + strncpy(cmd + 1, adap->log_addrs.osd_name, 13); + if (osd_len < 4) { + memset(osd_str + osd_len, ' ', 4 - osd_len); + osd_len = 4; + osd_str[osd_len] = '\0'; + strcpy(adap->log_addrs.osd_name, osd_str); + } + err = pulse8_send_and_wait(pulse8, cmd, 1 + osd_len, + MSGCODE_COMMAND_ACCEPTED, 0); + if (err) + goto unlock; + } + +unlock: + if (pulse8->restoring_config) + pulse8->restoring_config = false; + else + pulse8->config_pending = true; + mutex_unlock(&pulse8->config_lock); return err; } @@ -471,6 +618,8 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv) CEC_CAP_PASSTHROUGH | CEC_CAP_RC | CEC_CAP_MONITOR_ALL; struct pulse8 *pulse8; int err = -ENOMEM; + struct cec_log_addrs log_addrs = {}; + u16 pa; pulse8 = kzalloc(sizeof(*pulse8), GFP_KERNEL); @@ -488,12 +637,14 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv) serio_set_drvdata(serio, pulse8); INIT_WORK(&pulse8->work, pulse8_irq_work_handler); mutex_init(&pulse8->write_lock); + mutex_init(&pulse8->config_lock); + pulse8->config_pending = false; err = serio_open(serio, drv); if (err) goto delete_adap; - err = pulse8_setup(pulse8, serio); + err = pulse8_setup(pulse8, serio, &log_addrs, &pa); if (err) goto close_serio; @@ -502,6 +653,18 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv) goto close_serio; pulse8->dev = &pulse8->adap->devnode.dev; + + if (persistent_config && pulse8->autonomous) { + err = pulse8_apply_persistent_config(pulse8, &log_addrs, pa); + if (err) + goto close_serio; + pulse8->restoring_config = true; + } + + INIT_DELAYED_WORK(&pulse8->ping_eeprom_work, + pulse8_ping_eeprom_work_handler); + schedule_delayed_work(&pulse8->ping_eeprom_work, PING_PERIOD); + return 0; close_serio: @@ -514,6 +677,33 @@ free_device: return err; } +static void pulse8_ping_eeprom_work_handler(struct work_struct *work) +{ + struct pulse8 *pulse8 = + container_of(work, struct pulse8, ping_eeprom_work.work); + u8 cmd; + + schedule_delayed_work(&pulse8->ping_eeprom_work, PING_PERIOD); + cmd = MSGCODE_PING; + pulse8_send_and_wait(pulse8, &cmd, 1, + MSGCODE_COMMAND_ACCEPTED, 0); + + if (pulse8->vers < 2) + return; + + mutex_lock(&pulse8->config_lock); + if (pulse8->config_pending && persistent_config) { + dev_dbg(pulse8->dev, "writing pending config to EEPROM\n"); + cmd = MSGCODE_WRITE_EEPROM; + if (pulse8_send_and_wait(pulse8, &cmd, 1, + MSGCODE_COMMAND_ACCEPTED, 0)) + dev_info(pulse8->dev, "failed to write pending config to EEPROM\n"); + else + pulse8->config_pending = false; + } + mutex_unlock(&pulse8->config_lock); +} + static struct serio_device_id pulse8_serio_ids[] = { { .type = SERIO_RS232, From ee242096598df01fcdeb709ddf765bb614d93afb Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Mon, 22 Aug 2016 13:12:24 -0300 Subject: [PATCH 292/591] [media] media: tw686x: Support frame sizes and frame intervals enumeration This commit adds support for VIDIOC_ENUM_FRAMESIZES and VIDIOC_ENUM_FRAMEINTERVALS enumeration ioctls. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw686x/tw686x-video.c | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index 24a813256c99..9621588be12c 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -906,6 +906,42 @@ static int tw686x_g_std(struct file *file, void *priv, v4l2_std_id *id) return 0; } +static int tw686x_enum_framesizes(struct file *file, void *priv, + struct v4l2_frmsizeenum *fsize) +{ + struct tw686x_video_channel *vc = video_drvdata(file); + + if (fsize->index) + return -EINVAL; + fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE; + fsize->stepwise.max_width = TW686X_VIDEO_WIDTH; + fsize->stepwise.min_width = fsize->stepwise.max_width / 2; + fsize->stepwise.step_width = fsize->stepwise.min_width; + fsize->stepwise.max_height = TW686X_VIDEO_HEIGHT(vc->video_standard); + fsize->stepwise.min_height = fsize->stepwise.max_height / 2; + fsize->stepwise.step_height = fsize->stepwise.min_height; + return 0; +} + +static int tw686x_enum_frameintervals(struct file *file, void *priv, + struct v4l2_frmivalenum *ival) +{ + struct tw686x_video_channel *vc = video_drvdata(file); + int max_fps = TW686X_MAX_FPS(vc->video_standard); + int max_rates = DIV_ROUND_UP(max_fps, 2); + + if (ival->index >= max_rates) + return -EINVAL; + + ival->type = V4L2_FRMIVAL_TYPE_DISCRETE; + ival->discrete.numerator = 1; + if (ival->index < (max_rates - 1)) + ival->discrete.denominator = (ival->index + 1) * 2; + else + ival->discrete.denominator = max_fps; + return 0; +} + static int tw686x_g_parm(struct file *file, void *priv, struct v4l2_streamparm *sp) { @@ -1034,6 +1070,8 @@ static const struct v4l2_ioctl_ops tw686x_video_ioctl_ops = { .vidioc_g_parm = tw686x_g_parm, .vidioc_s_parm = tw686x_s_parm, + .vidioc_enum_framesizes = tw686x_enum_framesizes, + .vidioc_enum_frameintervals = tw686x_enum_frameintervals, .vidioc_enum_input = tw686x_enum_input, .vidioc_g_input = tw686x_g_input, From 846c4a7b3aebab9d354aa3fc6b2b8770a453427d Mon Sep 17 00:00:00 2001 From: Songjun Wu Date: Wed, 24 Aug 2016 05:49:28 -0300 Subject: [PATCH 293/591] [media] atmel-isc: remove the warning Replace the 'IS_ERR_VALUE(irq)' with 'ret < 0' in function 'atmel_isc_probe'. Reported-by: Hans Verkuil Signed-off-by: Songjun Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/atmel/atmel-isc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index f0c2512d27f0..db6773de92f0 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -1358,7 +1358,7 @@ static int atmel_isc_probe(struct platform_device *pdev) } irq = platform_get_irq(pdev, 0); - if (IS_ERR_VALUE(irq)) { + if (irq < 0) { ret = irq; dev_err(dev, "failed to get irq: %d\n", ret); return ret; From 9d29327d16d5add499f106c693d7ad89c9e52c22 Mon Sep 17 00:00:00 2001 From: Johan Fjeldtvedt Date: Tue, 30 Aug 2016 09:31:28 -0300 Subject: [PATCH 294/591] [media] pulse8-cec: some small fixes Fix some small things: - clean up setup function - use MSGEND instead of 0xfe - don't assign "return value" from cec_phys_addr to err, it has return type void. Signed-off-by: Johan Fjeldtvedt Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/pulse8-cec/pulse8-cec.c | 33 ++++++------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index e27eca307a38..cb6a2a3dcc68 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c @@ -266,7 +266,7 @@ static int pulse8_send(struct serio *serio, const u8 *command, u8 cmd_len) } } if (!err) - err = serio_write(serio, 0xfe); + err = serio_write(serio, MSGEND); return err; } @@ -331,40 +331,29 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, u8 *data = pulse8->data + 1; u8 cmd[2]; int err; + struct tm tm; + time_t date; pulse8->vers = 0; - cmd[0] = MSGCODE_PING; - err = pulse8_send_and_wait(pulse8, cmd, 1, - MSGCODE_COMMAND_ACCEPTED, 0); cmd[0] = MSGCODE_FIRMWARE_VERSION; - if (!err) - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 2); + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 2); if (err) return err; - pulse8->vers = (data[0] << 8) | data[1]; - dev_info(pulse8->dev, "Firmware version %04x\n", pulse8->vers); if (pulse8->vers < 2) return 0; cmd[0] = MSGCODE_GET_BUILDDATE; - if (!err) - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 4); - if (!err) { - time_t date = (data[0] << 24) | (data[1] << 16) | - (data[2] << 8) | data[3]; - struct tm tm; - - time_to_tm(date, 0, &tm); - - dev_info(pulse8->dev, "Firmware build date %04ld.%02d.%02d %02d:%02d:%02d\n", - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); - } + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 4); if (err) return err; + date = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; + time_to_tm(date, 0, &tm); + dev_info(pulse8->dev, "Firmware build date %04ld.%02d.%02d %02d:%02d:%02d\n", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); dev_dbg(pulse8->dev, "Persistent config:\n"); cmd[0] = MSGCODE_GET_AUTO_ENABLED; @@ -456,8 +445,6 @@ static int pulse8_apply_persistent_config(struct pulse8 *pulse8, return err; cec_s_phys_addr(pulse8->adap, pa, false); - if (err) - return err; return 0; } From e5872251cdf59ad284eb7ebb5960208d1753d9d8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 5 Sep 2016 10:09:17 -0300 Subject: [PATCH 295/591] [media] Revert "[media] tw5864: remove double irq lock code" This reverts commit 617e901a12ad ("[media] tw5864: remove double irq lock code"). That commit was rejected by Andrey Utkin , but it had already been merged. Revert and apply Andrey's corrected patch next. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw5864/tw5864-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/pci/tw5864/tw5864-core.c b/drivers/media/pci/tw5864/tw5864-core.c index e3d884e963c0..440cd7bb8d04 100644 --- a/drivers/media/pci/tw5864/tw5864-core.c +++ b/drivers/media/pci/tw5864/tw5864-core.c @@ -157,10 +157,12 @@ static void tw5864_h264_isr(struct tw5864_dev *dev) cur_frame = next_frame; + spin_lock_irqsave(&input->slock, flags); input->frame_seqno++; input->frame_gop_seqno++; if (input->frame_gop_seqno >= input->gop) input->frame_gop_seqno = 0; + spin_unlock_irqrestore(&input->slock, flags); } else { dev_err(&dev->pci->dev, "Skipped frame on input %d because all buffers busy\n", From 350649cc24358ab0cfff7179c06818d0cfef698b Mon Sep 17 00:00:00 2001 From: Andrey Utkin Date: Wed, 24 Aug 2016 20:17:18 -0300 Subject: [PATCH 296/591] [media] tw5864-core: remove excessive irqsave As warned by smatch: drivers/media/pci/tw5864/tw5864-core.c:160 tw5864_h264_isr() error: double lock 'irqsave:flags' drivers/media/pci/tw5864/tw5864-core.c:174 tw5864_h264_isr() error: double unlock 'irqsave:flags' Two different spinlocks are obtained, so having two calls is correct, but second irqsave is superfluous, and using same "flags" variable is just wrong. Reported-by: Mauro Carvalho Chehab Signed-off-by: Andrey Utkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw5864/tw5864-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/tw5864/tw5864-core.c b/drivers/media/pci/tw5864/tw5864-core.c index 440cd7bb8d04..1d43b96958ea 100644 --- a/drivers/media/pci/tw5864/tw5864-core.c +++ b/drivers/media/pci/tw5864/tw5864-core.c @@ -157,12 +157,12 @@ static void tw5864_h264_isr(struct tw5864_dev *dev) cur_frame = next_frame; - spin_lock_irqsave(&input->slock, flags); + spin_lock(&input->slock); input->frame_seqno++; input->frame_gop_seqno++; if (input->frame_gop_seqno >= input->gop) input->frame_gop_seqno = 0; - spin_unlock_irqrestore(&input->slock, flags); + spin_unlock(&input->slock); } else { dev_err(&dev->pci->dev, "Skipped frame on input %d because all buffers busy\n", From 66de877c95427ff8698adc3b29577b5186b76d13 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 5 Sep 2016 11:30:08 -0300 Subject: [PATCH 297/591] [media] vivid: update EDID Update the vivid EDID, fixing various incorrect values (wrong name, product code, various video capabilities). Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vivid/vivid-core.c | 56 +++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c index 7f937136c3f5..741460ab68ab 100644 --- a/drivers/media/platform/vivid/vivid-core.c +++ b/drivers/media/platform/vivid/vivid-core.c @@ -163,38 +163,38 @@ const struct v4l2_rect vivid_max_rect = { static const u8 vivid_hdmi_edid[256] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x63, 0x3a, 0xaa, 0x55, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x18, 0x01, 0x03, 0x80, 0x10, 0x09, 0x78, - 0x0e, 0x00, 0xb2, 0xa0, 0x57, 0x49, 0x9b, 0x26, - 0x10, 0x48, 0x4f, 0x2f, 0xcf, 0x00, 0x31, 0x59, + 0x31, 0xd8, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x1a, 0x01, 0x03, 0x80, 0x60, 0x36, 0x78, + 0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, + 0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, 0x45, 0x59, 0x81, 0x80, 0x81, 0x40, 0x90, 0x40, - 0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x02, 0x3a, - 0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c, - 0x46, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x1e, + 0x95, 0x00, 0xa9, 0x40, 0xb3, 0x00, 0x08, 0xe8, + 0x00, 0x30, 0xf2, 0x70, 0x5a, 0x80, 0xb0, 0x58, + 0x8a, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, - 0x5e, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 'v', - '4', 'l', '2', '-', 'h', 'd', 'm', 'i', - 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x10, + 0x87, 0x3c, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x76, + 0x69, 0x76, 0x69, 0x64, 0x0a, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7b, - 0x02, 0x03, 0x1a, 0xc0, 0x48, 0xa2, 0x10, 0x04, - 0x02, 0x01, 0x21, 0x14, 0x13, 0x23, 0x09, 0x07, - 0x07, 0x65, 0x03, 0x0c, 0x00, 0x10, 0x00, 0xe2, - 0x00, 0x2a, 0x01, 0x1d, 0x00, 0x80, 0x51, 0xd0, - 0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x1e, 0x8c, 0x0a, 0xd0, 0x8a, - 0x20, 0xe0, 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7 + 0x02, 0x03, 0x3f, 0xf0, 0x51, 0x61, 0x60, 0x5f, + 0x5e, 0x5d, 0x10, 0x1f, 0x04, 0x13, 0x22, 0x21, + 0x20, 0x05, 0x14, 0x02, 0x11, 0x01, 0x23, 0x09, + 0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x6d, 0x03, + 0x0c, 0x00, 0x10, 0x00, 0x00, 0x78, 0x21, 0x00, + 0x60, 0x01, 0x02, 0x03, 0x67, 0xd8, 0x5d, 0xc4, + 0x01, 0x78, 0x00, 0x00, 0xe2, 0x00, 0xea, 0xe3, + 0x05, 0x00, 0x00, 0xe3, 0x06, 0x01, 0x00, 0x4d, + 0xd0, 0x00, 0xa0, 0xf0, 0x70, 0x3e, 0x80, 0x30, + 0x20, 0x35, 0x00, 0xc0, 0x1c, 0x32, 0x00, 0x00, + 0x1e, 0x1a, 0x36, 0x80, 0xa0, 0x70, 0x38, 0x1f, + 0x40, 0x30, 0x20, 0x35, 0x00, 0xc0, 0x1c, 0x32, + 0x00, 0x00, 0x1a, 0x1a, 0x1d, 0x00, 0x80, 0x51, + 0xd0, 0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0xc0, + 0x1c, 0x32, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, }; static int vidioc_querycap(struct file *file, void *priv, From 036bbb8213ecca49799217f30497dc0484178e53 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 5 Sep 2016 11:30:39 -0300 Subject: [PATCH 298/591] [media] cobalt: update EDID Update the cobalt EDID, fixing various incorrect values (wrong name, product code, various video capabilities). Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cobalt/cobalt-driver.c | 47 ++++++++++++------------ 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c index 476f7f0dcf81..979634000597 100644 --- a/drivers/media/pci/cobalt/cobalt-driver.c +++ b/drivers/media/pci/cobalt/cobalt-driver.c @@ -60,30 +60,27 @@ MODULE_DESCRIPTION("cobalt driver"); MODULE_LICENSE("GPL"); static u8 edid[256] = { - 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, - 0x50, 0x21, 0x9C, 0x27, 0x00, 0x00, 0x00, 0x00, - 0x19, 0x12, 0x01, 0x03, 0x80, 0x00, 0x00, 0x78, - 0x0E, 0x00, 0xB2, 0xA0, 0x57, 0x49, 0x9B, 0x26, - 0x10, 0x48, 0x4F, 0x2F, 0xCF, 0x00, 0x31, 0x59, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x50, 0x21, 0x32, 0x27, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x1a, 0x01, 0x03, 0x80, 0x30, 0x1b, 0x78, + 0x0f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, + 0x0f, 0x50, 0x54, 0x2f, 0xcf, 0x00, 0x31, 0x59, 0x45, 0x59, 0x61, 0x59, 0x81, 0x99, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A, - 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, - 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, - 0x00, 0x00, 0x00, 0xFD, 0x00, 0x31, 0x55, 0x18, - 0x5E, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x43, - 0x20, 0x39, 0x30, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, - 0x0A, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x00, 0x10, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, + 0x80, 0x18, 0x71, 0x38, 0x2d, 0x40, 0x58, 0x2c, + 0x46, 0x00, 0xe0, 0x0e, 0x11, 0x00, 0x00, 0x1e, + 0x00, 0x00, 0x00, 0xfd, 0x00, 0x18, 0x55, 0x18, + 0x5e, 0x11, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x63, + 0x6f, 0x62, 0x61, 0x6c, 0x74, 0x0a, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x68, - 0x02, 0x03, 0x1a, 0xc0, 0x48, 0xa2, 0x10, 0x04, - 0x02, 0x01, 0x21, 0x14, 0x13, 0x23, 0x09, 0x07, - 0x07, 0x65, 0x03, 0x0c, 0x00, 0x10, 0x00, 0xe2, - 0x00, 0x2a, 0x01, 0x1d, 0x00, 0x80, 0x51, 0xd0, - 0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x1e, 0x8c, 0x0a, 0xd0, 0x8a, - 0x20, 0xe0, 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x9c, + + 0x02, 0x03, 0x1f, 0xf0, 0x4a, 0x90, 0x1f, 0x04, + 0x13, 0x22, 0x21, 0x20, 0x02, 0x11, 0x01, 0x23, + 0x09, 0x07, 0x07, 0x68, 0x03, 0x0c, 0x00, 0x10, + 0x00, 0x00, 0x22, 0x0f, 0xe2, 0x00, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -91,7 +88,11 @@ static u8 edid[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, }; static void cobalt_set_interrupt(struct cobalt *cobalt, bool enable) From c92bab5e1ef4e709001cec678fc7c8f9817a4b2e Mon Sep 17 00:00:00 2001 From: Jean-Christophe Trotin Date: Mon, 5 Sep 2016 11:06:28 -0300 Subject: [PATCH 299/591] [media] Documentation: DT: add bindings for ST HVA This patch adds DT binding documentation for STMicroelectronics hva driver. Signed-off-by: Yannick Fertre Signed-off-by: Jean-Christophe Trotin Acked-by: Peter Griffin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../devicetree/bindings/media/st,st-hva.txt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/st,st-hva.txt diff --git a/Documentation/devicetree/bindings/media/st,st-hva.txt b/Documentation/devicetree/bindings/media/st,st-hva.txt new file mode 100644 index 000000000000..0d76174a1f7e --- /dev/null +++ b/Documentation/devicetree/bindings/media/st,st-hva.txt @@ -0,0 +1,24 @@ +st-hva: multi-format video encoder for STMicroelectronics SoC. + +Required properties: +- compatible: should be "st,st-hva". +- reg: HVA physical address location and length, esram address location and + length. +- reg-names: names of the registers listed in registers property in the same + order. +- interrupts: HVA interrupt number. +- clocks: from common clock binding: handle hardware IP needed clocks, the + number of clocks may depend on the SoC type. + See ../clock/clock-bindings.txt for details. +- clock-names: names of the clocks listed in clocks property in the same order. + +Example: + hva@8c85000{ + compatible = "st,st-hva"; + reg = <0x8c85000 0x400>, <0x6000000 0x40000>; + reg-names = "hva_registers", "hva_esram"; + interrupts = , + ; + clock-names = "clk_hva"; + clocks = <&clk_s_c0_flexgen CLK_HVA>; + }; From bcec7c218d5aeb170d18c49a33f9bd36ddf9ee37 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 06:41:40 -0300 Subject: [PATCH 300/591] [media] docs-rst: parse-headers.pl: make debug a command line option Add a parser for the --debug option, in order to allow seeing what the parser is doing. Acked-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- Documentation/sphinx/parse-headers.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Documentation/sphinx/parse-headers.pl b/Documentation/sphinx/parse-headers.pl index 74089b0da798..531c710fc73f 100755 --- a/Documentation/sphinx/parse-headers.pl +++ b/Documentation/sphinx/parse-headers.pl @@ -2,12 +2,18 @@ use strict; use Text::Tabs; -# Uncomment if debug is needed -#use Data::Dumper; - -# change to 1 to generate some debug prints my $debug = 0; +while ($ARGV[0] =~ m/^-(.*)/) { + my $cmd = shift @ARGV; + if ($cmd eq "--debug") { + require Data::Dumper; + $debug = 1; + next; + } + die "argument $cmd unknown"; +} + if (scalar @ARGV < 2 || scalar @ARGV > 3) { die "Usage:\n\t$0 []\n"; } From 22c4003364437b4a3ddd36bd19b2080f1a20d372 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 06:44:21 -0300 Subject: [PATCH 301/591] [media] docs-rst: parse-headers.pl: use the C domain for cross-references Instead of keep using the normal reference, move to the C domain ones. Using C domains everywhere will allow cross-references between kAPI and uAPI docs. Acked-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- Documentation/sphinx/parse-headers.pl | 113 ++++++++++++++------------ 1 file changed, 59 insertions(+), 54 deletions(-) diff --git a/Documentation/sphinx/parse-headers.pl b/Documentation/sphinx/parse-headers.pl index 531c710fc73f..db0186a7618f 100755 --- a/Documentation/sphinx/parse-headers.pl +++ b/Documentation/sphinx/parse-headers.pl @@ -57,7 +57,7 @@ while () { $n =~ tr/A-Z/a-z/; $n =~ tr/_/-/; - $enum_symbols{$s} = $n; + $enum_symbols{$s} = "\\ :ref:`$s <$n>`\\ "; $is_enum = 0 if ($is_enum && m/\}/); next; @@ -69,7 +69,7 @@ while () { my $n = $1; $n =~ tr/A-Z/a-z/; - $ioctls{$s} = $n; + $ioctls{$s} = "\\ :ref:`$s <$n>`\\ "; next; } @@ -79,17 +79,15 @@ while () { $n =~ tr/A-Z/a-z/; $n =~ tr/_/-/; - $defines{$s} = $n; + $defines{$s} = "\\ :ref:`$s <$n>`\\ "; next; } - if ($ln =~ m/^\s*typedef\s+.*\s+([_\w][\w\d_]+);/) { - my $s = $1; - my $n = $1; - $n =~ tr/A-Z/a-z/; - $n =~ tr/_/-/; + if ($ln =~ m/^\s*typedef\s+([_\w][\w\d_]+)\s+(.*)\s+([_\w][\w\d_]+);/) { + my $s = $2; + my $n = $3; - $typedefs{$s} = $n; + $typedefs{$n} = "\\ :c:type:`$n <$s>`\\ "; next; } if ($ln =~ m/^\s*enum\s+([_\w][\w\d_]+)\s+\{/ @@ -97,11 +95,8 @@ while () { || $ln =~ m/^\s*typedef\s*enum\s+([_\w][\w\d_]+)\s+\{/ || $ln =~ m/^\s*typedef\s*enum\s+([_\w][\w\d_]+)$/) { my $s = $1; - my $n = $1; - $n =~ tr/A-Z/a-z/; - $n =~ tr/_/-/; - $enums{$s} = $n; + $enums{$s} = "enum :c:type:`$s`\\ "; $is_enum = $1; next; @@ -112,11 +107,8 @@ while () { || $ln =~ m/^\s*typedef\s*struct\s+([[_\w][\w\d_]+)$/ ) { my $s = $1; - my $n = $1; - $n =~ tr/A-Z/a-z/; - $n =~ tr/_/-/; - $structs{$s} = $n; + $structs{$s} = "struct :c:type:`$s`\\ "; next; } } @@ -129,12 +121,9 @@ close IN; my @matches = ($data =~ m/typedef\s+struct\s+\S+?\s*\{[^\}]+\}\s*(\S+)\s*\;/g, $data =~ m/typedef\s+enum\s+\S+?\s*\{[^\}]+\}\s*(\S+)\s*\;/g,); foreach my $m (@matches) { - my $s = $m; - my $n = $m; - $n =~ tr/A-Z/a-z/; - $n =~ tr/_/-/; + my $s = $m; - $typedefs{$s} = $n; + $typedefs{$s} = "\\ :c:type:`$s`\\ "; next; } @@ -142,6 +131,15 @@ foreach my $m (@matches) { # Handle exceptions, if any # +my %def_reftype = ( + "ioctl" => ":ref", + "define" => ":ref", + "symbol" => ":ref", + "typedef" => ":c:type", + "enum" => ":c:type", + "struct" => ":c:type", +); + if ($file_exceptions) { open IN, $file_exceptions or die "Can't read $file_exceptions"; while () { @@ -175,29 +173,49 @@ if ($file_exceptions) { } # Parsers to replace a symbol + my ($type, $old, $new, $reftype); - if (m/^replace\s+ioctl\s+(\S+)\s+(\S+)/) { - $ioctls{$1} = $2 if (exists($ioctls{$1})); + if (m/^replace\s+(\S+)\s+(\S+)\s+(\S+)/) { + $type = $1; + $old = $2; + $new = $3; + } else { + die "Can't parse $file_exceptions: $_"; + } + + if ($new =~ m/^\:c\:(data|func|macro|type)\:\`(.+)\`/) { + $reftype = ":c:$1"; + $new = $2; + } elsif ($new =~ m/\:ref\:\`(.+)\`/) { + $reftype = ":ref"; + $new = $1; + } else { + $reftype = $def_reftype{$type}; + } + $new = "$reftype:`$old <$new>`"; + + if ($type eq "ioctl") { + $ioctls{$old} = $new if (exists($ioctls{$old})); next; } - if (m/^replace\s+define\s+(\S+)\s+(\S+)/) { - $defines{$1} = $2 if (exists($defines{$1})); + if ($type eq "define") { + $defines{$old} = $new if (exists($defines{$old})); next; } - if (m/^replace\s+typedef\s+(\S+)\s+(\S+)/) { - $typedefs{$1} = $2 if (exists($typedefs{$1})); + if ($type eq "symbol") { + $enum_symbols{$old} = $new if (exists($enum_symbols{$old})); next; } - if (m/^replace\s+enum\s+(\S+)\s+(\S+)/) { - $enums{$1} = $2 if (exists($enums{$1})); + if ($type eq "typedef") { + $typedefs{$old} = $new if (exists($typedefs{$old})); next; } - if (m/^replace\s+symbol\s+(\S+)\s+(\S+)/) { - $enum_symbols{$1} = $2 if (exists($enum_symbols{$1})); + if ($type eq "enum") { + $enums{$old} = $new if (exists($enums{$old})); next; } - if (m/^replace\s+struct\s+(\S+)\s+(\S+)/) { - $structs{$1} = $2 if (exists($structs{$1})); + if ($type eq "struct") { + $structs{$old} = $new if (exists($structs{$old})); next; } @@ -238,9 +256,7 @@ my $start_delim = "[ \n\t\(\=\*\@]"; my $end_delim = "(\\s|,|\\\\=|\\\\:|\\;|\\\)|\\}|\\{)"; foreach my $r (keys %ioctls) { - my $n = $ioctls{$r}; - - my $s = "\\ :ref:`$r <$n>`\\ "; + my $s = $ioctls{$r}; $r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g; @@ -250,9 +266,7 @@ foreach my $r (keys %ioctls) { } foreach my $r (keys %defines) { - my $n = $defines{$r}; - - my $s = "\\ :ref:`$r <$n>`\\ "; + my $s = $defines{$r}; $r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g; @@ -262,9 +276,7 @@ foreach my $r (keys %defines) { } foreach my $r (keys %enum_symbols) { - my $n = $enum_symbols{$r}; - - my $s = "\\ :ref:`$r <$n>`\\ "; + my $s = $enum_symbols{$r}; $r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g; @@ -274,9 +286,7 @@ foreach my $r (keys %enum_symbols) { } foreach my $r (keys %enums) { - my $n = $enums{$r}; - - my $s = "\\ :ref:`enum $r <$n>`\\ "; + my $s = $enums{$r}; $r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g; @@ -286,9 +296,7 @@ foreach my $r (keys %enums) { } foreach my $r (keys %structs) { - my $n = $structs{$r}; - - my $s = "\\ :ref:`struct $r <$n>`\\ "; + my $s = $structs{$r}; $r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g; @@ -298,18 +306,15 @@ foreach my $r (keys %structs) { } foreach my $r (keys %typedefs) { - my $n = $typedefs{$r}; - - my $s = "\\ :ref:`$r <$n>`\\ "; + my $s = $typedefs{$r}; $r =~ s,([\_\`\*\<\>\&\\\\:\/]),\\\\$1,g; print "$r -> $s\n" if ($debug); - $data =~ s/($start_delim)($r)$end_delim/$1$s$3/g; } -$data =~ s/\\ \n/\n/g; +$data =~ s/\\ ([\n\s])/\1/g; # # Generate output file From b3ef4445fccb169480c0b6ea76e8b36c94af2a16 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 08:39:47 -0300 Subject: [PATCH 302/591] [media] conf_nitpick.py: add external vars to ignore list There a some other types and functions that aren't declared inside the media document but are elsewhere. Add them to the ignore list. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/conf_nitpick.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Documentation/media/conf_nitpick.py b/Documentation/media/conf_nitpick.py index 227deee68c88..4de9533ce361 100644 --- a/Documentation/media/conf_nitpick.py +++ b/Documentation/media/conf_nitpick.py @@ -21,8 +21,11 @@ nitpick_ignore = [ ("c:func", "clock_gettime"), ("c:func", "close"), ("c:func", "container_of"), + ("c:func", "copy_from_user"), + ("c:func", "copy_to_user"), ("c:func", "determine_valid_ioctls"), ("c:func", "ERR_PTR"), + ("c:func", "i2c_new_device"), ("c:func", "ioctl"), ("c:func", "IS_ERR"), ("c:func", "mmap"), @@ -37,6 +40,7 @@ nitpick_ignore = [ ("c:func", "struct pollfd"), ("c:func", "usb_make_path"), ("c:func", "write"), + ("c:type", "atomic_t"), ("c:type", "bool"), ("c:type", "boolean"), @@ -72,10 +76,10 @@ nitpick_ignore = [ ("c:type", "spi_device"), ("c:type", "spi_master"), ("c:type", "ssize_t"), - ("c:type", "struct fb_fix_screeninfo"), - ("c:type", "struct pollfd"), - ("c:type", "struct timeval"), - ("c:type", "struct video_capability"), + ("c:type", "fb_fix_screeninfo"), + ("c:type", "pollfd"), + ("c:type", "timeval"), + ("c:type", "video_capability"), ("c:type", "timeval"), ("c:type", "__u16"), ("c:type", "u16"), @@ -87,6 +91,7 @@ nitpick_ignore = [ ("c:type", "uint16_t"), ("c:type", "uint32_t"), ("c:type", "union"), + ("c:type", "__user"), ("c:type", "usb_device"), ("c:type", "video_system_t"), ] From ff54c19d8e8fcfd9f660bf849b0e92f8c69cc0c2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 08:38:01 -0300 Subject: [PATCH 303/591] [media] dvb_ringbuffer.h: Document all functions There are several functions there there weren't properly documented. Add documentation for them. While here, make checkpatch.pl happier. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/dvb_ringbuffer.h | 179 ++++++++++++++++++------ 1 file changed, 134 insertions(+), 45 deletions(-) diff --git a/drivers/media/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb-core/dvb_ringbuffer.h index 8af642399f1e..8209eb4db2aa 100644 --- a/drivers/media/dvb-core/dvb_ringbuffer.h +++ b/drivers/media/dvb-core/dvb_ringbuffer.h @@ -18,10 +18,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _DVB_RINGBUFFER_H_ @@ -30,6 +26,18 @@ #include #include +/** + * struct dvb_ringbuffer - Describes a ring buffer used at DVB framework + * + * @data: Area were the ringbuffer data is written + * @size: size of the ringbuffer + * @pread: next position to read + * @pwrite: next position to write + * @error: used by ringbuffer clients to indicate that an error happened. + * @queue: Wait queue used by ringbuffer clients to indicate when buffer + * was filled + * @lock: Spinlock used to protect the ringbuffer + */ struct dvb_ringbuffer { u8 *data; ssize_t size; @@ -43,7 +51,21 @@ struct dvb_ringbuffer { #define DVB_RINGBUFFER_PKTHDRSIZE 3 +/** + * dvb_ringbuffer_init - initialize ring buffer, lock and queue + * + * @rbuf: pointer to struct dvb_ringbuffer + * @data: pointer to the buffer where the data will be stored + * @len: bytes from ring buffer into @buf + */ +extern void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, + size_t len); +/** + * dvb_ringbuffer_empty - test whether buffer is empty + * + * @rbuf: pointer to struct dvb_ringbuffer + */ /* * Notes: * ------ @@ -72,69 +94,133 @@ struct dvb_ringbuffer { * Resetting the buffer counts as a read and write operation. * Two or more writers must be locked against each other. */ - -/* initialize ring buffer, lock and queue */ -extern void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len); - -/* test whether buffer is empty */ extern int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf); -/* return the number of free bytes in the buffer */ +/** + * dvb_ringbuffer_free - returns the number of free bytes in the buffer + * + * @rbuf: pointer to struct dvb_ringbuffer + * + * Return: number of free bytes in the buffer + */ extern ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf); -/* return the number of bytes waiting in the buffer */ +/** + * dvb_ringbuffer_avail - returns the number of bytes waiting in the buffer + * + * @rbuf: pointer to struct dvb_ringbuffer + * + * Return: number of bytes waiting in the buffer + */ extern ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf); - -/* - * Reset the read and write pointers to zero and flush the buffer +/** + * dvb_ringbuffer_reset - resets the ringbuffer to initial state + * + * @rbuf: pointer to struct dvb_ringbuffer + * + * Resets the read and write pointers to zero and flush the buffer. + * * This counts as a read and write operation */ extern void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf); -/* read routines & macros */ -/* ---------------------- */ -/* flush buffer */ +/* + * read routines & macros + */ + +/** + * dvb_ringbuffer_flush - flush buffer + * + * @rbuf: pointer to struct dvb_ringbuffer + */ extern void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf); -/* flush buffer protected by spinlock and wake-up waiting task(s) */ +/** + * dvb_ringbuffer_flush_spinlock_wakeup- flush buffer protected by spinlock + * and wake-up waiting task(s) + * + * @rbuf: pointer to struct dvb_ringbuffer + */ extern void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf); -/* peek at byte @offs: in the buffer */ -#define DVB_RINGBUFFER_PEEK(rbuf,offs) \ - (rbuf)->data[((rbuf)->pread+(offs))%(rbuf)->size] +/* DVB_RINGBUFFER_PEEK - peek at byte @offs: in the buffer */ +#define DVB_RINGBUFFER_PEEK(rbuf, offs) \ + (rbuf)->data[((rbuf)->pread + (offs)) % (rbuf)->size] /* advance read ptr by @num: bytes */ -#define DVB_RINGBUFFER_SKIP(rbuf,num) \ - (rbuf)->pread=((rbuf)->pread+(num))%(rbuf)->size +#define DVB_RINGBUFFER_SKIP(rbuf, num) {\ + (rbuf)->pread = ((rbuf)->pread + (num)) % (rbuf)->size;\ +} -/* - * read @len: bytes from ring buffer into @buf: - * @usermem: specifies whether @buf: resides in user space - * returns number of bytes transferred or -EFAULT +/** + * dvb_ringbuffer_read_user - Reads a buffer into an user pointer + * + * @rbuf: pointer to struct dvb_ringbuffer + * @buf: pointer to the buffer where the data will be stored + * @len: bytes from ring buffer into @buf + * + * This variant assumes that the buffer is a memory at the userspace. So, + * it will internally call copy_to_user(). + * + * Return: number of bytes transferred or -EFAULT */ extern ssize_t dvb_ringbuffer_read_user(struct dvb_ringbuffer *rbuf, u8 __user *buf, size_t len); + +/** + * dvb_ringbuffer_read - Reads a buffer into a pointer + * + * @rbuf: pointer to struct dvb_ringbuffer + * @buf: pointer to the buffer where the data will be stored + * @len: bytes from ring buffer into @buf + * + * This variant assumes that the buffer is a memory at the Kernel space + * + * Return: number of bytes transferred or -EFAULT + */ extern void dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len); -/* write routines & macros */ -/* ----------------------- */ -/* write single byte to ring buffer */ -#define DVB_RINGBUFFER_WRITE_BYTE(rbuf,byte) \ - { (rbuf)->data[(rbuf)->pwrite]=(byte); \ - (rbuf)->pwrite=((rbuf)->pwrite+1)%(rbuf)->size; } /* - * write @len: bytes to ring buffer - * @usermem: specifies whether @buf: resides in user space - * returns number of bytes transferred or -EFAULT -*/ + * write routines & macros + */ + +/* write single byte to ring buffer */ +#define DVB_RINGBUFFER_WRITE_BYTE(rbuf, byte) \ + { (rbuf)->data[(rbuf)->pwrite] = (byte); \ + (rbuf)->pwrite = ((rbuf)->pwrite + 1) % (rbuf)->size; } + +/** + * dvb_ringbuffer_write - Writes a buffer into the ringbuffer + * + * @rbuf: pointer to struct dvb_ringbuffer + * @buf: pointer to the buffer where the data will be read + * @len: bytes from ring buffer into @buf + * + * This variant assumes that the buffer is a memory at the Kernel space + * + * return: number of bytes transferred or -EFAULT + */ extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len); + +/** + * dvb_ringbuffer_writeuser - Writes a buffer received via an user pointer + * + * @rbuf: pointer to struct dvb_ringbuffer + * @buf: pointer to the buffer where the data will be read + * @len: bytes from ring buffer into @buf + * + * This variant assumes that the buffer is a memory at the userspace. So, + * it will internally call copy_from_user(). + * + * Return: number of bytes transferred or -EFAULT + */ extern ssize_t dvb_ringbuffer_write_user(struct dvb_ringbuffer *rbuf, - const u8 __user *buf, size_t len); + const u8 __user *buf, size_t len); /** @@ -143,9 +229,10 @@ extern ssize_t dvb_ringbuffer_write_user(struct dvb_ringbuffer *rbuf, * @rbuf: Ringbuffer to write to. * @buf: Buffer to write. * @len: Length of buffer (currently limited to 65535 bytes max). - * returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL. + * + * Return: Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL. */ -extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, +extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len); /** @@ -157,7 +244,7 @@ extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, * @buf: Destination buffer for data. * @len: Size of destination buffer. * - * returns Number of bytes read, or -EFAULT. + * Return: Number of bytes read, or -EFAULT. * * .. note:: * @@ -167,7 +254,7 @@ extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, */ extern ssize_t dvb_ringbuffer_pkt_read_user(struct dvb_ringbuffer *rbuf, size_t idx, - int offset, u8 __user *buf, + int offset, u8 __user *buf, size_t len); /** @@ -181,7 +268,7 @@ extern ssize_t dvb_ringbuffer_pkt_read_user(struct dvb_ringbuffer *rbuf, * @buf: Destination buffer for data. * @len: Size of destination buffer. * - * returns Number of bytes read, or -EFAULT. + * Return: Number of bytes read, or -EFAULT. */ extern ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx, int offset, u8 *buf, size_t len); @@ -199,10 +286,12 @@ extern void dvb_ringbuffer_pkt_dispose(struct dvb_ringbuffer *rbuf, size_t idx); * * @rbuf: Ringbuffer concerned. * @idx: Previous packet index, or -1 to return the first packet index. - * @pktlen: On success, will be updated to contain the length of the packet in bytes. + * @pktlen: On success, will be updated to contain the length of the packet + * in bytes. * returns Packet index (if >=0), or -1 if no packets available. */ -extern ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t* pktlen); +extern ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, + size_t idx, size_t *pktlen); #endif /* _DVB_RINGBUFFER_H_ */ From b6df512a9f9580abc07cd1963ced91b5a87619ed Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 08:39:32 -0300 Subject: [PATCH 304/591] [media] dtv-core.rst: move DTV ringbuffer notes to kAPI doc Instead of keeping those notes at the file on a non-structured way, move them to dtv-core.rst, using the proper ReST tags. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/dtv-core.rst | 38 +++++++++++++++++++++++-- drivers/media/dvb-core/dvb_ringbuffer.h | 28 ------------------ 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/Documentation/media/kapi/dtv-core.rst b/Documentation/media/kapi/dtv-core.rst index 41df9f144fcb..a3c4642eabfc 100644 --- a/Documentation/media/kapi/dtv-core.rst +++ b/Documentation/media/kapi/dtv-core.rst @@ -6,8 +6,6 @@ Digital TV Common functions .. kernel-doc:: drivers/media/dvb-core/dvb_math.h -.. kernel-doc:: drivers/media/dvb-core/dvb_ringbuffer.h - .. kernel-doc:: drivers/media/dvb-core/dvbdev.h @@ -18,6 +16,42 @@ Digital TV Common functions .. kernel-doc:: drivers/media/dvb-core/dvbdev.h :export: drivers/media/dvb-core/dvbdev.c +Digital TV Ring buffer +---------------------- + +Those routines implement ring buffers used to handle digital TV data and +copy it from/to userspace. + +.. note:: + + 1) For performance reasons read and write routines don't check buffer sizes + and/or number of bytes free/available. This has to be done before these + routines are called. For example: + + .. code-block:: c + + /* write @buflen: bytes */ + free = dvb_ringbuffer_free(rbuf); + if (free >= buflen) + count = dvb_ringbuffer_write(rbuf, buffer, buflen); + else + /* do something */ + + /* read min. 1000, max. @bufsize: bytes */ + avail = dvb_ringbuffer_avail(rbuf); + if (avail >= 1000) + count = dvb_ringbuffer_read(rbuf, buffer, min(avail, bufsize)); + else + /* do something */ + + 2) If there is exactly one reader and one writer, there is no need + to lock read or write operations. + Two or more readers must be locked against each other. + Flushing the buffer counts as a read operation. + Resetting the buffer counts as a read and write operation. + Two or more writers must be locked against each other. + +.. kernel-doc:: drivers/media/dvb-core/dvb_ringbuffer.h Digital TV Frontend kABI diff --git a/drivers/media/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb-core/dvb_ringbuffer.h index 8209eb4db2aa..f64bd86fe5fd 100644 --- a/drivers/media/dvb-core/dvb_ringbuffer.h +++ b/drivers/media/dvb-core/dvb_ringbuffer.h @@ -66,34 +66,6 @@ extern void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, * * @rbuf: pointer to struct dvb_ringbuffer */ -/* - * Notes: - * ------ - * (1) For performance reasons read and write routines don't check buffer sizes - * and/or number of bytes free/available. This has to be done before these - * routines are called. For example: - * - * *** write @buflen: bytes *** - * free = dvb_ringbuffer_free(rbuf); - * if (free >= buflen) - * count = dvb_ringbuffer_write(rbuf, buffer, buflen); - * else - * ... - * - * *** read min. 1000, max. @bufsize: bytes *** - * avail = dvb_ringbuffer_avail(rbuf); - * if (avail >= 1000) - * count = dvb_ringbuffer_read(rbuf, buffer, min(avail, bufsize)); - * else - * ... - * - * (2) If there is exactly one reader and one writer, there is no need - * to lock read or write operations. - * Two or more readers must be locked against each other. - * Flushing the buffer counts as a read operation. - * Resetting the buffer counts as a read and write operation. - * Two or more writers must be locked against each other. - */ extern int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf); /** From 9aa9d9289037faa4fefead06ff948972b10cc64f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 10:01:06 -0300 Subject: [PATCH 305/591] [media] dvb_ringbuffer.h: document the define macros There are a few define macros not documented, because the ReST output was causing more warnings. Now that this got fixed, document them. While here, fix the remaining coding style issues. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/dvb_ringbuffer.h | 27 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb-core/dvb_ringbuffer.h index f64bd86fe5fd..eae3f091b6a0 100644 --- a/drivers/media/dvb-core/dvb_ringbuffer.h +++ b/drivers/media/dvb-core/dvb_ringbuffer.h @@ -97,7 +97,6 @@ extern ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf); */ extern void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf); - /* * read routines & macros */ @@ -117,11 +116,21 @@ extern void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf); */ extern void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf); -/* DVB_RINGBUFFER_PEEK - peek at byte @offs: in the buffer */ +/** + * DVB_RINGBUFFER_PEEK - peek at byte @offs in the buffer + * + * @rbuf: pointer to struct dvb_ringbuffer + * @offs: offset inside the ringbuffer + */ #define DVB_RINGBUFFER_PEEK(rbuf, offs) \ - (rbuf)->data[((rbuf)->pread + (offs)) % (rbuf)->size] + ((rbuf)->data[((rbuf)->pread + (offs)) % (rbuf)->size]) -/* advance read ptr by @num: bytes */ +/** + * DVB_RINGBUFFER_SKIP - advance read ptr by @num bytes + * + * @rbuf: pointer to struct dvb_ringbuffer + * @num: number of bytes to advance + */ #define DVB_RINGBUFFER_SKIP(rbuf, num) {\ (rbuf)->pread = ((rbuf)->pread + (num)) % (rbuf)->size;\ } @@ -155,12 +164,16 @@ extern ssize_t dvb_ringbuffer_read_user(struct dvb_ringbuffer *rbuf, extern void dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len); - /* * write routines & macros */ -/* write single byte to ring buffer */ +/** + * DVB_RINGBUFFER_WRITE_BYTE - write single byte to ring buffer + * + * @rbuf: pointer to struct dvb_ringbuffer + * @byte: byte to write + */ #define DVB_RINGBUFFER_WRITE_BYTE(rbuf, byte) \ { (rbuf)->data[(rbuf)->pwrite] = (byte); \ (rbuf)->pwrite = ((rbuf)->pwrite + 1) % (rbuf)->size; } @@ -194,7 +207,6 @@ extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, extern ssize_t dvb_ringbuffer_write_user(struct dvb_ringbuffer *rbuf, const u8 __user *buf, size_t len); - /** * dvb_ringbuffer_pkt_write - Write a packet into the ringbuffer. * @@ -265,5 +277,4 @@ extern void dvb_ringbuffer_pkt_dispose(struct dvb_ringbuffer *rbuf, size_t idx); extern ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t *pktlen); - #endif /* _DVB_RINGBUFFER_H_ */ From bb501b76c7cbafa278f8edec9622c861a9fc67bd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 10:05:49 -0300 Subject: [PATCH 306/591] [media] demux.h: Fix a few documentation issues demux.h was lacking documentation for the DMX_FE_ENTRY macro: ./drivers/media/dvb-core/demux.h:511: WARNING: c:func reference target not found: DMX_FE_ENTRY While here, get rid of unused parameters and fix a few minor issues at the header file. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/demux.h | 36 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/media/dvb-core/demux.h b/drivers/media/dvb-core/demux.h index 4b4c1da20f4b..0d9c53518be2 100644 --- a/drivers/media/dvb-core/demux.h +++ b/drivers/media/dvb-core/demux.h @@ -202,7 +202,7 @@ struct dmx_section_feed { * * This function callback prototype, provided by the client of the demux API, * is called from the demux code. The function is only called when filtering - * on ae TS feed has been enabled using the start_filtering() function at + * on a TS feed has been enabled using the start_filtering\(\) function at * the &dmx_demux. * Any TS packets that match the filter settings are copied to a circular * buffer. The filtered TS packets are delivered to the client using this @@ -243,8 +243,10 @@ struct dmx_section_feed { * will also be sent to the hardware MPEG decoder. * * Return: - * 0, on success; - * -EOVERFLOW, on buffer overflow. + * + * - 0, on success; + * + * - -EOVERFLOW, on buffer overflow. */ typedef int (*dmx_ts_cb)(const u8 *buffer1, size_t buffer1_length, @@ -293,9 +295,9 @@ typedef int (*dmx_section_cb)(const u8 *buffer1, size_t buffer2_len, struct dmx_section_filter *source); -/*--------------------------------------------------------------------------*/ -/* DVB Front-End */ -/*--------------------------------------------------------------------------*/ +/* + * DVB Front-End + */ /** * enum dmx_frontend_source - Used to identify the type of frontend @@ -349,15 +351,15 @@ enum dmx_demux_caps { /* * Demux resource type identifier. -*/ - -/* - * DMX_FE_ENTRY(): Casts elements in the list of registered - * front-ends from the generic type struct list_head - * to the type * struct dmx_frontend - *. -*/ + */ +/** + * DMX_FE_ENTRY - Casts elements in the list of registered + * front-ends from the generic type struct list_head + * to the type * struct dmx_frontend + * + * @list: list of struct dmx_frontend + */ #define DMX_FE_ENTRY(list) \ list_entry(list, struct dmx_frontend, connectivity_list) @@ -551,7 +553,6 @@ enum dmx_demux_caps { * 0 on success; * -EINVAL on bad parameter. */ - struct dmx_demux { enum dmx_demux_caps capabilities; struct dmx_frontend *frontend; @@ -581,11 +582,6 @@ struct dmx_demux { int (*get_pes_pids)(struct dmx_demux *demux, u16 *pids); - /* private: Not used upstream and never documented */ -#if 0 - int (*get_caps)(struct dmx_demux *demux, struct dmx_caps *caps); - int (*set_source)(struct dmx_demux *demux, const dmx_source_t *src); -#endif /* * private: Only used at av7110, to read some data from firmware. * As this was never documented, we have no clue about what's From 3c7d91eff7dc9477a00b8c692ffa0ccf9e84517d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 16:03:00 -0300 Subject: [PATCH 307/591] [media] mc-core.rst: Fix cross-references to the source The cross-reference to "struct media_pad" was pointing to a place that doesn't exist. Fix it, and adjust the second reference on the same paragraph to use the same text. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/mc-core.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/media/kapi/mc-core.rst b/Documentation/media/kapi/mc-core.rst index 569cfc4f01cd..fb839a6c1f46 100644 --- a/Documentation/media/kapi/mc-core.rst +++ b/Documentation/media/kapi/mc-core.rst @@ -85,8 +85,9 @@ a driver-specific structure. Pads are identified by their entity and their 0-based index in the pads array. -Both information are stored in the :c:type:`struct media_pad`, making the -:c:type:`media_pad` pointer the canonical way to store and pass link references. +Both information are stored in the :c:type:`struct media_pad `, +making the :c:type:`struct media_pad ` pointer the canonical way +to store and pass link references. Pads have flags that describe the pad capabilities and state. From 36aefa35f4bfab4c40f2445864e4fcb445d0d09d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 16:04:01 -0300 Subject: [PATCH 308/591] [media] demux.h: fix a documentation warning The kernel-doc parser didn't handle well the private: tag. Rewrite it. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/demux.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-core/demux.h b/drivers/media/dvb-core/demux.h index 0d9c53518be2..aeda2b64931c 100644 --- a/drivers/media/dvb-core/demux.h +++ b/drivers/media/dvb-core/demux.h @@ -582,10 +582,12 @@ struct dmx_demux { int (*get_pes_pids)(struct dmx_demux *demux, u16 *pids); + /* private: */ + /* - * private: Only used at av7110, to read some data from firmware. - * As this was never documented, we have no clue about what's - * there, and its usage on other drivers aren't encouraged. + * Only used at av7110, to read some data from firmware. + * As this was never documented, we have no clue about what's + * there, and its usage on other drivers aren't encouraged. */ int (*get_stc)(struct dmx_demux *demux, unsigned int num, u64 *stc, unsigned int *base); From 48a7c4bac94dfb367d1d64123b5182536912c03e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 16:09:11 -0300 Subject: [PATCH 309/591] [media] docs-rst: improve the kAPI documentation for the mediactl There are several issues on the documentation: - the media.h header were not properly referenced; - verbatim expressions were not properly marked as such; - struct member references were wrong; - some notes were not using the right markup; - a comment that were moved to the kernel-doc markup were duplicated as a comment inside the struct media_entity; - some args were not pointing to the struct they're using; - macros weren't documented. Signed-off-by: Mauro Carvalho Chehab --- include/media/media-device.h | 115 +++++++++++------ include/media/media-devnode.h | 2 +- include/media/media-entity.h | 237 ++++++++++++++++++++++------------ 3 files changed, 231 insertions(+), 123 deletions(-) diff --git a/include/media/media-device.h b/include/media/media-device.h index 28195242386c..481dd6c672cb 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -53,7 +53,7 @@ struct media_entity_notify { * @dev: Parent device * @devnode: Media device node * @driver_name: Optional device driver name. If not set, calls to - * %MEDIA_IOC_DEVICE_INFO will return dev->driver->name. + * %MEDIA_IOC_DEVICE_INFO will return ``dev->driver->name``. * This is needed for USB drivers for example, as otherwise * they'll all appear as if the driver name was "usb". * @model: Device model name @@ -102,16 +102,18 @@ struct media_entity_notify { * sink entity and deactivate the link between them. Drivers * should call this handler to release the source. * - * Note: Bridge driver is expected to implement and set the - * handler when media_device is registered or when - * bridge driver finds the media_device during probe. - * Bridge driver sets source_priv with information - * necessary to run enable/disable source handlers. - * * Use-case: find tuner entity connected to the decoder * entity and check if it is available, and activate the - * the link between them from enable_source and deactivate - * from disable_source. + * the link between them from @enable_source and deactivate + * from @disable_source. + * + * .. note:: + * + * Bridge driver is expected to implement and set the + * handler when &media_device is registered or when + * bridge driver finds the media_device during probe. + * Bridge driver sets source_priv with information + * necessary to run @enable_source and @disable_source handlers. */ struct media_device { /* dev->driver_data points to this struct. */ @@ -168,7 +170,7 @@ struct usb_device; * @ent_enum: Entity enumeration to be initialised * @mdev: The related media device * - * Returns zero on success or a negative error code. + * Return: zero on success or a negative error code. */ static inline __must_check int media_entity_enum_init( struct media_entity_enum *ent_enum, struct media_device *mdev) @@ -211,36 +213,38 @@ void media_device_cleanup(struct media_device *mdev); * * Users, should, instead, call the media_device_register() macro. * - * The caller is responsible for initializing the media_device structure before - * registration. The following fields must be set: + * The caller is responsible for initializing the &media_device structure + * before registration. The following fields of &media_device must be set: * - * - dev must point to the parent device (usually a &pci_dev, &usb_interface or - * &platform_device instance). + * - &media_entity.dev must point to the parent device (usually a &pci_dev, + * &usb_interface or &platform_device instance). * - * - model must be filled with the device model name as a NUL-terminated UTF-8 - * string. The device/model revision must not be stored in this field. + * - &media_entity.model must be filled with the device model name as a + * NUL-terminated UTF-8 string. The device/model revision must not be + * stored in this field. * * The following fields are optional: * - * - serial is a unique serial number stored as a NUL-terminated ASCII string. - * The field is big enough to store a GUID in text form. If the hardware - * doesn't provide a unique serial number this field must be left empty. + * - &media_entity.serial is a unique serial number stored as a + * NUL-terminated ASCII string. The field is big enough to store a GUID + * in text form. If the hardware doesn't provide a unique serial number + * this field must be left empty. * - * - bus_info represents the location of the device in the system as a - * NUL-terminated ASCII string. For PCI/PCIe devices bus_info must be set to - * "PCI:" (or "PCIe:") followed by the value of pci_name(). For USB devices, - * the usb_make_path() function must be used. This field is used by - * applications to distinguish between otherwise identical devices that don't - * provide a serial number. + * - &media_entity.bus_info represents the location of the device in the + * system as a NUL-terminated ASCII string. For PCI/PCIe devices + * &media_entity.bus_info must be set to "PCI:" (or "PCIe:") followed by + * the value of pci_name(). For USB devices,the usb_make_path() function + * must be used. This field is used by applications to distinguish between + * otherwise identical devices that don't provide a serial number. * - * - hw_revision is the hardware device revision in a driver-specific format. - * When possible the revision should be formatted with the KERNEL_VERSION - * macro. + * - &media_entity.hw_revision is the hardware device revision in a + * driver-specific format. When possible the revision should be formatted + * with the KERNEL_VERSION() macro. * - * - driver_version is formatted with the KERNEL_VERSION macro. The version - * minor must be incremented when new features are added to the userspace API - * without breaking binary compatibility. The version major must be - * incremented when binary compatibility is broken. + * - &media_entity.driver_version is formatted with the KERNEL_VERSION() + * macro. The version minor must be incremented when new features are added + * to the userspace API without breaking binary compatibility. The version + * major must be incremented when binary compatibility is broken. * * .. note:: * @@ -252,6 +256,16 @@ void media_device_cleanup(struct media_device *mdev); */ int __must_check __media_device_register(struct media_device *mdev, struct module *owner); + + +/** + * media_device_register() - Registers a media device element + * + * @mdev: pointer to struct &media_device + * + * This macro calls __media_device_register() passing %THIS_MODULE as + * the __media_device_register() second argument (**owner**). + */ #define media_device_register(mdev) __media_device_register(mdev, THIS_MODULE) /** @@ -259,7 +273,6 @@ int __must_check __media_device_register(struct media_device *mdev, * * @mdev: pointer to struct &media_device * - * * It is safe to call this function on an unregistered (but initialised) * media device. */ @@ -285,14 +298,15 @@ void media_device_unregister(struct media_device *mdev); * framework. * * If the device has pads, media_entity_pads_init() should be called before - * this function. Otherwise, the &media_entity.@pad and &media_entity.@num_pads + * this function. Otherwise, the &media_entity.pad and &media_entity.num_pads * should be zeroed before calling this function. * * Entities have flags that describe the entity capabilities and state: * - * %MEDIA_ENT_FL_DEFAULT indicates the default entity for a given type. - * This can be used to report the default audio and video devices or the - * default camera sensor. + * %MEDIA_ENT_FL_DEFAULT + * indicates the default entity for a given type. + * This can be used to report the default audio and video devices or the + * default camera sensor. * * .. note:: * @@ -331,8 +345,10 @@ void media_device_unregister_entity(struct media_entity *entity); * @mdev: The media device * @nptr: The media_entity_notify * - * Note: When a new entity is registered, all the registered - * media_entity_notify callbacks are invoked. + * .. note:: + * + * When a new entity is registered, all the registered + * media_entity_notify callbacks are invoked. */ int __must_check media_device_register_entity_notify(struct media_device *mdev, @@ -410,11 +426,13 @@ void media_device_pci_init(struct media_device *mdev, * @board_name: media device name. If %NULL, the routine will use the usb * product name, if available. * @driver_name: name of the driver. if %NULL, the routine will use the name - * given by udev->dev->driver->name, with is usually the wrong + * given by ``udev->dev->driver->name``, with is usually the wrong * thing to do. * - * NOTE: It is better to call media_device_usb_init() instead, as - * such macro fills driver_name with %KBUILD_MODNAME. + * .. note:: + * + * It is better to call media_device_usb_init() instead, as + * such macro fills driver_name with %KBUILD_MODNAME. */ void __media_device_usb_init(struct media_device *mdev, struct usb_device *udev, @@ -472,6 +490,19 @@ static inline void __media_device_usb_init(struct media_device *mdev, #endif /* CONFIG_MEDIA_CONTROLLER */ +/** + * media_device_usb_init() - create and initialize a + * struct &media_device from a PCI device. + * + * @mdev: pointer to struct &media_device + * @udev: pointer to struct usb_device + * @name: media device name. If %NULL, the routine will use the usb + * product name, if available. + * + * This macro calls media_device_usb_init() passing the + * media_device_usb_init() **driver_name** parameter filled with + * %KBUILD_MODNAME. + */ #define media_device_usb_init(mdev, udev, name) \ __media_device_usb_init(mdev, udev, name, KBUILD_MODNAME) diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h index 37d494805944..972168e90413 100644 --- a/include/media/media-devnode.h +++ b/include/media/media-devnode.h @@ -75,7 +75,7 @@ struct media_file_operations { * @cdev: struct cdev pointer character device * @parent: parent device * @minor: device node minor number - * @flags: flags, combination of the MEDIA_FLAG_* constants + * @flags: flags, combination of the ``MEDIA_FLAG_*`` constants * @release: release callback called at the end of media_devnode_release() * * This structure represents a media-related device node. diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 7bf6885dd37f..e21958c7c5d9 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -56,7 +56,7 @@ enum media_gobj_type { /** * struct media_gobj - Define a graph object. * - * @mdev: Pointer to the struct media_device that owns the object + * @mdev: Pointer to the struct &media_device that owns the object * @id: Non-zero object ID identifier. The ID should be unique * inside a media_device, as it is composed by * %MEDIA_BITS_PER_TYPE to store the type plus @@ -162,7 +162,9 @@ struct media_link { * @graph_obj: Embedded structure containing the media object common data * @entity: Entity this pad belongs to * @index: Pad index in the entity pads array, numbered from 0 to n - * @flags: Pad flags, as defined in uapi/media.h (MEDIA_PAD_FL_*) + * @flags: Pad flags, as defined in + * :ref:`include/uapi/linux/media.h ` + * (seek for ``MEDIA_PAD_FL_*``) */ struct media_pad { struct media_gobj graph_obj; /* must be first field in struct */ @@ -182,7 +184,7 @@ struct media_pad { * * .. note:: * - * Those these callbacks are called with struct media_device.@graph_mutex + * Those these callbacks are called with struct &media_device.graph_mutex * mutex held. */ struct media_entity_operations { @@ -210,7 +212,7 @@ struct media_entity_operations { * This allows runtime type identification of media entities and safe casting to * the correct object type. For instance, a media entity structure instance * embedded in a v4l2_subdev structure instance will have the type - * MEDIA_ENTITY_TYPE_V4L2_SUBDEV and can safely be cast to a v4l2_subdev + * %MEDIA_ENTITY_TYPE_V4L2_SUBDEV and can safely be cast to a &v4l2_subdev * structure using the container_of() macro. */ enum media_entity_type { @@ -225,9 +227,12 @@ enum media_entity_type { * @graph_obj: Embedded structure containing the media object common data. * @name: Entity name. * @obj_type: Type of the object that implements the media_entity. - * @function: Entity main function, as defined in uapi/media.h - * (MEDIA_ENT_F_*) - * @flags: Entity flags, as defined in uapi/media.h (MEDIA_ENT_FL_*) + * @function: Entity main function, as defined in + * :ref:`include/uapi/linux/media.h ` + * (seek for ``MEDIA_ENT_F_*``) + * @flags: Entity flags, as defined in + * :ref:`include/uapi/linux/media.h ` + * (seek for ``MEDIA_ENT_FL_*``) * @num_pads: Number of sink and source pads. * @num_links: Total number of links, forward and back, enabled and disabled. * @num_backlinks: Number of backlinks @@ -246,9 +251,12 @@ enum media_entity_type { * @minor: Devnode minor number (zero if not applicable). Kept just * for backward compatibility. * - * NOTE: @stream_count and @use_count reference counts must never be - * negative, but are signed integers on purpose: a simple WARN_ON(<0) check - * can be used to detect reference count bugs that would make them negative. + * .. note:: + * + * @stream_count and @use_count reference counts must never be + * negative, but are signed integers on purpose: a simple ``WARN_ON(<0)`` + * check can be used to detect reference count bugs that would make them + * negative. */ struct media_entity { struct media_gobj graph_obj; /* must be first field in struct */ @@ -267,10 +275,6 @@ struct media_entity { const struct media_entity_operations *ops; - /* Reference counts must never be negative, but are signed integers on - * purpose: a simple WARN_ON(<0) check can be used to detect reference - * count bugs that would make them negative. - */ int stream_count; int use_count; @@ -289,10 +293,16 @@ struct media_entity { * * @graph_obj: embedded graph object * @links: List of links pointing to graph entities - * @type: Type of the interface as defined in the - * uapi/media/media.h header, e. g. - * MEDIA_INTF_T_* - * @flags: Interface flags as defined in uapi/media/media.h + * @type: Type of the interface as defined in + * :ref:`include/uapi/linux/media.h ` + * (seek for ``MEDIA_INTF_T_*``) + * @flags: Interface flags as defined in + * :ref:`include/uapi/linux/media.h ` + * (seek for ``MEDIA_INTF_FL_*``) + * + * .. note:: + * + * Currently, no flags for &media_interface is defined. */ struct media_interface { struct media_gobj graph_obj; @@ -319,7 +329,7 @@ struct media_intf_devnode { /** * media_entity_id() - return the media entity graph object id * - * @entity: pointer to entity + * @entity: pointer to &media_entity */ static inline u32 media_entity_id(struct media_entity *entity) { @@ -329,7 +339,7 @@ static inline u32 media_entity_id(struct media_entity *entity) /** * media_type() - return the media object type * - * @gobj: pointer to the media graph object + * @gobj: Pointer to the struct &media_gobj graph object */ static inline enum media_gobj_type media_type(struct media_gobj *gobj) { @@ -339,7 +349,7 @@ static inline enum media_gobj_type media_type(struct media_gobj *gobj) /** * media_id() - return the media object ID * - * @gobj: pointer to the media graph object + * @gobj: Pointer to the struct &media_gobj graph object */ static inline u32 media_id(struct media_gobj *gobj) { @@ -350,7 +360,7 @@ static inline u32 media_id(struct media_gobj *gobj) * media_gobj_gen_id() - encapsulates type and ID on at the object ID * * @type: object type as define at enum &media_gobj_type. - * @local_id: next ID, from struct &media_device.@id. + * @local_id: next ID, from struct &media_device.id. */ static inline u32 media_gobj_gen_id(enum media_gobj_type type, u64 local_id) { @@ -366,9 +376,9 @@ static inline u32 media_gobj_gen_id(enum media_gobj_type type, u64 local_id) * is_media_entity_v4l2_video_device() - Check if the entity is a video_device * @entity: pointer to entity * - * Return: true if the entity is an instance of a video_device object and can + * Return: %true if the entity is an instance of a video_device object and can * safely be cast to a struct video_device using the container_of() macro, or - * false otherwise. + * %false otherwise. */ static inline bool is_media_entity_v4l2_video_device(struct media_entity *entity) { @@ -379,9 +389,9 @@ static inline bool is_media_entity_v4l2_video_device(struct media_entity *entity * is_media_entity_v4l2_subdev() - Check if the entity is a v4l2_subdev * @entity: pointer to entity * - * Return: true if the entity is an instance of a v4l2_subdev object and can - * safely be cast to a struct v4l2_subdev using the container_of() macro, or - * false otherwise. + * Return: %true if the entity is an instance of a &v4l2_subdev object and can + * safely be cast to a struct &v4l2_subdev using the container_of() macro, or + * %false otherwise. */ static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity) { @@ -452,7 +462,7 @@ static inline void media_entity_enum_clear(struct media_entity_enum *ent_enum, * @ent_enum: Entity enumeration * @entity: Entity to be tested * - * Returns true if the entity was marked. + * Returns %true if the entity was marked. */ static inline bool media_entity_enum_test(struct media_entity_enum *ent_enum, struct media_entity *entity) @@ -469,7 +479,7 @@ static inline bool media_entity_enum_test(struct media_entity_enum *ent_enum, * @ent_enum: Entity enumeration * @entity: Entity to be tested * - * Returns true if the entity was marked, and mark it before doing so. + * Returns %true if the entity was marked, and mark it before doing so. */ static inline bool media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, @@ -486,7 +496,7 @@ media_entity_enum_test_and_set(struct media_entity_enum *ent_enum, * * @ent_enum: Entity enumeration * - * Returns true if the entity was empty. + * Return: %true if the entity was empty. */ static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) { @@ -499,7 +509,8 @@ static inline bool media_entity_enum_empty(struct media_entity_enum *ent_enum) * @ent_enum1: First entity enumeration * @ent_enum2: Second entity enumeration * - * Returns true if entity enumerations e and f intersect, otherwise false. + * Return: %true if entity enumerations @ent_enum1 and @ent_enum2 intersect, + * otherwise %false. */ static inline bool media_entity_enum_intersects( struct media_entity_enum *ent_enum1, @@ -511,33 +522,63 @@ static inline bool media_entity_enum_intersects( min(ent_enum1->idx_max, ent_enum2->idx_max)); } +/** + * gobj_to_entity - returns the struct &media_entity pointer from the + * @gobj contained on it. + * + * @gobj: Pointer to the struct &media_gobj graph object + */ #define gobj_to_entity(gobj) \ container_of(gobj, struct media_entity, graph_obj) +/** + * gobj_to_entity - returns the struct &media_pad pointer from the + * @gobj contained on it. + * + * @gobj: Pointer to the struct &media_gobj graph object + */ #define gobj_to_pad(gobj) \ container_of(gobj, struct media_pad, graph_obj) +/** + * gobj_to_entity - returns the struct &media_link pointer from the + * @gobj contained on it. + * + * @gobj: Pointer to the struct &media_gobj graph object + */ #define gobj_to_link(gobj) \ container_of(gobj, struct media_link, graph_obj) +/** + * gobj_to_entity - returns the struct &media_interface pointer from the + * @gobj contained on it. + * + * @gobj: Pointer to the struct &media_gobj graph object + */ #define gobj_to_intf(gobj) \ container_of(gobj, struct media_interface, graph_obj) +/** + * gobj_to_entity - returns the struct media_intf_devnode pointer from the + * @intf contained on it. + * + * @intf: Pointer to struct &media_intf_devnode + */ #define intf_to_devnode(intf) \ container_of(intf, struct media_intf_devnode, intf) /** * media_gobj_create - Initialize a graph object * - * @mdev: Pointer to the media_device that contains the object + * @mdev: Pointer to the &media_device that contains the object * @type: Type of the object - * @gobj: Pointer to the graph object + * @gobj: Pointer to the struct &media_gobj graph object * - * This routine initializes the embedded struct media_gobj inside a - * media graph object. It is called automatically if media_*_create\(\) - * calls are used. However, if the object (entity, link, pad, interface) - * is embedded on some other object, this function should be called before - * registering the object at the media controller. + * This routine initializes the embedded struct &media_gobj inside a + * media graph object. It is called automatically if ``media_*_create`` + * function calls are used. However, if the object (entity, link, pad, + * interface) is embedded on some other object, this function should be + * called before registering the object at the media controller. */ void media_gobj_create(struct media_device *mdev, enum media_gobj_type type, @@ -546,7 +587,7 @@ void media_gobj_create(struct media_device *mdev, /** * media_gobj_destroy - Stop using a graph object on a media device * - * @gobj: Pointer to the graph object + * @gobj: Pointer to the struct &media_gobj graph object * * This should be called by all routines like media_device_unregister() * that remove/destroy media graph objects. @@ -561,11 +602,11 @@ void media_gobj_destroy(struct media_gobj *gobj); * @pads: Array of @num_pads pads. * * The pads array is managed by the entity driver and passed to - * media_entity_pads_init() where its pointer will be stored in the entity - * structure. + * media_entity_pads_init() where its pointer will be stored in the + * &media_entity structure. * * If no pads are needed, drivers could either directly fill - * &media_entity->@num_pads with 0 and &media_entity->@pads with NULL or call + * &media_entity->num_pads with 0 and &media_entity->pads with %NULL or call * this function that will do the same. * * As the number of pads is known in advance, the pads array is not allocated @@ -595,18 +636,21 @@ static inline void media_entity_cleanup(struct media_entity *entity) {}; * @source_pad: number of the source pad in the pads array * @sink: pointer to &media_entity of the sink pad. * @sink_pad: number of the sink pad in the pads array. - * @flags: Link flags, as defined in include/uapi/linux/media.h. + * @flags: Link flags, as defined in + * :ref:`include/uapi/linux/media.h ` + * ( seek for ``MEDIA_LNK_FL_*``) * * Valid values for flags: * - * - A %MEDIA_LNK_FL_ENABLED flag indicates that the link is enabled and can - * be used to transfer media data. When two or more links target a sink pad, - * only one of them can be enabled at a time. + * %MEDIA_LNK_FL_ENABLED + * Indicates that the link is enabled and can be used to transfer media data. + * When two or more links target a sink pad, only one of them can be + * enabled at a time. * - * - A %MEDIA_LNK_FL_IMMUTABLE flag indicates that the link enabled state can't - * be modified at runtime. If %MEDIA_LNK_FL_IMMUTABLE is set, then - * %MEDIA_LNK_FL_ENABLED must also be set since an immutable link is - * always enabled. + * %MEDIA_LNK_FL_IMMUTABLE + * Indicates that the link enabled state can't be modified at runtime. If + * %MEDIA_LNK_FL_IMMUTABLE is set, then %MEDIA_LNK_FL_ENABLED must also be + * set, since an immutable link is always enabled. * * .. note:: * @@ -624,17 +668,17 @@ __must_check int media_create_pad_link(struct media_entity *source, * @source_function: Function of the source entities. Used only if @source is * NULL. * @source: pointer to &media_entity of the source pad. If NULL, it will use - * all entities that matches the @sink_function. + * all entities that matches the @sink_function. * @source_pad: number of the source pad in the pads array * @sink_function: Function of the sink entities. Used only if @sink is NULL. * @sink: pointer to &media_entity of the sink pad. If NULL, it will use - * all entities that matches the @sink_function. + * all entities that matches the @sink_function. * @sink_pad: number of the sink pad in the pads array. * @flags: Link flags, as defined in include/uapi/linux/media.h. - * @allow_both_undefined: if true, then both @source and @sink can be NULL. + * @allow_both_undefined: if %true, then both @source and @sink can be NULL. * In such case, it will create a crossbar between all entities that * matches @source_function to all entities that matches @sink_function. - * If false, it will return 0 and won't create any link if both @source + * If %false, it will return 0 and won't create any link if both @source * and @sink are NULL. * * Valid values for flags: @@ -654,9 +698,11 @@ __must_check int media_create_pad_link(struct media_entity *source, * creates link by link, this function is meant to allow 1:n, n:1 and even * cross-bar (n:n) links. * - * NOTE: Before calling this function, media_entity_pads_init() and - * media_device_register_entity() should be called previously for the entities - * to be linked. + * .. note:: + * + * Before calling this function, media_entity_pads_init() and + * media_device_register_entity() should be called previously for the + * entities to be linked. */ int media_create_pad_links(const struct media_device *mdev, const u32 source_function, @@ -715,7 +761,7 @@ int __media_entity_setup_link(struct media_link *link, u32 flags); * flags. * * Media device drivers can be notified of link setup operations by setting the - * media_device::link_notify pointer to a callback function. If provided, the + * &media_device.link_notify pointer to a callback function. If provided, the * notification callback will be called before enabling and after disabling * links. * @@ -725,7 +771,7 @@ int __media_entity_setup_link(struct media_link *link, u32 flags); * * Link configuration must not have any side effect on other links. If an * enabled link at a sink pad prevents another link at the same pad from - * being enabled, the link_setup operation must return -EBUSY and can't + * being enabled, the link_setup operation must return %-EBUSY and can't * implicitly disable the first enabled link. * * .. note:: @@ -741,8 +787,8 @@ int media_entity_setup_link(struct media_link *link, u32 flags); * @source: Source pad * @sink: Sink pad * - * Return a pointer to the link between the two entities. If no such link - * exists, return NULL. + * Return: returns a pointer to the link between the two entities. If no + * such link exists, return %NULL. */ struct media_link *media_entity_find_link(struct media_pad *source, struct media_pad *sink); @@ -754,8 +800,8 @@ struct media_link *media_entity_find_link(struct media_pad *source, * Search for a remote pad connected to the given pad by iterating over all * links originating or terminating at that pad until an enabled link is found. * - * Return a pointer to the pad at the remote end of the first found enabled - * link, or NULL if no enabled link has been found. + * Return: returns a pointer to the pad at the remote end of the first found + * enabled link, or %NULL if no enabled link has been found. */ struct media_pad *media_entity_remote_pad(struct media_pad *pad); @@ -766,12 +812,18 @@ struct media_pad *media_entity_remote_pad(struct media_pad *pad); * * Get a reference to the parent media device module. * - * The function will return immediately if @entity is NULL. + * The function will return immediately if @entity is %NULL. * - * Return a pointer to the entity on success or NULL on failure. + * Return: returns a pointer to the entity on success or %NULL on failure. */ struct media_entity *media_entity_get(struct media_entity *entity); +/** + * media_entity_graph_walk_init - Allocate resources used by graph walk. + * + * @graph: Media graph structure that will be used to walk the graph + * @mdev: Pointer to the &media_device that contains the object + */ __must_check int media_entity_graph_walk_init( struct media_entity_graph *graph, struct media_device *mdev); @@ -789,12 +841,14 @@ void media_entity_graph_walk_cleanup(struct media_entity_graph *graph); * * Release the reference count acquired by media_entity_get(). * - * The function will return immediately if @entity is NULL. + * The function will return immediately if @entity is %NULL. */ void media_entity_put(struct media_entity *entity); /** - * media_entity_graph_walk_start - Start walking the media graph at a given entity + * media_entity_graph_walk_start - Start walking the media graph at a + * given entity + * * @graph: Media graph structure that will be used to walk the graph * @entity: Starting entity * @@ -818,8 +872,8 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, * The graph structure must have been previously initialized with a call to * media_entity_graph_walk_start(). * - * Return the next entity in the graph or NULL if the whole graph have been - * traversed. + * Return: returns the next entity in the graph or %NULL if the whole graph + * have been traversed. */ struct media_entity * media_entity_graph_walk_next(struct media_entity_graph *graph); @@ -830,8 +884,8 @@ media_entity_graph_walk_next(struct media_entity_graph *graph); * @pipe: Media pipeline to be assigned to all entities in the pipeline. * * Mark all entities connected to a given entity through enabled links, either - * directly or indirectly, as streaming. The given pipeline object is assigned to - * every entity in the pipeline and stored in the media_entity pipe field. + * directly or indirectly, as streaming. The given pipeline object is assigned + * to every entity in the pipeline and stored in the media_entity pipe field. * * Calls to this function can be nested, in which case the same number of * media_entity_pipeline_stop() calls will be required to stop streaming. The @@ -857,7 +911,7 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity, * * Mark all entities connected to a given entity through enabled links, either * directly or indirectly, as not streaming. The media_entity pipe field is - * reset to NULL. + * reset to %NULL. * * If multiple calls to media_entity_pipeline_start() have been made, the same * number of calls to this function are required to mark the pipeline as not @@ -878,14 +932,21 @@ void __media_entity_pipeline_stop(struct media_entity *entity); * media_devnode_create() - creates and initializes a device node interface * * @mdev: pointer to struct &media_device - * @type: type of the interface, as given by MEDIA_INTF_T_* macros - * as defined in the uapi/media/media.h header. - * @flags: Interface flags as defined in uapi/media/media.h. + * @type: type of the interface, as given by + * :ref:`include/uapi/linux/media.h ` + * ( seek for ``MEDIA_INTF_T_*``) macros. + * @flags: Interface flags, as defined in + * :ref:`include/uapi/linux/media.h ` + * ( seek for ``MEDIA_INTF_FL_*``) * @major: Device node major number. * @minor: Device node minor number. * * Return: if succeeded, returns a pointer to the newly allocated * &media_intf_devnode pointer. + * + * .. note:: + * + * Currently, no flags for &media_interface is defined. */ struct media_intf_devnode * __must_check media_devnode_create(struct media_device *mdev, @@ -907,15 +968,19 @@ struct media_link * * * @entity: pointer to %media_entity * @intf: pointer to %media_interface - * @flags: Link flags, as defined in include/uapi/linux/media.h. + * @flags: Link flags, as defined in + * :ref:`include/uapi/linux/media.h ` + * ( seek for ``MEDIA_LNK_FL_*``) * * * Valid values for flags: * - * - The %MEDIA_LNK_FL_ENABLED flag indicates that the interface is connected to - * the entity hardware. That's the default value for interfaces. An - * interface may be disabled if the hardware is busy due to the usage - * of some other interface that it is currently controlling the hardware. + * %MEDIA_LNK_FL_ENABLED + * Indicates that the interface is connected to the entity hardware. + * That's the default value for interfaces. An interface may be disabled if + * the hardware is busy due to the usage of some other interface that it is + * currently controlling the hardware. + * * A typical example is an hybrid TV device that handle only one type of * stream on a given time. So, when the digital TV is streaming, * the V4L2 interfaces won't be enabled, as such device is not able to @@ -971,6 +1036,18 @@ void __media_remove_intf_links(struct media_interface *intf); */ void media_remove_intf_links(struct media_interface *intf); +/** + * media_entity_call - Calls a struct media_entity_operations operation on + * an entity + * + * @entity: entity where the @operation will be called + * @operation: type of the operation. Should be the name of a member of + * struct &media_entity_operations. + * + * This helper function will check if @operation is not %NULL. On such case, + * it will issue a call to @operation\(@entity, @args\). + */ + #define media_entity_call(entity, operation, args...) \ (((entity)->ops && (entity)->ops->operation) ? \ (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD) From 730fbf2a096054e95a84dde12532bd799809a229 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 16:09:16 -0300 Subject: [PATCH 310/591] [media] conf_nitpick.py: ignore external functions used on mediactl There are some functions/macros used by the mediactl documentation that are alien to the media subsystem. Ignore them. After this patch, the media core will only complain about this static function: Documentation/media/kapi/mc-core.rst:97: WARNING: c:func reference target not found: media_devnode_release Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/conf_nitpick.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/media/conf_nitpick.py b/Documentation/media/conf_nitpick.py index 4de9533ce361..1c7928abace5 100644 --- a/Documentation/media/conf_nitpick.py +++ b/Documentation/media/conf_nitpick.py @@ -28,6 +28,7 @@ nitpick_ignore = [ ("c:func", "i2c_new_device"), ("c:func", "ioctl"), ("c:func", "IS_ERR"), + ("c:func", "KERNEL_VERSION"), ("c:func", "mmap"), ("c:func", "open"), ("c:func", "pci_name"), @@ -66,6 +67,7 @@ nitpick_ignore = [ ("c:type", "off_t"), ("c:type", "pci_dev"), ("c:type", "pdvbdev"), + ("c:type", "platform_device"), ("c:type", "pollfd"), ("c:type", "poll_table_struct"), ("c:type", "s32"), @@ -93,5 +95,6 @@ nitpick_ignore = [ ("c:type", "union"), ("c:type", "__user"), ("c:type", "usb_device"), + ("c:type", "usb_interface"), ("c:type", "video_system_t"), ] From 9fa7235f88386c9a5f5013a90f0c6fe8aa6fe828 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 17:00:22 -0300 Subject: [PATCH 311/591] [media] rc-map.h: document structs/enums on it There are some structs/enums that aren't documented via kernel-doc markup. Add documentation for them. Fix those warnings: ./include/media/rc-map.h:103: WARNING: c:type reference target not found: rc_map_list ./include/media/rc-map.h:110: WARNING: c:type reference target not found: rc_map_list ./include/media/rc-map.h:117: WARNING: c:type reference target not found: rc_map Signed-off-by: Mauro Carvalho Chehab --- include/media/rc-map.h | 94 +++++++++++++++++++++++++++++++----------- 1 file changed, 71 insertions(+), 23 deletions(-) diff --git a/include/media/rc-map.h b/include/media/rc-map.h index daa75fcc1ff1..173ad58fb61b 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -11,27 +11,51 @@ #include +/** + * enum rc_type - type of the Remote Controller protocol + * + * @RC_TYPE_UNKNOWN: Protocol not known + * @RC_TYPE_OTHER: Protocol known but proprietary + * @RC_TYPE_RC5: Philips RC5 protocol + * @RC_TYPE_RC5X: Philips RC5x protocol + * @RC_TYPE_RC5_SZ: StreamZap variant of RC5 + * @RC_TYPE_JVC: JVC protocol + * @RC_TYPE_SONY12: Sony 12 bit protocol + * @RC_TYPE_SONY15: Sony 15 bit protocol + * @RC_TYPE_SONY20: Sony 20 bit protocol + * @RC_TYPE_NEC: NEC protocol + * @RC_TYPE_SANYO: Sanyo protocol + * @RC_TYPE_MCE_KBD: RC6-ish MCE keyboard/mouse + * @RC_TYPE_RC6_0: Philips RC6-0-16 protocol + * @RC_TYPE_RC6_6A_20: Philips RC6-6A-20 protocol + * @RC_TYPE_RC6_6A_24: Philips RC6-6A-24 protocol + * @RC_TYPE_RC6_6A_32: Philips RC6-6A-32 protocol + * @RC_TYPE_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol + * @RC_TYPE_SHARP: Sharp protocol + * @RC_TYPE_XMP: XMP protocol + * @RC_TYPE_CEC: CEC protocol + */ enum rc_type { - RC_TYPE_UNKNOWN = 0, /* Protocol not known */ - RC_TYPE_OTHER = 1, /* Protocol known but proprietary */ - RC_TYPE_RC5 = 2, /* Philips RC5 protocol */ - RC_TYPE_RC5X = 3, /* Philips RC5x protocol */ - RC_TYPE_RC5_SZ = 4, /* StreamZap variant of RC5 */ - RC_TYPE_JVC = 5, /* JVC protocol */ - RC_TYPE_SONY12 = 6, /* Sony 12 bit protocol */ - RC_TYPE_SONY15 = 7, /* Sony 15 bit protocol */ - RC_TYPE_SONY20 = 8, /* Sony 20 bit protocol */ - RC_TYPE_NEC = 9, /* NEC protocol */ - RC_TYPE_SANYO = 10, /* Sanyo protocol */ - RC_TYPE_MCE_KBD = 11, /* RC6-ish MCE keyboard/mouse */ - RC_TYPE_RC6_0 = 12, /* Philips RC6-0-16 protocol */ - RC_TYPE_RC6_6A_20 = 13, /* Philips RC6-6A-20 protocol */ - RC_TYPE_RC6_6A_24 = 14, /* Philips RC6-6A-24 protocol */ - RC_TYPE_RC6_6A_32 = 15, /* Philips RC6-6A-32 protocol */ - RC_TYPE_RC6_MCE = 16, /* MCE (Philips RC6-6A-32 subtype) protocol */ - RC_TYPE_SHARP = 17, /* Sharp protocol */ - RC_TYPE_XMP = 18, /* XMP protocol */ - RC_TYPE_CEC = 19, /* CEC protocol */ + RC_TYPE_UNKNOWN = 0, + RC_TYPE_OTHER = 1, + RC_TYPE_RC5 = 2, + RC_TYPE_RC5X = 3, + RC_TYPE_RC5_SZ = 4, + RC_TYPE_JVC = 5, + RC_TYPE_SONY12 = 6, + RC_TYPE_SONY15 = 7, + RC_TYPE_SONY20 = 8, + RC_TYPE_NEC = 9, + RC_TYPE_SANYO = 10, + RC_TYPE_MCE_KBD = 11, + RC_TYPE_RC6_0 = 12, + RC_TYPE_RC6_6A_20 = 13, + RC_TYPE_RC6_6A_24 = 14, + RC_TYPE_RC6_6A_32 = 15, + RC_TYPE_RC6_MCE = 16, + RC_TYPE_SHARP = 17, + RC_TYPE_XMP = 18, + RC_TYPE_CEC = 19, }; #define RC_BIT_NONE 0ULL @@ -76,21 +100,45 @@ enum rc_type { #define RC_SCANCODE_RC6_0(sys, cmd) (((sys) << 8) | (cmd)) #define RC_SCANCODE_RC6_6A(vendor, sys, cmd) (((vendor) << 16) | ((sys) << 8) | (cmd)) +/** + * struct rc_map_table - represents a scancode/keycode pair + * + * @scancode: scan code (u32) + * @keycode: Linux input keycode + */ struct rc_map_table { u32 scancode; u32 keycode; }; +/** + * struct rc_map - represents a keycode map table + * + * @scan: pointer to struct &rc_map_table + * @size: Max number of entries + * @len: Number of entries that are in use + * @alloc: size of *scan, in bytes + * @rc_type: type of the remote controller protocol, as defined at + * enum &rc_type + * @name: name of the key map table + * @lock: lock to protect access to this structure + */ struct rc_map { struct rc_map_table *scan; - unsigned int size; /* Max number of entries */ - unsigned int len; /* Used number of entries */ - unsigned int alloc; /* Size of *scan in bytes */ + unsigned int size; + unsigned int len; + unsigned int alloc; enum rc_type rc_type; const char *name; spinlock_t lock; }; +/** + * struct rc_map_list - list of the registered &rc_map maps + * + * @list: pointer to struct &list_head + * @map: pointer to struct &rc_map + */ struct rc_map_list { struct list_head list; struct rc_map map; From 2257e180101c910c2d93dd226ab1e500e4a6813c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 17:26:15 -0300 Subject: [PATCH 312/591] [media] v4l2-ctrls: document some extra data structures The typedefs and a macro are not defined. While here, improve a few bits on the documentation. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-ctrls.h | 51 ++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 178a88d45aea..b8e043f63825 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -93,6 +93,16 @@ struct v4l2_ctrl_type_ops { union v4l2_ctrl_ptr ptr); }; +/** + * typedef v4l2_ctrl_notify_fnc - typedef for a notify argument with a function + * that should be called when a control value has changed. + * + * @ctrl: pointer to struct &v4l2_ctrl + * @priv: control private data + * + * This typedef definition is used as an argument to v4l2_ctrl_notify() + * and as an argument at struct &v4l2_ctrl_handler. + */ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv); /** @@ -369,17 +379,38 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, * @key: Used by the lock validator if CONFIG_LOCKDEP is set. * @name: Used by the lock validator if CONFIG_LOCKDEP is set. * - * Returns an error if the buckets could not be allocated. This error will - * also be stored in @hdl->error. + * .. attention:: * - * Never use this call directly, always use the v4l2_ctrl_handler_init - * macro that hides the @key and @name arguments. + * Never use this call directly, always use the v4l2_ctrl_handler_init() + * macro that hides the @key and @name arguments. + * + * Return: returns an error if the buckets could not be allocated. This + * error will also be stored in @hdl->error. */ int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, unsigned int nr_of_controls_hint, struct lock_class_key *key, const char *name); #ifdef CONFIG_LOCKDEP + +/** + * v4l2_ctrl_handler_init - + * + * @hdl: The control handler. + * @nr_of_controls_hint: A hint of how many controls this handler is + * expected to refer to. This is the total number, so including + * any inherited controls. It doesn't have to be precise, but if + * it is way off, then you either waste memory (too many buckets + * are allocated) or the control lookup becomes slower (not enough + * buckets are allocated, so there are more slow list lookups). + * It will always work, though. + * + * This helper function creates a static struct &lock_class_key and + * calls v4l2_ctrl_handler_init_class(), providing a proper name for the lock + * validador. + * + * Use this helper function to initialize a control handler. + */ #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \ ( \ ({ \ @@ -564,6 +595,13 @@ struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, u32 id, u8 max, u8 def, const s64 *qmenu_int); +/** + * typedef v4l2_ctrl_filter - Typedef to define the filter function to be + * used when adding a control handler. + * + * @ctrl: pointer to struct &v4l2_ctrl. + */ + typedef bool (*v4l2_ctrl_filter)(const struct v4l2_ctrl *ctrl); /** @@ -635,8 +673,8 @@ void v4l2_ctrl_cluster(unsigned int ncontrols, struct v4l2_ctrl **controls); * be marked active, and any reads will just return the current value without * going through g_volatile_ctrl. * - * In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag - * on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s) + * In addition, this function will set the %V4L2_CTRL_FLAG_UPDATE flag + * on the autofoo control and %V4L2_CTRL_FLAG_INACTIVE on the foo control(s) * if autofoo is in auto mode. */ void v4l2_ctrl_auto_cluster(unsigned int ncontrols, @@ -686,7 +724,6 @@ void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); */ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); - /** *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range() * From e8be7e97e639af6f968473e5a598afbebc737b9c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 17:37:59 -0300 Subject: [PATCH 313/591] [media] docs-rst: convert uAPI structs to C domain instead of declaring the uAPI structs using usual refs, e. g.: .. _foo-struct: Use the C domain way: .. c:type:: foo_struct This way, the kAPI documentation can use cross-references to point to the uAPI symbols. That solves about ~100 undefined warnings like: WARNING: c:type reference target not found: foo_struct Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/v4l2-event.rst | 6 +- .../media/uapi/cec/cec-ioc-adap-g-caps.rst | 4 +- .../uapi/cec/cec-ioc-adap-g-log-addrs.rst | 2 +- .../media/uapi/cec/cec-ioc-dqevent.rst | 2 +- .../media/uapi/cec/cec-ioc-receive.rst | 2 +- .../media/uapi/dvb/audio_data_types.rst | 6 +- .../media/uapi/dvb/ca_data_types.rst | 12 +- Documentation/media/uapi/dvb/dmx_types.rst | 10 +- Documentation/media/uapi/dvb/dtv-fe-stats.rst | 2 +- .../media/uapi/dvb/dtv-properties.rst | 2 +- Documentation/media/uapi/dvb/dtv-property.rst | 2 +- Documentation/media/uapi/dvb/dtv-stats.rst | 2 +- .../media/uapi/dvb/dvb-frontend-event.rst | 2 +- .../uapi/dvb/dvb-frontend-parameters.rst | 10 +- Documentation/media/uapi/dvb/dvbproperty.rst | 2 +- .../uapi/dvb/fe-diseqc-recv-slave-reply.rst | 4 +- .../uapi/dvb/fe-diseqc-send-master-cmd.rst | 4 +- Documentation/media/uapi/dvb/fe-get-info.rst | 4 +- .../media/uapi/dvb/fe-get-property.rst | 2 +- Documentation/media/uapi/dvb/fe-type-t.rst | 4 +- .../uapi/dvb/frontend-stat-properties.rst | 2 +- Documentation/media/uapi/dvb/net-add-if.rst | 6 +- Documentation/media/uapi/dvb/net-get-if.rst | 6 +- Documentation/media/uapi/dvb/video_types.rst | 16 +-- .../uapi/mediactl/media-ioc-device-info.rst | 4 +- .../uapi/mediactl/media-ioc-enum-entities.rst | 6 +- .../uapi/mediactl/media-ioc-enum-links.rst | 22 ++-- .../uapi/mediactl/media-ioc-g-topology.rst | 14 +-- .../uapi/mediactl/media-ioc-setup-link.rst | 4 +- Documentation/media/uapi/v4l/audio.rst | 12 +- Documentation/media/uapi/v4l/buffer.rst | 40 +++---- Documentation/media/uapi/v4l/crop.rst | 14 +-- Documentation/media/uapi/v4l/dev-capture.rst | 16 +-- Documentation/media/uapi/v4l/dev-osd.rst | 18 +-- Documentation/media/uapi/v4l/dev-output.rst | 16 +-- Documentation/media/uapi/v4l/dev-overlay.rst | 22 ++-- Documentation/media/uapi/v4l/dev-radio.rst | 2 +- Documentation/media/uapi/v4l/dev-raw-vbi.rst | 14 +-- Documentation/media/uapi/v4l/dev-rds.rst | 14 +-- Documentation/media/uapi/v4l/dev-sdr.rst | 12 +- .../media/uapi/v4l/dev-sliced-vbi.rst | 36 +++--- Documentation/media/uapi/v4l/dev-subdev.rst | 4 +- Documentation/media/uapi/v4l/dev-touch.rst | 2 +- Documentation/media/uapi/v4l/diff-v4l.rst | 66 +++++------ Documentation/media/uapi/v4l/dmabuf.rst | 8 +- .../media/uapi/v4l/extended-controls.rst | 10 +- Documentation/media/uapi/v4l/field-order.rst | 8 +- Documentation/media/uapi/v4l/format.rst | 2 +- Documentation/media/uapi/v4l/func-mmap.rst | 8 +- Documentation/media/uapi/v4l/func-munmap.rst | 4 +- Documentation/media/uapi/v4l/hist-v4l2.rst | 108 +++++++++--------- Documentation/media/uapi/v4l/mmap.rst | 12 +- Documentation/media/uapi/v4l/pixfmt-002.rst | 6 +- Documentation/media/uapi/v4l/pixfmt-003.rst | 22 ++-- Documentation/media/uapi/v4l/pixfmt-006.rst | 4 +- Documentation/media/uapi/v4l/pixfmt.rst | 4 +- Documentation/media/uapi/v4l/planar-apis.rst | 8 +- Documentation/media/uapi/v4l/rw.rst | 2 +- .../media/uapi/v4l/selection-api-005.rst | 10 +- Documentation/media/uapi/v4l/standard.rst | 8 +- .../media/uapi/v4l/streaming-par.rst | 2 +- Documentation/media/uapi/v4l/tuner.rst | 10 +- Documentation/media/uapi/v4l/userp.rst | 8 +- Documentation/media/uapi/v4l/v4l2.rst | 6 +- Documentation/media/uapi/v4l/video.rst | 2 +- .../media/uapi/v4l/vidioc-create-bufs.rst | 8 +- .../media/uapi/v4l/vidioc-cropcap.rst | 6 +- .../media/uapi/v4l/vidioc-dbg-g-chip-info.rst | 4 +- .../media/uapi/v4l/vidioc-dbg-g-register.rst | 6 +- .../media/uapi/v4l/vidioc-decoder-cmd.rst | 6 +- .../media/uapi/v4l/vidioc-dqevent.rst | 40 +++---- .../media/uapi/v4l/vidioc-dv-timings-cap.rst | 10 +- .../media/uapi/v4l/vidioc-encoder-cmd.rst | 4 +- .../media/uapi/v4l/vidioc-enum-dv-timings.rst | 10 +- .../media/uapi/v4l/vidioc-enum-fmt.rst | 6 +- .../uapi/v4l/vidioc-enum-frameintervals.rst | 16 +-- .../media/uapi/v4l/vidioc-enum-framesizes.rst | 12 +- .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 14 +-- .../media/uapi/v4l/vidioc-enumaudio.rst | 4 +- .../media/uapi/v4l/vidioc-enumaudioout.rst | 4 +- .../media/uapi/v4l/vidioc-enuminput.rst | 8 +- .../media/uapi/v4l/vidioc-enumoutput.rst | 8 +- .../media/uapi/v4l/vidioc-enumstd.rst | 12 +- .../media/uapi/v4l/vidioc-expbuf.rst | 12 +- .../media/uapi/v4l/vidioc-g-audio.rst | 6 +- .../media/uapi/v4l/vidioc-g-audioout.rst | 6 +- .../media/uapi/v4l/vidioc-g-crop.rst | 10 +- .../media/uapi/v4l/vidioc-g-ctrl.rst | 10 +- .../media/uapi/v4l/vidioc-g-dv-timings.rst | 10 +- .../media/uapi/v4l/vidioc-g-enc-index.rst | 8 +- .../media/uapi/v4l/vidioc-g-ext-ctrls.rst | 26 ++--- .../media/uapi/v4l/vidioc-g-fbuf.rst | 18 +-- Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 24 ++-- .../media/uapi/v4l/vidioc-g-frequency.rst | 20 ++-- .../media/uapi/v4l/vidioc-g-input.rst | 2 +- .../media/uapi/v4l/vidioc-g-jpegcomp.rst | 2 +- .../media/uapi/v4l/vidioc-g-modulator.rst | 8 +- .../media/uapi/v4l/vidioc-g-output.rst | 2 +- .../media/uapi/v4l/vidioc-g-parm.rst | 22 ++-- .../media/uapi/v4l/vidioc-g-selection.rst | 28 ++--- .../uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 4 +- Documentation/media/uapi/v4l/vidioc-g-std.rst | 4 +- .../media/uapi/v4l/vidioc-g-tuner.rst | 12 +- .../media/uapi/v4l/vidioc-prepare-buf.rst | 2 +- Documentation/media/uapi/v4l/vidioc-qbuf.rst | 20 ++-- .../uapi/v4l/vidioc-query-dv-timings.rst | 2 +- .../media/uapi/v4l/vidioc-querybuf.rst | 14 +-- .../media/uapi/v4l/vidioc-querycap.rst | 8 +- .../media/uapi/v4l/vidioc-queryctrl.rst | 4 +- .../media/uapi/v4l/vidioc-reqbufs.rst | 6 +- .../media/uapi/v4l/vidioc-s-hw-freq-seek.rst | 22 ++-- .../media/uapi/v4l/vidioc-streamon.rst | 2 +- .../v4l/vidioc-subdev-enum-frame-interval.rst | 2 +- .../media/uapi/v4l/vidioc-subdev-g-crop.rst | 2 +- .../v4l/vidioc-subdev-g-frame-interval.rst | 2 +- .../uapi/v4l/vidioc-subdev-g-selection.rst | 2 +- .../media/uapi/v4l/vidioc-subscribe-event.rst | 2 +- 117 files changed, 603 insertions(+), 603 deletions(-) diff --git a/Documentation/media/kapi/v4l2-event.rst b/Documentation/media/kapi/v4l2-event.rst index f962686a7b63..9a5e31546ae3 100644 --- a/Documentation/media/kapi/v4l2-event.rst +++ b/Documentation/media/kapi/v4l2-event.rst @@ -40,7 +40,7 @@ A good example of these ``replace``/``merge`` callbacks is in v4l2-event.c: In order to queue events to video device, drivers should call: :c:func:`v4l2_event_queue ` - (:c:type:`vdev `, :ref:`ev `) + (:c:type:`vdev `, :c:type:`ev `) The driver's only responsibility is to fill in the type and the data fields. The other fields will be filled in by V4L2. @@ -51,7 +51,7 @@ Event subscription Subscribing to an event is via: :c:func:`v4l2_event_subscribe ` - (:c:type:`fh `, :ref:`sub ` , + (:c:type:`fh `, :c:type:`sub ` , elems, :c:type:`ops `) @@ -86,7 +86,7 @@ Unsubscribing an event Unsubscribing to an event is via: :c:func:`v4l2_event_unsubscribe ` - (:c:type:`fh `, :ref:`sub `) + (:c:type:`fh `, :c:type:`sub `) This function is used to implement :c:type:`video_device`-> :c:type:`ioctl_ops `-> ``vidioc_unsubscribe_event``. diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst index 14d7f6a19455..a35dca281178 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst @@ -36,12 +36,12 @@ Description All cec devices must support :ref:`ioctl CEC_ADAP_G_CAPS `. To query device information, applications call the ioctl with a pointer to a -struct :ref:`cec_caps `. The driver fills the structure and +struct :c:type:`cec_caps`. The driver fills the structure and returns the information to the application. The ioctl never fails. .. tabularcolumns:: |p{1.2cm}|p{2.5cm}|p{13.8cm}| -.. _cec-caps: +.. c:type:: cec_caps .. flat-table:: struct cec_caps :header-rows: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index 1a920109072c..bd0756ff022e 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst @@ -68,7 +68,7 @@ logical address types are already defined will return with error ``EBUSY``. .. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}| -.. _cec-log-addrs: +.. c:type:: cec_log_addrs .. cssclass:: longtable diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index b7f104802045..10228eb0fd4a 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -105,7 +105,7 @@ it is guaranteed that the state did change in between the two events. .. tabularcolumns:: |p{1.0cm}|p{4.2cm}|p{2.5cm}|p{8.8cm}| -.. _cec-event: +.. c:type:: cec_event .. flat-table:: struct cec_event :header-rows: 0 diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index 025a3851ab76..f015f1259b27 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -76,7 +76,7 @@ result. .. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{13.0cm}| -.. _cec-msg: +.. c:type:: cec_msg .. cssclass:: longtable diff --git a/Documentation/media/uapi/dvb/audio_data_types.rst b/Documentation/media/uapi/dvb/audio_data_types.rst index 4a53127eb13a..0b14c2dfc98c 100644 --- a/Documentation/media/uapi/dvb/audio_data_types.rst +++ b/Documentation/media/uapi/dvb/audio_data_types.rst @@ -71,7 +71,7 @@ the following values. } audio_channel_select_t; -.. _audio-status: +.. c:type:: audio_status struct audio_status =================== @@ -93,7 +93,7 @@ about various states of the playback operation. } audio_status_t; -.. _audio-mixer: +.. c:type:: audio_mixer struct audio_mixer ================== @@ -132,7 +132,7 @@ following bits set according to the hardwares capabilities. #define AUDIO_CAP_AC3 256 -.. _audio-karaoke: +.. c:type:: audio_karaoke struct audio_karaoke ==================== diff --git a/Documentation/media/uapi/dvb/ca_data_types.rst b/Documentation/media/uapi/dvb/ca_data_types.rst index 025f910ae945..d9e27c77426c 100644 --- a/Documentation/media/uapi/dvb/ca_data_types.rst +++ b/Documentation/media/uapi/dvb/ca_data_types.rst @@ -7,7 +7,7 @@ CA Data Types ************* -.. _ca-slot-info: +.. c:type:: ca_slot_info ca_slot_info_t ============== @@ -31,7 +31,7 @@ ca_slot_info_t } ca_slot_info_t; -.. _ca-descr-info: +.. c:type:: ca_descr_info ca_descr_info_t =============== @@ -48,7 +48,7 @@ ca_descr_info_t } ca_descr_info_t; -.. _ca-caps: +.. c:type:: ca_caps ca_caps_t ========= @@ -64,7 +64,7 @@ ca_caps_t } ca_cap_t; -.. _ca-msg: +.. c:type:: ca_msg ca_msg_t ======== @@ -81,7 +81,7 @@ ca_msg_t } ca_msg_t; -.. _ca-descr: +.. c:type:: ca_descr ca_descr_t ========== @@ -96,7 +96,7 @@ ca_descr_t } ca_descr_t; -.. _ca-pid: +.. c:type:: ca_pid ca-pid ====== diff --git a/Documentation/media/uapi/dvb/dmx_types.rst b/Documentation/media/uapi/dvb/dmx_types.rst index efd564035958..65de705fa1ef 100644 --- a/Documentation/media/uapi/dvb/dmx_types.rst +++ b/Documentation/media/uapi/dvb/dmx_types.rst @@ -120,7 +120,7 @@ dmx_pes_type_t } dmx_pes_type_t; -.. _dmx-filter: +.. c:type:: dmx_filter struct dmx_filter ================= @@ -136,7 +136,7 @@ struct dmx_filter } dmx_filter_t; -.. _dmx-sct-filter-params: +.. c:type:: dmx_sct_filter_params struct dmx_sct_filter_params ============================ @@ -157,7 +157,7 @@ struct dmx_sct_filter_params }; -.. _dmx-pes-filter-params: +.. c:type:: dmx_pes_filter_params struct dmx_pes_filter_params ============================ @@ -194,7 +194,7 @@ struct dmx_event }; -.. _dmx-stc: +.. c:type:: dmx_stc struct dmx_stc ============== @@ -209,7 +209,7 @@ struct dmx_stc }; -.. _dmx-caps: +.. c:type:: dmx_caps struct dmx_caps =============== diff --git a/Documentation/media/uapi/dvb/dtv-fe-stats.rst b/Documentation/media/uapi/dvb/dtv-fe-stats.rst index 7c105e2ab27e..e8a02a1f138d 100644 --- a/Documentation/media/uapi/dvb/dtv-fe-stats.rst +++ b/Documentation/media/uapi/dvb/dtv-fe-stats.rst @@ -1,6 +1,6 @@ .. -*- coding: utf-8; mode: rst -*- -.. _dtv-fe-stats: +.. c:type:: dtv_fe_stats ******************* struct dtv_fe_stats diff --git a/Documentation/media/uapi/dvb/dtv-properties.rst b/Documentation/media/uapi/dvb/dtv-properties.rst index c13be5de4302..48c4e834ad11 100644 --- a/Documentation/media/uapi/dvb/dtv-properties.rst +++ b/Documentation/media/uapi/dvb/dtv-properties.rst @@ -1,6 +1,6 @@ .. -*- coding: utf-8; mode: rst -*- -.. _dtv-properties: +.. c:type:: dtv_properties ********************* struct dtv_properties diff --git a/Documentation/media/uapi/dvb/dtv-property.rst b/Documentation/media/uapi/dvb/dtv-property.rst index 5073a49def2a..3ddc3474b00e 100644 --- a/Documentation/media/uapi/dvb/dtv-property.rst +++ b/Documentation/media/uapi/dvb/dtv-property.rst @@ -1,6 +1,6 @@ .. -*- coding: utf-8; mode: rst -*- -.. _dtv-property: +.. c:type:: dtv_property ******************* struct dtv_property diff --git a/Documentation/media/uapi/dvb/dtv-stats.rst b/Documentation/media/uapi/dvb/dtv-stats.rst index 2cfdca00f164..35239e72bf74 100644 --- a/Documentation/media/uapi/dvb/dtv-stats.rst +++ b/Documentation/media/uapi/dvb/dtv-stats.rst @@ -1,6 +1,6 @@ .. -*- coding: utf-8; mode: rst -*- -.. _dtv-stats: +.. c:type:: dtv_stats **************** struct dtv_stats diff --git a/Documentation/media/uapi/dvb/dvb-frontend-event.rst b/Documentation/media/uapi/dvb/dvb-frontend-event.rst index 78e72feaa178..2088bc6cacd8 100644 --- a/Documentation/media/uapi/dvb/dvb-frontend-event.rst +++ b/Documentation/media/uapi/dvb/dvb-frontend-event.rst @@ -1,6 +1,6 @@ .. -*- coding: utf-8; mode: rst -*- -.. _dvb-frontend-event: +.. c:type:: dvb_frontend_event *************** frontend events diff --git a/Documentation/media/uapi/dvb/dvb-frontend-parameters.rst b/Documentation/media/uapi/dvb/dvb-frontend-parameters.rst index 16cb581d5cff..bf31411fc9df 100644 --- a/Documentation/media/uapi/dvb/dvb-frontend-parameters.rst +++ b/Documentation/media/uapi/dvb/dvb-frontend-parameters.rst @@ -1,6 +1,6 @@ .. -*- coding: utf-8; mode: rst -*- -.. _dvb-frontend-parameters: +.. c:type:: dvb_frontend_parameters ******************* frontend parameters @@ -49,7 +49,7 @@ frontends the ``frequency`` specifies the absolute frequency and is given in Hz. -.. _dvb-qpsk-parameters: +.. c:type:: dvb_qpsk_parameters QPSK parameters =============== @@ -66,7 +66,7 @@ structure: }; -.. _dvb-qam-parameters: +.. c:type:: dvb_qam_parameters QAM parameters ============== @@ -83,7 +83,7 @@ for cable QAM frontend you use the ``dvb_qam_parameters`` structure: }; -.. _dvb-vsb-parameters: +.. c:type:: dvb_vsb_parameters VSB parameters ============== @@ -98,7 +98,7 @@ ATSC frontends are supported by the ``dvb_vsb_parameters`` structure: }; -.. _dvb-ofdm-parameters: +.. c:type:: dvb_ofdm_parameters OFDM parameters =============== diff --git a/Documentation/media/uapi/dvb/dvbproperty.rst b/Documentation/media/uapi/dvb/dvbproperty.rst index a5a859a45381..906f3e651e10 100644 --- a/Documentation/media/uapi/dvb/dvbproperty.rst +++ b/Documentation/media/uapi/dvb/dvbproperty.rst @@ -23,7 +23,7 @@ union/struct based approach, in favor of a properties set approach. .. note:: On Linux DVB API version 3, setting a frontend were done via - :ref:`struct dvb_frontend_parameters `. + :c:type:`struct dvb_frontend_parameters `. This got replaced on version 5 (also called "S2API", as this API were added originally_enabled to provide support for DVB-S2), because the old API has a very limited support to new standards and new hardware. diff --git a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst index e1b6da08b3a1..9fda5546d8c1 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst @@ -27,7 +27,7 @@ Arguments ``argp`` pointer to struct - :ref:`dvb_diseqc_slave_reply ` + :c:type:`dvb_diseqc_slave_reply` Description @@ -35,7 +35,7 @@ Description Receives reply from a DiSEqC 2.0 command. -.. _dvb-diseqc-slave-reply: +.. c:type:: dvb_diseqc_slave_reply struct dvb_diseqc_slave_reply ----------------------------- diff --git a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst index ea090cbeaae0..72cb4ebd95c0 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst @@ -27,7 +27,7 @@ Arguments ``argp`` pointer to struct - :ref:`dvb_diseqc_master_cmd ` + :c:type:`dvb_diseqc_master_cmd` Description @@ -35,7 +35,7 @@ Description Sends a DiSEqC command to the antenna subsystem. -.. _dvb-diseqc-master-cmd: +.. c:type:: dvb_diseqc_master_cmd struct dvb_diseqc_master_cmd ============================ diff --git a/Documentation/media/uapi/dvb/fe-get-info.rst b/Documentation/media/uapi/dvb/fe-get-info.rst index c367b5ab023c..3557b756ef27 100644 --- a/Documentation/media/uapi/dvb/fe-get-info.rst +++ b/Documentation/media/uapi/dvb/fe-get-info.rst @@ -27,7 +27,7 @@ Arguments ``argp`` pointer to struct struct - :ref:`dvb_frontend_info ` + :c:type:`dvb_frontend_info` Description @@ -40,7 +40,7 @@ takes a pointer to dvb_frontend_info which is filled by the driver. When the driver is not compatible with this specification the ioctl returns an error. -.. _dvb-frontend-info: +.. c:type:: dvb_frontend_info struct dvb_frontend_info ======================== diff --git a/Documentation/media/uapi/dvb/fe-get-property.rst b/Documentation/media/uapi/dvb/fe-get-property.rst index 51daf016a8eb..015d4db597b5 100644 --- a/Documentation/media/uapi/dvb/fe-get-property.rst +++ b/Documentation/media/uapi/dvb/fe-get-property.rst @@ -29,7 +29,7 @@ Arguments File descriptor returned by :ref:`open() `. ``argp`` - pointer to struct :ref:`dtv_properties ` + pointer to struct :c:type:`dtv_properties` Description diff --git a/Documentation/media/uapi/dvb/fe-type-t.rst b/Documentation/media/uapi/dvb/fe-type-t.rst index fa377fe9e104..03a6c75bf5de 100644 --- a/Documentation/media/uapi/dvb/fe-type-t.rst +++ b/Documentation/media/uapi/dvb/fe-type-t.rst @@ -78,7 +78,7 @@ at the above, as they're supported via the new ioctl's, using the :ref:`DTV_DELIVERY_SYSTEM ` parameter. -In the old days, struct :ref:`dvb_frontend_info ` +In the old days, struct :c:type:`dvb_frontend_info` used to contain ``fe_type_t`` field to indicate the delivery systems, filled with either FE_QPSK, FE_QAM, FE_OFDM or FE_ATSC. While this is still filled to keep backward compatibility, the usage of this field @@ -87,7 +87,7 @@ devices support multiple delivery systems. Please use :ref:`DTV_ENUM_DELSYS ` instead. On devices that support multiple delivery systems, struct -:ref:`dvb_frontend_info `::``fe_type_t`` is +:c:type:`dvb_frontend_info`::``fe_type_t`` is filled with the currently standard, as selected by the last call to :ref:`FE_SET_PROPERTY ` using the :ref:`DTV_DELIVERY_SYSTEM ` property. diff --git a/Documentation/media/uapi/dvb/frontend-stat-properties.rst b/Documentation/media/uapi/dvb/frontend-stat-properties.rst index 0fc4aaa304ff..e73754fd0631 100644 --- a/Documentation/media/uapi/dvb/frontend-stat-properties.rst +++ b/Documentation/media/uapi/dvb/frontend-stat-properties.rst @@ -20,7 +20,7 @@ standards, up to 3 groups of statistics can be provided, and plus one metric per each carrier group (called "layer" on ISDB). So, in order to be consistent with other delivery systems, the first -value at :ref:`dtv_property.stat.dtv_stats ` array refers +value at :c:type:`dtv_property.stat.dtv_stats ` array refers to the global metric. The other elements of the array represent each layer, starting from layer A(index 1), layer B (index 2) and so on. diff --git a/Documentation/media/uapi/dvb/net-add-if.rst b/Documentation/media/uapi/dvb/net-add-if.rst index dfb4509f816c..dbe80c91bdb0 100644 --- a/Documentation/media/uapi/dvb/net-add-if.rst +++ b/Documentation/media/uapi/dvb/net-add-if.rst @@ -26,7 +26,7 @@ Arguments File descriptor returned by :ref:`open() `. ``net_if`` - pointer to struct :ref:`dvb_net_if ` + pointer to struct :c:type:`dvb_net_if` Description @@ -38,7 +38,7 @@ ULE) and the interface number for the new interface to be created. When the system call successfully returns, a new virtual network interface is created. -The struct :ref:`dvb_net_if `::ifnum field will be +The struct :c:type:`dvb_net_if`::ifnum field will be filled with the number of the created interface. @@ -47,7 +47,7 @@ filled with the number of the created interface. struct dvb_net_if description ============================= -.. _dvb-net-if: +.. c:type:: dvb_net_if .. flat-table:: struct dvb_net_if :header-rows: 1 diff --git a/Documentation/media/uapi/dvb/net-get-if.rst b/Documentation/media/uapi/dvb/net-get-if.rst index dd9d6a3c4a2b..1bb8ee0cbced 100644 --- a/Documentation/media/uapi/dvb/net-get-if.rst +++ b/Documentation/media/uapi/dvb/net-get-if.rst @@ -26,15 +26,15 @@ Arguments File descriptor returned by :ref:`open() `. ``net_if`` - pointer to struct :ref:`dvb_net_if ` + pointer to struct :c:type:`dvb_net_if` Description =========== The NET_GET_IF ioctl uses the interface number given by the struct -:ref:`dvb_net_if `::ifnum field and fills the content of -struct :ref:`dvb_net_if ` with the packet ID and +:c:type:`dvb_net_if`::ifnum field and fills the content of +struct :c:type:`dvb_net_if` with the packet ID and encapsulation type used on such interface. If the interface was not created yet with :ref:`NET_ADD_IF `, it will return -1 and fill the ``errno`` with ``EINVAL`` error code. diff --git a/Documentation/media/uapi/dvb/video_types.rst b/Documentation/media/uapi/dvb/video_types.rst index 671f365ceeb4..640a21de6b8a 100644 --- a/Documentation/media/uapi/dvb/video_types.rst +++ b/Documentation/media/uapi/dvb/video_types.rst @@ -95,7 +95,7 @@ representing the state of video playback. } video_play_state_t; -.. _video-command: +.. c:type:: video_command struct video_command ==================== @@ -146,7 +146,7 @@ video_size_t } video_size_t; -.. _video-event: +.. c:type:: video_event struct video_event ================== @@ -172,7 +172,7 @@ VIDEO_GET_EVENT call. }; -.. _video-status: +.. c:type:: video_status struct video_status =================== @@ -203,7 +203,7 @@ case the source video format is not the same as the format of the output device. -.. _video-still-picture: +.. c:type:: video_still_picture struct video_still_picture ========================== @@ -271,7 +271,7 @@ output. The following system types can be set: } video_system_t; -.. _video-highlight: +.. c:type:: video_highlight struct video_highlight ====================== @@ -302,7 +302,7 @@ information. The call expects the following format for that information: } video_highlight_t; -.. _video-spu: +.. c:type:: video_spu struct video_spu ================ @@ -320,7 +320,7 @@ to the following format: } video_spu_t; -.. _video-spu-palette: +.. c:type:: video_spu_palette struct video_spu_palette ======================== @@ -338,7 +338,7 @@ VIDEO_SPU_PALETTE: } video_spu_palette_t; -.. _video-navi-pack: +.. c:type:: video_navi_pack struct video_navi_pack ====================== diff --git a/Documentation/media/uapi/mediactl/media-ioc-device-info.rst b/Documentation/media/uapi/mediactl/media-ioc-device-info.rst index 412014110570..f690f9afc470 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-device-info.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-device-info.rst @@ -33,12 +33,12 @@ Description All media devices must support the ``MEDIA_IOC_DEVICE_INFO`` ioctl. To query device information, applications call the ioctl with a pointer to -a struct :ref:`media_device_info `. The driver +a struct :c:type:`media_device_info`. The driver fills the structure and returns the information to the application. The ioctl never fails. -.. _media-device-info: +.. c:type:: media_device_info .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst index 628e91aeda97..0fd329279bef 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst @@ -32,7 +32,7 @@ Description =========== To query the attributes of an entity, applications set the id field of a -struct :ref:`media_entity_desc ` structure and +struct :c:type:`media_entity_desc` structure and call the MEDIA_IOC_ENUM_ENTITIES ioctl with a pointer to this structure. The driver fills the rest of the structure or returns an EINVAL error code when the id is invalid. @@ -49,7 +49,7 @@ enumerate entities by calling MEDIA_IOC_ENUM_ENTITIES with increasing id's until they get an error. -.. _media-entity-desc: +.. c:type:: media_entity_desc .. tabularcolumns:: |p{1.5cm}|p{1.5cm}|p{1.5cm}|p{1.5cm}|p{11.5cm}| @@ -195,5 +195,5 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`media_entity_desc ` ``id`` + The struct :c:type:`media_entity_desc` ``id`` references a non-existing entity. diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst index c81765f14b9f..d05be16ffaf6 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-links.rst @@ -32,10 +32,10 @@ Description =========== To enumerate pads and/or links for a given entity, applications set the -entity field of a struct :ref:`media_links_enum ` +entity field of a struct :c:type:`media_links_enum` structure and initialize the struct -:ref:`media_pad_desc ` and struct -:ref:`media_link_desc ` structure arrays pointed by +:c:type:`media_pad_desc` and struct +:c:type:`media_link_desc` structure arrays pointed by the ``pads`` and ``links`` fields. They then call the MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this structure. @@ -53,7 +53,7 @@ Only forward links that originate at one of the entity's source pads are returned during the enumeration process. -.. _media-links-enum: +.. c:type:: media_links_enum .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -73,7 +73,7 @@ returned during the enumeration process. - .. row 2 - - struct :ref:`media_pad_desc ` + - struct :c:type:`media_pad_desc` - \*\ ``pads`` @@ -82,7 +82,7 @@ returned during the enumeration process. - .. row 3 - - struct :ref:`media_link_desc ` + - struct :c:type:`media_link_desc` - \*\ ``links`` @@ -91,7 +91,7 @@ returned during the enumeration process. -.. _media-pad-desc: +.. c:type:: media_pad_desc .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -127,7 +127,7 @@ returned during the enumeration process. -.. _media-link-desc: +.. c:type:: media_link_desc .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -139,7 +139,7 @@ returned during the enumeration process. - .. row 1 - - struct :ref:`media_pad_desc ` + - struct :c:type:`media_pad_desc` - ``source`` @@ -147,7 +147,7 @@ returned during the enumeration process. - .. row 2 - - struct :ref:`media_pad_desc ` + - struct :c:type:`media_pad_desc` - ``sink`` @@ -170,5 +170,5 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`media_links_enum ` ``id`` + The struct :c:type:`media_links_enum` ``id`` references a non-existing entity. diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst index c246df06ff7f..0b26fd865b72 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst @@ -33,7 +33,7 @@ Description The typical usage of this ioctl is to call it twice. On the first call, the structure defined at struct -:ref:`media_v2_topology ` should be zeroed. At +:c:type:`media_v2_topology` should be zeroed. At return, if no errors happen, this ioctl will return the ``topology_version`` and the total number of entities, interfaces, pads and links. @@ -48,7 +48,7 @@ desired arrays with the media graph elements. .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| -.. _media-v2-topology: +.. c:type:: media_v2_topology .. flat-table:: struct media_v2_topology :header-rows: 0 @@ -143,7 +143,7 @@ desired arrays with the media graph elements. .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| -.. _media-v2-entity: +.. c:type:: media_v2_entity .. flat-table:: struct media_v2_entity :header-rows: 0 @@ -187,7 +187,7 @@ desired arrays with the media graph elements. .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| -.. _media-v2-interface: +.. c:type:: media_v2_interface .. flat-table:: struct media_v2_interface :header-rows: 0 @@ -239,7 +239,7 @@ desired arrays with the media graph elements. .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| -.. _media-v2-intf-devnode: +.. c:type:: media_v2_intf_devnode .. flat-table:: struct media_v2_interface :header-rows: 0 @@ -266,7 +266,7 @@ desired arrays with the media graph elements. .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| -.. _media-v2-pad: +.. c:type:: media_v2_pad .. flat-table:: struct media_v2_pad :header-rows: 0 @@ -310,7 +310,7 @@ desired arrays with the media graph elements. .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| -.. _media-v2-link: +.. c:type:: media_v2_link .. flat-table:: struct media_v2_pad :header-rows: 0 diff --git a/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst b/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst index 35a189e19962..ae5194940100 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-setup-link.rst @@ -32,7 +32,7 @@ Description =========== To change link properties applications fill a struct -:ref:`media_link_desc ` with link identification +:c:type:`media_link_desc` with link identification information (source and sink pad) and the new requested link flags. They then call the MEDIA_IOC_SETUP_LINK ioctl with a pointer to that structure. @@ -61,6 +61,6 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`media_link_desc ` references a + The struct :c:type:`media_link_desc` references a non-existing link, or the link is immutable and an attempt to modify its configuration was made. diff --git a/Documentation/media/uapi/v4l/audio.rst b/Documentation/media/uapi/v4l/audio.rst index b8059fb05372..5ec99a2809fe 100644 --- a/Documentation/media/uapi/v4l/audio.rst +++ b/Documentation/media/uapi/v4l/audio.rst @@ -21,15 +21,15 @@ more than one video input or output. Assumed two composite video inputs and two audio inputs exist, there may be up to four valid combinations. The relation of video and audio connectors is defined in the ``audioset`` field of the respective struct -:ref:`v4l2_input ` or struct -:ref:`v4l2_output `, where each bit represents the index +:c:type:`v4l2_input` or struct +:c:type:`v4l2_output`, where each bit represents the index number, starting at zero, of one audio input or output. To learn about the number and attributes of the available inputs and outputs applications can enumerate them with the :ref:`VIDIOC_ENUMAUDIO` and :ref:`VIDIOC_ENUMAUDOUT ` ioctl, respectively. -The struct :ref:`v4l2_audio ` returned by the +The struct :c:type:`v4l2_audio` returned by the :ref:`VIDIOC_ENUMAUDIO` ioctl also contains signal :status information applicable when the current audio input is queried. @@ -53,7 +53,7 @@ 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 ``V4L2_CAP_AUDIO`` flag -in the struct :ref:`v4l2_capability ` returned by +in the struct :c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. @@ -91,7 +91,7 @@ Example: Switching to the first audio input } .. [#f1] - Actually struct :ref:`v4l2_audio ` ought to have a - ``tuner`` field like struct :ref:`v4l2_input `, not + Actually struct :c:type:`v4l2_audio` ought to have a + ``tuner`` field like struct :c:type:`v4l2_input`, not only making the API more consistent but also permitting radio devices with multiple tuners. diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index 7bab30b59eae..a52a586b0b41 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -11,14 +11,14 @@ the Streaming I/O methods. In the multi-planar API, the data is held in planes, while the buffer structure acts as a container for the planes. Only pointers to buffers (planes) are exchanged, the data itself is not copied. These pointers, together with meta-information like timestamps -or field parity, are stored in a struct :ref:`struct v4l2_buffer `, +or field parity, are stored in a struct :c:type:`struct v4l2_buffer `, argument to the :ref:`VIDIOC_QUERYBUF`, :ref:`VIDIOC_QBUF` and :ref:`VIDIOC_DQBUF ` ioctl. In the multi-planar API, -some plane-specific members of struct :ref:`struct v4l2_buffer `, +some plane-specific members of struct :c:type:`struct v4l2_buffer `, such as pointers and sizes for each plane, are stored in struct -:ref:`struct v4l2_plane ` instead. In that case, struct -:ref:`struct v4l2_buffer ` contains an array of plane structures. +:c:type:`struct v4l2_plane ` instead. In that case, struct +:c:type:`struct v4l2_buffer ` contains an array of plane structures. Dequeued video buffers come with timestamps. The driver decides at which part of the frame and with which clock the timestamp is taken. Please @@ -34,7 +34,7 @@ flags are copied from the OUTPUT video buffer to the CAPTURE video buffer. -.. _v4l2-buffer: +.. c:type:: v4l2_buffer struct v4l2_buffer ================== @@ -60,7 +60,7 @@ struct v4l2_buffer :ref:`VIDIOC_DQBUF `, then it is set by the driver. This field can range from zero to the number of buffers allocated with the :ref:`VIDIOC_REQBUFS` ioctl - (struct :ref:`v4l2_requestbuffers ` + (struct :c:type:`v4l2_requestbuffers` ``count``), plus any buffers allocated with :ref:`VIDIOC_CREATE_BUFS` minus one. @@ -72,8 +72,8 @@ struct v4l2_buffer - - Type of the buffer, same as struct - :ref:`v4l2_format ` ``type`` or struct - :ref:`v4l2_requestbuffers ` ``type``, set + :c:type:`v4l2_format` ``type`` or struct + :c:type:`v4l2_requestbuffers` ``type``, set by the application. See :ref:`v4l2-buf-type` - .. row 3 @@ -134,7 +134,7 @@ struct v4l2_buffer - .. row 7 - - struct :ref:`v4l2_timecode ` + - struct :c:type:`v4l2_timecode` - ``timecode`` @@ -229,9 +229,9 @@ struct v4l2_buffer - ``*planes`` - When using the multi-planar API, contains a userspace pointer to - an array of struct :ref:`v4l2_plane `. The size of + an array of struct :c:type:`v4l2_plane`. The size of the array should be put in the ``length`` field of this - :ref:`struct v4l2_buffer ` structure. + :c:type:`struct v4l2_buffer ` structure. - .. row 15 @@ -281,7 +281,7 @@ struct v4l2_buffer -.. _v4l2-plane: +.. c:type:: v4l2_plane struct v4l2_plane ================= @@ -344,10 +344,10 @@ struct v4l2_plane - ``mem_offset`` - When the memory type in the containing struct - :ref:`v4l2_buffer ` is ``V4L2_MEMORY_MMAP``, this + :c:type:`v4l2_buffer` is ``V4L2_MEMORY_MMAP``, this is the value that should be passed to :ref:`mmap() `, similar to the ``offset`` field in struct - :ref:`v4l2_buffer `. + :c:type:`v4l2_buffer`. - .. row 5 @@ -357,7 +357,7 @@ struct v4l2_plane - ``userptr`` - When the memory type in the containing struct - :ref:`v4l2_buffer ` is ``V4L2_MEMORY_USERPTR``, + :c:type:`v4l2_buffer` is ``V4L2_MEMORY_USERPTR``, this is a userspace pointer to the memory allocated for this plane by an application. @@ -369,9 +369,9 @@ struct v4l2_plane - ``fd`` - When the memory type in the containing struct - :ref:`v4l2_buffer ` is ``V4L2_MEMORY_DMABUF``, + :c:type:`v4l2_buffer` is ``V4L2_MEMORY_DMABUF``, this is a file descriptor associated with a DMABUF buffer, similar - to the ``fd`` field in struct :ref:`v4l2_buffer `. + to the ``fd`` field in struct :c:type:`v4l2_buffer`. - .. row 7 @@ -823,13 +823,13 @@ enum v4l2_memory Timecodes ========= -The :ref:`struct v4l2_timecode ` structure is designed to hold a +The :c:type:`struct v4l2_timecode ` structure is designed to hold a :ref:`smpte12m` or similar timecode. (struct :c:type:`struct timeval` timestamps are stored in struct -:ref:`v4l2_buffer ` field ``timestamp``.) +:c:type:`v4l2_buffer` field ``timestamp``.) -.. _v4l2-timecode: +.. c:type:: v4l2_timecode struct v4l2_timecode -------------------- diff --git a/Documentation/media/uapi/v4l/crop.rst b/Documentation/media/uapi/v4l/crop.rst index 4622884b06ea..3ea733a8eef8 100644 --- a/Documentation/media/uapi/v4l/crop.rst +++ b/Documentation/media/uapi/v4l/crop.rst @@ -65,7 +65,7 @@ Cropping Structures For capture devices the coordinates of the top left corner, width and height of the area which can be sampled is given by the ``bounds`` -substructure of the struct :ref:`v4l2_cropcap ` returned +substructure of the struct :c:type:`v4l2_cropcap` returned by the :ref:`VIDIOC_CROPCAP ` ioctl. To support a wide range of hardware this specification does not define an origin or units. However by convention drivers should horizontally count unscaled samples @@ -77,8 +77,8 @@ can capture both fields. The top left corner, width and height of the source rectangle, that is the area actually sampled, is given by struct -:ref:`v4l2_crop ` using the same coordinate system as -struct :ref:`v4l2_cropcap `. Applications can use the +:c:type:`v4l2_crop` using the same coordinate system as +struct :c:type:`v4l2_cropcap`. Applications can use the :ref:`VIDIOC_G_CROP ` and :ref:`VIDIOC_S_CROP ` ioctls to get and set this rectangle. It must lie completely within the capture boundaries and the driver may further adjust the requested size @@ -86,7 +86,7 @@ and/or position according to hardware limitations. Each capture device has a default source rectangle, given by the ``defrect`` substructure of struct -:ref:`v4l2_cropcap `. The center of this rectangle +:c:type:`v4l2_cropcap`. The center of this rectangle shall align with the center of the active picture area of the video signal, and cover what the driver writer considers the complete picture. Drivers shall reset the source rectangle to the default when the driver @@ -104,11 +104,11 @@ Video hardware can have various cropping, insertion and scaling limitations. It may only scale up or down, support only discrete scaling factors, or have different scaling abilities in horizontal and vertical direction. Also it may not support scaling at all. At the same time the -struct :ref:`v4l2_crop ` rectangle may have to be aligned, +struct :c:type:`v4l2_crop` rectangle may have to be aligned, and both the source and target rectangles may have arbitrary upper and lower size limits. In particular the maximum ``width`` and ``height`` in -struct :ref:`v4l2_crop ` may be smaller than the struct -:ref:`v4l2_cropcap `. ``bounds`` area. Therefore, as +struct :c:type:`v4l2_crop` may be smaller than the struct +:c:type:`v4l2_cropcap`. ``bounds`` area. Therefore, as usual, drivers are expected to adjust the requested parameters and return the actual values selected. diff --git a/Documentation/media/uapi/v4l/dev-capture.rst b/Documentation/media/uapi/v4l/dev-capture.rst index 8d049471e1c2..32b32055d070 100644 --- a/Documentation/media/uapi/v4l/dev-capture.rst +++ b/Documentation/media/uapi/v4l/dev-capture.rst @@ -26,7 +26,7 @@ Querying Capabilities Devices supporting the video capture interface set the ``V4L2_CAP_VIDEO_CAPTURE`` or ``V4L2_CAP_VIDEO_CAPTURE_MPLANE`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. As secondary device functions they may also support the :ref:`video overlay ` (``V4L2_CAP_VIDEO_OVERLAY``) and the :ref:`raw VBI capture ` @@ -64,18 +64,18 @@ Cropping initialization at minimum requires to reset the parameters to defaults. An example is given in :ref:`crop`. To query the current image format applications set the ``type`` field of -a struct :ref:`v4l2_format ` to +a struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` or ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`` and call the :ref:`VIDIOC_G_FMT ` ioctl with a pointer to this structure. Drivers fill the struct -:ref:`v4l2_pix_format ` ``pix`` or the struct -:ref:`v4l2_pix_format_mplane ` ``pix_mp`` +:c:type:`v4l2_pix_format` ``pix`` or the struct +:c:type:`v4l2_pix_format_mplane` ``pix_mp`` member of the ``fmt`` union. To request different parameters applications set the ``type`` field of a -struct :ref:`v4l2_format ` as above and initialize all -fields of the struct :ref:`v4l2_pix_format ` +struct :c:type:`v4l2_format` as above and initialize all +fields of the struct :c:type:`v4l2_pix_format` ``vbi`` member of the ``fmt`` union, or better just modify the results of :ref:`VIDIOC_G_FMT `, and call the :ref:`VIDIOC_S_FMT ` ioctl with a pointer to this structure. Drivers may adjust the @@ -86,8 +86,8 @@ Like :ref:`VIDIOC_S_FMT ` the :ref:`VIDIOC_TRY_FMT ` can be used to learn about hardware limitations without disabling I/O or possibly time consuming hardware preparations. -The contents of struct :ref:`v4l2_pix_format ` and -struct :ref:`v4l2_pix_format_mplane ` are +The contents of struct :c:type:`v4l2_pix_format` and +struct :c:type:`v4l2_pix_format_mplane` are discussed in :ref:`pixfmt`. See also the specification of the :ref:`VIDIOC_G_FMT `, :ref:`VIDIOC_S_FMT ` and :ref:`VIDIOC_TRY_FMT ` ioctls for details. Video capture devices must implement both the :ref:`VIDIOC_G_FMT ` diff --git a/Documentation/media/uapi/v4l/dev-osd.rst b/Documentation/media/uapi/v4l/dev-osd.rst index 4e1ee79ec334..a6aaf28807a4 100644 --- a/Documentation/media/uapi/v4l/dev-osd.rst +++ b/Documentation/media/uapi/v4l/dev-osd.rst @@ -28,7 +28,7 @@ Querying Capabilities Devices supporting the *Video Output Overlay* interface set the ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY`` flag in the ``capabilities`` field of -struct :ref:`v4l2_capability ` returned by the +struct :c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. @@ -41,7 +41,7 @@ accessible as a framebuffer device (``/dev/fbN``). Given a V4L2 device, applications can find the corresponding framebuffer device by calling the :ref:`VIDIOC_G_FBUF ` ioctl. It returns, amongst other information, the physical address of the framebuffer in the -``base`` field of struct :ref:`v4l2_framebuffer `. +``base`` field of struct :c:type:`v4l2_framebuffer`. The framebuffer device ioctl ``FBIOGET_FSCREENINFO`` returns the same address in the ``smem_start`` field of struct :c:type:`struct fb_fix_screeninfo`. The ``FBIOGET_FSCREENINFO`` @@ -114,18 +114,18 @@ sizes and positions of these rectangles. Further drivers may support any (or none) of the clipping/blending methods defined for the :ref:`Video Overlay ` interface. -A struct :ref:`v4l2_window ` defines the size of the +A struct :c:type:`v4l2_window` defines the size of the source rectangle, its position in the framebuffer and the clipping/blending method to be used for the overlay. To get the current parameters applications set the ``type`` field of a struct -:ref:`v4l2_format ` to +:c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY`` and call the :ref:`VIDIOC_G_FMT ` ioctl. The driver fills the -:ref:`struct v4l2_window ` substructure named ``win``. It is not +:c:type:`struct v4l2_window ` substructure named ``win``. It is not possible to retrieve a previously programmed clipping list or bitmap. To program the source rectangle applications set the ``type`` field of a -struct :ref:`v4l2_format ` to +struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY``, initialize the ``win`` substructure and call the :ref:`VIDIOC_S_FMT ` ioctl. The driver adjusts the parameters against hardware limits and returns @@ -134,10 +134,10 @@ the :ref:`VIDIOC_TRY_FMT ` ioctl can be used to learn about driver capabilities without actually changing driver state. Unlike :ref:`VIDIOC_S_FMT ` this also works after the overlay has been enabled. -A struct :ref:`v4l2_crop ` defines the size and position +A struct :c:type:`v4l2_crop` defines the size and position of the target rectangle. The scaling factor of the overlay is implied by -the width and height given in struct :ref:`v4l2_window ` -and struct :ref:`v4l2_crop `. The cropping API applies to +the width and height given in struct :c:type:`v4l2_window` +and struct :c:type:`v4l2_crop`. The cropping API applies to *Video Output* and *Video Output Overlay* devices in the same way as to *Video Capture* and *Video Overlay* devices, merely reversing the direction of the data flow. For more information see :ref:`crop`. diff --git a/Documentation/media/uapi/v4l/dev-output.rst b/Documentation/media/uapi/v4l/dev-output.rst index dfb8207c21cc..25ae8ec96fdf 100644 --- a/Documentation/media/uapi/v4l/dev-output.rst +++ b/Documentation/media/uapi/v4l/dev-output.rst @@ -25,7 +25,7 @@ Querying Capabilities Devices supporting the video output interface set the ``V4L2_CAP_VIDEO_OUTPUT`` or ``V4L2_CAP_VIDEO_OUTPUT_MPLANE`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. As secondary device functions they may also support the :ref:`raw VBI output ` (``V4L2_CAP_VBI_OUTPUT``) interface. At least one of the read/write or @@ -62,17 +62,17 @@ Cropping initialization at minimum requires to reset the parameters to defaults. An example is given in :ref:`crop`. To query the current image format applications set the ``type`` field of -a struct :ref:`v4l2_format ` to +a struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` or ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and call the :ref:`VIDIOC_G_FMT ` ioctl with a pointer to this structure. Drivers fill the struct -:ref:`v4l2_pix_format ` ``pix`` or the struct -:ref:`v4l2_pix_format_mplane ` ``pix_mp`` +:c:type:`v4l2_pix_format` ``pix`` or the struct +:c:type:`v4l2_pix_format_mplane` ``pix_mp`` member of the ``fmt`` union. To request different parameters applications set the ``type`` field of a -struct :ref:`v4l2_format ` as above and initialize all -fields of the struct :ref:`v4l2_pix_format ` +struct :c:type:`v4l2_format` as above and initialize all +fields of the struct :c:type:`v4l2_pix_format` ``vbi`` member of the ``fmt`` union, or better just modify the results of :ref:`VIDIOC_G_FMT `, and call the :ref:`VIDIOC_S_FMT ` ioctl with a pointer to this structure. Drivers may adjust the @@ -83,8 +83,8 @@ Like :ref:`VIDIOC_S_FMT ` the :ref:`VIDIOC_TRY_FMT ` can be used to learn about hardware limitations without disabling I/O or possibly time consuming hardware preparations. -The contents of struct :ref:`v4l2_pix_format ` and -struct :ref:`v4l2_pix_format_mplane ` are +The contents of struct :c:type:`v4l2_pix_format` and +struct :c:type:`v4l2_pix_format_mplane` are discussed in :ref:`pixfmt`. See also the specification of the :ref:`VIDIOC_G_FMT `, :ref:`VIDIOC_S_FMT ` and :ref:`VIDIOC_TRY_FMT ` ioctls for details. Video output devices must implement both the :ref:`VIDIOC_G_FMT ` diff --git a/Documentation/media/uapi/v4l/dev-overlay.rst b/Documentation/media/uapi/v4l/dev-overlay.rst index 50e2d52fcae6..4962947bd8a2 100644 --- a/Documentation/media/uapi/v4l/dev-overlay.rst +++ b/Documentation/media/uapi/v4l/dev-overlay.rst @@ -43,7 +43,7 @@ Querying Capabilities Devices supporting the video overlay interface set the ``V4L2_CAP_VIDEO_OVERLAY`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. The overlay I/O method specified below must be supported. Tuners and audio inputs are optional. @@ -119,17 +119,17 @@ at minimum requires to reset the parameters to defaults. An example is given in :ref:`crop`. The overlay window is described by a struct -:ref:`v4l2_window `. It defines the size of the image, +:c:type:`v4l2_window`. It defines the size of the image, its position over the graphics surface and the clipping to be applied. To get the current parameters applications set the ``type`` field of a -struct :ref:`v4l2_format ` to +struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VIDEO_OVERLAY`` and call the :ref:`VIDIOC_G_FMT ` ioctl. The driver fills the -:ref:`struct v4l2_window ` substructure named ``win``. It is not +:c:type:`struct v4l2_window ` substructure named ``win``. It is not possible to retrieve a previously programmed clipping list or bitmap. To program the overlay window applications set the ``type`` field of a -struct :ref:`v4l2_format ` to +struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VIDEO_OVERLAY``, initialize the ``win`` substructure and call the :ref:`VIDIOC_S_FMT ` ioctl. The driver adjusts the parameters against hardware limits and returns the actual @@ -139,7 +139,7 @@ about driver capabilities without actually changing driver state. Unlike :ref:`VIDIOC_S_FMT ` this also works after the overlay has been enabled. The scaling factor of the overlaid image is implied by the width and -height given in struct :ref:`v4l2_window ` and the size +height given in struct :c:type:`v4l2_window` and the size of the cropping rectangle. For more information see :ref:`crop`. When simultaneous capturing and overlay is supported and the hardware @@ -149,7 +149,7 @@ takes precedence. The attempt to capture or overlay as well code or return accordingly modified parameters. -.. _v4l2-window: +.. c:type:: v4l2_window struct v4l2_window ------------------ @@ -175,7 +175,7 @@ struct v4l2_window :ref:`VIDIOC_S_FBUF ` applications set this field to the desired pixel value for the chroma key. The format is the same as the pixel format of the framebuffer (struct - :ref:`v4l2_framebuffer ` ``fmt.pixelformat`` + :c:type:`v4l2_framebuffer` ``fmt.pixelformat`` field), with bytes in host order. E. g. for :ref:`V4L2_PIX_FMT_BGR24 ` the value should be 0xRRGGBB on a little endian, 0xBBGGRR on a big endian host. @@ -242,11 +242,11 @@ exceeded are undefined. [#f3]_ This field was added in Linux 2.6.23, extending the structure. However the :ref:`VIDIOC_[G|S|TRY]_FMT ` - ioctls, which take a pointer to a :ref:`v4l2_format ` + ioctls, which take a pointer to a :c:type:`v4l2_format` parent structure with padding bytes at the end, are not affected. -.. _v4l2-clip: +.. c:type:: v4l2_clip struct v4l2_clip [#f4]_ ----------------------- @@ -262,7 +262,7 @@ struct v4l2_clip [#f4]_ linked list of clipping rectangles. -.. _v4l2-rect: +.. c:type:: v4l2_rect struct v4l2_rect ---------------- diff --git a/Documentation/media/uapi/v4l/dev-radio.rst b/Documentation/media/uapi/v4l/dev-radio.rst index 5ff7cded2591..2b5b836574eb 100644 --- a/Documentation/media/uapi/v4l/dev-radio.rst +++ b/Documentation/media/uapi/v4l/dev-radio.rst @@ -20,7 +20,7 @@ Querying Capabilities Devices supporting the radio interface set the ``V4L2_CAP_RADIO`` and ``V4L2_CAP_TUNER`` or ``V4L2_CAP_MODULATOR`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. Other combinations of capability flags are reserved for future extensions. diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst b/Documentation/media/uapi/v4l/dev-raw-vbi.rst index 3cf44869a425..26ec24a94103 100644 --- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst @@ -39,7 +39,7 @@ Querying Capabilities Devices supporting the raw VBI capturing or output API set the ``V4L2_CAP_VBI_CAPTURE`` or ``V4L2_CAP_VBI_OUTPUT`` flags, respectively, in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. At least one of the read/write, streaming or asynchronous I/O methods must be supported. VBI devices may or may not have a tuner or modulator. @@ -69,16 +69,16 @@ always ensure they really get what they want, requesting reasonable parameters and then checking if the actual parameters are suitable. To query the current raw VBI capture parameters applications set the -``type`` field of a struct :ref:`v4l2_format ` to +``type`` field of a struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VBI_CAPTURE`` or ``V4L2_BUF_TYPE_VBI_OUTPUT``, and call the :ref:`VIDIOC_G_FMT ` ioctl with a pointer to this structure. Drivers fill the struct -:ref:`v4l2_vbi_format ` ``vbi`` member of the +:c:type:`v4l2_vbi_format` ``vbi`` member of the ``fmt`` union. To request different parameters applications set the ``type`` field of a -struct :ref:`v4l2_format ` as above and initialize all -fields of the struct :ref:`v4l2_vbi_format ` +struct :c:type:`v4l2_format` as above and initialize all +fields of the struct :c:type:`v4l2_vbi_format` ``vbi`` member of the ``fmt`` union, or better just modify the results of :ref:`VIDIOC_G_FMT `, and call the :ref:`VIDIOC_S_FMT ` ioctl with a pointer to this structure. Drivers return an ``EINVAL`` error @@ -101,7 +101,7 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does .. tabularcolumns:: |p{2.4cm}|p{4.4cm}|p{10.7cm}| -.. _v4l2-vbi-format: +.. c:type:: v4l2_vbi_format .. cssclass:: longtable @@ -204,7 +204,7 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does To initialize the ``start`` and ``count`` fields, applications must first determine the current video standard selection. The :ref:`v4l2_std_id ` or the ``framelines`` field - of struct :ref:`v4l2_standard ` can be evaluated + of struct :c:type:`v4l2_standard` can be evaluated for this purpose. - .. row 8 diff --git a/Documentation/media/uapi/v4l/dev-rds.rst b/Documentation/media/uapi/v4l/dev-rds.rst index 841761a3ea59..4a8e1d2efd06 100644 --- a/Documentation/media/uapi/v4l/dev-rds.rst +++ b/Documentation/media/uapi/v4l/dev-rds.rst @@ -34,10 +34,10 @@ Querying Capabilities Devices supporting the RDS capturing API set the ``V4L2_CAP_RDS_CAPTURE`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. Any tuner that supports RDS will set the ``V4L2_TUNER_CAP_RDS`` flag in the -``capability`` field of struct :ref:`v4l2_tuner `. If the +``capability`` field of struct :c:type:`v4l2_tuner`. If the driver only passes RDS blocks without interpreting the data the ``V4L2_TUNER_CAP_RDS_BLOCK_IO`` flag has to be set, see :ref:`Reading RDS data `. For future use the flag @@ -48,19 +48,19 @@ linux-media mailing list: `https://linuxtv.org/lists.php `__. Whether an RDS signal is present can be detected by looking at the -``rxsubchans`` field of struct :ref:`v4l2_tuner `: the +``rxsubchans`` field of struct :c:type:`v4l2_tuner`: the ``V4L2_TUNER_SUB_RDS`` will be set if RDS data was detected. Devices supporting the RDS output API set the ``V4L2_CAP_RDS_OUTPUT`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. Any modulator that supports RDS will set the ``V4L2_TUNER_CAP_RDS`` flag in the ``capability`` field of struct -:ref:`v4l2_modulator `. In order to enable the RDS +:c:type:`v4l2_modulator`. In order to enable the RDS transmission one must set the ``V4L2_TUNER_SUB_RDS`` bit in the ``txsubchans`` field of struct -:ref:`v4l2_modulator `. If the driver only passes RDS +:c:type:`v4l2_modulator`. If the driver only passes RDS blocks without interpreting the data the ``V4L2_TUNER_CAP_RDS_BLOCK_IO`` flag has to be set. If the tuner is capable of handling RDS entities like program identification codes and radio text, the flag @@ -93,7 +93,7 @@ RDS datastructures ================== -.. _v4l2-rds-data: +.. c:type:: v4l2_rds_data .. tabularcolumns:: |p{2.5cm}|p{2.5cm}|p{12.5cm}| diff --git a/Documentation/media/uapi/v4l/dev-sdr.rst b/Documentation/media/uapi/v4l/dev-sdr.rst index 3b6aa2a58430..5f82d760e188 100644 --- a/Documentation/media/uapi/v4l/dev-sdr.rst +++ b/Documentation/media/uapi/v4l/dev-sdr.rst @@ -21,7 +21,7 @@ Querying Capabilities Devices supporting the SDR receiver interface set the ``V4L2_CAP_SDR_CAPTURE`` and ``V4L2_CAP_TUNER`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. That flag means the device has an Analog to Digital Converter (ADC), which is a mandatory element for the SDR receiver. @@ -29,7 +29,7 @@ element for the SDR receiver. Devices supporting the SDR transmitter interface set the ``V4L2_CAP_SDR_OUTPUT`` and ``V4L2_CAP_MODULATOR`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. That flag means the device has an Digital to Analog Converter (DAC), which is a mandatory element for the SDR transmitter. @@ -67,18 +67,18 @@ basic :ref:`format` ioctls, the well. To use the :ref:`format` ioctls applications set the ``type`` -field of a struct :ref:`v4l2_format ` to +field of a struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_SDR_CAPTURE`` or ``V4L2_BUF_TYPE_SDR_OUTPUT`` and use -the struct :ref:`v4l2_sdr_format ` ``sdr`` member +the struct :c:type:`v4l2_sdr_format` ``sdr`` member of the ``fmt`` union as needed per the desired operation. Currently there is two fields, ``pixelformat`` and ``buffersize``, of struct -struct :ref:`v4l2_sdr_format ` which are used. +struct :c:type:`v4l2_sdr_format` which are used. Content of the ``pixelformat`` is V4L2 FourCC code of the data format. The ``buffersize`` field is maximum buffer size in bytes required for data transfer, set by the driver in order to inform application. -.. _v4l2-sdr-format: +.. c:type:: v4l2_sdr_format .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst index 86d2d698d2af..2a979aa138bd 100644 --- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst @@ -34,7 +34,7 @@ Querying Capabilities Devices supporting the sliced VBI capturing or output API set the ``V4L2_CAP_SLICED_VBI_CAPTURE`` or ``V4L2_CAP_SLICED_VBI_OUTPUT`` flag respectively, in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. At least one of the read/write, streaming or asynchronous :ref:`I/O methods ` must be supported. Sliced VBI devices may have a tuner or modulator. @@ -67,17 +67,17 @@ line 16 the hardware may be able to look for a VPS or Teletext signal, but not both at the same time. To determine the currently selected services applications set the -``type`` field of struct :ref:`v4l2_format ` to +``type`` field of struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE`` or ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT``, and the :ref:`VIDIOC_G_FMT ` ioctl fills the ``fmt.sliced`` member, a struct -:ref:`v4l2_sliced_vbi_format `. +:c:type:`v4l2_sliced_vbi_format`. Applications can request different parameters by initializing or modifying the ``fmt.sliced`` member and calling the :ref:`VIDIOC_S_FMT ` ioctl with a pointer to the -:ref:`struct v4l2_format ` structure. +:c:type:`struct v4l2_format ` structure. The sliced VBI API is more complicated than the raw VBI API because the hardware must be told which VBI service to expect on each scan line. Not @@ -100,7 +100,7 @@ which may return ``EBUSY`` can be the :ref:`select() ` call. -.. _v4l2-sliced-vbi-format: +.. c:type:: v4l2_sliced_vbi_format struct v4l2_sliced_vbi_format ----------------------------- @@ -233,7 +233,7 @@ struct v4l2_sliced_vbi_format :ref:`VIDIOC_QBUF` and :ref:`VIDIOC_DQBUF ` ioctl. Drivers set this field to the size of struct - :ref:`v4l2_sliced_vbi_data ` times the + :c:type:`v4l2_sliced_vbi_data` times the number of non-zero elements in the returned ``service_lines`` array (that is the number of lines potentially carrying data). @@ -376,14 +376,14 @@ Reading and writing sliced VBI data A single :ref:`read() ` or :ref:`write() ` call must pass all data belonging to one video frame. That is an array -of :ref:`struct v4l2_sliced_vbi_data ` structures with one or +of :c:type:`struct v4l2_sliced_vbi_data ` structures with one or more elements and a total size not exceeding ``io_size`` bytes. Likewise in streaming I/O mode one buffer of ``io_size`` bytes must contain data of one video frame. The ``id`` of unused -:ref:`struct v4l2_sliced_vbi_data ` elements must be zero. +:c:type:`struct v4l2_sliced_vbi_data ` elements must be zero. -.. _v4l2-sliced-vbi-data: +.. c:type:: v4l2_sliced_vbi_data struct v4l2_sliced_vbi_data --------------------------- @@ -561,7 +561,7 @@ refer to the MPEG-2 specifications for details on those packet headers.) The payload of the MPEG-2 *Private Stream 1 PES* packets that contain sliced VBI data is specified by struct -:ref:`v4l2_mpeg_vbi_fmt_ivtv `. The +:c:type:`v4l2_mpeg_vbi_fmt_ivtv`. The payload is variable length, depending on the actual number of lines of sliced VBI data present in a video frame. The payload may be padded at the end with unspecified fill bytes to align the end of the payload to a @@ -570,7 +570,7 @@ with 18 lines/field with 43 bytes of data/line and a 4 byte magic number). -.. _v4l2-mpeg-vbi-fmt-ivtv: +.. c:type:: v4l2_mpeg_vbi_fmt_ivtv struct v4l2_mpeg_vbi_fmt_ivtv ----------------------------- @@ -604,7 +604,7 @@ struct v4l2_mpeg_vbi_fmt_ivtv - .. row 3 - - - struct :ref:`v4l2_mpeg_vbi_itv0 ` + - struct :c:type:`v4l2_mpeg_vbi_itv0` - ``itv0`` @@ -655,7 +655,7 @@ Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field - "itv0" - Indicates the ``itv0`` member of the union in struct - :ref:`v4l2_mpeg_vbi_fmt_ivtv ` is + :c:type:`v4l2_mpeg_vbi_fmt_ivtv` is valid. - .. row 3 @@ -665,12 +665,12 @@ Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field - "ITV0" - Indicates the ``ITV0`` member of the union in struct - :ref:`v4l2_mpeg_vbi_fmt_ivtv ` is + :c:type:`v4l2_mpeg_vbi_fmt_ivtv` is valid and that 36 lines of sliced VBI data are present. -.. _v4l2-mpeg-vbi-itv0: +.. c:type:: v4l2_mpeg_vbi_itv0 struct v4l2_mpeg_vbi_itv0 ------------------------- @@ -711,7 +711,7 @@ struct v4l2_mpeg_vbi_itv0 - .. row 2 - struct - :ref:`v4l2_mpeg_vbi_itv0_line ` + :c:type:`v4l2_mpeg_vbi_itv0_line` - ``line``\ [35] @@ -745,7 +745,7 @@ struct v4l2_mpeg_vbi_ITV0 - .. row 1 - struct - :ref:`v4l2_mpeg_vbi_itv0_line ` + :c:type:`v4l2_mpeg_vbi_itv0_line` - ``line``\ [36] @@ -756,7 +756,7 @@ struct v4l2_mpeg_vbi_ITV0 -.. _v4l2-mpeg-vbi-itv0-line: +.. c:type:: v4l2_mpeg_vbi_itv0_line struct v4l2_mpeg_vbi_itv0_line ------------------------------ diff --git a/Documentation/media/uapi/v4l/dev-subdev.rst b/Documentation/media/uapi/v4l/dev-subdev.rst index 1045b3c61031..6dc7f13780ba 100644 --- a/Documentation/media/uapi/v4l/dev-subdev.rst +++ b/Documentation/media/uapi/v4l/dev-subdev.rst @@ -341,7 +341,7 @@ It can also be used as part of digital zoom implementations to select the area of the image that will be scaled up. Crop settings are defined by a crop rectangle and represented in a -struct :ref:`v4l2_rect ` by the coordinates of the top +struct :c:type:`v4l2_rect` by the coordinates of the top left corner and the rectangle size. Both the coordinates and sizes are expressed in pixels. @@ -357,7 +357,7 @@ sub-device for processing. The scaling operation changes the size of the image by scaling it to new dimensions. The scaling ratio isn't specified explicitly, but is implied from the original and scaled image sizes. Both sizes are represented by -struct :ref:`v4l2_rect `. +struct :c:type:`v4l2_rect`. Scaling support is optional. When supported by a subdev, the crop rectangle on the subdev's sink pad is scaled to the size configured diff --git a/Documentation/media/uapi/v4l/dev-touch.rst b/Documentation/media/uapi/v4l/dev-touch.rst index 1f4e75243a47..98797f255ce0 100644 --- a/Documentation/media/uapi/v4l/dev-touch.rst +++ b/Documentation/media/uapi/v4l/dev-touch.rst @@ -41,7 +41,7 @@ Querying Capabilities Devices supporting the touch interface set the ``V4L2_CAP_VIDEO_CAPTURE`` flag and the ``V4L2_CAP_TOUCH`` flag in the ``capabilities`` field of -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl. At least one of the read/write or streaming I/O methods must be diff --git a/Documentation/media/uapi/v4l/diff-v4l.rst b/Documentation/media/uapi/v4l/diff-v4l.rst index 93263e477127..93794e015e7c 100644 --- a/Documentation/media/uapi/v4l/diff-v4l.rst +++ b/Documentation/media/uapi/v4l/diff-v4l.rst @@ -88,7 +88,7 @@ The V4L ``VIDIOCGCAP`` ioctl is equivalent to V4L2's :ref:`VIDIOC_QUERYCAP`. The ``name`` field in struct :c:type:`struct video_capability` became -``card`` in struct :ref:`v4l2_capability `, ``type`` +``card`` in struct :c:type:`v4l2_capability`, ``type`` was replaced by ``capabilities``. Note V4L2 does not distinguish between device types like this, better think of basic video input, video output and radio devices supporting a set of related functions like video @@ -108,7 +108,7 @@ introduction. - ``struct video_capability`` ``type`` - - struct :ref:`v4l2_capability ` + - struct :c:type:`v4l2_capability` ``capabilities`` flags - Purpose @@ -150,7 +150,7 @@ introduction. - ``VID_TYPE_CHROMAKEY`` - ``V4L2_FBUF_CAP_CHROMAKEY`` in field ``capability`` of struct - :ref:`v4l2_framebuffer ` + :c:type:`v4l2_framebuffer` - Whether chromakey overlay is supported. For more information on overlay see :ref:`overlay`. @@ -161,7 +161,7 @@ introduction. - ``V4L2_FBUF_CAP_LIST_CLIPPING`` and ``V4L2_FBUF_CAP_BITMAP_CLIPPING`` in field ``capability`` of - struct :ref:`v4l2_framebuffer ` + struct :c:type:`v4l2_framebuffer` - Whether clipping the overlaid image is supported, see :ref:`overlay`. @@ -171,7 +171,7 @@ introduction. - ``VID_TYPE_FRAMERAM`` - ``V4L2_FBUF_CAP_EXTERNOVERLAY`` *not set* in field ``capability`` - of struct :ref:`v4l2_framebuffer ` + of struct :c:type:`v4l2_framebuffer` - Whether overlay overwrites frame buffer memory, see :ref:`overlay`. @@ -269,7 +269,7 @@ device. The equivalent V4L2 ioctls are :ref:`VIDIOC_ENUMINPUT`, :ref:`VIDIOC_G_INPUT ` and :ref:`VIDIOC_S_INPUT ` using struct -:ref:`v4l2_input ` as discussed in :ref:`video`. +:c:type:`v4l2_input` as discussed in :ref:`video`. The ``channel`` field counting inputs was renamed to ``index``, the video input types were renamed as follows: @@ -285,7 +285,7 @@ video input types were renamed as follows: - struct :c:type:`struct video_channel` ``type`` - - struct :ref:`v4l2_input ` ``type`` + - struct :c:type:`v4l2_input` ``type`` - .. row 2 @@ -305,7 +305,7 @@ input, V4L2 assumes each video input is connected to at most one tuner. However a tuner can have more than one input, i. e. RF connectors, and a device can have multiple tuners. The index number of the tuner associated with the input, if any, is stored in field ``tuner`` of -struct :ref:`v4l2_input `. Enumeration of tuners is +struct :c:type:`v4l2_input`. Enumeration of tuners is discussed in :ref:`tuner`. The redundant ``VIDEO_VC_TUNER`` flag was dropped. Video inputs @@ -332,7 +332,7 @@ The V4L ``VIDIOCGTUNER`` and ``VIDIOCSTUNER`` ioctl and struct V4L TV or radio device. The equivalent V4L2 ioctls are :ref:`VIDIOC_G_TUNER ` and :ref:`VIDIOC_S_TUNER ` using struct -:ref:`v4l2_tuner `. Tuners are covered in :ref:`tuner`. +:c:type:`v4l2_tuner`. Tuners are covered in :ref:`tuner`. The ``tuner`` field counting tuners was renamed to ``index``. The fields ``name``, ``rangelow`` and ``rangehigh`` remained unchanged. @@ -340,7 +340,7 @@ The ``tuner`` field counting tuners was renamed to ``index``. The fields The ``VIDEO_TUNER_PAL``, ``VIDEO_TUNER_NTSC`` and ``VIDEO_TUNER_SECAM`` flags indicating the supported video standards were dropped. This information is now contained in the associated struct -:ref:`v4l2_input `. No replacement exists for the +:c:type:`v4l2_input`. No replacement exists for the ``VIDEO_TUNER_NORM`` flag indicating whether the video standard can be switched. The ``mode`` field to select a different video standard was replaced by a whole new set of ioctls and structures described in @@ -353,18 +353,18 @@ Japan with numbers 3-6 (sic). The ``VIDEO_TUNER_STEREO_ON`` flag indicating stereo reception became ``V4L2_TUNER_SUB_STEREO`` in field ``rxsubchans``. This field also permits the detection of monaural and bilingual audio, see the -definition of struct :ref:`v4l2_tuner ` for details. +definition of struct :c:type:`v4l2_tuner` for details. Presently no replacement exists for the ``VIDEO_TUNER_RDS_ON`` and ``VIDEO_TUNER_MBS_ON`` flags. The ``VIDEO_TUNER_LOW`` flag was renamed to ``V4L2_TUNER_CAP_LOW`` in -the struct :ref:`v4l2_tuner ` ``capability`` field. +the struct :c:type:`v4l2_tuner` ``capability`` field. The ``VIDIOCGFREQ`` and ``VIDIOCSFREQ`` ioctl to change the tuner frequency where renamed to :ref:`VIDIOC_G_FREQUENCY ` and :ref:`VIDIOC_S_FREQUENCY `. They take a pointer -to a struct :ref:`v4l2_frequency ` instead of an +to a struct :c:type:`v4l2_frequency` instead of an unsigned long integer. @@ -434,7 +434,7 @@ The ``depth`` (average number of bits per pixel) of a video image is implied by the selected image 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 ``palette`` field moved -into the struct :ref:`v4l2_pix_format `: +into the struct :c:type:`v4l2_pix_format`: @@ -447,7 +447,7 @@ into the struct :ref:`v4l2_pix_format `: - struct :c:type:`struct video_picture` ``palette`` - - struct :ref:`v4l2_pix_format ` ``pixfmt`` + - struct :c:type:`v4l2_pix_format` ``pixfmt`` - .. row 2 @@ -558,7 +558,7 @@ The ``VIDIOCGAUDIO`` and ``VIDIOCSAUDIO`` ioctl and struct of a V4L device. The equivalent V4L2 ioctls are :ref:`VIDIOC_G_AUDIO ` and :ref:`VIDIOC_S_AUDIO ` using struct -:ref:`v4l2_audio ` as discussed in :ref:`audio`. +:c:type:`v4l2_audio` as discussed in :ref:`audio`. The ``audio`` "channel number" field counting audio inputs was renamed to ``index``. @@ -571,10 +571,10 @@ standard is BTSC ``VIDEO_SOUND_LANG2`` refers to SAP and specification, there is no way to query the selected mode. On ``VIDIOCGAUDIO`` the driver returns the *actually received* audio programmes in this field. In the V4L2 API this information is stored in -the struct :ref:`v4l2_tuner ` ``rxsubchans`` and +the struct :c:type:`v4l2_tuner` ``rxsubchans`` and ``audmode`` fields, respectively. See :ref:`tuner` for more information on tuners. Related to audio modes struct -:ref:`v4l2_audio ` also reports if this is a mono or +:c:type:`v4l2_audio` also reports if this is a mono or stereo input, regardless if the source is a tuner. The following fields where replaced by V4L2 controls accessible with the @@ -645,8 +645,8 @@ The V4L2 ioctls equivalent to ``VIDIOCGFBUF`` and ``VIDIOCSFBUF`` are :c:type:`struct video_buffer` remained unchanged, except V4L2 defines a flag to indicate non-destructive overlays instead of a ``NULL`` pointer. All other fields moved into the struct -:ref:`v4l2_pix_format ` ``fmt`` substructure of -struct :ref:`v4l2_framebuffer `. The ``depth`` +:c:type:`v4l2_pix_format` ``fmt`` substructure of +struct :c:type:`v4l2_framebuffer`. The ``depth`` field was replaced by ``pixelformat``. See :ref:`pixfmt-rgb` for a list of RGB formats and their respective color depths. @@ -654,23 +654,23 @@ Instead of the special ioctls ``VIDIOCGWIN`` and ``VIDIOCSWIN`` V4L2 uses the general-purpose data format negotiation ioctls :ref:`VIDIOC_G_FMT ` and :ref:`VIDIOC_S_FMT `. They take a pointer to a struct -:ref:`v4l2_format ` as argument. Here the ``win`` member +:c:type:`v4l2_format` as argument. Here the ``win`` member of the ``fmt`` union is used, a struct -:ref:`v4l2_window `. +:c:type:`v4l2_window`. The ``x``, ``y``, ``width`` and ``height`` fields of struct :c:type:`struct video_window` moved into struct -:ref:`v4l2_rect ` substructure ``w`` of struct +:c:type:`v4l2_rect` substructure ``w`` of struct :c:type:`struct v4l2_window`. The ``chromakey``, ``clips``, and ``clipcount`` fields remained unchanged. Struct :c:type:`struct video_clip` was renamed to struct -:ref:`v4l2_clip `, also containing a struct +:c:type:`v4l2_clip`, also containing a struct :c:type:`struct v4l2_rect`, but the semantics are still the same. The ``VIDEO_WINDOW_INTERLACE`` flag was dropped. Instead applications must set the ``field`` field to ``V4L2_FIELD_ANY`` or ``V4L2_FIELD_INTERLACED``. The ``VIDEO_WINDOW_CHROMAKEY`` flag moved -into struct :ref:`v4l2_framebuffer `, under the new +into struct :c:type:`v4l2_framebuffer`, under the new name ``V4L2_FBUF_FLAG_CHROMAKEY``. In V4L, storing a bitmap pointer in ``clips`` and setting ``clipcount`` @@ -691,12 +691,12 @@ To capture only a subsection of the full picture V4L defines the :c:type:`struct video_capture`. The equivalent V4L2 ioctls are :ref:`VIDIOC_G_CROP ` and :ref:`VIDIOC_S_CROP ` using struct -:ref:`v4l2_crop `, and the related +:c:type:`v4l2_crop`, and the related :ref:`VIDIOC_CROPCAP` ioctl. This is a rather complex matter, see :ref:`crop` for details. The ``x``, ``y``, ``width`` and ``height`` fields moved into struct -:ref:`v4l2_rect ` substructure ``c`` of struct +:c:type:`v4l2_rect` substructure ``c`` of struct :c:type:`struct v4l2_crop`. The ``decimation`` field was dropped. In the V4L2 API the scaling factor is implied by the size of the cropping rectangle and the size of the captured or overlaid image. @@ -704,8 +704,8 @@ rectangle and the size of the captured or overlaid image. The ``VIDEO_CAPTURE_ODD`` and ``VIDEO_CAPTURE_EVEN`` flags to capture only the odd or even field, respectively, were replaced by ``V4L2_FIELD_TOP`` and ``V4L2_FIELD_BOTTOM`` in the field named -``field`` of struct :ref:`v4l2_pix_format ` and -struct :ref:`v4l2_window `. These structures are used to +``field`` of struct :c:type:`v4l2_pix_format` and +struct :c:type:`v4l2_window`. These structures are used to select a capture or overlay format with the :ref:`VIDIOC_S_FMT ` ioctl. @@ -730,8 +730,8 @@ To select an image format and size, V4L provides the ``VIDIOCSPICT`` and ``VIDIOCSWIN`` ioctls. V4L2 uses the general-purpose data format negotiation ioctls :ref:`VIDIOC_G_FMT ` and :ref:`VIDIOC_S_FMT `. They take a pointer to a struct -:ref:`v4l2_format ` as argument, here the struct -:ref:`v4l2_pix_format ` named ``pix`` of its +:c:type:`v4l2_format` as argument, here the struct +:c:type:`v4l2_pix_format` named ``pix`` of its ``fmt`` union is used. For more information about the V4L2 read interface see :ref:`rw`. @@ -838,7 +838,7 @@ with the following parameters: - .. row 1 - - struct :ref:`v4l2_vbi_format ` + - struct :c:type:`v4l2_vbi_format` - V4L, BTTV driver @@ -896,7 +896,7 @@ interface specified in :ref:`raw-vbi`. An ``offset`` field does not exist, ``sample_format`` is supposed to be ``VIDEO_PALETTE_RAW``, equivalent to ``V4L2_PIX_FMT_GREY``. The remaining fields are probably equivalent to struct -:ref:`v4l2_vbi_format `. +:c:type:`v4l2_vbi_format`. Apparently only the Zoran (ZR 36120) driver implements these ioctls. The semantics differ from those specified for V4L2 in two ways. The diff --git a/Documentation/media/uapi/v4l/dmabuf.rst b/Documentation/media/uapi/v4l/dmabuf.rst index 675768f7c66a..4e980a7e9c9c 100644 --- a/Documentation/media/uapi/v4l/dmabuf.rst +++ b/Documentation/media/uapi/v4l/dmabuf.rst @@ -19,7 +19,7 @@ exporting V4L2 buffers as DMABUF file descriptors. Input and output devices support the streaming I/O method when the ``V4L2_CAP_STREAMING`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP ` ioctl is set. Whether importing DMA buffers through DMABUF file descriptors is supported is determined by calling the :ref:`VIDIOC_REQBUFS ` @@ -31,8 +31,8 @@ DRM). Buffers (planes) are allocated by a driver on behalf of an application. Next, these buffers are exported to the application as file descriptors using an API which is specific for an allocator driver. Only such file descriptor are exchanged. The descriptors and meta-information -are passed in struct :ref:`v4l2_buffer ` (or in struct -:ref:`v4l2_plane ` in the multi-planar API case). The +are passed in struct :c:type:`v4l2_buffer` (or in struct +:c:type:`v4l2_plane` in the multi-planar API case). The driver must be switched into DMABUF I/O mode by calling the :ref:`VIDIOC_REQBUFS ` with the desired buffer type. @@ -151,7 +151,7 @@ To start and stop capturing or displaying applications call the both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything "now" on a multitasking system, if an application needs to synchronize with another event it should examine - the struct :ref:`v4l2_buffer ` ``timestamp`` of captured or + the struct :c:type:`v4l2_buffer` ``timestamp`` of captured or outputted buffers. Drivers implementing DMABUF importing I/O must support the diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 1f1518e4859d..75359739eb52 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -49,7 +49,7 @@ control). This is needed since it is often required to atomically change several controls at once. Each of the new ioctls expects a pointer to a struct -:ref:`v4l2_ext_controls `. This structure +:c:type:`v4l2_ext_controls`. This structure contains a pointer to the control array, a count of the number of controls in that array and a control class. Control classes are used to group similar controls into a single class. For example, control class @@ -65,12 +65,12 @@ It is also possible to use an empty control array (``count`` == 0) to check whether the specified control class is supported. The control array is a struct -:ref:`v4l2_ext_control ` array. The -:ref:`struct v4l2_ext_control ` structure is very similar to -struct :ref:`v4l2_control `, except for the fact that +:c:type:`v4l2_ext_control` array. The +:c:type:`struct v4l2_ext_control ` structure is very similar to +struct :c:type:`v4l2_control`, except for the fact that it also allows for 64-bit values and pointers to be passed. -Since the struct :ref:`v4l2_ext_control ` supports +Since the struct :c:type:`v4l2_ext_control` supports pointers it is now also possible to have controls with compound types such as N-dimensional arrays and/or structures. You need to specify the ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` when enumerating controls to actually diff --git a/Documentation/media/uapi/v4l/field-order.rst b/Documentation/media/uapi/v4l/field-order.rst index 95e9d2a41f1d..1fa082f34c6f 100644 --- a/Documentation/media/uapi/v4l/field-order.rst +++ b/Documentation/media/uapi/v4l/field-order.rst @@ -47,7 +47,7 @@ clearer. All video capture and output devices must report the current field order. Some drivers may permit the selection of a different order, to this end applications initialize the ``field`` field of struct -:ref:`v4l2_pix_format ` before calling the +:c:type:`v4l2_pix_format` before calling the :ref:`VIDIOC_S_FMT ` ioctl. If this is not desired it should have the value ``V4L2_FIELD_ANY`` (0). @@ -80,7 +80,7 @@ enum v4l2_field driver must choose one of the possible field orders during :ref:`VIDIOC_S_FMT ` or :ref:`VIDIOC_TRY_FMT `. struct - :ref:`v4l2_buffer ` ``field`` can never be + :c:type:`v4l2_buffer` ``field`` can never be ``V4L2_FIELD_ANY``. - .. row 2 @@ -156,12 +156,12 @@ enum v4l2_field temporal order, i. e. the older one first. To indicate the field parity (whether the current field is a top or bottom field) the driver or application, depending on data direction, must set - struct :ref:`v4l2_buffer ` ``field`` to + struct :c:type:`v4l2_buffer` ``field`` to ``V4L2_FIELD_TOP`` or ``V4L2_FIELD_BOTTOM``. 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 struct - :ref:`v4l2_buffer ` ``sequence`` field. This + :c:type:`v4l2_buffer` ``sequence`` 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. diff --git a/Documentation/media/uapi/v4l/format.rst b/Documentation/media/uapi/v4l/format.rst index 7c73278849ca..452c6d59cad5 100644 --- a/Documentation/media/uapi/v4l/format.rst +++ b/Documentation/media/uapi/v4l/format.rst @@ -22,7 +22,7 @@ to satisfy the request. Of course applications can also just query the current selection. A single mechanism exists to negotiate all data formats using the -aggregate struct :ref:`v4l2_format ` and the +aggregate struct :c:type:`v4l2_format` and the :ref:`VIDIOC_G_FMT ` and :ref:`VIDIOC_S_FMT ` ioctls. Additionally the :ref:`VIDIOC_TRY_FMT ` ioctl can be used to examine diff --git a/Documentation/media/uapi/v4l/func-mmap.rst b/Documentation/media/uapi/v4l/func-mmap.rst index bd19cef952f5..6d2ce539bd72 100644 --- a/Documentation/media/uapi/v4l/func-mmap.rst +++ b/Documentation/media/uapi/v4l/func-mmap.rst @@ -37,9 +37,9 @@ Arguments ``length`` Length of the memory area to map. This must be the same value as returned by the driver in the struct - :ref:`v4l2_buffer ` ``length`` field for the + :c:type:`v4l2_buffer` ``length`` field for the single-planar API, and the same value as returned by the driver in - the struct :ref:`v4l2_plane ` ``length`` field for + the struct :c:type:`v4l2_plane` ``length`` field for the multi-planar API. ``prot`` @@ -92,9 +92,9 @@ Arguments ``offset`` Offset of the buffer in device memory. This must be the same value as returned by the driver in the struct - :ref:`v4l2_buffer ` ``m`` union ``offset`` field for + :c:type:`v4l2_buffer` ``m`` union ``offset`` field for the single-planar API, and the same value as returned by the driver - in the struct :ref:`v4l2_plane ` ``m`` union + in the struct :c:type:`v4l2_plane` ``m`` union ``mem_offset`` field for the multi-planar API. diff --git a/Documentation/media/uapi/v4l/func-munmap.rst b/Documentation/media/uapi/v4l/func-munmap.rst index a1a4d8cb6c4b..c2f4043d7d2b 100644 --- a/Documentation/media/uapi/v4l/func-munmap.rst +++ b/Documentation/media/uapi/v4l/func-munmap.rst @@ -34,9 +34,9 @@ Arguments ``length`` Length of the mapped buffer. This must be the same value as given to :ref:`mmap() ` and returned by the driver in the struct - :ref:`v4l2_buffer ` ``length`` field for the + :c:type:`v4l2_buffer` ``length`` field for the single-planar API and in the struct - :ref:`v4l2_plane ` ``length`` field for the + :c:type:`v4l2_plane` ``length`` field for the multi-planar API. diff --git a/Documentation/media/uapi/v4l/hist-v4l2.rst b/Documentation/media/uapi/v4l/hist-v4l2.rst index 3ba1c0c2df1a..a84895968349 100644 --- a/Documentation/media/uapi/v4l/hist-v4l2.rst +++ b/Documentation/media/uapi/v4l/hist-v4l2.rst @@ -45,7 +45,7 @@ renamed to :ref:`VIDIOC_ENUMSTD`, Codec API was released. 1998-11-08: Many minor changes. Most symbols have been renamed. Some -material changes to struct :ref:`v4l2_capability `. +material changes to struct :c:type:`v4l2_capability`. 1998-11-12: The read/write directon of some ioctls was misdefined. @@ -117,7 +117,7 @@ to simplify the API, while making it more extensible and following common Linux driver API conventions. 1. Some typos in ``V4L2_FMT_FLAG`` symbols were fixed. struct - :ref:`v4l2_clip ` was changed for compatibility with + :c:type:`v4l2_clip` was changed for compatibility with v4l. (1999-08-30) 2. ``V4L2_TUNER_SUB_LANG1`` was added. (1999-09-05) @@ -152,14 +152,14 @@ common Linux driver API conventions. ``VIDIOC_G_INFMT``, ``VIDIOC_S_OUTFMT``, ``VIDIOC_G_OUTFMT``, ``VIDIOC_S_VBIFMT`` and ``VIDIOC_G_VBIFMT``. The image format structure :c:type:`struct v4l2_format` was renamed to struct - :ref:`v4l2_pix_format `, while struct - :ref:`v4l2_format ` is now the envelopping structure + :c:type:`v4l2_pix_format`, while struct + :c:type:`v4l2_format` is now the envelopping structure for all format negotiations. 5. Similar to the changes above, the ``VIDIOC_G_PARM`` and ``VIDIOC_S_PARM`` ioctls were merged with ``VIDIOC_G_OUTPARM`` and ``VIDIOC_S_OUTPARM``. A ``type`` field in the new struct - :ref:`v4l2_streamparm ` selects the respective + :c:type:`v4l2_streamparm` selects the respective union member. This change obsoletes the ``VIDIOC_G_OUTPARM`` and @@ -178,7 +178,7 @@ common Linux driver API conventions. categories might have a greater separation, or may even appear in separate windows. -7. The struct :ref:`v4l2_buffer ` ``timestamp`` was +7. The struct :c:type:`v4l2_buffer` ``timestamp`` was changed to a 64 bit integer, containing the sampling or output time of the frame in nanoseconds. Additionally timestamps will be in absolute system time, not starting from zero at the beginning of a @@ -202,7 +202,7 @@ common Linux driver API conventions. return a 64-bit integer. 8. A ``sequence`` field was added to struct - :ref:`v4l2_buffer `. The ``sequence`` field counts + :c:type:`v4l2_buffer`. The ``sequence`` field counts captured frames, it is ignored by output devices. When a capture driver drops a frame, the sequence number of that frame is skipped. @@ -210,7 +210,7 @@ common Linux driver API conventions. V4L2 Version 0.20 incremental changes ===================================== -1999-12-23: In struct :ref:`v4l2_vbi_format ` the +1999-12-23: In struct :c:type:`v4l2_vbi_format` the ``reserved1`` field became ``offset``. Previously drivers were required to clear the ``reserved1`` field. @@ -256,7 +256,7 @@ compatibility* as the :ref:`VIDIOC_G_FMT ` and :ref:`VIDIOC_S_FMT ` ioctls may fail now if the struct :c:type:`struct v4l2_fmt` ``type`` field does not contain ``V4L2_BUF_TYPE_VBI``. In the documentation of the struct -:ref:`v4l2_vbi_format ` ``offset`` field the +:c:type:`v4l2_vbi_format` ``offset`` field the ambiguous phrase "rising edge" was changed to "leading edge". @@ -321,7 +321,7 @@ This unnamed version was finally merged into Linux 2.5.46. until the application attempts to initiate a data exchange, see :ref:`open`. -3. The struct :ref:`v4l2_capability ` changed +3. The struct :c:type:`v4l2_capability` changed dramatically. Note that also the size of the structure changed, which is encoded in the ioctl request code, thus older V4L2 devices will respond with an ``EINVAL`` error code to the new @@ -354,7 +354,7 @@ This unnamed version was finally merged into Linux 2.5.46. ``V4L2_FLAG_MONOCHROME`` flag was removed, this information is available as described in :ref:`format`. -4. In struct :ref:`v4l2_input ` the ``assoc_audio`` +4. In struct :c:type:`v4l2_input` the ``assoc_audio`` field and the ``capability`` field and its only flag ``V4L2_INPUT_CAP_AUDIO`` was replaced by the new ``audioset`` field. Instead of linking one video input to one audio input this field @@ -363,11 +363,11 @@ This unnamed version was finally merged into Linux 2.5.46. New fields are ``tuner`` (reversing the former link from tuners to video inputs), ``std`` and ``status``. - Accordingly struct :ref:`v4l2_output ` lost its + Accordingly struct :c:type:`v4l2_output` lost its ``capability`` and ``assoc_audio`` fields. ``audioset``, ``modulator`` and ``std`` where added instead. -5. The struct :ref:`v4l2_audio ` field ``audio`` was +5. The struct :c:type:`v4l2_audio` field ``audio`` was renamed to ``index``, for consistency with other structures. A new capability flag ``V4L2_AUDCAP_STEREO`` was added to indicated if the audio input in question supports stereo sound. @@ -376,20 +376,20 @@ This unnamed version was finally merged into Linux 2.5.46. (However the same applies to AVL which is still there.) Again for consistency the struct - :ref:`v4l2_audioout ` field ``audio`` was renamed + :c:type:`v4l2_audioout` field ``audio`` was renamed to ``index``. -6. The struct :ref:`v4l2_tuner ` ``input`` field was +6. The struct :c:type:`v4l2_tuner` ``input`` field was replaced by an ``index`` field, permitting devices with multiple tuners. The link between video inputs and tuners is now reversed, inputs point to their tuner. The ``std`` substructure became a simple set (more about this below) and moved into struct - :ref:`v4l2_input `. A ``type`` field was added. + :c:type:`v4l2_input`. A ``type`` field was added. - Accordingly in struct :ref:`v4l2_modulator ` the + Accordingly in struct :c:type:`v4l2_modulator` the ``output`` was replaced by an ``index`` field. - In struct :ref:`v4l2_frequency ` the ``port`` + In struct :c:type:`v4l2_frequency` the ``port`` field was replaced by a ``tuner`` field containing the respective tuner or modulator index number. A tuner ``type`` field was added and the ``reserved`` field became larger for future extensions @@ -405,7 +405,7 @@ This unnamed version was finally merged into Linux 2.5.46. :ref:`VIDIOC_S_STD ` now take a pointer to this type as argument. :ref:`VIDIOC_QUERYSTD` was added to autodetect the received standard, if the hardware has this - capability. In struct :ref:`v4l2_standard ` an + capability. In struct :c:type:`v4l2_standard` an ``index`` field was added for :ref:`VIDIOC_ENUMSTD`. A :ref:`v4l2_std_id ` field named ``id`` was added as @@ -417,10 +417,10 @@ This unnamed version was finally merged into Linux 2.5.46. Struct :c:type:`struct v4l2_enumstd` ceased to be. :ref:`VIDIOC_ENUMSTD` now takes a pointer to a - struct :ref:`v4l2_standard ` directly. The + struct :c:type:`v4l2_standard` directly. The information which standards are supported by a particular video - input or output moved into struct :ref:`v4l2_input ` - and struct :ref:`v4l2_output ` fields named ``std``, + input or output moved into struct :c:type:`v4l2_input` + and struct :c:type:`v4l2_output` fields named ``std``, respectively. 8. The struct :ref:`v4l2_queryctrl ` fields @@ -432,8 +432,8 @@ This unnamed version was finally merged into Linux 2.5.46. :ref:`VIDIOC_S_FMT `, but without the overhead of programming the hardware and regardless of I/O in progress. - In struct :ref:`v4l2_format ` the ``fmt`` union was - extended to contain struct :ref:`v4l2_window `. All + In struct :c:type:`v4l2_format` the ``fmt`` union was + extended to contain struct :c:type:`v4l2_window`. All image format negotiations are now possible with ``VIDIOC_G_FMT``, ``VIDIOC_S_FMT`` and ``VIDIOC_TRY_FMT``; ioctl. The ``VIDIOC_G_WIN`` and ``VIDIOC_S_WIN`` ioctls to prepare for a video overlay were @@ -533,15 +533,15 @@ This unnamed version was finally merged into Linux 2.5.46. - ``V4L2_BUF_TYPE_PRIVATE`` (but this is deprecated) -10. In struct :ref:`v4l2_fmtdesc ` a enum +10. In struct :c:type:`v4l2_fmtdesc` a enum :ref:`v4l2_buf_type ` field named ``type`` was - added as in struct :ref:`v4l2_format `. The + added as in struct :c:type:`v4l2_format`. The ``VIDIOC_ENUM_FBUFFMT`` ioctl is no longer needed and was removed. These calls can be replaced by :ref:`VIDIOC_ENUM_FMT` with type ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. -11. In struct :ref:`v4l2_pix_format ` the ``depth`` +11. In struct :c:type:`v4l2_pix_format` the ``depth`` field was removed, assuming applications which recognize the format by its four-character-code already know the color depth, and others do not care about it. The same rationale lead to the removal of the @@ -620,7 +620,7 @@ This unnamed version was finally merged into Linux 2.5.46. ``V4L2_COLORSPACE_BT878``, ``V4L2_COLORSPACE_470_SYSTEM_M`` or ``V4L2_COLORSPACE_470_SYSTEM_BG`` replaces ``V4L2_FMT_CS_601YUV``. -12. In struct :ref:`v4l2_requestbuffers ` the +12. In struct :c:type:`v4l2_requestbuffers` the ``type`` field was properly defined as enum :ref:`v4l2_buf_type `. Buffer types changed as mentioned above. A new ``memory`` field of type enum @@ -628,7 +628,7 @@ This unnamed version was finally merged into Linux 2.5.46. I/O methods using buffers allocated by the driver or the application. See :ref:`io` for details. -13. In struct :ref:`v4l2_buffer ` the ``type`` field was +13. In struct :c:type:`v4l2_buffer` the ``type`` field was properly defined as enum :ref:`v4l2_buf_type `. Buffer types changed as mentioned above. A ``field`` field of type enum :ref:`v4l2_field ` was added to indicate if a @@ -648,7 +648,7 @@ This unnamed version was finally merged into Linux 2.5.46. indeed allocated in device memory rather than DMA-able system memory. It was barely useful and so was removed. -14. In struct :ref:`v4l2_framebuffer ` the +14. In struct :c:type:`v4l2_framebuffer` the ``base[3]`` array anticipating double- and triple-buffering in off-screen video memory, however without defining a synchronization mechanism, was replaced by a single pointer. The @@ -659,13 +659,13 @@ This unnamed version was finally merged into Linux 2.5.46. ``V4L2_FBUF_CAP_LIST_CLIPPING`` and ``V4L2_FBUF_CAP_BITMAP_CLIPPING``. -15. In struct :ref:`v4l2_clip ` the ``x``, ``y``, +15. In struct :c:type:`v4l2_clip` the ``x``, ``y``, ``width`` and ``height`` field moved into a ``c`` substructure of - type struct :ref:`v4l2_rect `. The ``x`` and ``y`` + type struct :c:type:`v4l2_rect`. The ``x`` and ``y`` fields were renamed to ``left`` and ``top``, i. e. offsets to a context dependent origin. -16. In struct :ref:`v4l2_window ` the ``x``, ``y``, +16. In struct :c:type:`v4l2_window` the ``x``, ``y``, ``width`` and ``height`` field moved into a ``w`` substructure as above. A ``field`` field of type %v4l2-field; was added to distinguish between field and frame (interlaced) overlay. @@ -678,21 +678,21 @@ This unnamed version was finally merged into Linux 2.5.46. :c:type:`struct v4l2_cropcap` and :c:type:`struct v4l2_crop` where redefined for this purpose. See :ref:`crop` for details. -18. In struct :ref:`v4l2_vbi_format ` the +18. In struct :c:type:`v4l2_vbi_format` the ``SAMPLE_FORMAT`` field now contains a four-character-code as used to identify video image formats and ``V4L2_PIX_FMT_GREY`` replaces the ``V4L2_VBI_SF_UBYTE`` define. The ``reserved`` field was extended. -19. In struct :ref:`v4l2_captureparm ` the type of +19. In struct :c:type:`v4l2_captureparm` the type of the ``timeperframe`` field changed from unsigned long to struct - :ref:`v4l2_fract `. This allows the accurate + :c:type:`v4l2_fract`. This allows the accurate expression of multiples of the NTSC-M frame rate 30000 / 1001. A new field ``readbuffers`` was added to control the driver behaviour in read I/O mode. Similar changes were made to struct - :ref:`v4l2_outputparm `. + :c:type:`v4l2_outputparm`. 20. The struct :c:type:`struct v4l2_performance` and ``VIDIOC_G_PERF`` ioctl were dropped. Except when using the @@ -834,7 +834,7 @@ V4L2 in Linux 2.6.8 =================== 1. A new field ``input`` (former ``reserved[0]``) was added to the - struct :ref:`v4l2_buffer ` structure. Purpose of this + struct :c:type:`v4l2_buffer` structure. Purpose of this field is to alternate between video inputs (e. g. cameras) in step with the video capturing process. This function must be enabled with the new ``V4L2_BUF_FLAG_INPUT`` flag. The ``flags`` field is no @@ -854,7 +854,7 @@ V4L2 spec erratum 2004-08-01 4. The documentation of the :ref:`VIDIOC_QBUF` and :ref:`VIDIOC_DQBUF ` ioctls did not mention the - struct :ref:`v4l2_buffer ` ``memory`` field. It was + struct :c:type:`v4l2_buffer` ``memory`` field. It was also missing from examples. Also on the ``VIDIOC_DQBUF`` page the ``EIO`` error code was not documented. @@ -901,7 +901,7 @@ V4L2 spec erratum 2006-01-10 ============================ 1. The ``V4L2_IN_ST_COLOR_KILL`` flag in struct - :ref:`v4l2_input ` not only indicates if the color + :c:type:`v4l2_input` not only indicates if the color killer is enabled, but also if it is active. (The color killer disables color decoding when it detects no color in the video signal to improve the image quality.) @@ -914,16 +914,16 @@ V4L2 spec erratum 2006-01-10 V4L2 spec erratum 2006-02-03 ============================ -1. In struct :ref:`v4l2_captureparm ` and struct - :ref:`v4l2_outputparm ` the ``timeperframe`` +1. In struct :c:type:`v4l2_captureparm` and struct + :c:type:`v4l2_outputparm` the ``timeperframe`` field gives the time in seconds, not microseconds. V4L2 spec erratum 2006-02-04 ============================ -1. The ``clips`` field in struct :ref:`v4l2_window ` - must point to an array of struct :ref:`v4l2_clip `, not +1. The ``clips`` field in struct :c:type:`v4l2_window` + must point to an array of struct :c:type:`v4l2_clip`, not a linked list, because drivers ignore the struct :c:type:`struct v4l2_clip`. ``next`` pointer. @@ -951,18 +951,18 @@ V4L2 spec erratum 2006-09-23 (Draft 0.15) not mentioned along with other buffer types. 2. In :ref:`VIDIOC_G_AUDIO ` it was clarified that the struct - :ref:`v4l2_audio ` ``mode`` field is a flags field. + :c:type:`v4l2_audio` ``mode`` field is a flags field. 3. :ref:`VIDIOC_QUERYCAP` did not mention the sliced VBI and radio capability flags. 4. In :ref:`VIDIOC_G_FREQUENCY ` it was clarified that applications must initialize the tuner ``type`` field of struct - :ref:`v4l2_frequency ` before calling + :c:type:`v4l2_frequency` before calling :ref:`VIDIOC_S_FREQUENCY `. 5. The ``reserved`` array in struct - :ref:`v4l2_requestbuffers ` has 2 elements, + :c:type:`v4l2_requestbuffers` has 2 elements, not 32. 6. In :ref:`output` and :ref:`raw-vbi` the device file names @@ -991,7 +991,7 @@ V4L2 in Linux 2.6.18 V4L2 in Linux 2.6.19 ==================== -1. In struct :ref:`v4l2_sliced_vbi_cap ` a +1. In struct :c:type:`v4l2_sliced_vbi_cap` a buffer type field was added replacing a reserved field. Note on architectures where the size of enum types differs from int types the size of the structure changed. The @@ -1038,15 +1038,15 @@ V4L2 in Linux 2.6.22 and :ref:`VIDIOC_S_FBUF ` ioctls for details. A new ``global_alpha`` field was added to - :ref:`v4l2_window `, extending the structure. This + :c:type:`v4l2_window`, extending the structure. This may *break compatibility* with applications using a struct :c:type:`struct v4l2_window` directly. However the :ref:`VIDIOC_G/S/TRY_FMT ` ioctls, which take a - pointer to a :ref:`v4l2_format ` parent structure + pointer to a :c:type:`v4l2_format` parent structure with padding bytes at the end, are not affected. 3. The format of the ``chromakey`` field in struct - :ref:`v4l2_window ` changed from "host order RGB32" + :c:type:`v4l2_window` changed from "host order RGB32" to a pixel value in the same format as the framebuffer. This may *break compatibility* with existing applications. Drivers supporting the "host order RGB32" format are not known. @@ -1339,7 +1339,7 @@ V4L2 in Linux 3.16 V4L2 in Linux 3.17 ================== -1. Extended struct :ref:`v4l2_pix_format `. Added +1. Extended struct :c:type:`v4l2_pix_format`. Added format flags. 2. Added compound control types and @@ -1359,8 +1359,8 @@ V4L2 in Linux 3.19 1. Rewrote Colorspace chapter, added new enum :ref:`v4l2_ycbcr_encoding ` and enum :ref:`v4l2_quantization ` fields to struct - :ref:`v4l2_pix_format `, struct - :ref:`v4l2_pix_format_mplane ` and + :c:type:`v4l2_pix_format`, struct + :c:type:`v4l2_pix_format_mplane` and struct :ref:`v4l2_mbus_framefmt `. diff --git a/Documentation/media/uapi/v4l/mmap.rst b/Documentation/media/uapi/v4l/mmap.rst index 7ad5d5e76163..670596c1a4f7 100644 --- a/Documentation/media/uapi/v4l/mmap.rst +++ b/Documentation/media/uapi/v4l/mmap.rst @@ -8,7 +8,7 @@ Streaming I/O (Memory Mapping) Input and output devices support this I/O method when the ``V4L2_CAP_STREAMING`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl is set. There are two streaming methods, to determine if the memory mapping flavor is supported applications must call the :ref:`VIDIOC_REQBUFS` ioctl @@ -39,10 +39,10 @@ address space with the :ref:`mmap() ` function. The location of the buffers in device memory can be determined with the :ref:`VIDIOC_QUERYBUF` ioctl. In the single-planar API case, the ``m.offset`` and ``length`` returned in a struct -:ref:`v4l2_buffer ` are passed as sixth and second +:c:type:`v4l2_buffer` are passed as sixth and second parameter to the :ref:`mmap() ` function. When using the -multi-planar API, struct :ref:`v4l2_buffer ` contains an -array of struct :ref:`v4l2_plane ` structures, each +multi-planar API, struct :c:type:`v4l2_buffer` contains an +array of struct :c:type:`v4l2_plane` structures, each containing its own ``m.offset`` and ``length``. When using the multi-planar API, every plane of every buffer has to be mapped separately, so the number of calls to :ref:`mmap() ` should @@ -218,7 +218,7 @@ to function, apart of this no limit exists on the number of buffers applications can enqueue in advance, or dequeue and process. They can also enqueue in a different order than buffers have been dequeued, and the driver can *fill* enqueued *empty* buffers in any order. [#f2]_ The -index number of a buffer (struct :ref:`v4l2_buffer ` +index number of a buffer (struct :c:type:`v4l2_buffer` ``index``) plays no role here, it only identifies the buffer. Initially all mapped buffers are in dequeued state, inaccessible by the @@ -251,7 +251,7 @@ To start and stop capturing or output applications call the removes all buffers from both queues as a side effect. Since there is no notion of doing anything "now" on a multitasking system, if an application needs to synchronize with another event it should examine - the struct ::ref:`v4l2_buffer ` ``timestamp`` of captured + the struct ::c:type:`v4l2_buffer` ``timestamp`` of captured or outputted buffers. Drivers implementing memory mapping I/O must support the diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst b/Documentation/media/uapi/v4l/pixfmt-002.rst index 58e872f66a07..789937900d14 100644 --- a/Documentation/media/uapi/v4l/pixfmt-002.rst +++ b/Documentation/media/uapi/v4l/pixfmt-002.rst @@ -6,7 +6,7 @@ Single-planar format structure .. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{11.0cm}| -.. _v4l2-pix-format: +.. c:type:: v4l2_pix_format .. cssclass:: longtable @@ -136,7 +136,7 @@ Single-planar format structure - ``priv`` - This field indicates whether the remaining fields of the - :ref:`struct v4l2_pix_format ` structure, also called the + :c:type:`struct v4l2_pix_format ` structure, also called the extended fields, are valid. When set to ``V4L2_PIX_FMT_PRIV_MAGIC``, it indicates that the extended fields have been correctly initialized. When set to any other value it @@ -152,7 +152,7 @@ Single-planar format structure To use the extended fields, applications must set the ``priv`` field to ``V4L2_PIX_FMT_PRIV_MAGIC``, initialize all the extended fields and zero the unused bytes of the - :ref:`struct v4l2_format ` ``raw_data`` field. + :c:type:`struct v4l2_format ` ``raw_data`` field. When the ``priv`` field isn't set to ``V4L2_PIX_FMT_PRIV_MAGIC`` drivers must act as if all the extended fields were set to zero. diff --git a/Documentation/media/uapi/v4l/pixfmt-003.rst b/Documentation/media/uapi/v4l/pixfmt-003.rst index 6ec8ce639764..b214b818baa7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-003.rst +++ b/Documentation/media/uapi/v4l/pixfmt-003.rst @@ -4,17 +4,17 @@ Multi-planar format structures ****************************** -The :ref:`struct v4l2_plane_pix_format ` structures define size +The :c:type:`struct v4l2_plane_pix_format ` structures define size and layout for each of the planes in a multi-planar format. The -:ref:`struct v4l2_pix_format_mplane ` structure contains +:c:type:`struct v4l2_pix_format_mplane ` structure contains information common to all planes (such as image width and height) and an -array of :ref:`struct v4l2_plane_pix_format ` structures, +array of :c:type:`struct v4l2_plane_pix_format ` structures, describing all planes of that format. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-plane-pix-format: +.. c:type:: v4l2_plane_pix_format .. flat-table:: struct v4l2_plane_pix_format :header-rows: 0 @@ -37,7 +37,7 @@ describing all planes of that format. - ``bytesperline`` - Distance in bytes between the leftmost pixels in two adjacent - lines. See struct :ref:`v4l2_pix_format `. + lines. See struct :c:type:`v4l2_pix_format`. - .. row 3 @@ -51,7 +51,7 @@ describing all planes of that format. .. tabularcolumns:: |p{4.4cm}|p{5.6cm}|p{7.5cm}| -.. _v4l2-pix-format-mplane: +.. c:type:: v4l2_pix_format_mplane .. flat-table:: struct v4l2_pix_format_mplane :header-rows: 0 @@ -66,7 +66,7 @@ describing all planes of that format. - ``width`` - Image width in pixels. See struct - :ref:`v4l2_pix_format `. + :c:type:`v4l2_pix_format`. - .. row 2 @@ -75,7 +75,7 @@ describing all planes of that format. - ``height`` - Image height in pixels. See struct - :ref:`v4l2_pix_format `. + :c:type:`v4l2_pix_format`. - .. row 3 @@ -92,7 +92,7 @@ describing all planes of that format. - ``field`` - - See struct :ref:`v4l2_pix_format `. + - See struct :c:type:`v4l2_pix_format`. - .. row 5 @@ -100,11 +100,11 @@ describing all planes of that format. - ``colorspace`` - - See struct :ref:`v4l2_pix_format `. + - See struct :c:type:`v4l2_pix_format`. - .. row 6 - - struct :ref:`v4l2_plane_pix_format ` + - struct :c:type:`v4l2_plane_pix_format` - ``plane_fmt[VIDEO_MAX_PLANES]`` diff --git a/Documentation/media/uapi/v4l/pixfmt-006.rst b/Documentation/media/uapi/v4l/pixfmt-006.rst index 574294ec0a89..a97fc28e039d 100644 --- a/Documentation/media/uapi/v4l/pixfmt-006.rst +++ b/Documentation/media/uapi/v4l/pixfmt-006.rst @@ -15,8 +15,8 @@ transfer functions. The third is the Y'CbCr encoding identifier (enum non-standard Y'CbCr encodings and the fourth is the quantization identifier (enum :ref:`v4l2_quantization `) to specify non-standard quantization methods. Most of the time only the -colorspace field of struct :ref:`v4l2_pix_format ` -or struct :ref:`v4l2_pix_format_mplane ` +colorspace field of struct :c:type:`v4l2_pix_format` +or struct :c:type:`v4l2_pix_format_mplane` needs to be filled in. .. note:: diff --git a/Documentation/media/uapi/v4l/pixfmt.rst b/Documentation/media/uapi/v4l/pixfmt.rst index 6866bcb7d229..a6b7871e39e7 100644 --- a/Documentation/media/uapi/v4l/pixfmt.rst +++ b/Documentation/media/uapi/v4l/pixfmt.rst @@ -6,8 +6,8 @@ Image Formats ############# The V4L2 API was primarily designed for devices exchanging image data -with applications. The :ref:`struct v4l2_pix_format ` and -:ref:`struct v4l2_pix_format_mplane ` structures define the +with applications. The :c:type:`struct v4l2_pix_format ` and +:c:type:`struct v4l2_pix_format_mplane ` structures define the format and layout of an image in memory. The former is used with the single-planar API, while the latter is used with the multi-planar version (see :ref:`planar-apis`). Image formats are negotiated with diff --git a/Documentation/media/uapi/v4l/planar-apis.rst b/Documentation/media/uapi/v4l/planar-apis.rst index 5fe2e1188230..bd0f88b01c9a 100644 --- a/Documentation/media/uapi/v4l/planar-apis.rst +++ b/Documentation/media/uapi/v4l/planar-apis.rst @@ -46,16 +46,16 @@ Calls that distinguish between single and multi-planar APIs :ref:`VIDIOC_G_FMT `, :ref:`VIDIOC_S_FMT `, :ref:`VIDIOC_TRY_FMT ` New structures for describing multi-planar formats are added: struct - :ref:`v4l2_pix_format_mplane ` and - struct :ref:`v4l2_plane_pix_format `. + :c:type:`v4l2_pix_format_mplane` and + struct :c:type:`v4l2_plane_pix_format`. Drivers may define new multi-planar formats, which have distinct FourCC codes from the existing single-planar ones. :ref:`VIDIOC_QBUF `, :ref:`VIDIOC_DQBUF `, :ref:`VIDIOC_QUERYBUF ` - A new struct :ref:`v4l2_plane ` structure for + A new struct :c:type:`v4l2_plane` structure for describing planes is added. Arrays of this structure are passed in the new ``m.planes`` field of struct - :ref:`v4l2_buffer `. + :c:type:`v4l2_buffer`. :ref:`VIDIOC_REQBUFS ` Will allocate multi-planar buffers as requested. diff --git a/Documentation/media/uapi/v4l/rw.rst b/Documentation/media/uapi/v4l/rw.rst index dcac379c484f..91596c0cc2f3 100644 --- a/Documentation/media/uapi/v4l/rw.rst +++ b/Documentation/media/uapi/v4l/rw.rst @@ -9,7 +9,7 @@ Read/Write Input and output devices support the :ref:`read() ` and :ref:`write() ` function, respectively, when the ``V4L2_CAP_READWRITE`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl is set. Drivers may need the CPU to copy the data, but they may also support DMA diff --git a/Documentation/media/uapi/v4l/selection-api-005.rst b/Documentation/media/uapi/v4l/selection-api-005.rst index 94731a13efdb..5b47a28ac6d7 100644 --- a/Documentation/media/uapi/v4l/selection-api-005.rst +++ b/Documentation/media/uapi/v4l/selection-api-005.rst @@ -16,19 +16,19 @@ cropping from an image inside a memory buffer. The application could configure a capture device to fill only a part of an image by abusing V4L2 API. Cropping a smaller image from a larger one is achieved by setting the field ``bytesperline`` at struct -:ref:`v4l2_pix_format `. +:c:type:`v4l2_pix_format`. Introducing an image offsets could be done by modifying field ``m_userptr`` at struct -:ref:`v4l2_buffer ` before calling +:c:type:`v4l2_buffer` before calling :ref:`VIDIOC_QBUF`. Those operations should be avoided because they are not portable (endianness), and do not work for macroblock and Bayer formats and mmap buffers. The selection API deals with configuration of buffer cropping/composing in a clear, intuitive and portable way. Next, with the selection API the concepts of the padded target and constraints -flags are introduced. Finally, struct :ref:`v4l2_crop ` -and struct :ref:`v4l2_cropcap ` have no reserved +flags are introduced. Finally, struct :c:type:`v4l2_crop` +and struct :c:type:`v4l2_cropcap` have no reserved fields. Therefore there is no way to extend their functionality. The new -struct :ref:`v4l2_selection ` provides a lot of place +struct :c:type:`v4l2_selection` provides a lot of place for future extensions. Driver developers are encouraged to implement only selection API. The former cropping API would be simulated using the new one. diff --git a/Documentation/media/uapi/v4l/standard.rst b/Documentation/media/uapi/v4l/standard.rst index 2320008f6063..75a14895aed7 100644 --- a/Documentation/media/uapi/v4l/standard.rst +++ b/Documentation/media/uapi/v4l/standard.rst @@ -9,8 +9,8 @@ Video Standards Video devices typically support one or more different video standards or variations of standards. Each video input and output may support another set of standards. This set is reported by the ``std`` field of struct -:ref:`v4l2_input ` and struct -:ref:`v4l2_output ` returned by the +:c:type:`v4l2_input` and struct +:c:type:`v4l2_output` returned by the :ref:`VIDIOC_ENUMINPUT` and :ref:`VIDIOC_ENUMOUTPUT` ioctls, respectively. @@ -58,8 +58,8 @@ output device which is: - that does not support the video standard formats at all. Here the driver shall set the ``std`` field of struct -:ref:`v4l2_input ` and struct -:ref:`v4l2_output ` to zero and the :ref:`VIDIOC_G_STD `, +:c:type:`v4l2_input` and struct +:c:type:`v4l2_output` to zero and the :ref:`VIDIOC_G_STD `, :ref:`VIDIOC_S_STD `, :ref:`VIDIOC_QUERYSTD` and :ref:`VIDIOC_ENUMSTD` ioctls shall return the ``ENOTTY`` error code or the ``EINVAL`` error code. diff --git a/Documentation/media/uapi/v4l/streaming-par.rst b/Documentation/media/uapi/v4l/streaming-par.rst index b07b0f0b35d4..f9b93c53f75c 100644 --- a/Documentation/media/uapi/v4l/streaming-par.rst +++ b/Documentation/media/uapi/v4l/streaming-par.rst @@ -25,7 +25,7 @@ section discussing the :ref:`read() ` function. To get and set the streaming parameters applications call the :ref:`VIDIOC_G_PARM ` and :ref:`VIDIOC_S_PARM ` ioctl, respectively. They take -a pointer to a struct :ref:`v4l2_streamparm `, which +a pointer to a struct :c:type:`v4l2_streamparm`, which contains a union holding separate parameters for input and output devices. diff --git a/Documentation/media/uapi/v4l/tuner.rst b/Documentation/media/uapi/v4l/tuner.rst index c3df65c2e320..4064841d8963 100644 --- a/Documentation/media/uapi/v4l/tuner.rst +++ b/Documentation/media/uapi/v4l/tuner.rst @@ -13,7 +13,7 @@ Tuners Video input devices can have one or more tuners demodulating a RF signal. Each tuner is associated with one or more video inputs, depending on the number of RF connectors on the tuner. The ``type`` -field of the respective struct :ref:`v4l2_input ` +field of the respective struct :c:type:`v4l2_input` returned by the :ref:`VIDIOC_ENUMINPUT` ioctl is set to ``V4L2_INPUT_TYPE_TUNER`` and its ``tuner`` field contains the index number of the tuner. @@ -24,7 +24,7 @@ inputs. To query and change tuner properties applications use the :ref:`VIDIOC_G_TUNER ` and :ref:`VIDIOC_S_TUNER ` ioctls, respectively. The -struct :ref:`v4l2_tuner ` returned by :ref:`VIDIOC_G_TUNER ` +struct :c:type:`v4l2_tuner` returned by :ref:`VIDIOC_G_TUNER ` also contains signal status information applicable when the tuner of the current video or radio input is queried. @@ -46,7 +46,7 @@ video signal for radiation or connection to the antenna input of a TV set or video recorder. Each modulator is associated with one or more video outputs, depending on the number of RF connectors on the modulator. The ``type`` field of the respective struct -:ref:`v4l2_output ` returned by the +:c:type:`v4l2_output` returned by the :ref:`VIDIOC_ENUMOUTPUT` ioctl is set to ``V4L2_OUTPUT_TYPE_MODULATOR`` and its ``modulator`` field contains the index number of the modulator. @@ -68,7 +68,7 @@ To query and change modulator properties applications use the is more than one at all. The modulator is solely determined by the current video output. Drivers must support both ioctls and set the ``V4L2_CAP_MODULATOR`` flag in the struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl when the device has one or more modulators. @@ -79,7 +79,7 @@ Radio Frequency To get and set the tuner or modulator radio frequency applications use the :ref:`VIDIOC_G_FREQUENCY ` and :ref:`VIDIOC_S_FREQUENCY ` ioctl which both take -a pointer to a struct :ref:`v4l2_frequency `. These +a pointer to a struct :c:type:`v4l2_frequency`. These ioctls are used for TV and radio devices alike. Drivers must support both ioctls when the tuner or modulator ioctls are supported, or when the device is a radio device. diff --git a/Documentation/media/uapi/v4l/userp.rst b/Documentation/media/uapi/v4l/userp.rst index 0371e068c50b..dc2893a60d65 100644 --- a/Documentation/media/uapi/v4l/userp.rst +++ b/Documentation/media/uapi/v4l/userp.rst @@ -8,7 +8,7 @@ Streaming I/O (User Pointers) Input and output devices support this I/O method when the ``V4L2_CAP_STREAMING`` flag in the ``capabilities`` field of struct -:ref:`v4l2_capability ` returned by the +:c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP` ioctl is set. If the particular user pointer method (not only memory mapping) is supported must be determined by calling the :ref:`VIDIOC_REQBUFS` ioctl @@ -18,8 +18,8 @@ This I/O method combines advantages of the read/write and memory mapping methods. Buffers (planes) are allocated by the application itself, and can reside for example in virtual or shared memory. Only pointers to data are exchanged, these pointers and meta-information are passed in -struct :ref:`v4l2_buffer ` (or in struct -:ref:`v4l2_plane ` in the multi-planar API case). The +struct :c:type:`v4l2_buffer` (or in struct +:c:type:`v4l2_plane` in the multi-planar API case). The driver must be switched into user pointer I/O mode by calling the :ref:`VIDIOC_REQBUFS` with the desired buffer type. No buffers (planes) are allocated beforehand, consequently they are not @@ -94,7 +94,7 @@ To start and stop capturing or output applications call the both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything "now" on a multitasking system, if an application needs to synchronize with another event it should examine - the struct :ref:`v4l2_buffer ` ``timestamp`` of captured or + the struct :c:type:`v4l2_buffer` ``timestamp`` of captured or outputted buffers. Drivers implementing user pointer I/O must support the diff --git a/Documentation/media/uapi/v4l/v4l2.rst b/Documentation/media/uapi/v4l/v4l2.rst index 5e41a8505301..785d4cdd2f85 100644 --- a/Documentation/media/uapi/v4l/v4l2.rst +++ b/Documentation/media/uapi/v4l/v4l2.rst @@ -114,14 +114,14 @@ DVB device nodes. Add support for Tuner sub-device. Rewrote Colorspace chapter, added new enum :ref:`v4l2_ycbcr_encoding ` and enum :ref:`v4l2_quantization ` fields to struct -:ref:`v4l2_pix_format `, struct -:ref:`v4l2_pix_format_mplane ` and struct +:c:type:`v4l2_pix_format`, struct +:c:type:`v4l2_pix_format_mplane` and struct :ref:`v4l2_mbus_framefmt `. :revision: 3.17 / 2014-08-04 (*lp, hv*) -Extended struct :ref:`v4l2_pix_format `. Added +Extended struct :c:type:`v4l2_pix_format`. Added format flags. Added compound control types and VIDIOC_QUERY_EXT_CTRL. diff --git a/Documentation/media/uapi/v4l/video.rst b/Documentation/media/uapi/v4l/video.rst index d3f00715fbc1..a205fb87d566 100644 --- a/Documentation/media/uapi/v4l/video.rst +++ b/Documentation/media/uapi/v4l/video.rst @@ -16,7 +16,7 @@ To learn about the number and attributes of the available inputs and outputs applications can enumerate them with the :ref:`VIDIOC_ENUMINPUT` and :ref:`VIDIOC_ENUMOUTPUT` ioctl, respectively. The -struct :ref:`v4l2_input ` returned by the +struct :c:type:`v4l2_input` returned by the :ref:`VIDIOC_ENUMINPUT` ioctl also contains signal :status information applicable when the current video input is queried. diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst index dc75f21e4b4c..c53fdcc3666a 100644 --- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst @@ -39,14 +39,14 @@ over buffers is required. This ioctl can be called multiple times to create buffers of different sizes. To allocate the device buffers applications must initialize the relevant -fields of the :ref:`struct v4l2_create_buffers ` structure. The +fields of the :c:type:`struct v4l2_create_buffers ` structure. The ``count`` field must be set to the number of requested buffers, the ``memory`` field specifies the requested I/O method and the ``reserved`` array must be zeroed. The ``format`` field specifies the image format that the buffers must be able to handle. The application has to fill in this struct -:ref:`v4l2_format `. Usually this will be done using the +:c:type:`v4l2_format`. Usually this will be done using the :ref:`VIDIOC_TRY_FMT ` or :ref:`VIDIOC_G_FMT ` ioctls to ensure that the requested format is supported by the driver. Based on the format's @@ -71,7 +71,7 @@ the ``index`` fields respectively. On return ``count`` can be smaller than the number requested. -.. _v4l2-create-buffers: +.. c:type:: v4l2_create_buffers .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -115,7 +115,7 @@ than the number requested. - .. row 4 - - struct :ref:`v4l2_format ` + - struct :c:type:`v4l2_format` - ``format`` diff --git a/Documentation/media/uapi/v4l/vidioc-cropcap.rst b/Documentation/media/uapi/v4l/vidioc-cropcap.rst index 9b7c99eef717..945596fcd65f 100644 --- a/Documentation/media/uapi/v4l/vidioc-cropcap.rst +++ b/Documentation/media/uapi/v4l/vidioc-cropcap.rst @@ -50,7 +50,7 @@ support cropping and/or scaling and/or have non-square pixels, and for overlay devices. -.. _v4l2-cropcap: +.. c:type:: v4l2_cropcap .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -98,7 +98,7 @@ overlay devices. - .. row 4 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``pixelaspect`` @@ -165,7 +165,7 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_cropcap ` ``type`` is + The struct :c:type:`v4l2_cropcap` ``type`` is invalid. ENODATA diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst index 9c97527dc2cf..f9d76f3d519d 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst @@ -48,7 +48,7 @@ Additionally the Linux kernel must be compiled with the To query the driver applications must initialize the ``match.type`` and ``match.addr`` or ``match.name`` fields of a struct -:ref:`v4l2_dbg_chip_info ` and call +:c:type:`v4l2_dbg_chip_info` and call :ref:`VIDIOC_DBG_G_CHIP_INFO` with a pointer to this structure. On success the driver stores information about the selected chip in the ``name`` and ``flags`` fields. @@ -124,7 +124,7 @@ instructions. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-dbg-chip-info: +.. c:type:: v4l2_dbg_chip_info .. flat-table:: struct v4l2_dbg_chip_info :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst index 6eeb0de24b50..08f3c510e440 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst @@ -49,7 +49,7 @@ superuser privileges. Additionally the Linux kernel must be compiled with the ``CONFIG_VIDEO_ADV_DEBUG`` option to enable these ioctls. To write a register applications must initialize all fields of a struct -:ref:`v4l2_dbg_register ` except for ``size`` and +:c:type:`v4l2_dbg_register` except for ``size`` and call ``VIDIOC_DBG_S_REGISTER`` with a pointer to this structure. The ``match.type`` and ``match.addr`` or ``match.name`` fields select a chip on the TV card, the ``reg`` field specifies a register number and the @@ -87,7 +87,7 @@ instructions. .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| -.. _v4l2-dbg-match: +.. c:type:: v4l2_dbg_match .. flat-table:: struct v4l2_dbg_match :header-rows: 0 @@ -131,7 +131,7 @@ instructions. -.. _v4l2-dbg-register: +.. c:type:: v4l2_dbg_register .. flat-table:: struct v4l2_dbg_register :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst index 6077caac6086..cade4603e138 100644 --- a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst @@ -30,7 +30,7 @@ Arguments File descriptor returned by :ref:`open() `. ``argp`` - pointer to struct :ref:`v4l2_decoder_cmd `. + pointer to struct :c:type:`v4l2_decoder_cmd`. Description @@ -40,7 +40,7 @@ These ioctls control an audio/video (usually MPEG-) decoder. ``VIDIOC_DECODER_CMD`` sends a command to the decoder, ``VIDIOC_TRY_DECODER_CMD`` can be used to try a command without actually executing it. To send a command applications must initialize all fields -of a struct :ref:`v4l2_decoder_cmd ` and call +of a struct :c:type:`v4l2_decoder_cmd` and call ``VIDIOC_DECODER_CMD`` or ``VIDIOC_TRY_DECODER_CMD`` with a pointer to this structure. @@ -61,7 +61,7 @@ introduced in Linux 3.3. .. tabularcolumns:: |p{1.1cm}|p{2.4cm}|p{1.2cm}|p{1.6cm}|p{10.6cm}| -.. _v4l2-decoder-cmd: +.. c:type:: v4l2_decoder_cmd .. cssclass:: longtable diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index 067e0aa27918..cf0e98f5112f 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -32,7 +32,7 @@ Description =========== Dequeue an event from a video device. No input is required for this -ioctl. All the fields of the struct :ref:`v4l2_event ` +ioctl. All the fields of the struct :c:type:`v4l2_event` structure are filled by the driver. The file handle will also receive exceptions which the application may get by e.g. using the select system call. @@ -40,7 +40,7 @@ call. .. tabularcolumns:: |p{3.0cm}|p{4.3cm}|p{2.5cm}|p{7.7cm}| -.. _v4l2-event: +.. c:type:: v4l2_event .. cssclass: longtable @@ -71,7 +71,7 @@ call. - .. row 3 - - - struct :ref:`v4l2_event_vsync ` + - struct :c:type:`v4l2_event_vsync` - ``vsync`` @@ -80,7 +80,7 @@ call. - .. row 4 - - - struct :ref:`v4l2_event_ctrl ` + - struct :c:type:`v4l2_event_ctrl` - ``ctrl`` @@ -89,7 +89,7 @@ call. - .. row 5 - - - struct :ref:`v4l2_event_frame_sync ` + - struct :c:type:`v4l2_event_frame_sync` - ``frame_sync`` @@ -98,7 +98,7 @@ call. - .. row 6 - - - struct :ref:`v4l2_event_motion_det ` + - struct :c:type:`v4l2_event_motion_det` - ``motion_det`` @@ -107,7 +107,7 @@ call. - .. row 7 - - - struct :ref:`v4l2_event_src_change ` + - struct :c:type:`v4l2_event_src_change` - ``src_change`` @@ -205,7 +205,7 @@ call. - 1 - This event is triggered on the vertical sync. This event has a - struct :ref:`v4l2_event_vsync ` associated + struct :c:type:`v4l2_event_vsync` associated with it. - .. row 3 @@ -228,10 +228,10 @@ call. which you want to receive events. This event is triggered if the control's value changes, if a button control is pressed or if the control's flags change. This event has a struct - :ref:`v4l2_event_ctrl ` associated with it. + :c:type:`v4l2_event_ctrl` associated with it. This struct contains much of the same information as struct :ref:`v4l2_queryctrl ` and struct - :ref:`v4l2_control `. + :c:type:`v4l2_control`. If the event is generated due to a call to :ref:`VIDIOC_S_CTRL ` or @@ -243,7 +243,7 @@ call. This event type will ensure that no information is lost when more events are raised than there is room internally. In that case the - struct :ref:`v4l2_event_ctrl ` of the + struct :c:type:`v4l2_event_ctrl` of the second-oldest event is kept, but the ``changes`` field of the second-oldest event is ORed with the ``changes`` field of the oldest event. @@ -256,13 +256,13 @@ call. - Triggered immediately when the reception of a frame has begun. This event has a struct - :ref:`v4l2_event_frame_sync ` + :c:type:`v4l2_event_frame_sync` associated with it. If the hardware needs to be stopped in the case of a buffer underrun it might not be able to generate this event. In such cases the ``frame_sequence`` field in struct - :ref:`v4l2_event_frame_sync ` will not + :c:type:`v4l2_event_frame_sync` will not be incremented. This causes two consecutive frame sequence numbers to have n times frame interval in between them. @@ -281,7 +281,7 @@ call. receive events. This event has a struct - :ref:`v4l2_event_src_change ` + :c:type:`v4l2_event_src_change` associated with it. The ``changes`` bitfield denotes what has changed for the subscribed pad. If multiple events occurred before application could dequeue them, then the changes will have the @@ -295,7 +295,7 @@ call. - Triggered whenever the motion detection state for one or more of the regions changes. This event has a struct - :ref:`v4l2_event_motion_det ` + :c:type:`v4l2_event_motion_det` associated with it. - .. row 8 @@ -310,7 +310,7 @@ call. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-event-vsync: +.. c:type:: v4l2_event_vsync .. flat-table:: struct v4l2_event_vsync :header-rows: 0 @@ -330,7 +330,7 @@ call. .. tabularcolumns:: |p{3.5cm}|p{3.0cm}|p{1.8cm}|p{8.5cm}| -.. _v4l2-event-ctrl: +.. c:type:: v4l2_event_ctrl .. flat-table:: struct v4l2_event_ctrl :header-rows: 0 @@ -439,7 +439,7 @@ call. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-event-frame-sync: +.. c:type:: v4l2_event_frame_sync .. flat-table:: struct v4l2_event_frame_sync :header-rows: 0 @@ -459,7 +459,7 @@ call. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-event-src-change: +.. c:type:: v4l2_event_src_change .. flat-table:: struct v4l2_event_src_change :header-rows: 0 @@ -480,7 +480,7 @@ call. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-event-motion-det: +.. c:type:: v4l2_event_motion_det .. flat-table:: struct v4l2_event_motion_det :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst index 741718baf14b..7cb78a0067ac 100644 --- a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst @@ -36,7 +36,7 @@ Description To query the capabilities of the DV receiver/transmitter applications initialize the ``pad`` field to 0, zero the reserved array of struct -:ref:`v4l2_dv_timings_cap ` and call the +:c:type:`v4l2_dv_timings_cap` and call the ``VIDIOC_DV_TIMINGS_CAP`` ioctl on a video node and the driver will fill in the structure. @@ -50,14 +50,14 @@ queried by calling the ``VIDIOC_SUBDEV_DV_TIMINGS_CAP`` 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 struct -:ref:`v4l2_dv_timings_cap ` ``pad`` field and +:c:type:`v4l2_dv_timings_cap` ``pad`` field and zero the ``reserved`` array. Attempts to query capabilities on a pad that doesn't support them will return an ``EINVAL`` error code. .. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{13.3cm}| -.. _v4l2-bt-timings-cap: +.. c:type:: v4l2_bt_timings_cap .. flat-table:: struct v4l2_bt_timings_cap :header-rows: 0 @@ -144,7 +144,7 @@ that doesn't support them will return an ``EINVAL`` error code. .. tabularcolumns:: |p{1.0cm}|p{3.5cm}|p{3.5cm}|p{9.5cm}| -.. _v4l2-dv-timings-cap: +.. c:type:: v4l2_dv_timings_cap .. flat-table:: struct v4l2_dv_timings_cap :header-rows: 0 @@ -190,7 +190,7 @@ that doesn't support them will return an ``EINVAL`` error code. - .. row 5 - - - struct :ref:`v4l2_bt_timings_cap ` + - struct :c:type:`v4l2_bt_timings_cap` - ``bt`` diff --git a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst index 802eac3ca9ec..b724ec36a25c 100644 --- a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst @@ -40,7 +40,7 @@ These ioctls control an audio/video (usually MPEG-) encoder. executing it. To send a command applications must initialize all fields of a struct -:ref:`v4l2_encoder_cmd ` and call +:c:type:`v4l2_encoder_cmd` and call ``VIDIOC_ENCODER_CMD`` or ``VIDIOC_TRY_ENCODER_CMD`` with a pointer to this structure. @@ -67,7 +67,7 @@ introduced in Linux 2.6.21. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-encoder-cmd: +.. c:type:: v4l2_encoder_cmd .. flat-table:: struct v4l2_encoder_cmd :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst index db9613c9b4bd..dfe4d737b0aa 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst @@ -43,7 +43,7 @@ this list. To query the available timings, applications initialize the ``index`` field, set the ``pad`` field to 0, zero the reserved array of struct -:ref:`v4l2_enum_dv_timings ` and call the +:c:type:`v4l2_enum_dv_timings` and call the ``VIDIOC_ENUM_DV_TIMINGS`` ioctl on a video node with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all supported @@ -60,12 +60,12 @@ by calling the ``VIDIOC_SUBDEV_ENUM_DV_TIMINGS`` 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 struct -:ref:`v4l2_enum_dv_timings ` ``pad`` field. +:c:type:`v4l2_enum_dv_timings` ``pad`` field. Attempts to enumerate timings on a pad that doesn't support them will return an ``EINVAL`` error code. -.. _v4l2-enum-dv-timings: +.. c:type:: v4l2_enum_dv_timings .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -104,7 +104,7 @@ return an ``EINVAL`` error code. - .. row 4 - - struct :ref:`v4l2_dv_timings ` + - struct :c:type:`v4l2_dv_timings` - ``timings`` @@ -119,7 +119,7 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_enum_dv_timings ` + The struct :c:type:`v4l2_enum_dv_timings` ``index`` is out of bounds or the ``pad`` number is invalid. ENODATA diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index 1a4834934085..1df8fccf067f 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -32,7 +32,7 @@ Description =========== To enumerate image formats applications initialize the ``type`` and -``index`` field of struct :ref:`v4l2_fmtdesc ` and call +``index`` field of struct :c:type:`v4l2_fmtdesc` and call the :ref:`VIDIOC_ENUM_FMT` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code. All formats are enumerable by beginning at index zero and incrementing by @@ -46,7 +46,7 @@ one until ``EINVAL`` is returned. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-fmtdesc: +.. c:type:: v4l2_fmtdesc .. flat-table:: struct v4l2_fmtdesc :header-rows: 0 @@ -167,5 +167,5 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_fmtdesc ` ``type`` is not + The struct :c:type:`v4l2_fmtdesc` ``type`` is not supported or the ``index`` is out of bounds. diff --git a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst index f9bb6fb4ca8e..07e94420c4c5 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst @@ -26,7 +26,7 @@ Arguments File descriptor returned by :ref:`open() `. ``argp`` - Pointer to a struct :ref:`v4l2_frmivalenum ` + Pointer to a struct :c:type:`v4l2_frmivalenum` structure that contains a pixel format and size and receives a frame interval. @@ -101,7 +101,7 @@ the application, *OUT* denotes values that the driver fills in. The application should zero out all members except for the *IN* fields. -.. _v4l2-frmival-stepwise: +.. c:type:: v4l2_frmival_stepwise .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -113,7 +113,7 @@ application should zero out all members except for the *IN* fields. - .. row 1 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``min`` @@ -121,7 +121,7 @@ application should zero out all members except for the *IN* fields. - .. row 2 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``max`` @@ -129,7 +129,7 @@ application should zero out all members except for the *IN* fields. - .. row 3 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``step`` @@ -137,7 +137,7 @@ application should zero out all members except for the *IN* fields. -.. _v4l2-frmivalenum: +.. c:type:: v4l2_frmivalenum .. flat-table:: struct v4l2_frmivalenum :header-rows: 0 @@ -200,7 +200,7 @@ application should zero out all members except for the *IN* fields. - .. row 7 - - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``discrete`` @@ -209,7 +209,7 @@ application should zero out all members except for the *IN* fields. - .. row 8 - - - struct :ref:`v4l2_frmival_stepwise ` + - struct :c:type:`v4l2_frmival_stepwise` - ``stepwise`` diff --git a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst index 4fb19b75abf1..a4ddfe9f8956 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst @@ -26,7 +26,7 @@ Arguments File descriptor returned by :ref:`open() `. ``argp`` - Pointer to a struct :ref:`v4l2_frmsizeenum ` + Pointer to a struct :c:type:`v4l2_frmsizeenum` that contains an index and pixel format and receives a frame width and height. @@ -90,7 +90,7 @@ the application, *OUT* denotes values that the driver fills in. The application should zero out all members except for the *IN* fields. -.. _v4l2-frmsize-discrete: +.. c:type:: v4l2_frmsize_discrete .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -118,7 +118,7 @@ application should zero out all members except for the *IN* fields. -.. _v4l2-frmsize-stepwise: +.. c:type:: v4l2_frmsize_stepwise .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -178,7 +178,7 @@ application should zero out all members except for the *IN* fields. -.. _v4l2-frmsizeenum: +.. c:type:: v4l2_frmsizeenum .. flat-table:: struct v4l2_frmsizeenum :header-rows: 0 @@ -223,7 +223,7 @@ application should zero out all members except for the *IN* fields. - .. row 5 - - - struct :ref:`v4l2_frmsize_discrete ` + - struct :c:type:`v4l2_frmsize_discrete` - ``discrete`` @@ -232,7 +232,7 @@ application should zero out all members except for the *IN* fields. - .. row 6 - - - struct :ref:`v4l2_frmsize_stepwise ` + - struct :c:type:`v4l2_frmsize_stepwise` - ``stepwise`` diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index 60ae938d5ef8..c38478227031 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -34,7 +34,7 @@ Description Enumerates the frequency bands that a tuner or modulator supports. To do this applications initialize the ``tuner``, ``type`` and ``index`` fields, and zero out the ``reserved`` array of a struct -:ref:`v4l2_frequency_band ` and call the +:c:type:`v4l2_frequency_band` and call the :ref:`VIDIOC_ENUM_FREQ_BANDS` ioctl with a pointer to this structure. This ioctl is supported if the ``V4L2_TUNER_CAP_FREQ_BANDS`` capability @@ -43,7 +43,7 @@ of the corresponding tuner/modulator is set. .. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| -.. _v4l2-frequency-band: +.. c:type:: v4l2_frequency_band .. flat-table:: struct v4l2_frequency_band :header-rows: 0 @@ -58,10 +58,10 @@ of the corresponding tuner/modulator is set. - ``tuner`` - The tuner or modulator index number. This is the same value as in - the struct :ref:`v4l2_input ` ``tuner`` field and - the struct :ref:`v4l2_tuner ` ``index`` field, or - the struct :ref:`v4l2_output ` ``modulator`` field - and the struct :ref:`v4l2_modulator ` ``index`` + the struct :c:type:`v4l2_input` ``tuner`` field and + the struct :c:type:`v4l2_tuner` ``index`` field, or + the struct :c:type:`v4l2_output` ``modulator`` field + and the struct :c:type:`v4l2_modulator` ``index`` field. - .. row 2 @@ -71,7 +71,7 @@ of the corresponding tuner/modulator is set. - ``type`` - The tuner type. This is the same value as in the struct - :ref:`v4l2_tuner ` ``type`` field. The type must be + :c:type:`v4l2_tuner` ``type`` field. The type must be set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to ``V4L2_TUNER_RADIO`` for modulators (currently only radio diff --git a/Documentation/media/uapi/v4l/vidioc-enumaudio.rst b/Documentation/media/uapi/v4l/vidioc-enumaudio.rst index c9d9eb60551e..74bc3ed0bdd8 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumaudio.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumaudio.rst @@ -33,14 +33,14 @@ Description To query the attributes of an audio input applications initialize the ``index`` field and zero out the ``reserved`` array of a struct -:ref:`v4l2_audio ` and call the :ref:`VIDIOC_ENUMAUDIO` +:c:type:`v4l2_audio` and call the :ref:`VIDIOC_ENUMAUDIO` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all audio inputs applications shall begin at index zero, incrementing by one until the driver returns ``EINVAL``. See :ref:`VIDIOC_G_AUDIO ` for a description of struct -:ref:`v4l2_audio `. +:c:type:`v4l2_audio`. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst b/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst index a7a27327fe88..4470a1ece5cf 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumaudioout.rst @@ -33,7 +33,7 @@ Description To query the attributes of an audio output applications initialize the ``index`` field and zero out the ``reserved`` array of a struct -:ref:`v4l2_audioout ` and call the ``VIDIOC_G_AUDOUT`` +:c:type:`v4l2_audioout` and call the ``VIDIOC_G_AUDOUT`` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all audio outputs applications shall begin at index @@ -45,7 +45,7 @@ zero, incrementing by one until the driver returns ``EINVAL``. to a sound card are not audio outputs in this sense. See :ref:`VIDIOC_G_AUDIOout ` for a description of struct -:ref:`v4l2_audioout `. +:c:type:`v4l2_audioout`. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index 8f6c603819d8..be03e04e3dac 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -32,7 +32,7 @@ Description =========== To query the attributes of a video input applications initialize the -``index`` field of struct :ref:`v4l2_input ` and call the +``index`` field of struct :c:type:`v4l2_input` and call the :ref:`VIDIOC_ENUMINPUT` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all inputs applications shall begin @@ -41,7 +41,7 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-input: +.. c:type:: v4l2_input .. flat-table:: struct v4l2_input :header-rows: 0 @@ -104,7 +104,7 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. - Capture devices can have zero or more tuners (RF demodulators). When the ``type`` is set to ``V4L2_INPUT_TYPE_TUNER`` this is an RF connector and this field identifies the tuner. It corresponds - to struct :ref:`v4l2_tuner ` field ``index``. For + to struct :c:type:`v4l2_tuner` field ``index``. For details on tuners see :ref:`tuner`. - .. row 6 @@ -377,5 +377,5 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_input ` ``index`` is out of + The struct :c:type:`v4l2_input` ``index`` is out of bounds. diff --git a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst index d660c37d3516..763066ab99b6 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst @@ -32,7 +32,7 @@ Description =========== To query the attributes of a video outputs applications initialize the -``index`` field of struct :ref:`v4l2_output ` and call +``index`` field of struct :c:type:`v4l2_output` and call the :ref:`VIDIOC_ENUMOUTPUT` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all outputs applications @@ -42,7 +42,7 @@ EINVAL. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-output: +.. c:type:: v4l2_output .. flat-table:: struct v4l2_output :header-rows: 0 @@ -105,7 +105,7 @@ EINVAL. - Output devices can have zero or more RF modulators. When the ``type`` is ``V4L2_OUTPUT_TYPE_MODULATOR`` this is an RF connector and this field identifies the modulator. It corresponds to struct - :ref:`v4l2_modulator ` field ``index``. For + :c:type:`v4l2_modulator` field ``index``. For details on modulators see :ref:`tuner`. - .. row 6 @@ -222,5 +222,5 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_output ` ``index`` is out of + The struct :c:type:`v4l2_output` ``index`` is out of bounds. diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index 5bd85932d33b..eaac7a2e14c4 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -33,7 +33,7 @@ Description To query the attributes of a video standard, especially a custom (driver defined) one, applications initialize the ``index`` field of struct -:ref:`v4l2_standard ` and call the :ref:`VIDIOC_ENUMSTD` +:c:type:`v4l2_standard` and call the :ref:`VIDIOC_ENUMSTD` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all standards applications shall begin at index @@ -42,7 +42,7 @@ enumerate a different set of standards after switching the video input or output. [#f1]_ -.. _v4l2-standard: +.. c:type:: v4l2_standard .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -71,7 +71,7 @@ or output. [#f1]_ set as custom standards. Multiple bits can be set if the hardware does not distinguish between these standards, however separate indices do not indicate the opposite. The ``id`` must be unique. - No other enumerated :ref:`struct v4l2_standard ` structure, + No other enumerated :c:type:`struct v4l2_standard ` structure, for this input or output anyway, can contain the same set of bits. - .. row 3 @@ -86,7 +86,7 @@ or output. [#f1]_ - .. row 4 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``frameperiod`` @@ -112,7 +112,7 @@ or output. [#f1]_ -.. _v4l2-fract: +.. c:type:: v4l2_fract .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -411,7 +411,7 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_standard ` ``index`` is out + The struct :c:type:`v4l2_standard` ``index`` is out of bounds. ENODATA diff --git a/Documentation/media/uapi/v4l/vidioc-expbuf.rst b/Documentation/media/uapi/v4l/vidioc-expbuf.rst index f7b8d643fd28..650757ad8aed 100644 --- a/Documentation/media/uapi/v4l/vidioc-expbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-expbuf.rst @@ -38,13 +38,13 @@ buffers have been allocated with the :ref:`VIDIOC_REQBUFS` ioctl. To export a buffer, applications fill struct -:ref:`v4l2_exportbuffer `. The ``type`` field is +:c:type:`v4l2_exportbuffer`. The ``type`` field is set to the same buffer type as was previously used with struct -:ref:`v4l2_requestbuffers ` ``type``. +:c:type:`v4l2_requestbuffers` ``type``. Applications must also set the ``index`` field. Valid index numbers range from zero to the number of buffers allocated with :ref:`VIDIOC_REQBUFS` (struct -:ref:`v4l2_requestbuffers ` ``count``) minus +:c:type:`v4l2_requestbuffers` ``count``) minus one. For the multi-planar API, applications set the ``plane`` field to the index of the plane to be exported. Valid planes range from zero to the maximal number of valid planes for the currently active format. For @@ -114,7 +114,7 @@ Examples } -.. _v4l2-exportbuffer: +.. c:type:: v4l2_exportbuffer .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -131,8 +131,8 @@ Examples - ``type`` - Type of the buffer, same as struct - :ref:`v4l2_format ` ``type`` or struct - :ref:`v4l2_requestbuffers ` ``type``, set + :c:type:`v4l2_format` ``type`` or struct + :c:type:`v4l2_requestbuffers` ``type``, set by the application. See :ref:`v4l2-buf-type` - .. row 2 diff --git a/Documentation/media/uapi/v4l/vidioc-g-audio.rst b/Documentation/media/uapi/v4l/vidioc-g-audio.rst index 224a09c2c53d..ebf2514464fc 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audio.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audio.rst @@ -35,7 +35,7 @@ Description =========== To query the current audio input applications zero out the ``reserved`` -array of a struct :ref:`v4l2_audio ` and call the +array of a struct :c:type:`v4l2_audio` and call the :ref:`VIDIOC_G_AUDIO ` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the device has no audio inputs, or none which combine with the current video input. @@ -43,7 +43,7 @@ has no audio inputs, or none which combine with the current video input. Audio inputs have one writable property, the audio mode. To select the current audio input *and* change the audio mode, applications initialize the ``index`` and ``mode`` fields, and the ``reserved`` array of a -:ref:`struct v4l2_audio ` structure and call the :ref:`VIDIOC_S_AUDIO ` +:c:type:`struct v4l2_audio ` structure and call the :ref:`VIDIOC_S_AUDIO ` ioctl. Drivers may switch to a different audio mode if the request cannot be satisfied. However, this is a write-only ioctl, it does not return the actual new audio mode. @@ -51,7 +51,7 @@ return the actual new audio mode. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-audio: +.. c:type:: v4l2_audio .. flat-table:: struct v4l2_audio :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst index da8db3b42262..b21794300efd 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst @@ -35,7 +35,7 @@ Description =========== To query the current audio output applications zero out the ``reserved`` -array of a struct :ref:`v4l2_audioout ` and call the +array of a struct :c:type:`v4l2_audioout` and call the ``VIDIOC_G_AUDOUT`` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the device has no audio inputs, or none which combine with the current video @@ -44,7 +44,7 @@ output. Audio outputs have no writable properties. Nevertheless, to select the current audio output applications can initialize the ``index`` field and ``reserved`` array (which in the future may contain writable properties) -of a :ref:`struct v4l2_audioout ` structure and call the +of a :c:type:`struct v4l2_audioout ` structure and call the ``VIDIOC_S_AUDOUT`` ioctl. Drivers switch to the requested output or return the ``EINVAL`` error code when the index is out of bounds. This is a write-only ioctl, it does not return the current audio output attributes @@ -56,7 +56,7 @@ as ``VIDIOC_G_AUDOUT`` does. to a sound card are not audio outputs in this sense. -.. _v4l2-audioout: +.. c:type:: v4l2_audioout .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-g-crop.rst index 1689b0c523d7..b99032e59ebe 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-crop.rst @@ -35,13 +35,13 @@ Description =========== To query the cropping rectangle size and position applications set the -``type`` field of a :ref:`struct v4l2_crop ` structure to the +``type`` field of a :c:type:`struct v4l2_crop ` structure to the respective buffer (stream) type and call the :ref:`VIDIOC_G_CROP ` ioctl with a pointer to this structure. The driver fills the rest of the structure or returns the ``EINVAL`` error code if cropping is not supported. To change the cropping rectangle applications initialize the ``type`` -and struct :ref:`v4l2_rect ` substructure named ``c`` of a +and struct :c:type:`v4l2_rect` substructure named ``c`` of a v4l2_crop structure and call the :ref:`VIDIOC_S_CROP ` ioctl with a pointer to this structure. @@ -75,7 +75,7 @@ When cropping is not supported then no parameters are changed and :ref:`VIDIOC_S_CROP ` returns the ``EINVAL`` error code. -.. _v4l2-crop: +.. c:type:: v4l2_crop .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -98,12 +98,12 @@ When cropping is not supported then no parameters are changed and - .. row 2 - - struct :ref:`v4l2_rect ` + - struct :c:type:`v4l2_rect` - ``c`` - Cropping rectangle. The same co-ordinate system as for struct - :ref:`v4l2_cropcap ` ``bounds`` is used. + :c:type:`v4l2_cropcap` ``bounds`` is used. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst index 6ced76016246..53a6ebe6f744 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst @@ -35,10 +35,10 @@ Description =========== To get the current value of a control applications initialize the ``id`` -field of a struct :ref:`struct v4l2_control ` and call the +field of a struct :c:type:`struct v4l2_control ` and call the :ref:`VIDIOC_G_CTRL ` ioctl with a pointer to this structure. To change the value of a control applications initialize the ``id`` and ``value`` -fields of a struct :ref:`struct v4l2_control ` and call the +fields of a struct :c:type:`struct v4l2_control ` and call the :ref:`VIDIOC_S_CTRL ` ioctl. When the ``id`` is invalid drivers return an ``EINVAL`` error code. When the @@ -55,7 +55,7 @@ These ioctls work only with user controls. For other control classes the :ref:`VIDIOC_TRY_EXT_CTRLS ` must be used. -.. _v4l2-control: +.. c:type:: v4l2_control .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -90,13 +90,13 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_control ` ``id`` is invalid + The struct :c:type:`v4l2_control` ``id`` is invalid or the ``value`` is inappropriate for the given control (i.e. if a menu item is selected that is not supported by the driver according to :ref:`VIDIOC_QUERYMENU `). ERANGE - The struct :ref:`v4l2_control ` ``value`` is out of + The struct :c:type:`v4l2_control` ``value`` is out of bounds. EBUSY diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index f143a6b3d927..379f2be0bc92 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -44,8 +44,8 @@ To set DV timings for the input or output, applications use the :ref:`VIDIOC_S_DV_TIMINGS ` ioctl and to get the current timings, applications use the :ref:`VIDIOC_G_DV_TIMINGS ` ioctl. The detailed timing information is filled in using the structure struct -:ref:`v4l2_dv_timings `. These ioctls take a -pointer to the struct :ref:`v4l2_dv_timings ` +:c:type:`v4l2_dv_timings`. These ioctls take a +pointer to the struct :c:type:`v4l2_dv_timings` structure as argument. If the ioctl is not supported or the timing values are not correct, the driver returns ``EINVAL`` error code. @@ -76,7 +76,7 @@ EBUSY .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-bt-timings: +.. c:type:: v4l2_bt_timings .. flat-table:: struct v4l2_bt_timings :header-rows: 0 @@ -239,7 +239,7 @@ EBUSY .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| -.. _v4l2-dv-timings: +.. c:type:: v4l2_dv_timings .. flat-table:: struct v4l2_dv_timings :header-rows: 0 @@ -266,7 +266,7 @@ EBUSY - .. row 3 - - - struct :ref:`v4l2_bt_timings ` + - struct :c:type:`v4l2_bt_timings` - ``bt`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst index 3decb810c8bb..6b5727439db2 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst @@ -37,7 +37,7 @@ driver, which is useful for random access into the stream without decoding it. To read the data applications must call :ref:`VIDIOC_G_ENC_INDEX ` with a -pointer to a struct :ref:`v4l2_enc_idx `. On success +pointer to a struct :c:type:`v4l2_enc_idx`. On success the driver fills the ``entry`` array, stores the number of elements written in the ``entries`` field, and initializes the ``entries_cap`` field. @@ -57,7 +57,7 @@ video elementary streams. .. tabularcolumns:: |p{3.5cm}|p{5.6cm}|p{8.4cm}| -.. _v4l2-enc-idx: +.. c:type:: v4l2_enc_idx .. flat-table:: struct v4l2_enc_idx :header-rows: 0 @@ -93,7 +93,7 @@ video elementary streams. - .. row 4 - - struct :ref:`v4l2_enc_idx_entry ` + - struct :c:type:`v4l2_enc_idx_entry` - ``entry``\ [``V4L2_ENC_IDX_ENTRIES``] @@ -105,7 +105,7 @@ video elementary streams. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-enc-idx-entry: +.. c:type:: v4l2_enc_idx_entry .. flat-table:: struct v4l2_enc_idx_entry :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index ee72c69f902a..01561ddfe73b 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -46,13 +46,13 @@ to the same control class. Applications must always fill in the ``count``, ``which``, ``controls`` and ``reserved`` fields of struct -:ref:`v4l2_ext_controls `, and initialize the -struct :ref:`v4l2_ext_control ` array pointed to +:c:type:`v4l2_ext_controls`, and initialize the +struct :c:type:`v4l2_ext_control` array pointed to by the ``controls`` fields. To get the current value of a set of controls applications initialize the ``id``, ``size`` and ``reserved2`` fields of each struct -:ref:`v4l2_ext_control ` and call the +:c:type:`v4l2_ext_control` and call the :ref:`VIDIOC_G_EXT_CTRLS ` ioctl. String controls controls must also set the ``string`` field. Controls of compound types (``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set) must set the ``ptr`` field. @@ -74,14 +74,14 @@ by calling :ref:`VIDIOC_QUERY_EXT_CTRL `. To change the value of a set of controls applications initialize the ``id``, ``size``, ``reserved2`` and ``value/value64/string/ptr`` fields -of each struct :ref:`v4l2_ext_control ` and call +of each struct :c:type:`v4l2_ext_control` and call the :ref:`VIDIOC_S_EXT_CTRLS ` ioctl. The controls will only be set if *all* control values are valid. To check if a set of controls have correct values applications initialize the ``id``, ``size``, ``reserved2`` and ``value/value64/string/ptr`` fields of each struct -:ref:`v4l2_ext_control ` and call the +:c:type:`v4l2_ext_control` and call the :ref:`VIDIOC_TRY_EXT_CTRLS ` ioctl. It is up to the driver whether wrong values are automatically adjusted to a valid value or if an error is returned. @@ -90,7 +90,7 @@ When the ``id`` or ``which`` is invalid drivers return an ``EINVAL`` error code. When the value is out of bounds drivers can choose to take the closest valid value or return an ``ERANGE`` error code, whatever seems more appropriate. In the first case the new value is set in struct -:ref:`v4l2_ext_control `. If the new control value +:c:type:`v4l2_ext_control`. If the new control value is inappropriate (e.g. the given menu index is not supported by the menu control), then this will also result in an ``EINVAL`` error code error. @@ -102,7 +102,7 @@ still cause this situation. .. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{1.5cm}|p{11.8cm}| -.. _v4l2-ext-control: +.. c:type:: v4l2_ext_control .. cssclass: longtable @@ -236,7 +236,7 @@ still cause this situation. .. tabularcolumns:: |p{4.0cm}|p{2.0cm}|p{2.0cm}|p{8.5cm}| -.. _v4l2-ext-controls: +.. c:type:: v4l2_ext_controls .. cssclass:: longtable @@ -362,7 +362,7 @@ still cause this situation. - .. row 7 - - struct :ref:`v4l2_ext_control ` * + - struct :c:type:`v4l2_ext_control` * - ``controls`` @@ -483,17 +483,17 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_ext_control ` ``id`` is - invalid, the struct :ref:`v4l2_ext_controls ` + The struct :c:type:`v4l2_ext_control` ``id`` is + invalid, the struct :c:type:`v4l2_ext_controls` ``which`` is invalid, or the struct - :ref:`v4l2_ext_control ` ``value`` was + :c:type:`v4l2_ext_control` ``value`` was inappropriate (e.g. the given menu index is not supported by the driver). This error code is also returned by the :ref:`VIDIOC_S_EXT_CTRLS ` and :ref:`VIDIOC_TRY_EXT_CTRLS ` ioctls if two or more control values are in conflict. ERANGE - The struct :ref:`v4l2_ext_control ` ``value`` + The struct :c:type:`v4l2_ext_control` ``value`` is out of bounds. EBUSY diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index 00f783692752..7ade2f7d62be 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -49,13 +49,13 @@ VGA signal or graphics into a video signal. *Video Output Overlays* are always non-destructive. To get the current parameters applications call the :ref:`VIDIOC_G_FBUF ` -ioctl with a pointer to a :ref:`struct v4l2_framebuffer ` +ioctl with a pointer to a :c:type:`struct v4l2_framebuffer ` structure. The driver fills all fields of the structure or returns an EINVAL error code when overlays are not supported. To set the parameters for a *Video Output Overlay*, applications must initialize the ``flags`` field of a struct -:ref:`struct v4l2_framebuffer `. Since the framebuffer is +:c:type:`struct v4l2_framebuffer `. Since the framebuffer is implemented on the TV card all other parameters are determined by the driver. When an application calls :ref:`VIDIOC_S_FBUF ` with a pointer to this structure, the driver prepares for the overlay and returns the @@ -77,7 +77,7 @@ destructive video overlay. .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| -.. _v4l2-framebuffer: +.. c:type:: v4l2_framebuffer .. cssclass:: longtable @@ -172,7 +172,7 @@ destructive video overlay. - - - For *non-destructive Video Overlays* this field only defines a - format for the struct :ref:`v4l2_window ` + format for the struct :c:type:`v4l2_window` ``chromakey`` field. - .. row 10 @@ -207,7 +207,7 @@ destructive video overlay. - Drivers and applications shall ignore this field. If applicable, the field order is selected with the :ref:`VIDIOC_S_FMT ` ioctl, using the ``field`` - field of struct :ref:`v4l2_window `. + field of struct :c:type:`v4l2_window`. - .. row 13 @@ -422,7 +422,7 @@ destructive video overlay. - 0x0004 - Use chroma-keying. The chroma-key color is determined by the - ``chromakey`` field of struct :ref:`v4l2_window ` + ``chromakey`` field of struct :c:type:`v4l2_window` and negotiated with the :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` and :ref:`osd`. @@ -454,7 +454,7 @@ destructive video overlay. images. The blend function is: output = (framebuffer pixel * alpha + video pixel * (255 - alpha)) / 255. The alpha value is determined by the ``global_alpha`` field of struct - :ref:`v4l2_window ` and negotiated with the + :c:type:`v4l2_window` and negotiated with the :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` and :ref:`osd`. @@ -478,11 +478,11 @@ destructive video overlay. - Use source chroma-keying. The source chroma-key color is determined by the ``chromakey`` field of struct - :ref:`v4l2_window ` and negotiated with the + :c:type:`v4l2_window` and negotiated with the :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` and :ref:`osd`. Both chroma-keying are mutual exclusive to each other, so same ``chromakey`` field of struct - :ref:`v4l2_window ` is being used. + :c:type:`v4l2_window` is being used. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst index ebeb7e9a48ea..dd6c062d267c 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst @@ -40,15 +40,15 @@ These ioctls are used to negotiate the format of data (typically image format) exchanged between driver and application. To query the current parameters applications set the ``type`` field of a -struct :ref:`struct v4l2_format ` to the respective buffer (stream) +struct :c:type:`struct v4l2_format ` to the respective buffer (stream) type. For example video capture devices use ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` or ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``. When the application calls the :ref:`VIDIOC_G_FMT ` ioctl with a pointer to this structure the driver fills the respective member of the ``fmt`` union. In case of video capture devices that is either the struct -:ref:`v4l2_pix_format ` ``pix`` or the struct -:ref:`v4l2_pix_format_mplane ` ``pix_mp`` +:c:type:`v4l2_pix_format` ``pix`` or the struct +:c:type:`v4l2_pix_format_mplane` ``pix_mp`` member. When the requested buffer type is not supported drivers return an ``EINVAL`` error code. @@ -58,7 +58,7 @@ For details see the documentation of the various devices types in :ref:`devices`. Good practice is to query the current parameters first, and to modify only those parameters not suitable for the application. When the application calls the :ref:`VIDIOC_S_FMT ` ioctl with -a pointer to a :ref:`struct v4l2_format ` structure the driver +a pointer to a :c:type:`struct v4l2_format ` structure the driver checks and adjusts the parameters against hardware abilities. Drivers should not return an error code unless the ``type`` field is invalid, this is a mechanism to fathom device capabilities and to approach @@ -85,7 +85,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical :ref:`VIDIOC_S_FMT ` returns for the same input or output. -.. _v4l2-format: +.. c:type:: v4l2_format .. tabularcolumns:: |p{1.2cm}|p{4.3cm}|p{3.0cm}|p{9.0cm}| @@ -112,7 +112,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical - .. row 3 - - - struct :ref:`v4l2_pix_format ` + - struct :c:type:`v4l2_pix_format` - ``pix`` @@ -122,7 +122,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical - .. row 4 - - - struct :ref:`v4l2_pix_format_mplane ` + - struct :c:type:`v4l2_pix_format_mplane` - ``pix_mp`` @@ -133,7 +133,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical - .. row 5 - - - struct :ref:`v4l2_window ` + - struct :c:type:`v4l2_window` - ``win`` @@ -143,7 +143,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical - .. row 6 - - - struct :ref:`v4l2_vbi_format ` + - struct :c:type:`v4l2_vbi_format` - ``vbi`` @@ -154,7 +154,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical - .. row 7 - - - struct :ref:`v4l2_sliced_vbi_format ` + - struct :c:type:`v4l2_sliced_vbi_format` - ``sliced`` @@ -164,7 +164,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical - .. row 8 - - - struct :ref:`v4l2_sdr_format ` + - struct :c:type:`v4l2_sdr_format` - ``sdr`` @@ -189,5 +189,5 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_format ` ``type`` field is + The struct :c:type:`v4l2_format` ``type`` field is invalid or the requested buffer type not supported. diff --git a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst index d517c7bb2182..9cbe70098b2b 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst @@ -36,7 +36,7 @@ Description To get the current tuner or modulator radio frequency applications set the ``tuner`` field of a struct -:ref:`v4l2_frequency ` to the respective tuner or +:c:type:`v4l2_frequency` to the respective tuner or modulator number (only input devices have tuners, only output devices have modulators), zero out the ``reserved`` array and call the :ref:`VIDIOC_G_FREQUENCY ` ioctl with a pointer to this structure. The @@ -44,7 +44,7 @@ driver stores the current frequency in the ``frequency`` field. To change the current tuner or modulator radio frequency applications initialize the ``tuner``, ``type`` and ``frequency`` fields, and the -``reserved`` array of a struct :ref:`v4l2_frequency ` +``reserved`` array of a struct :c:type:`v4l2_frequency` and call the :ref:`VIDIOC_S_FREQUENCY ` ioctl with a pointer to this structure. When the requested frequency is not possible the driver assumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY ` is a @@ -53,7 +53,7 @@ write-only ioctl, it does not return the actual new frequency. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-frequency: +.. c:type:: v4l2_frequency .. flat-table:: struct v4l2_frequency :header-rows: 0 @@ -68,10 +68,10 @@ write-only ioctl, it does not return the actual new frequency. - ``tuner`` - The tuner or modulator index number. This is the same value as in - the struct :ref:`v4l2_input ` ``tuner`` field and - the struct :ref:`v4l2_tuner ` ``index`` field, or - the struct :ref:`v4l2_output ` ``modulator`` field - and the struct :ref:`v4l2_modulator ` ``index`` + the struct :c:type:`v4l2_input` ``tuner`` field and + the struct :c:type:`v4l2_tuner` ``index`` field, or + the struct :c:type:`v4l2_output` ``modulator`` field + and the struct :c:type:`v4l2_modulator` ``index`` field. - .. row 2 @@ -81,7 +81,7 @@ write-only ioctl, it does not return the actual new frequency. - ``type`` - The tuner type. This is the same value as in the struct - :ref:`v4l2_tuner ` ``type`` field. The type must be + :c:type:`v4l2_tuner` ``type`` field. The type must be set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to ``V4L2_TUNER_RADIO`` for modulators (currently only radio @@ -94,8 +94,8 @@ write-only ioctl, it does not return the actual new frequency. - ``frequency`` - Tuning frequency in units of 62.5 kHz, or if the struct - :ref:`v4l2_tuner ` or struct - :ref:`v4l2_modulator ` ``capability`` flag + :c:type:`v4l2_tuner` or struct + :c:type:`v4l2_modulator` ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. diff --git a/Documentation/media/uapi/v4l/vidioc-g-input.rst b/Documentation/media/uapi/v4l/vidioc-g-input.rst index 32735d20066c..1364a918fbce 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-input.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-input.rst @@ -37,7 +37,7 @@ Description To query the current video input applications call the :ref:`VIDIOC_G_INPUT ` ioctl with a pointer to an integer where the driver stores the number of the input, as in the struct -:ref:`v4l2_input ` ``index`` field. This ioctl will fail +:c:type:`v4l2_input` ``index`` field. This ioctl will fail only when there are no video inputs, returning ``EINVAL``. To select a video input applications store the number of the desired diff --git a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst index 387c71c209bc..c56c5bc7beb5 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst @@ -56,7 +56,7 @@ encoding. You usually do want to add them. .. tabularcolumns:: |p{1.2cm}|p{3.0cm}|p{13.3cm}| -.. _v4l2-jpegcompression: +.. c:type:: v4l2_jpegcompression .. flat-table:: struct v4l2_jpegcompression :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst index c7729e67e8d9..5d209efa0965 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst @@ -36,7 +36,7 @@ Description To query the attributes of a modulator applications initialize the ``index`` field and zero out the ``reserved`` array of a struct -:ref:`v4l2_modulator ` and call the +:c:type:`v4l2_modulator` and call the :ref:`VIDIOC_G_MODULATOR ` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all modulators applications shall @@ -62,7 +62,7 @@ To change the radio frequency the .. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}| -.. _v4l2-modulator: +.. c:type:: v4l2_modulator .. flat-table:: struct v4l2_modulator :header-rows: 0 @@ -95,7 +95,7 @@ To change the radio frequency the - ``capability`` - Modulator capability flags. No flags are defined for this field, - the tuner flags in struct :ref:`v4l2_tuner ` are + the tuner flags in struct :c:type:`v4l2_tuner` are used accordingly. The audio flags indicate the ability to encode audio subprograms. They will *not* change for example with the current video standard. @@ -260,5 +260,5 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_modulator ` ``index`` is + The struct :c:type:`v4l2_modulator` ``index`` is out of bounds. diff --git a/Documentation/media/uapi/v4l/vidioc-g-output.rst b/Documentation/media/uapi/v4l/vidioc-g-output.rst index e0613e2d667f..7750948fc61b 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-output.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-output.rst @@ -37,7 +37,7 @@ Description To query the current video output applications call the :ref:`VIDIOC_G_OUTPUT ` ioctl with a pointer to an integer where the driver stores the number of the output, as in the struct -:ref:`v4l2_output ` ``index`` field. This ioctl will +:c:type:`v4l2_output` ``index`` field. This ioctl will fail only when there are no video outputs, returning the ``EINVAL`` error code. diff --git a/Documentation/media/uapi/v4l/vidioc-g-parm.rst b/Documentation/media/uapi/v4l/vidioc-g-parm.rst index 9e9af1dd4f29..021b96ee641d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-parm.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-parm.rst @@ -47,13 +47,13 @@ section discussing the :ref:`read() ` function. To get and set the streaming parameters applications call the :ref:`VIDIOC_G_PARM ` and :ref:`VIDIOC_S_PARM ` ioctl, respectively. They take a -pointer to a struct :ref:`struct v4l2_streamparm ` which contains a +pointer to a struct :c:type:`struct v4l2_streamparm ` which contains a union holding separate parameters for input and output devices. .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| -.. _v4l2-streamparm: +.. c:type:: v4l2_streamparm .. flat-table:: struct v4l2_streamparm :header-rows: 0 @@ -69,7 +69,7 @@ union holding separate parameters for input and output devices. - - The buffer (stream) type, same as struct - :ref:`v4l2_format ` ``type``, set by the + :c:type:`v4l2_format` ``type``, set by the application. See :ref:`v4l2-buf-type` - .. row 2 @@ -84,7 +84,7 @@ union holding separate parameters for input and output devices. - .. row 3 - - - struct :ref:`v4l2_captureparm ` + - struct :c:type:`v4l2_captureparm` - ``capture`` @@ -94,7 +94,7 @@ union holding separate parameters for input and output devices. - .. row 4 - - - struct :ref:`v4l2_outputparm ` + - struct :c:type:`v4l2_outputparm` - ``output`` @@ -114,7 +114,7 @@ union holding separate parameters for input and output devices. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-captureparm: +.. c:type:: v4l2_captureparm .. flat-table:: struct v4l2_captureparm :header-rows: 0 @@ -140,7 +140,7 @@ union holding separate parameters for input and output devices. - .. row 3 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``timeperframe`` @@ -151,7 +151,7 @@ union holding separate parameters for input and output devices. Applications store here the desired frame period, drivers return the actual frame period, which must be greater or equal to the nominal frame period determined by the current video standard - (struct :ref:`v4l2_standard ` ``frameperiod`` + (struct :c:type:`v4l2_standard` ``frameperiod`` field). Changing the video standard (also implicitly by switching the video input) may reset this parameter to the nominal frame period. To reset manually applications can just set this field to @@ -197,7 +197,7 @@ union holding separate parameters for input and output devices. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-outputparm: +.. c:type:: v4l2_outputparm .. flat-table:: struct v4l2_outputparm :header-rows: 0 @@ -223,7 +223,7 @@ union holding separate parameters for input and output devices. - .. row 3 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``timeperframe`` @@ -241,7 +241,7 @@ union holding separate parameters for input and output devices. Applications store here the desired frame period, drivers return the actual frame period, which must be greater or equal to the nominal frame period determined by the current video standard - (struct :ref:`v4l2_standard ` ``frameperiod`` + (struct :c:type:`v4l2_standard` ``frameperiod`` field). Changing the video standard (also implicitly by switching the video output) may reset this parameter to the nominal frame period. To reset manually applications can just set this field to diff --git a/Documentation/media/uapi/v4l/vidioc-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-g-selection.rst index 85b5afa48474..af38b2568e3b 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-selection.rst @@ -41,43 +41,43 @@ Description The ioctls are used to query and configure selection rectangles. To query the cropping (composing) rectangle set struct -:ref:`v4l2_selection ` ``type`` field to the +:c:type:`v4l2_selection` ``type`` field to the respective buffer type. Do not use the multiplanar buffer types. Use ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` instead of ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`` and use ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` instead of ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``. The next step is setting the -value of struct :ref:`v4l2_selection ` ``target`` +value of struct :c:type:`v4l2_selection` ``target`` field to ``V4L2_SEL_TGT_CROP`` (``V4L2_SEL_TGT_COMPOSE``). Please refer to table :ref:`v4l2-selections-common` or :ref:`selection-api` for additional targets. The ``flags`` and ``reserved`` fields of struct -:ref:`v4l2_selection ` are ignored and they must be +:c:type:`v4l2_selection` are ignored and they must be filled with zeros. The driver fills the rest of the structure or returns EINVAL error code if incorrect buffer type or target was used. If cropping (composing) is not supported then the active rectangle is not mutable and it is always equal to the bounds rectangle. Finally, the -struct :ref:`v4l2_rect ` ``r`` rectangle is filled with +struct :c:type:`v4l2_rect` ``r`` rectangle is filled with the current cropping (composing) coordinates. The coordinates are expressed in driver-dependent units. The only exception are rectangles for images in raw formats, whose coordinates are always expressed in pixels. To change the cropping (composing) rectangle set the struct -:ref:`v4l2_selection ` ``type`` field to the +:c:type:`v4l2_selection` ``type`` field to the respective buffer type. Do not use multiplanar buffers. Use ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` instead of ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``. Use ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` instead of ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``. The next step is setting the -value of struct :ref:`v4l2_selection ` ``target`` to +value of struct :c:type:`v4l2_selection` ``target`` to ``V4L2_SEL_TGT_CROP`` (``V4L2_SEL_TGT_COMPOSE``). Please refer to table :ref:`v4l2-selections-common` or :ref:`selection-api` for additional -targets. The struct :ref:`v4l2_rect ` ``r`` rectangle need +targets. The struct :c:type:`v4l2_rect` ``r`` rectangle need to be set to the desired active area. Field struct -:ref:`v4l2_selection ` ``reserved`` is ignored and +:c:type:`v4l2_selection` ``reserved`` is ignored and must be filled with zeros. The driver may adjust coordinates of the requested rectangle. An application may introduce constraints to control -rounding behaviour. The struct :ref:`v4l2_selection ` +rounding behaviour. The struct :c:type:`v4l2_selection` ``flags`` field must be set to one of the following: - ``0`` - The driver can adjust the rectangle size freely and shall @@ -102,7 +102,7 @@ horizontal and vertical offset and sizes are chosen according to following priority: 1. Satisfy constraints from struct - :ref:`v4l2_selection ` ``flags``. + :c:type:`v4l2_selection` ``flags``. 2. Adjust width, height, left, and top to hardware limits and alignments. @@ -115,7 +115,7 @@ following priority: 5. Keep horizontal and vertical offset as close as possible to original ones. -On success the struct :ref:`v4l2_rect ` ``r`` field +On success the struct :c:type:`v4l2_rect` ``r`` field contains the adjusted rectangle. When the parameters are unsuitable the application may modify the cropping (composing) or image parameters and repeat the cycle until satisfactory parameters have been negotiated. If @@ -140,7 +140,7 @@ Selection targets and flags are documented in -.. _v4l2-selection: +.. c:type:: v4l2_selection .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -179,7 +179,7 @@ Selection targets and flags are documented in - .. row 4 - - struct :ref:`v4l2_rect ` + - struct :c:type:`v4l2_rect` - ``r`` @@ -207,7 +207,7 @@ EINVAL supported, or the ``flags`` argument is not valid. ERANGE - It is not possible to adjust struct :ref:`v4l2_rect ` + It is not possible to adjust struct :c:type:`v4l2_rect` ``r`` rectangle to satisfy all constraints given in the ``flags`` argument. diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index abda04b07999..4df7227e0490 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -33,7 +33,7 @@ Description To find out which data services are supported by a sliced VBI capture or output device, applications initialize the ``type`` field of a struct -:ref:`v4l2_sliced_vbi_cap `, clear the +:c:type:`v4l2_sliced_vbi_cap`, clear the ``reserved`` array and call the :ref:`VIDIOC_G_SLICED_VBI_CAP ` ioctl. The driver fills in the remaining fields or returns an ``EINVAL`` error code if the sliced VBI API is unsupported or ``type`` is invalid. @@ -44,7 +44,7 @@ the sliced VBI API is unsupported or ``type`` is invalid. to write-read, in Linux 2.6.19. -.. _v4l2-sliced-vbi-cap: +.. c:type:: v4l2_sliced_vbi_cap .. tabularcolumns:: |p{1.2cm}|p{4.2cm}|p{4.1cm}|p{4.0cm}|p{4.0cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-g-std.rst b/Documentation/media/uapi/v4l/vidioc-g-std.rst index 91162f5ea6b2..c351eb9f6b0e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-std.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-std.rst @@ -38,9 +38,9 @@ To query and select the current video standard applications use the :ref:`VIDIOC_G_STD ` and :ref:`VIDIOC_S_STD ` ioctls which take a pointer to a :ref:`v4l2_std_id ` type as argument. :ref:`VIDIOC_G_STD ` can return a single flag or a set of flags as in struct -:ref:`v4l2_standard ` field ``id``. The flags must be +:c:type:`v4l2_standard` field ``id``. The flags must be unambiguous such that they appear in only one enumerated -:ref:`struct v4l2_standard ` structure. +:c:type:`struct v4l2_standard ` structure. :ref:`VIDIOC_S_STD ` accepts one or more flags, being a write-only ioctl it does not return the actual new standard as :ref:`VIDIOC_G_STD ` does. When diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index 4658a4715a5e..01b7f26bf22f 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -36,7 +36,7 @@ Description To query the attributes of a tuner applications initialize the ``index`` field and zero out the ``reserved`` array of a struct -:ref:`v4l2_tuner ` and call the ``VIDIOC_G_TUNER`` ioctl +:c:type:`v4l2_tuner` and call the ``VIDIOC_G_TUNER`` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code when the index is out of bounds. To enumerate all tuners applications shall begin at index zero, @@ -61,7 +61,7 @@ To change the radio frequency the .. tabularcolumns:: |p{1.3cm}|p{3.0cm}|p{6.6cm}|p{6.6cm}| -.. _v4l2-tuner: +.. c:type:: v4l2_tuner .. cssclass:: longtable @@ -116,7 +116,7 @@ To change the radio frequency the If multiple frequency bands are supported, then ``capability`` is the union of all ``capability`` fields of each struct - :ref:`v4l2_frequency_band `. + :c:type:`v4l2_frequency_band`. - .. row 5 @@ -226,7 +226,7 @@ To change the radio frequency the received audio programs do not match. Currently this is the only field of struct - :ref:`struct v4l2_tuner ` applications can change. + :c:type:`struct v4l2_tuner ` applications can change. - .. row 15 @@ -337,7 +337,7 @@ To change the radio frequency the multi-standard because the video standard is automatically determined from the frequency band.) The set of supported video standards is available from the struct - :ref:`v4l2_input ` pointing to this tuner, see the + :c:type:`v4l2_input` pointing to this tuner, see the description of ioctl :ref:`VIDIOC_ENUMINPUT` for details. Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this capability. @@ -730,7 +730,7 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. EINVAL - The struct :ref:`v4l2_tuner ` ``index`` is out of + The struct :c:type:`v4l2_tuner` ``index`` is out of bounds. .. [#f1] diff --git a/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst b/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst index c3f6c1c615f6..c20e1c7d5f89 100644 --- a/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst +++ b/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst @@ -40,7 +40,7 @@ operations are not required, the application can use one of ``V4L2_BUF_FLAG_NO_CACHE_INVALIDATE`` and ``V4L2_BUF_FLAG_NO_CACHE_CLEAN`` flags to skip the respective step. -The :ref:`struct v4l2_buffer ` structure is specified in +The :c:type:`struct v4l2_buffer ` structure is specified in :ref:`buffer`. diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst b/Documentation/media/uapi/v4l/vidioc-qbuf.rst index dd3f2e069fcb..727238fc2337 100644 --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst @@ -39,14 +39,14 @@ Applications call the ``VIDIOC_QBUF`` ioctl to enqueue an empty The semantics depend on the selected I/O method. To enqueue a buffer applications set the ``type`` field of a struct -:ref:`v4l2_buffer ` to the same buffer type as was -previously used with struct :ref:`v4l2_format ` ``type`` -and struct :ref:`v4l2_requestbuffers ` ``type``. +:c:type:`v4l2_buffer` to the same buffer type as was +previously used with struct :c:type:`v4l2_format` ``type`` +and struct :c:type:`v4l2_requestbuffers` ``type``. Applications must also set the ``index`` field. Valid index numbers range from zero to the number of buffers allocated with :ref:`VIDIOC_REQBUFS` (struct -:ref:`v4l2_requestbuffers ` ``count``) minus -one. The contents of the struct :ref:`struct v4l2_buffer ` returned +:c:type:`v4l2_requestbuffers` ``count``) minus +one. The contents of the struct :c:type:`struct v4l2_buffer ` returned by a :ref:`VIDIOC_QUERYBUF` ioctl will do as well. When the buffer is intended for output (``type`` is ``V4L2_BUF_TYPE_VIDEO_OUTPUT``, ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``, @@ -56,7 +56,7 @@ for details. Applications must also set ``flags`` to 0. The ``reserved2`` and ``reserved`` fields must be set to 0. When using the :ref:`multi-planar API `, the ``m.planes`` field must contain a userspace pointer to a filled-in array of struct -:ref:`v4l2_plane ` and the ``length`` field must be set +:c:type:`v4l2_plane` and the ``length`` field must be set to the number of elements in that array. To enqueue a :ref:`memory mapped ` buffer applications set the @@ -70,7 +70,7 @@ To enqueue a :ref:`user pointer ` buffer applications set the ``memory`` field to ``V4L2_MEMORY_USERPTR``, the ``m.userptr`` field to the address of the buffer and ``length`` to its size. When the multi-planar API is used, ``m.userptr`` and ``length`` members of the -passed array of struct :ref:`v4l2_plane ` have to be used +passed array of struct :c:type:`v4l2_plane` have to be used instead. When ``VIDIOC_QBUF`` is called with a pointer to this structure the driver sets the ``V4L2_BUF_FLAG_QUEUED`` flag and clears the ``V4L2_BUF_FLAG_MAPPED`` and ``V4L2_BUF_FLAG_DONE`` flags in the @@ -85,7 +85,7 @@ To enqueue a :ref:`DMABUF ` buffer applications set the ``memory`` field to ``V4L2_MEMORY_DMABUF`` and the ``m.fd`` field to a file descriptor associated with a DMABUF buffer. When the multi-planar API is used the ``m.fd`` fields of the passed array of struct -:ref:`v4l2_plane ` have to be used instead. When +:c:type:`v4l2_plane` have to be used instead. When ``VIDIOC_QBUF`` is called with a pointer to this structure the driver sets the ``V4L2_BUF_FLAG_QUEUED`` flag and clears the ``V4L2_BUF_FLAG_MAPPED`` and ``V4L2_BUF_FLAG_DONE`` flags in the @@ -100,7 +100,7 @@ device is closed. Applications call the ``VIDIOC_DQBUF`` ioctl to dequeue a filled (capturing) or displayed (output) buffer from the driver's outgoing queue. They just set the ``type``, ``memory`` and ``reserved`` fields of -a struct :ref:`v4l2_buffer ` as above, when +a struct :c:type:`v4l2_buffer` as above, when ``VIDIOC_DQBUF`` is called with a pointer to this structure the driver fills the remaining fields or returns an error code. The driver may also set ``V4L2_BUF_FLAG_ERROR`` in the ``flags`` field. It indicates a @@ -114,7 +114,7 @@ queue. When the ``O_NONBLOCK`` flag was given to the :ref:`open() ` function, ``VIDIOC_DQBUF`` returns immediately with an ``EAGAIN`` error code when no buffer is available. -The :ref:`struct v4l2_buffer ` structure is specified in +The :c:type:`struct v4l2_buffer ` structure is specified in :ref:`buffer`. diff --git a/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst index 230ebcb8aa4b..0d16853b1b51 100644 --- a/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-query-dv-timings.rst @@ -37,7 +37,7 @@ Description The hardware may be able to detect the current DV timings automatically, similar to sensing the video standard. To do so, applications call :ref:`VIDIOC_QUERY_DV_TIMINGS` with a pointer to a struct -:ref:`v4l2_dv_timings `. Once the hardware detects +:c:type:`v4l2_dv_timings`. Once the hardware detects the timings, it will fill in the timings structure. .. note:: diff --git a/Documentation/media/uapi/v4l/vidioc-querybuf.rst b/Documentation/media/uapi/v4l/vidioc-querybuf.rst index 8edfc7931ec6..1edd76c06e0a 100644 --- a/Documentation/media/uapi/v4l/vidioc-querybuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-querybuf.rst @@ -36,17 +36,17 @@ be used to query the status of a buffer at any time after buffers have been allocated with the :ref:`VIDIOC_REQBUFS` ioctl. Applications set the ``type`` field of a struct -:ref:`v4l2_buffer ` to the same buffer type as was -previously used with struct :ref:`v4l2_format ` ``type`` -and struct :ref:`v4l2_requestbuffers ` ``type``, +:c:type:`v4l2_buffer` to the same buffer type as was +previously used with struct :c:type:`v4l2_format` ``type`` +and struct :c:type:`v4l2_requestbuffers` ``type``, and the ``index`` field. Valid index numbers range from zero to the number of buffers allocated with :ref:`VIDIOC_REQBUFS` (struct -:ref:`v4l2_requestbuffers ` ``count``) minus +:c:type:`v4l2_requestbuffers` ``count``) minus one. The ``reserved`` and ``reserved2`` fields must be set to 0. When using the :ref:`multi-planar API `, the ``m.planes`` field must contain a userspace pointer to an array of struct -:ref:`v4l2_plane ` and the ``length`` field has to be set +:c:type:`v4l2_plane` and the ``length`` field has to be set to the number of elements in that array. After calling :ref:`VIDIOC_QUERYBUF` with a pointer to this structure drivers return an error code or fill the rest of the structure. @@ -59,11 +59,11 @@ set to the current I/O method. For the single-planar API, the device memory, the ``length`` field its size. For the multi-planar API, fields ``m.mem_offset`` and ``length`` in the ``m.planes`` array elements will be used instead and the ``length`` field of struct -:ref:`v4l2_buffer ` is set to the number of filled-in +:c:type:`v4l2_buffer` is set to the number of filled-in array elements. The driver may or may not set the remaining fields and flags, they are meaningless in this context. -The :ref:`struct v4l2_buffer ` structure is specified in +The :c:type:`struct v4l2_buffer ` structure is specified in :ref:`buffer`. diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index 97a394bbcc9c..2824ead350b9 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -34,14 +34,14 @@ Description All V4L2 devices support the ``VIDIOC_QUERYCAP`` ioctl. It is used to identify kernel devices compatible with this specification and to obtain information about driver and hardware capabilities. The ioctl takes a -pointer to a struct :ref:`v4l2_capability ` which is +pointer to a struct :c:type:`v4l2_capability` which is filled by the driver. When the driver is not compatible with this specification the ioctl returns an ``EINVAL`` error code. .. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}| -.. _v4l2-capability: +.. c:type:: v4l2_capability .. flat-table:: struct v4l2_capability :header-rows: 0 @@ -373,7 +373,7 @@ specification the ioctl returns an ``EINVAL`` error code. - 0x00200000 - The device supports the struct - :ref:`v4l2_pix_format ` extended fields. + :c:type:`v4l2_pix_format` extended fields. - .. row 22 @@ -435,6 +435,6 @@ appropriately. The generic error codes are described at the :ref:`Generic Error Codes ` chapter. .. [#f1] - The struct :ref:`v4l2_framebuffer ` lacks an + The struct :c:type:`v4l2_framebuffer` lacks an enum :ref:`v4l2_buf_type ` field, therefore the type of overlay is implied by the driver capabilities. diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index db3ad928ec1c..ef32e28e57c7 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -592,7 +592,7 @@ See also the examples in :ref:`control`. pass a string of length 8 to :ref:`VIDIOC_S_EXT_CTRLS ` you need to set the ``size`` field of struct - :ref:`v4l2_ext_control ` to 9. For + :c:type:`v4l2_ext_control` to 9. For :ref:`VIDIOC_G_EXT_CTRLS ` you can set the ``size`` field to ``maximum`` + 1. Which character encoding is used will depend on the string control itself and should be part @@ -769,7 +769,7 @@ See also the examples in :ref:`control`. - This control has a pointer type, so its value has to be accessed using one of the pointer fields of struct - :ref:`v4l2_ext_control `. This flag is set + :c:type:`v4l2_ext_control`. This flag is set for controls that are an array, string, or have a compound type. In all cases you have to set a pointer to memory containing the payload of the control. diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst index 39c9bf8af47a..195f0a3d783c 100644 --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst @@ -43,7 +43,7 @@ configures the driver into DMABUF I/O mode without performing any direct allocation. To allocate device buffers applications initialize all fields of the -:ref:`struct v4l2_requestbuffers ` structure. They set the ``type`` +:c:type:`struct v4l2_requestbuffers ` structure. They set the ``type`` field to the respective stream or buffer type, the ``count`` field to the desired number of buffers, ``memory`` must be set to the requested I/O method and the ``reserved`` array must be zeroed. When the ioctl is @@ -65,7 +65,7 @@ any DMA in progress, an implicit :ref:`VIDIOC_STREAMOFF `. -.. _v4l2-requestbuffers: +.. c:type:: v4l2_requestbuffers .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -90,7 +90,7 @@ any DMA in progress, an implicit - ``type`` - Type of the stream or buffers, this is the same as the struct - :ref:`v4l2_format ` ``type`` field. See + :c:type:`v4l2_format` ``type`` field. See :ref:`v4l2-buf-type` for valid values. - .. row 3 diff --git a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst index efbe3a1f1134..e33969b9d3da 100644 --- a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst +++ b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst @@ -35,12 +35,12 @@ Start a hardware frequency seek from the current frequency. To do this applications initialize the ``tuner``, ``type``, ``seek_upward``, ``wrap_around``, ``spacing``, ``rangelow`` and ``rangehigh`` fields, and zero out the ``reserved`` array of a struct -:ref:`v4l2_hw_freq_seek ` and call the +:c:type:`v4l2_hw_freq_seek` and call the ``VIDIOC_S_HW_FREQ_SEEK`` ioctl with a pointer to this structure. The ``rangelow`` and ``rangehigh`` fields can be set to a non-zero value to tell the driver to search a specific band. If the struct -:ref:`v4l2_tuner ` ``capability`` field has the +:c:type:`v4l2_tuner` ``capability`` field has the ``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag set, these values must fall within one of the bands returned by :ref:`VIDIOC_ENUM_FREQ_BANDS`. If the @@ -61,7 +61,7 @@ error code is returned and no seek takes place. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-hw-freq-seek: +.. c:type:: v4l2_hw_freq_seek .. flat-table:: struct v4l2_hw_freq_seek :header-rows: 0 @@ -76,8 +76,8 @@ error code is returned and no seek takes place. - ``tuner`` - The tuner index number. This is the same value as in the struct - :ref:`v4l2_input ` ``tuner`` field and the struct - :ref:`v4l2_tuner ` ``index`` field. + :c:type:`v4l2_input` ``tuner`` field and the struct + :c:type:`v4l2_tuner` ``index`` field. - .. row 2 @@ -86,7 +86,7 @@ error code is returned and no seek takes place. - ``type`` - The tuner type. This is the same value as in the struct - :ref:`v4l2_tuner ` ``type`` field. See + :c:type:`v4l2_tuner` ``type`` field. See :ref:`v4l2-tuner-type` - .. row 3 @@ -105,7 +105,7 @@ error code is returned and no seek takes place. - ``wrap_around`` - If non-zero, wrap around when at the end of the frequency range, - else stop seeking. The struct :ref:`v4l2_tuner ` + else stop seeking. The struct :c:type:`v4l2_tuner` ``capability`` field will tell you what the hardware supports. - .. row 5 @@ -126,9 +126,9 @@ error code is returned and no seek takes place. - If non-zero, the lowest tunable frequency of the band to search in units of 62.5 kHz, or if the struct - :ref:`v4l2_tuner ` ``capability`` field has the + :c:type:`v4l2_tuner` ``capability`` field has the ``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the - struct :ref:`v4l2_tuner ` ``capability`` field has + struct :c:type:`v4l2_tuner` ``capability`` field has the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If ``rangelow`` is zero a reasonable default value is used. @@ -140,9 +140,9 @@ error code is returned and no seek takes place. - If non-zero, the highest tunable frequency of the band to search in units of 62.5 kHz, or if the struct - :ref:`v4l2_tuner ` ``capability`` field has the + :c:type:`v4l2_tuner` ``capability`` field has the ``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the - struct :ref:`v4l2_tuner ` ``capability`` field has + struct :c:type:`v4l2_tuner` ``capability`` field has the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If ``rangehigh`` is zero a reasonable default value is used. diff --git a/Documentation/media/uapi/v4l/vidioc-streamon.rst b/Documentation/media/uapi/v4l/vidioc-streamon.rst index 25dfaa44af3b..972d5b3c74aa 100644 --- a/Documentation/media/uapi/v4l/vidioc-streamon.rst +++ b/Documentation/media/uapi/v4l/vidioc-streamon.rst @@ -69,7 +69,7 @@ accordingly. Both ioctls take a pointer to an integer, the desired buffer or stream type. This is the same as struct -:ref:`v4l2_requestbuffers ` ``type``. +:c:type:`v4l2_requestbuffers` ``type``. If ``VIDIOC_STREAMON`` is called when streaming is already in progress, or if ``VIDIOC_STREAMOFF`` is called when streaming is already stopped, diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst index 3df2099ceeb9..db7145016571 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst @@ -113,7 +113,7 @@ multiple pads of the same sub-device is not defined. - .. row 6 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``interval`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst index b0fb5203e65f..80517ec8a847 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst @@ -100,7 +100,7 @@ modified format should be as close as possible to the original request. - .. row 3 - - struct :ref:`v4l2_rect ` + - struct :c:type:`v4l2_rect` - ``rect`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst index f8405bf344fa..7580174a6ed1 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst @@ -87,7 +87,7 @@ the same sub-device is not defined. - .. row 2 - - struct :ref:`v4l2_fract ` + - struct :c:type:`v4l2_fract` - ``interval`` diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst index 697fc40434cc..d581ff6cf458 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst @@ -110,7 +110,7 @@ Selection targets and flags are documented in - .. row 5 - - struct :ref:`v4l2_rect ` + - struct :c:type:`v4l2_rect` - ``r`` diff --git a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst index 04eee095952b..0202a78cbeb0 100644 --- a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst +++ b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst @@ -41,7 +41,7 @@ using the :ref:`VIDIOC_DQEVENT` ioctl. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-event-subscription: +.. c:type:: v4l2_event_subscription .. flat-table:: struct v4l2_event_subscription :header-rows: 0 From 6e862f3cbbe96f8d147a37511c08e5def4f654f9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 18:22:52 -0300 Subject: [PATCH 314/591] [media] diff-v4l.rst: Fix V4L version 1 references The V4L version 1 structures had long gone from the Linux Kernel. It doesn't make sense to use cross-references for them, as they won't be found. So, get rid of them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/diff-v4l.rst | 38 +++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Documentation/media/uapi/v4l/diff-v4l.rst b/Documentation/media/uapi/v4l/diff-v4l.rst index 93794e015e7c..0419e2051759 100644 --- a/Documentation/media/uapi/v4l/diff-v4l.rst +++ b/Documentation/media/uapi/v4l/diff-v4l.rst @@ -87,7 +87,7 @@ Querying Capabilities The V4L ``VIDIOCGCAP`` ioctl is equivalent to V4L2's :ref:`VIDIOC_QUERYCAP`. -The ``name`` field in struct :c:type:`struct video_capability` became +The ``name`` field in struct ``video_capability`` became ``card`` in struct :c:type:`v4l2_capability`, ``type`` was replaced by ``capabilities``. Note V4L2 does not distinguish between device types like this, better think of basic video input, video output @@ -264,7 +264,7 @@ Video Sources ============= V4L provides the ``VIDIOCGCHAN`` and ``VIDIOCSCHAN`` ioctl using struct -:c:type:`struct video_channel` to enumerate the video inputs of a V4L +``video_channel`` to enumerate the video inputs of a V4L device. The equivalent V4L2 ioctls are :ref:`VIDIOC_ENUMINPUT`, :ref:`VIDIOC_G_INPUT ` and @@ -283,7 +283,7 @@ video input types were renamed as follows: - .. row 1 - - struct :c:type:`struct video_channel` ``type`` + - struct ``video_channel`` ``type`` - struct :c:type:`v4l2_input` ``type`` @@ -328,7 +328,7 @@ Tuning ====== The V4L ``VIDIOCGTUNER`` and ``VIDIOCSTUNER`` ioctl and struct -:c:type:`struct video_tuner` can be used to enumerate the tuners of a +``video_tuner`` can be used to enumerate the tuners of a V4L TV or radio device. The equivalent V4L2 ioctls are :ref:`VIDIOC_G_TUNER ` and :ref:`VIDIOC_S_TUNER ` using struct @@ -374,7 +374,7 @@ Image Properties ================ V4L2 has no equivalent of the ``VIDIOCGPICT`` and ``VIDIOCSPICT`` ioctl -and struct :c:type:`struct video_picture`. The following fields where +and struct ``video_picture``. The following fields where replaced by V4L2 controls accessible with the :ref:`VIDIOC_QUERYCTRL`, :ref:`VIDIOC_G_CTRL ` and @@ -389,7 +389,7 @@ replaced by V4L2 controls accessible with the - .. row 1 - - struct :c:type:`struct video_picture` + - struct ``video_picture`` - V4L2 Control ID @@ -445,7 +445,7 @@ into the struct :c:type:`v4l2_pix_format`: - .. row 1 - - struct :c:type:`struct video_picture` ``palette`` + - struct ``video_picture`` ``palette`` - struct :c:type:`v4l2_pix_format` ``pixfmt`` @@ -554,7 +554,7 @@ Audio ===== The ``VIDIOCGAUDIO`` and ``VIDIOCSAUDIO`` ioctl and struct -:c:type:`struct video_audio` are used to enumerate the audio inputs +``video_audio`` are used to enumerate the audio inputs of a V4L device. The equivalent V4L2 ioctls are :ref:`VIDIOC_G_AUDIO ` and :ref:`VIDIOC_S_AUDIO ` using struct @@ -591,7 +591,7 @@ The following fields where replaced by V4L2 controls accessible with the - .. row 1 - - struct :c:type:`struct video_audio` + - struct ``video_audio`` - V4L2 Control ID @@ -629,7 +629,7 @@ and ``VIDEO_AUDIO_MUTE`` flags where replaced by the boolean ``V4L2_CID_AUDIO_MUTE`` control. All V4L2 controls have a ``step`` attribute replacing the struct -:c:type:`struct video_audio` ``step`` field. The V4L audio controls +``video_audio`` ``step`` field. The V4L audio controls are assumed to range from 0 to 65535 with no particular reset value. The V4L2 API permits arbitrary limits and defaults which can be queried with the :ref:`VIDIOC_QUERYCTRL` ioctl. For general @@ -642,7 +642,7 @@ Frame Buffer Overlay The V4L2 ioctls equivalent to ``VIDIOCGFBUF`` and ``VIDIOCSFBUF`` are :ref:`VIDIOC_G_FBUF ` and :ref:`VIDIOC_S_FBUF `. The ``base`` field of struct -:c:type:`struct video_buffer` remained unchanged, except V4L2 defines +``video_buffer`` remained unchanged, except V4L2 defines a flag to indicate non-destructive overlays instead of a ``NULL`` pointer. All other fields moved into the struct :c:type:`v4l2_pix_format` ``fmt`` substructure of @@ -659,13 +659,13 @@ of the ``fmt`` union is used, a struct :c:type:`v4l2_window`. The ``x``, ``y``, ``width`` and ``height`` fields of struct -:c:type:`struct video_window` moved into struct +``video_window`` moved into struct :c:type:`v4l2_rect` substructure ``w`` of struct -:c:type:`struct v4l2_window`. The ``chromakey``, ``clips``, and +:c:type:`v4l2_window`. The ``chromakey``, ``clips``, and ``clipcount`` fields remained unchanged. Struct -:c:type:`struct video_clip` was renamed to struct +``video_clip`` was renamed to struct :c:type:`v4l2_clip`, also containing a struct -:c:type:`struct v4l2_rect`, but the semantics are still the same. +:c:type:`v4l2_rect`, but the semantics are still the same. The ``VIDEO_WINDOW_INTERLACE`` flag was dropped. Instead applications must set the ``field`` field to ``V4L2_FIELD_ANY`` or @@ -675,7 +675,7 @@ name ``V4L2_FBUF_FLAG_CHROMAKEY``. In V4L, storing a bitmap pointer in ``clips`` and setting ``clipcount`` to ``VIDEO_CLIP_BITMAP`` (-1) requests bitmap clipping, using a fixed -size bitmap of 1024 × 625 bits. Struct :c:type:`struct v4l2_window` +size bitmap of 1024 × 625 bits. Struct :c:type:`v4l2_window` has a separate ``bitmap`` pointer field for this purpose and the bitmap size is determined by ``w.width`` and ``w.height``. @@ -688,7 +688,7 @@ Cropping To capture only a subsection of the full picture V4L defines the ``VIDIOCGCAPTURE`` and ``VIDIOCSCAPTURE`` ioctls using struct -:c:type:`struct video_capture`. The equivalent V4L2 ioctls are +``video_capture``. The equivalent V4L2 ioctls are :ref:`VIDIOC_G_CROP ` and :ref:`VIDIOC_S_CROP ` using struct :c:type:`v4l2_crop`, and the related @@ -697,7 +697,7 @@ complex matter, see :ref:`crop` for details. The ``x``, ``y``, ``width`` and ``height`` fields moved into struct :c:type:`v4l2_rect` substructure ``c`` of struct -:c:type:`struct v4l2_crop`. The ``decimation`` field was dropped. In +:c:type:`v4l2_crop`. The ``decimation`` field was dropped. In the V4L2 API the scaling factor is implied by the size of the cropping rectangle and the size of the captured or overlaid image. @@ -889,7 +889,7 @@ with the following parameters: Undocumented in the V4L specification, in Linux 2.3 the ``VIDIOCGVBIFMT`` and ``VIDIOCSVBIFMT`` ioctls using struct -:c:type:`struct vbi_format` were added to determine the VBI image +``vbi_format`` were added to determine the VBI image parameters. These ioctls are only partially compatible with the V4L2 VBI interface specified in :ref:`raw-vbi`. From fb91161a32bfe907720aff92318660ca8f6b9e71 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 18:43:02 -0300 Subject: [PATCH 315/591] [media] v4l2-ctrls.h: fix doc reference for prepare_ext_ctrls() The prepare_ext_ctrls() function is actually internal to the v4l2-ctrls.c implementation, so it doesn't have a declaration for the kAPI header to reference it. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-ctrls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index b8e043f63825..3207449327d7 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -239,7 +239,7 @@ struct v4l2_ctrl { * @next: Single-link list node for the hash. * @ctrl: The actual control information. * @helper: Pointer to helper struct. Used internally in - * prepare_ext_ctrls(). + * ``prepare_ext_ctrls`` function at ``v4l2-ctrl.c``. * * Each control handler has a list of these refs. The list_head is used to * keep a sorted-by-control-ID list of all controls, while the next pointer From ffa0441edca1ae462bdafe2743a4cde16f407f3a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 18:40:21 -0300 Subject: [PATCH 316/591] [media] docs-rst: use C domain for enum references on uapi Change the parse-headers.pl and the corresponding files to use the C domain for enum references. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/hist-v4l2.rst | 2 +- Documentation/media/uapi/v4l/subdev-formats.rst | 2 +- Documentation/media/uapi/v4l/v4l2.rst | 2 +- Documentation/media/uapi/v4l/vidioc-dqevent.rst | 2 +- Documentation/media/uapi/v4l/vidioc-g-priority.rst | 2 +- Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 14 +++++++------- .../media/uapi/v4l/vidioc-subdev-g-fmt.rst | 10 +++++----- include/media/v4l2-dev.h | 12 ++++++------ 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Documentation/media/uapi/v4l/hist-v4l2.rst b/Documentation/media/uapi/v4l/hist-v4l2.rst index a84895968349..bd45431ed00e 100644 --- a/Documentation/media/uapi/v4l/hist-v4l2.rst +++ b/Documentation/media/uapi/v4l/hist-v4l2.rst @@ -1361,7 +1361,7 @@ V4L2 in Linux 3.19 :ref:`v4l2_quantization ` fields to struct :c:type:`v4l2_pix_format`, struct :c:type:`v4l2_pix_format_mplane` and - struct :ref:`v4l2_mbus_framefmt `. + struct :c:type:`v4l2_mbus_framefmt`. V4L2 in Linux 4.4 diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 52013b55ea80..f0d7754f1906 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -7,7 +7,7 @@ Media Bus Formats .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-mbus-framefmt: +.. c:type:: v4l2_mbus_framefmt .. flat-table:: struct v4l2_mbus_framefmt :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/v4l2.rst b/Documentation/media/uapi/v4l/v4l2.rst index 785d4cdd2f85..e020c57f98d4 100644 --- a/Documentation/media/uapi/v4l/v4l2.rst +++ b/Documentation/media/uapi/v4l/v4l2.rst @@ -116,7 +116,7 @@ Rewrote Colorspace chapter, added new enum :ref:`v4l2_quantization ` fields to struct :c:type:`v4l2_pix_format`, struct :c:type:`v4l2_pix_format_mplane` and struct -:ref:`v4l2_mbus_framefmt `. +:c:type:`v4l2_mbus_framefmt`. :revision: 3.17 / 2014-08-04 (*lp, hv*) diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index cf0e98f5112f..3038f349049c 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -356,7 +356,7 @@ call. - - The type of the control. See enum - :ref:`v4l2_ctrl_type `. + :c:type:`v4l2_ctrl_type`. - .. row 3 diff --git a/Documentation/media/uapi/v4l/vidioc-g-priority.rst b/Documentation/media/uapi/v4l/vidioc-g-priority.rst index d6a07c076837..cbd2a3cbb18e 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-priority.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-priority.rst @@ -44,7 +44,7 @@ an enum v4l2_priority variable and call :ref:`VIDIOC_S_PRIORITY ` how + control. See enum :c:type:`v4l2_ctrl_type` how the minimum value is to be used for each possible control type. Note that this a signed 32-bit value. @@ -153,7 +153,7 @@ See also the examples in :ref:`control`. - ``maximum`` - Maximum value, inclusive. This field gives an upper bound for the - control. See enum :ref:`v4l2_ctrl_type ` how + control. See enum :c:type:`v4l2_ctrl_type` how the maximum value is to be used for each possible control type. Note that this a signed 32-bit value. @@ -164,7 +164,7 @@ See also the examples in :ref:`control`. - ``step`` - This field gives a step size for the control. See enum - :ref:`v4l2_ctrl_type ` how the step value is + :c:type:`v4l2_ctrl_type` how the step value is to be used for each possible control type. Note that this an unsigned 32-bit value. @@ -269,7 +269,7 @@ See also the examples in :ref:`control`. - ``minimum`` - Minimum value, inclusive. This field gives a lower bound for the - control. See enum :ref:`v4l2_ctrl_type ` how + control. See enum :c:type:`v4l2_ctrl_type` how the minimum value is to be used for each possible control type. Note that this a signed 64-bit value. @@ -280,7 +280,7 @@ See also the examples in :ref:`control`. - ``maximum`` - Maximum value, inclusive. This field gives an upper bound for the - control. See enum :ref:`v4l2_ctrl_type ` how + control. See enum :c:type:`v4l2_ctrl_type` how the maximum value is to be used for each possible control type. Note that this a signed 64-bit value. @@ -291,7 +291,7 @@ See also the examples in :ref:`control`. - ``step`` - This field gives a step size for the control. See enum - :ref:`v4l2_ctrl_type ` how the step value is + :c:type:`v4l2_ctrl_type` how the step value is to be used for each possible control type. Note that this an unsigned 64-bit value. @@ -456,7 +456,7 @@ See also the examples in :ref:`control`. .. tabularcolumns:: |p{5.8cm}|p{1.4cm}|p{1.0cm}|p{1.4cm}|p{6.9cm}| -.. _v4l2-ctrl-type: +.. c:type:: v4l2_ctrl_type .. cssclass:: longtable diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst index 2df1342ac6ea..90d876faa5b9 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst @@ -38,7 +38,7 @@ These ioctls are used to negotiate the frame format at specific subdev pads in the image pipeline. To retrieve the current format applications set the ``pad`` field of a -struct :ref:`v4l2_subdev_format ` to the desired +struct :c:type:`v4l2_subdev_format` to the desired pad number as reported by the media API and the ``which`` field to ``V4L2_SUBDEV_FORMAT_ACTIVE``. When they call the ``VIDIOC_SUBDEV_G_FMT`` ioctl with a pointer to this structure the @@ -49,7 +49,7 @@ To change the current format applications set both the ``pad`` and the ``VIDIOC_SUBDEV_S_FMT`` ioctl with a pointer to this structure the driver verifies the requested format, adjusts it based on the hardware capabilities and configures the device. Upon return the struct -:ref:`v4l2_subdev_format ` contains the current +:c:type:`v4l2_subdev_format` contains the current format as would be returned by a ``VIDIOC_SUBDEV_G_FMT`` call. Applications can query the device capabilities by setting the ``which`` @@ -78,7 +78,7 @@ should be as close as possible to the original request. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| -.. _v4l2-subdev-format: +.. c:type:: v4l2_subdev_format .. flat-table:: struct v4l2_subdev_format :header-rows: 0 @@ -105,7 +105,7 @@ should be as close as possible to the original request. - .. row 3 - - struct :ref:`v4l2_mbus_framefmt ` + - struct :c:type:`v4l2_mbus_framefmt` - ``format`` @@ -164,7 +164,7 @@ EBUSY fix the problem first. Only returned by ``VIDIOC_SUBDEV_S_FMT`` EINVAL - The struct :ref:`v4l2_subdev_format ` + The struct :c:type:`v4l2_subdev_format` ``pad`` references a non-existing pad, or the ``which`` field references a non-existing format. diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 5272aeec0cec..477e90d89a04 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -56,7 +56,7 @@ struct v4l2_ctrl_handler; * * .. note:: * The size of @prios array matches the number of priority types defined - * by :ref:`enum v4l2_priority `. + * by enum &v4l2_priority. */ struct v4l2_prio_state { atomic_t prios[4]; @@ -73,8 +73,8 @@ void v4l2_prio_init(struct v4l2_prio_state *global); * v4l2_prio_change - changes the v4l2 file handler priority * * @global: pointer to the &struct v4l2_prio_state of the device node. - * @local: pointer to the desired priority, as defined by :ref:`enum v4l2_priority ` - * @new: Priority type requested, as defined by :ref:`enum v4l2_priority `. + * @local: pointer to the desired priority, as defined by enum &v4l2_priority + * @new: Priority type requested, as defined by enum &v4l2_priority. * * .. note:: * This function should be used only by the V4L2 core. @@ -86,7 +86,7 @@ int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, * v4l2_prio_open - Implements the priority logic for a file handler open * * @global: pointer to the &struct v4l2_prio_state of the device node. - * @local: pointer to the desired priority, as defined by :ref:`enum v4l2_priority ` + * @local: pointer to the desired priority, as defined by enum &v4l2_priority * * .. note:: * This function should be used only by the V4L2 core. @@ -97,7 +97,7 @@ void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); * v4l2_prio_close - Implements the priority logic for a file handler close * * @global: pointer to the &struct v4l2_prio_state of the device node. - * @local: priority to be released, as defined by :ref:`enum v4l2_priority ` + * @local: priority to be released, as defined by enum &v4l2_priority * * .. note:: * This function should be used only by the V4L2 core. @@ -118,7 +118,7 @@ enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); * v4l2_prio_close - Implements the priority logic for a file handler close * * @global: pointer to the &struct v4l2_prio_state of the device node. - * @local: desired priority, as defined by :ref:`enum v4l2_priority ` local + * @local: desired priority, as defined by enum &v4l2_priority local * * .. note:: * This function should be used only by the V4L2 core. From f8441a4334107ccd69c07164a38d9dde451cd85d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 19:29:58 -0300 Subject: [PATCH 317/591] [media] v4l2-ctrls.h: Fix some c:type references Now that the uAPI is using c:type, let's use it here too. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-ctrls.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 3207449327d7..beea0a2c0894 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -973,9 +973,9 @@ extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; * v4l2_ctrl_replace - Function to be used as a callback to * &struct v4l2_subscribed_event_ops replace\(\) * - * @old: pointer to :ref:`struct v4l2_event ` with the reported + * @old: pointer to struct &v4l2_event with the reported * event; - * @new: pointer to :ref:`struct v4l2_event ` with the modified + * @new: pointer to struct &v4l2_event with the modified * event; */ void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); @@ -984,9 +984,9 @@ void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); * v4l2_ctrl_merge - Function to be used as a callback to * &struct v4l2_subscribed_event_ops merge(\) * - * @old: pointer to :ref:`struct v4l2_event ` with the reported + * @old: pointer to struct &v4l2_event with the reported * event; - * @new: pointer to :ref:`struct v4l2_event ` with the merged + * @new: pointer to struct &v4l2_event with the merged * event; */ void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new); From 94d71e58074210a192d785df2744ce4abcbe519c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 29 Aug 2016 19:45:57 -0300 Subject: [PATCH 318/591] [media] cec-ioc-dqevent.rst: fix some undefined references Documentation/output/cec.h.rst:6: WARNING: c:type reference target not found: cec_event_state_change Documentation/output/cec.h.rst:6: WARNING: c:type reference target not found: cec_event_state_change Documentation/output/cec.h.rst:6: WARNING: c:type reference target not found: cec_event_lost_msgs Documentation/output/cec.h.rst:6: WARNING: c:type reference target not found: cec_event_lost_msgs Documentation/output/cec.h.rst:6: WARNING: c:type reference target not found: cec_event_state_change Documentation/output/cec.h.rst:6: WARNING: c:type reference target not found: cec_event_lost_msgs Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/cec/cec-ioc-dqevent.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index 10228eb0fd4a..06b79361254c 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -51,7 +51,7 @@ it is guaranteed that the state did change in between the two events. .. tabularcolumns:: |p{1.2cm}|p{2.9cm}|p{13.4cm}| -.. _cec-event-state-change_s: +.. c:type:: cec_event_state_change .. flat-table:: struct cec_event_state_change :header-rows: 0 @@ -78,7 +78,7 @@ it is guaranteed that the state did change in between the two events. .. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.5cm}| -.. _cec-event-lost-msgs_s: +.. c:type:: cec_event_lost_msgs .. flat-table:: struct cec_event_lost_msgs :header-rows: 0 From bba65c132fe4e57682861ff826e259efd7845492 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 12:18:09 -0300 Subject: [PATCH 319/591] [media] v4l2-ioctl.h: document the remaining functions There are several undocumented functions here; document them. While here, make checkpatch.pl happy. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/conf_nitpick.py | 1 + include/media/v4l2-ioctl.h | 504 +++++++++++++++++----------- 2 files changed, 302 insertions(+), 203 deletions(-) diff --git a/Documentation/media/conf_nitpick.py b/Documentation/media/conf_nitpick.py index 1c7928abace5..1f3ef3ded2d4 100644 --- a/Documentation/media/conf_nitpick.py +++ b/Documentation/media/conf_nitpick.py @@ -96,5 +96,6 @@ nitpick_ignore = [ ("c:type", "__user"), ("c:type", "usb_device"), ("c:type", "usb_interface"), + ("c:type", "v4l2_std_id"), ("c:type", "video_system_t"), ] diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 8b1d19bc9b0e..574ff2ae94be 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -287,273 +287,286 @@ struct v4l2_ioctl_ops { /* ioctl callbacks */ /* VIDIOC_QUERYCAP handler */ - int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap); + int (*vidioc_querycap)(struct file *file, void *fh, + struct v4l2_capability *cap); /* VIDIOC_ENUM_FMT handlers */ - int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh, - struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh, - struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh, - struct v4l2_fmtdesc *f); + int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh, + struct v4l2_fmtdesc *f); + int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh, + struct v4l2_fmtdesc *f); + int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh, + struct v4l2_fmtdesc *f); int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_fmtdesc *f); int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_sdr_cap) (struct file *file, void *fh, - struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_sdr_out) (struct file *file, void *fh, - struct v4l2_fmtdesc *f); + int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh, + struct v4l2_fmtdesc *f); + int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh, + struct v4l2_fmtdesc *f); /* VIDIOC_G_FMT handlers */ - int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f); - int (*vidioc_g_fmt_vid_out) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_g_fmt_vbi_cap) (struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_g_fmt_vbi_out) (struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); + int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh, + struct v4l2_format *f); + int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f); int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f); - int (*vidioc_g_fmt_sdr_cap) (struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_g_fmt_sdr_out) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh, + struct v4l2_format *f); + int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh, + struct v4l2_format *f); /* VIDIOC_S_FMT handlers */ - int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f); - int (*vidioc_s_fmt_vid_out) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_s_fmt_vbi_cap) (struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_s_fmt_vbi_out) (struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); + int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh, + struct v4l2_format *f); + int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f); int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f); - int (*vidioc_s_fmt_sdr_cap) (struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_s_fmt_sdr_out) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh, + struct v4l2_format *f); + int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh, + struct v4l2_format *f); /* VIDIOC_TRY_FMT handlers */ - int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh, struct v4l2_format *f); - int (*vidioc_try_fmt_vid_out) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_try_fmt_vbi_cap) (struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_try_fmt_vbi_out) (struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); + int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh, + struct v4l2_format *f); + int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh, + struct v4l2_format *f); int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, - struct v4l2_format *f); + struct v4l2_format *f); int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh, struct v4l2_format *f); int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, struct v4l2_format *f); - int (*vidioc_try_fmt_sdr_cap) (struct file *file, void *fh, - struct v4l2_format *f); - int (*vidioc_try_fmt_sdr_out) (struct file *file, void *fh, - struct v4l2_format *f); + int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh, + struct v4l2_format *f); + int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh, + struct v4l2_format *f); /* Buffer handlers */ - int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); - int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b); - int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b); - int (*vidioc_expbuf) (struct file *file, void *fh, - struct v4l2_exportbuffer *e); - int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); + int (*vidioc_reqbufs)(struct file *file, void *fh, + struct v4l2_requestbuffers *b); + int (*vidioc_querybuf)(struct file *file, void *fh, + struct v4l2_buffer *b); + int (*vidioc_qbuf)(struct file *file, void *fh, + struct v4l2_buffer *b); + int (*vidioc_expbuf)(struct file *file, void *fh, + struct v4l2_exportbuffer *e); + int (*vidioc_dqbuf)(struct file *file, void *fh, + struct v4l2_buffer *b); - int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b); - int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b); + int (*vidioc_create_bufs)(struct file *file, void *fh, + struct v4l2_create_buffers *b); + int (*vidioc_prepare_buf)(struct file *file, void *fh, + struct v4l2_buffer *b); - int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i); - int (*vidioc_g_fbuf) (struct file *file, void *fh, - struct v4l2_framebuffer *a); - int (*vidioc_s_fbuf) (struct file *file, void *fh, - const struct v4l2_framebuffer *a); + int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i); + int (*vidioc_g_fbuf)(struct file *file, void *fh, + struct v4l2_framebuffer *a); + int (*vidioc_s_fbuf)(struct file *file, void *fh, + const struct v4l2_framebuffer *a); /* Stream on/off */ - int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i); - int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i); + int (*vidioc_streamon)(struct file *file, void *fh, + enum v4l2_buf_type i); + int (*vidioc_streamoff)(struct file *file, void *fh, + enum v4l2_buf_type i); - /* Standard handling - ENUMSTD is handled by videodev.c + /* + * Standard handling + * + * Note: ENUMSTD is handled by videodev.c */ - int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm); - int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id norm); - int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a); + int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm); + int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm); + int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a); /* Input handling */ int (*vidioc_enum_input)(struct file *file, void *fh, struct v4l2_input *inp); - int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i); - int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i); + int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i); + int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i); /* Output handling */ - int (*vidioc_enum_output) (struct file *file, void *fh, + int (*vidioc_enum_output)(struct file *file, void *fh, struct v4l2_output *a); - int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i); - int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i); + int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i); + int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i); /* Control handling */ - int (*vidioc_queryctrl) (struct file *file, void *fh, - struct v4l2_queryctrl *a); - int (*vidioc_query_ext_ctrl) (struct file *file, void *fh, - struct v4l2_query_ext_ctrl *a); - int (*vidioc_g_ctrl) (struct file *file, void *fh, - struct v4l2_control *a); - int (*vidioc_s_ctrl) (struct file *file, void *fh, - struct v4l2_control *a); - int (*vidioc_g_ext_ctrls) (struct file *file, void *fh, - struct v4l2_ext_controls *a); - int (*vidioc_s_ext_ctrls) (struct file *file, void *fh, - struct v4l2_ext_controls *a); - int (*vidioc_try_ext_ctrls) (struct file *file, void *fh, - struct v4l2_ext_controls *a); - int (*vidioc_querymenu) (struct file *file, void *fh, - struct v4l2_querymenu *a); + int (*vidioc_queryctrl)(struct file *file, void *fh, + struct v4l2_queryctrl *a); + int (*vidioc_query_ext_ctrl)(struct file *file, void *fh, + struct v4l2_query_ext_ctrl *a); + int (*vidioc_g_ctrl)(struct file *file, void *fh, + struct v4l2_control *a); + int (*vidioc_s_ctrl)(struct file *file, void *fh, + struct v4l2_control *a); + int (*vidioc_g_ext_ctrls)(struct file *file, void *fh, + struct v4l2_ext_controls *a); + int (*vidioc_s_ext_ctrls)(struct file *file, void *fh, + struct v4l2_ext_controls *a); + int (*vidioc_try_ext_ctrls)(struct file *file, void *fh, + struct v4l2_ext_controls *a); + int (*vidioc_querymenu)(struct file *file, void *fh, + struct v4l2_querymenu *a); /* Audio ioctls */ - int (*vidioc_enumaudio) (struct file *file, void *fh, - struct v4l2_audio *a); - int (*vidioc_g_audio) (struct file *file, void *fh, - struct v4l2_audio *a); - int (*vidioc_s_audio) (struct file *file, void *fh, - const struct v4l2_audio *a); + int (*vidioc_enumaudio)(struct file *file, void *fh, + struct v4l2_audio *a); + int (*vidioc_g_audio)(struct file *file, void *fh, + struct v4l2_audio *a); + int (*vidioc_s_audio)(struct file *file, void *fh, + const struct v4l2_audio *a); /* Audio out ioctls */ - int (*vidioc_enumaudout) (struct file *file, void *fh, - struct v4l2_audioout *a); - int (*vidioc_g_audout) (struct file *file, void *fh, - struct v4l2_audioout *a); - int (*vidioc_s_audout) (struct file *file, void *fh, - const struct v4l2_audioout *a); - int (*vidioc_g_modulator) (struct file *file, void *fh, - struct v4l2_modulator *a); - int (*vidioc_s_modulator) (struct file *file, void *fh, - const struct v4l2_modulator *a); + int (*vidioc_enumaudout)(struct file *file, void *fh, + struct v4l2_audioout *a); + int (*vidioc_g_audout)(struct file *file, void *fh, + struct v4l2_audioout *a); + int (*vidioc_s_audout)(struct file *file, void *fh, + const struct v4l2_audioout *a); + int (*vidioc_g_modulator)(struct file *file, void *fh, + struct v4l2_modulator *a); + int (*vidioc_s_modulator)(struct file *file, void *fh, + const struct v4l2_modulator *a); /* Crop ioctls */ - int (*vidioc_cropcap) (struct file *file, void *fh, - struct v4l2_cropcap *a); - int (*vidioc_g_crop) (struct file *file, void *fh, - struct v4l2_crop *a); - int (*vidioc_s_crop) (struct file *file, void *fh, - const struct v4l2_crop *a); - int (*vidioc_g_selection) (struct file *file, void *fh, - struct v4l2_selection *s); - int (*vidioc_s_selection) (struct file *file, void *fh, - struct v4l2_selection *s); + int (*vidioc_cropcap)(struct file *file, void *fh, + struct v4l2_cropcap *a); + int (*vidioc_g_crop)(struct file *file, void *fh, + struct v4l2_crop *a); + int (*vidioc_s_crop)(struct file *file, void *fh, + const struct v4l2_crop *a); + int (*vidioc_g_selection)(struct file *file, void *fh, + struct v4l2_selection *s); + int (*vidioc_s_selection)(struct file *file, void *fh, + struct v4l2_selection *s); /* Compression ioctls */ - int (*vidioc_g_jpegcomp) (struct file *file, void *fh, - struct v4l2_jpegcompression *a); - int (*vidioc_s_jpegcomp) (struct file *file, void *fh, - const struct v4l2_jpegcompression *a); - int (*vidioc_g_enc_index) (struct file *file, void *fh, - struct v4l2_enc_idx *a); - int (*vidioc_encoder_cmd) (struct file *file, void *fh, - struct v4l2_encoder_cmd *a); - int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, - struct v4l2_encoder_cmd *a); - int (*vidioc_decoder_cmd) (struct file *file, void *fh, - struct v4l2_decoder_cmd *a); - int (*vidioc_try_decoder_cmd) (struct file *file, void *fh, - struct v4l2_decoder_cmd *a); + int (*vidioc_g_jpegcomp)(struct file *file, void *fh, + struct v4l2_jpegcompression *a); + int (*vidioc_s_jpegcomp)(struct file *file, void *fh, + const struct v4l2_jpegcompression *a); + int (*vidioc_g_enc_index)(struct file *file, void *fh, + struct v4l2_enc_idx *a); + int (*vidioc_encoder_cmd)(struct file *file, void *fh, + struct v4l2_encoder_cmd *a); + int (*vidioc_try_encoder_cmd)(struct file *file, void *fh, + struct v4l2_encoder_cmd *a); + int (*vidioc_decoder_cmd)(struct file *file, void *fh, + struct v4l2_decoder_cmd *a); + int (*vidioc_try_decoder_cmd)(struct file *file, void *fh, + struct v4l2_decoder_cmd *a); /* Stream type-dependent parameter ioctls */ - int (*vidioc_g_parm) (struct file *file, void *fh, - struct v4l2_streamparm *a); - int (*vidioc_s_parm) (struct file *file, void *fh, - struct v4l2_streamparm *a); + int (*vidioc_g_parm)(struct file *file, void *fh, + struct v4l2_streamparm *a); + int (*vidioc_s_parm)(struct file *file, void *fh, + struct v4l2_streamparm *a); /* Tuner ioctls */ - int (*vidioc_g_tuner) (struct file *file, void *fh, - struct v4l2_tuner *a); - int (*vidioc_s_tuner) (struct file *file, void *fh, - const struct v4l2_tuner *a); - int (*vidioc_g_frequency) (struct file *file, void *fh, - struct v4l2_frequency *a); - int (*vidioc_s_frequency) (struct file *file, void *fh, - const struct v4l2_frequency *a); - int (*vidioc_enum_freq_bands) (struct file *file, void *fh, - struct v4l2_frequency_band *band); + int (*vidioc_g_tuner)(struct file *file, void *fh, + struct v4l2_tuner *a); + int (*vidioc_s_tuner)(struct file *file, void *fh, + const struct v4l2_tuner *a); + int (*vidioc_g_frequency)(struct file *file, void *fh, + struct v4l2_frequency *a); + int (*vidioc_s_frequency)(struct file *file, void *fh, + const struct v4l2_frequency *a); + int (*vidioc_enum_freq_bands)(struct file *file, void *fh, + struct v4l2_frequency_band *band); /* Sliced VBI cap */ - int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh, - struct v4l2_sliced_vbi_cap *a); + int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh, + struct v4l2_sliced_vbi_cap *a); /* Log status ioctl */ - int (*vidioc_log_status) (struct file *file, void *fh); + int (*vidioc_log_status)(struct file *file, void *fh); - int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh, - const struct v4l2_hw_freq_seek *a); + int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh, + const struct v4l2_hw_freq_seek *a); /* Debugging ioctls */ #ifdef CONFIG_VIDEO_ADV_DEBUG - int (*vidioc_g_register) (struct file *file, void *fh, - struct v4l2_dbg_register *reg); - int (*vidioc_s_register) (struct file *file, void *fh, - const struct v4l2_dbg_register *reg); + int (*vidioc_g_register)(struct file *file, void *fh, + struct v4l2_dbg_register *reg); + int (*vidioc_s_register)(struct file *file, void *fh, + const struct v4l2_dbg_register *reg); - int (*vidioc_g_chip_info) (struct file *file, void *fh, - struct v4l2_dbg_chip_info *chip); + int (*vidioc_g_chip_info)(struct file *file, void *fh, + struct v4l2_dbg_chip_info *chip); #endif - int (*vidioc_enum_framesizes) (struct file *file, void *fh, - struct v4l2_frmsizeenum *fsize); + int (*vidioc_enum_framesizes)(struct file *file, void *fh, + struct v4l2_frmsizeenum *fsize); - int (*vidioc_enum_frameintervals) (struct file *file, void *fh, - struct v4l2_frmivalenum *fival); + int (*vidioc_enum_frameintervals)(struct file *file, void *fh, + struct v4l2_frmivalenum *fival); /* DV Timings IOCTLs */ - int (*vidioc_s_dv_timings) (struct file *file, void *fh, - struct v4l2_dv_timings *timings); - int (*vidioc_g_dv_timings) (struct file *file, void *fh, - struct v4l2_dv_timings *timings); - int (*vidioc_query_dv_timings) (struct file *file, void *fh, - struct v4l2_dv_timings *timings); - int (*vidioc_enum_dv_timings) (struct file *file, void *fh, - struct v4l2_enum_dv_timings *timings); - int (*vidioc_dv_timings_cap) (struct file *file, void *fh, - struct v4l2_dv_timings_cap *cap); - int (*vidioc_g_edid) (struct file *file, void *fh, struct v4l2_edid *edid); - int (*vidioc_s_edid) (struct file *file, void *fh, struct v4l2_edid *edid); + int (*vidioc_s_dv_timings)(struct file *file, void *fh, + struct v4l2_dv_timings *timings); + int (*vidioc_g_dv_timings)(struct file *file, void *fh, + struct v4l2_dv_timings *timings); + int (*vidioc_query_dv_timings)(struct file *file, void *fh, + struct v4l2_dv_timings *timings); + int (*vidioc_enum_dv_timings)(struct file *file, void *fh, + struct v4l2_enum_dv_timings *timings); + int (*vidioc_dv_timings_cap)(struct file *file, void *fh, + struct v4l2_dv_timings_cap *cap); + int (*vidioc_g_edid)(struct file *file, void *fh, + struct v4l2_edid *edid); + int (*vidioc_s_edid)(struct file *file, void *fh, + struct v4l2_edid *edid); - int (*vidioc_subscribe_event) (struct v4l2_fh *fh, - const struct v4l2_event_subscription *sub); + int (*vidioc_subscribe_event)(struct v4l2_fh *fh, + const struct v4l2_event_subscription *sub); int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub); /* For other private ioctls */ - long (*vidioc_default) (struct file *file, void *fh, - bool valid_prio, unsigned int cmd, void *arg); + long (*vidioc_default)(struct file *file, void *fh, + bool valid_prio, unsigned int cmd, void *arg); }; @@ -573,38 +586,123 @@ struct v4l2_ioctl_ops { #define V4L2_DEV_DEBUG_POLL 0x10 /* Video standard functions */ -extern const char *v4l2_norm_to_name(v4l2_std_id id); -extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod); -extern int v4l2_video_std_construct(struct v4l2_standard *vs, - int id, const char *name); -/* Prints the ioctl in a human-readable format. If prefix != NULL, - then do printk(KERN_DEBUG "%s: ", prefix) first. */ -extern void v4l_printk_ioctl(const char *prefix, unsigned int cmd); -/* Internal use only: get the mutex (if any) that we need to lock for the - given command. */ +/** + * v4l2_norm_to_name - Ancillary routine to analog TV standard name from its ID. + * + * @id: analog TV standard ID. + * + * Return: returns a string with the name of the analog TV standard. + * If the standard is not found or if @id points to multiple standard, + * it returns "Unknown". + */ +const char *v4l2_norm_to_name(v4l2_std_id id); + +/** + * v4l2_video_std_frame_period - Ancillary routine that fills a + * struct &v4l2_fract pointer with the default framerate fraction. + * + * @id: analog TV sdandard ID. + * @frameperiod: struct &v4l2_fract pointer to be filled + * + */ +void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod); + +/** + * v4l2_video_std_construct - Ancillary routine that fills in the fields of + * a &v4l2_standard structure according to the @id parameter. + * + * @vs: struct &v4l2_standard pointer to be filled + * @id: analog TV sdandard ID. + * @name: name of the standard to be used + * + * .. note:: + * + * This ancillary routine is obsolete. Shouldn't be used on newer drivers. + */ +int v4l2_video_std_construct(struct v4l2_standard *vs, + int id, const char *name); + +/** + * v4l_printk_ioctl - Ancillary routine that prints the ioctl in a + * human-readable format. + * + * @prefix: prefix to be added at the ioctl prints. + * @cmd: ioctl name + * + * .. note:: + * + * If prefix != %NULL, then it will issue a + * ``printk(KERN_DEBUG "%s: ", prefix)`` first. + */ +void v4l_printk_ioctl(const char *prefix, unsigned int cmd); + struct video_device; -extern struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned cmd); + + +/** + * v4l2_ioctl_get_lock - get the mutex (if any) that it is need to lock for + * a given command. + * + * @vdev: Pointer to struct &video_device. + * @cmd: Ioctl name. + * + * .. note:: Internal use only. Should not be used outside V4L2 core. + */ +struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned int cmd); /* names for fancy debug output */ extern const char *v4l2_field_names[]; extern const char *v4l2_type_names[]; #ifdef CONFIG_COMPAT -/* 32 Bits compatibility layer for 64 bits processors */ -extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, - unsigned long arg); +/** + * v4l2_compat_ioctl32 -32 Bits compatibility layer for 64 bits processors + * + * @file: Pointer to struct &file. + * @cmd: Ioctl name. + * @arg: Ioctl argument. + */ +long int v4l2_compat_ioctl32(struct file *file, unsigned int cmd, + unsigned long arg); #endif -typedef long (*v4l2_kioctl)(struct file *file, - unsigned int cmd, void *arg); +/** + * typedef v4l2_kioctl - Typedef used to pass an ioctl handler. + * + * @file: Pointer to struct &file. + * @cmd: Ioctl name. + * @arg: Ioctl argument. + */ +typedef long (*v4l2_kioctl)(struct file *file, unsigned int cmd, void *arg); -/* Include support for obsoleted stuff */ -extern long video_usercopy(struct file *file, unsigned int cmd, - unsigned long arg, v4l2_kioctl func); +/** + * video_usercopy - copies data from/to userspace memory when an ioctl is + * issued. + * + * @file: Pointer to struct &file. + * @cmd: Ioctl name. + * @arg: Ioctl argument. + * @func: function that will handle the ioctl + * + * .. note:: + * + * This routine should be used only inside the V4L2 core. + */ +long int video_usercopy(struct file *file, unsigned int cmd, + unsigned long int arg, v4l2_kioctl func); -/* Standard handlers for V4L ioctl's */ -extern long video_ioctl2(struct file *file, - unsigned int cmd, unsigned long arg); +/** + * video_ioctl2 - Handles a V4L2 ioctl. + * + * @file: Pointer to struct &file. + * @cmd: Ioctl name. + * @arg: Ioctl argument. + * + * Method used to hancle an ioctl. Should be used to fill the + * &v4l2_ioctl_ops.unlocked_ioctl on all V4L2 drivers. + */ +long int video_ioctl2(struct file *file, + unsigned int cmd, unsigned long int arg); #endif /* _V4L2_IOCTL_H */ From daf3a4f751d3d08ebee539aab991e8d94cd1a01e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 18:55:17 -0300 Subject: [PATCH 320/591] [media] v4l2-dev.rst: fix a broken c domain reference The "struct" were inside the reference, causing it to break. Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/v4l2-dev.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/kapi/v4l2-dev.rst b/Documentation/media/kapi/v4l2-dev.rst index 5782be725334..0a3b4503a89f 100644 --- a/Documentation/media/kapi/v4l2-dev.rst +++ b/Documentation/media/kapi/v4l2-dev.rst @@ -56,7 +56,7 @@ You should also set these fields of :c:type:`video_device`: :c:type:`video_device`->vfl_dir fields are used to disable ops that do not match the type/dir combination. E.g. VBI ops are disabled for non-VBI nodes, and output ops are disabled for a capture device. This makes it possible to - provide just one :c:type:`v4l2_ioctl_ops struct` for both vbi and + provide just one :c:type:`v4l2_ioctl_ops` struct for both vbi and video nodes. - :c:type:`video_device`->lock: leave to ``NULL`` if you want to do all the From 65d7aba0d3c32fc686fe19e146b8cd8a0a87952d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 19:16:25 -0300 Subject: [PATCH 321/591] [media] v4l2-device.h: fix some doc tags Fix some minor issues at the documentation tags on this file, adding cross-references where needed, and fixing some broken ones. While here, fix a few spaces before tabs to make Checkpatch happier. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-device.h | 68 ++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index a9d6aa41790e..8ffa94009d1a 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h @@ -39,7 +39,7 @@ struct v4l2_ctrl_handler; * if this struct is embedded into a larger struct. * @name: unique device name, by default the driver name + bus ID * @notify: notify callback called by some sub-devices. - * @ctrl_handler: The control handler. May be NULL. + * @ctrl_handler: The control handler. May be %NULL. * @prio: Device's priority state * @ref: Keep track of the references to this struct. * @release: Release function that is called when the ref count @@ -53,8 +53,8 @@ struct v4l2_ctrl_handler; * * .. note:: * - * #) dev->driver_data points to this struct. - * #) dev might be NULL if there is no parent device + * #) @dev->driver_data points to this struct. + * #) @dev might be %NULL if there is no parent device */ struct v4l2_device { @@ -76,10 +76,10 @@ struct v4l2_device { /** * v4l2_device_get - gets a V4L2 device reference * - * @v4l2_dev: pointer to struct v4l2_device + * @v4l2_dev: pointer to struct &v4l2_device * * This is an ancillary routine meant to increment the usage for the - * struct v4l2_device pointed by @v4l2_dev. + * struct &v4l2_device pointed by @v4l2_dev. */ static inline void v4l2_device_get(struct v4l2_device *v4l2_dev) { @@ -89,23 +89,23 @@ static inline void v4l2_device_get(struct v4l2_device *v4l2_dev) /** * v4l2_device_put - putss a V4L2 device reference * - * @v4l2_dev: pointer to struct v4l2_device + * @v4l2_dev: pointer to struct &v4l2_device * * This is an ancillary routine meant to decrement the usage for the - * struct v4l2_device pointed by @v4l2_dev. + * struct &v4l2_device pointed by @v4l2_dev. */ int v4l2_device_put(struct v4l2_device *v4l2_dev); /** - * v4l2_device_register -Initialize v4l2_dev and make dev->driver_data - * point to v4l2_dev. + * v4l2_device_register - Initialize v4l2_dev and make @dev->driver_data + * point to @v4l2_dev. * - * @dev: pointer to struct device - * @v4l2_dev: pointer to struct v4l2_device + * @dev: pointer to struct &device + * @v4l2_dev: pointer to struct &v4l2_device * * .. note:: - * dev may be NULL in rare cases (ISA devices). - * In such case the caller must fill in the v4l2_dev->name field + * @dev may be %NULL in rare cases (ISA devices). + * In such case the caller must fill in the @v4l2_dev->name field * before calling this function. */ int __must_check v4l2_device_register(struct device *dev, @@ -113,14 +113,14 @@ int __must_check v4l2_device_register(struct device *dev, /** * v4l2_device_set_name - Optional function to initialize the - * name field of struct v4l2_device + * name field of struct &v4l2_device * - * @v4l2_dev: pointer to struct v4l2_device + * @v4l2_dev: pointer to struct &v4l2_device * @basename: base name for the device name * @instance: pointer to a static atomic_t var with the instance usage for - * the device driver. + * the device driver. * - * v4l2_device_set_name() initializes the name field of struct v4l2_device + * v4l2_device_set_name() initializes the name field of struct &v4l2_device * using the driver name and a driver-global atomic_t instance. * * This function will increment the instance counter and returns the @@ -132,7 +132,7 @@ int __must_check v4l2_device_register(struct device *dev, * * ... * - * instance = v4l2_device_set_name(&v4l2_dev, "foo", &drv_instance); + * instance = v4l2_device_set_name(&\ v4l2_dev, "foo", &\ drv_instance); * * The first time this is called the name field will be set to foo0 and * this function returns 0. If the name ends with a digit (e.g. cx18), @@ -147,16 +147,16 @@ int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename, * @v4l2_dev: pointer to struct v4l2_device * * Should be called when the USB parent disconnects. - * Since the parent disappears, this ensures that v4l2_dev doesn't have + * Since the parent disappears, this ensures that @v4l2_dev doesn't have * an invalid parent pointer. * - * .. note:: This function sets v4l2_dev->dev to NULL. + * .. note:: This function sets @v4l2_dev->dev to NULL. */ void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); /** * v4l2_device_unregister - Unregister all sub-devices and any other - * resources related to v4l2_dev. + * resources related to @v4l2_dev. * * @v4l2_dev: pointer to struct v4l2_device */ @@ -165,8 +165,8 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev); /** * v4l2_device_register_subdev - Registers a subdev with a v4l2 device. * - * @v4l2_dev: pointer to struct v4l2_device - * @sd: pointer to struct v4l2_subdev + * @v4l2_dev: pointer to struct &v4l2_device + * @sd: pointer to struct &v4l2_subdev * * While registered, the subdev module is marked as in-use. * @@ -179,7 +179,7 @@ int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, /** * v4l2_device_unregister_subdev - Unregisters a subdev with a v4l2 device. * - * @sd: pointer to struct v4l2_subdev + * @sd: pointer to struct &v4l2_subdev * * .. note :: * @@ -191,7 +191,7 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); /** * v4l2_device_register_subdev_nodes - Registers device nodes for all subdevs * of the v4l2 device that are marked with - * the V4L2_SUBDEV_FL_HAS_DEVNODE flag. + * the %V4L2_SUBDEV_FL_HAS_DEVNODE flag. * * @v4l2_dev: pointer to struct v4l2_device */ @@ -201,9 +201,9 @@ v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev); /** * v4l2_subdev_notify - Sends a notification to v4l2_device. * - * @sd: pointer to struct v4l2_subdev + * @sd: pointer to struct &v4l2_subdev * @notification: type of notification. Please notice that the notification - * type is driver-specific. + * type is driver-specific. * @arg: arguments for the notification. Those are specific to each * notification type. */ @@ -222,7 +222,7 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, Ignore any errors. Note that you cannot add or delete a subdev while walking the subdevs list. */ #define __v4l2_device_call_subdevs_p(v4l2_dev, sd, cond, o, f, args...) \ - do { \ + do { \ list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) \ if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \ (sd)->ops->o->f((sd) , ##args); \ @@ -241,15 +241,15 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, return with that error code. Note that you cannot add or delete a subdev while walking the subdevs list. */ #define __v4l2_device_call_subdevs_until_err_p(v4l2_dev, sd, cond, o, f, args...) \ -({ \ +({ \ long __err = 0; \ \ list_for_each_entry((sd), &(v4l2_dev)->subdevs, list) { \ if ((cond) && (sd)->ops->o && (sd)->ops->o->f) \ __err = (sd)->ops->o->f((sd) , ##args); \ if (__err && __err != -ENOIOCTLCMD) \ - break; \ - } \ + break; \ + } \ (__err == -ENOIOCTLCMD) ? 0 : __err; \ }) @@ -276,7 +276,7 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, match them all). If the callback returns an error other than 0 or -ENOIOCTLCMD, then return with that error code. Note that you cannot add or delete a subdev while walking the subdevs list. */ -#define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \ +#define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \ ({ \ struct v4l2_subdev *__sd; \ __v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, \ @@ -300,8 +300,8 @@ static inline void v4l2_subdev_notify(struct v4l2_subdev *sd, /* * Call the specified callback for all subdevs where grp_id & grpmsk != 0 - * (if grpmsk == `0, then match them all). If the callback returns an error - * other than 0 or -ENOIOCTLCMD, then return with that error code. Note that + * (if grpmsk == 0, then match them all). If the callback returns an error + * other than 0 or %-ENOIOCTLCMD, then return with that error code. Note that * you cannot add or delete a subdev while walking the subdevs list. */ #define v4l2_device_mask_call_until_err(v4l2_dev, grpmsk, o, f, args...) \ From f06606e56bc61d65cbc1ad3a8dc6e81ec1b2034e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 20:11:11 -0300 Subject: [PATCH 322/591] [media] v4l2-dv-timings.h: let kernel-doc parte the typedef argument Now that scripts/kernel-doc was fixed to parse the typedef argument used here, let it produce documentation. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-dv-timings.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h index 65caadf13eec..0a7d9e1fc8c8 100644 --- a/include/media/v4l2-dv-timings.h +++ b/include/media/v4l2-dv-timings.h @@ -28,8 +28,8 @@ */ extern const struct v4l2_dv_timings v4l2_dv_timings_presets[]; -/* - * v4l2_check_dv_timings_fnc - timings check callback +/** + * typedef v4l2_check_dv_timings_fnc - timings check callback * * @t: the v4l2_dv_timings struct. * @handle: a handle from the driver. From a8e58f29c90e8d7e2f675b0f8668b77143b1349c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 21:01:57 -0300 Subject: [PATCH 323/591] [media] v4l2-subdev.rst: get rid of legacy functions There are two warnings that are due to functions that has long gone: Documentation/media/kapi/v4l2-subdev.rst:417: WARNING: c:func reference target not found: v4l2_i2c_new_subdev_cfg Documentation/media/kapi/v4l2-subdev.rst:436: WARNING: c:func reference target not found: v4l2_i2c_new_probed_subdev Update the documentation to remove those. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/v4l2-subdev.rst | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/Documentation/media/kapi/v4l2-subdev.rst b/Documentation/media/kapi/v4l2-subdev.rst index fcecce01a35c..e1f0b726e438 100644 --- a/Documentation/media/kapi/v4l2-subdev.rst +++ b/Documentation/media/kapi/v4l2-subdev.rst @@ -412,19 +412,7 @@ later date. It differs between i2c drivers and as such can be confusing. To see which chip variants are supported you can look in the i2c driver code for the i2c_device_id table. This lists all the possibilities. -There are two more helper functions: - -:c:func:`v4l2_i2c_new_subdev_cfg`: this function adds new irq and -platform_data arguments and has both 'addr' and 'probed_addrs' arguments: -if addr is not 0 then that will be used (non-probing variant), otherwise the -probed_addrs are probed. - -For example: this will probe for address 0x10: - -.. code-block:: c - - struct v4l2_subdev *sd = v4l2_i2c_new_subdev_cfg(v4l2_dev, adapter, - "module_foo", "chipid", 0, NULL, 0, I2C_ADDRS(0x10)); +There are one more helper function: :c:func:`v4l2_i2c_new_subdev_board` uses an :c:type:`i2c_board_info` struct which is passed to the i2c driver and replaces the irq, platform_data and addr @@ -433,9 +421,10 @@ arguments. If the subdev supports the s_config core ops, then that op is called with the irq and platform_data arguments after the subdev was setup. -The older :c:func:`v4l2_i2c_new_subdev` and -:c:func:`v4l2_i2c_new_probed_subdev` functions will call ``s_config`` as -well, but with irq set to 0 and platform_data set to ``NULL``. +The :c:func:`v4l2_i2c_new_subdev` function will call +:c:func:`v4l2_i2c_new_subdev_board`, internally filling a +:c:type:`i2c_board_info` structure using the ``client_type`` and the +``addr`` to fill it. V4L2 sub-device functions and data structures --------------------------------------------- From 59d44bbe46fe876c55d5cc051d552b1debb1c454 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 21:08:17 -0300 Subject: [PATCH 324/591] [media] v4l2-subdev.h: fix a doc nitpick warning One markup tag is wrong here. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 6e1d044e3ee8..2c1e328ccb1d 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -226,7 +226,7 @@ struct v4l2_subdev_core_ops { * * @g_tuner: callback for %VIDIOC_G_TUNER ioctl handler code. * - * @s_tuner: callback for %VIDIOC_S_TUNER ioctl handler code. &vt->type must be + * @s_tuner: callback for %VIDIOC_S_TUNER ioctl handler code. @vt->type must be * filled in. Normally done by video_ioctl2 or the * bridge driver. * From 836cf1db4e741f12e2d95573b5479fcbdd6fa34e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 30 Aug 2016 10:21:03 -0300 Subject: [PATCH 325/591] [media] docs-rst exceptions: use C domain references for DVB headers Now that we moved away from the :ref: type of references, we need to update the exceptions lists. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/audio.h.rst.exceptions | 6 +- Documentation/media/ca.h.rst.exceptions | 32 +++---- Documentation/media/dmx.h.rst.exceptions | 85 ++++++++++--------- Documentation/media/frontend.h.rst.exceptions | 8 +- Documentation/media/intro.rst | 2 +- Documentation/media/net.h.rst.exceptions | 4 +- .../dvb/audio-bilingual-channel-select.rst | 2 +- .../media/uapi/dvb/audio-channel-select.rst | 2 +- .../media/uapi/dvb/audio-select-source.rst | 2 +- .../media/uapi/dvb/audio-set-attributes.rst | 2 +- .../media/uapi/dvb/audio-set-karaoke.rst | 2 +- .../media/uapi/dvb/audio-set-mixer.rst | 2 +- .../media/uapi/dvb/audio_data_types.rst | 31 +------ Documentation/media/uapi/dvb/dmx_types.rst | 39 +++------ .../media/uapi/dvb/fe-bandwidth-t.rst | 5 +- .../uapi/dvb/fe-diseqc-recv-slave-reply.rst | 3 - .../media/uapi/dvb/fe-diseqc-send-burst.rst | 9 +- .../uapi/dvb/fe-diseqc-send-master-cmd.rst | 4 +- Documentation/media/uapi/dvb/fe-get-info.rst | 11 +-- .../media/uapi/dvb/fe-read-status.rst | 8 +- Documentation/media/uapi/dvb/fe-set-tone.rst | 9 +- .../media/uapi/dvb/fe-set-voltage.rst | 4 +- Documentation/media/uapi/dvb/fe-type-t.rst | 4 +- .../media/uapi/dvb/fe_property_parameters.rst | 69 ++++++--------- Documentation/media/uapi/dvb/net-add-if.rst | 6 -- Documentation/media/video.h.rst.exceptions | 20 ++--- 26 files changed, 144 insertions(+), 227 deletions(-) diff --git a/Documentation/media/audio.h.rst.exceptions b/Documentation/media/audio.h.rst.exceptions index 8330edcd906d..f40f3cbfe4c9 100644 --- a/Documentation/media/audio.h.rst.exceptions +++ b/Documentation/media/audio.h.rst.exceptions @@ -2,7 +2,7 @@ ignore define _DVBAUDIO_H_ # Typedef pointing to structs -replace typedef audio_karaoke_t audio-karaoke +replace typedef audio_karaoke_t :c:type:`audio_karaoke` # Undocumented audio caps, as this is a deprecated API anyway ignore define AUDIO_CAP_DTS @@ -16,5 +16,5 @@ ignore define AUDIO_CAP_SDDS ignore define AUDIO_CAP_AC3 # some typedefs should point to struct/enums -replace typedef audio_mixer_t audio-mixer -replace typedef audio_status_t audio-status +replace typedef audio_mixer_t :c:type:`audio_mixer` +replace typedef audio_status_t :c:type:`audio_status` diff --git a/Documentation/media/ca.h.rst.exceptions b/Documentation/media/ca.h.rst.exceptions index 09c13be67527..d7c9fed8c004 100644 --- a/Documentation/media/ca.h.rst.exceptions +++ b/Documentation/media/ca.h.rst.exceptions @@ -2,23 +2,23 @@ ignore define _DVBCA_H_ # struct ca_slot_info defines -replace define CA_CI ca-slot-info -replace define CA_CI_LINK ca-slot-info -replace define CA_CI_PHYS ca-slot-info -replace define CA_DESCR ca-slot-info -replace define CA_SC ca-slot-info -replace define CA_CI_MODULE_PRESENT ca-slot-info -replace define CA_CI_MODULE_READY ca-slot-info +replace define CA_CI :c:type:`ca_slot_info` +replace define CA_CI_LINK :c:type:`ca_slot_info` +replace define CA_CI_PHYS :c:type:`ca_slot_info` +replace define CA_DESCR :c:type:`ca_slot_info` +replace define CA_SC :c:type:`ca_slot_info` +replace define CA_CI_MODULE_PRESENT :c:type:`ca_slot_info` +replace define CA_CI_MODULE_READY :c:type:`ca_slot_info` # struct ca_descr_info defines -replace define CA_ECD ca-descr-info -replace define CA_NDS ca-descr-info -replace define CA_DSS ca-descr-info +replace define CA_ECD :c:type:`ca_descr_info` +replace define CA_NDS :c:type:`ca_descr_info` +replace define CA_DSS :c:type:`ca_descr_info` # some typedefs should point to struct/enums -replace typedef ca_pid_t ca-pid -replace typedef ca_slot_info_t ca-slot-info -replace typedef ca_descr_info_t ca-descr-info -replace typedef ca_caps_t ca-caps -replace typedef ca_msg_t ca-msg -replace typedef ca_descr_t ca-descr +replace typedef ca_pid_t :c:type:`ca_pid` +replace typedef ca_slot_info_t :c:type:`ca_slot_info` +replace typedef ca_descr_info_t :c:type:`ca_descr_info` +replace typedef ca_caps_t :c:type:`ca_caps` +replace typedef ca_msg_t :c:type:`ca_msg` +replace typedef ca_descr_t :c:type:`ca_descr` diff --git a/Documentation/media/dmx.h.rst.exceptions b/Documentation/media/dmx.h.rst.exceptions index 8200653839d2..2fdb458564ba 100644 --- a/Documentation/media/dmx.h.rst.exceptions +++ b/Documentation/media/dmx.h.rst.exceptions @@ -4,29 +4,29 @@ ignore define _UAPI_DVBDMX_H_ # Ignore limit constants ignore define DMX_FILTER_SIZE -# dmx-pes-type-t enum symbols -replace enum dmx_ts_pes dmx-pes-type-t -replace symbol DMX_PES_AUDIO0 dmx-pes-type-t -replace symbol DMX_PES_VIDEO0 dmx-pes-type-t -replace symbol DMX_PES_TELETEXT0 dmx-pes-type-t -replace symbol DMX_PES_SUBTITLE0 dmx-pes-type-t -replace symbol DMX_PES_PCR0 dmx-pes-type-t -replace symbol DMX_PES_AUDIO1 dmx-pes-type-t -replace symbol DMX_PES_VIDEO1 dmx-pes-type-t -replace symbol DMX_PES_TELETEXT1 dmx-pes-type-t -replace symbol DMX_PES_SUBTITLE1 dmx-pes-type-t -replace symbol DMX_PES_PCR1 dmx-pes-type-t -replace symbol DMX_PES_AUDIO2 dmx-pes-type-t -replace symbol DMX_PES_VIDEO2 dmx-pes-type-t -replace symbol DMX_PES_TELETEXT2 dmx-pes-type-t -replace symbol DMX_PES_SUBTITLE2 dmx-pes-type-t -replace symbol DMX_PES_PCR2 dmx-pes-type-t -replace symbol DMX_PES_AUDIO3 dmx-pes-type-t -replace symbol DMX_PES_VIDEO3 dmx-pes-type-t -replace symbol DMX_PES_TELETEXT3 dmx-pes-type-t -replace symbol DMX_PES_SUBTITLE3 dmx-pes-type-t -replace symbol DMX_PES_PCR3 dmx-pes-type-t -replace symbol DMX_PES_OTHER dmx-pes-type-t +# dmx_pes_type_t enum symbols +replace enum dmx_ts_pes :c:type:`dmx_pes_type` +replace symbol DMX_PES_AUDIO0 :c:type:`dmx_pes_type` +replace symbol DMX_PES_VIDEO0 :c:type:`dmx_pes_type` +replace symbol DMX_PES_TELETEXT0 :c:type:`dmx_pes_type` +replace symbol DMX_PES_SUBTITLE0 :c:type:`dmx_pes_type` +replace symbol DMX_PES_PCR0 :c:type:`dmx_pes_type` +replace symbol DMX_PES_AUDIO1 :c:type:`dmx_pes_type` +replace symbol DMX_PES_VIDEO1 :c:type:`dmx_pes_type` +replace symbol DMX_PES_TELETEXT1 :c:type:`dmx_pes_type` +replace symbol DMX_PES_SUBTITLE1 :c:type:`dmx_pes_type` +replace symbol DMX_PES_PCR1 :c:type:`dmx_pes_type` +replace symbol DMX_PES_AUDIO2 :c:type:`dmx_pes_type` +replace symbol DMX_PES_VIDEO2 :c:type:`dmx_pes_type` +replace symbol DMX_PES_TELETEXT2 :c:type:`dmx_pes_type` +replace symbol DMX_PES_SUBTITLE2 :c:type:`dmx_pes_type` +replace symbol DMX_PES_PCR2 :c:type:`dmx_pes_type` +replace symbol DMX_PES_AUDIO3 :c:type:`dmx_pes_type` +replace symbol DMX_PES_VIDEO3 :c:type:`dmx_pes_type` +replace symbol DMX_PES_TELETEXT3 :c:type:`dmx_pes_type` +replace symbol DMX_PES_SUBTITLE3 :c:type:`dmx_pes_type` +replace symbol DMX_PES_PCR3 :c:type:`dmx_pes_type` +replace symbol DMX_PES_OTHER :c:type:`dmx_pes_type` # Ignore obsolete symbols ignore define DMX_PES_AUDIO @@ -36,28 +36,31 @@ ignore define DMX_PES_SUBTITLE ignore define DMX_PES_PCR # dmx_input_t symbols -replace enum dmx_input dmx-input-t -replace symbol DMX_IN_FRONTEND dmx-input-t -replace symbol DMX_IN_DVR dmx-input-t +replace enum dmx_input :c:type:`dmx_input` +replace symbol DMX_IN_FRONTEND :c:type:`dmx_input` +replace symbol DMX_IN_DVR :c:type:`dmx_input` # dmx_source_t symbols -replace enum dmx_source dmx-source-t -replace symbol DMX_SOURCE_FRONT0 dmx-source-t -replace symbol DMX_SOURCE_FRONT1 dmx-source-t -replace symbol DMX_SOURCE_FRONT2 dmx-source-t -replace symbol DMX_SOURCE_FRONT3 dmx-source-t -replace symbol DMX_SOURCE_DVR0 dmx-source-t -replace symbol DMX_SOURCE_DVR1 dmx-source-t -replace symbol DMX_SOURCE_DVR2 dmx-source-t -replace symbol DMX_SOURCE_DVR3 dmx-source-t +replace enum dmx_source :c:type:`dmx_source` +replace symbol DMX_SOURCE_FRONT0 :c:type:`dmx_source` +replace symbol DMX_SOURCE_FRONT1 :c:type:`dmx_source` +replace symbol DMX_SOURCE_FRONT2 :c:type:`dmx_source` +replace symbol DMX_SOURCE_FRONT3 :c:type:`dmx_source` +replace symbol DMX_SOURCE_DVR0 :c:type:`dmx_source` +replace symbol DMX_SOURCE_DVR1 :c:type:`dmx_source` +replace symbol DMX_SOURCE_DVR2 :c:type:`dmx_source` +replace symbol DMX_SOURCE_DVR3 :c:type:`dmx_source` # Flags for struct dmx_sct_filter_params -replace define DMX_CHECK_CRC dmx-sct-filter-params -replace define DMX_ONESHOT dmx-sct-filter-params -replace define DMX_IMMEDIATE_START dmx-sct-filter-params -replace define DMX_KERNEL_CLIENT dmx-sct-filter-params +replace define DMX_CHECK_CRC :c:type:`dmx_sct_filter_params` +replace define DMX_ONESHOT :c:type:`dmx_sct_filter_params` +replace define DMX_IMMEDIATE_START :c:type:`dmx_sct_filter_params` +replace define DMX_KERNEL_CLIENT :c:type:`dmx_sct_filter_params` # some typedefs should point to struct/enums -replace typedef dmx_caps_t dmx-caps -replace typedef dmx_filter_t dmx-filter +replace typedef dmx_caps_t :c:type:`dmx_caps` +replace typedef dmx_filter_t :c:type:`dmx_filter` +replace typedef dmx_pes_type_t :c:type:`dmx_pes_type` +replace typedef dmx_input_t :c:type:`dmx_input` +replace typedef dmx_source_t :c:type:`dmx_source` diff --git a/Documentation/media/frontend.h.rst.exceptions b/Documentation/media/frontend.h.rst.exceptions index 60f2cbb92656..7656770f1936 100644 --- a/Documentation/media/frontend.h.rst.exceptions +++ b/Documentation/media/frontend.h.rst.exceptions @@ -26,22 +26,22 @@ ignore define MAX_DTV_STATS ignore define DTV_IOCTL_MAX_MSGS # Stats enum is documented altogether -replace enum fecap_scale_params frontend-stat-properties +replace enum fecap_scale_params :ref:`frontend-stat-properties` replace symbol FE_SCALE_COUNTER frontend-stat-properties replace symbol FE_SCALE_DECIBEL frontend-stat-properties replace symbol FE_SCALE_NOT_AVAILABLE frontend-stat-properties replace symbol FE_SCALE_RELATIVE frontend-stat-properties # the same reference is used for both get and set ioctls -replace ioctl FE_SET_PROPERTY FE_GET_PROPERTY +replace ioctl FE_SET_PROPERTY :c:type:`FE_GET_PROPERTY` # Ignore struct used only internally at Kernel ignore struct dtv_cmds_h # Typedefs that use the enum reference -replace typedef fe_sec_voltage_t fe-sec-voltage +replace typedef fe_sec_voltage_t :c:type:`fe_sec_voltage` # Replaces for flag constants -replace define FE_TUNE_MODE_ONESHOT fe_set_frontend_tune_mode +replace define FE_TUNE_MODE_ONESHOT :c:func:`FE_SET_FRONTEND_TUNE_MODE` replace define LNA_AUTO dtv-lna replace define NO_STREAM_ID_FILTER dtv-stream-id diff --git a/Documentation/media/intro.rst b/Documentation/media/intro.rst index be90bda5b3f3..f6086c159772 100644 --- a/Documentation/media/intro.rst +++ b/Documentation/media/intro.rst @@ -30,7 +30,7 @@ divided into five parts. called as DVB API, in fact it covers several different video standards including DVB-T/T2, DVB-S/S2, DVB-C, ATSC, ISDB-T, ISDB-S, DTMB, etc. The complete list of supported standards can be found at - :ref:`fe-delivery-system-t`. + :c:type:`fe_delivery_system`. 3. The :ref:`third part ` covers the Remote Controller API. diff --git a/Documentation/media/net.h.rst.exceptions b/Documentation/media/net.h.rst.exceptions index 30a267483aa9..afe6bef91567 100644 --- a/Documentation/media/net.h.rst.exceptions +++ b/Documentation/media/net.h.rst.exceptions @@ -7,5 +7,5 @@ ignore ioctl __NET_GET_IF_OLD ignore struct __dvb_net_if_old # Macros used at struct dvb_net_if -replace define DVB_NET_FEEDTYPE_MPE dvb-net-if -replace define DVB_NET_FEEDTYPE_ULE dvb-net-if +replace define DVB_NET_FEEDTYPE_MPE :c:type:`dvb_net_if` +replace define DVB_NET_FEEDTYPE_ULE :c:type:`dvb_net_if` diff --git a/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst b/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst index e048ee8f4d65..1279bd21dbd0 100644 --- a/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst +++ b/Documentation/media/uapi/dvb/audio-bilingual-channel-select.rst @@ -16,7 +16,7 @@ AUDIO_BILINGUAL_CHANNEL_SELECT Synopsis -------- -.. c:function:: int ioctl(int fd, AUDIO_BILINGUAL_CHANNEL_SELECT, audio_channel_select_t) +.. c:function:: int ioctl(int fd, AUDIO_BILINGUAL_CHANNEL_SELECT, struct *audio_channel_select) :name: AUDIO_BILINGUAL_CHANNEL_SELECT diff --git a/Documentation/media/uapi/dvb/audio-channel-select.rst b/Documentation/media/uapi/dvb/audio-channel-select.rst index 03dcdbbfbbc6..2ceb4efebdf0 100644 --- a/Documentation/media/uapi/dvb/audio-channel-select.rst +++ b/Documentation/media/uapi/dvb/audio-channel-select.rst @@ -16,7 +16,7 @@ AUDIO_CHANNEL_SELECT Synopsis -------- -.. c:function:: int ioctl(int fd, AUDIO_CHANNEL_SELECT, audio_channel_select_t) +.. c:function:: int ioctl(int fd, AUDIO_CHANNEL_SELECT, struct *audio_channel_select) :name: AUDIO_CHANNEL_SELECT diff --git a/Documentation/media/uapi/dvb/audio-select-source.rst b/Documentation/media/uapi/dvb/audio-select-source.rst index e4ea98787619..c0434a0bd324 100644 --- a/Documentation/media/uapi/dvb/audio-select-source.rst +++ b/Documentation/media/uapi/dvb/audio-select-source.rst @@ -16,7 +16,7 @@ AUDIO_SELECT_SOURCE Synopsis -------- -.. c:function:: int ioctl(int fd, AUDIO_SELECT_SOURCE, audio_stream_source_t source) +.. c:function:: int ioctl(int fd, AUDIO_SELECT_SOURCE, struct audio_stream_source *source) :name: AUDIO_SELECT_SOURCE diff --git a/Documentation/media/uapi/dvb/audio-set-attributes.rst b/Documentation/media/uapi/dvb/audio-set-attributes.rst index ad89a37cf83c..f0c6153ca80f 100644 --- a/Documentation/media/uapi/dvb/audio-set-attributes.rst +++ b/Documentation/media/uapi/dvb/audio-set-attributes.rst @@ -17,7 +17,7 @@ AUDIO_SET_ATTRIBUTES Synopsis -------- -.. c:function:: int ioctl(fd, AUDIO_SET_ATTRIBUTES, audio_attributes_t attr ) +.. c:function:: int ioctl(fd, AUDIO_SET_ATTRIBUTES, struct audio_attributes *attr ) :name: AUDIO_SET_ATTRIBUTES Arguments diff --git a/Documentation/media/uapi/dvb/audio-set-karaoke.rst b/Documentation/media/uapi/dvb/audio-set-karaoke.rst index 78571abdd93a..c759952d88aa 100644 --- a/Documentation/media/uapi/dvb/audio-set-karaoke.rst +++ b/Documentation/media/uapi/dvb/audio-set-karaoke.rst @@ -16,7 +16,7 @@ AUDIO_SET_KARAOKE Synopsis -------- -.. c:function:: int ioctl(fd, AUDIO_SET_KARAOKE, audio_karaoke_t *karaoke) +.. c:function:: int ioctl(fd, AUDIO_SET_KARAOKE, struct audio_karaoke *karaoke) :name: AUDIO_SET_KARAOKE diff --git a/Documentation/media/uapi/dvb/audio-set-mixer.rst b/Documentation/media/uapi/dvb/audio-set-mixer.rst index 657bd89b8a6a..248aab8c8909 100644 --- a/Documentation/media/uapi/dvb/audio-set-mixer.rst +++ b/Documentation/media/uapi/dvb/audio-set-mixer.rst @@ -16,7 +16,7 @@ AUDIO_SET_MIXER Synopsis -------- -.. c:function:: int ioctl(int fd, AUDIO_SET_MIXER, audio_mixer_t *mix) +.. c:function:: int ioctl(int fd, AUDIO_SET_MIXER, struct audio_mixer *mix) :name: AUDIO_SET_MIXER Arguments diff --git a/Documentation/media/uapi/dvb/audio_data_types.rst b/Documentation/media/uapi/dvb/audio_data_types.rst index 0b14c2dfc98c..6b93359d64f7 100644 --- a/Documentation/media/uapi/dvb/audio_data_types.rst +++ b/Documentation/media/uapi/dvb/audio_data_types.rst @@ -9,11 +9,7 @@ Audio Data Types This section describes the structures, data types and defines used when talking to the audio device. - -.. _audio-stream-source-t: - -audio_stream_source_t -===================== +.. c:type:: audio_stream_source The audio stream source is set through the AUDIO_SELECT_SOURCE call and can take the following values, depending on whether we are replaying @@ -33,10 +29,7 @@ AUDIO_SOURCE_MEMORY is selected the stream comes from the application through the ``write()`` system call. -.. _audio-play-state-t: - -audio_play_state_t -================== +.. c:type:: audio_play_state The following values can be returned by the AUDIO_GET_STATUS call representing the state of audio playback. @@ -51,10 +44,7 @@ representing the state of audio playback. } audio_play_state_t; -.. _audio-channel-select-t: - -audio_channel_select_t -====================== +.. c:type:: audio_channel_select The audio channel selected via AUDIO_CHANNEL_SELECT is determined by the following values. @@ -73,9 +63,6 @@ the following values. .. c:type:: audio_status -struct audio_status -=================== - The AUDIO_GET_STATUS call returns the following structure informing about various states of the playback operation. @@ -95,9 +82,6 @@ about various states of the playback operation. .. c:type:: audio_mixer -struct audio_mixer -================== - The following structure is used by the AUDIO_SET_MIXER call to set the audio volume. @@ -131,12 +115,8 @@ following bits set according to the hardwares capabilities. #define AUDIO_CAP_SDDS 128 #define AUDIO_CAP_AC3 256 - .. c:type:: audio_karaoke -struct audio_karaoke -==================== - The ioctl AUDIO_SET_KARAOKE uses the following format: @@ -155,10 +135,7 @@ into the left channel and Vocal2 into the right channel at 100% each. Ff Melody is non-zero, the melody channel gets mixed into left and right. -.. _audio-attributes-t: - -audio attributes -================ +.. c:type:: audio_attributes The following attributes can be set by a call to AUDIO_SET_ATTRIBUTES: diff --git a/Documentation/media/uapi/dvb/dmx_types.rst b/Documentation/media/uapi/dvb/dmx_types.rst index 65de705fa1ef..80dd659860d7 100644 --- a/Documentation/media/uapi/dvb/dmx_types.rst +++ b/Documentation/media/uapi/dvb/dmx_types.rst @@ -6,15 +6,12 @@ Demux Data Types **************** - -.. _dmx-output-t: - Output for the demux ==================== -.. tabularcolumns:: |p{5.0cm}|p{12.5cm}| +.. c:type:: dmx_output -.. _dmx-output: +.. tabularcolumns:: |p{5.0cm}|p{12.5cm}| .. flat-table:: enum dmx_output :header-rows: 1 @@ -66,12 +63,10 @@ Output for the demux from the DMX device. - -.. _dmx-input-t: - dmx_input_t =========== +.. c:type:: dmx_input .. code-block:: c @@ -82,11 +77,11 @@ dmx_input_t } dmx_input_t; -.. _dmx-pes-type-t: - dmx_pes_type_t ============== +.. c:type:: dmx_pes_type + .. code-block:: c @@ -120,11 +115,10 @@ dmx_pes_type_t } dmx_pes_type_t; -.. c:type:: dmx_filter - struct dmx_filter ================= +.. c:type:: dmx_filter .. code-block:: c @@ -157,11 +151,10 @@ struct dmx_sct_filter_params }; -.. c:type:: dmx_pes_filter_params - struct dmx_pes_filter_params ============================ +.. c:type:: dmx_pes_filter_params .. code-block:: c @@ -175,11 +168,10 @@ struct dmx_pes_filter_params }; -.. _dmx-event: - struct dmx_event ================ +.. c:type:: dmx_event .. code-block:: c @@ -194,11 +186,10 @@ struct dmx_event }; -.. c:type:: dmx_stc - struct dmx_stc ============== +.. c:type:: dmx_stc .. code-block:: c @@ -209,11 +200,10 @@ struct dmx_stc }; -.. c:type:: dmx_caps - struct dmx_caps =============== +.. c:type:: dmx_caps .. code-block:: c @@ -223,15 +213,14 @@ struct dmx_caps } dmx_caps_t; -.. _dmx-source-t: - -enum dmx_source_t -================= +enum dmx_source +=============== +.. c:type:: dmx_source .. code-block:: c - typedef enum { + typedef enum dmx_source { DMX_SOURCE_FRONT0 = 0, DMX_SOURCE_FRONT1, DMX_SOURCE_FRONT2, diff --git a/Documentation/media/uapi/dvb/fe-bandwidth-t.rst b/Documentation/media/uapi/dvb/fe-bandwidth-t.rst index 8edaf1a8fbc8..70256180e9b3 100644 --- a/Documentation/media/uapi/dvb/fe-bandwidth-t.rst +++ b/Documentation/media/uapi/dvb/fe-bandwidth-t.rst @@ -1,13 +1,10 @@ .. -*- coding: utf-8; mode: rst -*- -.. _fe-bandwidth-t: - ****************** Frontend bandwidth ****************** - -.. _fe-bandwidth: +.. c:type:: fe_bandwidth .. flat-table:: enum fe_bandwidth :header-rows: 1 diff --git a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst index 9fda5546d8c1..302db2857f90 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-recv-slave-reply.rst @@ -37,9 +37,6 @@ Receives reply from a DiSEqC 2.0 command. .. c:type:: dvb_diseqc_slave_reply -struct dvb_diseqc_slave_reply ------------------------------ - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| .. flat-table:: struct dvb_diseqc_slave_reply diff --git a/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst b/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst index 0e55614bc987..26272f2860bc 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-send-burst.rst @@ -26,7 +26,7 @@ Arguments File descriptor returned by :ref:`open() `. ``tone`` - pointer to enum :ref:`fe_sec_mini_cmd ` + pointer to enum :c:type:`fe_sec_mini_cmd` Description @@ -39,12 +39,7 @@ read/write permissions. It provides support for what's specified at `Digital Satellite Equipment Control (DiSEqC) - Simple "ToneBurst" Detection Circuit specification. `__ -.. _fe-sec-mini-cmd-t: - -enum fe_sec_mini_cmd -==================== - -.. _fe-sec-mini-cmd: +.. c:type:: fe_sec_mini_cmd .. flat-table:: enum fe_sec_mini_cmd :header-rows: 1 diff --git a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst index 72cb4ebd95c0..bbcab3df39b5 100644 --- a/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst +++ b/Documentation/media/uapi/dvb/fe-diseqc-send-master-cmd.rst @@ -35,10 +35,8 @@ Description Sends a DiSEqC command to the antenna subsystem. -.. c:type:: dvb_diseqc_master_cmd -struct dvb_diseqc_master_cmd -============================ +.. c:type:: dvb_diseqc_master_cmd .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| diff --git a/Documentation/media/uapi/dvb/fe-get-info.rst b/Documentation/media/uapi/dvb/fe-get-info.rst index 3557b756ef27..e3d64b251f61 100644 --- a/Documentation/media/uapi/dvb/fe-get-info.rst +++ b/Documentation/media/uapi/dvb/fe-get-info.rst @@ -42,9 +42,6 @@ returns an error. .. c:type:: dvb_frontend_info -struct dvb_frontend_info -======================== - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| .. flat-table:: struct dvb_frontend_info @@ -137,7 +134,7 @@ struct dvb_frontend_info - .. row 11 - - enum :ref:`fe_caps ` + - enum :c:type:`fe_caps` - caps @@ -150,17 +147,15 @@ struct dvb_frontend_info systems. They're specified in kHz for Satellite systems -.. _fe-caps-t: - frontend capabilities ===================== Capabilities describe what a frontend can do. Some capabilities are supported only on some specific frontend types. -.. tabularcolumns:: |p{6.5cm}|p{11.0cm}| +.. c:type:: fe_caps -.. _fe-caps: +.. tabularcolumns:: |p{6.5cm}|p{11.0cm}| .. flat-table:: enum fe_caps :header-rows: 1 diff --git a/Documentation/media/uapi/dvb/fe-read-status.rst b/Documentation/media/uapi/dvb/fe-read-status.rst index c65cec3a35c9..812f086c20f5 100644 --- a/Documentation/media/uapi/dvb/fe-read-status.rst +++ b/Documentation/media/uapi/dvb/fe-read-status.rst @@ -27,7 +27,7 @@ Arguments ``status`` pointer to a bitmask integer filled with the values defined by enum - :ref:`fe_status `. + :c:type:`fe_status`. Description @@ -45,14 +45,14 @@ written. future. -.. _fe-status-t: - int fe_status ============= The fe_status parameter is used to indicate the current state and/or state changes of the frontend hardware. It is produced using the enum -:ref:`fe_status ` values on a bitmask +:c:type:`fe_status` values on a bitmask + +.. c:type:: fe_status .. tabularcolumns:: |p{3.5cm}|p{14.0cm}| diff --git a/Documentation/media/uapi/dvb/fe-set-tone.rst b/Documentation/media/uapi/dvb/fe-set-tone.rst index 4cfd532d3dc5..bea193234cb4 100644 --- a/Documentation/media/uapi/dvb/fe-set-tone.rst +++ b/Documentation/media/uapi/dvb/fe-set-tone.rst @@ -26,7 +26,7 @@ Arguments File descriptor returned by :ref:`open() `. ``tone`` - pointer to enum :ref:`fe_sec_tone_mode ` + pointer to enum :c:type:`fe_sec_tone_mode` Description @@ -45,12 +45,7 @@ this is done using the DiSEqC ioctls. capability of selecting the band. So, it is recommended that applications would change to SEC_TONE_OFF when the device is not used. -.. _fe-sec-tone-mode-t: - -enum fe_sec_tone_mode -===================== - -.. _fe-sec-tone-mode: +.. c:type:: fe_sec_tone_mode .. flat-table:: enum fe_sec_tone_mode :header-rows: 1 diff --git a/Documentation/media/uapi/dvb/fe-set-voltage.rst b/Documentation/media/uapi/dvb/fe-set-voltage.rst index b8b23c51ec7d..fcf6f38ef18e 100644 --- a/Documentation/media/uapi/dvb/fe-set-voltage.rst +++ b/Documentation/media/uapi/dvb/fe-set-voltage.rst @@ -26,10 +26,10 @@ Arguments File descriptor returned by :ref:`open() `. ``voltage`` - pointer to enum :ref:`fe_sec_voltage ` + pointer to enum :c:type:`fe_sec_voltage` Valid values are described at enum - :ref:`fe_sec_voltage `. + :c:type:`fe_sec_voltage`. Description diff --git a/Documentation/media/uapi/dvb/fe-type-t.rst b/Documentation/media/uapi/dvb/fe-type-t.rst index 03a6c75bf5de..548b965188d0 100644 --- a/Documentation/media/uapi/dvb/fe-type-t.rst +++ b/Documentation/media/uapi/dvb/fe-type-t.rst @@ -1,7 +1,5 @@ .. -*- coding: utf-8; mode: rst -*- -.. _fe-type-t: - ************* Frontend type ************* @@ -11,7 +9,7 @@ modulation used in transmission. The fontend types are given by fe_type_t type, defined as: -.. _fe-type: +.. c:type:: fe_type .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| diff --git a/Documentation/media/uapi/dvb/fe_property_parameters.rst b/Documentation/media/uapi/dvb/fe_property_parameters.rst index 304ac1a3c2ff..7bb7559c4500 100644 --- a/Documentation/media/uapi/dvb/fe_property_parameters.rst +++ b/Documentation/media/uapi/dvb/fe_property_parameters.rst @@ -68,10 +68,10 @@ DTV_MODULATION Specifies the frontend modulation type for delivery systems that supports more than one modulation type. The modulation can be one of the -types defined by enum :ref:`fe_modulation `. +types defined by enum :c:type:`fe_modulation`. -.. _fe-modulation-t: +.. c:type:: fe_modulation Modulation property ------------------- @@ -82,8 +82,6 @@ enum contains the values used by the Kernel. Please note that not all modulations are supported by a given standard. -.. _fe-modulation: - .. flat-table:: enum fe_modulation :header-rows: 1 :stub-columns: 0 @@ -251,8 +249,7 @@ DTV_INVERSION Specifies if the frontend should do spectral inversion or not. - -.. _fe-spectral-inversion-t: +.. c:type:: fe_spectral_inversion enum fe_modulation: Frontend spectral inversion ----------------------------------------------- @@ -264,8 +261,6 @@ support, the DVB core will try to lock at the carrier first with inversion off. If it fails, it will try to enable inversion. -.. _fe-spectral-inversion: - .. flat-table:: enum fe_modulation :header-rows: 1 :stub-columns: 0 @@ -327,15 +322,11 @@ DTV_INNER_FEC Used cable/satellite transmissions. The acceptable values are: - -.. _fe-code-rate-t: +.. c:type:: fe_code_rate enum fe_code_rate: type of the Forward Error Correction. -------------------------------------------------------- - -.. _fe-code-rate: - .. flat-table:: enum fe_code_rate :header-rows: 1 :stub-columns: 0 @@ -464,7 +455,7 @@ voltage has to be switched consistently to the DiSEqC commands as described in the DiSEqC spec. -.. _fe-sec-voltage: +.. c:type:: fe_sec_voltage .. flat-table:: enum fe_sec_voltage :header-rows: 1 @@ -519,14 +510,12 @@ DTV_PILOT Sets DVB-S2 pilot -.. _fe-pilot-t: +.. c:type:: fe_pilot fe_pilot type ------------- -.. _fe-pilot: - .. flat-table:: enum fe_pilot :header-rows: 1 :stub-columns: 0 @@ -572,14 +561,12 @@ DTV_ROLLOFF Sets DVB-S2 rolloff -.. _fe-rolloff-t: +.. c:type:: fe_rolloff fe_rolloff type --------------- -.. _fe-rolloff: - .. flat-table:: enum fe_rolloff :header-rows: 1 :stub-columns: 0 @@ -657,7 +644,7 @@ DTV_DELIVERY_SYSTEM Specifies the type of Delivery system -.. _fe-delivery-system-t: +.. c:type:: fe_delivery_system fe_delivery_system type ----------------------- @@ -665,8 +652,6 @@ fe_delivery_system type Possible values: -.. _fe-delivery-system: - .. flat-table:: enum fe_delivery_system :header-rows: 1 :stub-columns: 0 @@ -1098,7 +1083,7 @@ The values here are referring to what can be found in the TMCC-structure, as shown in the table below. -.. _isdbt-layer-interleaving-table: +.. c:type:: isdbt_layer_interleaving_table .. flat-table:: ISDB-T time interleaving modes :header-rows: 0 @@ -1235,7 +1220,7 @@ Possible values are: .. tabularcolumns:: |p{5.0cm}|p{12.5cm}| -.. _atscmh-rs-frame-mode: +.. c:type:: atscmh_rs_frame_mode .. flat-table:: enum atscmh_rs_frame_mode :header-rows: 1 @@ -1279,7 +1264,7 @@ Reed Solomon(RS) frame ensemble. Possible values are: -.. _atscmh-rs-frame-ensemble: +.. c:type:: atscmh_rs_frame_ensemble .. flat-table:: enum atscmh_rs_frame_ensemble :header-rows: 1 @@ -1328,7 +1313,7 @@ Reed Solomon (RS) code mode (primary). Possible values are: -.. _atscmh-rs-code-mode: +.. c:type:: atscmh_rs_code_mode .. flat-table:: enum atscmh_rs_code_mode :header-rows: 1 @@ -1383,7 +1368,7 @@ DTV_ATSCMH_RS_CODE_MODE_SEC Reed Solomon (RS) code mode (secondary). Possible values are the same as documented on enum -:ref:`atscmh_rs_code_mode `: +:c:type:`atscmh_rs_code_mode`: .. _DTV-ATSCMH-SCCC-BLOCK-MODE: @@ -1397,7 +1382,7 @@ Possible values are: .. tabularcolumns:: |p{4.5cm}|p{13.0cm}| -.. _atscmh-sccc-block-mode: +.. c:type:: atscmh_sccc_block_mode .. flat-table:: enum atscmh_scc_block_mode :header-rows: 1 @@ -1448,7 +1433,7 @@ Series Concatenated Convolutional Code Rate. Possible values are: -.. _atscmh-sccc-code-mode: +.. c:type:: atscmh_sccc_code_mode .. flat-table:: enum atscmh_sccc_code_mode :header-rows: 1 @@ -1495,7 +1480,7 @@ DTV_ATSCMH_SCCC_CODE_MODE_B Series Concatenated Convolutional Code Rate. Possible values are the same as documented on enum -:ref:`atscmh_sccc_code_mode `. +:c:type:`atscmh_sccc_code_mode`. .. _DTV-ATSCMH-SCCC-CODE-MODE-C: @@ -1506,7 +1491,7 @@ DTV_ATSCMH_SCCC_CODE_MODE_C Series Concatenated Convolutional Code Rate. Possible values are the same as documented on enum -:ref:`atscmh_sccc_code_mode `. +:c:type:`atscmh_sccc_code_mode`. .. _DTV-ATSCMH-SCCC-CODE-MODE-D: @@ -1517,7 +1502,7 @@ DTV_ATSCMH_SCCC_CODE_MODE_D Series Concatenated Convolutional Code Rate. Possible values are the same as documented on enum -:ref:`atscmh_sccc_code_mode `. +:c:type:`atscmh_sccc_code_mode`. .. _DTV-API-VERSION: @@ -1534,7 +1519,7 @@ DTV_CODE_RATE_HP ================ Used on terrestrial transmissions. The acceptable values are the ones -described at :ref:`fe_transmit_mode_t `. +described at :c:type:`fe_transmit_mode`. .. _DTV-CODE-RATE-LP: @@ -1543,7 +1528,7 @@ DTV_CODE_RATE_LP ================ Used on terrestrial transmissions. The acceptable values are the ones -described at :ref:`fe_transmit_mode_t `. +described at :c:type:`fe_transmit_mode`. .. _DTV-GUARD-INTERVAL: @@ -1554,14 +1539,12 @@ DTV_GUARD_INTERVAL Possible values are: -.. _fe-guard-interval-t: +.. c:type:: fe_guard_interval Modulation guard interval ------------------------- -.. _fe-guard-interval: - .. flat-table:: enum fe_guard_interval :header-rows: 1 :stub-columns: 0 @@ -1683,15 +1666,13 @@ Specifies the number of carriers used by the standard. This is used only on OFTM-based standards, e. g. DVB-T/T2, ISDB-T, DTMB -.. _fe-transmit-mode-t: +.. c:type:: fe_transmit_mode enum fe_transmit_mode: Number of carriers per channel ----------------------------------------------------- .. tabularcolumns:: |p{5.0cm}|p{12.5cm}| -.. _fe-transmit-mode: - .. flat-table:: enum fe_transmit_mode :header-rows: 1 :stub-columns: 0 @@ -1801,14 +1782,12 @@ DTV_HIERARCHY Frontend hierarchy -.. _fe-hierarchy-t: +.. c:type:: fe_hierarchy Frontend hierarchy ------------------ -.. _fe-hierarchy: - .. flat-table:: enum fe_hierarchy :header-rows: 1 :stub-columns: 0 @@ -1914,7 +1893,7 @@ DTV_INTERLEAVING Time interleaving to be used. Currently, used only on DTMB. -.. _fe-interleaving: +.. c:type:: fe_interleaving .. flat-table:: enum fe_interleaving :header-rows: 1 diff --git a/Documentation/media/uapi/dvb/net-add-if.rst b/Documentation/media/uapi/dvb/net-add-if.rst index dbe80c91bdb0..82ce2438213f 100644 --- a/Documentation/media/uapi/dvb/net-add-if.rst +++ b/Documentation/media/uapi/dvb/net-add-if.rst @@ -41,12 +41,6 @@ created. The struct :c:type:`dvb_net_if`::ifnum field will be filled with the number of the created interface. - -.. _dvb-net-if-t: - -struct dvb_net_if description -============================= - .. c:type:: dvb_net_if .. flat-table:: struct dvb_net_if diff --git a/Documentation/media/video.h.rst.exceptions b/Documentation/media/video.h.rst.exceptions index 8866145e8269..a91aa884ce0e 100644 --- a/Documentation/media/video.h.rst.exceptions +++ b/Documentation/media/video.h.rst.exceptions @@ -28,13 +28,13 @@ ignore define VIDEO_CAP_NAVI ignore define VIDEO_CAP_CSS # some typedefs should point to struct/enums -replace typedef video_format_t video-format -replace typedef video_system_t video-system -replace typedef video_displayformat_t video-displayformat -replace typedef video_size_t video-size -replace typedef video_stream_source_t video-stream-source -replace typedef video_play_state_t video-play-state -replace typedef video_highlight_t video-highlight -replace typedef video_spu_t video-spu -replace typedef video_spu_palette_t video-spu-palette -replace typedef video_navi_pack_t video-navi-pack +replace typedef video_format_t :c:type:`video_format` +replace typedef video_system_t :c:type:`video_system` +replace typedef video_displayformat_t :c:type:`video_displayformat` +replace typedef video_size_t :c:type:`video_size` +replace typedef video_stream_source_t :c:type:`video_stream_source` +replace typedef video_play_state_t :c:type:`video_play_state` +replace typedef video_highlight_t :c:type:`video_highlight` +replace typedef video_spu_t :c:type:`video_spu` +replace typedef video_spu_palette_t :c:type:`video_spu_palette` +replace typedef video_navi_pack_t :c:type:`video_navi_pack` From f9c045516401edf31730d2dc30b39a701dc611b6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 13:07:43 -0300 Subject: [PATCH 326/591] [media] ca-get-cap.rst: add a table for struct ca_caps Add a flat-table describing struct ca_caps, as found at the source file. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/ca-get-cap.rst | 29 ++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/dvb/ca-get-cap.rst b/Documentation/media/uapi/dvb/ca-get-cap.rst index 3486805b62a9..77c57ac59535 100644 --- a/Documentation/media/uapi/dvb/ca-get-cap.rst +++ b/Documentation/media/uapi/dvb/ca-get-cap.rst @@ -26,7 +26,34 @@ Arguments File descriptor returned by a previous call to :c:func:`open() `. ``caps`` - Undocumented. + struct :c:type:`ca_caps` pointer + +.. c:type:: struct ca_caps + +.. flat-table:: struct ca_caps + :header-rows: 1 + :stub-columns: 0 + + - + - type + - name + - description + - + - unsigned int + - slot_num + - total number of CA card and module slots + - + - unsigned int + - slot_type + - bitmask with all supported slot types + - + - unsigned int + - descr_num + - total number of descrambler slots (keys) + - + - unsigned int + - descr_type + - bit mask with all supported descr types Description From 302397d003606ef3584f80ce42ab3b0d23842684 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 14:07:38 -0300 Subject: [PATCH 327/591] [media] ca-get-descr-info.rst: add doc for for struct ca_descr_info The documentation follows what's there at the ca.h header. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/dvb/ca-get-descr-info.rst | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/dvb/ca-get-descr-info.rst b/Documentation/media/uapi/dvb/ca-get-descr-info.rst index b007f10b4910..b4a31940cec0 100644 --- a/Documentation/media/uapi/dvb/ca-get-descr-info.rst +++ b/Documentation/media/uapi/dvb/ca-get-descr-info.rst @@ -25,7 +25,28 @@ Arguments File descriptor returned by a previous call to :c:func:`open() `. ``desc`` - Undocumented. + Pointer to struct :c:type:`ca_descr_info`. + +.. c:type:: struct ca_descr_info + +.. flat-table:: struct ca_descr_info + :header-rows: 1 + :stub-columns: 0 + + - + - type + - name + - description + + - + - unsigned int + - num + - number of available descramblers (keys) + - + - unsigned int + - type + - type of supported scrambling system. Valid values are: + ``CA_ECD``, ``CA_NDS`` and ``CA_DSS``. Description From e0927092b6fd7e6ca5f5cf9e7d9e00a1a9563ca7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 14:14:26 -0300 Subject: [PATCH 328/591] [media] ca-get-msg.rst: add a boilerplate for struct ca_msg There are no descriptions at ca.h header for this struct. Yet, as we want to get rid of the warnings, let's add a boilerplate, with just the struct types and fields. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/ca-get-msg.rst | 33 ++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/dvb/ca-get-msg.rst b/Documentation/media/uapi/dvb/ca-get-msg.rst index 880995230909..03b2a602f02a 100644 --- a/Documentation/media/uapi/dvb/ca-get-msg.rst +++ b/Documentation/media/uapi/dvb/ca-get-msg.rst @@ -26,7 +26,38 @@ Arguments File descriptor returned by a previous call to :c:func:`open() `. ``msg`` - Undocumented. + Pointer to struct :c:type:`ca_msg`. + + +.. c:type:: struct ca_msg + +.. flat-table:: struct ca_msg + :header-rows: 1 + :stub-columns: 0 + + - + - type + - name + - description + - + - unsigned int + - index + - + + - + - unsigned int + - type + - + + - + - unsigned int + - length + - + + - + - unsigned char + - msg[256] + - Description From 63eb58b83b70e2b034879adea85a5df2c5e08ab4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 14:15:56 -0300 Subject: [PATCH 329/591] [media] ca-get-slot-info.rst: document struct ca_slot_info Add documentation for struct ca_slot_info and for the two sets of define used by it, according with what's there at the ca.h header. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/dvb/ca-get-slot-info.rst | 84 ++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/dvb/ca-get-slot-info.rst b/Documentation/media/uapi/dvb/ca-get-slot-info.rst index fcecd80e30d4..4398aeb83eb7 100644 --- a/Documentation/media/uapi/dvb/ca-get-slot-info.rst +++ b/Documentation/media/uapi/dvb/ca-get-slot-info.rst @@ -26,7 +26,89 @@ Arguments File descriptor returned by a previous call to :c:func:`open() `. ``info`` - Undocumented. + Pointer to struct c:type:`ca_slot_info`. + +.. _ca_slot_info_type: + +.. flat-table:: ca_slot_info types + :header-rows: 1 + :stub-columns: 0 + + - + - type + - name + - description + - + - CA_CI + - 1 + - CI high level interface + + - + - CA_CI_LINK + - 2 + - CI link layer level interface + + - + - CA_CI_PHYS + - 4 + - CI physical layer level interface + + - + - CA_DESCR + - 8 + - built-in descrambler + + - + - CA_SC + - 128 + - simple smart card interface + +.. _ca_slot_info_flag: + +.. flat-table:: ca_slot_info flags + :header-rows: 1 + :stub-columns: 0 + + - + - type + - name + - description + + - + - CA_CI_MODULE_PRESENT + - 1 + - module (or card) inserted + + - + - CA_CI_MODULE_READY + - 2 + - + +.. c:type:: ca_slot_info + +.. flat-table:: struct ca_slot_info + :header-rows: 1 + :stub-columns: 0 + + - + - type + - name + - description + + - + - int + - num + - slot number + + - + - int + - type + - CA interface this slot supports, as defined at :ref:`ca_slot_info_type`. + + - + - unsigned int + - flags + - flags as defined at :ref:`ca_slot_info_flag`. Description From cdb1c89681779d84605c0ac2a12cd7461ebadf17 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 15:59:11 -0300 Subject: [PATCH 330/591] [media] ca-set-pid.rst: document struct ca_pid Add a table describing the fields on this struct, based on ca.h header. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/ca-set-pid.rst | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/dvb/ca-set-pid.rst b/Documentation/media/uapi/dvb/ca-set-pid.rst index 8e13ad9595d3..06bdaf4afada 100644 --- a/Documentation/media/uapi/dvb/ca-set-pid.rst +++ b/Documentation/media/uapi/dvb/ca-set-pid.rst @@ -26,7 +26,24 @@ Arguments File descriptor returned by a previous call to :c:func:`open() `. ``pid`` - Undocumented. + Pointer to struct :c:type:`ca_pid`. + +.. c:type:: ca_pid + +.. flat-table:: struct ca_pid + :header-rows: 1 + :stub-columns: 0 + + - + - unsigned int + - pid + - Program ID + + - + - int + - index + - PID index. Use -1 to disable. + Description From 189d7243d24ae8673c84be022808522d9df5cc40 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 15:59:14 -0300 Subject: [PATCH 331/591] [media] docs-rst: fix the remaining broken links for DVB CA API Several links are broken, as they were using the typedef name, instead of using the corresponding structs. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/ca-get-cap.rst | 4 ++-- Documentation/media/uapi/dvb/ca-get-descr-info.rst | 2 +- Documentation/media/uapi/dvb/ca-get-msg.rst | 2 +- Documentation/media/uapi/dvb/ca-get-slot-info.rst | 2 +- Documentation/media/uapi/dvb/ca-send-msg.rst | 4 ++-- Documentation/media/uapi/dvb/ca-set-descr.rst | 6 +++--- Documentation/media/uapi/dvb/ca-set-pid.rst | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Documentation/media/uapi/dvb/ca-get-cap.rst b/Documentation/media/uapi/dvb/ca-get-cap.rst index 77c57ac59535..fbf7e359cb8a 100644 --- a/Documentation/media/uapi/dvb/ca-get-cap.rst +++ b/Documentation/media/uapi/dvb/ca-get-cap.rst @@ -15,7 +15,7 @@ CA_GET_CAP Synopsis -------- -.. c:function:: int ioctl(fd, CA_GET_CAP, ca_caps_t *caps) +.. c:function:: int ioctl(fd, CA_GET_CAP, struct ca_caps *caps) :name: CA_GET_CAP @@ -26,7 +26,7 @@ Arguments File descriptor returned by a previous call to :c:func:`open() `. ``caps`` - struct :c:type:`ca_caps` pointer + Pointer to struct :c:type:`ca_caps`. .. c:type:: struct ca_caps diff --git a/Documentation/media/uapi/dvb/ca-get-descr-info.rst b/Documentation/media/uapi/dvb/ca-get-descr-info.rst index b4a31940cec0..7bf327a3d0e3 100644 --- a/Documentation/media/uapi/dvb/ca-get-descr-info.rst +++ b/Documentation/media/uapi/dvb/ca-get-descr-info.rst @@ -15,7 +15,7 @@ CA_GET_DESCR_INFO Synopsis -------- -.. c:function:: int ioctl(fd, CA_GET_DESCR_INFO, ca_descr_info_t *desc) +.. c:function:: int ioctl(fd, CA_GET_DESCR_INFO, struct ca_descr_info *desc) :name: CA_GET_DESCR_INFO Arguments diff --git a/Documentation/media/uapi/dvb/ca-get-msg.rst b/Documentation/media/uapi/dvb/ca-get-msg.rst index 03b2a602f02a..121588da3ef1 100644 --- a/Documentation/media/uapi/dvb/ca-get-msg.rst +++ b/Documentation/media/uapi/dvb/ca-get-msg.rst @@ -15,7 +15,7 @@ CA_GET_MSG Synopsis -------- -.. c:function:: int ioctl(fd, CA_GET_MSG, ca_msg_t *msg) +.. c:function:: int ioctl(fd, CA_GET_MSG, struct ca_msg *msg) :name: CA_GET_MSG diff --git a/Documentation/media/uapi/dvb/ca-get-slot-info.rst b/Documentation/media/uapi/dvb/ca-get-slot-info.rst index 4398aeb83eb7..54e5dc78a2dc 100644 --- a/Documentation/media/uapi/dvb/ca-get-slot-info.rst +++ b/Documentation/media/uapi/dvb/ca-get-slot-info.rst @@ -15,7 +15,7 @@ CA_GET_SLOT_INFO Synopsis -------- -.. c:function:: int ioctl(fd, CA_GET_SLOT_INFO, ca_slot_info_t *info) +.. c:function:: int ioctl(fd, CA_GET_SLOT_INFO, struct ca_slot_info *info) :name: CA_GET_SLOT_INFO diff --git a/Documentation/media/uapi/dvb/ca-send-msg.rst b/Documentation/media/uapi/dvb/ca-send-msg.rst index 0c42b10cf4f4..532ef5f9d6ac 100644 --- a/Documentation/media/uapi/dvb/ca-send-msg.rst +++ b/Documentation/media/uapi/dvb/ca-send-msg.rst @@ -15,7 +15,7 @@ CA_SEND_MSG Synopsis -------- -.. c:function:: int ioctl(fd, CA_SEND_MSG, ca_msg_t *msg) +.. c:function:: int ioctl(fd, CA_SEND_MSG, struct ca_msg *msg) :name: CA_SEND_MSG @@ -26,7 +26,7 @@ Arguments File descriptor returned by a previous call to :c:func:`open() `. ``msg`` - Undocumented. + Pointer to struct :c:type:`ca_msg`. Description diff --git a/Documentation/media/uapi/dvb/ca-set-descr.rst b/Documentation/media/uapi/dvb/ca-set-descr.rst index 63dcc2b751ef..70f7b3cf12ad 100644 --- a/Documentation/media/uapi/dvb/ca-set-descr.rst +++ b/Documentation/media/uapi/dvb/ca-set-descr.rst @@ -15,8 +15,8 @@ CA_SET_DESCR Synopsis -------- -.. c:function:: int ioctl(fd, CA_SET_DESCR, ca_descr_t *desc) - :name: +.. c:function:: int ioctl(fd, CA_SET_DESCR, struct ca_descr *desc) + :name: CA_SET_DESCR Arguments @@ -26,7 +26,7 @@ Arguments File descriptor returned by a previous call to :c:func:`open() `. ``msg`` - Undocumented. + Pointer to struct :c:type:`ca_descr`. Description diff --git a/Documentation/media/uapi/dvb/ca-set-pid.rst b/Documentation/media/uapi/dvb/ca-set-pid.rst index 06bdaf4afada..891c1c72ef24 100644 --- a/Documentation/media/uapi/dvb/ca-set-pid.rst +++ b/Documentation/media/uapi/dvb/ca-set-pid.rst @@ -15,7 +15,7 @@ CA_SET_PID Synopsis -------- -.. c:function:: int ioctl(fd, CA_SET_PID, ca_pid_t *pid) +.. c:function:: int ioctl(fd, CA_SET_PID, struct ca_pid *pid) :name: CA_SET_PID From 848d10314bfe1be79f5ca4deb3d2bf81f6adcf38 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 16:34:07 -0300 Subject: [PATCH 332/591] [media] fix broken references on dvb/video*rst Trivially fix those broken references, by copying the structs fron the header, just like other API documentation at the DVB side. This doesn't have the level of quality used at the V4L2 side of the API, but, as this documents a deprecated API, used only by av7110 driver, it doesn't make much sense to invest time making it better. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/dvb/video-command.rst | 30 +++++++++++++++++++ .../media/uapi/dvb/video-get-event.rst | 17 +++++++++++ .../media/uapi/dvb/video-get-navi.rst | 10 ++++++- .../media/uapi/dvb/video-get-size.rst | 10 +++++++ .../media/uapi/dvb/video-get-status.rst | 11 +++++++ .../media/uapi/dvb/video-select-source.rst | 10 +++++++ .../media/uapi/dvb/video-set-attributes.rst | 16 ++++++++++ .../uapi/dvb/video-set-display-format.rst | 2 +- .../media/uapi/dvb/video-set-format.rst | 9 ++++++ .../media/uapi/dvb/video-set-highlight.rst | 26 +++++++++++++++- .../media/uapi/dvb/video-set-spu-palette.rst | 10 ++++++- .../media/uapi/dvb/video-set-spu.rst | 11 ++++++- include/uapi/linux/dvb/video.h | 3 +- 13 files changed, 159 insertions(+), 6 deletions(-) diff --git a/Documentation/media/uapi/dvb/video-command.rst b/Documentation/media/uapi/dvb/video-command.rst index 4772562036f1..536d0fdd8399 100644 --- a/Documentation/media/uapi/dvb/video-command.rst +++ b/Documentation/media/uapi/dvb/video-command.rst @@ -59,6 +59,36 @@ subset of the ``v4l2_decoder_cmd`` struct, so refer to the :ref:`VIDIOC_DECODER_CMD` documentation for more information. +.. c:type:: struct video_command + +.. code-block:: c + + /* The structure must be zeroed before use by the application + This ensures it can be extended safely in the future. */ + struct video_command { + __u32 cmd; + __u32 flags; + union { + struct { + __u64 pts; + } stop; + + struct { + /* 0 or 1000 specifies normal speed, + 1 specifies forward single stepping, + -1 specifies backward single stepping, + >1: playback at speed/1000 of the normal speed, + <-1: reverse playback at (-speed/1000) of the normal speed. */ + __s32 speed; + __u32 format; + } play; + + struct { + __u32 data[16]; + } raw; + }; + }; + Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-get-event.rst b/Documentation/media/uapi/dvb/video-get-event.rst index 8c0c622c380b..6ad14cdb894a 100644 --- a/Documentation/media/uapi/dvb/video-get-event.rst +++ b/Documentation/media/uapi/dvb/video-get-event.rst @@ -64,6 +64,23 @@ included in the exceptfds argument, and for poll(), POLLPRI should be specified as the wake-up condition. Read-only permissions are sufficient for this ioctl call. +.. c:type:: video_event + +.. code-block:: c + + struct video_event { + __s32 type; + #define VIDEO_EVENT_SIZE_CHANGED 1 + #define VIDEO_EVENT_FRAME_RATE_CHANGED 2 + #define VIDEO_EVENT_DECODER_STOPPED 3 + #define VIDEO_EVENT_VSYNC 4 + __kernel_time_t timestamp; + union { + video_size_t size; + unsigned int frame_rate; /* in frames per 1000sec */ + unsigned char vsync_field; /* unknown/odd/even/progressive */ + } u; + }; Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-get-navi.rst b/Documentation/media/uapi/dvb/video-get-navi.rst index b8de9ccf38c2..114a9ac48b9e 100644 --- a/Documentation/media/uapi/dvb/video-get-navi.rst +++ b/Documentation/media/uapi/dvb/video-get-navi.rst @@ -16,7 +16,7 @@ VIDEO_GET_NAVI Synopsis -------- -.. c:function:: int ioctl(fd, VIDEO_GET_NAVI , video_navi_pack_t *navipack) +.. c:function:: int ioctl(fd, VIDEO_GET_NAVI , struct video_navi_pack *navipack) :name: VIDEO_GET_NAVI @@ -54,6 +54,14 @@ This ioctl returns navigational information from the DVD stream. This is especially needed if an encoded stream has to be decoded by the hardware. +.. c:type:: video_navi_pack + +.. code-block::c + + typedef struct video_navi_pack { + int length; /* 0 ... 1024 */ + __u8 data[1024]; + } video_navi_pack_t; Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-get-size.rst b/Documentation/media/uapi/dvb/video-get-size.rst index ce8b4c6b41a5..d077fe2305a0 100644 --- a/Documentation/media/uapi/dvb/video-get-size.rst +++ b/Documentation/media/uapi/dvb/video-get-size.rst @@ -52,6 +52,16 @@ Description This ioctl returns the size and aspect ratio. +.. c:type:: video_size_t + +.. code-block::c + + typedef struct { + int w; + int h; + video_format_t aspect_ratio; + } video_size_t; + Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-get-status.rst b/Documentation/media/uapi/dvb/video-get-status.rst index 7b6a278b5246..ed6ea19827a6 100644 --- a/Documentation/media/uapi/dvb/video-get-status.rst +++ b/Documentation/media/uapi/dvb/video-get-status.rst @@ -53,6 +53,17 @@ Description This ioctl call asks the Video Device to return the current status of the device. +.. c:type:: video_status + +.. code-block:: c + + struct video_status { + int video_blank; /* blank video on freeze? */ + video_play_state_t play_state; /* current state of playback */ + video_stream_source_t stream_source; /* current source (demux/memory) */ + video_format_t video_format; /* current aspect ratio of stream*/ + video_displayformat_t display_format;/* selected cropping mode */ + }; Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-select-source.rst b/Documentation/media/uapi/dvb/video-select-source.rst index eaa1088f07da..2f4fbf4b490c 100644 --- a/Documentation/media/uapi/dvb/video-select-source.rst +++ b/Documentation/media/uapi/dvb/video-select-source.rst @@ -58,6 +58,16 @@ This ioctl call informs the video device which source shall be used for the input data. The possible sources are demux or memory. If memory is selected, the data is fed to the video device through the write command. +.. c:type:: video_stream_source_t + +.. code-block:: c + + typedef enum { + VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ + VIDEO_SOURCE_MEMORY /* If this source is selected, the stream + comes from the user through the write + system call */ + } video_stream_source_t; Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-set-attributes.rst b/Documentation/media/uapi/dvb/video-set-attributes.rst index 8901520d7e43..b2f11a6746e9 100644 --- a/Documentation/media/uapi/dvb/video-set-attributes.rst +++ b/Documentation/media/uapi/dvb/video-set-attributes.rst @@ -55,6 +55,22 @@ information about the stream. Some hardware may not need this information, but the call also tells the hardware to prepare for DVD playback. +.. c:type:: video_attributes_t + +.. code-block::c + + typedef __u16 video_attributes_t; + /* bits: descr. */ + /* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ + /* 13-12 TV system (0=525/60, 1=625/50) */ + /* 11-10 Aspect ratio (0=4:3, 3=16:9) */ + /* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */ + /* 7 line 21-1 data present in GOP (1=yes, 0=no) */ + /* 6 line 21-2 data present in GOP (1=yes, 0=no) */ + /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ + /* 2 source letterboxed (1=yes, 0=no) */ + /* 0 film/camera mode (0=camera, 1=film (625/50 only)) */ + Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-set-display-format.rst b/Documentation/media/uapi/dvb/video-set-display-format.rst index 6abf19479939..2ef7401781be 100644 --- a/Documentation/media/uapi/dvb/video-set-display-format.rst +++ b/Documentation/media/uapi/dvb/video-set-display-format.rst @@ -16,7 +16,7 @@ VIDEO_SET_DISPLAY_FORMAT Synopsis -------- -.. c:function:: int ioctl(fd, VIDEO_SET_DISPLAY_FORMAT, video_display_format_t format) +.. c:function:: int ioctl(fd, VIDEO_SET_DISPLAY_FORMAT) :name: VIDEO_SET_DISPLAY_FORMAT diff --git a/Documentation/media/uapi/dvb/video-set-format.rst b/Documentation/media/uapi/dvb/video-set-format.rst index 117618525538..4239a4e365bb 100644 --- a/Documentation/media/uapi/dvb/video-set-format.rst +++ b/Documentation/media/uapi/dvb/video-set-format.rst @@ -54,6 +54,15 @@ This ioctl sets the screen format (aspect ratio) of the connected output device (TV) so that the output of the decoder can be adjusted accordingly. +.. c:type:: video_format_t + +.. code-block:: c + + typedef enum { + VIDEO_FORMAT_4_3, /* Select 4:3 format */ + VIDEO_FORMAT_16_9, /* Select 16:9 format. */ + VIDEO_FORMAT_221_1 /* 2.21:1 */ + } video_format_t; Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-set-highlight.rst b/Documentation/media/uapi/dvb/video-set-highlight.rst index d93b69eef15b..90aeafd923b7 100644 --- a/Documentation/media/uapi/dvb/video-set-highlight.rst +++ b/Documentation/media/uapi/dvb/video-set-highlight.rst @@ -16,7 +16,7 @@ VIDEO_SET_HIGHLIGHT Synopsis -------- -.. c:function:: int ioctl(fd, VIDEO_SET_HIGHLIGHT ,video_highlight_t *vhilite) +.. c:function:: int ioctl(fd, VIDEO_SET_HIGHLIGHT, struct video_highlight *vhilite) :name: VIDEO_SET_HIGHLIGHT @@ -53,6 +53,30 @@ Description This ioctl sets the SPU highlight information for the menu access of a DVD. +.. c:type:: video_highlight + +.. code-block:: c + + typedef + struct video_highlight { + int active; /* 1=show highlight, 0=hide highlight */ + __u8 contrast1; /* 7- 4 Pattern pixel contrast */ + /* 3- 0 Background pixel contrast */ + __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */ + /* 3- 0 Emphasis pixel-1 contrast */ + __u8 color1; /* 7- 4 Pattern pixel color */ + /* 3- 0 Background pixel color */ + __u8 color2; /* 7- 4 Emphasis pixel-2 color */ + /* 3- 0 Emphasis pixel-1 color */ + __u32 ypos; /* 23-22 auto action mode */ + /* 21-12 start y */ + /* 9- 0 end y */ + __u32 xpos; /* 23-22 button color number */ + /* 21-12 start x */ + /* 9- 0 end x */ + } video_highlight_t; + + Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-set-spu-palette.rst b/Documentation/media/uapi/dvb/video-set-spu-palette.rst index b24f7882089a..51a1913d21d2 100644 --- a/Documentation/media/uapi/dvb/video-set-spu-palette.rst +++ b/Documentation/media/uapi/dvb/video-set-spu-palette.rst @@ -16,7 +16,7 @@ VIDEO_SET_SPU_PALETTE Synopsis -------- -.. c:function:: int ioctl(fd, VIDEO_SET_SPU_PALETTE, video_spu_palette_t *palette ) +.. c:function:: int ioctl(fd, VIDEO_SET_SPU_PALETTE, struct video_spu_palette *palette ) :name: VIDEO_SET_SPU_PALETTE @@ -52,6 +52,14 @@ Description This ioctl sets the SPU color palette. +.. c:type:: video_spu_palette + +.. code-block::c + + typedef struct video_spu_palette { /* SPU Palette information */ + int length; + __u8 __user *palette; + } video_spu_palette_t; Return Value ------------ diff --git a/Documentation/media/uapi/dvb/video-set-spu.rst b/Documentation/media/uapi/dvb/video-set-spu.rst index 2a7f0625de38..739e5e7bd133 100644 --- a/Documentation/media/uapi/dvb/video-set-spu.rst +++ b/Documentation/media/uapi/dvb/video-set-spu.rst @@ -16,7 +16,7 @@ VIDEO_SET_SPU Synopsis -------- -.. c:function:: int ioctl(fd, VIDEO_SET_SPU , video_spu_t *spu) +.. c:function:: int ioctl(fd, VIDEO_SET_SPU , struct video_spu *spu) :name: VIDEO_SET_SPU @@ -54,6 +54,15 @@ Description This ioctl activates or deactivates SPU decoding in a DVD input stream. It can only be used, if the driver is able to handle a DVD stream. +.. c:type:: struct video_spu + +.. code-block:: c + + typedef struct video_spu { + int active; + int stream_id; + } video_spu_t; + Return Value ------------ diff --git a/include/uapi/linux/dvb/video.h b/include/uapi/linux/dvb/video.h index 49392564f9d6..260f033a5b54 100644 --- a/include/uapi/linux/dvb/video.h +++ b/include/uapi/linux/dvb/video.h @@ -206,7 +206,8 @@ typedef __u16 video_attributes_t; /* 6 line 21-2 data present in GOP (1=yes, 0=no) */ /* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */ /* 2 source letterboxed (1=yes, 0=no) */ -/* 0 film/camera mode (0=camera, 1=film (625/50 only)) */ +/* 0 film/camera mode (0= + *camera, 1=film (625/50 only)) */ /* bit definitions for capabilities: */ From 180965cb0826bfc90d420c627f1ff84e215fa9f1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 18:57:07 -0300 Subject: [PATCH 333/591] [media] docs-rst: fix dmx bad cross-references Some structs are pointed via the typedef. As we replaced those references, fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/dvb/dmx-get-caps.rst | 5 ++--- Documentation/media/uapi/dvb/dmx-set-source.rst | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Documentation/media/uapi/dvb/dmx-get-caps.rst b/Documentation/media/uapi/dvb/dmx-get-caps.rst index aaf084a245fd..145fb520d779 100644 --- a/Documentation/media/uapi/dvb/dmx-get-caps.rst +++ b/Documentation/media/uapi/dvb/dmx-get-caps.rst @@ -15,7 +15,7 @@ DMX_GET_CAPS Synopsis -------- -.. c:function:: int ioctl(fd, DMX_GET_CAPS, dmx_caps_t *caps) +.. c:function:: int ioctl(fd, DMX_GET_CAPS, struct dmx_caps *caps) :name: DMX_GET_CAPS Arguments @@ -25,7 +25,7 @@ Arguments File descriptor returned by :c:func:`open() `. ``caps`` - Undocumented. + Pointer to struct :c:type:`dmx_caps` Description @@ -33,7 +33,6 @@ Description .. note:: This ioctl is undocumented. Documentation is welcome. - Return Value ------------ diff --git a/Documentation/media/uapi/dvb/dmx-set-source.rst b/Documentation/media/uapi/dvb/dmx-set-source.rst index a232fd6e5f52..ac7f77b25e06 100644 --- a/Documentation/media/uapi/dvb/dmx-set-source.rst +++ b/Documentation/media/uapi/dvb/dmx-set-source.rst @@ -15,7 +15,7 @@ DMX_SET_SOURCE Synopsis -------- -.. c:function:: int ioctl(fd, DMX_SET_SOURCE, dmx_source_t *src) +.. c:function:: int ioctl(fd, DMX_SET_SOURCE, struct dmx_source *src) :name: DMX_SET_SOURCE From 2606eee43cbceb1356ddb11a5f3cc9a89a0cec66 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Aug 2016 19:15:05 -0300 Subject: [PATCH 334/591] [media] docs-rst: fix cec bad cross-references Fix some CEC cross references that are broken. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/cec.h.rst.exceptions | 6 ------ .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst | 10 +++++----- Documentation/media/uapi/cec/cec-ioc-receive.rst | 9 +++++---- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Documentation/media/cec.h.rst.exceptions b/Documentation/media/cec.h.rst.exceptions index b79339433718..b1687532742f 100644 --- a/Documentation/media/cec.h.rst.exceptions +++ b/Documentation/media/cec.h.rst.exceptions @@ -1,12 +1,6 @@ # Ignore header name ignore define _CEC_UAPI_H -# Rename some symbols, to avoid namespace conflicts -replace struct cec_event_state_change cec-event-state-change_s -replace struct cec_event_lost_msgs cec-event-lost-msgs_s -replace enum cec_mode_initiator cec-mode-initiator_e -replace enum cec_mode_follower cec-mode-follower_e - # define macros to ignore ignore define CEC_MAX_MSG_SIZE diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index bd0756ff022e..6c314c2db73e 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst @@ -30,7 +30,7 @@ Arguments File descriptor returned by :c:func:`open() `. ``argp`` - Pointer to struct cec_log_addrs + Pointer to struct :c:type:`cec_log_addrs`. Description =========== @@ -42,10 +42,10 @@ Description To query the current CEC logical addresses, applications call :ref:`ioctl CEC_ADAP_G_LOG_ADDRS ` with a pointer to a -:c:type:`struct cec_log_addrs` where the driver stores the logical addresses. +struct :c:type:`cec_log_addrs` where the driver stores the logical addresses. To set new logical addresses, applications fill in -:c:type:`struct cec_log_addrs` and call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` +struct :c:type:`cec_log_addrs` and call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` with a pointer to this struct. The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` is only available if ``CEC_CAP_LOG_ADDRS`` is set (the ``ENOTTY`` error code is returned otherwise). The :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` @@ -66,10 +66,10 @@ logical addresses are claimed or cleared. Attempting to call :ref:`ioctl CEC_ADAP_S_LOG_ADDRS ` when logical address types are already defined will return with error ``EBUSY``. -.. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}| - .. c:type:: cec_log_addrs +.. tabularcolumns:: |p{1.0cm}|p{7.5cm}|p{8.0cm}| + .. cssclass:: longtable .. flat-table:: struct cec_log_addrs diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index f015f1259b27..18620f81b7d9 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -40,7 +40,8 @@ Description and is currently only available as a staging kernel module. To receive a CEC message the application has to fill in the -``timeout`` field of :c:type:`struct cec_msg` and pass it to :ref:`ioctl CEC_RECEIVE `. +``timeout`` field of struct :c:type:`cec_msg` and pass it to +:ref:`ioctl CEC_RECEIVE `. If the file descriptor is in non-blocking mode and there are no received messages pending, then it will return -1 and set errno to the ``EAGAIN`` error code. If the file descriptor is in blocking mode and ``timeout`` @@ -54,9 +55,9 @@ A received message can be: 2. the result of an earlier non-blocking transmit (the ``sequence`` field will be non-zero). -To send a CEC message the application has to fill in the -:c:type:`struct cec_msg` and pass it to -:ref:`ioctl CEC_TRANSMIT `. The :ref:`ioctl CEC_TRANSMIT ` is only available if +To send a CEC message the application has to fill in the struct +:c:type:` cec_msg` and pass it to :ref:`ioctl CEC_TRANSMIT `. +The :ref:`ioctl CEC_TRANSMIT ` is only available if ``CEC_CAP_TRANSMIT`` is set. If there is no more room in the transmit queue, then it will return -1 and set errno to the ``EBUSY`` error code. The transmit queue has enough room for 18 messages (about 1 second worth From fc78c7c7a1747912293ad9f78374f5be7f0acc6d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 05:43:01 -0300 Subject: [PATCH 335/591] [media] docs-rst: simplify c:type: cross references Instead of using c:type:`struct foo `, use: struct c:type:`foo` This patch was generated via this shell script: for i in `find Documentation/media -type f`; do perl -ne 'if (m/\:c\:type\:\`struct\s+(\S+)\s*\<(\S+)\>\`/) { $s=$1; $r=$2; if ($s eq $r) { s/\:c\:type\:\`struct\s+(\S+)\s*\<(\S+)\>\`/struct :c:type:`$2`/; s/struct\s+struct/struct/; s/(struct\s+\:c\:type\:\`\S+\`)\s+structure/$1/; }} print $_' <$i >a && mv a $i; done Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/mc-core.rst | 24 +++++++++---------- Documentation/media/uapi/dvb/dvbproperty.rst | 2 +- Documentation/media/uapi/v4l/buffer.rst | 12 +++++----- Documentation/media/uapi/v4l/dev-osd.rst | 2 +- Documentation/media/uapi/v4l/dev-overlay.rst | 2 +- .../media/uapi/v4l/dev-sliced-vbi.rst | 6 ++--- .../media/uapi/v4l/extended-controls.rst | 2 +- Documentation/media/uapi/v4l/pixfmt-002.rst | 4 ++-- Documentation/media/uapi/v4l/pixfmt-003.rst | 6 ++--- Documentation/media/uapi/v4l/pixfmt.rst | 4 ++-- .../media/uapi/v4l/vidioc-create-bufs.rst | 2 +- .../media/uapi/v4l/vidioc-enumstd.rst | 2 +- .../media/uapi/v4l/vidioc-g-audio.rst | 2 +- .../media/uapi/v4l/vidioc-g-audioout.rst | 2 +- .../media/uapi/v4l/vidioc-g-crop.rst | 2 +- .../media/uapi/v4l/vidioc-g-ctrl.rst | 4 ++-- .../media/uapi/v4l/vidioc-g-fbuf.rst | 4 ++-- Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 4 ++-- .../media/uapi/v4l/vidioc-g-parm.rst | 2 +- Documentation/media/uapi/v4l/vidioc-g-std.rst | 2 +- .../media/uapi/v4l/vidioc-g-tuner.rst | 2 +- .../media/uapi/v4l/vidioc-prepare-buf.rst | 2 +- Documentation/media/uapi/v4l/vidioc-qbuf.rst | 4 ++-- .../media/uapi/v4l/vidioc-querybuf.rst | 2 +- .../media/uapi/v4l/vidioc-reqbufs.rst | 2 +- 25 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Documentation/media/kapi/mc-core.rst b/Documentation/media/kapi/mc-core.rst index fb839a6c1f46..1a738e5f6056 100644 --- a/Documentation/media/kapi/mc-core.rst +++ b/Documentation/media/kapi/mc-core.rst @@ -34,7 +34,7 @@ pad to a sink pad. Media device ^^^^^^^^^^^^ -A media device is represented by a :c:type:`struct media_device ` +A media device is represented by a struct :c:type:`media_device` instance, defined in ``include/media/media-device.h``. Allocation of the structure is handled by the media device driver, usually by embedding the :c:type:`media_device` instance in a larger driver-specific @@ -47,7 +47,7 @@ and unregistered by calling :c:func:`media_device_unregister()`. Entities ^^^^^^^^ -Entities are represented by a :c:type:`struct media_entity ` +Entities are represented by a struct :c:type:`media_entity` instance, defined in ``include/media/media-entity.h``. The structure is usually embedded into a higher-level structure, such as :c:type:`v4l2_subdev` or :c:type:`video_device` @@ -65,10 +65,10 @@ Interfaces ^^^^^^^^^^ Interfaces are represented by a -:c:type:`struct media_interface ` instance, defined in +struct :c:type:`media_interface` instance, defined in ``include/media/media-entity.h``. Currently, only one type of interface is defined: a device node. Such interfaces are represented by a -:c:type:`struct media_intf_devnode `. +struct :c:type:`media_intf_devnode`. Drivers initialize and create device node interfaces by calling :c:func:`media_devnode_create()` @@ -77,7 +77,7 @@ and remove them by calling: Pads ^^^^ -Pads are represented by a :c:type:`struct media_pad ` instance, +Pads are represented by a struct :c:type:`media_pad` instance, defined in ``include/media/media-entity.h``. Each entity stores its pads in a pads array managed by the entity driver. Drivers usually embed the array in a driver-specific structure. @@ -85,8 +85,8 @@ a driver-specific structure. Pads are identified by their entity and their 0-based index in the pads array. -Both information are stored in the :c:type:`struct media_pad `, -making the :c:type:`struct media_pad ` pointer the canonical way +Both information are stored in the struct :c:type:`media_pad`, +making the struct :c:type:`media_pad` pointer the canonical way to store and pass link references. Pads have flags that describe the pad capabilities and state. @@ -102,7 +102,7 @@ Pads have flags that describe the pad capabilities and state. Links ^^^^^ -Links are represented by a :c:type:`struct media_link ` instance, +Links are represented by a struct :c:type:`media_link` instance, defined in ``include/media/media-entity.h``. There are two types of links: **1. pad to pad links**: @@ -185,7 +185,7 @@ Use count and power handling Due to the wide differences between drivers regarding power management needs, the media controller does not implement power management. However, -the :c:type:`struct media_entity ` includes a ``use_count`` +the struct :c:type:`media_entity` includes a ``use_count`` field that media drivers can use to track the number of users of every entity for power management needs. @@ -211,11 +211,11 @@ prevent link states from being modified during streaming by calling The function will mark all entities connected to the given entity through enabled links, either directly or indirectly, as streaming. -The :c:type:`struct media_pipeline ` instance pointed to by +The struct :c:type:`media_pipeline` instance pointed to by the pipe argument will be stored in every entity in the pipeline. -Drivers should embed the :c:type:`struct media_pipeline ` +Drivers should embed the struct :c:type:`media_pipeline` in higher-level pipeline structures and can then access the -pipeline through the :c:type:`struct media_entity ` +pipeline through the struct :c:type:`media_entity` pipe field. Calls to :c:func:`media_entity_pipeline_start()` can be nested. diff --git a/Documentation/media/uapi/dvb/dvbproperty.rst b/Documentation/media/uapi/dvb/dvbproperty.rst index 906f3e651e10..dd2d71ce43fa 100644 --- a/Documentation/media/uapi/dvb/dvbproperty.rst +++ b/Documentation/media/uapi/dvb/dvbproperty.rst @@ -23,7 +23,7 @@ union/struct based approach, in favor of a properties set approach. .. note:: On Linux DVB API version 3, setting a frontend were done via - :c:type:`struct dvb_frontend_parameters `. + struct :c:type:`dvb_frontend_parameters`. This got replaced on version 5 (also called "S2API", as this API were added originally_enabled to provide support for DVB-S2), because the old API has a very limited support to new standards and new hardware. diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index a52a586b0b41..7b64a1986d66 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -11,14 +11,14 @@ the Streaming I/O methods. In the multi-planar API, the data is held in planes, while the buffer structure acts as a container for the planes. Only pointers to buffers (planes) are exchanged, the data itself is not copied. These pointers, together with meta-information like timestamps -or field parity, are stored in a struct :c:type:`struct v4l2_buffer `, +or field parity, are stored in a struct :c:type:`v4l2_buffer`, argument to the :ref:`VIDIOC_QUERYBUF`, :ref:`VIDIOC_QBUF` and :ref:`VIDIOC_DQBUF ` ioctl. In the multi-planar API, -some plane-specific members of struct :c:type:`struct v4l2_buffer `, +some plane-specific members of struct :c:type:`v4l2_buffer`, such as pointers and sizes for each plane, are stored in struct -:c:type:`struct v4l2_plane ` instead. In that case, struct -:c:type:`struct v4l2_buffer ` contains an array of plane structures. +struct :c:type:`v4l2_plane` instead. In that case, struct +struct :c:type:`v4l2_buffer` contains an array of plane structures. Dequeued video buffers come with timestamps. The driver decides at which part of the frame and with which clock the timestamp is taken. Please @@ -231,7 +231,7 @@ struct v4l2_buffer - When using the multi-planar API, contains a userspace pointer to an array of struct :c:type:`v4l2_plane`. The size of the array should be put in the ``length`` field of this - :c:type:`struct v4l2_buffer ` structure. + struct :c:type:`v4l2_buffer` structure. - .. row 15 @@ -823,7 +823,7 @@ enum v4l2_memory Timecodes ========= -The :c:type:`struct v4l2_timecode ` structure is designed to hold a +The struct :c:type:`v4l2_timecode` structure is designed to hold a :ref:`smpte12m` or similar timecode. (struct :c:type:`struct timeval` timestamps are stored in struct :c:type:`v4l2_buffer` field ``timestamp``.) diff --git a/Documentation/media/uapi/v4l/dev-osd.rst b/Documentation/media/uapi/v4l/dev-osd.rst index a6aaf28807a4..0b246c31b6a3 100644 --- a/Documentation/media/uapi/v4l/dev-osd.rst +++ b/Documentation/media/uapi/v4l/dev-osd.rst @@ -121,7 +121,7 @@ parameters applications set the ``type`` field of a struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY`` and call the :ref:`VIDIOC_G_FMT ` ioctl. The driver fills the -:c:type:`struct v4l2_window ` substructure named ``win``. It is not +struct :c:type:`v4l2_window` substructure named ``win``. It is not possible to retrieve a previously programmed clipping list or bitmap. To program the source rectangle applications set the ``type`` field of a diff --git a/Documentation/media/uapi/v4l/dev-overlay.rst b/Documentation/media/uapi/v4l/dev-overlay.rst index 4962947bd8a2..9be14b55e305 100644 --- a/Documentation/media/uapi/v4l/dev-overlay.rst +++ b/Documentation/media/uapi/v4l/dev-overlay.rst @@ -125,7 +125,7 @@ To get the current parameters applications set the ``type`` field of a struct :c:type:`v4l2_format` to ``V4L2_BUF_TYPE_VIDEO_OVERLAY`` and call the :ref:`VIDIOC_G_FMT ` ioctl. The driver fills the -:c:type:`struct v4l2_window ` substructure named ``win``. It is not +struct :c:type:`v4l2_window` substructure named ``win``. It is not possible to retrieve a previously programmed clipping list or bitmap. To program the overlay window applications set the ``type`` field of a diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst index 2a979aa138bd..7f159c3d4942 100644 --- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst @@ -77,7 +77,7 @@ member, a struct Applications can request different parameters by initializing or modifying the ``fmt.sliced`` member and calling the :ref:`VIDIOC_S_FMT ` ioctl with a pointer to the -:c:type:`struct v4l2_format ` structure. +struct :c:type:`v4l2_format` structure. The sliced VBI API is more complicated than the raw VBI API because the hardware must be told which VBI service to expect on each scan line. Not @@ -376,11 +376,11 @@ Reading and writing sliced VBI data A single :ref:`read() ` or :ref:`write() ` call must pass all data belonging to one video frame. That is an array -of :c:type:`struct v4l2_sliced_vbi_data ` structures with one or +of struct :c:type:`v4l2_sliced_vbi_data` structures with one or more elements and a total size not exceeding ``io_size`` bytes. Likewise in streaming I/O mode one buffer of ``io_size`` bytes must contain data of one video frame. The ``id`` of unused -:c:type:`struct v4l2_sliced_vbi_data ` elements must be zero. +struct :c:type:`v4l2_sliced_vbi_data` elements must be zero. .. c:type:: v4l2_sliced_vbi_data diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 75359739eb52..85e536971923 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -66,7 +66,7 @@ whether the specified control class is supported. The control array is a struct :c:type:`v4l2_ext_control` array. The -:c:type:`struct v4l2_ext_control ` structure is very similar to +struct :c:type:`v4l2_ext_control` is very similar to struct :c:type:`v4l2_control`, except for the fact that it also allows for 64-bit values and pointers to be passed. diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst b/Documentation/media/uapi/v4l/pixfmt-002.rst index 789937900d14..28f14e41631c 100644 --- a/Documentation/media/uapi/v4l/pixfmt-002.rst +++ b/Documentation/media/uapi/v4l/pixfmt-002.rst @@ -136,7 +136,7 @@ Single-planar format structure - ``priv`` - This field indicates whether the remaining fields of the - :c:type:`struct v4l2_pix_format ` structure, also called the + struct :c:type:`v4l2_pix_format`, also called the extended fields, are valid. When set to ``V4L2_PIX_FMT_PRIV_MAGIC``, it indicates that the extended fields have been correctly initialized. When set to any other value it @@ -152,7 +152,7 @@ Single-planar format structure To use the extended fields, applications must set the ``priv`` field to ``V4L2_PIX_FMT_PRIV_MAGIC``, initialize all the extended fields and zero the unused bytes of the - :c:type:`struct v4l2_format ` ``raw_data`` field. + struct :c:type:`v4l2_format` ``raw_data`` field. When the ``priv`` field isn't set to ``V4L2_PIX_FMT_PRIV_MAGIC`` drivers must act as if all the extended fields were set to zero. diff --git a/Documentation/media/uapi/v4l/pixfmt-003.rst b/Documentation/media/uapi/v4l/pixfmt-003.rst index b214b818baa7..e39fa2b732d7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-003.rst +++ b/Documentation/media/uapi/v4l/pixfmt-003.rst @@ -4,11 +4,11 @@ Multi-planar format structures ****************************** -The :c:type:`struct v4l2_plane_pix_format ` structures define size +The struct :c:type:`v4l2_plane_pix_format` structures define size and layout for each of the planes in a multi-planar format. The -:c:type:`struct v4l2_pix_format_mplane ` structure contains +struct :c:type:`v4l2_pix_format_mplane` structure contains information common to all planes (such as image width and height) and an -array of :c:type:`struct v4l2_plane_pix_format ` structures, +array of struct :c:type:`v4l2_plane_pix_format` structures, describing all planes of that format. diff --git a/Documentation/media/uapi/v4l/pixfmt.rst b/Documentation/media/uapi/v4l/pixfmt.rst index a6b7871e39e7..4d297f6eb5f1 100644 --- a/Documentation/media/uapi/v4l/pixfmt.rst +++ b/Documentation/media/uapi/v4l/pixfmt.rst @@ -6,8 +6,8 @@ Image Formats ############# The V4L2 API was primarily designed for devices exchanging image data -with applications. The :c:type:`struct v4l2_pix_format ` and -:c:type:`struct v4l2_pix_format_mplane ` structures define the +with applications. The struct :c:type:`v4l2_pix_format` and +struct :c:type:`v4l2_pix_format_mplane` structures define the format and layout of an image in memory. The former is used with the single-planar API, while the latter is used with the multi-planar version (see :ref:`planar-apis`). Image formats are negotiated with diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst index c53fdcc3666a..b93422400608 100644 --- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst @@ -39,7 +39,7 @@ over buffers is required. This ioctl can be called multiple times to create buffers of different sizes. To allocate the device buffers applications must initialize the relevant -fields of the :c:type:`struct v4l2_create_buffers ` structure. The +fields of the struct :c:type:`v4l2_create_buffers` structure. The ``count`` field must be set to the number of requested buffers, the ``memory`` field specifies the requested I/O method and the ``reserved`` array must be zeroed. diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index eaac7a2e14c4..7a3a6d6aeb17 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -71,7 +71,7 @@ or output. [#f1]_ set as custom standards. Multiple bits can be set if the hardware does not distinguish between these standards, however separate indices do not indicate the opposite. The ``id`` must be unique. - No other enumerated :c:type:`struct v4l2_standard ` structure, + No other enumerated struct :c:type:`v4l2_standard` structure, for this input or output anyway, can contain the same set of bits. - .. row 3 diff --git a/Documentation/media/uapi/v4l/vidioc-g-audio.rst b/Documentation/media/uapi/v4l/vidioc-g-audio.rst index ebf2514464fc..60520318cb4a 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audio.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audio.rst @@ -43,7 +43,7 @@ has no audio inputs, or none which combine with the current video input. Audio inputs have one writable property, the audio mode. To select the current audio input *and* change the audio mode, applications initialize the ``index`` and ``mode`` fields, and the ``reserved`` array of a -:c:type:`struct v4l2_audio ` structure and call the :ref:`VIDIOC_S_AUDIO ` +struct :c:type:`v4l2_audio` structure and call the :ref:`VIDIOC_S_AUDIO ` ioctl. Drivers may switch to a different audio mode if the request cannot be satisfied. However, this is a write-only ioctl, it does not return the actual new audio mode. diff --git a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst index b21794300efd..e9d264590788 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst @@ -44,7 +44,7 @@ output. Audio outputs have no writable properties. Nevertheless, to select the current audio output applications can initialize the ``index`` field and ``reserved`` array (which in the future may contain writable properties) -of a :c:type:`struct v4l2_audioout ` structure and call the +of a struct :c:type:`v4l2_audioout` structure and call the ``VIDIOC_S_AUDOUT`` ioctl. Drivers switch to the requested output or return the ``EINVAL`` error code when the index is out of bounds. This is a write-only ioctl, it does not return the current audio output attributes diff --git a/Documentation/media/uapi/v4l/vidioc-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-g-crop.rst index b99032e59ebe..4ddd8c08fd1c 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-crop.rst @@ -35,7 +35,7 @@ Description =========== To query the cropping rectangle size and position applications set the -``type`` field of a :c:type:`struct v4l2_crop ` structure to the +``type`` field of a struct :c:type:`v4l2_crop` structure to the respective buffer (stream) type and call the :ref:`VIDIOC_G_CROP ` ioctl with a pointer to this structure. The driver fills the rest of the structure or returns the ``EINVAL`` error code if cropping is not supported. diff --git a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst index 53a6ebe6f744..78c191a89360 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst @@ -35,10 +35,10 @@ Description =========== To get the current value of a control applications initialize the ``id`` -field of a struct :c:type:`struct v4l2_control ` and call the +field of a struct :c:type:`v4l2_control` and call the :ref:`VIDIOC_G_CTRL ` ioctl with a pointer to this structure. To change the value of a control applications initialize the ``id`` and ``value`` -fields of a struct :c:type:`struct v4l2_control ` and call the +fields of a struct :c:type:`v4l2_control` and call the :ref:`VIDIOC_S_CTRL ` ioctl. When the ``id`` is invalid drivers return an ``EINVAL`` error code. When the diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index 7ade2f7d62be..4ac2625e545d 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -49,13 +49,13 @@ VGA signal or graphics into a video signal. *Video Output Overlays* are always non-destructive. To get the current parameters applications call the :ref:`VIDIOC_G_FBUF ` -ioctl with a pointer to a :c:type:`struct v4l2_framebuffer ` +ioctl with a pointer to a struct :c:type:`v4l2_framebuffer` structure. The driver fills all fields of the structure or returns an EINVAL error code when overlays are not supported. To set the parameters for a *Video Output Overlay*, applications must initialize the ``flags`` field of a struct -:c:type:`struct v4l2_framebuffer `. Since the framebuffer is +struct :c:type:`v4l2_framebuffer`. Since the framebuffer is implemented on the TV card all other parameters are determined by the driver. When an application calls :ref:`VIDIOC_S_FBUF ` with a pointer to this structure, the driver prepares for the overlay and returns the diff --git a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst index dd6c062d267c..037437d66f08 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst @@ -40,7 +40,7 @@ These ioctls are used to negotiate the format of data (typically image format) exchanged between driver and application. To query the current parameters applications set the ``type`` field of a -struct :c:type:`struct v4l2_format ` to the respective buffer (stream) +struct :c:type:`v4l2_format` to the respective buffer (stream) type. For example video capture devices use ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` or ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``. When the application calls the @@ -58,7 +58,7 @@ For details see the documentation of the various devices types in :ref:`devices`. Good practice is to query the current parameters first, and to modify only those parameters not suitable for the application. When the application calls the :ref:`VIDIOC_S_FMT ` ioctl with -a pointer to a :c:type:`struct v4l2_format ` structure the driver +a pointer to a struct :c:type:`v4l2_format` structure the driver checks and adjusts the parameters against hardware abilities. Drivers should not return an error code unless the ``type`` field is invalid, this is a mechanism to fathom device capabilities and to approach diff --git a/Documentation/media/uapi/v4l/vidioc-g-parm.rst b/Documentation/media/uapi/v4l/vidioc-g-parm.rst index 021b96ee641d..689b5d92aeae 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-parm.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-parm.rst @@ -47,7 +47,7 @@ section discussing the :ref:`read() ` function. To get and set the streaming parameters applications call the :ref:`VIDIOC_G_PARM ` and :ref:`VIDIOC_S_PARM ` ioctl, respectively. They take a -pointer to a struct :c:type:`struct v4l2_streamparm ` which contains a +pointer to a struct :c:type:`v4l2_streamparm` which contains a union holding separate parameters for input and output devices. diff --git a/Documentation/media/uapi/v4l/vidioc-g-std.rst b/Documentation/media/uapi/v4l/vidioc-g-std.rst index c351eb9f6b0e..cd856ad21a28 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-std.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-std.rst @@ -40,7 +40,7 @@ To query and select the current video standard applications use the can return a single flag or a set of flags as in struct :c:type:`v4l2_standard` field ``id``. The flags must be unambiguous such that they appear in only one enumerated -:c:type:`struct v4l2_standard ` structure. +struct :c:type:`v4l2_standard` structure. :ref:`VIDIOC_S_STD ` accepts one or more flags, being a write-only ioctl it does not return the actual new standard as :ref:`VIDIOC_G_STD ` does. When diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index 01b7f26bf22f..077da39f3ae6 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -226,7 +226,7 @@ To change the radio frequency the received audio programs do not match. Currently this is the only field of struct - :c:type:`struct v4l2_tuner ` applications can change. + struct :c:type:`v4l2_tuner` applications can change. - .. row 15 diff --git a/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst b/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst index c20e1c7d5f89..bdcfd9fe550d 100644 --- a/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst +++ b/Documentation/media/uapi/v4l/vidioc-prepare-buf.rst @@ -40,7 +40,7 @@ operations are not required, the application can use one of ``V4L2_BUF_FLAG_NO_CACHE_INVALIDATE`` and ``V4L2_BUF_FLAG_NO_CACHE_CLEAN`` flags to skip the respective step. -The :c:type:`struct v4l2_buffer ` structure is specified in +The struct :c:type:`v4l2_buffer` structure is specified in :ref:`buffer`. diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst b/Documentation/media/uapi/v4l/vidioc-qbuf.rst index 727238fc2337..1f3612637200 100644 --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst @@ -46,7 +46,7 @@ Applications must also set the ``index`` field. Valid index numbers range from zero to the number of buffers allocated with :ref:`VIDIOC_REQBUFS` (struct :c:type:`v4l2_requestbuffers` ``count``) minus -one. The contents of the struct :c:type:`struct v4l2_buffer ` returned +one. The contents of the struct :c:type:`v4l2_buffer` returned by a :ref:`VIDIOC_QUERYBUF` ioctl will do as well. When the buffer is intended for output (``type`` is ``V4L2_BUF_TYPE_VIDEO_OUTPUT``, ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``, @@ -114,7 +114,7 @@ queue. When the ``O_NONBLOCK`` flag was given to the :ref:`open() ` function, ``VIDIOC_DQBUF`` returns immediately with an ``EAGAIN`` error code when no buffer is available. -The :c:type:`struct v4l2_buffer ` structure is specified in +The struct :c:type:`v4l2_buffer` structure is specified in :ref:`buffer`. diff --git a/Documentation/media/uapi/v4l/vidioc-querybuf.rst b/Documentation/media/uapi/v4l/vidioc-querybuf.rst index 1edd76c06e0a..0bdc8e0abddc 100644 --- a/Documentation/media/uapi/v4l/vidioc-querybuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-querybuf.rst @@ -63,7 +63,7 @@ elements will be used instead and the ``length`` field of struct array elements. The driver may or may not set the remaining fields and flags, they are meaningless in this context. -The :c:type:`struct v4l2_buffer ` structure is specified in +The struct :c:type:`v4l2_buffer` structure is specified in :ref:`buffer`. diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst index 195f0a3d783c..fc63045f4143 100644 --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst @@ -43,7 +43,7 @@ configures the driver into DMABUF I/O mode without performing any direct allocation. To allocate device buffers applications initialize all fields of the -:c:type:`struct v4l2_requestbuffers ` structure. They set the ``type`` +struct :c:type:`v4l2_requestbuffers` structure. They set the ``type`` field to the respective stream or buffer type, the ``count`` field to the desired number of buffers, ``memory`` must be set to the requested I/O method and the ``reserved`` array must be zeroed. When the ioctl is From a17a954efde487f4072a33f05c5388bc42c51efc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 05:48:50 -0300 Subject: [PATCH 336/591] [media] docs-rst: fix some broken struct references The :c:type: references point to the structure name, and not to struct foo. Fixed via this shell script: for i in `find Documentation/media -type f`; do perl -ne 'if (s/\:c\:type\:\`struct\s*(\S+)\`/struct :c:type:`$1`/) { s/struct\s+struct/struct/; s/(struct\s+\:c\:type\:\`\S+\`)\s+structure/$1/; } print $_' <$i >a && mv a $i; done Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/cec/cec-func-poll.rst | 2 +- Documentation/media/uapi/v4l/buffer.rst | 2 +- Documentation/media/uapi/v4l/dev-osd.rst | 4 +-- Documentation/media/uapi/v4l/hist-v4l2.rst | 34 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Documentation/media/uapi/cec/cec-func-poll.rst b/Documentation/media/uapi/cec/cec-func-poll.rst index 5bacb7c6f33b..cfb73e6027a5 100644 --- a/Documentation/media/uapi/cec/cec-func-poll.rst +++ b/Documentation/media/uapi/cec/cec-func-poll.rst @@ -49,7 +49,7 @@ events. On success :c:func:`poll()` returns the number of file descriptors that have been selected (that is, file descriptors for which the -``revents`` field of the respective :c:type:`struct pollfd` structure +``revents`` field of the respective struct :c:type:`pollfd` is non-zero). CEC devices set the ``POLLIN`` and ``POLLRDNORM`` flags in the ``revents`` field if there are messages in the receive queue. If the transmit queue has room for new messages, the ``POLLOUT`` and diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index 7b64a1986d66..7d2d81a771b1 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -825,7 +825,7 @@ Timecodes The struct :c:type:`v4l2_timecode` structure is designed to hold a :ref:`smpte12m` or similar timecode. (struct -:c:type:`struct timeval` timestamps are stored in struct +struct :c:type:`timeval` timestamps are stored in struct :c:type:`v4l2_buffer` field ``timestamp``.) diff --git a/Documentation/media/uapi/v4l/dev-osd.rst b/Documentation/media/uapi/v4l/dev-osd.rst index 0b246c31b6a3..71da85ed7e4b 100644 --- a/Documentation/media/uapi/v4l/dev-osd.rst +++ b/Documentation/media/uapi/v4l/dev-osd.rst @@ -44,8 +44,8 @@ other information, the physical address of the framebuffer in the ``base`` field of struct :c:type:`v4l2_framebuffer`. The framebuffer device ioctl ``FBIOGET_FSCREENINFO`` returns the same address in the ``smem_start`` field of struct -:c:type:`struct fb_fix_screeninfo`. The ``FBIOGET_FSCREENINFO`` -ioctl and struct :c:type:`struct fb_fix_screeninfo` are defined in +struct :c:type:`fb_fix_screeninfo`. The ``FBIOGET_FSCREENINFO`` +ioctl and struct :c:type:`fb_fix_screeninfo` are defined in the ``linux/fb.h`` header file. The width and height of the framebuffer depends on the current video diff --git a/Documentation/media/uapi/v4l/hist-v4l2.rst b/Documentation/media/uapi/v4l/hist-v4l2.rst index bd45431ed00e..b18fb7e6c39a 100644 --- a/Documentation/media/uapi/v4l/hist-v4l2.rst +++ b/Documentation/media/uapi/v4l/hist-v4l2.rst @@ -37,7 +37,7 @@ transmission arguments. enumerable. 1998-10-02: The ``id`` field was removed from struct -:c:type:`struct video_standard` and the color subcarrier fields were +struct :c:type:`video_standard` and the color subcarrier fields were renamed. The :ref:`VIDIOC_QUERYSTD` ioctl was renamed to :ref:`VIDIOC_ENUMSTD`, :ref:`VIDIOC_G_INPUT ` to @@ -151,7 +151,7 @@ common Linux driver API conventions. This change obsoletes the following ioctls: ``VIDIOC_S_INFMT``, ``VIDIOC_G_INFMT``, ``VIDIOC_S_OUTFMT``, ``VIDIOC_G_OUTFMT``, ``VIDIOC_S_VBIFMT`` and ``VIDIOC_G_VBIFMT``. The image format - structure :c:type:`struct v4l2_format` was renamed to struct + structure struct :c:type:`v4l2_format` was renamed to struct :c:type:`v4l2_pix_format`, while struct :c:type:`v4l2_format` is now the envelopping structure for all format negotiations. @@ -254,7 +254,7 @@ multiple tuners into account.) 2000-09-18: ``V4L2_BUF_TYPE_VBI`` was added. This may *break compatibility* as the :ref:`VIDIOC_G_FMT ` and :ref:`VIDIOC_S_FMT ` ioctls may fail now if the struct -:c:type:`struct v4l2_fmt` ``type`` field does not contain +struct :c:type:`v4l2_fmt` ``type`` field does not contain ``V4L2_BUF_TYPE_VBI``. In the documentation of the struct :c:type:`v4l2_vbi_format` ``offset`` field the ambiguous phrase "rising edge" was changed to "leading edge". @@ -415,7 +415,7 @@ This unnamed version was finally merged into Linux 2.5.46. originally needed to distguish between variations of standards, were removed. - Struct :c:type:`struct v4l2_enumstd` ceased to be. + Struct struct :c:type:`v4l2_enumstd` ceased to be. :ref:`VIDIOC_ENUMSTD` now takes a pointer to a struct :c:type:`v4l2_standard` directly. The information which standards are supported by a particular video @@ -636,7 +636,7 @@ This unnamed version was finally merged into Linux 2.5.46. removed. Since no unadjusted system time clock was added to the kernel as planned, the ``timestamp`` field changed back from type stamp_t, an unsigned 64 bit integer expressing the sample time in - nanoseconds, to struct :c:type:`struct timeval`. With the addition + nanoseconds, to struct :c:type:`timeval`. With the addition of a second memory mapping method the ``offset`` field moved into union ``m``, and a new ``memory`` field of type enum :ref:`v4l2_memory ` was added to distinguish between @@ -671,11 +671,11 @@ This unnamed version was finally merged into Linux 2.5.46. distinguish between field and frame (interlaced) overlay. 17. The digital zoom interface, including struct - :c:type:`struct v4l2_zoomcap`, struct - :c:type:`struct v4l2_zoom`, ``V4L2_ZOOM_NONCAP`` and + struct :c:type:`v4l2_zoomcap`, struct + struct :c:type:`v4l2_zoom`, ``V4L2_ZOOM_NONCAP`` and ``V4L2_ZOOM_WHILESTREAMING`` was replaced by a new cropping and scaling interface. The previously unused struct - :c:type:`struct v4l2_cropcap` and :c:type:`struct v4l2_crop` + struct :c:type:`v4l2_cropcap` and :c:type:`struct v4l2_crop` where redefined for this purpose. See :ref:`crop` for details. 18. In struct :c:type:`v4l2_vbi_format` the @@ -694,7 +694,7 @@ This unnamed version was finally merged into Linux 2.5.46. Similar changes were made to struct :c:type:`v4l2_outputparm`. -20. The struct :c:type:`struct v4l2_performance` and +20. The struct :c:type:`v4l2_performance` and ``VIDIOC_G_PERF`` ioctl were dropped. Except when using the :ref:`read/write I/O method `, which is limited anyway, this information is already available to applications. @@ -882,7 +882,7 @@ V4L2 in Linux 2.6.15 3. The ``VIDIOC_G_COMP`` and ``VIDIOC_S_COMP`` ioctl were renamed to ``VIDIOC_G_MPEGCOMP`` and ``VIDIOC_S_MPEGCOMP`` respectively. Their argument was replaced by a struct - :c:type:`struct v4l2_mpeg_compression` pointer. (The + struct :c:type:`v4l2_mpeg_compression` pointer. (The ``VIDIOC_G_MPEGCOMP`` and ``VIDIOC_S_MPEGCOMP`` ioctls where removed in Linux 2.6.25.) @@ -925,7 +925,7 @@ V4L2 spec erratum 2006-02-04 1. The ``clips`` field in struct :c:type:`v4l2_window` must point to an array of struct :c:type:`v4l2_clip`, not a linked list, because drivers ignore the struct - :c:type:`struct v4l2_clip`. ``next`` pointer. + struct :c:type:`v4l2_clip`. ``next`` pointer. V4L2 in Linux 2.6.17 @@ -1040,7 +1040,7 @@ V4L2 in Linux 2.6.22 A new ``global_alpha`` field was added to :c:type:`v4l2_window`, extending the structure. This may *break compatibility* with applications using a struct - :c:type:`struct v4l2_window` directly. However the + struct :c:type:`v4l2_window` directly. However the :ref:`VIDIOC_G/S/TRY_FMT ` ioctls, which take a pointer to a :c:type:`v4l2_format` parent structure with padding bytes at the end, are not affected. @@ -1127,8 +1127,8 @@ V4L2 in Linux 2.6.29 1. The ``VIDIOC_G_CHIP_IDENT`` ioctl was renamed to ``VIDIOC_G_CHIP_IDENT_OLD`` and ``VIDIOC_DBG_G_CHIP_IDENT`` was introduced in its place. The old struct - :c:type:`struct v4l2_chip_ident` was renamed to - :c:type:`struct v4l2_chip_ident_old`. + struct :c:type:`v4l2_chip_ident` was renamed to + struct :c:type:`v4l2_chip_ident_old`. 2. The pixel formats ``V4L2_PIX_FMT_VYUY``, ``V4L2_PIX_FMT_NV16`` and ``V4L2_PIX_FMT_NV61`` were added. @@ -1279,7 +1279,7 @@ V4L2 in Linux 3.5 V4L2 in Linux 3.6 ================= -1. Replaced ``input`` in :c:type:`struct v4l2_buffer` by +1. Replaced ``input`` in struct :c:type:`v4l2_buffer` by ``reserved2`` and removed ``V4L2_BUF_FLAG_INPUT``. 2. Added V4L2_CAP_VIDEO_M2M and V4L2_CAP_VIDEO_M2M_MPLANE @@ -1293,7 +1293,7 @@ V4L2 in Linux 3.9 ================= 1. Added timestamp types to ``flags`` field in - :c:type:`struct v4l2_buffer`. See :ref:`buffer-flags`. + struct :c:type:`v4l2_buffer`. See :ref:`buffer-flags`. 2. Added ``V4L2_EVENT_CTRL_CH_RANGE`` control event changes flag. See :ref:`ctrl-changes-flags`. @@ -1320,7 +1320,7 @@ V4L2 in Linux 3.11 V4L2 in Linux 3.14 ================== -1. In struct :c:type:`struct v4l2_rect`, the type of ``width`` and +1. In struct :c:type:`v4l2_rect`, the type of ``width`` and ``height`` fields changed from _s32 to _u32. From 39b6b9005f6cd2ef2f6c554bb2da176ca87aab0d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 05:51:10 -0300 Subject: [PATCH 337/591] [media] fix clock_gettime cross-references Fix those warnings: Documentation/media/uapi/cec/cec-ioc-dqevent.rst:124: WARNING: c:func reference target not found: clock_gettime(2) By replacing it with the right function name, using this shell script: for i in `find Documentation/media -type f`; do sed 's,clock_gettime(2),clock_gettime,' <$i >a && mv a $i; done Please notice that this will make the nitpick mode to shut up complaining about that, becasue clock_gettime is on its exclude list, but the cross reference will be undefined until someone documents this function at the core documentation. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/cec/cec-ioc-dqevent.rst | 2 +- Documentation/media/uapi/cec/cec-ioc-receive.rst | 4 ++-- Documentation/media/uapi/v4l/buffer.rst | 4 ++-- Documentation/media/uapi/v4l/vidioc-dqevent.rst | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index 06b79361254c..060c455380ce 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst @@ -122,7 +122,7 @@ it is guaranteed that the state did change in between the two events. - :cspan:`1` Timestamp of the event in ns. The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access - the same clock from userspace use :c:func:`clock_gettime(2)`. + the same clock from userspace use :c:func:`clock_gettime`. - .. row 2 diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst index 18620f81b7d9..d585b1bba6ac 100644 --- a/Documentation/media/uapi/cec/cec-ioc-receive.rst +++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst @@ -95,7 +95,7 @@ result. - Timestamp in ns of when the last byte of the message was transmitted. The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access - the same clock from userspace use :c:func:`clock_gettime(2)`. + the same clock from userspace use :c:func:`clock_gettime`. - .. row 2 @@ -105,7 +105,7 @@ result. - Timestamp in ns of when the last byte of the message was received. The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access - the same clock from userspace use :c:func:`clock_gettime(2)`. + the same clock from userspace use :c:func:`clock_gettime`. - .. row 3 diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index 7d2d81a771b1..e71a458712d3 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -712,7 +712,7 @@ Buffer Flags clock). Monotonic clock has been favoured in embedded systems whereas most of the drivers use the realtime clock. Either kinds of timestamps are available in user space via - :c:func:`clock_gettime(2)` using clock IDs ``CLOCK_MONOTONIC`` + :c:func:`clock_gettime` using clock IDs ``CLOCK_MONOTONIC`` and ``CLOCK_REALTIME``, respectively. - .. _`V4L2-BUF-FLAG-TIMESTAMP-MONOTONIC`: @@ -723,7 +723,7 @@ Buffer Flags - The buffer timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access the same clock outside V4L2, use - :c:func:`clock_gettime(2)`. + :c:func:`clock_gettime`. - .. _`V4L2-BUF-FLAG-TIMESTAMP-COPY`: diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index 3038f349049c..1e435ab674a2 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -152,7 +152,7 @@ call. - - Event timestamp. The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access the same clock outside V4L2, - use :c:func:`clock_gettime(2)`. + use :c:func:`clock_gettime`. - .. row 12 From 9281f251bebe5618070e03041a7cdb81162b337d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 06:07:47 -0300 Subject: [PATCH 338/591] [media] libv4l-introdution.rst: fix function definitions c:type is not the right tag for function definitions. Replace them by .. c:function:: Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/libv4l-introduction.rst | 62 +++++++++++-------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/Documentation/media/uapi/v4l/libv4l-introduction.rst b/Documentation/media/uapi/v4l/libv4l-introduction.rst index 61d085f9f105..1c1278d17fa7 100644 --- a/Documentation/media/uapi/v4l/libv4l-introduction.rst +++ b/Documentation/media/uapi/v4l/libv4l-introduction.rst @@ -116,45 +116,53 @@ The common file operation methods are provided by libv4l. Those functions operate just like glibc open/close/dup/ioctl/read/mmap/munmap: -- :c:type:`int v4l2_open(const char *file, int oflag, ...)` - operates like the - standard :ref:`open() ` function. +.. c:function:: int v4l2_open(const char *file, int oflag, ...) -- :c:type:`int v4l2_close(int fd)` - operates like the standard - :ref:`close() ` function. + operates like the standard :ref:`open() ` function. -- :c:type:`int v4l2_dup(int fd)` - operates like the standard dup() function, - duplicating a file handler. +.. c:function:: int v4l2_close(int fd) -- :c:type:`int v4l2_ioctl (int fd, unsigned long int request, ...)` - operates - like the standard :ref:`ioctl() ` function. + operates like the standard :ref:`close() ` function. -- :c:type:`int v4l2_read (int fd, void* buffer, size_t n)` - operates like the - standard :ref:`read() ` function. +.. c:function:: int v4l2_dup(int fd) -- :c:type:`void v4l2_mmap(void *start, size_t length, int prot, int flags, int - fd, int64_t offset);` - operates like the standard - :ref:`mmap() ` function. + operates like the standard dup() function, duplicating a file handler. -- :c:type:`int v4l2_munmap(void *_start, size_t length);` - operates like the - standard :ref:`munmap() ` function. +.. c:function:: int v4l2_ioctl (int fd, unsigned long int request, ...) + + operates like the standard :ref:`ioctl() ` function. + +.. c:function:: int v4l2_read (int fd, void* buffer, size_t n) + + operates like the standard :ref:`read() ` function. + +.. c:function:: void v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); + + operates like the standard :ref:`mmap() ` function. + +.. c:function:: int v4l2_munmap(void *_start, size_t length); + operates like the standard :ref:`munmap() ` function. Those functions provide additional control: -- :c:type:`int v4l2_fd_open(int fd, int v4l2_flags)` - opens an already opened - fd for further use through v4l2lib and possibly modify libv4l2's - default behavior through the v4l2_flags argument. Currently, - v4l2_flags can be ``V4L2_DISABLE_CONVERSION``, to disable format - conversion. +.. c:function:: int v4l2_fd_open(int fd, int v4l2_flags) -- :c:type:`int v4l2_set_control(int fd, int cid, int value)` - This function - takes a value of 0 - 65535, and then scales that range to the actual - range of the given v4l control id, and then if the cid exists and is + opens an already opened fd for further use through v4l2lib and possibly + modify libv4l2's default behavior through the v4l2_flags argument. + Currently, v4l2_flags can be ``V4L2_DISABLE_CONVERSION``, to disable + format conversion. + +.. c:function:: int v4l2_set_control(int fd, int cid, int value) + + This function takes a value of 0 - 65535, and then scales that range to the + actual range of the given v4l control id, and then if the cid exists and is not locked sets the cid to the scaled value. -- :c:type:`int v4l2_get_control(int fd, int cid)` - This function returns a - value of 0 - 65535, scaled to from the actual range of the given v4l - control id. when the cid does not exist, could not be accessed for - some reason, or some error occurred 0 is returned. +.. c:function:: int v4l2_get_control(int fd, int cid) + + This function returns a value of 0 - 65535, scaled to from the actual range + of the given v4l control id. when the cid does not exist, could not be + accessed for some reason, or some error occurred 0 is returned. v4l1compat.so wrapper library From e452134cee5593612e515265247d271c36d6ca33 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 06:21:01 -0300 Subject: [PATCH 339/591] [media] libv4l-introduction.rst: improve crossr-references Use C cross-references to mention the V4L2 API calls on all places it occurs inside this file. While here, also mark constants as such. Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/libv4l-introduction.rst | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/Documentation/media/uapi/v4l/libv4l-introduction.rst b/Documentation/media/uapi/v4l/libv4l-introduction.rst index 1c1278d17fa7..ccc3c4d2fc0f 100644 --- a/Documentation/media/uapi/v4l/libv4l-introduction.rst +++ b/Documentation/media/uapi/v4l/libv4l-introduction.rst @@ -113,43 +113,47 @@ Libv4l device control functions The common file operation methods are provided by libv4l. -Those functions operate just like glibc -open/close/dup/ioctl/read/mmap/munmap: +Those functions operate just like the gcc function ``dup()`` and +V4L2 functions +:c:func:`open() `, :c:func:`close() `, +:c:func:`ioctl() `, :c:func:`read() `, +:c:func:`mmap() ` and :c:func:`munmap() `: .. c:function:: int v4l2_open(const char *file, int oflag, ...) - operates like the standard :ref:`open() ` function. + operates like the :c:func:`open() ` function. .. c:function:: int v4l2_close(int fd) - operates like the standard :ref:`close() ` function. + operates like the :c:func:`close() ` function. .. c:function:: int v4l2_dup(int fd) - operates like the standard dup() function, duplicating a file handler. + operates like the libc ``dup()`` function, duplicating a file handler. .. c:function:: int v4l2_ioctl (int fd, unsigned long int request, ...) - operates like the standard :ref:`ioctl() ` function. + operates like the :c:func:`ioctl() ` function. .. c:function:: int v4l2_read (int fd, void* buffer, size_t n) - operates like the standard :ref:`read() ` function. + operates like the :c:func:`read() ` function. .. c:function:: void v4l2_mmap(void *start, size_t length, int prot, int flags, int fd, int64_t offset); - operates like the standard :ref:`mmap() ` function. + operates like the :c:func:`munmap() ` function. .. c:function:: int v4l2_munmap(void *_start, size_t length); - operates like the standard :ref:`munmap() ` function. + + operates like the :c:func:`munmap() ` function. Those functions provide additional control: .. c:function:: int v4l2_fd_open(int fd, int v4l2_flags) opens an already opened fd for further use through v4l2lib and possibly - modify libv4l2's default behavior through the v4l2_flags argument. - Currently, v4l2_flags can be ``V4L2_DISABLE_CONVERSION``, to disable + modify libv4l2's default behavior through the ``v4l2_flags`` argument. + Currently, ``v4l2_flags`` can be ``V4L2_DISABLE_CONVERSION``, to disable format conversion. .. c:function:: int v4l2_set_control(int fd, int cid, int value) @@ -168,9 +172,12 @@ Those functions provide additional control: v4l1compat.so wrapper library ============================= -This library intercepts calls to open/close/ioctl/mmap/mmunmap +This library intercepts calls to +:c:func:`open() `, :c:func:`close() `, +:c:func:`ioctl() `, :c:func:`mmap() ` and +:c:func:`munmap() ` operations and redirects them to the libv4l counterparts, by using -LD_PRELOAD=/usr/lib/v4l1compat.so. It also emulates V4L1 calls via V4L2 +``LD_PRELOAD=/usr/lib/v4l1compat.so``. It also emulates V4L1 calls via V4L2 API. It allows usage of binary legacy applications that still don't use From be831b34c2182731df77710e2fb8130060b1012f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 06:30:27 -0300 Subject: [PATCH 340/591] [media] hist-v4l2.rst: don't do refs to old structures Several structs were renamed or removed during V4L2 development. Don't try to cross-reference the legacy ones. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/hist-v4l2.rst | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Documentation/media/uapi/v4l/hist-v4l2.rst b/Documentation/media/uapi/v4l/hist-v4l2.rst index b18fb7e6c39a..d86d6343a20a 100644 --- a/Documentation/media/uapi/v4l/hist-v4l2.rst +++ b/Documentation/media/uapi/v4l/hist-v4l2.rst @@ -30,14 +30,14 @@ aliases ``O_NONCAP`` and ``O_NOIO`` were defined. Applications can set this flag if they intend to access controls only, as opposed to capture applications which need exclusive access. The ``VIDEO_STD_XXX`` identifiers are now ordinals instead of flags, and the -:c:func:`video_std_construct()` helper function takes id and +``video_std_construct()`` helper function takes id and transmission arguments. 1998-09-28: Revamped video standard. Made video controls individually enumerable. 1998-10-02: The ``id`` field was removed from struct -struct :c:type:`video_standard` and the color subcarrier fields were +struct ``video_standard`` and the color subcarrier fields were renamed. The :ref:`VIDIOC_QUERYSTD` ioctl was renamed to :ref:`VIDIOC_ENUMSTD`, :ref:`VIDIOC_G_INPUT ` to @@ -254,7 +254,7 @@ multiple tuners into account.) 2000-09-18: ``V4L2_BUF_TYPE_VBI`` was added. This may *break compatibility* as the :ref:`VIDIOC_G_FMT ` and :ref:`VIDIOC_S_FMT ` ioctls may fail now if the struct -struct :c:type:`v4l2_fmt` ``type`` field does not contain +struct ``v4l2_fmt`` ``type`` field does not contain ``V4L2_BUF_TYPE_VBI``. In the documentation of the struct :c:type:`v4l2_vbi_format` ``offset`` field the ambiguous phrase "rising edge" was changed to "leading edge". @@ -415,7 +415,7 @@ This unnamed version was finally merged into Linux 2.5.46. originally needed to distguish between variations of standards, were removed. - Struct struct :c:type:`v4l2_enumstd` ceased to be. + Struct ``v4l2_enumstd`` ceased to be. :ref:`VIDIOC_ENUMSTD` now takes a pointer to a struct :c:type:`v4l2_standard` directly. The information which standards are supported by a particular video @@ -671,11 +671,11 @@ This unnamed version was finally merged into Linux 2.5.46. distinguish between field and frame (interlaced) overlay. 17. The digital zoom interface, including struct - struct :c:type:`v4l2_zoomcap`, struct - struct :c:type:`v4l2_zoom`, ``V4L2_ZOOM_NONCAP`` and + struct ``v4l2_zoomcap``, struct + struct ``v4l2_zoom``, ``V4L2_ZOOM_NONCAP`` and ``V4L2_ZOOM_WHILESTREAMING`` was replaced by a new cropping and scaling interface. The previously unused struct - struct :c:type:`v4l2_cropcap` and :c:type:`struct v4l2_crop` + struct :c:type:`v4l2_cropcap` and struct :c:type:`v4l2_crop` where redefined for this purpose. See :ref:`crop` for details. 18. In struct :c:type:`v4l2_vbi_format` the @@ -694,7 +694,7 @@ This unnamed version was finally merged into Linux 2.5.46. Similar changes were made to struct :c:type:`v4l2_outputparm`. -20. The struct :c:type:`v4l2_performance` and +20. The struct ``v4l2_performance`` and ``VIDIOC_G_PERF`` ioctl were dropped. Except when using the :ref:`read/write I/O method `, which is limited anyway, this information is already available to applications. @@ -882,7 +882,7 @@ V4L2 in Linux 2.6.15 3. The ``VIDIOC_G_COMP`` and ``VIDIOC_S_COMP`` ioctl were renamed to ``VIDIOC_G_MPEGCOMP`` and ``VIDIOC_S_MPEGCOMP`` respectively. Their argument was replaced by a struct - struct :c:type:`v4l2_mpeg_compression` pointer. (The + ``v4l2_mpeg_compression`` pointer. (The ``VIDIOC_G_MPEGCOMP`` and ``VIDIOC_S_MPEGCOMP`` ioctls where removed in Linux 2.6.25.) @@ -982,7 +982,7 @@ V4L2 in Linux 2.6.18 flag to skip unsupported controls with :ref:`VIDIOC_QUERYCTRL`, new control types ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_TYPE_CTRL_CLASS`` - (:ref:`v4l2-ctrl-type`), and new control flags + (:c:type:`v4l2_ctrl_type`), and new control flags ``V4L2_CTRL_FLAG_READ_ONLY``, ``V4L2_CTRL_FLAG_UPDATE``, ``V4L2_CTRL_FLAG_INACTIVE`` and ``V4L2_CTRL_FLAG_SLIDER`` (:ref:`control-flags`). See :ref:`extended-controls` for details. @@ -1127,8 +1127,8 @@ V4L2 in Linux 2.6.29 1. The ``VIDIOC_G_CHIP_IDENT`` ioctl was renamed to ``VIDIOC_G_CHIP_IDENT_OLD`` and ``VIDIOC_DBG_G_CHIP_IDENT`` was introduced in its place. The old struct - struct :c:type:`v4l2_chip_ident` was renamed to - struct :c:type:`v4l2_chip_ident_old`. + struct ``v4l2_chip_ident`` was renamed to + struct ``v4l2_chip_ident_old``. 2. The pixel formats ``V4L2_PIX_FMT_VYUY``, ``V4L2_PIX_FMT_NV16`` and ``V4L2_PIX_FMT_NV61`` were added. From 56683d7dea0ecc3045b3041bc9071eb4fb72c4fb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 06:41:26 -0300 Subject: [PATCH 341/591] [media] docs-rst: fix cross-references for videodev2.h There are several broken references there, due to the conversion to C domain. Fix them using this shell script and manually adjust what's broken: # funcs is a file with the broken functions/references for i in $(cat funcs|sort|uniq|perl -ne 'print "$1\n" if (m/(\S+)$/)'); do i=${i//-/_} echo $i j=${i//_/-} for k in $(git grep -l "_$j:" Documentation/); do sed s,\_$j\:,"c\:type\:\: $i", <$k >a && mv a $k done for k in $(git grep -l "$j" Documentation/media/*.exceptions); do sed s,$j,":c\:type\:\`$i\`", <$k >a && mv a $k done for k in $(git grep -l "$j" Documentation/); do sed "s,:ref:\`$i <$j>\`,:c:type:\`$i\`," <$k >a && mv a $k sed "s,:ref:\`$j\`,:c:type:\`$i\`," <$k >a && mv a $k sed -E "s,:ref:\`(.*)<$j>\`,:c:type:\`\1<$i>\`," <$k >a && mv a $k done for k in $(git grep -l "<$j>" include/media); do sed -E "s,:ref:\`(.*)<$j>\`,enum \&$i," <$k >a && mv a $k done done Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/buffer.rst | 14 +- Documentation/media/uapi/v4l/field-order.rst | 4 +- Documentation/media/uapi/v4l/hist-v4l2.rst | 30 +-- Documentation/media/uapi/v4l/pixfmt-002.rst | 10 +- Documentation/media/uapi/v4l/pixfmt-003.rst | 10 +- Documentation/media/uapi/v4l/pixfmt-006.rst | 16 +- Documentation/media/uapi/v4l/planar-apis.rst | 2 +- .../media/uapi/v4l/subdev-formats.rst | 10 +- Documentation/media/uapi/v4l/tuner.rst | 4 +- Documentation/media/uapi/v4l/v4l2.rst | 4 +- .../media/uapi/v4l/vidioc-create-bufs.rst | 2 +- .../media/uapi/v4l/vidioc-cropcap.rst | 2 +- .../media/uapi/v4l/vidioc-dbg-g-register.rst | 2 +- .../media/uapi/v4l/vidioc-dqevent.rst | 2 +- .../media/uapi/v4l/vidioc-enum-fmt.rst | 2 +- .../uapi/v4l/vidioc-enum-frameintervals.rst | 2 +- .../media/uapi/v4l/vidioc-enum-framesizes.rst | 2 +- .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 2 +- .../media/uapi/v4l/vidioc-expbuf.rst | 2 +- .../media/uapi/v4l/vidioc-g-crop.rst | 2 +- .../media/uapi/v4l/vidioc-g-edid.rst | 2 +- .../media/uapi/v4l/vidioc-g-fbuf.rst | 4 +- Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 2 +- .../media/uapi/v4l/vidioc-g-frequency.rst | 2 +- .../media/uapi/v4l/vidioc-g-modulator.rst | 2 +- .../media/uapi/v4l/vidioc-g-parm.rst | 2 +- .../media/uapi/v4l/vidioc-g-selection.rst | 2 +- .../uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 2 +- .../media/uapi/v4l/vidioc-g-tuner.rst | 4 +- .../media/uapi/v4l/vidioc-querycap.rst | 2 +- .../media/uapi/v4l/vidioc-queryctrl.rst | 4 +- .../media/uapi/v4l/vidioc-reqbufs.rst | 4 +- .../media/uapi/v4l/vidioc-s-hw-freq-seek.rst | 2 +- .../v4l/vidioc-subdev-enum-frame-interval.rst | 7 +- .../v4l/vidioc-subdev-enum-frame-size.rst | 6 +- .../uapi/v4l/vidioc-subdev-enum-mbus-code.rst | 6 +- .../media/uapi/v4l/vidioc-subdev-g-crop.rst | 8 +- .../media/uapi/v4l/vidioc-subdev-g-fmt.rst | 2 +- .../v4l/vidioc-subdev-g-frame-interval.rst | 8 +- .../uapi/v4l/vidioc-subdev-g-selection.rst | 4 +- .../media/videodev2.h.rst.exceptions | 204 +++++++++--------- 41 files changed, 201 insertions(+), 202 deletions(-) diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index e71a458712d3..21893ee1384a 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -74,7 +74,7 @@ struct v4l2_buffer - Type of the buffer, same as struct :c:type:`v4l2_format` ``type`` or struct :c:type:`v4l2_requestbuffers` ``type``, set - by the application. See :ref:`v4l2-buf-type` + by the application. See :c:type:`v4l2_buf_type` - .. row 3 @@ -110,7 +110,7 @@ struct v4l2_buffer - - Indicates the field order of the image in the buffer, see - :ref:`v4l2-field`. This field is not used when the buffer + :c:type:`v4l2_field`. This field is not used when the buffer contains VBI data. Drivers must set it when ``type`` refers to a capture stream, applications when it refers to an output stream. @@ -142,7 +142,7 @@ struct v4l2_buffer - When ``type`` is ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` and the ``V4L2_BUF_FLAG_TIMECODE`` flag is set in ``flags``, this structure contains a frame timecode. In - :ref:`V4L2_FIELD_ALTERNATE ` mode the top and + :c:type:`V4L2_FIELD_ALTERNATE ` mode the top and bottom field contain the same timecode. Timecodes are intended to help video editing and are typically recorded on video tapes, but also embedded in compressed formats like MPEG. This field is @@ -162,7 +162,7 @@ struct v4l2_buffer - :cspan:`3` - In :ref:`V4L2_FIELD_ALTERNATE ` mode the top and + In :c:type:`V4L2_FIELD_ALTERNATE ` mode the top and bottom field have the same sequence number. The count starts at zero and includes dropped or repeated frames. A dropped frame was received by an input device but could not be stored due to lack of @@ -187,7 +187,7 @@ struct v4l2_buffer - - This field must be set by applications and/or drivers in - accordance with the selected I/O method. See :ref:`v4l2-memory` + accordance with the selected I/O method. See :c:type:`v4l2_memory` - .. row 11 @@ -402,7 +402,7 @@ struct v4l2_plane -.. _v4l2-buf-type: +.. c:type:: v4l2_buf_type enum v4l2_buf_type ================== @@ -773,7 +773,7 @@ Buffer Flags -.. _v4l2-memory: +.. c:type:: v4l2_memory enum v4l2_memory ================ diff --git a/Documentation/media/uapi/v4l/field-order.rst b/Documentation/media/uapi/v4l/field-order.rst index 1fa082f34c6f..0d71d5a3fbde 100644 --- a/Documentation/media/uapi/v4l/field-order.rst +++ b/Documentation/media/uapi/v4l/field-order.rst @@ -52,11 +52,11 @@ this end applications initialize the ``field`` field of struct should have the value ``V4L2_FIELD_ANY`` (0). -.. _v4l2-field: - enum v4l2_field =============== +.. c:type:: v4l2_field + .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| .. flat-table:: diff --git a/Documentation/media/uapi/v4l/hist-v4l2.rst b/Documentation/media/uapi/v4l/hist-v4l2.rst index d86d6343a20a..dfd55e9066b3 100644 --- a/Documentation/media/uapi/v4l/hist-v4l2.rst +++ b/Documentation/media/uapi/v4l/hist-v4l2.rst @@ -438,7 +438,7 @@ This unnamed version was finally merged into Linux 2.5.46. ``VIDIOC_S_FMT`` and ``VIDIOC_TRY_FMT``; ioctl. The ``VIDIOC_G_WIN`` and ``VIDIOC_S_WIN`` ioctls to prepare for a video overlay were removed. The ``type`` field changed to type enum - :ref:`v4l2_buf_type ` and the buffer type names + :c:type:`v4l2_buf_type` and the buffer type names changed as follows. @@ -452,7 +452,7 @@ This unnamed version was finally merged into Linux 2.5.46. - Old defines - - enum :ref:`v4l2_buf_type ` + - enum :c:type:`v4l2_buf_type` - .. row 2 @@ -534,7 +534,7 @@ This unnamed version was finally merged into Linux 2.5.46. 10. In struct :c:type:`v4l2_fmtdesc` a enum - :ref:`v4l2_buf_type ` field named ``type`` was + :c:type:`v4l2_buf_type` field named ``type`` was added as in struct :c:type:`v4l2_format`. The ``VIDIOC_ENUM_FBUFFMT`` ioctl is no longer needed and was removed. These calls can be replaced by @@ -555,7 +555,7 @@ This unnamed version was finally merged into Linux 2.5.46. itself was removed. The interlace flags were replaced by a enum - :ref:`v4l2_field ` value in a newly added ``field`` + :c:type:`v4l2_field` value in a newly added ``field`` field. @@ -569,7 +569,7 @@ This unnamed version was finally merged into Linux 2.5.46. - Old flag - - enum :ref:`v4l2_field ` + - enum :c:type:`v4l2_field` - .. row 2 @@ -615,23 +615,23 @@ This unnamed version was finally merged into Linux 2.5.46. The color space flags were replaced by a enum - :ref:`v4l2_colorspace ` value in a newly added + :c:type:`v4l2_colorspace` value in a newly added ``colorspace`` field, where one of ``V4L2_COLORSPACE_SMPTE170M``, ``V4L2_COLORSPACE_BT878``, ``V4L2_COLORSPACE_470_SYSTEM_M`` or ``V4L2_COLORSPACE_470_SYSTEM_BG`` replaces ``V4L2_FMT_CS_601YUV``. 12. In struct :c:type:`v4l2_requestbuffers` the ``type`` field was properly defined as enum - :ref:`v4l2_buf_type `. Buffer types changed as + :c:type:`v4l2_buf_type`. Buffer types changed as mentioned above. A new ``memory`` field of type enum - :ref:`v4l2_memory ` was added to distinguish between + :c:type:`v4l2_memory` was added to distinguish between I/O methods using buffers allocated by the driver or the application. See :ref:`io` for details. 13. In struct :c:type:`v4l2_buffer` the ``type`` field was - properly defined as enum :ref:`v4l2_buf_type `. + properly defined as enum :c:type:`v4l2_buf_type`. Buffer types changed as mentioned above. A ``field`` field of type - enum :ref:`v4l2_field ` was added to indicate if a + enum :c:type:`v4l2_field` was added to indicate if a buffer contains a top or bottom field. The old field flags were removed. Since no unadjusted system time clock was added to the kernel as planned, the ``timestamp`` field changed back from type @@ -639,7 +639,7 @@ This unnamed version was finally merged into Linux 2.5.46. nanoseconds, to struct :c:type:`timeval`. With the addition of a second memory mapping method the ``offset`` field moved into union ``m``, and a new ``memory`` field of type enum - :ref:`v4l2_memory ` was added to distinguish between + :c:type:`v4l2_memory` was added to distinguish between I/O methods. See :ref:`io` for details. The ``V4L2_BUF_REQ_CONTIG`` flag was used by the V4L compatibility @@ -667,7 +667,7 @@ This unnamed version was finally merged into Linux 2.5.46. 16. In struct :c:type:`v4l2_window` the ``x``, ``y``, ``width`` and ``height`` field moved into a ``w`` substructure as - above. A ``field`` field of type %v4l2-field; was added to + above. A ``field`` field of type :c:type:`v4l2_field` was added to distinguish between field and frame (interlaced) overlay. 17. The digital zoom interface, including struct @@ -1029,7 +1029,7 @@ V4L2 in Linux 2.6.22 ==================== 1. Two new field orders ``V4L2_FIELD_INTERLACED_TB`` and - ``V4L2_FIELD_INTERLACED_BT`` were added. See :ref:`v4l2-field` for + ``V4L2_FIELD_INTERLACED_BT`` were added. See :c:type:`v4l2_field` for details. 2. Three new clipping/blending methods with a global or straight or @@ -1357,8 +1357,8 @@ V4L2 in Linux 3.19 ================== 1. Rewrote Colorspace chapter, added new enum - :ref:`v4l2_ycbcr_encoding ` and enum - :ref:`v4l2_quantization ` fields to struct + :c:type:`v4l2_ycbcr_encoding` and enum + :c:type:`v4l2_quantization` fields to struct :c:type:`v4l2_pix_format`, struct :c:type:`v4l2_pix_format_mplane` and struct :c:type:`v4l2_mbus_framefmt`. diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst b/Documentation/media/uapi/v4l/pixfmt-002.rst index 28f14e41631c..fd73f4697878 100644 --- a/Documentation/media/uapi/v4l/pixfmt-002.rst +++ b/Documentation/media/uapi/v4l/pixfmt-002.rst @@ -61,7 +61,7 @@ Single-planar format structure - .. row 5 - - enum :ref:`v4l2_field ` + - enum :c:type::`v4l2_field` - ``field`` @@ -121,7 +121,7 @@ Single-planar format structure - .. row 9 - - enum :ref:`v4l2_colorspace ` + - enum :c:type:`v4l2_colorspace` - ``colorspace`` @@ -170,7 +170,7 @@ Single-planar format structure - .. row 12 - - enum :ref:`v4l2_ycbcr_encoding ` + - enum :c:type:`v4l2_ycbcr_encoding` - ``ycbcr_enc`` @@ -180,7 +180,7 @@ Single-planar format structure - .. row 13 - - enum :ref:`v4l2_quantization ` + - enum :c:type:`v4l2_quantization` - ``quantization`` @@ -190,7 +190,7 @@ Single-planar format structure - .. row 14 - - enum :ref:`v4l2_xfer_func ` + - enum :c:type:`v4l2_xfer_func` - ``xfer_func`` diff --git a/Documentation/media/uapi/v4l/pixfmt-003.rst b/Documentation/media/uapi/v4l/pixfmt-003.rst index e39fa2b732d7..a3c83df3bce5 100644 --- a/Documentation/media/uapi/v4l/pixfmt-003.rst +++ b/Documentation/media/uapi/v4l/pixfmt-003.rst @@ -88,7 +88,7 @@ describing all planes of that format. - .. row 4 - - enum :ref:`v4l2_field ` + - enum :c:type:`v4l2_field` - ``field`` @@ -96,7 +96,7 @@ describing all planes of that format. - .. row 5 - - enum :ref:`v4l2_colorspace ` + - enum :c:type:`v4l2_colorspace` - ``colorspace`` @@ -131,7 +131,7 @@ describing all planes of that format. - .. row 9 - - enum :ref:`v4l2_ycbcr_encoding ` + - enum :c:type:`v4l2_ycbcr_encoding` - ``ycbcr_enc`` @@ -141,7 +141,7 @@ describing all planes of that format. - .. row 10 - - enum :ref:`v4l2_quantization ` + - enum :c:type:`v4l2_quantization` - ``quantization`` @@ -151,7 +151,7 @@ describing all planes of that format. - .. row 11 - - enum :ref:`v4l2_xfer_func ` + - enum :c:type:`v4l2_xfer_func` - ``xfer_func`` diff --git a/Documentation/media/uapi/v4l/pixfmt-006.rst b/Documentation/media/uapi/v4l/pixfmt-006.rst index a97fc28e039d..819299d0291a 100644 --- a/Documentation/media/uapi/v4l/pixfmt-006.rst +++ b/Documentation/media/uapi/v4l/pixfmt-006.rst @@ -5,15 +5,15 @@ Defining Colorspaces in V4L2 **************************** In V4L2 colorspaces are defined by four values. The first is the -colorspace identifier (enum :ref:`v4l2_colorspace `) +colorspace identifier (enum :c:type:`v4l2_colorspace`) which defines the chromaticities, the default transfer function, the default Y'CbCr encoding and the default quantization method. The second is the transfer function identifier (enum -:ref:`v4l2_xfer_func `) to specify non-standard +:c:type:`v4l2_xfer_func`) to specify non-standard transfer functions. The third is the Y'CbCr encoding identifier (enum -:ref:`v4l2_ycbcr_encoding `) to specify +:c:type:`v4l2_ycbcr_encoding`) to specify non-standard Y'CbCr encodings and the fourth is the quantization -identifier (enum :ref:`v4l2_quantization `) to +identifier (enum :c:type:`v4l2_quantization`) to specify non-standard quantization methods. Most of the time only the colorspace field of struct :c:type:`v4l2_pix_format` or struct :c:type:`v4l2_pix_format_mplane` @@ -27,7 +27,7 @@ needs to be filled in. .. tabularcolumns:: |p{6.0cm}|p{11.5cm}| -.. _v4l2-colorspace: +.. c:type:: v4l2_colorspace .. flat-table:: V4L2 Colorspaces :header-rows: 1 @@ -119,7 +119,7 @@ needs to be filled in. -.. _v4l2-xfer-func: +.. c:type:: v4l2_xfer_func .. flat-table:: V4L2 Transfer Function :header-rows: 1 @@ -182,7 +182,7 @@ needs to be filled in. -.. _v4l2-ycbcr-encoding: +.. c:type:: v4l2_ycbcr_encoding .. tabularcolumns:: |p{6.5cm}|p{11.0cm}| @@ -247,7 +247,7 @@ needs to be filled in. -.. _v4l2-quantization: +.. c:type:: v4l2_quantization .. tabularcolumns:: |p{6.5cm}|p{11.0cm}| diff --git a/Documentation/media/uapi/v4l/planar-apis.rst b/Documentation/media/uapi/v4l/planar-apis.rst index bd0f88b01c9a..4e059fb44153 100644 --- a/Documentation/media/uapi/v4l/planar-apis.rst +++ b/Documentation/media/uapi/v4l/planar-apis.rst @@ -22,7 +22,7 @@ application can choose whether to use one or the other by passing a corresponding buffer type to its ioctl calls. Multi-planar versions of buffer types are suffixed with an ``_MPLANE`` string. For a list of available multi-planar buffer types see enum -:ref:`v4l2_buf_type `. +:c:type:`v4l2_buf_type`. Multi-planar formats diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index f0d7754f1906..568d5dd56561 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -46,7 +46,7 @@ Media Bus Formats - ``field`` - - Field order, from enum :ref:`v4l2_field `. See + - Field order, from enum :c:type:`v4l2_field`. See :ref:`field-order` for details. - .. row 5 @@ -56,12 +56,12 @@ Media Bus Formats - ``colorspace`` - Image colorspace, from enum - :ref:`v4l2_colorspace `. See + :c:type:`v4l2_colorspace`. See :ref:`colorspaces` for details. - .. row 6 - - enum :ref:`v4l2_ycbcr_encoding ` + - enum :c:type:`v4l2_ycbcr_encoding` - ``ycbcr_enc`` @@ -71,7 +71,7 @@ Media Bus Formats - .. row 7 - - enum :ref:`v4l2_quantization ` + - enum :c:type:`v4l2_quantization` - ``quantization`` @@ -81,7 +81,7 @@ Media Bus Formats - .. row 8 - - enum :ref:`v4l2_xfer_func ` + - enum :c:type:`v4l2_xfer_func` - ``xfer_func`` diff --git a/Documentation/media/uapi/v4l/tuner.rst b/Documentation/media/uapi/v4l/tuner.rst index 4064841d8963..ad117b068831 100644 --- a/Documentation/media/uapi/v4l/tuner.rst +++ b/Documentation/media/uapi/v4l/tuner.rst @@ -33,8 +33,8 @@ current video or radio input is queried. :ref:`VIDIOC_S_TUNER ` does not switch the current tuner, when there is more than one at all. The tuner is solely determined by the current video input. Drivers must support both ioctls - and set the ``V4L2_CAP_TUNER`` flag in the struct :ref:`v4l2_capability - ` returned by the :ref:`VIDIOC_QUERYCAP` ioctl when the + and set the ``V4L2_CAP_TUNER`` flag in the struct :c:type:`v4l2_capability` + returned by the :ref:`VIDIOC_QUERYCAP` ioctl when the device has one or more tuners. diff --git a/Documentation/media/uapi/v4l/v4l2.rst b/Documentation/media/uapi/v4l/v4l2.rst index e020c57f98d4..55b959dda07e 100644 --- a/Documentation/media/uapi/v4l/v4l2.rst +++ b/Documentation/media/uapi/v4l/v4l2.rst @@ -112,8 +112,8 @@ DVB device nodes. Add support for Tuner sub-device. :revision: 3.19 / 2014-12-05 (*hv*) Rewrote Colorspace chapter, added new enum -:ref:`v4l2_ycbcr_encoding ` and enum -:ref:`v4l2_quantization ` fields to struct +:c:type:`v4l2_ycbcr_encoding` and enum +:c:type:`v4l2_quantization` fields to struct :c:type:`v4l2_pix_format`, struct :c:type:`v4l2_pix_format_mplane` and struct :c:type:`v4l2_mbus_framefmt`. diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst index b93422400608..810634e47d54 100644 --- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst @@ -111,7 +111,7 @@ than the number requested. - Applications set this field to ``V4L2_MEMORY_MMAP``, ``V4L2_MEMORY_DMABUF`` or ``V4L2_MEMORY_USERPTR``. See - :ref:`v4l2-memory` + :c:type:`v4l2_memory` - .. row 4 diff --git a/Documentation/media/uapi/v4l/vidioc-cropcap.rst b/Documentation/media/uapi/v4l/vidioc-cropcap.rst index 945596fcd65f..f7d448cad4eb 100644 --- a/Documentation/media/uapi/v4l/vidioc-cropcap.rst +++ b/Documentation/media/uapi/v4l/vidioc-cropcap.rst @@ -69,7 +69,7 @@ overlay devices. - Type of the data stream, set by the application. Only these types are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` and - ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :ref:`v4l2-buf-type`. + ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. - .. row 2 diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst index 08f3c510e440..b875ee2aece7 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst @@ -144,7 +144,7 @@ instructions. - ``match`` - - How to match the chip, see :ref:`v4l2-dbg-match`. + - How to match the chip, see :c:type:`v4l2_dbg_match`. - .. row 2 diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index 1e435ab674a2..6347d2f83a44 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -324,7 +324,7 @@ call. - ``field`` - - The upcoming field. See enum :ref:`v4l2_field `. + - The upcoming field. See enum :c:type:`v4l2_field`. diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index 1df8fccf067f..91fbc4ba209c 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -73,7 +73,7 @@ one until ``EINVAL`` is returned. ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``, ``V4L2_BUF_TYPE_VIDEO_OUTPUT``, ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and - ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :ref:`v4l2-buf-type`. + ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. - .. row 3 diff --git a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst index 07e94420c4c5..83f641f9f231 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst @@ -231,7 +231,7 @@ Enums ===== -.. _v4l2-frmivaltypes: +.. c:type:: v4l2_frmivaltypes .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst index a4ddfe9f8956..9a9571d11f7d 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst @@ -254,7 +254,7 @@ Enums ===== -.. _v4l2-frmsizetypes: +.. c:type:: v4l2_frmsizetypes .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index c38478227031..cc27ad4e2fa7 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -75,7 +75,7 @@ of the corresponding tuner/modulator is set. set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to ``V4L2_TUNER_RADIO`` for modulators (currently only radio - modulators are supported). See :ref:`v4l2-tuner-type` + modulators are supported). See :c:type:`v4l2_tuner_type` - .. row 3 diff --git a/Documentation/media/uapi/v4l/vidioc-expbuf.rst b/Documentation/media/uapi/v4l/vidioc-expbuf.rst index 650757ad8aed..2ae2f5483351 100644 --- a/Documentation/media/uapi/v4l/vidioc-expbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-expbuf.rst @@ -133,7 +133,7 @@ Examples - Type of the buffer, same as struct :c:type:`v4l2_format` ``type`` or struct :c:type:`v4l2_requestbuffers` ``type``, set - by the application. See :ref:`v4l2-buf-type` + by the application. See :c:type:`v4l2_buf_type` - .. row 2 diff --git a/Documentation/media/uapi/v4l/vidioc-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-g-crop.rst index 4ddd8c08fd1c..9b24ca591ea4 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-crop.rst @@ -94,7 +94,7 @@ When cropping is not supported then no parameters are changed and - Type of the data stream, set by the application. Only these types are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` and - ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :ref:`v4l2-buf-type`. + ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. - .. row 2 diff --git a/Documentation/media/uapi/v4l/vidioc-g-edid.rst b/Documentation/media/uapi/v4l/vidioc-g-edid.rst index b288d8ee49ef..1fffca7cc38f 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-edid.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-edid.rst @@ -97,7 +97,7 @@ the EDID data in some way. In any case, the end result is the same: the EDID is no longer available. -.. _v4l2-edid: +.. c:type:: v4l2_edid .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index 4ac2625e545d..1ad40a9dd743 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -200,7 +200,7 @@ destructive video overlay. - .. row 12 - - - enum :ref:`v4l2_field ` + - enum :c:type:`v4l2_field` - ``field`` @@ -266,7 +266,7 @@ destructive video overlay. - .. row 16 - - - enum :ref:`v4l2_colorspace ` + - enum :c:type:`v4l2_colorspace` - ``colorspace`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst index 037437d66f08..f11dce6dc543 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst @@ -101,7 +101,7 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical - ``type`` - - - Type of the data stream, see :ref:`v4l2-buf-type`. + - Type of the data stream, see :c:type:`v4l2_buf_type`. - .. row 2 diff --git a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst index 9cbe70098b2b..37ac69acf113 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst @@ -85,7 +85,7 @@ write-only ioctl, it does not return the actual new frequency. set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to ``V4L2_TUNER_RADIO`` for modulators (currently only radio - modulators are supported). See :ref:`v4l2-tuner-type` + modulators are supported). See :c:type:`v4l2_tuner_type` - .. row 3 diff --git a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst index 5d209efa0965..a8a542dc8a40 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst @@ -147,7 +147,7 @@ To change the radio frequency the - ``type`` - - :cspan:`2` Type of the modulator, see :ref:`v4l2-tuner-type`. + - :cspan:`2` Type of the modulator, see :c:type:`v4l2_tuner_type`. - .. row 8 diff --git a/Documentation/media/uapi/v4l/vidioc-g-parm.rst b/Documentation/media/uapi/v4l/vidioc-g-parm.rst index 689b5d92aeae..eb68c34bb9ac 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-parm.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-parm.rst @@ -70,7 +70,7 @@ union holding separate parameters for input and output devices. - - The buffer (stream) type, same as struct :c:type:`v4l2_format` ``type``, set by the - application. See :ref:`v4l2-buf-type` + application. See :c:type:`v4l2_buf_type` - .. row 2 diff --git a/Documentation/media/uapi/v4l/vidioc-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-g-selection.rst index af38b2568e3b..a687e236d0f1 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-selection.rst @@ -157,7 +157,7 @@ Selection targets and flags are documented in - ``type`` - Type of the buffer (from enum - :ref:`v4l2_buf_type `). + :c:type:`v4l2_buf_type`). - .. row 2 diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index 4df7227e0490..04fae524850a 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -158,7 +158,7 @@ the sliced VBI API is unsupported or ``type`` is invalid. - ``type`` - - Type of the data stream, see :ref:`v4l2-buf-type`. Should be + - Type of the data stream, see :c:type:`v4l2_buf_type`. Should be ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE`` or ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT``. diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index 077da39f3ae6..bfeeeb22c41f 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -96,7 +96,7 @@ To change the radio frequency the - ``type`` - - :cspan:`1` Type of the tuner, see :ref:`v4l2-tuner-type`. + - :cspan:`1` Type of the tuner, see :c:type:`v4l2_tuner_type`. - .. row 4 @@ -263,7 +263,7 @@ To change the radio frequency the .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| -.. _v4l2-tuner-type: +.. c:type:: v4l2_tuner_type .. flat-table:: enum v4l2_tuner_type :header-rows: 0 diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index 2824ead350b9..f2785cad2e57 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -436,5 +436,5 @@ appropriately. The generic error codes are described at the .. [#f1] The struct :c:type:`v4l2_framebuffer` lacks an - enum :ref:`v4l2_buf_type ` field, therefore the + enum :c:type:`v4l2_buf_type` field, therefore the type of overlay is implied by the driver capabilities. diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index 1a798be69e10..f3ce0ab53bae 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -124,7 +124,7 @@ See also the examples in :ref:`control`. - ``type`` - - Type of control, see :ref:`v4l2-ctrl-type`. + - Type of control, see :c:type:`v4l2_ctrl_type`. - .. row 3 @@ -251,7 +251,7 @@ See also the examples in :ref:`control`. - ``type`` - - Type of control, see :ref:`v4l2-ctrl-type`. + - Type of control, see :c:type:`v4l2_ctrl_type`. - .. row 3 diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst index fc63045f4143..2c5291b42592 100644 --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst @@ -91,7 +91,7 @@ any DMA in progress, an implicit - Type of the stream or buffers, this is the same as the struct :c:type:`v4l2_format` ``type`` field. See - :ref:`v4l2-buf-type` for valid values. + :c:type:`v4l2_buf_type` for valid values. - .. row 3 @@ -101,7 +101,7 @@ any DMA in progress, an implicit - Applications set this field to ``V4L2_MEMORY_MMAP``, ``V4L2_MEMORY_DMABUF`` or ``V4L2_MEMORY_USERPTR``. See - :ref:`v4l2-memory`. + :c:type:`v4l2_memory`. - .. row 4 diff --git a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst index e33969b9d3da..fc5e31c63b95 100644 --- a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst +++ b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst @@ -87,7 +87,7 @@ error code is returned and no seek takes place. - The tuner type. This is the same value as in the struct :c:type:`v4l2_tuner` ``type`` field. See - :ref:`v4l2-tuner-type` + :c:type:`v4l2_tuner_type` - .. row 3 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst index db7145016571..16f2945b73dc 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst @@ -43,7 +43,7 @@ when enumerating frame intervals. To enumerate frame intervals applications initialize the ``index``, ``pad``, ``which``, ``code``, ``width`` and ``height`` fields of struct -:ref:`v4l2_subdev_frame_interval_enum ` +:c:type:`v4l2_subdev_frame_interval_enum` and call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an EINVAL error code if one of the input fields is invalid. All frame @@ -59,8 +59,7 @@ Sub-devices that support the frame interval enumeration ioctl should implemented it on a single pad only. Its behaviour when supported on multiple pads of the same sub-device is not defined. - -.. _v4l2-subdev-frame-interval-enum: +.. c:type:: v4l2_subdev_frame_interval_enum .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -147,7 +146,7 @@ appropriately. The generic error codes are described at the EINVAL The struct - :ref:`v4l2_subdev_frame_interval_enum ` + :c:type:`v4l2_subdev_frame_interval_enum` ``pad`` references a non-existing pad, one of the ``code``, ``width`` or ``height`` fields are invalid for the given pad or the ``index`` field is out of bounds. diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst index 8d2694a96b7d..972df0f74eae 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst @@ -39,7 +39,7 @@ ioctl. To enumerate frame sizes applications initialize the ``pad``, ``which`` , ``code`` and ``index`` fields of the struct -:ref:`v4l2_subdev_mbus_code_enum ` and +:c:type:`v4l2_subdev_mbus_code_enum` and call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_SIZE` ioctl with a pointer to the structure. Drivers fill the minimum and maximum frame sizes or return an EINVAL error code if one of the input parameters is invalid. @@ -62,7 +62,7 @@ current values of V4L2 controls. See information about try formats. -.. _v4l2-subdev-frame-size-enum: +.. c:type:: v4l2_subdev_frame_size_enum .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -157,6 +157,6 @@ appropriately. The generic error codes are described at the EINVAL The struct - :ref:`v4l2_subdev_frame_size_enum ` + :c:type:`v4l2_subdev_frame_size_enum` ``pad`` references a non-existing pad, the ``code`` is invalid for the given pad or the ``index`` field is out of bounds. diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst index 5ecc33daba8b..b10da0e81268 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst @@ -34,7 +34,7 @@ Description To enumerate media bus formats available at a given sub-device pad applications initialize the ``pad``, ``which`` and ``index`` fields of struct -:ref:`v4l2_subdev_mbus_code_enum ` and +:c:type:`v4l2_subdev_mbus_code_enum` and call the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl with a pointer to this structure. Drivers fill the rest of the structure or return an ``EINVAL`` error code if either the ``pad`` or ``index`` are invalid. All media bus @@ -47,7 +47,7 @@ See :ref:`VIDIOC_SUBDEV_G_FMT` for more information about the try formats. -.. _v4l2-subdev-mbus-code-enum: +.. c:type:: v4l2_subdev_mbus_code_enum .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -110,6 +110,6 @@ appropriately. The generic error codes are described at the EINVAL The struct - :ref:`v4l2_subdev_mbus_code_enum ` + :c:type:`v4l2_subdev_mbus_code_enum` ``pad`` references a non-existing pad, or the ``index`` field is out of bounds. diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst index 80517ec8a847..b5fa4ae25415 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst @@ -41,7 +41,7 @@ Description :ref:`the selection API `. To retrieve the current crop rectangle applications set the ``pad`` -field of a struct :ref:`v4l2_subdev_crop ` to the +field of a struct :c:type:`v4l2_subdev_crop` to the desired pad number as reported by the media API and the ``which`` field to ``V4L2_SUBDEV_FORMAT_ACTIVE``. They then call the ``VIDIOC_SUBDEV_G_CROP`` ioctl with a pointer to this structure. The @@ -54,7 +54,7 @@ and ``which`` fields and all members of the ``rect`` field. They then call the ``VIDIOC_SUBDEV_S_CROP`` ioctl with a pointer to this structure. The driver verifies the requested crop rectangle, adjusts it based on the hardware capabilities and configures the device. Upon -return the struct :ref:`v4l2_subdev_crop ` +return the struct :c:type:`v4l2_subdev_crop` contains the current format as would be returned by a ``VIDIOC_SUBDEV_G_CROP`` call. @@ -71,7 +71,7 @@ modify the rectangle to match what the hardware can provide. The modified format should be as close as possible to the original request. -.. _v4l2-subdev-crop: +.. c:type:: v4l2_subdev_crop .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -131,7 +131,7 @@ EBUSY ``VIDIOC_SUBDEV_S_CROP`` EINVAL - The struct :ref:`v4l2_subdev_crop ` ``pad`` + The struct :c:type:`v4l2_subdev_crop` ``pad`` references a non-existing pad, the ``which`` field references a non-existing format, or cropping is not supported on the given subdev pad. diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst index 90d876faa5b9..2f7ea274c4c2 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst @@ -109,7 +109,7 @@ should be as close as possible to the original request. - ``format`` - - Definition of an image format, see :ref:`v4l2-mbus-framefmt` for + - Definition of an image format, see :c:type:`v4l2_mbus_framefmt` for details. - .. row 4 diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst index 7580174a6ed1..4b150cc82555 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst @@ -42,7 +42,7 @@ don't support frame intervals must not implement these ioctls. To retrieve the current frame interval applications set the ``pad`` field of a struct -:ref:`v4l2_subdev_frame_interval ` to +:c:type:`v4l2_subdev_frame_interval` to the desired pad number as reported by the media controller API. When they call the ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` ioctl with a pointer to this structure the driver fills the members of the ``interval`` field. @@ -53,7 +53,7 @@ field and all members of the ``interval`` field. When they call the structure the driver verifies the requested interval, adjusts it based on the hardware capabilities and configures the device. Upon return the struct -:ref:`v4l2_subdev_frame_interval ` +:c:type:`v4l2_subdev_frame_interval` contains the current frame interval as would be returned by a ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` call. @@ -67,7 +67,7 @@ on a single pad only. Their behaviour when supported on multiple pads of the same sub-device is not defined. -.. _v4l2-subdev-frame-interval: +.. c:type:: v4l2_subdev_frame_interval .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -119,6 +119,6 @@ EBUSY EINVAL The struct - :ref:`v4l2_subdev_frame_interval ` + :c:type:`v4l2_subdev_frame_interval` ``pad`` references a non-existing pad, or the pad doesn't support frame intervals. diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst index d581ff6cf458..94789f8f74e3 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst @@ -65,7 +65,7 @@ Selection targets and flags are documented in :ref:`v4l2-selections-common`. -.. _v4l2-subdev-selection: +.. c:type:: v4l2_subdev_selection .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -141,7 +141,7 @@ EBUSY ``VIDIOC_SUBDEV_S_SELECTION`` EINVAL - The struct :ref:`v4l2_subdev_selection ` + The struct :c:type:`v4l2_subdev_selection` ``pad`` references a non-existing pad, the ``which`` field references a non-existing format, or the selection target is not supported on the given subdev pad. diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions index f0b243c48118..3828a2983acb 100644 --- a/Documentation/media/videodev2.h.rst.exceptions +++ b/Documentation/media/videodev2.h.rst.exceptions @@ -15,115 +15,115 @@ ignore symbol V4L2_TUNER_DIGITAL_TV ignore symbol V4L2_COLORSPACE_BT878 # Documented enum v4l2_field -replace symbol V4L2_FIELD_ALTERNATE v4l2-field -replace symbol V4L2_FIELD_ANY v4l2-field -replace symbol V4L2_FIELD_BOTTOM v4l2-field -replace symbol V4L2_FIELD_INTERLACED v4l2-field -replace symbol V4L2_FIELD_INTERLACED_BT v4l2-field -replace symbol V4L2_FIELD_INTERLACED_TB v4l2-field -replace symbol V4L2_FIELD_NONE v4l2-field -replace symbol V4L2_FIELD_SEQ_BT v4l2-field -replace symbol V4L2_FIELD_SEQ_TB v4l2-field -replace symbol V4L2_FIELD_TOP v4l2-field +replace symbol V4L2_FIELD_ALTERNATE :c:type:`v4l2_field` +replace symbol V4L2_FIELD_ANY :c:type:`v4l2_field` +replace symbol V4L2_FIELD_BOTTOM :c:type:`v4l2_field` +replace symbol V4L2_FIELD_INTERLACED :c:type:`v4l2_field` +replace symbol V4L2_FIELD_INTERLACED_BT :c:type:`v4l2_field` +replace symbol V4L2_FIELD_INTERLACED_TB :c:type:`v4l2_field` +replace symbol V4L2_FIELD_NONE :c:type:`v4l2_field` +replace symbol V4L2_FIELD_SEQ_BT :c:type:`v4l2_field` +replace symbol V4L2_FIELD_SEQ_TB :c:type:`v4l2_field` +replace symbol V4L2_FIELD_TOP :c:type:`v4l2_field` # Documented enum v4l2_buf_type -replace symbol V4L2_BUF_TYPE_SDR_CAPTURE v4l2-buf-type -replace symbol V4L2_BUF_TYPE_SDR_OUTPUT v4l2-buf-type -replace symbol V4L2_BUF_TYPE_SLICED_VBI_CAPTURE v4l2-buf-type -replace symbol V4L2_BUF_TYPE_SLICED_VBI_OUTPUT v4l2-buf-type -replace symbol V4L2_BUF_TYPE_VBI_CAPTURE v4l2-buf-type -replace symbol V4L2_BUF_TYPE_VBI_OUTPUT v4l2-buf-type -replace symbol V4L2_BUF_TYPE_VIDEO_CAPTURE v4l2-buf-type -replace symbol V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE v4l2-buf-type -replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT v4l2-buf-type -replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE v4l2-buf-type -replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY v4l2-buf-type -replace symbol V4L2_BUF_TYPE_VIDEO_OVERLAY v4l2-buf-type +replace symbol V4L2_BUF_TYPE_SDR_CAPTURE :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_SDR_OUTPUT :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_SLICED_VBI_CAPTURE :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_SLICED_VBI_OUTPUT :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_VBI_CAPTURE :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_VBI_OUTPUT :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_VIDEO_CAPTURE :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY :c:type:`v4l2_buf_type` +replace symbol V4L2_BUF_TYPE_VIDEO_OVERLAY :c:type:`v4l2_buf_type` # Documented enum v4l2_tuner_type -replace symbol V4L2_TUNER_ANALOG_TV v4l2-tuner-type -replace symbol V4L2_TUNER_RADIO v4l2-tuner-type -replace symbol V4L2_TUNER_RF v4l2-tuner-type -replace symbol V4L2_TUNER_SDR v4l2-tuner-type +replace symbol V4L2_TUNER_ANALOG_TV :c:type:`v4l2_tuner_type` +replace symbol V4L2_TUNER_RADIO :c:type:`v4l2_tuner_type` +replace symbol V4L2_TUNER_RF :c:type:`v4l2_tuner_type` +replace symbol V4L2_TUNER_SDR :c:type:`v4l2_tuner_type` # Documented enum v4l2_memory -replace symbol V4L2_MEMORY_DMABUF v4l2-memory -replace symbol V4L2_MEMORY_MMAP v4l2-memory -replace symbol V4L2_MEMORY_OVERLAY v4l2-memory -replace symbol V4L2_MEMORY_USERPTR v4l2-memory +replace symbol V4L2_MEMORY_DMABUF :c:type:`v4l2_memory` +replace symbol V4L2_MEMORY_MMAP :c:type:`v4l2_memory` +replace symbol V4L2_MEMORY_OVERLAY :c:type:`v4l2_memory` +replace symbol V4L2_MEMORY_USERPTR :c:type:`v4l2_memory` # Documented enum v4l2_colorspace -replace symbol V4L2_COLORSPACE_470_SYSTEM_BG v4l2-colorspace -replace symbol V4L2_COLORSPACE_470_SYSTEM_M v4l2-colorspace -replace symbol V4L2_COLORSPACE_ADOBERGB v4l2-colorspace -replace symbol V4L2_COLORSPACE_BT2020 v4l2-colorspace -replace symbol V4L2_COLORSPACE_DCI_P3 v4l2-colorspace -replace symbol V4L2_COLORSPACE_DEFAULT v4l2-colorspace -replace symbol V4L2_COLORSPACE_JPEG v4l2-colorspace -replace symbol V4L2_COLORSPACE_RAW v4l2-colorspace -replace symbol V4L2_COLORSPACE_REC709 v4l2-colorspace -replace symbol V4L2_COLORSPACE_SMPTE170M v4l2-colorspace -replace symbol V4L2_COLORSPACE_SMPTE240M v4l2-colorspace -replace symbol V4L2_COLORSPACE_SRGB v4l2-colorspace +replace symbol V4L2_COLORSPACE_470_SYSTEM_BG :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_470_SYSTEM_M :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_ADOBERGB :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_BT2020 :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_DCI_P3 :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_DEFAULT :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_JPEG :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_RAW :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_REC709 :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_SMPTE170M :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_SMPTE240M :c:type:`v4l2_colorspace` +replace symbol V4L2_COLORSPACE_SRGB :c:type:`v4l2_colorspace` # Documented enum v4l2_xfer_func -replace symbol V4L2_XFER_FUNC_709 v4l2-xfer-func -replace symbol V4L2_XFER_FUNC_ADOBERGB v4l2-xfer-func -replace symbol V4L2_XFER_FUNC_DCI_P3 v4l2-xfer-func -replace symbol V4L2_XFER_FUNC_DEFAULT v4l2-xfer-func -replace symbol V4L2_XFER_FUNC_NONE v4l2-xfer-func -replace symbol V4L2_XFER_FUNC_SMPTE2084 v4l2-xfer-func -replace symbol V4L2_XFER_FUNC_SMPTE240M v4l2-xfer-func -replace symbol V4L2_XFER_FUNC_SRGB v4l2-xfer-func +replace symbol V4L2_XFER_FUNC_709 :c:type:`v4l2_xfer_func` +replace symbol V4L2_XFER_FUNC_ADOBERGB :c:type:`v4l2_xfer_func` +replace symbol V4L2_XFER_FUNC_DCI_P3 :c:type:`v4l2_xfer_func` +replace symbol V4L2_XFER_FUNC_DEFAULT :c:type:`v4l2_xfer_func` +replace symbol V4L2_XFER_FUNC_NONE :c:type:`v4l2_xfer_func` +replace symbol V4L2_XFER_FUNC_SMPTE2084 :c:type:`v4l2_xfer_func` +replace symbol V4L2_XFER_FUNC_SMPTE240M :c:type:`v4l2_xfer_func` +replace symbol V4L2_XFER_FUNC_SRGB :c:type:`v4l2_xfer_func` # Documented enum v4l2_ycbcr_encoding -replace symbol V4L2_YCBCR_ENC_601 v4l2-ycbcr-encoding -replace symbol V4L2_YCBCR_ENC_709 v4l2-ycbcr-encoding -replace symbol V4L2_YCBCR_ENC_BT2020 v4l2-ycbcr-encoding -replace symbol V4L2_YCBCR_ENC_BT2020_CONST_LUM v4l2-ycbcr-encoding -replace symbol V4L2_YCBCR_ENC_DEFAULT v4l2-ycbcr-encoding -replace symbol V4L2_YCBCR_ENC_SYCC v4l2-ycbcr-encoding -replace symbol V4L2_YCBCR_ENC_XV601 v4l2-ycbcr-encoding -replace symbol V4L2_YCBCR_ENC_XV709 v4l2-ycbcr-encoding -replace symbol V4L2_YCBCR_ENC_SMPTE240M v4l2-ycbcr-encoding +replace symbol V4L2_YCBCR_ENC_601 :c:type:`v4l2_ycbcr_encoding` +replace symbol V4L2_YCBCR_ENC_709 :c:type:`v4l2_ycbcr_encoding` +replace symbol V4L2_YCBCR_ENC_BT2020 :c:type:`v4l2_ycbcr_encoding` +replace symbol V4L2_YCBCR_ENC_BT2020_CONST_LUM :c:type:`v4l2_ycbcr_encoding` +replace symbol V4L2_YCBCR_ENC_DEFAULT :c:type:`v4l2_ycbcr_encoding` +replace symbol V4L2_YCBCR_ENC_SYCC :c:type:`v4l2_ycbcr_encoding` +replace symbol V4L2_YCBCR_ENC_XV601 :c:type:`v4l2_ycbcr_encoding` +replace symbol V4L2_YCBCR_ENC_XV709 :c:type:`v4l2_ycbcr_encoding` +replace symbol V4L2_YCBCR_ENC_SMPTE240M :c:type:`v4l2_ycbcr_encoding` # Documented enum v4l2_quantization -replace symbol V4L2_QUANTIZATION_DEFAULT v4l2-quantization -replace symbol V4L2_QUANTIZATION_FULL_RANGE v4l2-quantization -replace symbol V4L2_QUANTIZATION_LIM_RANGE v4l2-quantization +replace symbol V4L2_QUANTIZATION_DEFAULT :c:type:`v4l2_quantization` +replace symbol V4L2_QUANTIZATION_FULL_RANGE :c:type:`v4l2_quantization` +replace symbol V4L2_QUANTIZATION_LIM_RANGE :c:type:`v4l2_quantization` # Documented enum v4l2_priority -replace symbol V4L2_PRIORITY_BACKGROUND v4l2-priority -replace symbol V4L2_PRIORITY_DEFAULT v4l2-priority -replace symbol V4L2_PRIORITY_INTERACTIVE v4l2-priority -replace symbol V4L2_PRIORITY_RECORD v4l2-priority -replace symbol V4L2_PRIORITY_UNSET v4l2-priority +replace symbol V4L2_PRIORITY_BACKGROUND :c:type:`v4l2_priority` +replace symbol V4L2_PRIORITY_DEFAULT :c:type:`v4l2_priority` +replace symbol V4L2_PRIORITY_INTERACTIVE :c:type:`v4l2_priority` +replace symbol V4L2_PRIORITY_RECORD :c:type:`v4l2_priority` +replace symbol V4L2_PRIORITY_UNSET :c:type:`v4l2_priority` # Documented enum v4l2_frmsizetypes -replace symbol V4L2_FRMSIZE_TYPE_CONTINUOUS v4l2-frmsizetypes -replace symbol V4L2_FRMSIZE_TYPE_DISCRETE v4l2-frmsizetypes -replace symbol V4L2_FRMSIZE_TYPE_STEPWISE v4l2-frmsizetypes +replace symbol V4L2_FRMSIZE_TYPE_CONTINUOUS :c:type:`v4l2_frmsizetypes` +replace symbol V4L2_FRMSIZE_TYPE_DISCRETE :c:type:`v4l2_frmsizetypes` +replace symbol V4L2_FRMSIZE_TYPE_STEPWISE :c:type:`v4l2_frmsizetypes` # Documented enum frmivaltypes -replace symbol V4L2_FRMIVAL_TYPE_CONTINUOUS v4l2-frmivaltypes -replace symbol V4L2_FRMIVAL_TYPE_DISCRETE v4l2-frmivaltypes -replace symbol V4L2_FRMIVAL_TYPE_STEPWISE v4l2-frmivaltypes +replace symbol V4L2_FRMIVAL_TYPE_CONTINUOUS :c:type:`v4l2_frmivaltypes` +replace symbol V4L2_FRMIVAL_TYPE_DISCRETE :c:type:`v4l2_frmivaltypes` +replace symbol V4L2_FRMIVAL_TYPE_STEPWISE :c:type:`v4l2_frmivaltypes` -# Documented enum v4l2-ctrl-type +# Documented enum :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_COMPOUND_TYPES vidioc_queryctrl -replace symbol V4L2_CTRL_TYPE_BITMASK v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_BOOLEAN v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_BUTTON v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_CTRL_CLASS v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_INTEGER v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_INTEGER64 v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_INTEGER_MENU v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_MENU v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_STRING v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_U16 v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_U32 v4l2-ctrl-type -replace symbol V4L2_CTRL_TYPE_U8 v4l2-ctrl-type +replace symbol V4L2_CTRL_TYPE_BITMASK :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_BOOLEAN :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_BUTTON :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_CTRL_CLASS :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_INTEGER :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_INTEGER64 :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_INTEGER_MENU :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_MENU :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_STRING :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_U16 :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_U32 :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_U8 :c:type:`v4l2_ctrl_type` # V4L2 capability defines replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities @@ -155,7 +155,7 @@ replace define V4L2_CAP_DEVICE_CAPS device-capabilities replace define V4L2_CAP_TOUCH device-capabilities # V4L2 pix flags -replace define V4L2_PIX_FMT_PRIV_MAGIC v4l2-pix-format +replace define V4L2_PIX_FMT_PRIV_MAGIC :c:type:`v4l2_pix_format` replace define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA reserved-formats # V4L2 format flags @@ -205,7 +205,7 @@ replace define V4L2_FBUF_FLAG_SRC_CHROMAKEY framebuffer-flags # Used on VIDIOC_G_PARM replace define V4L2_MODE_HIGHQUALITY parm-flags -replace define V4L2_CAP_TIMEPERFRAME v4l2-captureparm +replace define V4L2_CAP_TIMEPERFRAME :c:type:`v4l2_captureparm` # The V4L2_STD_foo are all defined at v4l2_std_id table @@ -258,11 +258,11 @@ replace define V4L2_STD_ALL v4l2-std-id # V4L2 DT BT timings definitions -replace define V4L2_DV_PROGRESSIVE v4l2-bt-timings -replace define V4L2_DV_INTERLACED v4l2-bt-timings +replace define V4L2_DV_PROGRESSIVE :c:type:`v4l2_bt_timings` +replace define V4L2_DV_INTERLACED :c:type:`v4l2_bt_timings` -replace define V4L2_DV_VSYNC_POS_POL v4l2-bt-timings -replace define V4L2_DV_HSYNC_POS_POL v4l2-bt-timings +replace define V4L2_DV_VSYNC_POS_POL :c:type:`v4l2_bt_timings` +replace define V4L2_DV_HSYNC_POS_POL :c:type:`v4l2_bt_timings` replace define V4L2_DV_BT_STD_CEA861 dv-bt-standards replace define V4L2_DV_BT_STD_DMT dv-bt-standards @@ -387,11 +387,11 @@ replace define V4L2_AUDMODE_AVL audio-mode # MPEG -replace define V4L2_ENC_IDX_FRAME_I v4l2-enc-idx -replace define V4L2_ENC_IDX_FRAME_P v4l2-enc-idx -replace define V4L2_ENC_IDX_FRAME_B v4l2-enc-idx -replace define V4L2_ENC_IDX_FRAME_MASK v4l2-enc-idx -replace define V4L2_ENC_IDX_ENTRIES v4l2-enc-idx +replace define V4L2_ENC_IDX_FRAME_I :c:type:`v4l2_enc_idx` +replace define V4L2_ENC_IDX_FRAME_P :c:type:`v4l2_enc_idx` +replace define V4L2_ENC_IDX_FRAME_B :c:type:`v4l2_enc_idx` +replace define V4L2_ENC_IDX_FRAME_MASK :c:type:`v4l2_enc_idx` +replace define V4L2_ENC_IDX_ENTRIES :c:type:`v4l2_enc_idx` replace define V4L2_ENC_CMD_START encoder-cmds replace define V4L2_ENC_CMD_STOP encoder-cmds @@ -418,10 +418,10 @@ replace define V4L2_DEC_START_FMT_GOP decoder-cmds replace define V4L2_VBI_UNSYNC vbifmt-flags replace define V4L2_VBI_INTERLACED vbifmt-flags -replace define V4L2_VBI_ITU_525_F1_START v4l2-vbi-format -replace define V4L2_VBI_ITU_525_F2_START v4l2-vbi-format -replace define V4L2_VBI_ITU_625_F1_START v4l2-vbi-format -replace define V4L2_VBI_ITU_625_F2_START v4l2-vbi-format +replace define V4L2_VBI_ITU_525_F1_START :c:type:`v4l2_vbi_format` +replace define V4L2_VBI_ITU_525_F2_START :c:type:`v4l2_vbi_format` +replace define V4L2_VBI_ITU_625_F1_START :c:type:`v4l2_vbi_format` +replace define V4L2_VBI_ITU_625_F2_START :c:type:`v4l2_vbi_format` replace define V4L2_SLICED_TELETEXT_B vbi-services @@ -456,7 +456,7 @@ replace define V4L2_EVENT_CTRL_CH_RANGE ctrl-changes-flags replace define V4L2_EVENT_SRC_CH_RESOLUTION src-changes-flags -replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ v4l2-event-motion-det +replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`v4l2_event_motion_det` replace define V4L2_EVENT_SUB_FL_SEND_INITIAL event-flags replace define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK event-flags From 8b98db6b2b0e2a845a441b439cc7dcb0b16867bd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 07:50:59 -0300 Subject: [PATCH 342/591] [media] dev-sliced-vbi.rst: fix reference for v4l2_mpeg_vbi_ITV0 The struct v4l2_mpeg_vbi_ITV0 is identical to struct v4l2_mpeg_vbi_itv0, except by its size, and it is documented at the same place at the book. Fix cross reference for it. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/dev-sliced-vbi.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst index 7f159c3d4942..019cac7e90e4 100644 --- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst @@ -672,8 +672,10 @@ Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field .. c:type:: v4l2_mpeg_vbi_itv0 -struct v4l2_mpeg_vbi_itv0 -------------------------- +.. c:type:: v4l2_mpeg_vbi_ITV0 + +structs v4l2_mpeg_vbi_itv0 and v4l2_mpeg_vbi_ITV0 +------------------------------------------------- .. tabularcolumns:: |p{4.4cm}|p{2.4cm}|p{10.7cm}| From 16f8306b349742ae2bd4f938cc03de4552e62d6e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 07:55:13 -0300 Subject: [PATCH 343/591] [media] media-ioc-g-topology.rst: fix a c domain reference One reference there is still using :ref:. Fix it, to solve this warning: Documentation/media/uapi/mediactl/media-ioc-g-topology.rst:236: WARNING: undefined label: media-v2-intf-devnode (if the link has no caption the label must precede a section header) Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/mediactl/media-ioc-g-topology.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst index 0b26fd865b72..48c9531f4db0 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst @@ -234,7 +234,7 @@ desired arrays with the media graph elements. - ``devnode`` - Used only for device node interfaces. See - :ref:`media-v2-intf-devnode` for details.. + :c:type:`media_v2_intf_devnode` for details.. .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}| From e9de2d89a7e48c777254780502c16157e1740587 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 08:14:10 -0300 Subject: [PATCH 344/591] [media] docs-rst: fix two wrong :name: tags There's a typo there, causing 4 warnings: Documentation/media/uapi/rc/lirc-read.rst:26: WARNING: c:type reference target not found: name Documentation/media/uapi/rc/lirc-read.rst:26: WARNING: c:type reference target not found: lirc Documentation/media/uapi/v4l/func-poll.rst:25: WARNING: c:type reference target not found: name Documentation/media/uapi/v4l/func-poll.rst:25: WARNING: c:type reference target not found: v4l2 Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/rc/lirc-read.rst | 2 +- Documentation/media/uapi/v4l/func-poll.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/rc/lirc-read.rst b/Documentation/media/uapi/rc/lirc-read.rst index 62bd3d8c9c67..4c678f60e872 100644 --- a/Documentation/media/uapi/rc/lirc-read.rst +++ b/Documentation/media/uapi/rc/lirc-read.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: ssize_t read( int fd, void *buf, size_t count ) - :name lirc-read + :name: lirc-read Arguments diff --git a/Documentation/media/uapi/v4l/func-poll.rst b/Documentation/media/uapi/v4l/func-poll.rst index 186cd61b6cd1..d0432dc09b05 100644 --- a/Documentation/media/uapi/v4l/func-poll.rst +++ b/Documentation/media/uapi/v4l/func-poll.rst @@ -21,7 +21,7 @@ Synopsis .. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout ) - name: v4l2-poll + :name: v4l2-poll Arguments ========= From c13dce18b8266566e951b1d4b9bbbbbf25a00068 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 08:18:04 -0300 Subject: [PATCH 345/591] [media] rc-map.h: fix a Sphinx warning ./include/media/rc-map.h:121: WARNING: Inline emphasis start-string without end-string. Signed-off-by: Mauro Carvalho Chehab --- include/media/rc-map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 173ad58fb61b..3c8edb34f84a 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -117,7 +117,7 @@ struct rc_map_table { * @scan: pointer to struct &rc_map_table * @size: Max number of entries * @len: Number of entries that are in use - * @alloc: size of *scan, in bytes + * @alloc: size of \*scan, in bytes * @rc_type: type of the remote controller protocol, as defined at * enum &rc_type * @name: name of the key map table From 82631b5bb268f670613db110177483ae3e85f913 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 09:57:24 -0300 Subject: [PATCH 346/591] [media] mc-core.rst: fix a warning about an internal routine Fix this warning: Documentation/media/kapi/mc-core.rst:97: WARNING: c:func reference target not found: media_devnode_release The media_device_release() is a function internal to media-devnode.c, and not exported elsewhere. So, we can't cross-reference it here. Make it explicit at the documentation. Signed-off-by: Mauro Carvalho Chehab --- include/media/media-devnode.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h index 972168e90413..cd23e915764c 100644 --- a/include/media/media-devnode.h +++ b/include/media/media-devnode.h @@ -76,7 +76,8 @@ struct media_file_operations { * @parent: parent device * @minor: device node minor number * @flags: flags, combination of the ``MEDIA_FLAG_*`` constants - * @release: release callback called at the end of media_devnode_release() + * @release: release callback called at the end of ``media_devnode_release()`` + * routine at media-device.c. * * This structure represents a media-related device node. * From 4781646c1e13b23ed31eb12f7e314824d98ce066 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 10:16:27 -0300 Subject: [PATCH 347/591] [media] v4l2-mem2mem.h: move descriptions from .c file Several routines are somewhat documented at v4l2-mem2mem.c file. Move what's there to the header file. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-mem2mem.c | 128 +----------------------- include/media/v4l2-mem2mem.h | 132 +++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 127 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 61d56c940f80..6bc27e7b2a33 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -76,9 +76,6 @@ static struct v4l2_m2m_queue_ctx *get_queue_ctx(struct v4l2_m2m_ctx *m2m_ctx, return &m2m_ctx->cap_q_ctx; } -/** - * v4l2_m2m_get_vq() - return vb2_queue for the given type - */ struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type) { @@ -92,9 +89,6 @@ struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL(v4l2_m2m_get_vq); -/** - * v4l2_m2m_next_buf() - return next buffer from the list of ready buffers - */ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx) { struct v4l2_m2m_buffer *b; @@ -113,10 +107,6 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx) } EXPORT_SYMBOL_GPL(v4l2_m2m_next_buf); -/** - * v4l2_m2m_buf_remove() - take off a buffer from the list of ready buffers and - * return it - */ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx) { struct v4l2_m2m_buffer *b; @@ -140,10 +130,6 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_buf_remove); * Scheduling handlers */ -/** - * v4l2_m2m_get_curr_priv() - return driver private data for the currently - * running instance or NULL if no instance is running - */ void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev) { unsigned long flags; @@ -188,26 +174,6 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev) m2m_dev->m2m_ops->device_run(m2m_dev->curr_ctx->priv); } -/** - * v4l2_m2m_try_schedule() - check whether an instance is ready to be added to - * the pending job queue and add it if so. - * @m2m_ctx: m2m context assigned to the instance to be checked - * - * There are three basic requirements an instance has to meet to be able to run: - * 1) at least one source buffer has to be queued, - * 2) at least one destination buffer has to be queued, - * 3) streaming has to be on. - * - * If a queue is buffered (for example a decoder hardware ringbuffer that has - * to be drained before doing streamoff), allow scheduling without v4l2 buffers - * on that queue. - * - * There may also be additional, custom requirements. In such case the driver - * should supply a custom callback (job_ready in v4l2_m2m_ops) that should - * return 1 if the instance is ready. - * An example of the above could be an instance that requires more than one - * src/dst buffer per transaction. - */ void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) { struct v4l2_m2m_dev *m2m_dev; @@ -311,18 +277,6 @@ static void v4l2_m2m_cancel_job(struct v4l2_m2m_ctx *m2m_ctx) } } -/** - * v4l2_m2m_job_finish() - inform the framework that a job has been finished - * and have it clean up - * - * Called by a driver to yield back the device after it has finished with it. - * Should be called as soon as possible after reaching a state which allows - * other instances to take control of the device. - * - * This function has to be called only after device_run() callback has been - * called on the driver. To prevent recursion, it should not be called directly - * from the device_run() callback though. - */ void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, struct v4l2_m2m_ctx *m2m_ctx) { @@ -350,9 +304,6 @@ void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, } EXPORT_SYMBOL(v4l2_m2m_job_finish); -/** - * v4l2_m2m_reqbufs() - multi-queue-aware REQBUFS multiplexer - */ int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_requestbuffers *reqbufs) { @@ -370,11 +321,6 @@ int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL_GPL(v4l2_m2m_reqbufs); -/** - * v4l2_m2m_querybuf() - multi-queue-aware QUERYBUF multiplexer - * - * See v4l2_m2m_mmap() documentation for details. - */ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf) { @@ -400,10 +346,6 @@ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL_GPL(v4l2_m2m_querybuf); -/** - * v4l2_m2m_qbuf() - enqueue a source or destination buffer, depending on - * the type - */ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf) { @@ -419,10 +361,6 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL_GPL(v4l2_m2m_qbuf); -/** - * v4l2_m2m_dqbuf() - dequeue a source or destination buffer, depending on - * the type - */ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf) { @@ -433,10 +371,6 @@ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); -/** - * v4l2_m2m_prepare_buf() - prepare a source or destination buffer, depending on - * the type - */ int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf) { @@ -452,10 +386,6 @@ int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL_GPL(v4l2_m2m_prepare_buf); -/** - * v4l2_m2m_create_bufs() - create a source or destination buffer, depending - * on the type - */ int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_create_buffers *create) { @@ -466,10 +396,6 @@ int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL_GPL(v4l2_m2m_create_bufs); -/** - * v4l2_m2m_expbuf() - export a source or destination buffer, depending on - * the type - */ int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_exportbuffer *eb) { @@ -479,9 +405,7 @@ int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, return vb2_expbuf(vq, eb); } EXPORT_SYMBOL_GPL(v4l2_m2m_expbuf); -/** - * v4l2_m2m_streamon() - turn on streaming for a video queue - */ + int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type) { @@ -497,9 +421,6 @@ int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL_GPL(v4l2_m2m_streamon); -/** - * v4l2_m2m_streamoff() - turn off streaming for a video queue - */ int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type) { @@ -540,14 +461,6 @@ int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL_GPL(v4l2_m2m_streamoff); -/** - * v4l2_m2m_poll() - poll replacement, for destination buffers only - * - * Call from the driver's poll() function. Will poll both queues. If a buffer - * is available to dequeue (with dqbuf) from the source queue, this will - * indicate that a non-blocking write can be performed, while read will be - * returned in case of the destination queue. - */ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct poll_table_struct *wait) { @@ -626,16 +539,6 @@ end: } EXPORT_SYMBOL_GPL(v4l2_m2m_poll); -/** - * v4l2_m2m_mmap() - source and destination queues-aware mmap multiplexer - * - * Call from driver's mmap() function. Will handle mmap() for both queues - * seamlessly for videobuffer, which will receive normal per-queue offsets and - * proper videobuf queue pointers. The differentiation is made outside videobuf - * by adding a predefined offset to buffers from one of the queues and - * subtracting it before passing it back to videobuf. Only drivers (and - * thus applications) receive modified offsets. - */ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct vm_area_struct *vma) { @@ -653,11 +556,6 @@ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, } EXPORT_SYMBOL(v4l2_m2m_mmap); -/** - * v4l2_m2m_init() - initialize per-driver m2m data - * - * Usually called from driver's probe() function. - */ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops) { struct v4l2_m2m_dev *m2m_dev; @@ -679,26 +577,12 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops) } EXPORT_SYMBOL_GPL(v4l2_m2m_init); -/** - * v4l2_m2m_release() - cleans up and frees a m2m_dev structure - * - * Usually called from driver's remove() function. - */ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev) { kfree(m2m_dev); } EXPORT_SYMBOL_GPL(v4l2_m2m_release); -/** - * v4l2_m2m_ctx_init() - allocate and initialize a m2m context - * @priv - driver's instance private data - * @m2m_dev - a previously initialized m2m_dev struct - * @vq_init - a callback for queue type-specific initialization function to be - * used for initializing videobuf_queues - * - * Usually called from driver's open() function. - */ struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev, void *drv_priv, int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)) @@ -744,11 +628,6 @@ err: } EXPORT_SYMBOL_GPL(v4l2_m2m_ctx_init); -/** - * v4l2_m2m_ctx_release() - release m2m context - * - * Usually called from driver's release() function. - */ void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx) { /* wait until the current context is dequeued from job_queue */ @@ -761,11 +640,6 @@ void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx) } EXPORT_SYMBOL_GPL(v4l2_m2m_ctx_release); -/** - * v4l2_m2m_buf_queue() - add a buffer to the proper ready buffers list. - * - * Call from buf_queue(), videobuf_queue_ops callback. - */ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_v4l2_buffer *vbuf) { diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index 5a9597dd1ee0..e5449a2c8475 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h @@ -94,13 +94,52 @@ struct v4l2_m2m_buffer { struct list_head list; }; +/** + * v4l2_m2m_get_curr_priv() - return driver private data for the currently + * running instance or NULL if no instance is running + */ void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); +/** + * v4l2_m2m_get_vq() - return vb2_queue for the given type + */ struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); +/** + * v4l2_m2m_try_schedule() - check whether an instance is ready to be added to + * the pending job queue and add it if so. + * @m2m_ctx: m2m context assigned to the instance to be checked + * + * There are three basic requirements an instance has to meet to be able to run: + * 1) at least one source buffer has to be queued, + * 2) at least one destination buffer has to be queued, + * 3) streaming has to be on. + * + * If a queue is buffered (for example a decoder hardware ringbuffer that has + * to be drained before doing streamoff), allow scheduling without v4l2 buffers + * on that queue. + * + * There may also be additional, custom requirements. In such case the driver + * should supply a custom callback (job_ready in v4l2_m2m_ops) that should + * return 1 if the instance is ready. + * An example of the above could be an instance that requires more than one + * src/dst buffer per transaction. + */ void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx); +/** + * v4l2_m2m_job_finish() - inform the framework that a job has been finished + * and have it clean up + * + * Called by a driver to yield back the device after it has finished with it. + * Should be called as soon as possible after reaching a state which allows + * other instances to take control of the device. + * + * This function has to be called only after device_run() callback has been + * called on the driver. To prevent recursion, it should not be called directly + * from the device_run() callback though. + */ void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, struct v4l2_m2m_ctx *m2m_ctx); @@ -110,38 +149,114 @@ v4l2_m2m_buf_done(struct vb2_v4l2_buffer *buf, enum vb2_buffer_state state) vb2_buffer_done(&buf->vb2_buf, state); } +/** + * v4l2_m2m_reqbufs() - multi-queue-aware REQBUFS multiplexer + */ int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_requestbuffers *reqbufs); +/** + * v4l2_m2m_querybuf() - multi-queue-aware QUERYBUF multiplexer + * + * See v4l2_m2m_mmap() documentation for details. + */ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf); +/** + * v4l2_m2m_qbuf() - enqueue a source or destination buffer, depending on + * the type + */ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf); + +/** + * v4l2_m2m_dqbuf() - dequeue a source or destination buffer, depending on + * the type + */ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf); + +/** + * v4l2_m2m_prepare_buf() - prepare a source or destination buffer, depending on + * the type + */ int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf); + +/** + * v4l2_m2m_create_bufs() - create a source or destination buffer, depending + * on the type + */ int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_create_buffers *create); +/** + * v4l2_m2m_expbuf() - export a source or destination buffer, depending on + * the type + */ int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_exportbuffer *eb); +/** + * v4l2_m2m_streamon() - turn on streaming for a video queue + */ int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); + +/** + * v4l2_m2m_streamoff() - turn off streaming for a video queue + */ int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); +/** + * v4l2_m2m_poll() - poll replacement, for destination buffers only + * + * Call from the driver's poll() function. Will poll both queues. If a buffer + * is available to dequeue (with dqbuf) from the source queue, this will + * indicate that a non-blocking write can be performed, while read will be + * returned in case of the destination queue. + */ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct poll_table_struct *wait); +/** + * v4l2_m2m_mmap() - source and destination queues-aware mmap multiplexer + * + * Call from driver's mmap() function. Will handle mmap() for both queues + * seamlessly for videobuffer, which will receive normal per-queue offsets and + * proper videobuf queue pointers. The differentiation is made outside videobuf + * by adding a predefined offset to buffers from one of the queues and + * subtracting it before passing it back to videobuf. Only drivers (and + * thus applications) receive modified offsets. + */ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct vm_area_struct *vma); +/** + * v4l2_m2m_init() - initialize per-driver m2m data + * + * Usually called from driver's probe() function. + */ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops); + +/** + * v4l2_m2m_release() - cleans up and frees a m2m_dev structure + * + * Usually called from driver's remove() function. + */ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); +/** + * v4l2_m2m_ctx_init() - allocate and initialize a m2m context + * @priv - driver's instance private data + * @m2m_dev - a previously initialized m2m_dev struct + * @vq_init - a callback for queue type-specific initialization function to be + * used for initializing videobuf_queues + * + * Usually called from driver's open() function. + */ struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev, void *drv_priv, int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)); @@ -158,8 +273,18 @@ static inline void v4l2_m2m_set_dst_buffered(struct v4l2_m2m_ctx *m2m_ctx, m2m_ctx->cap_q_ctx.buffered = buffered; } +/** + * v4l2_m2m_ctx_release() - release m2m context + * + * Usually called from driver's release() function. + */ void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); +/** + * v4l2_m2m_buf_queue() - add a buffer to the proper ready buffers list. + * + * Call from buf_queue(), videobuf_queue_ops callback. + */ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_v4l2_buffer *vbuf); @@ -187,6 +312,9 @@ unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) return m2m_ctx->cap_q_ctx.num_rdy; } +/** + * v4l2_m2m_next_buf() - return next buffer from the list of ready buffers + */ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx); /** @@ -233,6 +361,10 @@ struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) return &m2m_ctx->cap_q_ctx.q; } +/** + * v4l2_m2m_buf_remove() - take off a buffer from the list of ready buffers and + * return it + */ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx); /** From dcbd87358929ed989732a9866e683e33d0018461 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 10:39:58 -0300 Subject: [PATCH 348/591] [media] v4l2-mem2mem.h: document function arguments There are lots of troubles with the function arguments on this file. Fix them. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-mem2mem.h | 93 +++++++++++++++++++++++++++++++----- 1 file changed, 80 insertions(+), 13 deletions(-) diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index e5449a2c8475..00410bd14772 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h @@ -97,11 +97,16 @@ struct v4l2_m2m_buffer { /** * v4l2_m2m_get_curr_priv() - return driver private data for the currently * running instance or NULL if no instance is running + * + * @m2m_dev: pointer to struct &v4l2_m2m_dev */ void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); /** * v4l2_m2m_get_vq() - return vb2_queue for the given type + * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @type: type of the V4L2 buffer, as defined by enum &v4l2_buf_type */ struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); @@ -109,7 +114,8 @@ struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_try_schedule() - check whether an instance is ready to be added to * the pending job queue and add it if so. - * @m2m_ctx: m2m context assigned to the instance to be checked + * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx * * There are three basic requirements an instance has to meet to be able to run: * 1) at least one source buffer has to be queued, @@ -132,6 +138,9 @@ void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx); * v4l2_m2m_job_finish() - inform the framework that a job has been finished * and have it clean up * + * @m2m_dev: pointer to struct &v4l2_m2m_dev + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * * Called by a driver to yield back the device after it has finished with it. * Should be called as soon as possible after reaching a state which allows * other instances to take control of the device. @@ -151,6 +160,10 @@ v4l2_m2m_buf_done(struct vb2_v4l2_buffer *buf, enum vb2_buffer_state state) /** * v4l2_m2m_reqbufs() - multi-queue-aware REQBUFS multiplexer + * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @reqbufs: pointer to struct &v4l2_requestbuffers */ int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_requestbuffers *reqbufs); @@ -158,6 +171,10 @@ int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_querybuf() - multi-queue-aware QUERYBUF multiplexer * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @buf: pointer to struct &v4l2_buffer + * * See v4l2_m2m_mmap() documentation for details. */ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, @@ -166,6 +183,10 @@ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_qbuf() - enqueue a source or destination buffer, depending on * the type + * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @buf: pointer to struct &v4l2_buffer */ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf); @@ -173,6 +194,10 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_dqbuf() - dequeue a source or destination buffer, depending on * the type + * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @buf: pointer to struct &v4l2_buffer */ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf); @@ -180,6 +205,10 @@ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_prepare_buf() - prepare a source or destination buffer, depending on * the type + * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @buf: pointer to struct &v4l2_buffer */ int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf); @@ -187,6 +216,10 @@ int v4l2_m2m_prepare_buf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_create_bufs() - create a source or destination buffer, depending * on the type + * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @create: pointer to struct &v4l2_create_buffers */ int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_create_buffers *create); @@ -194,18 +227,30 @@ int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_expbuf() - export a source or destination buffer, depending on * the type + * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @eb: pointer to struct &v4l2_exportbuffer */ int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_exportbuffer *eb); /** * v4l2_m2m_streamon() - turn on streaming for a video queue + * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @type: type of the V4L2 buffer, as defined by enum &v4l2_buf_type */ int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); /** * v4l2_m2m_streamoff() - turn off streaming for a video queue + * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @type: type of the V4L2 buffer, as defined by enum &v4l2_buf_type */ int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); @@ -213,6 +258,10 @@ int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_poll() - poll replacement, for destination buffers only * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @wait: pointer to struct &poll_table_struct + * * Call from the driver's poll() function. Will poll both queues. If a buffer * is available to dequeue (with dqbuf) from the source queue, this will * indicate that a non-blocking write can be performed, while read will be @@ -224,6 +273,10 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_mmap() - source and destination queues-aware mmap multiplexer * + * @file: pointer to struct &file + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @vma: pointer to struct &vm_area_struct + * * Call from driver's mmap() function. Will handle mmap() for both queues * seamlessly for videobuffer, which will receive normal per-queue offsets and * proper videobuf queue pointers. The differentiation is made outside videobuf @@ -237,6 +290,8 @@ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_init() - initialize per-driver m2m data * + * @m2m_ops: pointer to struct v4l2_m2m_ops + * * Usually called from driver's probe() function. */ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops); @@ -244,16 +299,19 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops); /** * v4l2_m2m_release() - cleans up and frees a m2m_dev structure * + * @m2m_dev: pointer to struct &v4l2_m2m_dev + * * Usually called from driver's remove() function. */ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); /** * v4l2_m2m_ctx_init() - allocate and initialize a m2m context - * @priv - driver's instance private data - * @m2m_dev - a previously initialized m2m_dev struct - * @vq_init - a callback for queue type-specific initialization function to be - * used for initializing videobuf_queues + * + * @m2m_dev: a previously initialized m2m_dev struct + * @drv_priv: driver's instance private data + * @queue_init: a callback for queue type-specific initialization function + * to be used for initializing videobuf_queues * * Usually called from driver's open() function. */ @@ -276,6 +334,8 @@ static inline void v4l2_m2m_set_dst_buffered(struct v4l2_m2m_ctx *m2m_ctx, /** * v4l2_m2m_ctx_release() - release m2m context * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * * Usually called from driver's release() function. */ void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); @@ -283,6 +343,9 @@ void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); /** * v4l2_m2m_buf_queue() - add a buffer to the proper ready buffers list. * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @vbuf: pointer to struct &vb2_v4l2_buffer + * * Call from buf_queue(), videobuf_queue_ops callback. */ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, @@ -292,7 +355,7 @@ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for * use * - * @m2m_ctx: pointer to struct v4l2_m2m_ctx + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx */ static inline unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) @@ -304,7 +367,7 @@ unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers * ready for use * - * @m2m_ctx: pointer to struct v4l2_m2m_ctx + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx */ static inline unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) @@ -314,6 +377,8 @@ unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) /** * v4l2_m2m_next_buf() - return next buffer from the list of ready buffers + * + * @q_ctx: pointer to struct @v4l2_m2m_queue_ctx */ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx); @@ -321,7 +386,7 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx); * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready * buffers * - * @m2m_ctx: pointer to struct v4l2_m2m_ctx + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx */ static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) { @@ -332,7 +397,7 @@ static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of * ready buffers * - * @m2m_ctx: pointer to struct v4l2_m2m_ctx + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx */ static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) { @@ -342,7 +407,7 @@ static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) /** * v4l2_m2m_get_src_vq() - return vb2_queue for source buffers * - * @m2m_ctx: pointer to struct v4l2_m2m_ctx + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx */ static inline struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) @@ -353,7 +418,7 @@ struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) /** * v4l2_m2m_get_dst_vq() - return vb2_queue for destination buffers * - * @m2m_ctx: pointer to struct v4l2_m2m_ctx + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx */ static inline struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) @@ -364,6 +429,8 @@ struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) /** * v4l2_m2m_buf_remove() - take off a buffer from the list of ready buffers and * return it + * + * @q_ctx: pointer to struct @v4l2_m2m_queue_ctx */ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx); @@ -371,7 +438,7 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx); * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready * buffers and return it * - * @m2m_ctx: pointer to struct v4l2_m2m_ctx + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx */ static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) { @@ -382,7 +449,7 @@ static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of * ready buffers and return it * - * @m2m_ctx: pointer to struct v4l2_m2m_ctx + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx */ static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) { From 5fa5edbe59a7ab8ab649268fcb578662dfb7ca99 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 10:16:36 -0300 Subject: [PATCH 349/591] [media] v4l2-mem2mem.h: document the public structures Most structures here are not documented. Add a documentation for them. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-mem2mem.h | 67 +++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index 00410bd14772..cfa4f5e521a7 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h @@ -41,9 +41,9 @@ * This function does not have to (and will usually not) wait * until the device enters a state when it can be stopped. * @lock: optional. Define a driver's own lock callback, instead of using - * m2m_ctx->q_lock. + * &v4l2_m2m_ctx->q_lock. * @unlock: optional. Define a driver's own unlock callback, instead of - * using m2m_ctx->q_lock. + * using &v4l2_m2m_ctx->q_lock. */ struct v4l2_m2m_ops { void (*device_run)(void *priv); @@ -53,31 +53,59 @@ struct v4l2_m2m_ops { void (*unlock)(void *priv); }; +/** + * struct v4l2_m2m_dev - opaque struct used to represent a V4L2 M2M device. + * + * This structure is has the per-device context for a memory to memory + * device, and it is used internally at v4l2-mem2mem.c. + */ struct v4l2_m2m_dev; +/** + * struct v4l2_m2m_queue_ctx - represents a queue for buffers ready to be + * processed + * + * @q: pointer to struct &vb2_queue + * @rdy_queue: List of V4L2 mem-to-mem queues + * @rdy_spinlock: spin lock to protect the struct usage + * @num_rdy: number of buffers ready to be processed + * @buffered: is the queue buffered? + * + * Queue for buffers ready to be processed as soon as this + * instance receives access to the device. + */ + struct v4l2_m2m_queue_ctx { -/* private: internal use only */ struct vb2_queue q; - /* Queue for buffers ready to be processed as soon as this - * instance receives access to the device */ struct list_head rdy_queue; spinlock_t rdy_spinlock; u8 num_rdy; bool buffered; }; +/** + * struct v4l2_m2m_ctx - Memory to memory context structure + * + * @q_lock: struct &mutex lock + * @m2m_dev: pointer to struct &v4l2_m2m_dev + * @cap_q_ctx: Capture (output to memory) queue context + * @out_q_ctx: Output (input from memory) queue context + * @queue: List of memory to memory contexts + * @job_flags: Job queue flags, used internally by v4l2-mem2mem.c: + * %TRANS_QUEUED, %TRANS_RUNNING and %TRANS_ABORT. + * @finished: Wait queue used to signalize when a job queue finished. + * @priv: Instance private data + */ struct v4l2_m2m_ctx { /* optional cap/out vb2 queues lock */ struct mutex *q_lock; -/* private: internal use only */ + /* internal use only */ struct v4l2_m2m_dev *m2m_dev; - /* Capture (output to memory) queue context */ struct v4l2_m2m_queue_ctx cap_q_ctx; - /* Output (input from memory) queue context */ struct v4l2_m2m_queue_ctx out_q_ctx; /* For device job queue */ @@ -85,10 +113,15 @@ struct v4l2_m2m_ctx { unsigned long job_flags; wait_queue_head_t finished; - /* Instance private data */ void *priv; }; +/** + * struct v4l2_m2m_buffer - Memory to memory buffer + * + * @vb: pointer to struct &vb2_v4l2_buffer + * @list: list of m2m buffers + */ struct v4l2_m2m_buffer { struct vb2_v4l2_buffer vb; struct list_head list; @@ -145,9 +178,9 @@ void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx); * Should be called as soon as possible after reaching a state which allows * other instances to take control of the device. * - * This function has to be called only after device_run() callback has been - * called on the driver. To prevent recursion, it should not be called directly - * from the device_run() callback though. + * This function has to be called only after &v4l2_m2m_ops->device_run + * callback has been called on the driver. To prevent recursion, it should + * not be called directly from the &v4l2_m2m_ops->device_run callback though. */ void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, struct v4l2_m2m_ctx *m2m_ctx); @@ -292,7 +325,9 @@ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, * * @m2m_ops: pointer to struct v4l2_m2m_ops * - * Usually called from driver's probe() function. + * Usually called from driver's ``probe()`` function. + * + * Return: returns an opaque pointer to the internal data to handle M2M context */ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops); @@ -301,7 +336,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops); * * @m2m_dev: pointer to struct &v4l2_m2m_dev * - * Usually called from driver's remove() function. + * Usually called from driver's ``remove()`` function. */ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); @@ -313,7 +348,7 @@ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); * @queue_init: a callback for queue type-specific initialization function * to be used for initializing videobuf_queues * - * Usually called from driver's open() function. + * Usually called from driver's ``open()`` function. */ struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev, void *drv_priv, @@ -346,7 +381,7 @@ void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx * @vbuf: pointer to struct &vb2_v4l2_buffer * - * Call from buf_queue(), videobuf_queue_ops callback. + * Call from videobuf_queue_ops->ops->buf_queue, videobuf_queue_ops callback. */ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_v4l2_buffer *vbuf); From 9f8d3a2ee78110afc2aee85d979b869faac257e7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 17:20:44 -0300 Subject: [PATCH 350/591] [media] v4l2-mem2mem.h: make kernel-doc parse v4l2-mem2mem.h again The kernel-doc C parser doesn't like opaque structures. So, document it on another way. This should get rid of this warning: ./include/media/v4l2-mem2mem.h:62: error: Cannot parse struct or union! Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-mem2mem.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index cfa4f5e521a7..498c99baf8ac 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h @@ -53,12 +53,6 @@ struct v4l2_m2m_ops { void (*unlock)(void *priv); }; -/** - * struct v4l2_m2m_dev - opaque struct used to represent a V4L2 M2M device. - * - * This structure is has the per-device context for a memory to memory - * device, and it is used internally at v4l2-mem2mem.c. - */ struct v4l2_m2m_dev; /** @@ -88,7 +82,7 @@ struct v4l2_m2m_queue_ctx { * struct v4l2_m2m_ctx - Memory to memory context structure * * @q_lock: struct &mutex lock - * @m2m_dev: pointer to struct &v4l2_m2m_dev + * @m2m_dev: opaque pointer to the internal data to handle M2M context * @cap_q_ctx: Capture (output to memory) queue context * @out_q_ctx: Output (input from memory) queue context * @queue: List of memory to memory contexts @@ -131,7 +125,7 @@ struct v4l2_m2m_buffer { * v4l2_m2m_get_curr_priv() - return driver private data for the currently * running instance or NULL if no instance is running * - * @m2m_dev: pointer to struct &v4l2_m2m_dev + * @m2m_dev: opaque pointer to the internal data to handle M2M context */ void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); @@ -171,7 +165,7 @@ void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx); * v4l2_m2m_job_finish() - inform the framework that a job has been finished * and have it clean up * - * @m2m_dev: pointer to struct &v4l2_m2m_dev + * @m2m_dev: opaque pointer to the internal data to handle M2M context * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx * * Called by a driver to yield back the device after it has finished with it. @@ -334,7 +328,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops); /** * v4l2_m2m_release() - cleans up and frees a m2m_dev structure * - * @m2m_dev: pointer to struct &v4l2_m2m_dev + * @m2m_dev: opaque pointer to the internal data to handle M2M context * * Usually called from driver's ``remove()`` function. */ @@ -343,7 +337,7 @@ void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); /** * v4l2_m2m_ctx_init() - allocate and initialize a m2m context * - * @m2m_dev: a previously initialized m2m_dev struct + * @m2m_dev: opaque pointer to the internal data to handle M2M context * @drv_priv: driver's instance private data * @queue_init: a callback for queue type-specific initialization function * to be used for initializing videobuf_queues From bcb53f07080bb3413f00e2e95c2c6f56eb20c9e5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 18:01:36 -0300 Subject: [PATCH 351/591] [media] conf_nitpick.py: ignore an opaque struct from v4l2-mem2mem.h The v4l2_m2m_dev is opaque: its meaning is only known by v4l2-mem2mem.c. Ignore it on nitpick mode. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/conf_nitpick.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/media/conf_nitpick.py b/Documentation/media/conf_nitpick.py index 1f3ef3ded2d4..f71bb947eb15 100644 --- a/Documentation/media/conf_nitpick.py +++ b/Documentation/media/conf_nitpick.py @@ -98,4 +98,8 @@ nitpick_ignore = [ ("c:type", "usb_interface"), ("c:type", "v4l2_std_id"), ("c:type", "video_system_t"), + + # Opaque structures + + ("c:type", "v4l2_m2m_dev"), ] From 88b7eb092efb8197d29d5202d77d1fb919419ec5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 13:34:37 -0300 Subject: [PATCH 352/591] [media] videobuf2-core.h: move function descriptions from c file There are several functions that were documented at the .c file. As we only include the headers, we need to move them to there, in order to have documentation. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-core.c | 254 --------------------- include/media/videobuf2-core.h | 269 +++++++++++++++++++++++ 2 files changed, 269 insertions(+), 254 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index bfe85879c563..21900202ff83 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -528,10 +528,6 @@ static int __vb2_queue_free(struct vb2_queue *q, unsigned int buffers) return 0; } -/** - * vb2_buffer_in_use() - return true if the buffer is in use and - * the queue cannot be freed (by the means of REQBUFS(0)) call - */ bool vb2_buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb) { unsigned int plane; @@ -564,16 +560,6 @@ static bool __buffers_in_use(struct vb2_queue *q) return false; } -/** - * vb2_core_querybuf() - query video buffer information - * @q: videobuf queue - * @index: id number of the buffer - * @pb: buffer struct passed from userspace - * - * Should be called from vidioc_querybuf ioctl handler in driver. - * The passed buffer should have been verified. - * This function fills the relevant information for the userspace. - */ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb) { call_void_bufop(q, fill_user_buffer, q->bufs[index], pb); @@ -620,10 +606,6 @@ static int __verify_dmabuf_ops(struct vb2_queue *q) return 0; } -/** - * vb2_verify_memory_type() - Check whether the memory type and buffer type - * passed to a buffer operation are compatible with the queue. - */ int vb2_verify_memory_type(struct vb2_queue *q, enum vb2_memory memory, unsigned int type) { @@ -670,30 +652,6 @@ int vb2_verify_memory_type(struct vb2_queue *q, } EXPORT_SYMBOL(vb2_verify_memory_type); -/** - * vb2_core_reqbufs() - Initiate streaming - * @q: videobuf2 queue - * @memory: memory type - * @count: requested buffer count - * - * Should be called from vidioc_reqbufs ioctl handler of a driver. - * This function: - * 1) verifies streaming parameters passed from the userspace, - * 2) sets up the queue, - * 3) negotiates number of buffers and planes per buffer with the driver - * to be used during streaming, - * 4) allocates internal buffer structures (struct vb2_buffer), according to - * the agreed parameters, - * 5) for MMAP memory type, allocates actual video memory, using the - * memory handling/allocation routines provided during queue initialization - * - * If req->count is 0, all the memory will be freed instead. - * If the queue has been allocated previously (by a previous vb2_reqbufs) call - * and the queue is not busy, memory will be reallocated. - * - * The return values from this function are intended to be directly returned - * from vidioc_reqbufs handler in driver. - */ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, unsigned int *count) { @@ -819,22 +777,6 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, } EXPORT_SYMBOL_GPL(vb2_core_reqbufs); -/** - * vb2_core_create_bufs() - Allocate buffers and any required auxiliary structs - * @q: videobuf2 queue - * @memory: memory type - * @count: requested buffer count - * @parg: parameter passed to device driver - * - * Should be called from vidioc_create_bufs ioctl handler of a driver. - * This function: - * 1) verifies parameter sanity - * 2) calls the .queue_setup() queue operation - * 3) performs any necessary memory allocations - * - * The return values from this function are intended to be directly returned - * from vidioc_create_bufs handler in driver. - */ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, unsigned int *count, unsigned requested_planes, const unsigned requested_sizes[]) @@ -924,14 +866,6 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, } EXPORT_SYMBOL_GPL(vb2_core_create_bufs); -/** - * vb2_plane_vaddr() - Return a kernel virtual address of a given plane - * @vb: vb2_buffer to which the plane in question belongs to - * @plane_no: plane number for which the address is to be returned - * - * This function returns a kernel virtual address of a given plane if - * such a mapping exist, NULL otherwise. - */ void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no) { if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv) @@ -942,17 +876,6 @@ void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no) } EXPORT_SYMBOL_GPL(vb2_plane_vaddr); -/** - * vb2_plane_cookie() - Return allocator specific cookie for the given plane - * @vb: vb2_buffer to which the plane in question belongs to - * @plane_no: plane number for which the cookie is to be returned - * - * This function returns an allocator specific cookie for a given plane if - * available, NULL otherwise. The allocator should provide some simple static - * inline function, which would convert this cookie to the allocator specific - * type that can be used directly by the driver to access the buffer. This can - * be for example physical address, pointer to scatter list or IOMMU mapping. - */ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) { if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv) @@ -962,26 +885,6 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) } EXPORT_SYMBOL_GPL(vb2_plane_cookie); -/** - * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished - * @vb: vb2_buffer returned from the driver - * @state: either VB2_BUF_STATE_DONE if the operation finished successfully, - * VB2_BUF_STATE_ERROR if the operation finished with an error or - * VB2_BUF_STATE_QUEUED if the driver wants to requeue buffers. - * If start_streaming fails then it should return buffers with state - * VB2_BUF_STATE_QUEUED to put them back into the queue. - * - * This function should be called by the driver after a hardware operation on - * a buffer is finished and the buffer may be returned to userspace. The driver - * cannot use this buffer anymore until it is queued back to it by videobuf - * by the means of buf_queue callback. Only buffers previously queued to the - * driver by buf_queue can be passed to this function. - * - * While streaming a buffer can only be returned in state DONE or ERROR. - * The start_streaming op can also return them in case the DMA engine cannot - * be started for some reason. In that case the buffers should be returned with - * state QUEUED. - */ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) { struct vb2_queue *q = vb->vb2_queue; @@ -1040,18 +943,6 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) } EXPORT_SYMBOL_GPL(vb2_buffer_done); -/** - * vb2_discard_done() - discard all buffers marked as DONE - * @q: videobuf2 queue - * - * This function is intended to be used with suspend/resume operations. It - * discards all 'done' buffers as they would be too old to be requested after - * resume. - * - * Drivers must stop the hardware and synchronize with interrupt handlers and/or - * delayed works before calling this function to make sure no buffer will be - * touched by the driver and/or hardware. - */ void vb2_discard_done(struct vb2_queue *q) { struct vb2_buffer *vb; @@ -1384,22 +1275,6 @@ static int __buf_prepare(struct vb2_buffer *vb, const void *pb) return ret; } -/** - * vb2_core_prepare_buf() - Pass ownership of a buffer from userspace - * to the kernel - * @q: videobuf2 queue - * @index: id number of the buffer - * @pb: buffer structure passed from userspace to vidioc_prepare_buf - * handler in driver - * - * Should be called from vidioc_prepare_buf ioctl handler of a driver. - * The passed buffer should have been verified. - * This function calls buf_prepare callback in the driver (if provided), - * in which driver-specific buffer initialization can be performed, - * - * The return values from this function are intended to be directly returned - * from vidioc_prepare_buf handler in driver. - */ int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb) { struct vb2_buffer *vb; @@ -1488,24 +1363,6 @@ static int vb2_start_streaming(struct vb2_queue *q) return ret; } -/** - * vb2_core_qbuf() - Queue a buffer from userspace - * @q: videobuf2 queue - * @index: id number of the buffer - * @pb: buffer structure passed from userspace to vidioc_qbuf handler - * in driver - * - * Should be called from vidioc_qbuf ioctl handler of a driver. - * The passed buffer should have been verified. - * This function: - * 1) if necessary, calls buf_prepare callback in the driver (if provided), in - * which driver-specific buffer initialization can be performed, - * 2) if streaming is on, queues the buffer in driver by the means of buf_queue - * callback for processing. - * - * The return values from this function are intended to be directly returned - * from vidioc_qbuf handler in driver. - */ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb) { struct vb2_buffer *vb; @@ -1686,15 +1543,6 @@ static int __vb2_get_done_vb(struct vb2_queue *q, struct vb2_buffer **vb, return ret; } -/** - * vb2_wait_for_all_buffers() - wait until all buffers are given back to vb2 - * @q: videobuf2 queue - * - * This function will wait until all buffers that have been given to the driver - * by buf_queue() are given back to vb2 with vb2_buffer_done(). It doesn't call - * wait_prepare, wait_finish pair. It is intended to be called with all locks - * taken, for example from stop_streaming() callback. - */ int vb2_wait_for_all_buffers(struct vb2_queue *q) { if (!q->streaming) { @@ -1732,28 +1580,6 @@ static void __vb2_dqbuf(struct vb2_buffer *vb) } } -/** - * vb2_core_dqbuf() - Dequeue a buffer to the userspace - * @q: videobuf2 queue - * @pindex: pointer to the buffer index. May be NULL - * @pb: buffer structure passed from userspace to vidioc_dqbuf handler - * in driver - * @nonblocking: if true, this call will not sleep waiting for a buffer if no - * buffers ready for dequeuing are present. Normally the driver - * would be passing (file->f_flags & O_NONBLOCK) here - * - * Should be called from vidioc_dqbuf ioctl handler of a driver. - * The passed buffer should have been verified. - * This function: - * 1) calls buf_finish callback in the driver (if provided), in which - * driver can perform any additional operations that may be required before - * returning the buffer to userspace, such as cache sync, - * 2) the buffer struct members are filled with relevant information for - * the userspace. - * - * The return values from this function are intended to be directly returned - * from vidioc_dqbuf handler in driver. - */ int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb, bool nonblocking) { @@ -1917,19 +1743,6 @@ int vb2_core_streamon(struct vb2_queue *q, unsigned int type) } EXPORT_SYMBOL_GPL(vb2_core_streamon); -/** - * vb2_queue_error() - signal a fatal error on the queue - * @q: videobuf2 queue - * - * Flag that a fatal unrecoverable error has occurred and wake up all processes - * waiting on the queue. Polling will now set POLLERR and queuing and dequeuing - * buffers will return -EIO. - * - * The error flag will be cleared when cancelling the queue, either from - * vb2_streamoff or vb2_queue_release. Drivers should thus not call this - * function before starting the stream, otherwise the error flag will remain set - * until the queue is released when closing the device node. - */ void vb2_queue_error(struct vb2_queue *q) { q->error = 1; @@ -1992,19 +1805,6 @@ static int __find_plane_by_offset(struct vb2_queue *q, unsigned long off, return -EINVAL; } -/** - * vb2_core_expbuf() - Export a buffer as a file descriptor - * @q: videobuf2 queue - * @fd: file descriptor associated with DMABUF (set by driver) * - * @type: buffer type - * @index: id number of the buffer - * @plane: index of the plane to be exported, 0 for single plane queues - * @flags: flags for newly created file, currently only O_CLOEXEC is - * supported, refer to manual of open syscall for more details - * - * The return values from this function are intended to be directly returned - * from vidioc_expbuf handler in driver. - */ int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type, unsigned int index, unsigned int plane, unsigned int flags) { @@ -2076,25 +1876,6 @@ int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type, } EXPORT_SYMBOL_GPL(vb2_core_expbuf); -/** - * vb2_mmap() - map video buffers into application address space - * @q: videobuf2 queue - * @vma: vma passed to the mmap file operation handler in the driver - * - * Should be called from mmap file operation handler of a driver. - * This function maps one plane of one of the available video buffers to - * userspace. To map whole video memory allocated on reqbufs, this function - * has to be called once per each plane per each buffer previously allocated. - * - * When the userspace application calls mmap, it passes to it an offset returned - * to it earlier by the means of vidioc_querybuf handler. That offset acts as - * a "cookie", which is then used to identify the plane to be mapped. - * This function finds a plane with a matching offset and a mapping is performed - * by the means of a provided memory operation. - * - * The return values from this function are intended to be directly returned - * from the mmap handler in driver. - */ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma) { unsigned long off = vma->vm_pgoff << PAGE_SHIFT; @@ -2196,17 +1977,6 @@ unsigned long vb2_get_unmapped_area(struct vb2_queue *q, EXPORT_SYMBOL_GPL(vb2_get_unmapped_area); #endif -/** - * vb2_core_queue_init() - initialize a videobuf2 queue - * @q: videobuf2 queue; this structure should be allocated in driver - * - * The vb2_queue structure should be allocated by the driver. The driver is - * responsible of clearing it's content and setting initial values for some - * required entries before calling this function. - * q->ops, q->mem_ops, q->type and q->io_modes are mandatory. Please refer - * to the struct vb2_queue description in include/media/videobuf2-core.h - * for more information. - */ int vb2_core_queue_init(struct vb2_queue *q) { /* @@ -2236,14 +2006,6 @@ EXPORT_SYMBOL_GPL(vb2_core_queue_init); static int __vb2_init_fileio(struct vb2_queue *q, int read); static int __vb2_cleanup_fileio(struct vb2_queue *q); -/** - * vb2_core_queue_release() - stop streaming, release the queue and free memory - * @q: videobuf2 queue - * - * This function stops streaming and performs necessary clean ups, including - * freeing video buffer memory. The driver is responsible for freeing - * the vb2_queue structure itself. - */ void vb2_core_queue_release(struct vb2_queue *q) { __vb2_cleanup_fileio(q); @@ -2254,22 +2016,6 @@ void vb2_core_queue_release(struct vb2_queue *q) } EXPORT_SYMBOL_GPL(vb2_core_queue_release); -/** - * vb2_core_poll() - implements poll userspace operation - * @q: videobuf2 queue - * @file: file argument passed to the poll file operation handler - * @wait: wait argument passed to the poll file operation handler - * - * This function implements poll file operation handler for a driver. - * For CAPTURE queues, if a buffer is ready to be dequeued, the userspace will - * be informed that the file descriptor of a video device is available for - * reading. - * For OUTPUT queues, if a buffer is ready to be dequeued, the file descriptor - * will be reported as available for writing. - * - * The return values from this function are intended to be directly returned - * from poll handler in driver. - */ unsigned int vb2_core_poll(struct vb2_queue *q, struct file *file, poll_table *wait) { diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index b6546db670ca..68f93dacb38f 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -536,35 +536,274 @@ struct vb2_queue { #endif }; +/** + * vb2_plane_vaddr() - Return a kernel virtual address of a given plane + * @vb: vb2_buffer to which the plane in question belongs to + * @plane_no: plane number for which the address is to be returned + * + * This function returns a kernel virtual address of a given plane if + * such a mapping exist, NULL otherwise. + */ void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no); + +/** + * vb2_plane_cookie() - Return allocator specific cookie for the given plane + * @vb: vb2_buffer to which the plane in question belongs to + * @plane_no: plane number for which the cookie is to be returned + * + * This function returns an allocator specific cookie for a given plane if + * available, NULL otherwise. The allocator should provide some simple static + * inline function, which would convert this cookie to the allocator specific + * type that can be used directly by the driver to access the buffer. This can + * be for example physical address, pointer to scatter list or IOMMU mapping. + */ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no); +/** + * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished + * @vb: vb2_buffer returned from the driver + * @state: either %VB2_BUF_STATE_DONE if the operation finished successfully, + * %VB2_BUF_STATE_ERROR if the operation finished with an error or + * %VB2_BUF_STATE_QUEUED if the driver wants to requeue buffers. + * If start_streaming fails then it should return buffers with state + * %VB2_BUF_STATE_QUEUED to put them back into the queue. + * + * This function should be called by the driver after a hardware operation on + * a buffer is finished and the buffer may be returned to userspace. The driver + * cannot use this buffer anymore until it is queued back to it by videobuf + * by the means of buf_queue callback. Only buffers previously queued to the + * driver by buf_queue can be passed to this function. + * + * While streaming a buffer can only be returned in state DONE or ERROR. + * The start_streaming op can also return them in case the DMA engine cannot + * be started for some reason. In that case the buffers should be returned with + * state QUEUED. + */ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state); + +/** + * vb2_discard_done() - discard all buffers marked as DONE + * @q: videobuf2 queue + * + * This function is intended to be used with suspend/resume operations. It + * discards all 'done' buffers as they would be too old to be requested after + * resume. + * + * Drivers must stop the hardware and synchronize with interrupt handlers and/or + * delayed works before calling this function to make sure no buffer will be + * touched by the driver and/or hardware. + */ void vb2_discard_done(struct vb2_queue *q); + +/** + * vb2_wait_for_all_buffers() - wait until all buffers are given back to vb2 + * @q: videobuf2 queue + * + * This function will wait until all buffers that have been given to the driver + * by buf_queue() are given back to vb2 with vb2_buffer_done(). It doesn't call + * wait_prepare, wait_finish pair. It is intended to be called with all locks + * taken, for example from stop_streaming() callback. + */ int vb2_wait_for_all_buffers(struct vb2_queue *q); +/** + * vb2_core_querybuf() - query video buffer information + * @q: videobuf queue + * @index: id number of the buffer + * @pb: buffer struct passed from userspace + * + * Should be called from vidioc_querybuf ioctl handler in driver. + * The passed buffer should have been verified. + * This function fills the relevant information for the userspace. + */ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb); + +/** + * vb2_core_reqbufs() - Initiate streaming + * @q: videobuf2 queue + * @memory: memory type + * @count: requested buffer count + * + * Should be called from vidioc_reqbufs ioctl handler of a driver. + * This function: + * 1) verifies streaming parameters passed from the userspace, + * 2) sets up the queue, + * 3) negotiates number of buffers and planes per buffer with the driver + * to be used during streaming, + * 4) allocates internal buffer structures (struct vb2_buffer), according to + * the agreed parameters, + * 5) for MMAP memory type, allocates actual video memory, using the + * memory handling/allocation routines provided during queue initialization + * + * If req->count is 0, all the memory will be freed instead. + * If the queue has been allocated previously (by a previous vb2_reqbufs) call + * and the queue is not busy, memory will be reallocated. + * + * The return values from this function are intended to be directly returned + * from vidioc_reqbufs handler in driver. + */ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, unsigned int *count); + +/** + * vb2_core_create_bufs() - Allocate buffers and any required auxiliary structs + * @q: videobuf2 queue + * @memory: memory type + * @count: requested buffer count + * @parg: parameter passed to device driver + * + * Should be called from vidioc_create_bufs ioctl handler of a driver. + * This function: + * 1) verifies parameter sanity + * 2) calls the .queue_setup() queue operation + * 3) performs any necessary memory allocations + * + * The return values from this function are intended to be directly returned + * from vidioc_create_bufs handler in driver. + */ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, unsigned int *count, unsigned requested_planes, const unsigned int requested_sizes[]); + +/** + * vb2_core_prepare_buf() - Pass ownership of a buffer from userspace + * to the kernel + * @q: videobuf2 queue + * @index: id number of the buffer + * @pb: buffer structure passed from userspace to vidioc_prepare_buf + * handler in driver + * + * Should be called from vidioc_prepare_buf ioctl handler of a driver. + * The passed buffer should have been verified. + * This function calls buf_prepare callback in the driver (if provided), + * in which driver-specific buffer initialization can be performed, + * + * The return values from this function are intended to be directly returned + * from vidioc_prepare_buf handler in driver. + */ int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb); + +/** + * vb2_core_qbuf() - Queue a buffer from userspace + * @q: videobuf2 queue + * @index: id number of the buffer + * @pb: buffer structure passed from userspace to vidioc_qbuf handler + * in driver + * + * Should be called from vidioc_qbuf ioctl handler of a driver. + * The passed buffer should have been verified. + * This function: + * 1) if necessary, calls buf_prepare callback in the driver (if provided), in + * which driver-specific buffer initialization can be performed, + * 2) if streaming is on, queues the buffer in driver by the means of buf_queue + * callback for processing. + * + * The return values from this function are intended to be directly returned + * from vidioc_qbuf handler in driver. + */ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb); + +/** + * vb2_core_dqbuf() - Dequeue a buffer to the userspace + * @q: videobuf2 queue + * @pindex: pointer to the buffer index. May be NULL + * @pb: buffer structure passed from userspace to vidioc_dqbuf handler + * in driver + * @nonblocking: if true, this call will not sleep waiting for a buffer if no + * buffers ready for dequeuing are present. Normally the driver + * would be passing (file->f_flags & O_NONBLOCK) here + * + * Should be called from vidioc_dqbuf ioctl handler of a driver. + * The passed buffer should have been verified. + * This function: + * 1) calls buf_finish callback in the driver (if provided), in which + * driver can perform any additional operations that may be required before + * returning the buffer to userspace, such as cache sync, + * 2) the buffer struct members are filled with relevant information for + * the userspace. + * + * The return values from this function are intended to be directly returned + * from vidioc_dqbuf handler in driver. + */ int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb, bool nonblocking); int vb2_core_streamon(struct vb2_queue *q, unsigned int type); int vb2_core_streamoff(struct vb2_queue *q, unsigned int type); +/** + * vb2_core_expbuf() - Export a buffer as a file descriptor + * @q: videobuf2 queue + * @fd: file descriptor associated with DMABUF (set by driver) * + * @type: buffer type + * @index: id number of the buffer + * @plane: index of the plane to be exported, 0 for single plane queues + * @flags: flags for newly created file, currently only O_CLOEXEC is + * supported, refer to manual of open syscall for more details + * + * The return values from this function are intended to be directly returned + * from vidioc_expbuf handler in driver. + */ int vb2_core_expbuf(struct vb2_queue *q, int *fd, unsigned int type, unsigned int index, unsigned int plane, unsigned int flags); +/** + * vb2_core_queue_init() - initialize a videobuf2 queue + * @q: videobuf2 queue; this structure should be allocated in driver + * + * The vb2_queue structure should be allocated by the driver. The driver is + * responsible of clearing it's content and setting initial values for some + * required entries before calling this function. + * q->ops, q->mem_ops, q->type and q->io_modes are mandatory. Please refer + * to the struct vb2_queue description in include/media/videobuf2-core.h + * for more information. + */ int vb2_core_queue_init(struct vb2_queue *q); + +/** + * vb2_core_queue_release() - stop streaming, release the queue and free memory + * @q: videobuf2 queue + * + * This function stops streaming and performs necessary clean ups, including + * freeing video buffer memory. The driver is responsible for freeing + * the vb2_queue structure itself. + */ void vb2_core_queue_release(struct vb2_queue *q); +/** + * vb2_queue_error() - signal a fatal error on the queue + * @q: videobuf2 queue + * + * Flag that a fatal unrecoverable error has occurred and wake up all processes + * waiting on the queue. Polling will now set POLLERR and queuing and dequeuing + * buffers will return -EIO. + * + * The error flag will be cleared when cancelling the queue, either from + * vb2_streamoff or vb2_queue_release. Drivers should thus not call this + * function before starting the stream, otherwise the error flag will remain set + * until the queue is released when closing the device node. + */ void vb2_queue_error(struct vb2_queue *q); +/** + * vb2_mmap() - map video buffers into application address space + * @q: videobuf2 queue + * @vma: vma passed to the mmap file operation handler in the driver + * + * Should be called from mmap file operation handler of a driver. + * This function maps one plane of one of the available video buffers to + * userspace. To map whole video memory allocated on reqbufs, this function + * has to be called once per each plane per each buffer previously allocated. + * + * When the userspace application calls mmap, it passes to it an offset returned + * to it earlier by the means of vidioc_querybuf handler. That offset acts as + * a "cookie", which is then used to identify the plane to be mapped. + * This function finds a plane with a matching offset and a mapping is performed + * by the means of a provided memory operation. + * + * The return values from this function are intended to be directly returned + * from the mmap handler in driver. + */ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma); #ifndef CONFIG_MMU unsigned long vb2_get_unmapped_area(struct vb2_queue *q, @@ -573,6 +812,23 @@ unsigned long vb2_get_unmapped_area(struct vb2_queue *q, unsigned long pgoff, unsigned long flags); #endif + +/** + * vb2_core_poll() - implements poll userspace operation + * @q: videobuf2 queue + * @file: file argument passed to the poll file operation handler + * @wait: wait argument passed to the poll file operation handler + * + * This function implements poll file operation handler for a driver. + * For CAPTURE queues, if a buffer is ready to be dequeued, the userspace will + * be informed that the file descriptor of a video device is available for + * reading. + * For OUTPUT queues, if a buffer is ready to be dequeued, the file descriptor + * will be reported as available for writing. + * + * The return values from this function are intended to be directly returned + * from poll handler in driver. + */ unsigned int vb2_core_poll(struct vb2_queue *q, struct file *file, poll_table *wait); size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, @@ -717,7 +973,20 @@ static inline void vb2_clear_last_buffer_dequeued(struct vb2_queue *q) * The following functions are not part of the vb2 core API, but are useful * functions for videobuf2-*. */ + +/** + * vb2_buffer_in_use() - return true if the buffer is in use and + * the queue cannot be freed (by the means of REQBUFS(0)) call + * + * @vb: buffer for which plane size should be returned + * @q: videobuf queue + */ bool vb2_buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb); + +/** + * vb2_verify_memory_type() - Check whether the memory type and buffer type + * passed to a buffer operation are compatible with the queue. + */ int vb2_verify_memory_type(struct vb2_queue *q, enum vb2_memory memory, unsigned int type); #endif /* _MEDIA_VIDEOBUF2_CORE_H */ From 52839f66edde1ed709390b55a0d3f82593203308 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 14:08:00 -0300 Subject: [PATCH 353/591] [media] videobuf2-core.h: document enum vb2_memory This enum was not documented. Document it. Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-core.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 68f93dacb38f..65eeca83687a 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -20,6 +20,20 @@ #define VB2_MAX_FRAME (32) #define VB2_MAX_PLANES (8) +/** + * enum vb2_memory - type of memory model used to make the buffers visible + * on userspace. + * + * @VB2_MEMORY_UNKNOWN: Buffer status is unknown or it is not used yet on + * userspace. + * @VB2_MEMORY_MMAP: The buffers are allocated by the Kernel and it is + * memory mapped via mmap() ioctl. This model is + * also used when the user is using the buffers via + * read() or write() system calls. + * @VB2_MEMORY_USERPTR: The buffers was allocated in userspace and it is + * memory mapped via mmap() ioctl. + * @VB2_MEMORY_DMABUF: The buffers are passed to userspace via DMA buffer. + */ enum vb2_memory { VB2_MEMORY_UNKNOWN = 0, VB2_MEMORY_MMAP = 1, From f286f4dfc50a9f4d777534794a773eb4fbbedd72 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 14:08:34 -0300 Subject: [PATCH 354/591] [media] videobuf2-core.h: improve documentation There are several small issues with the documentation. Fix them, in order to avoid producing warnings. While here, also make checkpatch.pl happy. Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-core.h | 143 ++++++++++++++++++++------------- 1 file changed, 85 insertions(+), 58 deletions(-) diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 65eeca83687a..9a144f2d9083 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -49,13 +49,13 @@ struct vb2_threadio_data; * @alloc: allocate video memory and, optionally, allocator private data, * return ERR_PTR() on failure or a pointer to allocator private, * per-buffer data on success; the returned private structure - * will then be passed as buf_priv argument to other ops in this + * will then be passed as @buf_priv argument to other ops in this * structure. Additional gfp_flags to use when allocating the * are also passed to this operation. These flags are from the * gfp_flags field of vb2_queue. * @put: inform the allocator that the buffer will no longer be used; * usually will result in the allocator freeing the buffer (if - * no other users of this buffer are present); the buf_priv + * no other users of this buffer are present); the @buf_priv * argument is the allocator private per-buffer structure * previously returned from the alloc callback. * @get_dmabuf: acquire userspace memory for a hardware operation; used for @@ -65,7 +65,7 @@ struct vb2_threadio_data; * videobuf layer when queuing a video buffer of USERPTR type; * should return an allocator private per-buffer structure * associated with the buffer on success, ERR_PTR() on failure; - * the returned private structure will then be passed as buf_priv + * the returned private structure will then be passed as @buf_priv * argument to other ops in this structure. * @put_userptr: inform the allocator that a USERPTR buffer will no longer * be used. @@ -75,7 +75,7 @@ struct vb2_threadio_data; * allocator private per-buffer structure on success; * this needs to be used for further accesses to the buffer. * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF - * buffer is no longer used; the buf_priv argument is the + * buffer is no longer used; the @buf_priv argument is the * allocator private per-buffer structure previously returned * from the attach_dmabuf callback. * @map_dmabuf: request for access to the dmabuf from allocator; the allocator @@ -109,11 +109,13 @@ struct vb2_threadio_data; * * #) Required ops for read/write access types: alloc, put, num_users, vaddr. * - * #) Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, map_dmabuf, unmap_dmabuf. + * #) Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, + * map_dmabuf, unmap_dmabuf. */ struct vb2_mem_ops { void *(*alloc)(struct device *dev, unsigned long attrs, - unsigned long size, enum dma_data_direction dma_dir, + unsigned long size, + enum dma_data_direction dma_dir, gfp_t gfp_flags); void (*put)(void *buf_priv); struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags); @@ -126,7 +128,8 @@ struct vb2_mem_ops { void (*prepare)(void *buf_priv); void (*finish)(void *buf_priv); - void *(*attach_dmabuf)(struct device *dev, struct dma_buf *dbuf, + void *(*attach_dmabuf)(struct device *dev, + struct dma_buf *dbuf, unsigned long size, enum dma_data_direction dma_dir); void (*detach_dmabuf)(void *buf_priv); @@ -291,7 +294,7 @@ struct vb2_buffer { /** * struct vb2_ops - driver-specific callbacks * - * @queue_setup: called from %VIDIOC_REQBUFS and %VIDIOC_CREATE_BUFS + * @queue_setup: called from VIDIOC_REQBUFS() and VIDIOC_CREATE_BUFS() * handlers before memory allocation. It can be called * twice: if the original number of requested buffers * could not be allocated, then it will be called a @@ -302,11 +305,11 @@ struct vb2_buffer { * buffer in \*num_planes, the size of each plane should be * set in the sizes\[\] array and optional per-plane * allocator specific device in the alloc_devs\[\] array. - * When called from %VIDIOC_REQBUFS, \*num_planes == 0, the - * driver has to use the currently configured format to + * When called from VIDIOC_REQBUFS,() \*num_planes == 0, + * the driver has to use the currently configured format to * determine the plane sizes and \*num_buffers is the total * number of buffers that are being allocated. When called - * from %VIDIOC_CREATE_BUFS, \*num_planes != 0 and it + * from VIDIOC_CREATE_BUFS,() \*num_planes != 0 and it * describes the requested number of planes and sizes\[\] * contains the requested plane sizes. If either * \*num_planes or the requested sizes are invalid callback @@ -325,11 +328,11 @@ struct vb2_buffer { * initialization failure (return != 0) will prevent * queue setup from completing successfully; optional. * @buf_prepare: called every time the buffer is queued from userspace - * and from the %VIDIOC_PREPARE_BUF ioctl; drivers may + * and from the VIDIOC_PREPARE_BUF() ioctl; drivers may * perform any initialization required before each * hardware operation in this callback; drivers can * access/modify the buffer here as it is still synced for - * the CPU; drivers that support %VIDIOC_CREATE_BUFS must + * the CPU; drivers that support VIDIOC_CREATE_BUFS() must * also validate the buffer size; if an error is returned, * the buffer will not be queued in driver; optional. * @buf_finish: called before every dequeue of the buffer back to @@ -353,24 +356,25 @@ struct vb2_buffer { * driver can return an error if hardware fails, in that * case all buffers that have been already given by * the @buf_queue callback are to be returned by the driver - * by calling @vb2_buffer_done\(%VB2_BUF_STATE_QUEUED\). + * by calling vb2_buffer_done() with %VB2_BUF_STATE_QUEUED. * If you need a minimum number of buffers before you can * start streaming, then set @min_buffers_needed in the * vb2_queue structure. If that is non-zero then - * start_streaming won't be called until at least that + * @start_streaming won't be called until at least that * many buffers have been queued up by userspace. * @stop_streaming: called when 'streaming' state must be disabled; driver * should stop any DMA transactions or wait until they * finish and give back all buffers it got from &buf_queue - * callback by calling @vb2_buffer_done\(\) with either + * callback by calling vb2_buffer_done() with either * %VB2_BUF_STATE_DONE or %VB2_BUF_STATE_ERROR; may use * vb2_wait_for_all_buffers() function * @buf_queue: passes buffer vb to the driver; driver may start * hardware operation on this buffer; driver should give * the buffer back by calling vb2_buffer_done() function; - * it is allways called after calling %VIDIOC_STREAMON ioctl; - * might be called before start_streaming callback if user - * pre-queued buffers before calling %VIDIOC_STREAMON. + * it is allways called after calling VIDIOC_STREAMON() + * ioctl; might be called before @start_streaming callback + * if user pre-queued buffers before calling + * VIDIOC_STREAMON(). */ struct vb2_ops { int (*queue_setup)(struct vb2_queue *q, @@ -418,7 +422,7 @@ struct vb2_buf_ops { * * @type: private buffer type whose content is defined by the vb2-core * caller. For example, for V4L2, it should match - * the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h + * the types defined on enum &v4l2_buf_type * @io_modes: supported io methods (see vb2_io_modes enum) * @dev: device to use for the default allocation context if the driver * doesn't fill in the @alloc_devs array. @@ -453,12 +457,12 @@ struct vb2_buf_ops { * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 * to force the buffer allocation to a specific memory zone. * @min_buffers_needed: the minimum number of buffers needed before - * start_streaming() can be called. Used when a DMA engine + * @start_streaming can be called. Used when a DMA engine * cannot be started unless at least this number of buffers * have been queued into the driver. */ /* - * Private elements (won't appear at the DocBook): + * Private elements (won't appear at the uAPI book): * @mmap_lock: private mutex used when buffers are allocated/freed/mmapped * @memory: current memory type used * @bufs: videobuf buffer structures @@ -471,7 +475,7 @@ struct vb2_buf_ops { * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued * @alloc_devs: memory type/allocator-specific per-plane device * @streaming: current streaming state - * @start_streaming_called: start_streaming() was called successfully and we + * @start_streaming_called: @start_streaming was called successfully and we * started streaming. * @error: a fatal error occurred on the queue * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for @@ -576,17 +580,18 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no); /** * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished * @vb: vb2_buffer returned from the driver - * @state: either %VB2_BUF_STATE_DONE if the operation finished successfully, - * %VB2_BUF_STATE_ERROR if the operation finished with an error or - * %VB2_BUF_STATE_QUEUED if the driver wants to requeue buffers. - * If start_streaming fails then it should return buffers with state - * %VB2_BUF_STATE_QUEUED to put them back into the queue. + * @state: either %VB2_BUF_STATE_DONE if the operation finished + * successfully, %VB2_BUF_STATE_ERROR if the operation finished + * with an error or %VB2_BUF_STATE_QUEUED if the driver wants to + * requeue buffers. If start_streaming fails then it should return + * buffers with state %VB2_BUF_STATE_QUEUED to put them back into + * the queue. * * This function should be called by the driver after a hardware operation on * a buffer is finished and the buffer may be returned to userspace. The driver * cannot use this buffer anymore until it is queued back to it by videobuf - * by the means of buf_queue callback. Only buffers previously queued to the - * driver by buf_queue can be passed to this function. + * by the means of &vb2_ops->buf_queue callback. Only buffers previously queued + * to the driver by &vb2_ops->buf_queue can be passed to this function. * * While streaming a buffer can only be returned in state DONE or ERROR. * The start_streaming op can also return them in case the DMA engine cannot @@ -614,9 +619,9 @@ void vb2_discard_done(struct vb2_queue *q); * @q: videobuf2 queue * * This function will wait until all buffers that have been given to the driver - * by buf_queue() are given back to vb2 with vb2_buffer_done(). It doesn't call - * wait_prepare, wait_finish pair. It is intended to be called with all locks - * taken, for example from stop_streaming() callback. + * by &vb2_ops->buf_queue are given back to vb2 with vb2_buffer_done(). It + * doesn't call wait_prepare()/wait_finish() pair. It is intended to be called + * with all locks taken, for example from &vb2_ops->stop_streaming callback. */ int vb2_wait_for_all_buffers(struct vb2_queue *q); @@ -639,14 +644,16 @@ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb); * @count: requested buffer count * * Should be called from vidioc_reqbufs ioctl handler of a driver. + * * This function: - * 1) verifies streaming parameters passed from the userspace, - * 2) sets up the queue, - * 3) negotiates number of buffers and planes per buffer with the driver + * + * #) verifies streaming parameters passed from the userspace, + * #) sets up the queue, + * #) negotiates number of buffers and planes per buffer with the driver * to be used during streaming, - * 4) allocates internal buffer structures (struct vb2_buffer), according to + * #) allocates internal buffer structures (struct vb2_buffer), according to * the agreed parameters, - * 5) for MMAP memory type, allocates actual video memory, using the + * #) for MMAP memory type, allocates actual video memory, using the * memory handling/allocation routines provided during queue initialization * * If req->count is 0, all the memory will be freed instead. @@ -664,20 +671,22 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, * @q: videobuf2 queue * @memory: memory type * @count: requested buffer count - * @parg: parameter passed to device driver + * @requested_planes: number of planes requested + * @requested_sizes: array with the size of the planes * - * Should be called from vidioc_create_bufs ioctl handler of a driver. + * Should be called from VIDIOC_CREATE_BUFS() ioctl handler of a driver. * This function: - * 1) verifies parameter sanity - * 2) calls the .queue_setup() queue operation - * 3) performs any necessary memory allocations * - * The return values from this function are intended to be directly returned - * from vidioc_create_bufs handler in driver. + * #) verifies parameter sanity + * #) calls the .queue_setup() queue operation + * #) performs any necessary memory allocations + * + * Return: the return values from this function are intended to be directly + * returned from VIDIOC_CREATE_BUFS() handler in driver. */ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, - unsigned int *count, unsigned requested_planes, - const unsigned int requested_sizes[]); + unsigned int *count, unsigned int requested_planes, + const unsigned int requested_sizes[]); /** * vb2_core_prepare_buf() - Pass ownership of a buffer from userspace @@ -699,6 +708,7 @@ int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb); /** * vb2_core_qbuf() - Queue a buffer from userspace + * * @q: videobuf2 queue * @index: id number of the buffer * @pb: buffer structure passed from userspace to vidioc_qbuf handler @@ -706,11 +716,13 @@ int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb); * * Should be called from vidioc_qbuf ioctl handler of a driver. * The passed buffer should have been verified. + * * This function: - * 1) if necessary, calls buf_prepare callback in the driver (if provided), in + * + * #) if necessary, calls buf_prepare callback in the driver (if provided), in * which driver-specific buffer initialization can be performed, - * 2) if streaming is on, queues the buffer in driver by the means of buf_queue - * callback for processing. + * #) if streaming is on, queues the buffer in driver by the means of + * &vb2_ops->buf_queue callback for processing. * * The return values from this function are intended to be directly returned * from vidioc_qbuf handler in driver. @@ -729,11 +741,13 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb); * * Should be called from vidioc_dqbuf ioctl handler of a driver. * The passed buffer should have been verified. + * * This function: - * 1) calls buf_finish callback in the driver (if provided), in which + * + * #) calls buf_finish callback in the driver (if provided), in which * driver can perform any additional operations that may be required before * returning the buffer to userspace, such as cache sync, - * 2) the buffer struct members are filled with relevant information for + * #) the buffer struct members are filled with relevant information for * the userspace. * * The return values from this function are intended to be directly returned @@ -819,6 +833,7 @@ void vb2_queue_error(struct vb2_queue *q); * from the mmap handler in driver. */ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma); + #ifndef CONFIG_MMU unsigned long vb2_get_unmapped_area(struct vb2_queue *q, unsigned long addr, @@ -844,14 +859,18 @@ unsigned long vb2_get_unmapped_area(struct vb2_queue *q, * from poll handler in driver. */ unsigned int vb2_core_poll(struct vb2_queue *q, struct file *file, - poll_table *wait); + poll_table *wait); + size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, loff_t *ppos, int nonblock); size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count, loff_t *ppos, int nonblock); -/* - * vb2_thread_fnc - callback function for use with vb2_thread +/** + * typedef vb2_thread_fnc - callback function for use with vb2_thread + * + * @vb: pointer to struct &vb2_buffer + * @priv: pointer to a private pointer * * This is called whenever a buffer is dequeued in the thread. */ @@ -867,9 +886,11 @@ typedef int (*vb2_thread_fnc)(struct vb2_buffer *vb, void *priv); * This starts a thread that will queue and dequeue until an error occurs * or @vb2_thread_stop is called. * - * This function should not be used for anything else but the videobuf2-dvb - * support. If you think you have another good use-case for this, then please - * contact the linux-media mailinglist first. + * .. attention:: + * + * This function should not be used for anything else but the videobuf2-dvb + * support. If you think you have another good use-case for this, then please + * contact the linux-media mailing list first. */ int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv, const char *thread_name); @@ -1000,6 +1021,12 @@ bool vb2_buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb); /** * vb2_verify_memory_type() - Check whether the memory type and buffer type * passed to a buffer operation are compatible with the queue. + * + * @q: videobuf queue + * @memory: memory model, as defined by enum &vb2_memory. + * @type: private buffer type whose content is defined by the vb2-core + * caller. For example, for V4L2, it should match + * the types defined on enum &v4l2_buf_type */ int vb2_verify_memory_type(struct vb2_queue *q, enum vb2_memory memory, unsigned int type); From 434b67c5789bad5ad7406e89464beb0a213522d7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 14:12:29 -0300 Subject: [PATCH 355/591] [media] conf_nitpick.py: ignore C domain data used on vb2 Ignore external C domain structs and functions used by VB2 header. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/conf_nitpick.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/media/conf_nitpick.py b/Documentation/media/conf_nitpick.py index f71bb947eb15..480d548af670 100644 --- a/Documentation/media/conf_nitpick.py +++ b/Documentation/media/conf_nitpick.py @@ -40,6 +40,8 @@ nitpick_ignore = [ ("c:func", "struct fd_set"), ("c:func", "struct pollfd"), ("c:func", "usb_make_path"), + ("c:func", "wait_finish"), + ("c:func", "wait_prepare"), ("c:func", "write"), ("c:type", "atomic_t"), @@ -67,6 +69,7 @@ nitpick_ignore = [ ("c:type", "off_t"), ("c:type", "pci_dev"), ("c:type", "pdvbdev"), + ("c:type", "poll_table"), ("c:type", "platform_device"), ("c:type", "pollfd"), ("c:type", "poll_table_struct"), @@ -98,6 +101,7 @@ nitpick_ignore = [ ("c:type", "usb_interface"), ("c:type", "v4l2_std_id"), ("c:type", "video_system_t"), + ("c:type", "vm_area_struct"), # Opaque structures From 24ade5b6de002c51d18722e996dd92e49ad88802 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 14:22:00 -0300 Subject: [PATCH 356/591] [media] videobuf2-v4l2.h: get kernel-doc tags from C file There are several functions documented at the C file. Move them to the header, as this is the one used to build the media books. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf2-v4l2.c | 142 --------------------- include/media/videobuf2-v4l2.h | 151 ++++++++++++++++++++++- 2 files changed, 150 insertions(+), 143 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index 9cfbb6e4bc28..52ef8833f6b6 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -483,13 +483,6 @@ int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b) } EXPORT_SYMBOL(vb2_querybuf); -/** - * vb2_reqbufs() - Wrapper for vb2_core_reqbufs() that also verifies - * the memory and type values. - * @q: videobuf2 queue - * @req: struct passed from userspace to vidioc_reqbufs handler - * in driver - */ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) { int ret = vb2_verify_memory_type(q, req->memory, req->type); @@ -498,21 +491,6 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) } EXPORT_SYMBOL_GPL(vb2_reqbufs); -/** - * vb2_prepare_buf() - Pass ownership of a buffer from userspace to the kernel - * @q: videobuf2 queue - * @b: buffer structure passed from userspace to vidioc_prepare_buf - * handler in driver - * - * Should be called from vidioc_prepare_buf ioctl handler of a driver. - * This function: - * 1) verifies the passed buffer, - * 2) calls buf_prepare callback in the driver (if provided), in which - * driver-specific buffer initialization can be performed, - * - * The return values from this function are intended to be directly returned - * from vidioc_prepare_buf handler in driver. - */ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b) { int ret; @@ -528,13 +506,6 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b) } EXPORT_SYMBOL_GPL(vb2_prepare_buf); -/** - * vb2_create_bufs() - Wrapper for vb2_core_create_bufs() that also verifies - * the memory and type values. - * @q: videobuf2 queue - * @create: creation parameters, passed from userspace to vidioc_create_bufs - * handler in driver - */ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create) { unsigned requested_planes = 1; @@ -586,23 +557,6 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create) } EXPORT_SYMBOL_GPL(vb2_create_bufs); -/** - * vb2_qbuf() - Queue a buffer from userspace - * @q: videobuf2 queue - * @b: buffer structure passed from userspace to vidioc_qbuf handler - * in driver - * - * Should be called from vidioc_qbuf ioctl handler of a driver. - * This function: - * 1) verifies the passed buffer, - * 2) if necessary, calls buf_prepare callback in the driver (if provided), in - * which driver-specific buffer initialization can be performed, - * 3) if streaming is on, queues the buffer in driver by the means of buf_queue - * callback for processing. - * - * The return values from this function are intended to be directly returned - * from vidioc_qbuf handler in driver. - */ int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) { int ret; @@ -617,27 +571,6 @@ int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) } EXPORT_SYMBOL_GPL(vb2_qbuf); -/** - * vb2_dqbuf() - Dequeue a buffer to the userspace - * @q: videobuf2 queue - * @b: buffer structure passed from userspace to vidioc_dqbuf handler - * in driver - * @nonblocking: if true, this call will not sleep waiting for a buffer if no - * buffers ready for dequeuing are present. Normally the driver - * would be passing (file->f_flags & O_NONBLOCK) here - * - * Should be called from vidioc_dqbuf ioctl handler of a driver. - * This function: - * 1) verifies the passed buffer, - * 2) calls buf_finish callback in the driver (if provided), in which - * driver can perform any additional operations that may be required before - * returning the buffer to userspace, such as cache sync, - * 3) the buffer struct members are filled with relevant information for - * the userspace. - * - * The return values from this function are intended to be directly returned - * from vidioc_dqbuf handler in driver. - */ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking) { int ret; @@ -664,19 +597,6 @@ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking) } EXPORT_SYMBOL_GPL(vb2_dqbuf); -/** - * vb2_streamon - start streaming - * @q: videobuf2 queue - * @type: type argument passed from userspace to vidioc_streamon handler - * - * Should be called from vidioc_streamon handler of a driver. - * This function: - * 1) verifies current state - * 2) passes any previously queued buffers to the driver and starts streaming - * - * The return values from this function are intended to be directly returned - * from vidioc_streamon handler in the driver. - */ int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type) { if (vb2_fileio_is_active(q)) { @@ -687,21 +607,6 @@ int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type) } EXPORT_SYMBOL_GPL(vb2_streamon); -/** - * vb2_streamoff - stop streaming - * @q: videobuf2 queue - * @type: type argument passed from userspace to vidioc_streamoff handler - * - * Should be called from vidioc_streamoff handler of a driver. - * This function: - * 1) verifies current state, - * 2) stop streaming and dequeues any queued buffers, including those previously - * passed to the driver (after waiting for the driver to finish). - * - * This call can be used for pausing playback. - * The return values from this function are intended to be directly returned - * from vidioc_streamoff handler in the driver - */ int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type) { if (vb2_fileio_is_active(q)) { @@ -712,15 +617,6 @@ int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type) } EXPORT_SYMBOL_GPL(vb2_streamoff); -/** - * vb2_expbuf() - Export a buffer as a file descriptor - * @q: videobuf2 queue - * @eb: export buffer structure passed from userspace to vidioc_expbuf - * handler in driver - * - * The return values from this function are intended to be directly returned - * from vidioc_expbuf handler in driver. - */ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb) { return vb2_core_expbuf(q, &eb->fd, eb->type, eb->index, @@ -728,17 +624,6 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb) } EXPORT_SYMBOL_GPL(vb2_expbuf); -/** - * vb2_queue_init() - initialize a videobuf2 queue - * @q: videobuf2 queue; this structure should be allocated in driver - * - * The vb2_queue structure should be allocated by the driver. The driver is - * responsible of clearing it's content and setting initial values for some - * required entries before calling this function. - * q->ops, q->mem_ops, q->type and q->io_modes are mandatory. Please refer - * to the struct vb2_queue description in include/media/videobuf2-core.h - * for more information. - */ int vb2_queue_init(struct vb2_queue *q) { /* @@ -779,39 +664,12 @@ int vb2_queue_init(struct vb2_queue *q) } EXPORT_SYMBOL_GPL(vb2_queue_init); -/** - * vb2_queue_release() - stop streaming, release the queue and free memory - * @q: videobuf2 queue - * - * This function stops streaming and performs necessary clean ups, including - * freeing video buffer memory. The driver is responsible for freeing - * the vb2_queue structure itself. - */ void vb2_queue_release(struct vb2_queue *q) { vb2_core_queue_release(q); } EXPORT_SYMBOL_GPL(vb2_queue_release); -/** - * vb2_poll() - implements poll userspace operation - * @q: videobuf2 queue - * @file: file argument passed to the poll file operation handler - * @wait: wait argument passed to the poll file operation handler - * - * This function implements poll file operation handler for a driver. - * For CAPTURE queues, if a buffer is ready to be dequeued, the userspace will - * be informed that the file descriptor of a video device is available for - * reading. - * For OUTPUT queues, if a buffer is ready to be dequeued, the file descriptor - * will be reported as available for writing. - * - * If the driver uses struct v4l2_fh, then vb2_poll() will also check for any - * pending events. - * - * The return values from this function are intended to be directly returned - * from poll handler in driver. - */ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) { struct video_device *vfd = video_devdata(file); diff --git a/include/media/videobuf2-v4l2.h b/include/media/videobuf2-v4l2.h index 3cc836f76675..01b1b71fc6fd 100644 --- a/include/media/videobuf2-v4l2.h +++ b/include/media/videobuf2-v4l2.h @@ -49,22 +49,171 @@ struct vb2_v4l2_buffer { container_of(vb, struct vb2_v4l2_buffer, vb2_buf) int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); + +/** + * vb2_reqbufs() - Wrapper for vb2_core_reqbufs() that also verifies + * the memory and type values. + * @q: videobuf2 queue + * @req: struct passed from userspace to vidioc_reqbufs handler + * in driver + */ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req); +/** + * vb2_create_bufs() - Wrapper for vb2_core_create_bufs() that also verifies + * the memory and type values. + * @q: videobuf2 queue + * @create: creation parameters, passed from userspace to vidioc_create_bufs + * handler in driver + */ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create); + +/** + * vb2_prepare_buf() - Pass ownership of a buffer from userspace to the kernel + * @q: videobuf2 queue + * @b: buffer structure passed from userspace to vidioc_prepare_buf + * handler in driver + * + * Should be called from vidioc_prepare_buf ioctl handler of a driver. + * This function: + * 1) verifies the passed buffer, + * 2) calls buf_prepare callback in the driver (if provided), in which + * driver-specific buffer initialization can be performed, + * + * The return values from this function are intended to be directly returned + * from vidioc_prepare_buf handler in driver. + */ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b); +/** + * vb2_qbuf() - Queue a buffer from userspace + * @q: videobuf2 queue + * @b: buffer structure passed from userspace to vidioc_qbuf handler + * in driver + * + * Should be called from vidioc_qbuf ioctl handler of a driver. + * This function: + * 1) verifies the passed buffer, + * 2) if necessary, calls buf_prepare callback in the driver (if provided), in + * which driver-specific buffer initialization can be performed, + * 3) if streaming is on, queues the buffer in driver by the means of buf_queue + * callback for processing. + * + * The return values from this function are intended to be directly returned + * from vidioc_qbuf handler in driver. + */ int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); + +/** + * vb2_expbuf() - Export a buffer as a file descriptor + * @q: videobuf2 queue + * @eb: export buffer structure passed from userspace to vidioc_expbuf + * handler in driver + * + * The return values from this function are intended to be directly returned + * from vidioc_expbuf handler in driver. + */ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb); + +/** + * vb2_dqbuf() - Dequeue a buffer to the userspace + * @q: videobuf2 queue + * @b: buffer structure passed from userspace to vidioc_dqbuf handler + * in driver + * @nonblocking: if true, this call will not sleep waiting for a buffer if no + * buffers ready for dequeuing are present. Normally the driver + * would be passing (file->f_flags & O_NONBLOCK) here + * + * Should be called from vidioc_dqbuf ioctl handler of a driver. + * This function: + * 1) verifies the passed buffer, + * 2) calls buf_finish callback in the driver (if provided), in which + * driver can perform any additional operations that may be required before + * returning the buffer to userspace, such as cache sync, + * 3) the buffer struct members are filled with relevant information for + * the userspace. + * + * The return values from this function are intended to be directly returned + * from vidioc_dqbuf handler in driver. + */ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); +/** + * vb2_streamon - start streaming + * @q: videobuf2 queue + * @type: type argument passed from userspace to vidioc_streamon handler + * + * Should be called from vidioc_streamon handler of a driver. + * This function: + * 1) verifies current state + * 2) passes any previously queued buffers to the driver and starts streaming + * + * The return values from this function are intended to be directly returned + * from vidioc_streamon handler in the driver. + */ int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); + +/** + * vb2_streamoff - stop streaming + * @q: videobuf2 queue + * @type: type argument passed from userspace to vidioc_streamoff handler + * + * Should be called from vidioc_streamoff handler of a driver. + * This function: + * 1) verifies current state, + * 2) stop streaming and dequeues any queued buffers, including those previously + * passed to the driver (after waiting for the driver to finish). + * + * This call can be used for pausing playback. + * The return values from this function are intended to be directly returned + * from vidioc_streamoff handler in the driver + */ int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type); +/** + * vb2_queue_init() - initialize a videobuf2 queue + * @q: videobuf2 queue; this structure should be allocated in driver + * + * The vb2_queue structure should be allocated by the driver. The driver is + * responsible of clearing it's content and setting initial values for some + * required entries before calling this function. + * q->ops, q->mem_ops, q->type and q->io_modes are mandatory. Please refer + * to the struct vb2_queue description in include/media/videobuf2-core.h + * for more information. + */ int __must_check vb2_queue_init(struct vb2_queue *q); + +/** + * vb2_queue_release() - stop streaming, release the queue and free memory + * @q: videobuf2 queue + * + * This function stops streaming and performs necessary clean ups, including + * freeing video buffer memory. The driver is responsible for freeing + * the vb2_queue structure itself. + */ void vb2_queue_release(struct vb2_queue *q); + +/** + * vb2_poll() - implements poll userspace operation + * @q: videobuf2 queue + * @file: file argument passed to the poll file operation handler + * @wait: wait argument passed to the poll file operation handler + * + * This function implements poll file operation handler for a driver. + * For CAPTURE queues, if a buffer is ready to be dequeued, the userspace will + * be informed that the file descriptor of a video device is available for + * reading. + * For OUTPUT queues, if a buffer is ready to be dequeued, the file descriptor + * will be reported as available for writing. + * + * If the driver uses struct v4l2_fh, then vb2_poll() will also check for any + * pending events. + * + * The return values from this function are intended to be directly returned + * from poll handler in driver. + */ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, - poll_table *wait); + poll_table *wait); /* * The following functions are not part of the vb2 core API, but are simple From bf4404b482f927096ba3001d829a79f788d2265f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 18:01:44 -0300 Subject: [PATCH 357/591] [media] videobuf2-v4l2.h: improve documentation There are a few issues at the documentation: fields not documented, bad cross refrences, etc. Fix them. Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-v4l2.h | 52 +++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/include/media/videobuf2-v4l2.h b/include/media/videobuf2-v4l2.h index 01b1b71fc6fd..611d4f330a4c 100644 --- a/include/media/videobuf2-v4l2.h +++ b/include/media/videobuf2-v4l2.h @@ -25,11 +25,13 @@ /** * struct vb2_v4l2_buffer - video buffer information for v4l2 + * * @vb2_buf: video buffer 2 * @flags: buffer informational flags * @field: enum v4l2_field; field order of the image in the buffer * @timecode: frame timecode * @sequence: sequence count of this frame + * * Should contain enough information to be able to cover all the fields * of struct v4l2_buffer at videodev2.h */ @@ -53,6 +55,7 @@ int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); /** * vb2_reqbufs() - Wrapper for vb2_core_reqbufs() that also verifies * the memory and type values. + * * @q: videobuf2 queue * @req: struct passed from userspace to vidioc_reqbufs handler * in driver @@ -62,6 +65,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req); /** * vb2_create_bufs() - Wrapper for vb2_core_create_bufs() that also verifies * the memory and type values. + * * @q: videobuf2 queue * @create: creation parameters, passed from userspace to vidioc_create_bufs * handler in driver @@ -70,15 +74,17 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create); /** * vb2_prepare_buf() - Pass ownership of a buffer from userspace to the kernel + * * @q: videobuf2 queue * @b: buffer structure passed from userspace to vidioc_prepare_buf * handler in driver * * Should be called from vidioc_prepare_buf ioctl handler of a driver. * This function: - * 1) verifies the passed buffer, - * 2) calls buf_prepare callback in the driver (if provided), in which - * driver-specific buffer initialization can be performed, + * + * #) verifies the passed buffer, + * #) calls buf_prepare callback in the driver (if provided), in which + * driver-specific buffer initialization can be performed. * * The return values from this function are intended to be directly returned * from vidioc_prepare_buf handler in driver. @@ -88,53 +94,57 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b); /** * vb2_qbuf() - Queue a buffer from userspace * @q: videobuf2 queue - * @b: buffer structure passed from userspace to vidioc_qbuf handler + * @b: buffer structure passed from userspace to VIDIOC_QBUF() handler * in driver * - * Should be called from vidioc_qbuf ioctl handler of a driver. + * Should be called from VIDIOC_QBUF() ioctl handler of a driver. + * * This function: - * 1) verifies the passed buffer, - * 2) if necessary, calls buf_prepare callback in the driver (if provided), in + * + * #) verifies the passed buffer, + * #) if necessary, calls buf_prepare callback in the driver (if provided), in * which driver-specific buffer initialization can be performed, - * 3) if streaming is on, queues the buffer in driver by the means of buf_queue + * #) if streaming is on, queues the buffer in driver by the means of buf_queue * callback for processing. * * The return values from this function are intended to be directly returned - * from vidioc_qbuf handler in driver. + * from VIDIOC_QBUF() handler in driver. */ int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); /** * vb2_expbuf() - Export a buffer as a file descriptor * @q: videobuf2 queue - * @eb: export buffer structure passed from userspace to vidioc_expbuf + * @eb: export buffer structure passed from userspace to VIDIOC_EXPBUF() * handler in driver * * The return values from this function are intended to be directly returned - * from vidioc_expbuf handler in driver. + * from VIDIOC_EXPBUF() handler in driver. */ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb); /** * vb2_dqbuf() - Dequeue a buffer to the userspace * @q: videobuf2 queue - * @b: buffer structure passed from userspace to vidioc_dqbuf handler + * @b: buffer structure passed from userspace to VIDIOC_DQBUF() handler * in driver * @nonblocking: if true, this call will not sleep waiting for a buffer if no * buffers ready for dequeuing are present. Normally the driver * would be passing (file->f_flags & O_NONBLOCK) here * - * Should be called from vidioc_dqbuf ioctl handler of a driver. + * Should be called from VIDIOC_DQBUF() ioctl handler of a driver. + * * This function: - * 1) verifies the passed buffer, - * 2) calls buf_finish callback in the driver (if provided), in which + * + * #) verifies the passed buffer, + * #) calls buf_finish callback in the driver (if provided), in which * driver can perform any additional operations that may be required before * returning the buffer to userspace, such as cache sync, - * 3) the buffer struct members are filled with relevant information for + * #) the buffer struct members are filled with relevant information for * the userspace. * * The return values from this function are intended to be directly returned - * from vidioc_dqbuf handler in driver. + * from VIDIOC_DQBUF() handler in driver. */ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); @@ -144,7 +154,9 @@ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); * @type: type argument passed from userspace to vidioc_streamon handler * * Should be called from vidioc_streamon handler of a driver. + * * This function: + * * 1) verifies current state * 2) passes any previously queued buffers to the driver and starts streaming * @@ -159,9 +171,11 @@ int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); * @type: type argument passed from userspace to vidioc_streamoff handler * * Should be called from vidioc_streamoff handler of a driver. + * * This function: - * 1) verifies current state, - * 2) stop streaming and dequeues any queued buffers, including those previously + * + * #) verifies current state, + * #) stop streaming and dequeues any queued buffers, including those previously * passed to the driver (after waiting for the driver to finish). * * This call can be used for pausing playback. From dba2d12ae49217254cfc0452c68f1a4e2d2f1e4b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 18:12:18 -0300 Subject: [PATCH 358/591] [media] videobuf2-v4l2: document two helper functions Document vb2_ops_wait_prepare() and vb2_ops_wait_finish(), in order to fix those two warnings: Documentation/media/kapi/v4l2-dev.rst:166: WARNING: c:func reference target not found: vb2_ops_wait_prepare Documentation/media/kapi/v4l2-dev.rst:166: WARNING: c:func reference target not found: vb2_ops_wait_finish Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-v4l2.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/media/videobuf2-v4l2.h b/include/media/videobuf2-v4l2.h index 611d4f330a4c..036127c54bbf 100644 --- a/include/media/videobuf2-v4l2.h +++ b/include/media/videobuf2-v4l2.h @@ -268,9 +268,22 @@ unsigned long vb2_fop_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); #endif -/* struct vb2_ops helpers, only use if vq->lock is non-NULL. */ - +/** + * vb2_ops_wait_prepare - helper function to lock a struct &vb2_queue + * + * @vq: pointer to struct vb2_queue + * + * ..note:: only use if vq->lock is non-NULL. + */ void vb2_ops_wait_prepare(struct vb2_queue *vq); + +/** + * vb2_ops_wait_finish - helper function to unlock a struct &vb2_queue + * + * @vq: pointer to struct vb2_queue + * + * ..note:: only use if vq->lock is non-NULL. + */ void vb2_ops_wait_finish(struct vb2_queue *vq); #endif /* _MEDIA_VIDEOBUF2_V4L2_H */ From 0d56015d80a2c187c107d7780b89712bda8eee2e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 18:23:35 -0300 Subject: [PATCH 359/591] [media] v4l2-flash-led-class.h: document v4l2_flash_ops Fix this warning: ./include/media/v4l2-flash-led-class.h:103: WARNING: c:type reference target not found: v4l2_flash_ops Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-flash-led-class.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/include/media/v4l2-flash-led-class.h b/include/media/v4l2-flash-led-class.h index 3d184ab52274..b0fe4d6f4a5f 100644 --- a/include/media/v4l2-flash-led-class.h +++ b/include/media/v4l2-flash-led-class.h @@ -20,7 +20,7 @@ struct led_classdev; struct v4l2_flash; enum led_brightness; -/* +/** * struct v4l2_flash_ctrl_data - flash control initialization data, filled * basing on the features declared by the LED flash * class driver in the v4l2_flash_config @@ -33,14 +33,21 @@ struct v4l2_flash_ctrl_data { u32 cid; }; +/** + * struct v4l2_flash_ops - V4L2 flash operations + * + * @external_strobe_set: Setup strobing the flash by hardware pin state + * assertion. + * @intensity_to_led_brightness: Convert intensity to brightness in a device + * specific manner + * @led_brightness_to_intensity: convert brightness to intensity in a device + * specific manner. + */ struct v4l2_flash_ops { - /* setup strobing the flash by hardware pin state assertion */ int (*external_strobe_set)(struct v4l2_flash *v4l2_flash, bool enable); - /* convert intensity to brightness in a device specific manner */ enum led_brightness (*intensity_to_led_brightness) (struct v4l2_flash *v4l2_flash, s32 intensity); - /* convert brightness to intensity in a device specific manner */ s32 (*led_brightness_to_intensity) (struct v4l2_flash *v4l2_flash, enum led_brightness); }; From cb8d67cf70b4bc7d60c356896823022717b70d1e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Sep 2016 18:31:17 -0300 Subject: [PATCH 360/591] [media] v4l2-subdev: fix some references to v4l2_dev There is a warning there, because it was pointing to a different name. Fix it. While here, use struct &foo, instead of &struct foo. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 2c1e328ccb1d..e175c2c891a8 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -764,7 +764,7 @@ struct v4l2_subdev_platform_data { * @entity: pointer to &struct media_entity * @list: List of sub-devices * @owner: The owner is the same as the driver's &struct device owner. - * @owner_v4l2_dev: true if the &sd->owner matches the owner of &v4l2_dev->dev + * @owner_v4l2_dev: true if the &sd->owner matches the owner of @v4l2_dev->dev * ownner. Initialized by v4l2_device_register_subdev(). * @flags: subdev flags. Can be: * %V4L2_SUBDEV_FL_IS_I2C - Set this flag if this subdev is a i2c device; @@ -774,9 +774,9 @@ struct v4l2_subdev_platform_data { * %V4L2_SUBDEV_FL_HAS_EVENTS - Set this flag if this subdev generates * events. * - * @v4l2_dev: pointer to &struct v4l2_device - * @ops: pointer to &struct v4l2_subdev_ops - * @internal_ops: pointer to &struct v4l2_subdev_internal_ops. + * @v4l2_dev: pointer to struct &v4l2_device + * @ops: pointer to struct &v4l2_subdev_ops + * @internal_ops: pointer to struct &v4l2_subdev_internal_ops. * Never call these internal ops from within a driver! * @ctrl_handler: The control handler of this subdev. May be NULL. * @name: Name of the sub-device. Please notice that the name must be unique. From 9ef0b3f3f88d2a177e3403dd57e373d97f1c389c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 9 Sep 2016 08:40:15 -0300 Subject: [PATCH 361/591] [media] v4l2-subdev.h: fix a typo at a kernel-doc markup One struct at the comment was not written well. Fix it. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-subdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index e175c2c891a8..863f92600607 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -421,7 +421,7 @@ struct v4l2_subdev_video_ops { * in video mode via the vbi device node. * * @decode_vbi_line: video decoders that support sliced VBI need to implement - * this ioctl. Field p of the &struct v4l2_sliced_vbi_line is set to the + * this ioctl. Field p of the &struct v4l2_decode_vbi_line is set to the * start of the VBI data that was generated by the decoder. The driver * then parses the sliced VBI data and sets the other fields in the * struct accordingly. The pointer p is updated to point to the start of From 57b2c0628b6042b7cfad387fe54951ddf7185fd2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Trotin Date: Mon, 5 Sep 2016 11:06:29 -0300 Subject: [PATCH 362/591] [media] st-hva: multi-format video encoder V4L2 driver This patch adds V4L2 HVA (Hardware Video Accelerator) video encoder driver for STMicroelectronics SoC. It uses the V4L2 mem2mem framework. This patch only contains the core parts of the driver: - the V4L2 interface with the userland (hva-v4l2.c) - the hardware services (hva-hw.c) - the memory management utilities (hva-mem.c) This patch doesn't include the support of specific codec (e.g. H.264) video encoding: this support is part of subsequent patches. Signed-off-by: Yannick Fertre Signed-off-by: Jean-Christophe Trotin Acked-by: Peter Griffin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/Kconfig | 15 + drivers/media/platform/Makefile | 1 + drivers/media/platform/sti/hva/Makefile | 2 + drivers/media/platform/sti/hva/hva-hw.c | 538 +++++++++ drivers/media/platform/sti/hva/hva-hw.h | 42 + drivers/media/platform/sti/hva/hva-mem.c | 59 + drivers/media/platform/sti/hva/hva-mem.h | 34 + drivers/media/platform/sti/hva/hva-v4l2.c | 1308 +++++++++++++++++++++ drivers/media/platform/sti/hva/hva.h | 290 +++++ 9 files changed, 2289 insertions(+) create mode 100644 drivers/media/platform/sti/hva/Makefile create mode 100644 drivers/media/platform/sti/hva/hva-hw.c create mode 100644 drivers/media/platform/sti/hva/hva-hw.h create mode 100644 drivers/media/platform/sti/hva/hva-mem.c create mode 100644 drivers/media/platform/sti/hva/hva-mem.h create mode 100644 drivers/media/platform/sti/hva/hva-v4l2.c create mode 100644 drivers/media/platform/sti/hva/hva.h diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 46f14ddeee65..124098560d02 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -257,6 +257,21 @@ config VIDEO_STI_BDISP help This v4l2 mem2mem driver is a 2D blitter for STMicroelectronics SoC. +config VIDEO_STI_HVA + tristate "STMicroelectronics HVA multi-format video encoder V4L2 driver" + depends on VIDEO_DEV && VIDEO_V4L2 + depends on HAS_DMA + depends on ARCH_STI || COMPILE_TEST + select VIDEOBUF2_DMA_CONTIG + select V4L2_MEM2MEM_DEV + help + This V4L2 driver enables HVA (Hardware Video Accelerator) multi-format + video encoder of STMicroelectronics SoC, allowing hardware encoding of + raw uncompressed formats in various compressed video bitstreams format. + + To compile this driver as a module, choose M here: + the module will be called st-hva. + config VIDEO_SH_VEU tristate "SuperH VEU mem2mem video processing driver" depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 536d1d8ef022..b4ee8aaf6d88 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_G2D) += s5p-g2d/ obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC) += exynos-gsc/ obj-$(CONFIG_VIDEO_STI_BDISP) += sti/bdisp/ +obj-$(CONFIG_VIDEO_STI_HVA) += sti/hva/ obj-$(CONFIG_DVB_C8SECTPFE) += sti/c8sectpfe/ obj-$(CONFIG_BLACKFIN) += blackfin/ diff --git a/drivers/media/platform/sti/hva/Makefile b/drivers/media/platform/sti/hva/Makefile new file mode 100644 index 000000000000..633ee408c34b --- /dev/null +++ b/drivers/media/platform/sti/hva/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_VIDEO_STI_HVA) := st-hva.o +st-hva-y := hva-v4l2.o hva-hw.o hva-mem.o diff --git a/drivers/media/platform/sti/hva/hva-hw.c b/drivers/media/platform/sti/hva/hva-hw.c new file mode 100644 index 000000000000..d341d4994528 --- /dev/null +++ b/drivers/media/platform/sti/hva/hva-hw.c @@ -0,0 +1,538 @@ +/* + * Copyright (C) STMicroelectronics SA 2015 + * Authors: Yannick Fertre + * Hugues Fruchet + * License terms: GNU General Public License (GPL), version 2 + */ + +#include +#include +#include +#include + +#include "hva.h" +#include "hva-hw.h" + +/* HVA register offsets */ +#define HVA_HIF_REG_RST 0x0100U +#define HVA_HIF_REG_RST_ACK 0x0104U +#define HVA_HIF_REG_MIF_CFG 0x0108U +#define HVA_HIF_REG_HEC_MIF_CFG 0x010CU +#define HVA_HIF_REG_CFL 0x0110U +#define HVA_HIF_FIFO_CMD 0x0114U +#define HVA_HIF_FIFO_STS 0x0118U +#define HVA_HIF_REG_SFL 0x011CU +#define HVA_HIF_REG_IT_ACK 0x0120U +#define HVA_HIF_REG_ERR_IT_ACK 0x0124U +#define HVA_HIF_REG_LMI_ERR 0x0128U +#define HVA_HIF_REG_EMI_ERR 0x012CU +#define HVA_HIF_REG_HEC_MIF_ERR 0x0130U +#define HVA_HIF_REG_HEC_STS 0x0134U +#define HVA_HIF_REG_HVC_STS 0x0138U +#define HVA_HIF_REG_HJE_STS 0x013CU +#define HVA_HIF_REG_CNT 0x0140U +#define HVA_HIF_REG_HEC_CHKSYN_DIS 0x0144U +#define HVA_HIF_REG_CLK_GATING 0x0148U +#define HVA_HIF_REG_VERSION 0x014CU +#define HVA_HIF_REG_BSM 0x0150U + +/* define value for version id register (HVA_HIF_REG_VERSION) */ +#define VERSION_ID_MASK 0x0000FFFF + +/* define values for BSM register (HVA_HIF_REG_BSM) */ +#define BSM_CFG_VAL1 0x0003F000 +#define BSM_CFG_VAL2 0x003F0000 + +/* define values for memory interface register (HVA_HIF_REG_MIF_CFG) */ +#define MIF_CFG_VAL1 0x04460446 +#define MIF_CFG_VAL2 0x04460806 +#define MIF_CFG_VAL3 0x00000000 + +/* define value for HEC memory interface register (HVA_HIF_REG_MIF_CFG) */ +#define HEC_MIF_CFG_VAL 0x000000C4 + +/* Bits definition for clock gating register (HVA_HIF_REG_CLK_GATING) */ +#define CLK_GATING_HVC BIT(0) +#define CLK_GATING_HEC BIT(1) +#define CLK_GATING_HJE BIT(2) + +/* fix hva clock rate */ +#define CLK_RATE 300000000 + +/* fix delay for pmruntime */ +#define AUTOSUSPEND_DELAY_MS 3 + +/* + * hw encode error values + * NO_ERROR: Success, Task OK + * H264_BITSTREAM_OVERSIZE: VECH264 Bitstream size > bitstream buffer + * H264_FRAME_SKIPPED: VECH264 Frame skipped (refers to CPB Buffer Size) + * H264_SLICE_LIMIT_SIZE: VECH264 MB > slice limit size + * H264_MAX_SLICE_NUMBER: VECH264 max slice number reached + * H264_SLICE_READY: VECH264 Slice ready + * TASK_LIST_FULL: HVA/FPC task list full + (discard latest transform command) + * UNKNOWN_COMMAND: Transform command not known by HVA/FPC + * WRONG_CODEC_OR_RESOLUTION: Wrong Codec or Resolution Selection + * NO_INT_COMPLETION: Time-out on interrupt completion + * LMI_ERR: Local Memory Interface Error + * EMI_ERR: External Memory Interface Error + * HECMI_ERR: HEC Memory Interface Error + */ +enum hva_hw_error { + NO_ERROR = 0x0, + H264_BITSTREAM_OVERSIZE = 0x2, + H264_FRAME_SKIPPED = 0x4, + H264_SLICE_LIMIT_SIZE = 0x5, + H264_MAX_SLICE_NUMBER = 0x7, + H264_SLICE_READY = 0x8, + TASK_LIST_FULL = 0xF0, + UNKNOWN_COMMAND = 0xF1, + WRONG_CODEC_OR_RESOLUTION = 0xF4, + NO_INT_COMPLETION = 0x100, + LMI_ERR = 0x101, + EMI_ERR = 0x102, + HECMI_ERR = 0x103, +}; + +static irqreturn_t hva_hw_its_interrupt(int irq, void *data) +{ + struct hva_dev *hva = data; + + /* read status registers */ + hva->sts_reg = readl_relaxed(hva->regs + HVA_HIF_FIFO_STS); + hva->sfl_reg = readl_relaxed(hva->regs + HVA_HIF_REG_SFL); + + /* acknowledge interruption */ + writel_relaxed(0x1, hva->regs + HVA_HIF_REG_IT_ACK); + + return IRQ_WAKE_THREAD; +} + +static irqreturn_t hva_hw_its_irq_thread(int irq, void *arg) +{ + struct hva_dev *hva = arg; + struct device *dev = hva_to_dev(hva); + u32 status = hva->sts_reg & 0xFF; + u8 ctx_id = 0; + struct hva_ctx *ctx = NULL; + + dev_dbg(dev, "%s %s: status: 0x%02x fifo level: 0x%02x\n", + HVA_PREFIX, __func__, hva->sts_reg & 0xFF, hva->sfl_reg & 0xF); + + /* + * status: task_id[31:16] client_id[15:8] status[7:0] + * the context identifier is retrieved from the client identifier + */ + ctx_id = (hva->sts_reg & 0xFF00) >> 8; + if (ctx_id >= HVA_MAX_INSTANCES) { + dev_err(dev, "%s %s: bad context identifier: %d\n", + ctx->name, __func__, ctx_id); + ctx->hw_err = true; + goto out; + } + + ctx = hva->instances[ctx_id]; + if (!ctx) + goto out; + + switch (status) { + case NO_ERROR: + dev_dbg(dev, "%s %s: no error\n", + ctx->name, __func__); + ctx->hw_err = false; + break; + case H264_SLICE_READY: + dev_dbg(dev, "%s %s: h264 slice ready\n", + ctx->name, __func__); + ctx->hw_err = false; + break; + case H264_FRAME_SKIPPED: + dev_dbg(dev, "%s %s: h264 frame skipped\n", + ctx->name, __func__); + ctx->hw_err = false; + break; + case H264_BITSTREAM_OVERSIZE: + dev_err(dev, "%s %s:h264 bitstream oversize\n", + ctx->name, __func__); + ctx->hw_err = true; + break; + case H264_SLICE_LIMIT_SIZE: + dev_err(dev, "%s %s: h264 slice limit size is reached\n", + ctx->name, __func__); + ctx->hw_err = true; + break; + case H264_MAX_SLICE_NUMBER: + dev_err(dev, "%s %s: h264 max slice number is reached\n", + ctx->name, __func__); + ctx->hw_err = true; + break; + case TASK_LIST_FULL: + dev_err(dev, "%s %s:task list full\n", + ctx->name, __func__); + ctx->hw_err = true; + break; + case UNKNOWN_COMMAND: + dev_err(dev, "%s %s: command not known\n", + ctx->name, __func__); + ctx->hw_err = true; + break; + case WRONG_CODEC_OR_RESOLUTION: + dev_err(dev, "%s %s: wrong codec or resolution\n", + ctx->name, __func__); + ctx->hw_err = true; + break; + default: + dev_err(dev, "%s %s: status not recognized\n", + ctx->name, __func__); + ctx->hw_err = true; + break; + } +out: + complete(&hva->interrupt); + + return IRQ_HANDLED; +} + +static irqreturn_t hva_hw_err_interrupt(int irq, void *data) +{ + struct hva_dev *hva = data; + + /* read status registers */ + hva->sts_reg = readl_relaxed(hva->regs + HVA_HIF_FIFO_STS); + hva->sfl_reg = readl_relaxed(hva->regs + HVA_HIF_REG_SFL); + + /* read error registers */ + hva->lmi_err_reg = readl_relaxed(hva->regs + HVA_HIF_REG_LMI_ERR); + hva->emi_err_reg = readl_relaxed(hva->regs + HVA_HIF_REG_EMI_ERR); + hva->hec_mif_err_reg = readl_relaxed(hva->regs + + HVA_HIF_REG_HEC_MIF_ERR); + + /* acknowledge interruption */ + writel_relaxed(0x1, hva->regs + HVA_HIF_REG_IT_ACK); + + return IRQ_WAKE_THREAD; +} + +static irqreturn_t hva_hw_err_irq_thread(int irq, void *arg) +{ + struct hva_dev *hva = arg; + struct device *dev = hva_to_dev(hva); + u8 ctx_id = 0; + struct hva_ctx *ctx; + + dev_dbg(dev, "%s status: 0x%02x fifo level: 0x%02x\n", + HVA_PREFIX, hva->sts_reg & 0xFF, hva->sfl_reg & 0xF); + + /* + * status: task_id[31:16] client_id[15:8] status[7:0] + * the context identifier is retrieved from the client identifier + */ + ctx_id = (hva->sts_reg & 0xFF00) >> 8; + if (ctx_id >= HVA_MAX_INSTANCES) { + dev_err(dev, "%s bad context identifier: %d\n", HVA_PREFIX, + ctx_id); + goto out; + } + + ctx = hva->instances[ctx_id]; + if (!ctx) + goto out; + + if (hva->lmi_err_reg) { + dev_err(dev, "%s local memory interface error: 0x%08x\n", + ctx->name, hva->lmi_err_reg); + ctx->hw_err = true; + } + + if (hva->lmi_err_reg) { + dev_err(dev, "%s external memory interface error: 0x%08x\n", + ctx->name, hva->emi_err_reg); + ctx->hw_err = true; + } + + if (hva->hec_mif_err_reg) { + dev_err(dev, "%s hec memory interface error: 0x%08x\n", + ctx->name, hva->hec_mif_err_reg); + ctx->hw_err = true; + } +out: + complete(&hva->interrupt); + + return IRQ_HANDLED; +} + +static unsigned long int hva_hw_get_ip_version(struct hva_dev *hva) +{ + struct device *dev = hva_to_dev(hva); + unsigned long int version; + + if (pm_runtime_get_sync(dev) < 0) { + dev_err(dev, "%s failed to get pm_runtime\n", HVA_PREFIX); + mutex_unlock(&hva->protect_mutex); + return -EFAULT; + } + + version = readl_relaxed(hva->regs + HVA_HIF_REG_VERSION) & + VERSION_ID_MASK; + + pm_runtime_put_autosuspend(dev); + + switch (version) { + case HVA_VERSION_V400: + dev_dbg(dev, "%s IP hardware version 0x%lx\n", + HVA_PREFIX, version); + break; + default: + dev_err(dev, "%s unknown IP hardware version 0x%lx\n", + HVA_PREFIX, version); + version = HVA_VERSION_UNKNOWN; + break; + } + + return version; +} + +int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva) +{ + struct device *dev = &pdev->dev; + struct resource *regs; + struct resource *esram; + int ret; + + WARN_ON(!hva); + + /* get memory for registers */ + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + hva->regs = devm_ioremap_resource(dev, regs); + if (IS_ERR_OR_NULL(hva->regs)) { + dev_err(dev, "%s failed to get regs\n", HVA_PREFIX); + return PTR_ERR(hva->regs); + } + + /* get memory for esram */ + esram = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (IS_ERR_OR_NULL(esram)) { + dev_err(dev, "%s failed to get esram\n", HVA_PREFIX); + return PTR_ERR(esram); + } + hva->esram_addr = esram->start; + hva->esram_size = resource_size(esram); + + dev_info(dev, "%s esram reserved for address: 0x%x size:%d\n", + HVA_PREFIX, hva->esram_addr, hva->esram_size); + + /* get clock resource */ + hva->clk = devm_clk_get(dev, "clk_hva"); + if (IS_ERR(hva->clk)) { + dev_err(dev, "%s failed to get clock\n", HVA_PREFIX); + return PTR_ERR(hva->clk); + } + + ret = clk_prepare(hva->clk); + if (ret < 0) { + dev_err(dev, "%s failed to prepare clock\n", HVA_PREFIX); + hva->clk = ERR_PTR(-EINVAL); + return ret; + } + + /* get status interruption resource */ + ret = platform_get_irq(pdev, 0); + if (ret < 0) { + dev_err(dev, "%s failed to get status IRQ\n", HVA_PREFIX); + goto err_clk; + } + hva->irq_its = ret; + + ret = devm_request_threaded_irq(dev, hva->irq_its, hva_hw_its_interrupt, + hva_hw_its_irq_thread, + IRQF_ONESHOT, + "hva_its_irq", hva); + if (ret) { + dev_err(dev, "%s failed to install status IRQ 0x%x\n", + HVA_PREFIX, hva->irq_its); + goto err_clk; + } + disable_irq(hva->irq_its); + + /* get error interruption resource */ + ret = platform_get_irq(pdev, 1); + if (ret < 0) { + dev_err(dev, "%s failed to get error IRQ\n", HVA_PREFIX); + goto err_clk; + } + hva->irq_err = ret; + + ret = devm_request_threaded_irq(dev, hva->irq_err, hva_hw_err_interrupt, + hva_hw_err_irq_thread, + IRQF_ONESHOT, + "hva_err_irq", hva); + if (ret) { + dev_err(dev, "%s failed to install error IRQ 0x%x\n", + HVA_PREFIX, hva->irq_err); + goto err_clk; + } + disable_irq(hva->irq_err); + + /* initialise protection mutex */ + mutex_init(&hva->protect_mutex); + + /* initialise completion signal */ + init_completion(&hva->interrupt); + + /* initialise runtime power management */ + pm_runtime_set_autosuspend_delay(dev, AUTOSUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_suspended(dev); + pm_runtime_enable(dev); + + ret = pm_runtime_get_sync(dev); + if (ret < 0) { + dev_err(dev, "%s failed to set PM\n", HVA_PREFIX); + goto err_clk; + } + + /* check IP hardware version */ + hva->ip_version = hva_hw_get_ip_version(hva); + + if (hva->ip_version == HVA_VERSION_UNKNOWN) { + ret = -EINVAL; + goto err_pm; + } + + dev_info(dev, "%s found hva device (version 0x%lx)\n", HVA_PREFIX, + hva->ip_version); + + return 0; + +err_pm: + pm_runtime_put(dev); +err_clk: + if (hva->clk) + clk_unprepare(hva->clk); + + return ret; +} + +void hva_hw_remove(struct hva_dev *hva) +{ + struct device *dev = hva_to_dev(hva); + + disable_irq(hva->irq_its); + disable_irq(hva->irq_err); + + pm_runtime_put_autosuspend(dev); + pm_runtime_disable(dev); +} + +int hva_hw_runtime_suspend(struct device *dev) +{ + struct hva_dev *hva = dev_get_drvdata(dev); + + clk_disable_unprepare(hva->clk); + + return 0; +} + +int hva_hw_runtime_resume(struct device *dev) +{ + struct hva_dev *hva = dev_get_drvdata(dev); + + if (clk_prepare_enable(hva->clk)) { + dev_err(hva->dev, "%s failed to prepare hva clk\n", + HVA_PREFIX); + return -EINVAL; + } + + if (clk_set_rate(hva->clk, CLK_RATE)) { + dev_err(dev, "%s failed to set clock frequency\n", + HVA_PREFIX); + return -EINVAL; + } + + return 0; +} + +int hva_hw_execute_task(struct hva_ctx *ctx, enum hva_hw_cmd_type cmd, + struct hva_buffer *task) +{ + struct hva_dev *hva = ctx_to_hdev(ctx); + struct device *dev = hva_to_dev(hva); + u8 client_id = ctx->id; + int ret; + u32 reg = 0; + + mutex_lock(&hva->protect_mutex); + + /* enable irqs */ + enable_irq(hva->irq_its); + enable_irq(hva->irq_err); + + if (pm_runtime_get_sync(dev) < 0) { + dev_err(dev, "%s failed to get pm_runtime\n", ctx->name); + ret = -EFAULT; + goto out; + } + + reg = readl_relaxed(hva->regs + HVA_HIF_REG_CLK_GATING); + switch (cmd) { + case H264_ENC: + reg |= CLK_GATING_HVC; + break; + default: + dev_dbg(dev, "%s unknown command 0x%x\n", ctx->name, cmd); + ret = -EFAULT; + goto out; + } + writel_relaxed(reg, hva->regs + HVA_HIF_REG_CLK_GATING); + + dev_dbg(dev, "%s %s: write configuration registers\n", ctx->name, + __func__); + + /* byte swap config */ + writel_relaxed(BSM_CFG_VAL1, hva->regs + HVA_HIF_REG_BSM); + + /* define Max Opcode Size and Max Message Size for LMI and EMI */ + writel_relaxed(MIF_CFG_VAL3, hva->regs + HVA_HIF_REG_MIF_CFG); + writel_relaxed(HEC_MIF_CFG_VAL, hva->regs + HVA_HIF_REG_HEC_MIF_CFG); + + /* + * command FIFO: task_id[31:16] client_id[15:8] command_type[7:0] + * the context identifier is provided as client identifier to the + * hardware, and is retrieved in the interrupt functions from the + * status register + */ + dev_dbg(dev, "%s %s: send task (cmd: %d, task_desc: %pad)\n", + ctx->name, __func__, cmd + (client_id << 8), &task->paddr); + writel_relaxed(cmd + (client_id << 8), hva->regs + HVA_HIF_FIFO_CMD); + writel_relaxed(task->paddr, hva->regs + HVA_HIF_FIFO_CMD); + + if (!wait_for_completion_timeout(&hva->interrupt, + msecs_to_jiffies(2000))) { + dev_err(dev, "%s %s: time out on completion\n", ctx->name, + __func__); + ret = -EFAULT; + goto out; + } + + /* get encoding status */ + ret = ctx->hw_err ? -EFAULT : 0; + +out: + disable_irq(hva->irq_its); + disable_irq(hva->irq_err); + + switch (cmd) { + case H264_ENC: + reg &= ~CLK_GATING_HVC; + writel_relaxed(reg, hva->regs + HVA_HIF_REG_CLK_GATING); + break; + default: + dev_dbg(dev, "%s unknown command 0x%x\n", ctx->name, cmd); + } + + pm_runtime_put_autosuspend(dev); + mutex_unlock(&hva->protect_mutex); + + return ret; +} diff --git a/drivers/media/platform/sti/hva/hva-hw.h b/drivers/media/platform/sti/hva/hva-hw.h new file mode 100644 index 000000000000..efb45b927524 --- /dev/null +++ b/drivers/media/platform/sti/hva/hva-hw.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) STMicroelectronics SA 2015 + * Authors: Yannick Fertre + * Hugues Fruchet + * License terms: GNU General Public License (GPL), version 2 + */ + +#ifndef HVA_HW_H +#define HVA_HW_H + +#include "hva-mem.h" + +/* HVA Versions */ +#define HVA_VERSION_UNKNOWN 0x000 +#define HVA_VERSION_V400 0x400 + +/* HVA command types */ +enum hva_hw_cmd_type { + /* RESERVED = 0x00 */ + /* RESERVED = 0x01 */ + H264_ENC = 0x02, + /* RESERVED = 0x03 */ + /* RESERVED = 0x04 */ + /* RESERVED = 0x05 */ + /* RESERVED = 0x06 */ + /* RESERVED = 0x07 */ + REMOVE_CLIENT = 0x08, + FREEZE_CLIENT = 0x09, + START_CLIENT = 0x0A, + FREEZE_ALL = 0x0B, + START_ALL = 0x0C, + REMOVE_ALL = 0x0D +}; + +int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva); +void hva_hw_remove(struct hva_dev *hva); +int hva_hw_runtime_suspend(struct device *dev); +int hva_hw_runtime_resume(struct device *dev); +int hva_hw_execute_task(struct hva_ctx *ctx, enum hva_hw_cmd_type cmd, + struct hva_buffer *task); + +#endif /* HVA_HW_H */ diff --git a/drivers/media/platform/sti/hva/hva-mem.c b/drivers/media/platform/sti/hva/hva-mem.c new file mode 100644 index 000000000000..649f66007ad6 --- /dev/null +++ b/drivers/media/platform/sti/hva/hva-mem.c @@ -0,0 +1,59 @@ +/* + * Copyright (C) STMicroelectronics SA 2015 + * Authors: Yannick Fertre + * Hugues Fruchet + * License terms: GNU General Public License (GPL), version 2 + */ + +#include "hva.h" +#include "hva-mem.h" + +int hva_mem_alloc(struct hva_ctx *ctx, u32 size, const char *name, + struct hva_buffer **buf) +{ + struct device *dev = ctx_to_dev(ctx); + struct hva_buffer *b; + dma_addr_t paddr; + void *base; + + b = devm_kzalloc(dev, sizeof(*b), GFP_KERNEL); + if (!b) + return -ENOMEM; + + base = dma_alloc_attrs(dev, size, &paddr, GFP_KERNEL | GFP_DMA, + DMA_ATTR_WRITE_COMBINE); + if (!base) { + dev_err(dev, "%s %s : dma_alloc_attrs failed for %s (size=%d)\n", + ctx->name, __func__, name, size); + devm_kfree(dev, b); + return -ENOMEM; + } + + b->size = size; + b->paddr = paddr; + b->vaddr = base; + b->name = name; + + dev_dbg(dev, + "%s allocate %d bytes of HW memory @(virt=%p, phy=%pad): %s\n", + ctx->name, size, b->vaddr, &b->paddr, b->name); + + /* return hva buffer to user */ + *buf = b; + + return 0; +} + +void hva_mem_free(struct hva_ctx *ctx, struct hva_buffer *buf) +{ + struct device *dev = ctx_to_dev(ctx); + + dev_dbg(dev, + "%s free %d bytes of HW memory @(virt=%p, phy=%pad): %s\n", + ctx->name, buf->size, buf->vaddr, &buf->paddr, buf->name); + + dma_free_attrs(dev, buf->size, buf->vaddr, buf->paddr, + DMA_ATTR_WRITE_COMBINE); + + devm_kfree(dev, buf); +} diff --git a/drivers/media/platform/sti/hva/hva-mem.h b/drivers/media/platform/sti/hva/hva-mem.h new file mode 100644 index 000000000000..a95c728a45e6 --- /dev/null +++ b/drivers/media/platform/sti/hva/hva-mem.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) STMicroelectronics SA 2015 + * Authors: Yannick Fertre + * Hugues Fruchet + * License terms: GNU General Public License (GPL), version 2 + */ + +#ifndef HVA_MEM_H +#define HVA_MEM_H + +/** + * struct hva_buffer - hva buffer + * + * @name: name of requester + * @paddr: physical address (for hardware) + * @vaddr: virtual address (kernel can read/write) + * @size: size of buffer + */ +struct hva_buffer { + const char *name; + dma_addr_t paddr; + void *vaddr; + u32 size; +}; + +int hva_mem_alloc(struct hva_ctx *ctx, + __u32 size, + const char *name, + struct hva_buffer **buf); + +void hva_mem_free(struct hva_ctx *ctx, + struct hva_buffer *buf); + +#endif /* HVA_MEM_H */ diff --git a/drivers/media/platform/sti/hva/hva-v4l2.c b/drivers/media/platform/sti/hva/hva-v4l2.c new file mode 100644 index 000000000000..54e79f71bfbe --- /dev/null +++ b/drivers/media/platform/sti/hva/hva-v4l2.c @@ -0,0 +1,1308 @@ +/* + * Copyright (C) STMicroelectronics SA 2015 + * Authors: Yannick Fertre + * Hugues Fruchet + * License terms: GNU General Public License (GPL), version 2 + */ + +#include +#include +#include +#include +#include +#include + +#include "hva.h" +#include "hva-hw.h" + +#define HVA_NAME "st-hva" + +#define MIN_FRAMES 1 +#define MIN_STREAMS 1 + +#define HVA_MIN_WIDTH 32 +#define HVA_MAX_WIDTH 1920 +#define HVA_MIN_HEIGHT 32 +#define HVA_MAX_HEIGHT 1920 + +/* HVA requires a 16x16 pixels alignment for frames */ +#define HVA_WIDTH_ALIGNMENT 16 +#define HVA_HEIGHT_ALIGNMENT 16 + +#define HVA_DEFAULT_WIDTH HVA_MIN_WIDTH +#define HVA_DEFAULT_HEIGHT HVA_MIN_HEIGHT +#define HVA_DEFAULT_FRAME_NUM 1 +#define HVA_DEFAULT_FRAME_DEN 30 + +#define to_type_str(type) (type == V4L2_BUF_TYPE_VIDEO_OUTPUT ? \ + "frame" : "stream") + +#define fh_to_ctx(f) (container_of(f, struct hva_ctx, fh)) + +/* registry of available encoders */ +const struct hva_enc *hva_encoders[] = { +}; + +static inline int frame_size(u32 w, u32 h, u32 fmt) +{ + switch (fmt) { + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + return (w * h * 3) / 2; + default: + return 0; + } +} + +static inline int frame_stride(u32 w, u32 fmt) +{ + switch (fmt) { + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + return w; + default: + return 0; + } +} + +static inline int frame_alignment(u32 fmt) +{ + switch (fmt) { + case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV21: + /* multiple of 2 */ + return 2; + default: + return 1; + } +} + +static inline int estimated_stream_size(u32 w, u32 h) +{ + /* + * HVA only encodes in YUV420 format, whatever the frame format. + * A compression ratio of 2 is assumed: thus, the maximum size + * of a stream is estimated to ((width x height x 3 / 2) / 2) + */ + return (w * h * 3) / 4; +} + +static void set_default_params(struct hva_ctx *ctx) +{ + struct hva_frameinfo *frameinfo = &ctx->frameinfo; + struct hva_streaminfo *streaminfo = &ctx->streaminfo; + + frameinfo->pixelformat = V4L2_PIX_FMT_NV12; + frameinfo->width = HVA_DEFAULT_WIDTH; + frameinfo->height = HVA_DEFAULT_HEIGHT; + frameinfo->aligned_width = ALIGN(frameinfo->width, + HVA_WIDTH_ALIGNMENT); + frameinfo->aligned_height = ALIGN(frameinfo->height, + HVA_HEIGHT_ALIGNMENT); + frameinfo->size = frame_size(frameinfo->aligned_width, + frameinfo->aligned_height, + frameinfo->pixelformat); + + streaminfo->streamformat = V4L2_PIX_FMT_H264; + streaminfo->width = HVA_DEFAULT_WIDTH; + streaminfo->height = HVA_DEFAULT_HEIGHT; + + ctx->colorspace = V4L2_COLORSPACE_REC709; + ctx->xfer_func = V4L2_XFER_FUNC_DEFAULT; + ctx->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + ctx->quantization = V4L2_QUANTIZATION_DEFAULT; + + ctx->max_stream_size = estimated_stream_size(streaminfo->width, + streaminfo->height); +} + +static const struct hva_enc *hva_find_encoder(struct hva_ctx *ctx, + u32 pixelformat, + u32 streamformat) +{ + struct hva_dev *hva = ctx_to_hdev(ctx); + const struct hva_enc *enc; + unsigned int i; + + for (i = 0; i < hva->nb_of_encoders; i++) { + enc = hva->encoders[i]; + if ((enc->pixelformat == pixelformat) && + (enc->streamformat == streamformat)) + return enc; + } + + return NULL; +} + +static void register_format(u32 format, u32 formats[], u32 *nb_of_formats) +{ + u32 i; + bool found = false; + + for (i = 0; i < *nb_of_formats; i++) { + if (format == formats[i]) { + found = true; + break; + } + } + + if (!found) + formats[(*nb_of_formats)++] = format; +} + +static void register_formats(struct hva_dev *hva) +{ + unsigned int i; + + for (i = 0; i < hva->nb_of_encoders; i++) { + register_format(hva->encoders[i]->pixelformat, + hva->pixelformats, + &hva->nb_of_pixelformats); + + register_format(hva->encoders[i]->streamformat, + hva->streamformats, + &hva->nb_of_streamformats); + } +} + +static void register_encoders(struct hva_dev *hva) +{ + struct device *dev = hva_to_dev(hva); + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(hva_encoders); i++) { + if (hva->nb_of_encoders >= HVA_MAX_ENCODERS) { + dev_dbg(dev, + "%s failed to register %s encoder (%d maximum reached)\n", + HVA_PREFIX, hva_encoders[i]->name, + HVA_MAX_ENCODERS); + return; + } + + hva->encoders[hva->nb_of_encoders++] = hva_encoders[i]; + dev_info(dev, "%s %s encoder registered\n", HVA_PREFIX, + hva_encoders[i]->name); + } +} + +static int hva_open_encoder(struct hva_ctx *ctx, u32 streamformat, + u32 pixelformat, struct hva_enc **penc) +{ + struct hva_dev *hva = ctx_to_hdev(ctx); + struct device *dev = ctx_to_dev(ctx); + struct hva_enc *enc; + int ret; + + /* find an encoder which can deal with these formats */ + enc = (struct hva_enc *)hva_find_encoder(ctx, pixelformat, + streamformat); + if (!enc) { + dev_err(dev, "%s no encoder found matching %4.4s => %4.4s\n", + ctx->name, (char *)&pixelformat, (char *)&streamformat); + return -EINVAL; + } + + dev_dbg(dev, "%s one encoder matching %4.4s => %4.4s\n", + ctx->name, (char *)&pixelformat, (char *)&streamformat); + + /* update instance name */ + snprintf(ctx->name, sizeof(ctx->name), "[%3d:%4.4s]", + hva->instance_id, (char *)&streamformat); + + /* open encoder instance */ + ret = enc->open(ctx); + if (ret) { + dev_err(dev, "%s failed to open encoder instance (%d)\n", + ctx->name, ret); + return ret; + } + + dev_dbg(dev, "%s %s encoder opened\n", ctx->name, enc->name); + + *penc = enc; + + return ret; +} + +/* + * V4L2 ioctl operations + */ + +static int hva_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct hva_dev *hva = ctx_to_hdev(ctx); + + strlcpy(cap->driver, HVA_NAME, sizeof(cap->driver)); + strlcpy(cap->card, hva->vdev->name, sizeof(cap->card)); + snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", + hva->pdev->name); + + return 0; +} + +static int hva_enum_fmt_stream(struct file *file, void *priv, + struct v4l2_fmtdesc *f) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct hva_dev *hva = ctx_to_hdev(ctx); + + if (unlikely(f->index >= hva->nb_of_streamformats)) + return -EINVAL; + + f->pixelformat = hva->streamformats[f->index]; + + return 0; +} + +static int hva_enum_fmt_frame(struct file *file, void *priv, + struct v4l2_fmtdesc *f) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct hva_dev *hva = ctx_to_hdev(ctx); + + if (unlikely(f->index >= hva->nb_of_pixelformats)) + return -EINVAL; + + f->pixelformat = hva->pixelformats[f->index]; + + return 0; +} + +static int hva_g_fmt_stream(struct file *file, void *fh, struct v4l2_format *f) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct hva_streaminfo *streaminfo = &ctx->streaminfo; + + f->fmt.pix.width = streaminfo->width; + f->fmt.pix.height = streaminfo->height; + f->fmt.pix.field = V4L2_FIELD_NONE; + f->fmt.pix.colorspace = ctx->colorspace; + f->fmt.pix.xfer_func = ctx->xfer_func; + f->fmt.pix.ycbcr_enc = ctx->ycbcr_enc; + f->fmt.pix.quantization = ctx->quantization; + f->fmt.pix.pixelformat = streaminfo->streamformat; + f->fmt.pix.bytesperline = 0; + f->fmt.pix.sizeimage = ctx->max_stream_size; + + return 0; +} + +static int hva_g_fmt_frame(struct file *file, void *fh, struct v4l2_format *f) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct hva_frameinfo *frameinfo = &ctx->frameinfo; + + f->fmt.pix.width = frameinfo->width; + f->fmt.pix.height = frameinfo->height; + f->fmt.pix.field = V4L2_FIELD_NONE; + f->fmt.pix.colorspace = ctx->colorspace; + f->fmt.pix.xfer_func = ctx->xfer_func; + f->fmt.pix.ycbcr_enc = ctx->ycbcr_enc; + f->fmt.pix.quantization = ctx->quantization; + f->fmt.pix.pixelformat = frameinfo->pixelformat; + f->fmt.pix.bytesperline = frame_stride(frameinfo->aligned_width, + frameinfo->pixelformat); + f->fmt.pix.sizeimage = frameinfo->size; + + return 0; +} + +static int hva_try_fmt_stream(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct device *dev = ctx_to_dev(ctx); + struct v4l2_pix_format *pix = &f->fmt.pix; + u32 streamformat = pix->pixelformat; + const struct hva_enc *enc; + u32 width, height; + u32 stream_size; + + enc = hva_find_encoder(ctx, ctx->frameinfo.pixelformat, streamformat); + if (!enc) { + dev_dbg(dev, + "%s V4L2 TRY_FMT (CAPTURE): unsupported format %.4s\n", + ctx->name, (char *)&pix->pixelformat); + return -EINVAL; + } + + width = pix->width; + height = pix->height; + if (ctx->flags & HVA_FLAG_FRAMEINFO) { + /* + * if the frame resolution is already fixed, only allow the + * same stream resolution + */ + pix->width = ctx->frameinfo.width; + pix->height = ctx->frameinfo.height; + if ((pix->width != width) || (pix->height != height)) + dev_dbg(dev, + "%s V4L2 TRY_FMT (CAPTURE): resolution updated %dx%d -> %dx%d to fit frame resolution\n", + ctx->name, width, height, + pix->width, pix->height); + } else { + /* adjust width & height */ + v4l_bound_align_image(&pix->width, + HVA_MIN_WIDTH, enc->max_width, + 0, + &pix->height, + HVA_MIN_HEIGHT, enc->max_height, + 0, + 0); + + if ((pix->width != width) || (pix->height != height)) + dev_dbg(dev, + "%s V4L2 TRY_FMT (CAPTURE): resolution updated %dx%d -> %dx%d to fit min/max/alignment\n", + ctx->name, width, height, + pix->width, pix->height); + } + + stream_size = estimated_stream_size(pix->width, pix->height); + if (pix->sizeimage < stream_size) + pix->sizeimage = stream_size; + + pix->bytesperline = 0; + pix->colorspace = ctx->colorspace; + pix->xfer_func = ctx->xfer_func; + pix->ycbcr_enc = ctx->ycbcr_enc; + pix->quantization = ctx->quantization; + pix->field = V4L2_FIELD_NONE; + + return 0; +} + +static int hva_try_fmt_frame(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct device *dev = ctx_to_dev(ctx); + struct v4l2_pix_format *pix = &f->fmt.pix; + u32 pixelformat = pix->pixelformat; + const struct hva_enc *enc; + u32 width, height; + + enc = hva_find_encoder(ctx, pixelformat, ctx->streaminfo.streamformat); + if (!enc) { + dev_dbg(dev, + "%s V4L2 TRY_FMT (OUTPUT): unsupported format %.4s\n", + ctx->name, (char *)&pixelformat); + return -EINVAL; + } + + /* adjust width & height */ + width = pix->width; + height = pix->height; + v4l_bound_align_image(&pix->width, + HVA_MIN_WIDTH, HVA_MAX_WIDTH, + frame_alignment(pixelformat) - 1, + &pix->height, + HVA_MIN_HEIGHT, HVA_MAX_HEIGHT, + frame_alignment(pixelformat) - 1, + 0); + + if ((pix->width != width) || (pix->height != height)) + dev_dbg(dev, + "%s V4L2 TRY_FMT (OUTPUT): resolution updated %dx%d -> %dx%d to fit min/max/alignment\n", + ctx->name, width, height, pix->width, pix->height); + + width = ALIGN(pix->width, HVA_WIDTH_ALIGNMENT); + height = ALIGN(pix->height, HVA_HEIGHT_ALIGNMENT); + + if (!pix->colorspace) { + pix->colorspace = V4L2_COLORSPACE_REC709; + pix->xfer_func = V4L2_XFER_FUNC_DEFAULT; + pix->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + pix->quantization = V4L2_QUANTIZATION_DEFAULT; + } + + pix->bytesperline = frame_stride(width, pixelformat); + pix->sizeimage = frame_size(width, height, pixelformat); + pix->field = V4L2_FIELD_NONE; + + return 0; +} + +static int hva_s_fmt_stream(struct file *file, void *fh, struct v4l2_format *f) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct device *dev = ctx_to_dev(ctx); + struct vb2_queue *vq; + int ret; + + ret = hva_try_fmt_stream(file, fh, f); + if (ret) { + dev_dbg(dev, "%s V4L2 S_FMT (CAPTURE): unsupported format %.4s\n", + ctx->name, (char *)&f->fmt.pix.pixelformat); + return ret; + } + + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); + if (vb2_is_streaming(vq)) { + dev_dbg(dev, "%s V4L2 S_FMT (CAPTURE): queue busy\n", + ctx->name); + return -EBUSY; + } + + ctx->max_stream_size = f->fmt.pix.sizeimage; + ctx->streaminfo.width = f->fmt.pix.width; + ctx->streaminfo.height = f->fmt.pix.height; + ctx->streaminfo.streamformat = f->fmt.pix.pixelformat; + ctx->flags |= HVA_FLAG_STREAMINFO; + + return 0; +} + +static int hva_s_fmt_frame(struct file *file, void *fh, struct v4l2_format *f) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct device *dev = ctx_to_dev(ctx); + struct v4l2_pix_format *pix = &f->fmt.pix; + struct vb2_queue *vq; + int ret; + + ret = hva_try_fmt_frame(file, fh, f); + if (ret) { + dev_dbg(dev, "%s V4L2 S_FMT (OUTPUT): unsupported format %.4s\n", + ctx->name, (char *)&pix->pixelformat); + return ret; + } + + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type); + if (vb2_is_streaming(vq)) { + dev_dbg(dev, "%s V4L2 S_FMT (OUTPUT): queue busy\n", ctx->name); + return -EBUSY; + } + + ctx->colorspace = pix->colorspace; + ctx->xfer_func = pix->xfer_func; + ctx->ycbcr_enc = pix->ycbcr_enc; + ctx->quantization = pix->quantization; + + ctx->frameinfo.aligned_width = ALIGN(pix->width, HVA_WIDTH_ALIGNMENT); + ctx->frameinfo.aligned_height = ALIGN(pix->height, + HVA_HEIGHT_ALIGNMENT); + ctx->frameinfo.size = pix->sizeimage; + ctx->frameinfo.pixelformat = pix->pixelformat; + ctx->frameinfo.width = pix->width; + ctx->frameinfo.height = pix->height; + ctx->flags |= HVA_FLAG_FRAMEINFO; + + return 0; +} + +static int hva_g_parm(struct file *file, void *fh, struct v4l2_streamparm *sp) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct v4l2_fract *time_per_frame = &ctx->ctrls.time_per_frame; + + if (sp->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + + sp->parm.output.capability = V4L2_CAP_TIMEPERFRAME; + sp->parm.output.timeperframe.numerator = time_per_frame->numerator; + sp->parm.output.timeperframe.denominator = + time_per_frame->denominator; + + return 0; +} + +static int hva_s_parm(struct file *file, void *fh, struct v4l2_streamparm *sp) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct v4l2_fract *time_per_frame = &ctx->ctrls.time_per_frame; + + if (sp->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) + return -EINVAL; + + if (!sp->parm.output.timeperframe.numerator || + !sp->parm.output.timeperframe.denominator) + return hva_g_parm(file, fh, sp); + + sp->parm.output.capability = V4L2_CAP_TIMEPERFRAME; + time_per_frame->numerator = sp->parm.output.timeperframe.numerator; + time_per_frame->denominator = + sp->parm.output.timeperframe.denominator; + + return 0; +} + +static int hva_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct device *dev = ctx_to_dev(ctx); + + if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { + /* + * depending on the targeted compressed video format, the + * capture buffer might contain headers (e.g. H.264 SPS/PPS) + * filled in by the driver client; the size of these data is + * copied from the bytesused field of the V4L2 buffer in the + * payload field of the hva stream buffer + */ + struct vb2_queue *vq; + struct hva_stream *stream; + + vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, buf->type); + + if (buf->index >= vq->num_buffers) { + dev_dbg(dev, "%s buffer index %d out of range (%d)\n", + ctx->name, buf->index, vq->num_buffers); + return -EINVAL; + } + + stream = (struct hva_stream *)vq->bufs[buf->index]; + stream->bytesused = buf->bytesused; + } + + return v4l2_m2m_qbuf(file, ctx->fh.m2m_ctx, buf); +} + +/* V4L2 ioctl ops */ +static const struct v4l2_ioctl_ops hva_ioctl_ops = { + .vidioc_querycap = hva_querycap, + .vidioc_enum_fmt_vid_cap = hva_enum_fmt_stream, + .vidioc_enum_fmt_vid_out = hva_enum_fmt_frame, + .vidioc_g_fmt_vid_cap = hva_g_fmt_stream, + .vidioc_g_fmt_vid_out = hva_g_fmt_frame, + .vidioc_try_fmt_vid_cap = hva_try_fmt_stream, + .vidioc_try_fmt_vid_out = hva_try_fmt_frame, + .vidioc_s_fmt_vid_cap = hva_s_fmt_stream, + .vidioc_s_fmt_vid_out = hva_s_fmt_frame, + .vidioc_g_parm = hva_g_parm, + .vidioc_s_parm = hva_s_parm, + .vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs, + .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs, + .vidioc_querybuf = v4l2_m2m_ioctl_querybuf, + .vidioc_expbuf = v4l2_m2m_ioctl_expbuf, + .vidioc_qbuf = hva_qbuf, + .vidioc_dqbuf = v4l2_m2m_ioctl_dqbuf, + .vidioc_streamon = v4l2_m2m_ioctl_streamon, + .vidioc_streamoff = v4l2_m2m_ioctl_streamoff, + .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, + .vidioc_unsubscribe_event = v4l2_event_unsubscribe, +}; + +/* + * V4L2 control operations + */ + +static int hva_s_ctrl(struct v4l2_ctrl *ctrl) +{ + struct hva_ctx *ctx = container_of(ctrl->handler, struct hva_ctx, + ctrl_handler); + struct device *dev = ctx_to_dev(ctx); + + dev_dbg(dev, "%s S_CTRL: id = %d, val = %d\n", ctx->name, + ctrl->id, ctrl->val); + + switch (ctrl->id) { + case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: + ctx->ctrls.bitrate_mode = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_GOP_SIZE: + ctx->ctrls.gop_size = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_BITRATE: + ctx->ctrls.bitrate = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_ASPECT: + ctx->ctrls.aspect = ctrl->val; + break; + default: + dev_dbg(dev, "%s S_CTRL: invalid control (id = %d)\n", + ctx->name, ctrl->id); + return -EINVAL; + } + + return 0; +} + +/* V4L2 control ops */ +static const struct v4l2_ctrl_ops hva_ctrl_ops = { + .s_ctrl = hva_s_ctrl, +}; + +static int hva_ctrls_setup(struct hva_ctx *ctx) +{ + struct device *dev = ctx_to_dev(ctx); + u64 mask; + + v4l2_ctrl_handler_init(&ctx->ctrl_handler, 4); + + v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_BITRATE_MODE, + V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, + 0, + V4L2_MPEG_VIDEO_BITRATE_MODE_CBR); + + v4l2_ctrl_new_std(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_GOP_SIZE, + 1, 60, 1, 16); + + v4l2_ctrl_new_std(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_BITRATE, + 1000, 60000000, 1000, 20000000); + + mask = ~(1 << V4L2_MPEG_VIDEO_ASPECT_1x1); + v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_ASPECT, + V4L2_MPEG_VIDEO_ASPECT_1x1, + mask, + V4L2_MPEG_VIDEO_ASPECT_1x1); + + if (ctx->ctrl_handler.error) { + int err = ctx->ctrl_handler.error; + + dev_dbg(dev, "%s controls setup failed (%d)\n", + ctx->name, err); + v4l2_ctrl_handler_free(&ctx->ctrl_handler); + return err; + } + + v4l2_ctrl_handler_setup(&ctx->ctrl_handler); + + /* set default time per frame */ + ctx->ctrls.time_per_frame.numerator = HVA_DEFAULT_FRAME_NUM; + ctx->ctrls.time_per_frame.denominator = HVA_DEFAULT_FRAME_DEN; + + return 0; +} + +/* + * mem-to-mem operations + */ + +static void hva_run_work(struct work_struct *work) +{ + struct hva_ctx *ctx = container_of(work, struct hva_ctx, run_work); + struct vb2_v4l2_buffer *src_buf, *dst_buf; + const struct hva_enc *enc = ctx->enc; + struct hva_frame *frame; + struct hva_stream *stream; + int ret; + + /* protect instance against reentrancy */ + mutex_lock(&ctx->lock); + + src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); + dst_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); + + frame = to_hva_frame(src_buf); + stream = to_hva_stream(dst_buf); + frame->vbuf.sequence = ctx->frame_num++; + + ret = enc->encode(ctx, frame, stream); + + vb2_set_plane_payload(&dst_buf->vb2_buf, 0, stream->bytesused); + if (ret) { + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); + v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR); + } else { + /* propagate frame timestamp */ + dst_buf->vb2_buf.timestamp = src_buf->vb2_buf.timestamp; + dst_buf->field = V4L2_FIELD_NONE; + dst_buf->sequence = ctx->stream_num - 1; + + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); + v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_DONE); + } + + mutex_unlock(&ctx->lock); + + v4l2_m2m_job_finish(ctx->hva_dev->m2m_dev, ctx->fh.m2m_ctx); +} + +static void hva_device_run(void *priv) +{ + struct hva_ctx *ctx = priv; + struct hva_dev *hva = ctx_to_hdev(ctx); + + queue_work(hva->work_queue, &ctx->run_work); +} + +static void hva_job_abort(void *priv) +{ + struct hva_ctx *ctx = priv; + struct device *dev = ctx_to_dev(ctx); + + dev_dbg(dev, "%s aborting job\n", ctx->name); + + ctx->aborting = true; +} + +static int hva_job_ready(void *priv) +{ + struct hva_ctx *ctx = priv; + struct device *dev = ctx_to_dev(ctx); + + if (!v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx)) { + dev_dbg(dev, "%s job not ready: no frame buffers\n", + ctx->name); + return 0; + } + + if (!v4l2_m2m_num_dst_bufs_ready(ctx->fh.m2m_ctx)) { + dev_dbg(dev, "%s job not ready: no stream buffers\n", + ctx->name); + return 0; + } + + if (ctx->aborting) { + dev_dbg(dev, "%s job not ready: aborting\n", ctx->name); + return 0; + } + + return 1; +} + +/* mem-to-mem ops */ +static const struct v4l2_m2m_ops hva_m2m_ops = { + .device_run = hva_device_run, + .job_abort = hva_job_abort, + .job_ready = hva_job_ready, +}; + +/* + * VB2 queue operations + */ + +static int hva_queue_setup(struct vb2_queue *vq, + unsigned int *num_buffers, unsigned int *num_planes, + unsigned int sizes[], struct device *alloc_devs[]) +{ + struct hva_ctx *ctx = vb2_get_drv_priv(vq); + struct device *dev = ctx_to_dev(ctx); + unsigned int size; + + dev_dbg(dev, "%s %s queue setup: num_buffers %d\n", ctx->name, + to_type_str(vq->type), *num_buffers); + + size = vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT ? + ctx->frameinfo.size : ctx->max_stream_size; + + if (*num_planes) + return sizes[0] < size ? -EINVAL : 0; + + /* only one plane supported */ + *num_planes = 1; + sizes[0] = size; + + return 0; +} + +static int hva_buf_prepare(struct vb2_buffer *vb) +{ + struct hva_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); + struct device *dev = ctx_to_dev(ctx); + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + + if (vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { + struct hva_frame *frame = to_hva_frame(vbuf); + + if (vbuf->field == V4L2_FIELD_ANY) + vbuf->field = V4L2_FIELD_NONE; + if (vbuf->field != V4L2_FIELD_NONE) { + dev_dbg(dev, + "%s frame[%d] prepare: %d field not supported\n", + ctx->name, vb->index, vbuf->field); + return -EINVAL; + } + + if (!frame->prepared) { + /* get memory addresses */ + frame->vaddr = vb2_plane_vaddr(&vbuf->vb2_buf, 0); + frame->paddr = vb2_dma_contig_plane_dma_addr( + &vbuf->vb2_buf, 0); + frame->info = ctx->frameinfo; + frame->prepared = true; + + dev_dbg(dev, + "%s frame[%d] prepared; virt=%p, phy=%pad\n", + ctx->name, vb->index, + frame->vaddr, &frame->paddr); + } + } else { + struct hva_stream *stream = to_hva_stream(vbuf); + + if (!stream->prepared) { + /* get memory addresses */ + stream->vaddr = vb2_plane_vaddr(&vbuf->vb2_buf, 0); + stream->paddr = vb2_dma_contig_plane_dma_addr( + &vbuf->vb2_buf, 0); + stream->size = vb2_plane_size(&vbuf->vb2_buf, 0); + stream->prepared = true; + + dev_dbg(dev, + "%s stream[%d] prepared; virt=%p, phy=%pad\n", + ctx->name, vb->index, + stream->vaddr, &stream->paddr); + } + } + + return 0; +} + +static void hva_buf_queue(struct vb2_buffer *vb) +{ + struct hva_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + + if (ctx->fh.m2m_ctx) + v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); +} + +static int hva_start_streaming(struct vb2_queue *vq, unsigned int count) +{ + struct hva_ctx *ctx = vb2_get_drv_priv(vq); + struct hva_dev *hva = ctx_to_hdev(ctx); + struct device *dev = ctx_to_dev(ctx); + struct vb2_v4l2_buffer *vbuf; + int ret; + unsigned int i; + bool found = false; + + dev_dbg(dev, "%s %s start streaming\n", ctx->name, + to_type_str(vq->type)); + + /* open encoder when both start_streaming have been called */ + if (V4L2_TYPE_IS_OUTPUT(vq->type)) { + if (!vb2_start_streaming_called(&ctx->fh.m2m_ctx->cap_q_ctx.q)) + return 0; + } else { + if (!vb2_start_streaming_called(&ctx->fh.m2m_ctx->out_q_ctx.q)) + return 0; + } + + /* store the instance context in the instances array */ + for (i = 0; i < HVA_MAX_INSTANCES; i++) { + if (!hva->instances[i]) { + hva->instances[i] = ctx; + /* save the context identifier in the context */ + ctx->id = i; + found = true; + break; + } + } + + if (!found) { + dev_err(dev, "%s maximum instances reached\n", ctx->name); + ret = -ENOMEM; + goto err; + } + + hva->nb_of_instances++; + + if (!ctx->enc) { + ret = hva_open_encoder(ctx, + ctx->streaminfo.streamformat, + ctx->frameinfo.pixelformat, + &ctx->enc); + if (ret < 0) + goto err_ctx; + } + + return 0; + +err_ctx: + hva->instances[ctx->id] = NULL; + hva->nb_of_instances--; +err: + if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { + /* return of all pending buffers to vb2 (in queued state) */ + while ((vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx))) + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_QUEUED); + } else { + /* return of all pending buffers to vb2 (in queued state) */ + while ((vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx))) + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_QUEUED); + } + + return ret; +} + +static void hva_stop_streaming(struct vb2_queue *vq) +{ + struct hva_ctx *ctx = vb2_get_drv_priv(vq); + struct hva_dev *hva = ctx_to_hdev(ctx); + struct device *dev = ctx_to_dev(ctx); + const struct hva_enc *enc = ctx->enc; + struct vb2_v4l2_buffer *vbuf; + + dev_dbg(dev, "%s %s stop streaming\n", ctx->name, + to_type_str(vq->type)); + + if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { + /* return of all pending buffers to vb2 (in error state) */ + ctx->frame_num = 0; + while ((vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx))) + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); + } else { + /* return of all pending buffers to vb2 (in error state) */ + ctx->stream_num = 0; + while ((vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx))) + v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); + } + + if ((V4L2_TYPE_IS_OUTPUT(vq->type) && + vb2_is_streaming(&ctx->fh.m2m_ctx->cap_q_ctx.q)) || + (!V4L2_TYPE_IS_OUTPUT(vq->type) && + vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q))) { + dev_dbg(dev, "%s %s out=%d cap=%d\n", + ctx->name, to_type_str(vq->type), + vb2_is_streaming(&ctx->fh.m2m_ctx->out_q_ctx.q), + vb2_is_streaming(&ctx->fh.m2m_ctx->cap_q_ctx.q)); + return; + } + + /* close encoder when both stop_streaming have been called */ + if (enc) { + dev_dbg(dev, "%s %s encoder closed\n", ctx->name, enc->name); + enc->close(ctx); + ctx->enc = NULL; + + /* clear instance context in instances array */ + hva->instances[ctx->id] = NULL; + hva->nb_of_instances--; + } + + ctx->aborting = false; +} + +/* VB2 queue ops */ +static const struct vb2_ops hva_qops = { + .queue_setup = hva_queue_setup, + .buf_prepare = hva_buf_prepare, + .buf_queue = hva_buf_queue, + .start_streaming = hva_start_streaming, + .stop_streaming = hva_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, +}; + +/* + * V4L2 file operations + */ + +static int queue_init(struct hva_ctx *ctx, struct vb2_queue *vq) +{ + vq->io_modes = VB2_MMAP | VB2_DMABUF; + vq->drv_priv = ctx; + vq->ops = &hva_qops; + vq->mem_ops = &vb2_dma_contig_memops; + vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; + vq->lock = &ctx->hva_dev->lock; + + return vb2_queue_init(vq); +} + +static int hva_queue_init(void *priv, struct vb2_queue *src_vq, + struct vb2_queue *dst_vq) +{ + struct hva_ctx *ctx = priv; + int ret; + + src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + src_vq->buf_struct_size = sizeof(struct hva_frame); + src_vq->min_buffers_needed = MIN_FRAMES; + src_vq->dev = ctx->hva_dev->dev; + + ret = queue_init(ctx, src_vq); + if (ret) + return ret; + + dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + dst_vq->buf_struct_size = sizeof(struct hva_stream); + dst_vq->min_buffers_needed = MIN_STREAMS; + dst_vq->dev = ctx->hva_dev->dev; + + return queue_init(ctx, dst_vq); +} + +static int hva_open(struct file *file) +{ + struct hva_dev *hva = video_drvdata(file); + struct device *dev = hva_to_dev(hva); + struct hva_ctx *ctx; + int ret; + + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + if (!ctx) { + ret = -ENOMEM; + goto out; + } + ctx->hva_dev = hva; + + INIT_WORK(&ctx->run_work, hva_run_work); + v4l2_fh_init(&ctx->fh, video_devdata(file)); + file->private_data = &ctx->fh; + v4l2_fh_add(&ctx->fh); + + ret = hva_ctrls_setup(ctx); + if (ret) { + dev_err(dev, "%s [x:x] failed to setup controls\n", + HVA_PREFIX); + goto err_fh; + } + ctx->fh.ctrl_handler = &ctx->ctrl_handler; + + mutex_init(&ctx->lock); + + ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(hva->m2m_dev, ctx, + &hva_queue_init); + if (IS_ERR(ctx->fh.m2m_ctx)) { + ret = PTR_ERR(ctx->fh.m2m_ctx); + dev_err(dev, "%s failed to initialize m2m context (%d)\n", + HVA_PREFIX, ret); + goto err_ctrls; + } + + /* set the instance name */ + mutex_lock(&hva->lock); + hva->instance_id++; + snprintf(ctx->name, sizeof(ctx->name), "[%3d:----]", + hva->instance_id); + mutex_unlock(&hva->lock); + + /* default parameters for frame and stream */ + set_default_params(ctx); + + dev_info(dev, "%s encoder instance created\n", ctx->name); + + return 0; + +err_ctrls: + v4l2_ctrl_handler_free(&ctx->ctrl_handler); +err_fh: + v4l2_fh_del(&ctx->fh); + v4l2_fh_exit(&ctx->fh); + kfree(ctx); +out: + return ret; +} + +static int hva_release(struct file *file) +{ + struct hva_ctx *ctx = fh_to_ctx(file->private_data); + struct hva_dev *hva = ctx_to_hdev(ctx); + struct device *dev = ctx_to_dev(ctx); + const struct hva_enc *enc = ctx->enc; + + if (enc) { + dev_dbg(dev, "%s %s encoder closed\n", ctx->name, enc->name); + enc->close(ctx); + ctx->enc = NULL; + + /* clear instance context in instances array */ + hva->instances[ctx->id] = NULL; + hva->nb_of_instances--; + } + + v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); + + v4l2_ctrl_handler_free(&ctx->ctrl_handler); + + v4l2_fh_del(&ctx->fh); + v4l2_fh_exit(&ctx->fh); + + dev_info(dev, "%s encoder instance released\n", ctx->name); + + kfree(ctx); + + return 0; +} + +/* V4L2 file ops */ +static const struct v4l2_file_operations hva_fops = { + .owner = THIS_MODULE, + .open = hva_open, + .release = hva_release, + .unlocked_ioctl = video_ioctl2, + .mmap = v4l2_m2m_fop_mmap, + .poll = v4l2_m2m_fop_poll, +}; + +/* + * Platform device operations + */ + +static int hva_register_device(struct hva_dev *hva) +{ + int ret; + struct video_device *vdev; + struct device *dev; + + if (!hva) + return -ENODEV; + dev = hva_to_dev(hva); + + hva->m2m_dev = v4l2_m2m_init(&hva_m2m_ops); + if (IS_ERR(hva->m2m_dev)) { + dev_err(dev, "%s failed to initialize v4l2-m2m device\n", + HVA_PREFIX); + ret = PTR_ERR(hva->m2m_dev); + goto err; + } + + vdev = video_device_alloc(); + if (!vdev) { + dev_err(dev, "%s failed to allocate video device\n", + HVA_PREFIX); + ret = -ENOMEM; + goto err_m2m_release; + } + + vdev->fops = &hva_fops; + vdev->ioctl_ops = &hva_ioctl_ops; + vdev->release = video_device_release; + vdev->lock = &hva->lock; + vdev->vfl_dir = VFL_DIR_M2M; + vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M; + vdev->v4l2_dev = &hva->v4l2_dev; + snprintf(vdev->name, sizeof(vdev->name), "%s%lx", HVA_NAME, + hva->ip_version); + + ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); + if (ret) { + dev_err(dev, "%s failed to register video device\n", + HVA_PREFIX); + goto err_vdev_release; + } + + hva->vdev = vdev; + video_set_drvdata(vdev, hva); + return 0; + +err_vdev_release: + video_device_release(vdev); +err_m2m_release: + v4l2_m2m_release(hva->m2m_dev); +err: + return ret; +} + +static void hva_unregister_device(struct hva_dev *hva) +{ + if (!hva) + return; + + if (hva->m2m_dev) + v4l2_m2m_release(hva->m2m_dev); + + video_unregister_device(hva->vdev); +} + +static int hva_probe(struct platform_device *pdev) +{ + struct hva_dev *hva; + struct device *dev = &pdev->dev; + int ret; + + hva = devm_kzalloc(dev, sizeof(*hva), GFP_KERNEL); + if (!hva) { + ret = -ENOMEM; + goto err; + } + + hva->dev = dev; + hva->pdev = pdev; + platform_set_drvdata(pdev, hva); + + mutex_init(&hva->lock); + + /* probe hardware */ + ret = hva_hw_probe(pdev, hva); + if (ret) + goto err; + + /* register all available encoders */ + register_encoders(hva); + + /* register all supported formats */ + register_formats(hva); + + /* register on V4L2 */ + ret = v4l2_device_register(dev, &hva->v4l2_dev); + if (ret) { + dev_err(dev, "%s %s failed to register V4L2 device\n", + HVA_PREFIX, HVA_NAME); + goto err_hw; + } + + hva->work_queue = create_workqueue(HVA_NAME); + if (!hva->work_queue) { + dev_err(dev, "%s %s failed to allocate work queue\n", + HVA_PREFIX, HVA_NAME); + ret = -ENOMEM; + goto err_v4l2; + } + + /* register device */ + ret = hva_register_device(hva); + if (ret) + goto err_work_queue; + + dev_info(dev, "%s %s registered as /dev/video%d\n", HVA_PREFIX, + HVA_NAME, hva->vdev->num); + + return 0; + +err_work_queue: + destroy_workqueue(hva->work_queue); +err_v4l2: + v4l2_device_unregister(&hva->v4l2_dev); +err_hw: + hva_hw_remove(hva); +err: + return ret; +} + +static int hva_remove(struct platform_device *pdev) +{ + struct hva_dev *hva = platform_get_drvdata(pdev); + struct device *dev = hva_to_dev(hva); + + hva_unregister_device(hva); + + destroy_workqueue(hva->work_queue); + + hva_hw_remove(hva); + + v4l2_device_unregister(&hva->v4l2_dev); + + dev_info(dev, "%s %s removed\n", HVA_PREFIX, pdev->name); + + return 0; +} + +/* PM ops */ +static const struct dev_pm_ops hva_pm_ops = { + .runtime_suspend = hva_hw_runtime_suspend, + .runtime_resume = hva_hw_runtime_resume, +}; + +static const struct of_device_id hva_match_types[] = { + { + .compatible = "st,st-hva", + }, + { /* end node */ } +}; + +MODULE_DEVICE_TABLE(of, hva_match_types); + +struct platform_driver hva_driver = { + .probe = hva_probe, + .remove = hva_remove, + .driver = { + .name = HVA_NAME, + .of_match_table = hva_match_types, + .pm = &hva_pm_ops, + }, +}; + +module_platform_driver(hva_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Yannick Fertre "); +MODULE_DESCRIPTION("STMicroelectronics HVA video encoder V4L2 driver"); diff --git a/drivers/media/platform/sti/hva/hva.h b/drivers/media/platform/sti/hva/hva.h new file mode 100644 index 000000000000..b62fda00dc15 --- /dev/null +++ b/drivers/media/platform/sti/hva/hva.h @@ -0,0 +1,290 @@ +/* + * Copyright (C) STMicroelectronics SA 2015 + * Authors: Yannick Fertre + * Hugues Fruchet + * License terms: GNU General Public License (GPL), version 2 + */ + +#ifndef HVA_H +#define HVA_H + +#include +#include +#include +#include + +#define fh_to_ctx(f) (container_of(f, struct hva_ctx, fh)) + +#define hva_to_dev(h) (h->dev) + +#define ctx_to_dev(c) (c->hva_dev->dev) + +#define ctx_to_hdev(c) (c->hva_dev) + +#define HVA_PREFIX "[---:----]" + +/** + * struct hva_frameinfo - information about hva frame + * + * @pixelformat: fourcc code for uncompressed video format + * @width: width of frame + * @height: height of frame + * @aligned_width: width of frame (with encoder alignment constraint) + * @aligned_height: height of frame (with encoder alignment constraint) + * @size: maximum size in bytes required for data +*/ +struct hva_frameinfo { + u32 pixelformat; + u32 width; + u32 height; + u32 aligned_width; + u32 aligned_height; + u32 size; +}; + +/** + * struct hva_streaminfo - information about hva stream + * + * @streamformat: fourcc code of compressed video format (H.264...) + * @width: width of stream + * @height: height of stream + * @profile: profile string + * @level: level string + */ +struct hva_streaminfo { + u32 streamformat; + u32 width; + u32 height; + u8 profile[32]; + u8 level[32]; +}; + +/** + * struct hva_controls - hva controls set + * + * @time_per_frame: time per frame in seconds + * @bitrate_mode: bitrate mode (constant bitrate or variable bitrate) + * @gop_size: groupe of picture size + * @bitrate: bitrate (in bps) + * @aspect: video aspect + */ +struct hva_controls { + struct v4l2_fract time_per_frame; + enum v4l2_mpeg_video_bitrate_mode bitrate_mode; + u32 gop_size; + u32 bitrate; + enum v4l2_mpeg_video_aspect aspect; +}; + +/** + * struct hva_frame - hva frame buffer (output) + * + * @vbuf: video buffer information for V4L2 + * @list: V4L2 m2m list that the frame belongs to + * @info: frame information (width, height, format, alignment...) + * @paddr: physical address (for hardware) + * @vaddr: virtual address (kernel can read/write) + * @prepared: true if vaddr/paddr are resolved + */ +struct hva_frame { + struct vb2_v4l2_buffer vbuf; + struct list_head list; + struct hva_frameinfo info; + dma_addr_t paddr; + void *vaddr; + bool prepared; +}; + +/* + * to_hva_frame() - cast struct vb2_v4l2_buffer * to struct hva_frame * + */ +#define to_hva_frame(vb) \ + container_of(vb, struct hva_frame, vbuf) + +/** + * struct hva_stream - hva stream buffer (capture) + * + * @v4l2: video buffer information for V4L2 + * @list: V4L2 m2m list that the frame belongs to + * @paddr: physical address (for hardware) + * @vaddr: virtual address (kernel can read/write) + * @prepared: true if vaddr/paddr are resolved + * @size: size of the buffer in bytes + * @bytesused: number of bytes occupied by data in the buffer + */ +struct hva_stream { + struct vb2_v4l2_buffer vbuf; + struct list_head list; + dma_addr_t paddr; + void *vaddr; + bool prepared; + unsigned int size; + unsigned int bytesused; +}; + +/* + * to_hva_stream() - cast struct vb2_v4l2_buffer * to struct hva_stream * + */ +#define to_hva_stream(vb) \ + container_of(vb, struct hva_stream, vbuf) + +struct hva_dev; +struct hva_enc; + +/** + * struct hva_ctx - context of hva instance + * + * @hva_dev: the device that this instance is associated with + * @fh: V4L2 file handle + * @ctrl_handler: V4L2 controls handler + * @ctrls: hva controls set + * @id: instance identifier + * @aborting: true if current job aborted + * @name: instance name (debug purpose) + * @run_work: encode work + * @lock: mutex used to lock access of this context + * @flags: validity of streaminfo and frameinfo fields + * @frame_num: frame number + * @stream_num: stream number + * @max_stream_size: maximum size in bytes required for stream data + * @colorspace: colorspace identifier + * @xfer_func: transfer function identifier + * @ycbcr_enc: Y'CbCr encoding identifier + * @quantization: quantization identifier + * @streaminfo: stream properties + * @frameinfo: frame properties + * @enc: current encoder + * @priv: private codec data for this instance, allocated + * by encoder @open time + * @hw_err: true if hardware error detected + */ +struct hva_ctx { + struct hva_dev *hva_dev; + struct v4l2_fh fh; + struct v4l2_ctrl_handler ctrl_handler; + struct hva_controls ctrls; + u8 id; + bool aborting; + char name[100]; + struct work_struct run_work; + /* mutex protecting this data structure */ + struct mutex lock; + u32 flags; + u32 frame_num; + u32 stream_num; + u32 max_stream_size; + enum v4l2_colorspace colorspace; + enum v4l2_xfer_func xfer_func; + enum v4l2_ycbcr_encoding ycbcr_enc; + enum v4l2_quantization quantization; + struct hva_streaminfo streaminfo; + struct hva_frameinfo frameinfo; + struct hva_enc *enc; + void *priv; + bool hw_err; +}; + +#define HVA_FLAG_STREAMINFO 0x0001 +#define HVA_FLAG_FRAMEINFO 0x0002 + +#define HVA_MAX_INSTANCES 16 +#define HVA_MAX_ENCODERS 10 +#define HVA_MAX_FORMATS HVA_MAX_ENCODERS + +/** + * struct hva_dev - abstraction for hva entity + * + * @v4l2_dev: V4L2 device + * @vdev: video device + * @pdev: platform device + * @dev: device + * @lock: mutex used for critical sections & V4L2 ops + * serialization + * @m2m_dev: memory-to-memory V4L2 device information + * @instances: opened instances + * @nb_of_instances: number of opened instances + * @instance_id: rolling counter identifying an instance (debug purpose) + * @regs: register io memory access + * @esram_addr: esram address + * @esram_size: esram size + * @clk: hva clock + * @irq_its: status interruption + * @irq_err: error interruption + * @work_queue: work queue to handle the encode jobs + * @protect_mutex: mutex used to lock access of hardware + * @interrupt: completion interrupt + * @ip_version: IP hardware version + * @encoders: registered encoders + * @nb_of_encoders: number of registered encoders + * @pixelformats: supported uncompressed video formats + * @nb_of_pixelformats: number of supported umcompressed video formats + * @streamformats: supported compressed video formats + * @nb_of_streamformats: number of supported compressed video formats + * @sfl_reg: status fifo level register value + * @sts_reg: status register value + * @lmi_err_reg: local memory interface error register value + * @emi_err_reg: external memory interface error register value + * @hec_mif_err_reg: HEC memory interface error register value + */ +struct hva_dev { + struct v4l2_device v4l2_dev; + struct video_device *vdev; + struct platform_device *pdev; + struct device *dev; + /* mutex protecting vb2_queue structure */ + struct mutex lock; + struct v4l2_m2m_dev *m2m_dev; + struct hva_ctx *instances[HVA_MAX_INSTANCES]; + unsigned int nb_of_instances; + unsigned int instance_id; + void __iomem *regs; + u32 esram_addr; + u32 esram_size; + struct clk *clk; + int irq_its; + int irq_err; + struct workqueue_struct *work_queue; + /* mutex protecting hardware access */ + struct mutex protect_mutex; + struct completion interrupt; + unsigned long int ip_version; + const struct hva_enc *encoders[HVA_MAX_ENCODERS]; + u32 nb_of_encoders; + u32 pixelformats[HVA_MAX_FORMATS]; + u32 nb_of_pixelformats; + u32 streamformats[HVA_MAX_FORMATS]; + u32 nb_of_streamformats; + u32 sfl_reg; + u32 sts_reg; + u32 lmi_err_reg; + u32 emi_err_reg; + u32 hec_mif_err_reg; +}; + +/** + * struct hva_enc - hva encoder + * + * @name: encoder name + * @streamformat: fourcc code for compressed video format (H.264...) + * @pixelformat: fourcc code for uncompressed video format + * @max_width: maximum width of frame for this encoder + * @max_height: maximum height of frame for this encoder + * @open: open encoder + * @close: close encoder + * @encode: encode a frame (struct hva_frame) in a stream + * (struct hva_stream) + */ + +struct hva_enc { + const char *name; + u32 streamformat; + u32 pixelformat; + u32 max_width; + u32 max_height; + int (*open)(struct hva_ctx *ctx); + int (*close)(struct hva_ctx *ctx); + int (*encode)(struct hva_ctx *ctx, struct hva_frame *frame, + struct hva_stream *stream); +}; + +#endif /* HVA_H */ From ba4616b7d9b9324021985fc5ecd9a9acd2f1f0f2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Trotin Date: Mon, 5 Sep 2016 11:06:30 -0300 Subject: [PATCH 363/591] [media] st-hva: add H.264 video encoding support This patch adds the H.264 video encoding capability in the V4L2 HVA video encoder driver for STMicroelectronics SoC (hva-h264.c). The main supported features are: - profile: baseline, main, high, stereo high - level: up to 4.2 - bitrate mode: CBR, VBR - entropy mode: CABAC, CAVLC - video aspect: 1x1 only Signed-off-by: Yannick Fertre Signed-off-by: Jean-Christophe Trotin Acked-by: Peter Griffin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/sti/hva/Makefile | 2 +- drivers/media/platform/sti/hva/hva-h264.c | 1050 +++++++++++++++++++++ drivers/media/platform/sti/hva/hva-v4l2.c | 109 ++- drivers/media/platform/sti/hva/hva.h | 35 +- 4 files changed, 1189 insertions(+), 7 deletions(-) create mode 100644 drivers/media/platform/sti/hva/hva-h264.c diff --git a/drivers/media/platform/sti/hva/Makefile b/drivers/media/platform/sti/hva/Makefile index 633ee408c34b..ffb69cebaef3 100644 --- a/drivers/media/platform/sti/hva/Makefile +++ b/drivers/media/platform/sti/hva/Makefile @@ -1,2 +1,2 @@ obj-$(CONFIG_VIDEO_STI_HVA) := st-hva.o -st-hva-y := hva-v4l2.o hva-hw.o hva-mem.o +st-hva-y := hva-v4l2.o hva-hw.o hva-mem.o hva-h264.o diff --git a/drivers/media/platform/sti/hva/hva-h264.c b/drivers/media/platform/sti/hva/hva-h264.c new file mode 100644 index 000000000000..8cc8467c0cd3 --- /dev/null +++ b/drivers/media/platform/sti/hva/hva-h264.c @@ -0,0 +1,1050 @@ +/* + * Copyright (C) STMicroelectronics SA 2015 + * Authors: Yannick Fertre + * Hugues Fruchet + * License terms: GNU General Public License (GPL), version 2 + */ + +#include "hva.h" +#include "hva-hw.h" + +#define MAX_SPS_PPS_SIZE 128 + +#define BITSTREAM_OFFSET_MASK 0x7F + +/* video max size*/ +#define H264_MAX_SIZE_W 1920 +#define H264_MAX_SIZE_H 1920 + +/* macroBlocs number (width & height) */ +#define MB_W(w) ((w + 0xF) / 0x10) +#define MB_H(h) ((h + 0xF) / 0x10) + +/* formula to get temporal or spatial data size */ +#define DATA_SIZE(w, h) (MB_W(w) * MB_H(h) * 16) + +#define SEARCH_WINDOW_BUFFER_MAX_SIZE(w) ((4 * MB_W(w) + 42) * 256 * 3 / 2) +#define CABAC_CONTEXT_BUFFER_MAX_SIZE(w) (MB_W(w) * 16) +#define CTX_MB_BUFFER_MAX_SIZE(w) (MB_W(w) * 16 * 8) +#define SLICE_HEADER_SIZE (4 * 16) +#define BRC_DATA_SIZE (5 * 16) + +/* source buffer copy in YUV 420 MB-tiled format with size=16*256*3/2 */ +#define CURRENT_WINDOW_BUFFER_MAX_SIZE (16 * 256 * 3 / 2) + +/* + * 4 lines of pixels (in Luma, Chroma blue and Chroma red) of top MB + * for deblocking with size=4*16*MBx*2 + */ +#define LOCAL_RECONSTRUCTED_BUFFER_MAX_SIZE(w) (4 * 16 * MB_W(w) * 2) + +/* factor for bitrate and cpb buffer size max values if profile >= high */ +#define H264_FACTOR_HIGH 1200 + +/* factor for bitrate and cpb buffer size max values if profile < high */ +#define H264_FACTOR_BASELINE 1000 + +/* number of bytes for NALU_TYPE_FILLER_DATA header and footer */ +#define H264_FILLER_DATA_SIZE 6 + +struct h264_profile { + enum v4l2_mpeg_video_h264_level level; + u32 max_mb_per_seconds; + u32 max_frame_size; + u32 max_bitrate; + u32 max_cpb_size; + u32 min_comp_ratio; +}; + +static const struct h264_profile h264_infos_list[] = { + {V4L2_MPEG_VIDEO_H264_LEVEL_1_0, 1485, 99, 64, 175, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_1B, 1485, 99, 128, 350, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_1_1, 3000, 396, 192, 500, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_1_2, 6000, 396, 384, 1000, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_1_3, 11880, 396, 768, 2000, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_2_0, 11880, 396, 2000, 2000, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_2_1, 19800, 792, 4000, 4000, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_2_2, 20250, 1620, 4000, 4000, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_3_0, 40500, 1620, 10000, 10000, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_3_1, 108000, 3600, 14000, 14000, 4}, + {V4L2_MPEG_VIDEO_H264_LEVEL_3_2, 216000, 5120, 20000, 20000, 4}, + {V4L2_MPEG_VIDEO_H264_LEVEL_4_0, 245760, 8192, 20000, 25000, 4}, + {V4L2_MPEG_VIDEO_H264_LEVEL_4_1, 245760, 8192, 50000, 62500, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_4_2, 522240, 8704, 50000, 62500, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_5_0, 589824, 22080, 135000, 135000, 2}, + {V4L2_MPEG_VIDEO_H264_LEVEL_5_1, 983040, 36864, 240000, 240000, 2} +}; + +enum hva_brc_type { + BRC_TYPE_NONE = 0, + BRC_TYPE_CBR = 1, + BRC_TYPE_VBR = 2, + BRC_TYPE_VBR_LOW_DELAY = 3 +}; + +enum hva_entropy_coding_mode { + CAVLC = 0, + CABAC = 1 +}; + +enum hva_picture_coding_type { + PICTURE_CODING_TYPE_I = 0, + PICTURE_CODING_TYPE_P = 1, + PICTURE_CODING_TYPE_B = 2 +}; + +enum hva_h264_sampling_mode { + SAMPLING_MODE_NV12 = 0, + SAMPLING_MODE_UYVY = 1, + SAMPLING_MODE_RGB3 = 3, + SAMPLING_MODE_XRGB4 = 4, + SAMPLING_MODE_NV21 = 8, + SAMPLING_MODE_VYUY = 9, + SAMPLING_MODE_BGR3 = 11, + SAMPLING_MODE_XBGR4 = 12, + SAMPLING_MODE_RGBX4 = 20, + SAMPLING_MODE_BGRX4 = 28 +}; + +enum hva_h264_nalu_type { + NALU_TYPE_UNKNOWN = 0, + NALU_TYPE_SLICE = 1, + NALU_TYPE_SLICE_DPA = 2, + NALU_TYPE_SLICE_DPB = 3, + NALU_TYPE_SLICE_DPC = 4, + NALU_TYPE_SLICE_IDR = 5, + NALU_TYPE_SEI = 6, + NALU_TYPE_SPS = 7, + NALU_TYPE_PPS = 8, + NALU_TYPE_AU_DELIMITER = 9, + NALU_TYPE_SEQ_END = 10, + NALU_TYPE_STREAM_END = 11, + NALU_TYPE_FILLER_DATA = 12, + NALU_TYPE_SPS_EXT = 13, + NALU_TYPE_PREFIX_UNIT = 14, + NALU_TYPE_SUBSET_SPS = 15, + NALU_TYPE_SLICE_AUX = 19, + NALU_TYPE_SLICE_EXT = 20 +}; + +enum hva_h264_sei_payload_type { + SEI_BUFFERING_PERIOD = 0, + SEI_PICTURE_TIMING = 1, + SEI_STEREO_VIDEO_INFO = 21, + SEI_FRAME_PACKING_ARRANGEMENT = 45 +}; + +/** + * stereo Video Info struct + */ +struct hva_h264_stereo_video_sei { + u8 field_views_flag; + u8 top_field_is_left_view_flag; + u8 current_frame_is_left_view_flag; + u8 next_frame_is_second_view_flag; + u8 left_view_self_contained_flag; + u8 right_view_self_contained_flag; +}; + +/** + * @frame_width: width in pixels of the buffer containing the input frame + * @frame_height: height in pixels of the buffer containing the input frame + * @frame_num: the parameter to be written in the slice header + * @picture_coding_type: type I, P or B + * @pic_order_cnt_type: POC mode, as defined in H264 std : can be 0,1,2 + * @first_picture_in_sequence: flag telling to encoder that this is the + * first picture in a video sequence. + * Used for VBR + * @slice_size_type: 0 = no constraint to close the slice + * 1= a slice is closed as soon as the slice_mb_size limit + * is reached + * 2= a slice is closed as soon as the slice_byte_size limit + * is reached + * 3= a slice is closed as soon as either the slice_byte_size + * limit or the slice_mb_size limit is reached + * @slice_mb_size: defines the slice size in number of macroblocks + * (used when slice_size_type=1 or slice_size_type=3) + * @ir_param_option: defines the number of macroblocks per frame to be + * refreshed by AIR algorithm OR the refresh period + * by CIR algorithm + * @intra_refresh_type: enables the adaptive intra refresh algorithm. + * Disable=0 / Adaptative=1 and Cycle=2 as intra refresh + * @use_constrained_intra_flag: constrained_intra_pred_flag from PPS + * @transform_mode: controls the use of 4x4/8x8 transform mode + * @disable_deblocking_filter_idc: + * 0: specifies that all luma and chroma block edges of + * the slice are filtered. + * 1: specifies that deblocking is disabled for all block + * edges of the slice. + * 2: specifies that all luma and chroma block edges of + * the slice are filtered with exception of the block edges + * that coincide with slice boundaries + * @slice_alpha_c0_offset_div2: to be written in slice header, + * controls deblocking + * @slice_beta_offset_div2: to be written in slice header, + * controls deblocking + * @encoder_complexity: encoder complexity control (IME). + * 0 = I_16x16, P_16x16, Full ME Complexity + * 1 = I_16x16, I_NxN, P_16x16, Full ME Complexity + * 2 = I_16x16, I_NXN, P_16x16, P_WxH, Full ME Complexity + * 4 = I_16x16, P_16x16, Reduced ME Complexity + * 5 = I_16x16, I_NxN, P_16x16, Reduced ME Complexity + * 6 = I_16x16, I_NXN, P_16x16, P_WxH, Reduced ME Complexity + * @chroma_qp_index_offset: coming from picture parameter set + * (PPS see [H.264 STD] 7.4.2.2) + * @entropy_coding_mode: entropy coding mode. + * 0 = CAVLC + * 1 = CABAC + * @brc_type: selects the bit-rate control algorithm + * 0 = constant Qp, (no BRC) + * 1 = CBR + * 2 = VBR + * @quant: Quantization param used in case of fix QP encoding (no BRC) + * @non_VCL_NALU_Size: size of non-VCL NALUs (SPS, PPS, filler), + * used by BRC + * @cpb_buffer_size: size of Coded Picture Buffer, used by BRC + * @bit_rate: target bitrate, for BRC + * @qp_min: min QP threshold + * @qp_max: max QP threshold + * @framerate_num: target framerate numerator , used by BRC + * @framerate_den: target framerate denomurator , used by BRC + * @delay: End-to-End Initial Delay + * @strict_HRD_compliancy: flag for HDR compliancy (1) + * May impact quality encoding + * @addr_source_buffer: address of input frame buffer for current frame + * @addr_fwd_Ref_Buffer: address of reference frame buffer + * @addr_rec_buffer: address of reconstructed frame buffer + * @addr_output_bitstream_start: output bitstream start address + * @addr_output_bitstream_end: output bitstream end address + * @addr_external_sw : address of external search window + * @addr_lctx : address of context picture buffer + * @addr_local_rec_buffer: address of local reconstructed buffer + * @addr_spatial_context: address of spatial context buffer + * @bitstream_offset: offset in bits between aligned bitstream start + * address and first bit to be written by HVA. + * Range value is [0..63] + * @sampling_mode: Input picture format . + * 0: YUV420 semi_planar Interleaved + * 1: YUV422 raster Interleaved + * @addr_param_out: address of output parameters structure + * @addr_scaling_matrix: address to the coefficient of + * the inverse scaling matrix + * @addr_scaling_matrix_dir: address to the coefficient of + * the direct scaling matrix + * @addr_cabac_context_buffer: address of cabac context buffer + * @GmvX: Input information about the horizontal global displacement of + * the encoded frame versus the previous one + * @GmvY: Input information about the vertical global displacement of + * the encoded frame versus the previous one + * @window_width: width in pixels of the window to be encoded inside + * the input frame + * @window_height: width in pixels of the window to be encoded inside + * the input frame + * @window_horizontal_offset: horizontal offset in pels for input window + * within input frame + * @window_vertical_offset: vertical offset in pels for input window + * within input frame + * @addr_roi: Map of QP offset for the Region of Interest algorithm and + * also used for Error map. + * Bit 0-6 used for qp offset (value -64 to 63). + * Bit 7 used to force intra + * @addr_slice_header: address to slice header + * @slice_header_size_in_bits: size in bits of the Slice header + * @slice_header_offset0: Slice header offset where to insert + * first_Mb_in_slice + * @slice_header_offset1: Slice header offset where to insert + * slice_qp_delta + * @slice_header_offset2: Slice header offset where to insert + * num_MBs_in_slice + * @slice_synchro_enable: enable "slice ready" interrupt after each slice + * @max_slice_number: Maximum number of slice in a frame + * (0 is strictly forbidden) + * @rgb2_yuv_y_coeff: Four coefficients (C0C1C2C3) to convert from RGB to + * YUV for the Y component. + * Y = C0*R + C1*G + C2*B + C3 (C0 is on byte 0) + * @rgb2_yuv_u_coeff: four coefficients (C0C1C2C3) to convert from RGB to + * YUV for the Y component. + * Y = C0*R + C1*G + C2*B + C3 (C0 is on byte 0) + * @rgb2_yuv_v_coeff: Four coefficients (C0C1C2C3) to convert from RGB to + * YUV for the U (Cb) component. + * U = C0*R + C1*G + C2*B + C3 (C0 is on byte 0) + * @slice_byte_size: maximum slice size in bytes + * (used when slice_size_type=2 or slice_size_type=3) + * @max_air_intra_mb_nb: Maximum number of intra macroblock in a frame + * for the AIR algorithm + * @brc_no_skip: Disable skipping in the Bitrate Controller + * @addr_brc_in_out_parameter: address of static buffer for BRC parameters + */ +struct hva_h264_td { + u16 frame_width; + u16 frame_height; + u32 frame_num; + u16 picture_coding_type; + u16 reserved1; + u16 pic_order_cnt_type; + u16 first_picture_in_sequence; + u16 slice_size_type; + u16 reserved2; + u32 slice_mb_size; + u16 ir_param_option; + u16 intra_refresh_type; + u16 use_constrained_intra_flag; + u16 transform_mode; + u16 disable_deblocking_filter_idc; + s16 slice_alpha_c0_offset_div2; + s16 slice_beta_offset_div2; + u16 encoder_complexity; + s16 chroma_qp_index_offset; + u16 entropy_coding_mode; + u16 brc_type; + u16 quant; + u32 non_vcl_nalu_size; + u32 cpb_buffer_size; + u32 bit_rate; + u16 qp_min; + u16 qp_max; + u16 framerate_num; + u16 framerate_den; + u16 delay; + u16 strict_hrd_compliancy; + u32 addr_source_buffer; + u32 addr_fwd_ref_buffer; + u32 addr_rec_buffer; + u32 addr_output_bitstream_start; + u32 addr_output_bitstream_end; + u32 addr_external_sw; + u32 addr_lctx; + u32 addr_local_rec_buffer; + u32 addr_spatial_context; + u16 bitstream_offset; + u16 sampling_mode; + u32 addr_param_out; + u32 addr_scaling_matrix; + u32 addr_scaling_matrix_dir; + u32 addr_cabac_context_buffer; + u32 reserved3; + u32 reserved4; + s16 gmv_x; + s16 gmv_y; + u16 window_width; + u16 window_height; + u16 window_horizontal_offset; + u16 window_vertical_offset; + u32 addr_roi; + u32 addr_slice_header; + u16 slice_header_size_in_bits; + u16 slice_header_offset0; + u16 slice_header_offset1; + u16 slice_header_offset2; + u32 reserved5; + u32 reserved6; + u16 reserved7; + u16 reserved8; + u16 slice_synchro_enable; + u16 max_slice_number; + u32 rgb2_yuv_y_coeff; + u32 rgb2_yuv_u_coeff; + u32 rgb2_yuv_v_coeff; + u32 slice_byte_size; + u16 max_air_intra_mb_nb; + u16 brc_no_skip; + u32 addr_temporal_context; + u32 addr_brc_in_out_parameter; +}; + +/** + * @ slice_size: slice size + * @ slice_start_time: start time + * @ slice_stop_time: stop time + * @ slice_num: slice number + */ +struct hva_h264_slice_po { + u32 slice_size; + u32 slice_start_time; + u32 slice_end_time; + u32 slice_num; +}; + +/** + * @ bitstream_size: bitstream size + * @ dct_bitstream_size: dtc bitstream size + * @ stuffing_bits: number of stuffing bits inserted by the encoder + * @ removal_time: removal time of current frame (nb of ticks 1/framerate) + * @ hvc_start_time: hvc start time + * @ hvc_stop_time: hvc stop time + * @ slice_count: slice count + */ +struct hva_h264_po { + u32 bitstream_size; + u32 dct_bitstream_size; + u32 stuffing_bits; + u32 removal_time; + u32 hvc_start_time; + u32 hvc_stop_time; + u32 slice_count; + u32 reserved0; + struct hva_h264_slice_po slice_params[16]; +}; + +struct hva_h264_task { + struct hva_h264_td td; + struct hva_h264_po po; +}; + +/** + * @seq_info: sequence information buffer + * @ref_frame: reference frame buffer + * @rec_frame: reconstructed frame buffer + * @task: task descriptor + */ +struct hva_h264_ctx { + struct hva_buffer *seq_info; + struct hva_buffer *ref_frame; + struct hva_buffer *rec_frame; + struct hva_buffer *task; +}; + +static int hva_h264_fill_slice_header(struct hva_ctx *pctx, + u8 *slice_header_addr, + struct hva_controls *ctrls, + int frame_num, + u16 *header_size, + u16 *header_offset0, + u16 *header_offset1, + u16 *header_offset2) +{ + /* + * with this HVA hardware version, part of the slice header is computed + * on host and part by hardware. + * The part of host is precomputed and available through this array. + */ + struct device *dev = ctx_to_dev(pctx); + int cabac = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC; + const unsigned char slice_header[] = { 0x00, 0x00, 0x00, 0x01, + 0x41, 0x34, 0x07, 0x00}; + int idr_pic_id = frame_num % 2; + enum hva_picture_coding_type type; + u32 frame_order = frame_num % ctrls->gop_size; + + if (!(frame_num % ctrls->gop_size)) + type = PICTURE_CODING_TYPE_I; + else + type = PICTURE_CODING_TYPE_P; + + memcpy(slice_header_addr, slice_header, sizeof(slice_header)); + + *header_size = 56; + *header_offset0 = 40; + *header_offset1 = 13; + *header_offset2 = 0; + + if (type == PICTURE_CODING_TYPE_I) { + slice_header_addr[4] = 0x65; + slice_header_addr[5] = 0x11; + + /* toggle the I frame */ + if ((frame_num / ctrls->gop_size) % 2) { + *header_size += 4; + *header_offset1 += 4; + slice_header_addr[6] = 0x04; + slice_header_addr[7] = 0x70; + + } else { + *header_size += 2; + *header_offset1 += 2; + slice_header_addr[6] = 0x09; + slice_header_addr[7] = 0xC0; + } + } else { + if (ctrls->entropy_mode == cabac) { + *header_size += 1; + *header_offset1 += 1; + slice_header_addr[7] = 0x80; + } + /* + * update slice header with P frame order + * frame order is limited to 16 (coded on 4bits only) + */ + slice_header_addr[5] += ((frame_order & 0x0C) >> 2); + slice_header_addr[6] += ((frame_order & 0x03) << 6); + } + + dev_dbg(dev, + "%s %s slice header order %d idrPicId %d header size %d\n", + pctx->name, __func__, frame_order, idr_pic_id, *header_size); + return 0; +} + +static int hva_h264_fill_data_nal(struct hva_ctx *pctx, + unsigned int stuffing_bytes, u8 *addr, + unsigned int stream_size, unsigned int *size) +{ + struct device *dev = ctx_to_dev(pctx); + const u8 start[] = { 0x00, 0x00, 0x00, 0x01 }; + + dev_dbg(dev, "%s %s stuffing bytes %d\n", pctx->name, __func__, + stuffing_bytes); + + if ((*size + stuffing_bytes + H264_FILLER_DATA_SIZE) > stream_size) { + dev_dbg(dev, "%s %s too many stuffing bytes %d\n", + pctx->name, __func__, stuffing_bytes); + return 0; + } + + /* start code */ + memcpy(addr + *size, start, sizeof(start)); + *size += sizeof(start); + + /* nal_unit_type */ + addr[*size] = NALU_TYPE_FILLER_DATA; + *size += 1; + + memset(addr + *size, 0xff, stuffing_bytes); + *size += stuffing_bytes; + + addr[*size] = 0x80; + *size += 1; + + return 0; +} + +static int hva_h264_fill_sei_nal(struct hva_ctx *pctx, + enum hva_h264_sei_payload_type type, + u8 *addr, u32 *size) +{ + struct device *dev = ctx_to_dev(pctx); + const u8 start[] = { 0x00, 0x00, 0x00, 0x01 }; + struct hva_h264_stereo_video_sei info; + u8 offset = 7; + u8 msg = 0; + + /* start code */ + memcpy(addr + *size, start, sizeof(start)); + *size += sizeof(start); + + /* nal_unit_type */ + addr[*size] = NALU_TYPE_SEI; + *size += 1; + + /* payload type */ + addr[*size] = type; + *size += 1; + + switch (type) { + case SEI_STEREO_VIDEO_INFO: + memset(&info, 0, sizeof(info)); + + /* set to top/bottom frame packing arrangement */ + info.field_views_flag = 1; + info.top_field_is_left_view_flag = 1; + + /* payload size */ + addr[*size] = 1; + *size += 1; + + /* payload */ + msg = info.field_views_flag << offset--; + + if (info.field_views_flag) { + msg |= info.top_field_is_left_view_flag << + offset--; + } else { + msg |= info.current_frame_is_left_view_flag << + offset--; + msg |= info.next_frame_is_second_view_flag << + offset--; + } + msg |= info.left_view_self_contained_flag << offset--; + msg |= info.right_view_self_contained_flag << offset--; + + addr[*size] = msg; + *size += 1; + + addr[*size] = 0x80; + *size += 1; + + return 0; + case SEI_BUFFERING_PERIOD: + case SEI_PICTURE_TIMING: + case SEI_FRAME_PACKING_ARRANGEMENT: + default: + dev_err(dev, "%s sei nal type not supported %d\n", + pctx->name, type); + return -EINVAL; + } +} + +static int hva_h264_prepare_task(struct hva_ctx *pctx, + struct hva_h264_task *task, + struct hva_frame *frame, + struct hva_stream *stream) +{ + struct hva_dev *hva = ctx_to_hdev(pctx); + struct device *dev = ctx_to_dev(pctx); + struct hva_h264_ctx *ctx = (struct hva_h264_ctx *)pctx->priv; + struct hva_buffer *seq_info = ctx->seq_info; + struct hva_buffer *fwd_ref_frame = ctx->ref_frame; + struct hva_buffer *loc_rec_frame = ctx->rec_frame; + struct hva_h264_td *td = &task->td; + struct hva_controls *ctrls = &pctx->ctrls; + struct v4l2_fract *time_per_frame = &pctx->ctrls.time_per_frame; + int cavlc = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC; + u32 frame_num = pctx->stream_num; + u32 addr_esram = hva->esram_addr; + enum v4l2_mpeg_video_h264_level level; + dma_addr_t paddr = 0; + u8 *slice_header_vaddr; + u32 frame_width = frame->info.aligned_width; + u32 frame_height = frame->info.aligned_height; + u32 max_cpb_buffer_size; + unsigned int payload = stream->bytesused; + u32 max_bitrate; + + /* check width and height parameters */ + if ((frame_width > max(H264_MAX_SIZE_W, H264_MAX_SIZE_H)) || + (frame_height > max(H264_MAX_SIZE_W, H264_MAX_SIZE_H))) { + dev_err(dev, + "%s width(%d) or height(%d) exceeds limits (%dx%d)\n", + pctx->name, frame_width, frame_height, + H264_MAX_SIZE_W, H264_MAX_SIZE_H); + return -EINVAL; + } + + level = ctrls->level; + + memset(td, 0, sizeof(struct hva_h264_td)); + + td->frame_width = frame_width; + td->frame_height = frame_height; + + /* set frame alignement */ + td->window_width = frame_width; + td->window_height = frame_height; + td->window_horizontal_offset = 0; + td->window_vertical_offset = 0; + + td->first_picture_in_sequence = (!frame_num) ? 1 : 0; + + /* pic_order_cnt_type hard coded to '2' as only I & P frames */ + td->pic_order_cnt_type = 2; + + /* useConstrainedIntraFlag set to false for better coding efficiency */ + td->use_constrained_intra_flag = false; + td->brc_type = (ctrls->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) + ? BRC_TYPE_CBR : BRC_TYPE_VBR; + + td->entropy_coding_mode = (ctrls->entropy_mode == cavlc) ? CAVLC : + CABAC; + + td->bit_rate = ctrls->bitrate; + + /* set framerate, framerate = 1 n/ time per frame */ + if (time_per_frame->numerator >= 536) { + /* + * due to a hardware bug, framerate denominator can't exceed + * 536 (BRC overflow). Compute nearest framerate + */ + td->framerate_den = 1; + td->framerate_num = (time_per_frame->denominator + + (time_per_frame->numerator >> 1) - 1) / + time_per_frame->numerator; + + /* + * update bitrate to introduce a correction due to + * the new framerate + * new bitrate = (old bitrate * new framerate) / old framerate + */ + td->bit_rate /= time_per_frame->numerator; + td->bit_rate *= time_per_frame->denominator; + td->bit_rate /= td->framerate_num; + } else { + td->framerate_den = time_per_frame->numerator; + td->framerate_num = time_per_frame->denominator; + } + + /* compute maximum bitrate depending on profile */ + if (ctrls->profile >= V4L2_MPEG_VIDEO_H264_PROFILE_HIGH) + max_bitrate = h264_infos_list[level].max_bitrate * + H264_FACTOR_HIGH; + else + max_bitrate = h264_infos_list[level].max_bitrate * + H264_FACTOR_BASELINE; + + /* check if bitrate doesn't exceed max size */ + if (td->bit_rate > max_bitrate) { + dev_dbg(dev, + "%s bitrate (%d) larger than level and profile allow, clip to %d\n", + pctx->name, td->bit_rate, max_bitrate); + td->bit_rate = max_bitrate; + } + + /* convert cpb_buffer_size in bits */ + td->cpb_buffer_size = ctrls->cpb_size * 8000; + + /* compute maximum cpb buffer size depending on profile */ + if (ctrls->profile >= V4L2_MPEG_VIDEO_H264_PROFILE_HIGH) + max_cpb_buffer_size = + h264_infos_list[level].max_cpb_size * H264_FACTOR_HIGH; + else + max_cpb_buffer_size = + h264_infos_list[level].max_cpb_size * H264_FACTOR_BASELINE; + + /* check if cpb buffer size doesn't exceed max size */ + if (td->cpb_buffer_size > max_cpb_buffer_size) { + dev_dbg(dev, + "%s cpb size larger than level %d allows, clip to %d\n", + pctx->name, td->cpb_buffer_size, max_cpb_buffer_size); + td->cpb_buffer_size = max_cpb_buffer_size; + } + + /* enable skipping in the Bitrate Controller */ + td->brc_no_skip = 0; + + /* initial delay */ + if ((ctrls->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) && + td->bit_rate) + td->delay = 1000 * (td->cpb_buffer_size / td->bit_rate); + else + td->delay = 0; + + switch (frame->info.pixelformat) { + case V4L2_PIX_FMT_NV12: + td->sampling_mode = SAMPLING_MODE_NV12; + break; + case V4L2_PIX_FMT_NV21: + td->sampling_mode = SAMPLING_MODE_NV21; + break; + default: + dev_err(dev, "%s invalid source pixel format\n", + pctx->name); + return -EINVAL; + } + + /* + * fill matrix color converter (RGB to YUV) + * Y = 0,299 R + 0,587 G + 0,114 B + * Cb = -0,1687 R -0,3313 G + 0,5 B + 128 + * Cr = 0,5 R - 0,4187 G - 0,0813 B + 128 + */ + td->rgb2_yuv_y_coeff = 0x12031008; + td->rgb2_yuv_u_coeff = 0x800EF7FB; + td->rgb2_yuv_v_coeff = 0x80FEF40E; + + /* enable/disable transform mode */ + td->transform_mode = ctrls->dct8x8; + + /* encoder complexity fix to 2, ENCODE_I_16x16_I_NxN_P_16x16_P_WxH */ + td->encoder_complexity = 2; + + /* quant fix to 28, default VBR value */ + td->quant = 28; + + if (td->framerate_den == 0) { + dev_err(dev, "%s invalid framerate\n", pctx->name); + return -EINVAL; + } + + /* if automatic framerate, deactivate bitrate controller */ + if (td->framerate_num == 0) + td->brc_type = 0; + + /* compliancy fix to true */ + td->strict_hrd_compliancy = 1; + + /* set minimum & maximum quantizers */ + td->qp_min = clamp_val(ctrls->qpmin, 0, 51); + td->qp_max = clamp_val(ctrls->qpmax, 0, 51); + + td->addr_source_buffer = frame->paddr; + td->addr_fwd_ref_buffer = fwd_ref_frame->paddr; + td->addr_rec_buffer = loc_rec_frame->paddr; + + td->addr_output_bitstream_end = (u32)stream->paddr + stream->size; + + td->addr_output_bitstream_start = (u32)stream->paddr; + td->bitstream_offset = (((u32)stream->paddr & 0xF) << 3) & + BITSTREAM_OFFSET_MASK; + + td->addr_param_out = (u32)ctx->task->paddr + + offsetof(struct hva_h264_task, po); + + /* swap spatial and temporal context */ + if (frame_num % 2) { + paddr = seq_info->paddr; + td->addr_spatial_context = ALIGN(paddr, 0x100); + paddr = seq_info->paddr + DATA_SIZE(frame_width, + frame_height); + td->addr_temporal_context = ALIGN(paddr, 0x100); + } else { + paddr = seq_info->paddr; + td->addr_temporal_context = ALIGN(paddr, 0x100); + paddr = seq_info->paddr + DATA_SIZE(frame_width, + frame_height); + td->addr_spatial_context = ALIGN(paddr, 0x100); + } + + paddr = seq_info->paddr + 2 * DATA_SIZE(frame_width, frame_height); + + td->addr_brc_in_out_parameter = ALIGN(paddr, 0x100); + + paddr = td->addr_brc_in_out_parameter + BRC_DATA_SIZE; + td->addr_slice_header = ALIGN(paddr, 0x100); + td->addr_external_sw = ALIGN(addr_esram, 0x100); + + addr_esram += SEARCH_WINDOW_BUFFER_MAX_SIZE(frame_width); + td->addr_local_rec_buffer = ALIGN(addr_esram, 0x100); + + addr_esram += LOCAL_RECONSTRUCTED_BUFFER_MAX_SIZE(frame_width); + td->addr_lctx = ALIGN(addr_esram, 0x100); + + addr_esram += CTX_MB_BUFFER_MAX_SIZE(max(frame_width, frame_height)); + td->addr_cabac_context_buffer = ALIGN(addr_esram, 0x100); + + if (!(frame_num % ctrls->gop_size)) { + td->picture_coding_type = PICTURE_CODING_TYPE_I; + stream->vbuf.flags |= V4L2_BUF_FLAG_KEYFRAME; + } else { + td->picture_coding_type = PICTURE_CODING_TYPE_P; + stream->vbuf.flags &= ~V4L2_BUF_FLAG_KEYFRAME; + } + + /* fill the slice header part */ + slice_header_vaddr = seq_info->vaddr + (td->addr_slice_header - + seq_info->paddr); + + hva_h264_fill_slice_header(pctx, slice_header_vaddr, ctrls, frame_num, + &td->slice_header_size_in_bits, + &td->slice_header_offset0, + &td->slice_header_offset1, + &td->slice_header_offset2); + + td->chroma_qp_index_offset = 2; + td->slice_synchro_enable = 0; + td->max_slice_number = 1; + + /* + * check the sps/pps header size for key frame only + * sps/pps header was previously fill by libv4l + * during qbuf of stream buffer + */ + if ((stream->vbuf.flags == V4L2_BUF_FLAG_KEYFRAME) && + (payload > MAX_SPS_PPS_SIZE)) { + dev_err(dev, "%s invalid sps/pps size %d\n", pctx->name, + payload); + return -EINVAL; + } + + if (stream->vbuf.flags != V4L2_BUF_FLAG_KEYFRAME) + payload = 0; + + /* add SEI nal (video stereo info) */ + if (ctrls->sei_fp && hva_h264_fill_sei_nal(pctx, SEI_STEREO_VIDEO_INFO, + (u8 *)stream->vaddr, + &payload)) { + dev_err(dev, "%s fail to get SEI nal\n", pctx->name); + return -EINVAL; + } + + /* fill size of non-VCL NAL units (SPS, PPS, filler and SEI) */ + td->non_vcl_nalu_size = payload * 8; + + /* compute bitstream offset & new start address of bitstream */ + td->addr_output_bitstream_start += ((payload >> 4) << 4); + td->bitstream_offset += (payload - ((payload >> 4) << 4)) * 8; + + stream->bytesused = payload; + + return 0; +} + +static unsigned int hva_h264_get_stream_size(struct hva_h264_task *task) +{ + struct hva_h264_po *po = &task->po; + + return po->bitstream_size; +} + +static u32 hva_h264_get_stuffing_bytes(struct hva_h264_task *task) +{ + struct hva_h264_po *po = &task->po; + + return po->stuffing_bits >> 3; +} + +static int hva_h264_open(struct hva_ctx *pctx) +{ + struct device *dev = ctx_to_dev(pctx); + struct hva_h264_ctx *ctx; + struct hva_dev *hva = ctx_to_hdev(pctx); + u32 frame_width = pctx->frameinfo.aligned_width; + u32 frame_height = pctx->frameinfo.aligned_height; + u32 size; + int ret; + + /* check esram size necessary to encode a frame */ + size = SEARCH_WINDOW_BUFFER_MAX_SIZE(frame_width) + + LOCAL_RECONSTRUCTED_BUFFER_MAX_SIZE(frame_width) + + CTX_MB_BUFFER_MAX_SIZE(max(frame_width, frame_height)) + + CABAC_CONTEXT_BUFFER_MAX_SIZE(frame_width); + + if (hva->esram_size < size) { + dev_err(dev, "%s not enough esram (max:%d request:%d)\n", + pctx->name, hva->esram_size, size); + ret = -EINVAL; + goto err; + } + + /* allocate context for codec */ + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) { + ret = -ENOMEM; + goto err; + } + + /* allocate sequence info buffer */ + ret = hva_mem_alloc(pctx, + 2 * DATA_SIZE(frame_width, frame_height) + + SLICE_HEADER_SIZE + + BRC_DATA_SIZE, + "hva sequence info", + &ctx->seq_info); + if (ret) { + dev_err(dev, + "%s failed to allocate sequence info buffer\n", + pctx->name); + goto err_ctx; + } + + /* allocate reference frame buffer */ + ret = hva_mem_alloc(pctx, + frame_width * frame_height * 3 / 2, + "hva reference frame", + &ctx->ref_frame); + if (ret) { + dev_err(dev, "%s failed to allocate reference frame buffer\n", + pctx->name); + goto err_seq_info; + } + + /* allocate reconstructed frame buffer */ + ret = hva_mem_alloc(pctx, + frame_width * frame_height * 3 / 2, + "hva reconstructed frame", + &ctx->rec_frame); + if (ret) { + dev_err(dev, + "%s failed to allocate reconstructed frame buffer\n", + pctx->name); + goto err_ref_frame; + } + + /* allocate task descriptor */ + ret = hva_mem_alloc(pctx, + sizeof(struct hva_h264_task), + "hva task descriptor", + &ctx->task); + if (ret) { + dev_err(dev, + "%s failed to allocate task descriptor\n", + pctx->name); + goto err_rec_frame; + } + + pctx->priv = (void *)ctx; + + return 0; + +err_rec_frame: + hva_mem_free(pctx, ctx->rec_frame); +err_ref_frame: + hva_mem_free(pctx, ctx->ref_frame); +err_seq_info: + hva_mem_free(pctx, ctx->seq_info); +err_ctx: + devm_kfree(dev, ctx); +err: + return ret; +} + +static int hva_h264_close(struct hva_ctx *pctx) +{ + struct hva_h264_ctx *ctx = (struct hva_h264_ctx *)pctx->priv; + struct device *dev = ctx_to_dev(pctx); + + if (ctx->seq_info) + hva_mem_free(pctx, ctx->seq_info); + + if (ctx->ref_frame) + hva_mem_free(pctx, ctx->ref_frame); + + if (ctx->rec_frame) + hva_mem_free(pctx, ctx->rec_frame); + + if (ctx->task) + hva_mem_free(pctx, ctx->task); + + devm_kfree(dev, ctx); + + return 0; +} + +static int hva_h264_encode(struct hva_ctx *pctx, struct hva_frame *frame, + struct hva_stream *stream) +{ + struct hva_h264_ctx *ctx = (struct hva_h264_ctx *)pctx->priv; + struct hva_h264_task *task = (struct hva_h264_task *)ctx->task->vaddr; + struct hva_buffer *tmp_frame; + u32 stuffing_bytes = 0; + int ret = 0; + + ret = hva_h264_prepare_task(pctx, task, frame, stream); + if (ret) + goto err; + + ret = hva_hw_execute_task(pctx, H264_ENC, ctx->task); + if (ret) + goto err; + + pctx->stream_num++; + stream->bytesused += hva_h264_get_stream_size(task); + + stuffing_bytes = hva_h264_get_stuffing_bytes(task); + + if (stuffing_bytes) + hva_h264_fill_data_nal(pctx, stuffing_bytes, + (u8 *)stream->vaddr, + stream->size, + &stream->bytesused); + + /* switch reference & reconstructed frame */ + tmp_frame = ctx->ref_frame; + ctx->ref_frame = ctx->rec_frame; + ctx->rec_frame = tmp_frame; + + return 0; +err: + stream->bytesused = 0; + return ret; +} + +const struct hva_enc nv12h264enc = { + .name = "H264(NV12)", + .pixelformat = V4L2_PIX_FMT_NV12, + .streamformat = V4L2_PIX_FMT_H264, + .max_width = H264_MAX_SIZE_W, + .max_height = H264_MAX_SIZE_H, + .open = hva_h264_open, + .close = hva_h264_close, + .encode = hva_h264_encode, +}; + +const struct hva_enc nv21h264enc = { + .name = "H264(NV21)", + .pixelformat = V4L2_PIX_FMT_NV21, + .streamformat = V4L2_PIX_FMT_H264, + .max_width = H264_MAX_SIZE_W, + .max_height = H264_MAX_SIZE_H, + .open = hva_h264_open, + .close = hva_h264_close, + .encode = hva_h264_encode, +}; diff --git a/drivers/media/platform/sti/hva/hva-v4l2.c b/drivers/media/platform/sti/hva/hva-v4l2.c index 54e79f71bfbe..1696e02c5707 100644 --- a/drivers/media/platform/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/sti/hva/hva-v4l2.c @@ -41,6 +41,8 @@ /* registry of available encoders */ const struct hva_enc *hva_encoders[] = { + &nv12h264enc, + &nv21h264enc, }; static inline int frame_size(u32 w, u32 h, u32 fmt) @@ -610,6 +612,49 @@ static int hva_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_ASPECT: ctx->ctrls.aspect = ctrl->val; break; + case V4L2_CID_MPEG_VIDEO_H264_PROFILE: + ctx->ctrls.profile = ctrl->val; + if (ctx->flags & HVA_FLAG_STREAMINFO) + snprintf(ctx->streaminfo.profile, + sizeof(ctx->streaminfo.profile), + "%s profile", + v4l2_ctrl_get_menu(ctrl->id)[ctrl->val]); + break; + case V4L2_CID_MPEG_VIDEO_H264_LEVEL: + ctx->ctrls.level = ctrl->val; + if (ctx->flags & HVA_FLAG_STREAMINFO) + snprintf(ctx->streaminfo.level, + sizeof(ctx->streaminfo.level), + "level %s", + v4l2_ctrl_get_menu(ctrl->id)[ctrl->val]); + break; + case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: + ctx->ctrls.entropy_mode = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE: + ctx->ctrls.cpb_size = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM: + ctx->ctrls.dct8x8 = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_H264_MIN_QP: + ctx->ctrls.qpmin = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_H264_MAX_QP: + ctx->ctrls.qpmax = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE: + ctx->ctrls.vui_sar = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC: + ctx->ctrls.vui_sar_idc = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING: + ctx->ctrls.sei_fp = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE: + ctx->ctrls.sei_fp_type = ctrl->val; + break; default: dev_dbg(dev, "%s S_CTRL: invalid control (id = %d)\n", ctx->name, ctrl->id); @@ -628,8 +673,10 @@ static int hva_ctrls_setup(struct hva_ctx *ctx) { struct device *dev = ctx_to_dev(ctx); u64 mask; + enum v4l2_mpeg_video_h264_sei_fp_arrangement_type sei_fp_type = + V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM; - v4l2_ctrl_handler_init(&ctx->ctrl_handler, 4); + v4l2_ctrl_handler_init(&ctx->ctrl_handler, 15); v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &hva_ctrl_ops, V4L2_CID_MPEG_VIDEO_BITRATE_MODE, @@ -652,6 +699,66 @@ static int hva_ctrls_setup(struct hva_ctx *ctx) mask, V4L2_MPEG_VIDEO_ASPECT_1x1); + mask = ~((1 << V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE) | + (1 << V4L2_MPEG_VIDEO_H264_PROFILE_MAIN) | + (1 << V4L2_MPEG_VIDEO_H264_PROFILE_HIGH) | + (1 << V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH)); + v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_PROFILE, + V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH, + mask, + V4L2_MPEG_VIDEO_H264_PROFILE_HIGH); + + v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_LEVEL, + V4L2_MPEG_VIDEO_H264_LEVEL_4_2, + 0, + V4L2_MPEG_VIDEO_H264_LEVEL_4_0); + + v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE, + V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC, + 0, + V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC); + + v4l2_ctrl_new_std(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE, + 1, 10000, 1, 3000); + + v4l2_ctrl_new_std(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM, + 0, 1, 1, 0); + + v4l2_ctrl_new_std(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_MIN_QP, + 0, 51, 1, 5); + + v4l2_ctrl_new_std(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_MAX_QP, + 0, 51, 1, 51); + + v4l2_ctrl_new_std(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE, + 0, 1, 1, 1); + + mask = ~(1 << V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1); + v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1, + mask, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1); + + v4l2_ctrl_new_std(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING, + 0, 1, 1, 0); + + mask = ~(1 << sei_fp_type); + v4l2_ctrl_new_std_menu(&ctx->ctrl_handler, &hva_ctrl_ops, + V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE, + sei_fp_type, + mask, + sei_fp_type); + if (ctx->ctrl_handler.error) { int err = ctx->ctrl_handler.error; diff --git a/drivers/media/platform/sti/hva/hva.h b/drivers/media/platform/sti/hva/hva.h index b62fda00dc15..caa580825541 100644 --- a/drivers/media/platform/sti/hva/hva.h +++ b/drivers/media/platform/sti/hva/hva.h @@ -23,6 +23,9 @@ #define HVA_PREFIX "[---:----]" +extern const struct hva_enc nv12h264enc; +extern const struct hva_enc nv21h264enc; + /** * struct hva_frameinfo - information about hva frame * @@ -67,13 +70,35 @@ struct hva_streaminfo { * @gop_size: groupe of picture size * @bitrate: bitrate (in bps) * @aspect: video aspect + * @profile: H.264 profile + * @level: H.264 level + * @entropy_mode: H.264 entropy mode (CABAC or CVLC) + * @cpb_size: coded picture buffer size (in kB) + * @dct8x8: transform mode 8x8 enable + * @qpmin: minimum quantizer + * @qpmax: maximum quantizer + * @vui_sar: pixel aspect ratio enable + * @vui_sar_idc: pixel aspect ratio identifier + * @sei_fp: sei frame packing arrangement enable + * @sei_fp_type: sei frame packing arrangement type */ struct hva_controls { - struct v4l2_fract time_per_frame; - enum v4l2_mpeg_video_bitrate_mode bitrate_mode; - u32 gop_size; - u32 bitrate; - enum v4l2_mpeg_video_aspect aspect; + struct v4l2_fract time_per_frame; + enum v4l2_mpeg_video_bitrate_mode bitrate_mode; + u32 gop_size; + u32 bitrate; + enum v4l2_mpeg_video_aspect aspect; + enum v4l2_mpeg_video_h264_profile profile; + enum v4l2_mpeg_video_h264_level level; + enum v4l2_mpeg_video_h264_entropy_mode entropy_mode; + u32 cpb_size; + bool dct8x8; + u32 qpmin; + u32 qpmax; + bool vui_sar; + enum v4l2_mpeg_video_h264_vui_sar_idc vui_sar_idc; + bool sei_fp; + enum v4l2_mpeg_video_h264_sei_fp_arrangement_type sei_fp_type; }; /** From fe713d608bcb5de7b709ddebceced9f047e3d506 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Trotin Date: Mon, 5 Sep 2016 12:31:29 -0300 Subject: [PATCH 364/591] [media] st-hva: update MAINTAINERS Add entry for the HVA driver to the MAINTAINERS file. Signed-off-by: Jean-Christophe Trotin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 0a16a820fd56..9015f04208a7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5626,6 +5626,14 @@ M: Nadia Yvette Chambers S: Maintained F: fs/hugetlbfs/ +HVA ST MEDIA DRIVER +M: Jean-Christophe Trotin +L: linux-media@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +W: https://linuxtv.org +S: Supported +F: drivers/media/platform/sti/hva + Hyper-V CORE AND DRIVERS M: "K. Y. Srinivasan" M: Haiyang Zhang From 5d7cc01b20fc7eecddea0a539f6d8fd6e2234334 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:11 -0300 Subject: [PATCH 365/591] [media] media: mt9m111: make a standalone v4l2 subdevice Remove the soc_camera adherence. Mostly the change removes the power manipulation provided by soc_camera, and instead : - powers on the sensor when the s_power control is activated - powers on the sensor in initial probe - enables and disables the MCLK provided to it in power on/off This patch also drops support for inverters on synchronisation and clock lines. It is assumed, if any board ever needs such inverters, support for them can be added in the future Acked-by: Guennadi Liakhovetski Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/soc_camera/mt9m111.c | 51 ++++++++------------------ 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index 6c8d1123658c..7faf49f0d9f9 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c @@ -16,10 +16,11 @@ #include #include -#include +#include #include #include #include +#include /* * MT9M111, MT9M112 and MT9M131: @@ -391,7 +392,7 @@ static int mt9m111_set_selection(struct v4l2_subdev *sd, struct mt9m111 *mt9m111 = to_mt9m111(client); struct v4l2_rect rect = sel->r; int width, height; - int ret; + int ret, align = 0; if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || sel->target != V4L2_SEL_TGT_CROP) @@ -400,17 +401,19 @@ static int mt9m111_set_selection(struct v4l2_subdev *sd, if (mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR8_1X8 || mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) { /* Bayer format - even size lengths */ - rect.width = ALIGN(rect.width, 2); - rect.height = ALIGN(rect.height, 2); + align = 1; /* Let the user play with the starting pixel */ } /* FIXME: the datasheet doesn't specify minimum sizes */ - soc_camera_limit_side(&rect.left, &rect.width, - MT9M111_MIN_DARK_COLS, 2, MT9M111_MAX_WIDTH); - - soc_camera_limit_side(&rect.top, &rect.height, - MT9M111_MIN_DARK_ROWS, 2, MT9M111_MAX_HEIGHT); + v4l_bound_align_image(&rect.width, 2, MT9M111_MAX_WIDTH, align, + &rect.height, 2, MT9M111_MAX_HEIGHT, align, 0); + rect.left = clamp(rect.left, MT9M111_MIN_DARK_COLS, + MT9M111_MIN_DARK_COLS + MT9M111_MAX_WIDTH - + (__s32)rect.width); + rect.top = clamp(rect.top, MT9M111_MIN_DARK_ROWS, + MT9M111_MIN_DARK_ROWS + MT9M111_MAX_HEIGHT - + (__s32)rect.height); width = min(mt9m111->width, rect.width); height = min(mt9m111->height, rect.height); @@ -779,17 +782,16 @@ static int mt9m111_init(struct mt9m111 *mt9m111) static int mt9m111_power_on(struct mt9m111 *mt9m111) { struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); - struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); int ret; - ret = soc_camera_power_on(&client->dev, ssdd, mt9m111->clk); + ret = v4l2_clk_enable(mt9m111->clk); if (ret < 0) return ret; ret = mt9m111_resume(mt9m111); if (ret < 0) { dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); - soc_camera_power_off(&client->dev, ssdd, mt9m111->clk); + v4l2_clk_disable(mt9m111->clk); } return ret; @@ -797,11 +799,8 @@ static int mt9m111_power_on(struct mt9m111 *mt9m111) static void mt9m111_power_off(struct mt9m111 *mt9m111) { - struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); - struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); - mt9m111_suspend(mt9m111); - soc_camera_power_off(&client->dev, ssdd, mt9m111->clk); + v4l2_clk_disable(mt9m111->clk); } static int mt9m111_s_power(struct v4l2_subdev *sd, int on) @@ -858,14 +857,10 @@ static int mt9m111_enum_mbus_code(struct v4l2_subdev *sd, static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, struct v4l2_mbus_config *cfg) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); - cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH; cfg->type = V4L2_MBUS_PARALLEL; - cfg->flags = soc_camera_apply_board_flags(ssdd, cfg); return 0; } @@ -936,20 +931,8 @@ static int mt9m111_probe(struct i2c_client *client, { struct mt9m111 *mt9m111; struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); - struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); int ret; - if (client->dev.of_node) { - ssdd = devm_kzalloc(&client->dev, sizeof(*ssdd), GFP_KERNEL); - if (!ssdd) - return -ENOMEM; - client->dev.platform_data = ssdd; - } - if (!ssdd) { - dev_err(&client->dev, "mt9m111: driver needs platform data\n"); - return -EINVAL; - } - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { dev_warn(&adapter->dev, "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n"); @@ -995,10 +978,6 @@ static int mt9m111_probe(struct i2c_client *client, mt9m111->lastpage = -1; mutex_init(&mt9m111->power_lock); - ret = soc_camera_power_init(&client->dev, ssdd); - if (ret < 0) - goto out_hdlfree; - ret = mt9m111_video_probe(client); if (ret < 0) goto out_hdlfree; From 1a412faa7a183ed5c2aade3d7e3383e555ab01c8 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:12 -0300 Subject: [PATCH 366/591] [media] media: mt9m111: use only the SRGB colorspace mt9m111 being a camera sensor, its colorspace should always be SRGB, for both RGB based formats or YCbCr based ones. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/soc_camera/mt9m111.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index 7faf49f0d9f9..72e71b762827 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c @@ -188,10 +188,10 @@ struct mt9m111_datafmt { }; static const struct mt9m111_datafmt mt9m111_colour_fmts[] = { - {MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}, - {MEDIA_BUS_FMT_YVYU8_2X8, V4L2_COLORSPACE_JPEG}, - {MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG}, - {MEDIA_BUS_FMT_VYUY8_2X8, V4L2_COLORSPACE_JPEG}, + {MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_SRGB}, + {MEDIA_BUS_FMT_YVYU8_2X8, V4L2_COLORSPACE_SRGB}, + {MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_SRGB}, + {MEDIA_BUS_FMT_VYUY8_2X8, V4L2_COLORSPACE_SRGB}, {MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE, V4L2_COLORSPACE_SRGB}, {MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE, V4L2_COLORSPACE_SRGB}, {MEDIA_BUS_FMT_RGB565_2X8_LE, V4L2_COLORSPACE_SRGB}, From c61e74e3a88c919d85706c49b18577e5b5cd0dbc Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:13 -0300 Subject: [PATCH 367/591] [media] media: mt9m111: move mt9m111 out of soc_camera As the mt9m111 is now working as a standalone v4l2 subdevice sensor, move it out of soc_camera directory and sever its dependency on soc_camera. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/Kconfig | 7 +++++++ drivers/media/i2c/Makefile | 1 + drivers/media/i2c/{soc_camera => }/mt9m111.c | 0 drivers/media/i2c/soc_camera/Kconfig | 7 +++++-- drivers/media/i2c/soc_camera/Makefile | 1 - 5 files changed, 13 insertions(+), 3 deletions(-) rename drivers/media/i2c/{soc_camera => }/mt9m111.c (100%) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 92cc54401339..7f929336c409 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -578,6 +578,13 @@ config VIDEO_MT9M032 This driver supports MT9M032 camera sensors from Aptina, monochrome models only. +config VIDEO_MT9M111 + tristate "mt9m111, mt9m112 and mt9m131 support" + depends on I2C && VIDEO_V4L2 + help + This driver supports MT9M111, MT9M112 and MT9M131 cameras from + Micron/Aptina + config VIDEO_MT9P031 tristate "Aptina MT9P031 support" depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 0216af0f9281..92773b2e6225 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -60,6 +60,7 @@ obj-$(CONFIG_VIDEO_OV7640) += ov7640.o obj-$(CONFIG_VIDEO_OV7670) += ov7670.o obj-$(CONFIG_VIDEO_OV9650) += ov9650.o obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o +obj-$(CONFIG_VIDEO_MT9M111) += mt9m111.o obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/mt9m111.c similarity index 100% rename from drivers/media/i2c/soc_camera/mt9m111.c rename to drivers/media/i2c/mt9m111.c diff --git a/drivers/media/i2c/soc_camera/Kconfig b/drivers/media/i2c/soc_camera/Kconfig index 23d352f0adf0..7704bcf5cc25 100644 --- a/drivers/media/i2c/soc_camera/Kconfig +++ b/drivers/media/i2c/soc_camera/Kconfig @@ -14,11 +14,14 @@ config SOC_CAMERA_MT9M001 and colour models. config SOC_CAMERA_MT9M111 - tristate "mt9m111, mt9m112 and mt9m131 support" + tristate "legacy soc_camera mt9m111, mt9m112 and mt9m131 support" depends on SOC_CAMERA && I2C + select VIDEO_MT9M111 help This driver supports MT9M111, MT9M112 and MT9M131 cameras from - Micron/Aptina + Micron/Aptina. + This is the legacy configuration which shouldn't be used anymore, + while VIDEO_MT9M111 should be used instead. config SOC_CAMERA_MT9T031 tristate "mt9t031 support" diff --git a/drivers/media/i2c/soc_camera/Makefile b/drivers/media/i2c/soc_camera/Makefile index d0421feaa796..6f994f9353a0 100644 --- a/drivers/media/i2c/soc_camera/Makefile +++ b/drivers/media/i2c/soc_camera/Makefile @@ -1,6 +1,5 @@ obj-$(CONFIG_SOC_CAMERA_IMX074) += imx074.o obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o -obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o From e009ebd57ba680c52cf513de65a1a87bbf70a459 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:14 -0300 Subject: [PATCH 368/591] [media] media: platform: pxa_camera: convert to vb2 Convert pxa_camera from videobuf to videobuf2. As the soc_camera was already compatible with videobuf2, the port is quite straightforward. The special case of this code in which the vb2 to prepare is "too big" in terms of size for the new capture format, the pxa_camera will fail. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/soc_camera/Kconfig | 4 +- .../media/platform/soc_camera/pxa_camera.c | 579 ++++++++---------- 2 files changed, 269 insertions(+), 314 deletions(-) diff --git a/drivers/media/platform/soc_camera/Kconfig b/drivers/media/platform/soc_camera/Kconfig index 99cf471a5fc0..de1767899ddc 100644 --- a/drivers/media/platform/soc_camera/Kconfig +++ b/drivers/media/platform/soc_camera/Kconfig @@ -19,8 +19,8 @@ config SOC_CAMERA_PLATFORM config VIDEO_PXA27x tristate "PXA27x Quick Capture Interface driver" - depends on VIDEO_DEV && PXA27x && SOC_CAMERA - select VIDEOBUF_DMA_SG + depends on VIDEO_DEV && PXA27x && SOC_CAMERA && HAS_DMA + select VIDEOBUF2_DMA_SG select SG_SPLIT ---help--- This is a v4l2 driver for the PXA27x Quick Capture Interface diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index ebbe514d64e2..d565bcb9f2d6 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include @@ -180,13 +180,16 @@ enum pxa_camera_active_dma { /* buffer for one video frame */ struct pxa_buffer { /* common v4l buffer stuff -- must be first */ - struct videobuf_buffer vb; + struct vb2_v4l2_buffer vbuf; + struct list_head queue; u32 code; + int nb_planes; /* our descriptor lists for Y, U and V channels */ struct dma_async_tx_descriptor *descs[3]; dma_cookie_t cookie[3]; struct scatterlist *sg[3]; int sg_len[3]; + size_t plane_sizes[3]; int inwork; enum pxa_camera_active_dma active_dma; }; @@ -230,59 +233,19 @@ struct pxa_cam { static const char *pxa_cam_driver_description = "PXA_Camera"; -static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ - /* * Videobuf operations */ -static int pxa_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, - unsigned int *size) +static struct pxa_buffer *vb2_to_pxa_buffer(struct vb2_buffer *vb) { - struct soc_camera_device *icd = vq->priv_data; + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); - dev_dbg(icd->parent, "count=%d, size=%d\n", *count, *size); - - *size = icd->sizeimage; - - if (0 == *count) - *count = 32; - if (*size * *count > vid_limit * 1024 * 1024) - *count = (vid_limit * 1024 * 1024) / *size; - - return 0; + return container_of(vbuf, struct pxa_buffer, vbuf); } -static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf) +static struct device *pcdev_to_dev(struct pxa_camera_dev *pcdev) { - struct soc_camera_device *icd = vq->priv_data; - struct videobuf_dmabuf *dma = videobuf_to_dma(&buf->vb); - int i; - - BUG_ON(in_interrupt()); - - dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, - &buf->vb, buf->vb.baddr, buf->vb.bsize); - - /* - * This waits until this buffer is out of danger, i.e., until it is no - * longer in STATE_QUEUED or STATE_ACTIVE - */ - videobuf_waiton(vq, &buf->vb, 0, 0); - - for (i = 0; i < 3 && buf->descs[i]; i++) { - dmaengine_desc_free(buf->descs[i]); - kfree(buf->sg[i]); - buf->descs[i] = NULL; - buf->sg[i] = NULL; - buf->sg_len[i] = 0; - } - videobuf_dma_unmap(vq->dev, dma); - videobuf_dma_free(dma); - - buf->vb.state = VIDEOBUF_NEEDS_INIT; - - dev_dbg(icd->parent, "%s end (vb=0x%p) 0x%08lx %d\n", __func__, - &buf->vb, buf->vb.baddr, buf->vb.bsize); + return pcdev->soc_host.v4l2_dev.dev; } static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, @@ -312,31 +275,26 @@ static void pxa_camera_dma_irq_v(void *data) /** * pxa_init_dma_channel - init dma descriptors * @pcdev: pxa camera device - * @buf: pxa buffer to find pxa dma channel + * @vb: videobuffer2 buffer * @dma: dma video buffer * @channel: dma channel (0 => 'Y', 1 => 'U', 2 => 'V') * @cibr: camera Receive Buffer Register - * @size: bytes to transfer - * @offset: offset in videobuffer of the first byte to transfer * * Prepares the pxa dma descriptors to transfer one camera channel. * * Returns 0 if success or -ENOMEM if no memory is available */ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev, - struct pxa_buffer *buf, - struct videobuf_dmabuf *dma, int channel, - int cibr, int size, int offset) + struct pxa_buffer *buf, int channel, + struct scatterlist *sg, int sglen) { struct dma_chan *dma_chan = pcdev->dma_chans[channel]; - struct scatterlist *sg = buf->sg[channel]; - int sglen = buf->sg_len[channel]; struct dma_async_tx_descriptor *tx; tx = dmaengine_prep_slave_sg(dma_chan, sg, sglen, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_REUSE); if (!tx) { - dev_err(pcdev->soc_host.v4l2_dev.dev, + dev_err(pcdev_to_dev(pcdev), "dmaengine_prep_slave_sg failed\n"); goto fail; } @@ -357,11 +315,9 @@ static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev, buf->descs[channel] = tx; return 0; fail: - kfree(sg); - - dev_dbg(pcdev->soc_host.v4l2_dev.dev, - "%s (vb=0x%p) dma_tx=%p\n", - __func__, &buf->vb, tx); + dev_dbg(pcdev_to_dev(pcdev), + "%s (vb=%p) dma_tx=%p\n", + __func__, buf, tx); return -ENOMEM; } @@ -374,129 +330,6 @@ static void pxa_videobuf_set_actdma(struct pxa_camera_dev *pcdev, buf->active_dma |= DMA_U | DMA_V; } -/* - * Please check the DMA prepared buffer structure in : - * Documentation/video4linux/pxa_camera.txt - * Please check also in pxa_camera_check_link_miss() to understand why DMA chain - * modification while DMA chain is running will work anyway. - */ -static int pxa_videobuf_prepare(struct videobuf_queue *vq, - struct videobuf_buffer *vb, enum v4l2_field field) -{ - struct soc_camera_device *icd = vq->priv_data; - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct pxa_camera_dev *pcdev = ici->priv; - struct device *dev = pcdev->soc_host.v4l2_dev.dev; - struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); - int ret; - int size_y, size_u = 0, size_v = 0; - size_t sizes[3]; - - dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, - vb, vb->baddr, vb->bsize); - - /* Added list head initialization on alloc */ - WARN_ON(!list_empty(&vb->queue)); - -#ifdef DEBUG - /* - * This can be useful if you want to see if we actually fill - * the buffer with something - */ - memset((void *)vb->baddr, 0xaa, vb->bsize); -#endif - - BUG_ON(NULL == icd->current_fmt); - - /* - * I think, in buf_prepare you only have to protect global data, - * the actual buffer is yours - */ - buf->inwork = 1; - - if (buf->code != icd->current_fmt->code || - vb->width != icd->user_width || - vb->height != icd->user_height || - vb->field != field) { - buf->code = icd->current_fmt->code; - vb->width = icd->user_width; - vb->height = icd->user_height; - vb->field = field; - vb->state = VIDEOBUF_NEEDS_INIT; - } - - vb->size = icd->sizeimage; - if (0 != vb->baddr && vb->bsize < vb->size) { - ret = -EINVAL; - goto out; - } - - if (vb->state == VIDEOBUF_NEEDS_INIT) { - int size = vb->size; - struct videobuf_dmabuf *dma = videobuf_to_dma(vb); - - ret = videobuf_iolock(vq, vb, NULL); - if (ret) - goto out; - - if (pcdev->channels == 3) { - size_y = size / 2; - size_u = size_v = size / 4; - } else { - size_y = size; - } - - sizes[0] = size_y; - sizes[1] = size_u; - sizes[2] = size_v; - ret = sg_split(dma->sglist, dma->sglen, 0, pcdev->channels, - sizes, buf->sg, buf->sg_len, GFP_KERNEL); - if (ret < 0) { - dev_err(dev, "sg_split failed: %d\n", ret); - goto fail; - } - - /* init DMA for Y channel */ - ret = pxa_init_dma_channel(pcdev, buf, dma, 0, CIBR0, - size_y, 0); - if (ret) { - dev_err(dev, "DMA initialization for Y/RGB failed\n"); - goto fail; - } - - /* init DMA for U channel */ - if (size_u) - ret = pxa_init_dma_channel(pcdev, buf, dma, 1, CIBR1, - size_u, size_y); - if (ret) { - dev_err(dev, "DMA initialization for U failed\n"); - goto fail; - } - - /* init DMA for V channel */ - if (size_v) - ret = pxa_init_dma_channel(pcdev, buf, dma, 2, CIBR2, - size_v, size_y + size_u); - if (ret) { - dev_err(dev, "DMA initialization for V failed\n"); - goto fail; - } - - vb->state = VIDEOBUF_PREPARED; - } - - buf->inwork = 0; - pxa_videobuf_set_actdma(pcdev, buf); - - return 0; - -fail: - free_buffer(vq, buf); -out: - buf->inwork = 0; - return ret; -} - /** * pxa_dma_start_channels - start DMA channel for active buffer * @pcdev: pxa camera device @@ -512,7 +345,7 @@ static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev) active = pcdev->active; for (i = 0; i < pcdev->channels; i++) { - dev_dbg(pcdev->soc_host.v4l2_dev.dev, + dev_dbg(pcdev_to_dev(pcdev), "%s (channel=%d)\n", __func__, i); dma_async_issue_pending(pcdev->dma_chans[i]); } @@ -523,7 +356,7 @@ static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev) int i; for (i = 0; i < pcdev->channels; i++) { - dev_dbg(pcdev->soc_host.v4l2_dev.dev, + dev_dbg(pcdev_to_dev(pcdev), "%s (channel=%d)\n", __func__, i); dmaengine_terminate_all(pcdev->dma_chans[i]); } @@ -536,7 +369,7 @@ static void pxa_dma_add_tail_buf(struct pxa_camera_dev *pcdev, for (i = 0; i < pcdev->channels; i++) { buf->cookie[i] = dmaengine_submit(buf->descs[i]); - dev_dbg(pcdev->soc_host.v4l2_dev.dev, + dev_dbg(pcdev_to_dev(pcdev), "%s (channel=%d) : submit vb=%p cookie=%d\n", __func__, i, buf, buf->descs[i]->cookie); } @@ -554,7 +387,7 @@ static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev) { unsigned long cicr0; - dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s\n", __func__); + dev_dbg(pcdev_to_dev(pcdev), "%s\n", __func__); __raw_writel(__raw_readl(pcdev->base + CISR), pcdev->base + CISR); /* Enable End-Of-Frame Interrupt */ cicr0 = __raw_readl(pcdev->base + CICR0) | CICR0_ENB; @@ -572,72 +405,20 @@ static void pxa_camera_stop_capture(struct pxa_camera_dev *pcdev) __raw_writel(cicr0, pcdev->base + CICR0); pcdev->active = NULL; - dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s\n", __func__); -} - -/* Called under spinlock_irqsave(&pcdev->lock, ...) */ -static void pxa_videobuf_queue(struct videobuf_queue *vq, - struct videobuf_buffer *vb) -{ - struct soc_camera_device *icd = vq->priv_data; - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct pxa_camera_dev *pcdev = ici->priv; - struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); - - dev_dbg(icd->parent, "%s (vb=0x%p) 0x%08lx %d active=%p\n", - __func__, vb, vb->baddr, vb->bsize, pcdev->active); - - list_add_tail(&vb->queue, &pcdev->capture); - - vb->state = VIDEOBUF_ACTIVE; - pxa_dma_add_tail_buf(pcdev, buf); - - if (!pcdev->active) - pxa_camera_start_capture(pcdev); -} - -static void pxa_videobuf_release(struct videobuf_queue *vq, - struct videobuf_buffer *vb) -{ - struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); -#ifdef DEBUG - struct soc_camera_device *icd = vq->priv_data; - struct device *dev = icd->parent; - - dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, - vb, vb->baddr, vb->bsize); - - switch (vb->state) { - case VIDEOBUF_ACTIVE: - dev_dbg(dev, "%s (active)\n", __func__); - break; - case VIDEOBUF_QUEUED: - dev_dbg(dev, "%s (queued)\n", __func__); - break; - case VIDEOBUF_PREPARED: - dev_dbg(dev, "%s (prepared)\n", __func__); - break; - default: - dev_dbg(dev, "%s (unknown)\n", __func__); - break; - } -#endif - - free_buffer(vq, buf); + dev_dbg(pcdev_to_dev(pcdev), "%s\n", __func__); } static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, - struct videobuf_buffer *vb, struct pxa_buffer *buf) { + struct vb2_buffer *vb = &buf->vbuf.vb2_buf; + /* _init is used to debug races, see comment in pxa_camera_reqbufs() */ - list_del_init(&vb->queue); - vb->state = VIDEOBUF_DONE; - v4l2_get_timestamp(&vb->ts); - vb->field_count++; - wake_up(&vb->done); - dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s dequeud buffer (vb=0x%p)\n", - __func__, vb); + list_del_init(&buf->queue); + vb->timestamp = ktime_get_ns(); + vb2_buffer_done(vb, VB2_BUF_STATE_DONE); + dev_dbg(pcdev_to_dev(pcdev), "%s dequeud buffer (buf=0x%p)\n", + __func__, buf); if (list_empty(&pcdev->capture)) { pxa_camera_stop_capture(pcdev); @@ -645,7 +426,7 @@ static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, } pcdev->active = list_entry(pcdev->capture.next, - struct pxa_buffer, vb.queue); + struct pxa_buffer, queue); } /** @@ -670,7 +451,7 @@ static void pxa_camera_check_link_miss(struct pxa_camera_dev *pcdev, { bool is_dma_stopped = last_submitted != last_issued; - dev_dbg(pcdev->soc_host.v4l2_dev.dev, + dev_dbg(pcdev_to_dev(pcdev), "%s : top queued buffer=%p, is_dma_stopped=%d\n", __func__, pcdev->active, is_dma_stopped); @@ -681,12 +462,11 @@ static void pxa_camera_check_link_miss(struct pxa_camera_dev *pcdev, static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, enum pxa_camera_active_dma act_dma) { - struct device *dev = pcdev->soc_host.v4l2_dev.dev; + struct device *dev = pcdev_to_dev(pcdev); struct pxa_buffer *buf, *last_buf; unsigned long flags; u32 camera_status, overrun; int chan; - struct videobuf_buffer *vb; enum dma_status last_status; dma_cookie_t last_issued; @@ -714,9 +494,8 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, if (!pcdev->active) goto out; - vb = &pcdev->active->vb; - buf = container_of(vb, struct pxa_buffer, vb); - WARN_ON(buf->inwork || list_empty(&vb->queue)); + buf = pcdev->active; + WARN_ON(buf->inwork || list_empty(&buf->queue)); /* * It's normal if the last frame creates an overrun, as there @@ -734,7 +513,7 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, break; } last_buf = list_entry(pcdev->capture.prev, - struct pxa_buffer, vb.queue); + struct pxa_buffer, queue); last_status = dma_async_is_tx_complete(pcdev->dma_chans[chan], last_buf->cookie[chan], NULL, &last_issued); @@ -743,14 +522,14 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, dev_dbg(dev, "FIFO overrun! CISR: %x\n", camera_status); pxa_camera_stop_capture(pcdev); - list_for_each_entry(buf, &pcdev->capture, vb.queue) + list_for_each_entry(buf, &pcdev->capture, queue) pxa_dma_add_tail_buf(pcdev, buf); pxa_camera_start_capture(pcdev); goto out; } buf->active_dma &= ~act_dma; if (!buf->active_dma) { - pxa_camera_wakeup(pcdev, vb, buf); + pxa_camera_wakeup(pcdev, buf); pxa_camera_check_link_miss(pcdev, last_buf->cookie[chan], last_issued); } @@ -759,26 +538,236 @@ out: spin_unlock_irqrestore(&pcdev->lock, flags); } -static struct videobuf_queue_ops pxa_videobuf_ops = { - .buf_setup = pxa_videobuf_setup, - .buf_prepare = pxa_videobuf_prepare, - .buf_queue = pxa_videobuf_queue, - .buf_release = pxa_videobuf_release, +static void pxa_buffer_cleanup(struct pxa_buffer *buf) +{ + int i; + + for (i = 0; i < 3 && buf->descs[i]; i++) { + dmaengine_desc_free(buf->descs[i]); + kfree(buf->sg[i]); + buf->descs[i] = NULL; + buf->sg[i] = NULL; + buf->sg_len[i] = 0; + buf->plane_sizes[i] = 0; + } + buf->nb_planes = 0; +} + +static int pxa_buffer_init(struct pxa_camera_dev *pcdev, + struct pxa_buffer *buf) +{ + struct vb2_buffer *vb = &buf->vbuf.vb2_buf; + struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); + int nb_channels = pcdev->channels; + int i, ret = 0; + unsigned long size = vb2_plane_size(vb, 0); + + switch (nb_channels) { + case 1: + buf->plane_sizes[0] = size; + break; + case 3: + buf->plane_sizes[0] = size / 2; + buf->plane_sizes[1] = size / 4; + buf->plane_sizes[2] = size / 4; + break; + default: + return -EINVAL; + }; + buf->nb_planes = nb_channels; + + ret = sg_split(sgt->sgl, sgt->nents, 0, nb_channels, + buf->plane_sizes, buf->sg, buf->sg_len, GFP_KERNEL); + if (ret < 0) { + dev_err(pcdev_to_dev(pcdev), + "sg_split failed: %d\n", ret); + return ret; + } + for (i = 0; i < nb_channels; i++) { + ret = pxa_init_dma_channel(pcdev, buf, i, + buf->sg[i], buf->sg_len[i]); + if (ret) { + pxa_buffer_cleanup(buf); + return ret; + } + } + INIT_LIST_HEAD(&buf->queue); + + return ret; +} + +static void pxac_vb2_cleanup(struct vb2_buffer *vb) +{ + struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); + + dev_dbg(pcdev_to_dev(pcdev), + "%s(vb=%p)\n", __func__, vb); + pxa_buffer_cleanup(buf); +} + +static void pxac_vb2_queue(struct vb2_buffer *vb) +{ + struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); + + dev_dbg(pcdev_to_dev(pcdev), + "%s(vb=%p) nb_channels=%d size=%lu active=%p\n", + __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0), + pcdev->active); + + list_add_tail(&buf->queue, &pcdev->capture); + + pxa_dma_add_tail_buf(pcdev, buf); +} + +/* + * Please check the DMA prepared buffer structure in : + * Documentation/video4linux/pxa_camera.txt + * Please check also in pxa_camera_check_link_miss() to understand why DMA chain + * modification while DMA chain is running will work anyway. + */ +static int pxac_vb2_prepare(struct vb2_buffer *vb) +{ + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); + struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); + struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); + int ret = 0; + + switch (pcdev->channels) { + case 1: + case 3: + vb2_set_plane_payload(vb, 0, icd->sizeimage); + break; + default: + return -EINVAL; + } + + dev_dbg(pcdev_to_dev(pcdev), + "%s (vb=%p) nb_channels=%d size=%lu\n", + __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0)); + + WARN_ON(!icd->current_fmt); + +#ifdef DEBUG + /* + * This can be useful if you want to see if we actually fill + * the buffer with something + */ + for (i = 0; i < vb->num_planes; i++) + memset((void *)vb2_plane_vaddr(vb, i), + 0xaa, vb2_get_plane_payload(vb, i)); +#endif + + /* + * I think, in buf_prepare you only have to protect global data, + * the actual buffer is yours + */ + buf->inwork = 0; + pxa_videobuf_set_actdma(pcdev, buf); + + return ret; +} + +static int pxac_vb2_init(struct vb2_buffer *vb) +{ + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); + struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); + + dev_dbg(pcdev_to_dev(pcdev), + "%s(nb_channels=%d)\n", + __func__, pcdev->channels); + + return pxa_buffer_init(pcdev, buf); +} + +static int pxac_vb2_queue_setup(struct vb2_queue *vq, + unsigned int *nbufs, + unsigned int *num_planes, unsigned int sizes[], + struct device *alloc_devs[]) +{ + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); + struct soc_camera_device *icd = soc_camera_from_vb2q(vq); + int size = icd->sizeimage; + + dev_dbg(pcdev_to_dev(pcdev), + "%s(vq=%p nbufs=%d num_planes=%d size=%d)\n", + __func__, vq, *nbufs, *num_planes, size); + /* + * Called from VIDIOC_REQBUFS or in compatibility mode For YUV422P + * format, even if there are 3 planes Y, U and V, we reply there is only + * one plane, containing Y, U and V data, one after the other. + */ + if (*num_planes) + return sizes[0] < size ? -EINVAL : 0; + + *num_planes = 1; + switch (pcdev->channels) { + case 1: + case 3: + sizes[0] = size; + break; + default: + return -EINVAL; + } + + if (!*nbufs) + *nbufs = 1; + + return 0; +} + +static int pxac_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) +{ + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); + + dev_dbg(pcdev_to_dev(pcdev), "%s(count=%d) active=%p\n", + __func__, count, pcdev->active); + + if (!pcdev->active) + pxa_camera_start_capture(pcdev); + + return 0; +} + +static void pxac_vb2_stop_streaming(struct vb2_queue *vq) +{ + vb2_wait_for_all_buffers(vq); +} + +static struct vb2_ops pxac_vb2_ops = { + .queue_setup = pxac_vb2_queue_setup, + .buf_init = pxac_vb2_init, + .buf_prepare = pxac_vb2_prepare, + .buf_queue = pxac_vb2_queue, + .buf_cleanup = pxac_vb2_cleanup, + .start_streaming = pxac_vb2_start_streaming, + .stop_streaming = pxac_vb2_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, }; -static void pxa_camera_init_videobuf(struct videobuf_queue *q, - struct soc_camera_device *icd) +static int pxa_camera_init_videobuf2(struct vb2_queue *vq, + struct soc_camera_device *icd) { struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct pxa_camera_dev *pcdev = ici->priv; + int ret; - /* - * We must pass NULL as dev pointer, then all pci_* dma operations - * transform to normal dma_* ones. - */ - videobuf_queue_sg_init(q, &pxa_videobuf_ops, NULL, &pcdev->lock, - V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, - sizeof(struct pxa_buffer), icd, &ici->host_lock); + vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; + vq->drv_priv = pcdev; + vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; + vq->buf_struct_size = sizeof(struct pxa_buffer); + + vq->ops = &pxac_vb2_ops; + vq->mem_ops = &vb2_dma_sg_memops; + + ret = vb2_queue_init(vq); + dev_dbg(pcdev_to_dev(pcdev), + "vb2_queue_init(vq=%p): %d\n", vq, ret); + + return ret; } static u32 mclk_get_divisor(struct platform_device *pdev, @@ -860,9 +849,8 @@ static void pxa_camera_eof(unsigned long arg) struct pxa_camera_dev *pcdev = (struct pxa_camera_dev *)arg; unsigned long cifr; struct pxa_buffer *buf; - struct videobuf_buffer *vb; - dev_dbg(pcdev->soc_host.v4l2_dev.dev, + dev_dbg(pcdev_to_dev(pcdev), "Camera interrupt status 0x%x\n", __raw_readl(pcdev->base + CISR)); @@ -871,9 +859,8 @@ static void pxa_camera_eof(unsigned long arg) __raw_writel(cifr, pcdev->base + CIFR); pcdev->active = list_first_entry(&pcdev->capture, - struct pxa_buffer, vb.queue); - vb = &pcdev->active->vb; - buf = container_of(vb, struct pxa_buffer, vb); + struct pxa_buffer, queue); + buf = pcdev->active; pxa_videobuf_set_actdma(pcdev, buf); pxa_dma_start_channels(pcdev); @@ -885,7 +872,7 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) unsigned long status, cicr0; status = __raw_readl(pcdev->base + CISR); - dev_dbg(pcdev->soc_host.v4l2_dev.dev, + dev_dbg(pcdev_to_dev(pcdev), "Camera interrupt status 0x%lx\n", status); if (!status) @@ -1496,42 +1483,11 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, return ret; } -static int pxa_camera_reqbufs(struct soc_camera_device *icd, - struct v4l2_requestbuffers *p) -{ - int i; - - /* - * This is for locking debugging only. I removed spinlocks and now I - * check whether .prepare is ever called on a linked buffer, or whether - * a dma IRQ can occur for an in-work or unlinked buffer. Until now - * it hadn't triggered - */ - for (i = 0; i < p->count; i++) { - struct pxa_buffer *buf = container_of(icd->vb_vidq.bufs[i], - struct pxa_buffer, vb); - buf->inwork = 0; - INIT_LIST_HEAD(&buf->vb.queue); - } - - return 0; -} - static unsigned int pxa_camera_poll(struct file *file, poll_table *pt) { struct soc_camera_device *icd = file->private_data; - struct pxa_buffer *buf; - buf = list_entry(icd->vb_vidq.stream.next, struct pxa_buffer, - vb.stream); - - poll_wait(file, &buf->vb.done, pt); - - if (buf->vb.state == VIDEOBUF_DONE || - buf->vb.state == VIDEOBUF_ERROR) - return POLLIN|POLLRDNORM; - - return 0; + return vb2_poll(&icd->vb2_vidq, file, pt); } static int pxa_camera_querycap(struct soc_camera_host *ici, @@ -1604,8 +1560,7 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = { .put_formats = pxa_camera_put_formats, .set_fmt = pxa_camera_set_fmt, .try_fmt = pxa_camera_try_fmt, - .init_videobuf = pxa_camera_init_videobuf, - .reqbufs = pxa_camera_reqbufs, + .init_videobuf2 = pxa_camera_init_videobuf2, .poll = pxa_camera_poll, .querycap = pxa_camera_querycap, .set_bus_param = pxa_camera_set_bus_param, From 6f28435d1c157073e4257a5dca7695103f32ba02 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:15 -0300 Subject: [PATCH 369/591] [media] media: platform: pxa_camera: trivial move of functions Move the functions in the file to be regrouped into meaningful blocks : 1. pxa camera core handling functions, manipulating the herdware 2. videobuf2 functions, dealing with video buffers 3. video ioctl (vidioc) related functions 4. driver probing, removal, suspend and resume This patch doesn't modify a single line of code. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/platform/soc_camera/pxa_camera.c | 473 +++++++++--------- 1 file changed, 241 insertions(+), 232 deletions(-) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index d565bcb9f2d6..62e3f69a17ec 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -538,238 +538,6 @@ out: spin_unlock_irqrestore(&pcdev->lock, flags); } -static void pxa_buffer_cleanup(struct pxa_buffer *buf) -{ - int i; - - for (i = 0; i < 3 && buf->descs[i]; i++) { - dmaengine_desc_free(buf->descs[i]); - kfree(buf->sg[i]); - buf->descs[i] = NULL; - buf->sg[i] = NULL; - buf->sg_len[i] = 0; - buf->plane_sizes[i] = 0; - } - buf->nb_planes = 0; -} - -static int pxa_buffer_init(struct pxa_camera_dev *pcdev, - struct pxa_buffer *buf) -{ - struct vb2_buffer *vb = &buf->vbuf.vb2_buf; - struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); - int nb_channels = pcdev->channels; - int i, ret = 0; - unsigned long size = vb2_plane_size(vb, 0); - - switch (nb_channels) { - case 1: - buf->plane_sizes[0] = size; - break; - case 3: - buf->plane_sizes[0] = size / 2; - buf->plane_sizes[1] = size / 4; - buf->plane_sizes[2] = size / 4; - break; - default: - return -EINVAL; - }; - buf->nb_planes = nb_channels; - - ret = sg_split(sgt->sgl, sgt->nents, 0, nb_channels, - buf->plane_sizes, buf->sg, buf->sg_len, GFP_KERNEL); - if (ret < 0) { - dev_err(pcdev_to_dev(pcdev), - "sg_split failed: %d\n", ret); - return ret; - } - for (i = 0; i < nb_channels; i++) { - ret = pxa_init_dma_channel(pcdev, buf, i, - buf->sg[i], buf->sg_len[i]); - if (ret) { - pxa_buffer_cleanup(buf); - return ret; - } - } - INIT_LIST_HEAD(&buf->queue); - - return ret; -} - -static void pxac_vb2_cleanup(struct vb2_buffer *vb) -{ - struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); - - dev_dbg(pcdev_to_dev(pcdev), - "%s(vb=%p)\n", __func__, vb); - pxa_buffer_cleanup(buf); -} - -static void pxac_vb2_queue(struct vb2_buffer *vb) -{ - struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); - - dev_dbg(pcdev_to_dev(pcdev), - "%s(vb=%p) nb_channels=%d size=%lu active=%p\n", - __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0), - pcdev->active); - - list_add_tail(&buf->queue, &pcdev->capture); - - pxa_dma_add_tail_buf(pcdev, buf); -} - -/* - * Please check the DMA prepared buffer structure in : - * Documentation/video4linux/pxa_camera.txt - * Please check also in pxa_camera_check_link_miss() to understand why DMA chain - * modification while DMA chain is running will work anyway. - */ -static int pxac_vb2_prepare(struct vb2_buffer *vb) -{ - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); - struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); - struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); - int ret = 0; - - switch (pcdev->channels) { - case 1: - case 3: - vb2_set_plane_payload(vb, 0, icd->sizeimage); - break; - default: - return -EINVAL; - } - - dev_dbg(pcdev_to_dev(pcdev), - "%s (vb=%p) nb_channels=%d size=%lu\n", - __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0)); - - WARN_ON(!icd->current_fmt); - -#ifdef DEBUG - /* - * This can be useful if you want to see if we actually fill - * the buffer with something - */ - for (i = 0; i < vb->num_planes; i++) - memset((void *)vb2_plane_vaddr(vb, i), - 0xaa, vb2_get_plane_payload(vb, i)); -#endif - - /* - * I think, in buf_prepare you only have to protect global data, - * the actual buffer is yours - */ - buf->inwork = 0; - pxa_videobuf_set_actdma(pcdev, buf); - - return ret; -} - -static int pxac_vb2_init(struct vb2_buffer *vb) -{ - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); - struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); - - dev_dbg(pcdev_to_dev(pcdev), - "%s(nb_channels=%d)\n", - __func__, pcdev->channels); - - return pxa_buffer_init(pcdev, buf); -} - -static int pxac_vb2_queue_setup(struct vb2_queue *vq, - unsigned int *nbufs, - unsigned int *num_planes, unsigned int sizes[], - struct device *alloc_devs[]) -{ - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); - struct soc_camera_device *icd = soc_camera_from_vb2q(vq); - int size = icd->sizeimage; - - dev_dbg(pcdev_to_dev(pcdev), - "%s(vq=%p nbufs=%d num_planes=%d size=%d)\n", - __func__, vq, *nbufs, *num_planes, size); - /* - * Called from VIDIOC_REQBUFS or in compatibility mode For YUV422P - * format, even if there are 3 planes Y, U and V, we reply there is only - * one plane, containing Y, U and V data, one after the other. - */ - if (*num_planes) - return sizes[0] < size ? -EINVAL : 0; - - *num_planes = 1; - switch (pcdev->channels) { - case 1: - case 3: - sizes[0] = size; - break; - default: - return -EINVAL; - } - - if (!*nbufs) - *nbufs = 1; - - return 0; -} - -static int pxac_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) -{ - struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); - - dev_dbg(pcdev_to_dev(pcdev), "%s(count=%d) active=%p\n", - __func__, count, pcdev->active); - - if (!pcdev->active) - pxa_camera_start_capture(pcdev); - - return 0; -} - -static void pxac_vb2_stop_streaming(struct vb2_queue *vq) -{ - vb2_wait_for_all_buffers(vq); -} - -static struct vb2_ops pxac_vb2_ops = { - .queue_setup = pxac_vb2_queue_setup, - .buf_init = pxac_vb2_init, - .buf_prepare = pxac_vb2_prepare, - .buf_queue = pxac_vb2_queue, - .buf_cleanup = pxac_vb2_cleanup, - .start_streaming = pxac_vb2_start_streaming, - .stop_streaming = pxac_vb2_stop_streaming, - .wait_prepare = vb2_ops_wait_prepare, - .wait_finish = vb2_ops_wait_finish, -}; - -static int pxa_camera_init_videobuf2(struct vb2_queue *vq, - struct soc_camera_device *icd) -{ - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct pxa_camera_dev *pcdev = ici->priv; - int ret; - - vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; - vq->drv_priv = pcdev; - vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - vq->buf_struct_size = sizeof(struct pxa_buffer); - - vq->ops = &pxac_vb2_ops; - vq->mem_ops = &vb2_dma_sg_memops; - - ret = vb2_queue_init(vq); - dev_dbg(pcdev_to_dev(pcdev), - "vb2_queue_init(vq=%p): %d\n", vq, ret); - - return ret; -} - static u32 mclk_get_divisor(struct platform_device *pdev, struct pxa_camera_dev *pcdev) { @@ -1051,6 +819,244 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, __raw_writel(cicr0, pcdev->base + CICR0); } +/* + * Videobuf2 section + */ +static void pxa_buffer_cleanup(struct pxa_buffer *buf) +{ + int i; + + for (i = 0; i < 3 && buf->descs[i]; i++) { + dmaengine_desc_free(buf->descs[i]); + kfree(buf->sg[i]); + buf->descs[i] = NULL; + buf->sg[i] = NULL; + buf->sg_len[i] = 0; + buf->plane_sizes[i] = 0; + } + buf->nb_planes = 0; +} + +static int pxa_buffer_init(struct pxa_camera_dev *pcdev, + struct pxa_buffer *buf) +{ + struct vb2_buffer *vb = &buf->vbuf.vb2_buf; + struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); + int nb_channels = pcdev->channels; + int i, ret = 0; + unsigned long size = vb2_plane_size(vb, 0); + + switch (nb_channels) { + case 1: + buf->plane_sizes[0] = size; + break; + case 3: + buf->plane_sizes[0] = size / 2; + buf->plane_sizes[1] = size / 4; + buf->plane_sizes[2] = size / 4; + break; + default: + return -EINVAL; + }; + buf->nb_planes = nb_channels; + + ret = sg_split(sgt->sgl, sgt->nents, 0, nb_channels, + buf->plane_sizes, buf->sg, buf->sg_len, GFP_KERNEL); + if (ret < 0) { + dev_err(pcdev_to_dev(pcdev), + "sg_split failed: %d\n", ret); + return ret; + } + for (i = 0; i < nb_channels; i++) { + ret = pxa_init_dma_channel(pcdev, buf, i, + buf->sg[i], buf->sg_len[i]); + if (ret) { + pxa_buffer_cleanup(buf); + return ret; + } + } + INIT_LIST_HEAD(&buf->queue); + + return ret; +} + +static void pxac_vb2_cleanup(struct vb2_buffer *vb) +{ + struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); + + dev_dbg(pcdev_to_dev(pcdev), + "%s(vb=%p)\n", __func__, vb); + pxa_buffer_cleanup(buf); +} + +static void pxac_vb2_queue(struct vb2_buffer *vb) +{ + struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); + + dev_dbg(pcdev_to_dev(pcdev), + "%s(vb=%p) nb_channels=%d size=%lu active=%p\n", + __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0), + pcdev->active); + + list_add_tail(&buf->queue, &pcdev->capture); + + pxa_dma_add_tail_buf(pcdev, buf); +} + +/* + * Please check the DMA prepared buffer structure in : + * Documentation/video4linux/pxa_camera.txt + * Please check also in pxa_camera_check_link_miss() to understand why DMA chain + * modification while DMA chain is running will work anyway. + */ +static int pxac_vb2_prepare(struct vb2_buffer *vb) +{ + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); + struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); + struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); + int ret = 0; + + switch (pcdev->channels) { + case 1: + case 3: + vb2_set_plane_payload(vb, 0, icd->sizeimage); + break; + default: + return -EINVAL; + } + + dev_dbg(pcdev_to_dev(pcdev), + "%s (vb=%p) nb_channels=%d size=%lu\n", + __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0)); + + WARN_ON(!icd->current_fmt); + +#ifdef DEBUG + /* + * This can be useful if you want to see if we actually fill + * the buffer with something + */ + for (i = 0; i < vb->num_planes; i++) + memset((void *)vb2_plane_vaddr(vb, i), + 0xaa, vb2_get_plane_payload(vb, i)); +#endif + + /* + * I think, in buf_prepare you only have to protect global data, + * the actual buffer is yours + */ + buf->inwork = 0; + pxa_videobuf_set_actdma(pcdev, buf); + + return ret; +} + +static int pxac_vb2_init(struct vb2_buffer *vb) +{ + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); + struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); + + dev_dbg(pcdev_to_dev(pcdev), + "%s(nb_channels=%d)\n", + __func__, pcdev->channels); + + return pxa_buffer_init(pcdev, buf); +} + +static int pxac_vb2_queue_setup(struct vb2_queue *vq, + unsigned int *nbufs, + unsigned int *num_planes, unsigned int sizes[], + struct device *alloc_devs[]) +{ + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); + struct soc_camera_device *icd = soc_camera_from_vb2q(vq); + int size = icd->sizeimage; + + dev_dbg(pcdev_to_dev(pcdev), + "%s(vq=%p nbufs=%d num_planes=%d size=%d)\n", + __func__, vq, *nbufs, *num_planes, size); + /* + * Called from VIDIOC_REQBUFS or in compatibility mode For YUV422P + * format, even if there are 3 planes Y, U and V, we reply there is only + * one plane, containing Y, U and V data, one after the other. + */ + if (*num_planes) + return sizes[0] < size ? -EINVAL : 0; + + *num_planes = 1; + switch (pcdev->channels) { + case 1: + case 3: + sizes[0] = size; + break; + default: + return -EINVAL; + } + + if (!*nbufs) + *nbufs = 1; + + return 0; +} + +static int pxac_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) +{ + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); + + dev_dbg(pcdev_to_dev(pcdev), "%s(count=%d) active=%p\n", + __func__, count, pcdev->active); + + if (!pcdev->active) + pxa_camera_start_capture(pcdev); + + return 0; +} + +static void pxac_vb2_stop_streaming(struct vb2_queue *vq) +{ + vb2_wait_for_all_buffers(vq); +} + +static struct vb2_ops pxac_vb2_ops = { + .queue_setup = pxac_vb2_queue_setup, + .buf_init = pxac_vb2_init, + .buf_prepare = pxac_vb2_prepare, + .buf_queue = pxac_vb2_queue, + .buf_cleanup = pxac_vb2_cleanup, + .start_streaming = pxac_vb2_start_streaming, + .stop_streaming = pxac_vb2_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, +}; + +static int pxa_camera_init_videobuf2(struct vb2_queue *vq, + struct soc_camera_device *icd) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); + struct pxa_camera_dev *pcdev = ici->priv; + int ret; + + vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; + vq->drv_priv = pcdev; + vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; + vq->buf_struct_size = sizeof(struct pxa_buffer); + + vq->ops = &pxac_vb2_ops; + vq->mem_ops = &vb2_dma_sg_memops; + + ret = vb2_queue_init(vq); + dev_dbg(pcdev_to_dev(pcdev), + "vb2_queue_init(vq=%p): %d\n", vq, ret); + + return ret; +} + +/* + * Video ioctls section + */ static int pxa_camera_set_bus_param(struct soc_camera_device *icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); @@ -1501,6 +1507,9 @@ static int pxa_camera_querycap(struct soc_camera_host *ici, return 0; } +/* + * Driver probe, remove, suspend and resume operations + */ static int pxa_camera_suspend(struct device *dev) { struct soc_camera_host *ici = to_soc_camera_host(dev); From b36bcbd6f2ddb9454346397e7baf4ca00b2d8077 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:16 -0300 Subject: [PATCH 370/591] [media] media: platform: pxa_camera: introduce sensor_call Introduce sensor_call(), which will be used for all sensor invocations. This is a preparation move to v4l2 device conversion, ie. soc_camera adherence removal. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/platform/soc_camera/pxa_camera.c | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 62e3f69a17ec..3091ec708a46 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -168,6 +168,9 @@ CICR0_PERRM | CICR0_QDM | CICR0_CDM | CICR0_SOFM | \ CICR0_EOFM | CICR0_FOM) +#define sensor_call(cam, o, f, args...) \ + v4l2_subdev_call(sd, o, f, ##args) + /* * Structures */ @@ -731,7 +734,7 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, struct v4l2_subdev *sd = soc_camera_to_subdev(icd); unsigned long dw, bpp; u32 cicr0, cicr1, cicr2, cicr3, cicr4 = 0, y_skip_top; - int ret = v4l2_subdev_call(sd, sensor, g_skip_top_lines, &y_skip_top); + int ret = sensor_call(pcdev, sensor, g_skip_top_lines, &y_skip_top); if (ret < 0) y_skip_top = 0; @@ -1073,7 +1076,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd) if (ret < 0) return ret; - ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg); + ret = sensor_call(pcdev, video, g_mbus_config, &cfg); if (!ret) { common_flags = soc_mbus_config_compatible(&cfg, bus_flags); @@ -1117,7 +1120,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd) } cfg.flags = common_flags; - ret = v4l2_subdev_call(sd, video, s_mbus_config, &cfg); + ret = sensor_call(pcdev, video, s_mbus_config, &cfg); if (ret < 0 && ret != -ENOIOCTLCMD) { dev_dbg(icd->parent, "camera s_mbus_config(0x%lx) returned %d\n", common_flags, ret); @@ -1144,7 +1147,7 @@ static int pxa_camera_try_bus_param(struct soc_camera_device *icd, if (ret < 0) return ret; - ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg); + ret = sensor_call(pcdev, video, g_mbus_config, &cfg); if (!ret) { common_flags = soc_mbus_config_compatible(&cfg, bus_flags); @@ -1195,7 +1198,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id }; const struct soc_mbus_pixelfmt *fmt; - ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code); + ret = sensor_call(pcdev, pad, enum_mbus_code, NULL, &code); if (ret < 0) /* No more formats */ return 0; @@ -1303,7 +1306,7 @@ static int pxa_camera_set_selection(struct soc_camera_device *icd, if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) icd->sense = &sense; - ret = v4l2_subdev_call(sd, pad, set_selection, NULL, &sdsel); + ret = sensor_call(pcdev, pad, set_selection, NULL, &sdsel); icd->sense = NULL; @@ -1314,7 +1317,7 @@ static int pxa_camera_set_selection(struct soc_camera_device *icd, } sel->r = sdsel.r; - ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); + ret = sensor_call(pcdev, pad, get_fmt, NULL, &fmt); if (ret < 0) return ret; @@ -1326,7 +1329,7 @@ static int pxa_camera_set_selection(struct soc_camera_device *icd, v4l_bound_align_image(&mf->width, 48, 2048, 1, &mf->height, 32, 2048, 0, fourcc == V4L2_PIX_FMT_YUV422P ? 4 : 0); - ret = v4l2_subdev_call(sd, pad, set_fmt, NULL, &fmt); + ret = sensor_call(pcdev, pad, set_fmt, NULL, &fmt); if (ret < 0) return ret; @@ -1391,7 +1394,7 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, mf->colorspace = pix->colorspace; mf->code = xlate->code; - ret = v4l2_subdev_call(sd, pad, set_fmt, NULL, &format); + ret = sensor_call(pcdev, pad, set_fmt, NULL, &format); if (mf->code != xlate->code) return -EINVAL; @@ -1466,7 +1469,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, mf->colorspace = pix->colorspace; mf->code = xlate->code; - ret = v4l2_subdev_call(sd, pad, set_fmt, &pad_cfg, &format); + ret = sensor_call(pcdev, pad, set_fmt, &pad_cfg, &format); if (ret < 0) return ret; @@ -1524,7 +1527,7 @@ static int pxa_camera_suspend(struct device *dev) if (pcdev->soc_host.icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(pcdev->soc_host.icd); - ret = v4l2_subdev_call(sd, core, s_power, 0); + ret = sensor_call(pcdev, core, s_power, 0); if (ret == -ENOIOCTLCMD) ret = 0; } @@ -1546,7 +1549,7 @@ static int pxa_camera_resume(struct device *dev) if (pcdev->soc_host.icd) { struct v4l2_subdev *sd = soc_camera_to_subdev(pcdev->soc_host.icd); - ret = v4l2_subdev_call(sd, core, s_power, 1); + ret = sensor_call(pcdev, core, s_power, 1); if (ret == -ENOIOCTLCMD) ret = 0; } From 295ab497d6357300f06f8d8571fbecc590edb435 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:17 -0300 Subject: [PATCH 371/591] [media] media: platform: pxa_camera: make printk consistent Make all print consistent by always using : - dev_xxx(pcdev_to_dev(pcdev), ....) This prepares the soc_camera adherence removal by making these call rely on only pcdev, and not the soc_camera icd structure. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/platform/soc_camera/pxa_camera.c | 70 ++++++++++++------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 3091ec708a46..026ed308fea8 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -236,6 +236,14 @@ struct pxa_cam { static const char *pxa_cam_driver_description = "PXA_Camera"; +static struct pxa_camera_dev *icd_to_pcdev(struct soc_camera_device *icd) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); + struct pxa_camera_dev *pcdev = ici->priv; + + return pcdev; +} + /* * Videobuf operations */ @@ -465,7 +473,6 @@ static void pxa_camera_check_link_miss(struct pxa_camera_dev *pcdev, static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, enum pxa_camera_active_dma act_dma) { - struct device *dev = pcdev_to_dev(pcdev); struct pxa_buffer *buf, *last_buf; unsigned long flags; u32 camera_status, overrun; @@ -476,7 +483,7 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, spin_lock_irqsave(&pcdev->lock, flags); camera_status = __raw_readl(pcdev->base + CISR); - dev_dbg(dev, "camera dma irq, cisr=0x%x dma=%d\n", + dev_dbg(pcdev_to_dev(pcdev), "camera dma irq, cisr=0x%x dma=%d\n", camera_status, act_dma); overrun = CISR_IFO_0; if (pcdev->channels == 3) @@ -522,7 +529,7 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, NULL, &last_issued); if (camera_status & overrun && last_status != DMA_COMPLETE) { - dev_dbg(dev, "FIFO overrun! CISR: %x\n", + dev_dbg(pcdev_to_dev(pcdev), "FIFO overrun! CISR: %x\n", camera_status); pxa_camera_stop_capture(pcdev); list_for_each_entry(buf, &pcdev->capture, queue) @@ -545,7 +552,6 @@ static u32 mclk_get_divisor(struct platform_device *pdev, struct pxa_camera_dev *pcdev) { unsigned long mclk = pcdev->mclk; - struct device *dev = &pdev->dev; u32 div; unsigned long lcdclk; @@ -555,7 +561,8 @@ static u32 mclk_get_divisor(struct platform_device *pdev, /* mclk <= ciclk / 4 (27.4.2) */ if (mclk > lcdclk / 4) { mclk = lcdclk / 4; - dev_warn(dev, "Limiting master clock to %lu\n", mclk); + dev_warn(pcdev_to_dev(pcdev), + "Limiting master clock to %lu\n", mclk); } /* We verify mclk != 0, so if anyone breaks it, here comes their Oops */ @@ -565,7 +572,7 @@ static u32 mclk_get_divisor(struct platform_device *pdev, if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) pcdev->mclk = lcdclk / (2 * (div + 1)); - dev_dbg(dev, "LCD clock %luHz, target freq %luHz, divisor %u\n", + dev_dbg(pcdev_to_dev(pcdev), "LCD clock %luHz, target freq %luHz, divisor %u\n", lcdclk, mclk, div); return div; @@ -662,7 +669,9 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) static int pxa_camera_add_device(struct soc_camera_device *icd) { - dev_info(icd->parent, "PXA Camera driver attached to camera %d\n", + struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); + + dev_info(pcdev_to_dev(pcdev), "PXA Camera driver attached to camera %d\n", icd->devnum); return 0; @@ -670,7 +679,9 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) static void pxa_camera_remove_device(struct soc_camera_device *icd) { - dev_info(icd->parent, "PXA Camera driver detached from camera %d\n", + struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); + + dev_info(pcdev_to_dev(pcdev), "PXA Camera driver detached from camera %d\n", icd->devnum); } @@ -1081,7 +1092,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd) common_flags = soc_mbus_config_compatible(&cfg, bus_flags); if (!common_flags) { - dev_warn(icd->parent, + dev_warn(pcdev_to_dev(pcdev), "Flags incompatible: camera 0x%x, host 0x%lx\n", cfg.flags, bus_flags); return -EINVAL; @@ -1122,7 +1133,7 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd) cfg.flags = common_flags; ret = sensor_call(pcdev, video, s_mbus_config, &cfg); if (ret < 0 && ret != -ENOIOCTLCMD) { - dev_dbg(icd->parent, "camera s_mbus_config(0x%lx) returned %d\n", + dev_dbg(pcdev_to_dev(pcdev), "camera s_mbus_config(0x%lx) returned %d\n", common_flags, ret); return ret; } @@ -1152,7 +1163,7 @@ static int pxa_camera_try_bus_param(struct soc_camera_device *icd, common_flags = soc_mbus_config_compatible(&cfg, bus_flags); if (!common_flags) { - dev_warn(icd->parent, + dev_warn(pcdev_to_dev(pcdev), "Flags incompatible: camera 0x%x, host 0x%lx\n", cfg.flags, bus_flags); return -EINVAL; @@ -1189,7 +1200,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id struct soc_camera_format_xlate *xlate) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct device *dev = icd->parent; + struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); int formats = 0, ret; struct pxa_cam *cam; struct v4l2_subdev_mbus_code_enum code = { @@ -1205,7 +1216,7 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id fmt = soc_mbus_get_fmtdesc(code.code); if (!fmt) { - dev_err(dev, "Invalid format code #%u: %d\n", idx, code.code); + dev_err(pcdev_to_dev(pcdev), "Invalid format code #%u: %d\n", idx, code.code); return 0; } @@ -1231,7 +1242,8 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id xlate->host_fmt = &pxa_camera_formats[0]; xlate->code = code.code; xlate++; - dev_dbg(dev, "Providing format %s using code %d\n", + dev_dbg(pcdev_to_dev(pcdev), + "Providing format %s using code %d\n", pxa_camera_formats[0].name, code.code); } case MEDIA_BUS_FMT_VYUY8_2X8: @@ -1240,14 +1252,15 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id case MEDIA_BUS_FMT_RGB565_2X8_LE: case MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE: if (xlate) - dev_dbg(dev, "Providing format %s packed\n", + dev_dbg(pcdev_to_dev(pcdev), + "Providing format %s packed\n", fmt->name); break; default: if (!pxa_camera_packing_supported(fmt)) return 0; if (xlate) - dev_dbg(dev, + dev_dbg(pcdev_to_dev(pcdev), "Providing format %s in pass-through mode\n", fmt->name); } @@ -1311,7 +1324,7 @@ static int pxa_camera_set_selection(struct soc_camera_device *icd, icd->sense = NULL; if (ret < 0) { - dev_warn(dev, "Failed to crop to %ux%u@%u:%u\n", + dev_warn(pcdev_to_dev(pcdev), "Failed to crop to %ux%u@%u:%u\n", rect->width, rect->height, rect->left, rect->top); return ret; } @@ -1334,7 +1347,7 @@ static int pxa_camera_set_selection(struct soc_camera_device *icd, return ret; if (pxa_camera_check_frame(mf->width, mf->height)) { - dev_warn(icd->parent, + dev_warn(pcdev_to_dev(pcdev), "Inconsistent state. Use S_FMT to repair\n"); return -EINVAL; } @@ -1342,7 +1355,7 @@ static int pxa_camera_set_selection(struct soc_camera_device *icd, if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { if (sense.pixel_clock > sense.pixel_clock_max) { - dev_err(dev, + dev_err(pcdev_to_dev(pcdev), "pixel clock %lu set by the camera too high!", sense.pixel_clock); return -EIO; @@ -1379,7 +1392,8 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); if (!xlate) { - dev_warn(dev, "Format %x not found\n", pix->pixelformat); + dev_warn(pcdev_to_dev(pcdev), + "Format %x not found\n", pix->pixelformat); return -EINVAL; } @@ -1402,16 +1416,17 @@ static int pxa_camera_set_fmt(struct soc_camera_device *icd, icd->sense = NULL; if (ret < 0) { - dev_warn(dev, "Failed to configure for format %x\n", + dev_warn(pcdev_to_dev(pcdev), + "Failed to configure for format %x\n", pix->pixelformat); } else if (pxa_camera_check_frame(mf->width, mf->height)) { - dev_warn(dev, + dev_warn(pcdev_to_dev(pcdev), "Camera driver produced an unsupported frame %dx%d\n", mf->width, mf->height); ret = -EINVAL; } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { if (sense.pixel_clock > sense.pixel_clock_max) { - dev_err(dev, + dev_err(pcdev_to_dev(pcdev), "pixel clock %lu set by the camera too high!", sense.pixel_clock); return -EIO; @@ -1435,6 +1450,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); + struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_subdev_pad_config pad_cfg; @@ -1447,7 +1463,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); if (!xlate) { - dev_warn(icd->parent, "Format %x not found\n", pixfmt); + dev_warn(pcdev_to_dev(pcdev), "Format %x not found\n", pixfmt); return -EINVAL; } @@ -1484,7 +1500,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, break; default: /* TODO: support interlaced at least in pass-through mode */ - dev_err(icd->parent, "Field type %d unsupported.\n", + dev_err(pcdev_to_dev(pcdev), "Field type %d unsupported.\n", mf->field); return -EINVAL; } @@ -1593,13 +1609,13 @@ static int pxa_camera_pdata_from_dt(struct device *dev, np = of_graph_get_next_endpoint(np, NULL); if (!np) { - dev_err(dev, "could not find endpoint\n"); + dev_err(pcdev_to_dev(pcdev), "could not find endpoint\n"); return -EINVAL; } err = v4l2_of_parse_endpoint(np, &ep); if (err) { - dev_err(dev, "could not parse endpoint\n"); + dev_err(pcdev_to_dev(pcdev), "could not parse endpoint\n"); goto out; } From 61634976a9876220f96b821eab2c80556aa5294f Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:18 -0300 Subject: [PATCH 372/591] [media] media: platform: pxa_camera: add buffer sequencing Add sequence numbers to completed buffers. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/soc_camera/pxa_camera.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 026ed308fea8..d9e2570d3931 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -223,6 +223,7 @@ struct pxa_camera_dev { struct list_head capture; spinlock_t lock; + unsigned int buf_sequence; struct pxa_buffer *active; struct tasklet_struct task_eof; @@ -423,10 +424,13 @@ static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, struct pxa_buffer *buf) { struct vb2_buffer *vb = &buf->vbuf.vb2_buf; + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); /* _init is used to debug races, see comment in pxa_camera_reqbufs() */ list_del_init(&buf->queue); vb->timestamp = ktime_get_ns(); + vbuf->sequence = pcdev->buf_sequence++; + vbuf->field = V4L2_FIELD_NONE; vb2_buffer_done(vb, VB2_BUF_STATE_DONE); dev_dbg(pcdev_to_dev(pcdev), "%s dequeud buffer (buf=0x%p)\n", __func__, buf); @@ -1022,6 +1026,7 @@ static int pxac_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) dev_dbg(pcdev_to_dev(pcdev), "%s(count=%d) active=%p\n", __func__, count, pcdev->active); + pcdev->buf_sequence = 0; if (!pcdev->active) pxa_camera_start_capture(pcdev); From 226ad6a18f511cfe285cc26a2334cc4257f9ddba Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:19 -0300 Subject: [PATCH 373/591] [media] media: platform: pxa_camera: remove set_selection This is to be seen as a regression as the set_selection (former set_crop) function is removed. This is a temporary situation in the v4l2 porting, and will have to be added later. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/platform/soc_camera/pxa_camera.c | 83 ------------------- 1 file changed, 83 deletions(-) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index d9e2570d3931..8f329d0b2cda 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -1294,88 +1294,6 @@ static int pxa_camera_check_frame(u32 width, u32 height) (width & 0x01); } -static int pxa_camera_set_selection(struct soc_camera_device *icd, - struct v4l2_selection *sel) -{ - const struct v4l2_rect *rect = &sel->r; - struct device *dev = icd->parent; - struct soc_camera_host *ici = to_soc_camera_host(dev); - struct pxa_camera_dev *pcdev = ici->priv; - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct soc_camera_sense sense = { - .master_clock = pcdev->mclk, - .pixel_clock_max = pcdev->ciclk / 4, - }; - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - struct v4l2_mbus_framefmt *mf = &fmt.format; - struct pxa_cam *cam = icd->host_priv; - u32 fourcc = icd->current_fmt->host_fmt->fourcc; - struct v4l2_subdev_selection sdsel = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - .target = sel->target, - .flags = sel->flags, - .r = sel->r, - }; - int ret; - - /* If PCLK is used to latch data from the sensor, check sense */ - if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) - icd->sense = &sense; - - ret = sensor_call(pcdev, pad, set_selection, NULL, &sdsel); - - icd->sense = NULL; - - if (ret < 0) { - dev_warn(pcdev_to_dev(pcdev), "Failed to crop to %ux%u@%u:%u\n", - rect->width, rect->height, rect->left, rect->top); - return ret; - } - sel->r = sdsel.r; - - ret = sensor_call(pcdev, pad, get_fmt, NULL, &fmt); - if (ret < 0) - return ret; - - if (pxa_camera_check_frame(mf->width, mf->height)) { - /* - * Camera cropping produced a frame beyond our capabilities. - * FIXME: just extract a subframe, that we can process. - */ - v4l_bound_align_image(&mf->width, 48, 2048, 1, - &mf->height, 32, 2048, 0, - fourcc == V4L2_PIX_FMT_YUV422P ? 4 : 0); - ret = sensor_call(pcdev, pad, set_fmt, NULL, &fmt); - if (ret < 0) - return ret; - - if (pxa_camera_check_frame(mf->width, mf->height)) { - dev_warn(pcdev_to_dev(pcdev), - "Inconsistent state. Use S_FMT to repair\n"); - return -EINVAL; - } - } - - if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { - if (sense.pixel_clock > sense.pixel_clock_max) { - dev_err(pcdev_to_dev(pcdev), - "pixel clock %lu set by the camera too high!", - sense.pixel_clock); - return -EIO; - } - recalculate_fifo_timeout(pcdev, sense.pixel_clock); - } - - icd->user_width = mf->width; - icd->user_height = mf->height; - - pxa_camera_setup_cicr(icd, cam->flags, fourcc); - - return ret; -} - static int pxa_camera_set_fmt(struct soc_camera_device *icd, struct v4l2_format *f) { @@ -1588,7 +1506,6 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = { .remove = pxa_camera_remove_device, .clock_start = pxa_camera_clock_start, .clock_stop = pxa_camera_clock_stop, - .set_selection = pxa_camera_set_selection, .get_formats = pxa_camera_get_formats, .put_formats = pxa_camera_put_formats, .set_fmt = pxa_camera_set_fmt, From 283e4a82999f48c61495436b9bbd0357a3268f9d Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:20 -0300 Subject: [PATCH 374/591] [media] media: platform: pxa_camera: make a standalone v4l2 device This patch removes the soc_camera API dependency from pxa_camera. In the current status : - all previously captures are working the same on pxa270 - the s_crop() call was removed, judged not working (see what happens soc_camera_s_crop() when get_crop() == NULL) - if the pixel clock is provided by then sensor, ie. not MCLK, the dual stage change is not handled yet. => there is no in-tree user of this, so I'll let it that way - the MCLK is not yet finished, it's as in the legacy way, ie. activated at video device opening and closed at video device closing. In a subsequence patch pxa_camera_mclk_ops should be used, and platform data MCLK ignored. It will be the sensor's duty to request the clock and enable it, which will end in pxa_camera_mclk_ops. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/soc_camera/Kconfig | 2 +- .../media/platform/soc_camera/pxa_camera.c | 763 ++++++++++++------ .../linux/platform_data/media/camera-pxa.h | 2 + 3 files changed, 523 insertions(+), 244 deletions(-) diff --git a/drivers/media/platform/soc_camera/Kconfig b/drivers/media/platform/soc_camera/Kconfig index de1767899ddc..6b87b3a9d546 100644 --- a/drivers/media/platform/soc_camera/Kconfig +++ b/drivers/media/platform/soc_camera/Kconfig @@ -19,7 +19,7 @@ config SOC_CAMERA_PLATFORM config VIDEO_PXA27x tristate "PXA27x Quick Capture Interface driver" - depends on VIDEO_DEV && PXA27x && SOC_CAMERA && HAS_DMA + depends on VIDEO_DEV && PXA27x && HAS_DMA select VIDEOBUF2_DMA_SG select SG_SPLIT ---help--- diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 8f329d0b2cda..395cd398c32b 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -3,6 +3,7 @@ * * Copyright (C) 2006, Sascha Hauer, Pengutronix * Copyright (C) 2008, Guennadi Liakhovetski + * Copyright (C) 2016, Robert Jarzmik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -14,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -32,13 +35,16 @@ #include #include +#include +#include #include -#include -#include -#include -#include +#include +#include #include +#include +#include + #include #include @@ -46,6 +52,9 @@ #define PXA_CAM_VERSION "0.0.6" #define PXA_CAM_DRV_NAME "pxa27x-camera" +#define DEFAULT_WIDTH 640 +#define DEFAULT_HEIGHT 480 + /* Camera Interface */ #define CICR0 0x0000 #define CICR1 0x0004 @@ -169,7 +178,25 @@ CICR0_EOFM | CICR0_FOM) #define sensor_call(cam, o, f, args...) \ - v4l2_subdev_call(sd, o, f, ##args) + v4l2_subdev_call(cam->sensor, o, f, ##args) + +/* + * Format handling + */ +/** + * struct soc_camera_format_xlate - match between host and sensor formats + * @code: code of a sensor provided format + * @host_fmt: host format after host translation from code + * + * Host and sensor translation structure. Used in table of host and sensor + * formats matchings in soc_camera_device. A host can override the generic list + * generation by implementing get_formats(), and use it for format checks and + * format setup. + */ +struct soc_camera_format_xlate { + u32 code; + const struct soc_mbus_pixelfmt *host_fmt; +}; /* * Structures @@ -198,7 +225,18 @@ struct pxa_buffer { }; struct pxa_camera_dev { - struct soc_camera_host soc_host; + struct v4l2_device v4l2_dev; + struct video_device vdev; + struct v4l2_async_notifier notifier; + struct vb2_queue vb2_vq; + struct v4l2_subdev *sensor; + struct soc_camera_format_xlate *user_formats; + const struct soc_camera_format_xlate *current_fmt; + struct v4l2_pix_format current_pix; + + struct v4l2_async_subdev asd; + struct v4l2_async_subdev *asds[1]; + /* * PXA27x is only supposed to handle one camera on its Quick Capture * interface. If anyone ever builds hardware to enable more than @@ -218,11 +256,13 @@ struct pxa_camera_dev { unsigned long ciclk; unsigned long mclk; u32 mclk_divisor; + struct v4l2_clk *mclk_clk; u16 width_flags; /* max 10 bits */ struct list_head capture; spinlock_t lock; + struct mutex mlock; unsigned int buf_sequence; struct pxa_buffer *active; @@ -237,12 +277,69 @@ struct pxa_cam { static const char *pxa_cam_driver_description = "PXA_Camera"; -static struct pxa_camera_dev *icd_to_pcdev(struct soc_camera_device *icd) +/* + * Format translation functions + */ +const struct soc_camera_format_xlate *soc_mbus_xlate_by_fourcc( + struct soc_camera_format_xlate *user_formats, unsigned int fourcc) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct pxa_camera_dev *pcdev = ici->priv; + unsigned int i; - return pcdev; + for (i = 0; user_formats[i].code; i++) + if (user_formats[i].host_fmt->fourcc == fourcc) + return user_formats + i; + return NULL; +} + +static struct soc_camera_format_xlate *soc_mbus_build_fmts_xlate( + struct v4l2_device *v4l2_dev, struct v4l2_subdev *subdev, + int (*get_formats)(struct v4l2_device *, unsigned int, + struct soc_camera_format_xlate *xlate)) +{ + unsigned int i, fmts = 0, raw_fmts = 0; + int ret; + struct v4l2_subdev_mbus_code_enum code = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct soc_camera_format_xlate *user_formats; + + while (!v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL, &code)) { + raw_fmts++; + code.index++; + } + + /* + * First pass - only count formats this host-sensor + * configuration can provide + */ + for (i = 0; i < raw_fmts; i++) { + ret = get_formats(v4l2_dev, i, NULL); + if (ret < 0) + return ERR_PTR(ret); + fmts += ret; + } + + if (!fmts) + return ERR_PTR(-ENXIO); + + user_formats = kcalloc(fmts + 1, sizeof(*user_formats), GFP_KERNEL); + if (!user_formats) + return ERR_PTR(-ENOMEM); + + /* Second pass - actually fill data formats */ + fmts = 0; + for (i = 0; i < raw_fmts; i++) { + ret = get_formats(v4l2_dev, i, user_formats + fmts); + if (ret < 0) + goto egfmt; + fmts += ret; + } + user_formats[fmts].code = 0; + + return user_formats; +egfmt: + kfree(user_formats); + return ERR_PTR(ret); } /* @@ -257,7 +354,12 @@ static struct pxa_buffer *vb2_to_pxa_buffer(struct vb2_buffer *vb) static struct device *pcdev_to_dev(struct pxa_camera_dev *pcdev) { - return pcdev->soc_host.v4l2_dev.dev; + return pcdev->v4l2_dev.dev; +} + +static struct pxa_camera_dev *v4l2_dev_to_pcdev(struct v4l2_device *v4l2_dev) +{ + return container_of(v4l2_dev, struct pxa_camera_dev, v4l2_dev); } static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, @@ -338,7 +440,7 @@ static void pxa_videobuf_set_actdma(struct pxa_camera_dev *pcdev, struct pxa_buffer *buf) { buf->active_dma = DMA_Y; - if (pcdev->channels == 3) + if (buf->nb_planes == 3) buf->active_dma |= DMA_U | DMA_V; } @@ -671,51 +773,6 @@ static irqreturn_t pxa_camera_irq(int irq, void *data) return IRQ_HANDLED; } -static int pxa_camera_add_device(struct soc_camera_device *icd) -{ - struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); - - dev_info(pcdev_to_dev(pcdev), "PXA Camera driver attached to camera %d\n", - icd->devnum); - - return 0; -} - -static void pxa_camera_remove_device(struct soc_camera_device *icd) -{ - struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); - - dev_info(pcdev_to_dev(pcdev), "PXA Camera driver detached from camera %d\n", - icd->devnum); -} - -/* - * The following two functions absolutely depend on the fact, that - * there can be only one camera on PXA quick capture interface - * Called with .host_lock held - */ -static int pxa_camera_clock_start(struct soc_camera_host *ici) -{ - struct pxa_camera_dev *pcdev = ici->priv; - - pxa_camera_activate(pcdev); - - return 0; -} - -/* Called with .host_lock held */ -static void pxa_camera_clock_stop(struct soc_camera_host *ici) -{ - struct pxa_camera_dev *pcdev = ici->priv; - - /* disable capture, disable interrupts */ - __raw_writel(0x3ff, pcdev->base + CICR0); - - /* Stop DMA engine */ - pxa_dma_stop_channels(pcdev); - pxa_camera_deactivate(pcdev); -} - static int test_platform_param(struct pxa_camera_dev *pcdev, unsigned char buswidth, unsigned long *flags) { @@ -741,12 +798,9 @@ static int test_platform_param(struct pxa_camera_dev *pcdev, return -EINVAL; } -static void pxa_camera_setup_cicr(struct soc_camera_device *icd, +static void pxa_camera_setup_cicr(struct pxa_camera_dev *pcdev, unsigned long flags, __u32 pixfmt) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct pxa_camera_dev *pcdev = ici->priv; - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); unsigned long dw, bpp; u32 cicr0, cicr1, cicr2, cicr3, cicr4 = 0, y_skip_top; int ret = sensor_call(pcdev, sensor, g_skip_top_lines, &y_skip_top); @@ -758,7 +812,7 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, * Datawidth is now guaranteed to be equal to one of the three values. * We fix bit-per-pixel equal to data-width... */ - switch (icd->current_fmt->host_fmt->bits_per_sample) { + switch (pcdev->current_fmt->host_fmt->bits_per_sample) { case 10: dw = 4; bpp = 0x40; @@ -792,7 +846,7 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, if (cicr0 & CICR0_ENB) __raw_writel(cicr0 & ~CICR0_ENB, pcdev->base + CICR0); - cicr1 = CICR1_PPL_VAL(icd->user_width - 1) | bpp | dw; + cicr1 = CICR1_PPL_VAL(pcdev->current_pix.width - 1) | bpp | dw; switch (pixfmt) { case V4L2_PIX_FMT_YUV422P: @@ -821,7 +875,7 @@ static void pxa_camera_setup_cicr(struct soc_camera_device *icd, } cicr2 = 0; - cicr3 = CICR3_LPF_VAL(icd->user_height - 1) | + cicr3 = CICR3_LPF_VAL(pcdev->current_pix.height - 1) | CICR3_BFW_VAL(min((u32)255, y_skip_top)); cicr4 |= pcdev->mclk_divisor; @@ -933,13 +987,12 @@ static int pxac_vb2_prepare(struct vb2_buffer *vb) { struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue); struct pxa_buffer *buf = vb2_to_pxa_buffer(vb); - struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); int ret = 0; switch (pcdev->channels) { case 1: case 3: - vb2_set_plane_payload(vb, 0, icd->sizeimage); + vb2_set_plane_payload(vb, 0, pcdev->current_pix.sizeimage); break; default: return -EINVAL; @@ -949,7 +1002,7 @@ static int pxac_vb2_prepare(struct vb2_buffer *vb) "%s (vb=%p) nb_channels=%d size=%lu\n", __func__, vb, pcdev->channels, vb2_get_plane_payload(vb, 0)); - WARN_ON(!icd->current_fmt); + WARN_ON(!pcdev->current_fmt); #ifdef DEBUG /* @@ -989,8 +1042,7 @@ static int pxac_vb2_queue_setup(struct vb2_queue *vq, struct device *alloc_devs[]) { struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); - struct soc_camera_device *icd = soc_camera_from_vb2q(vq); - int size = icd->sizeimage; + int size = pcdev->current_pix.sizeimage; dev_dbg(pcdev_to_dev(pcdev), "%s(vq=%p nbufs=%d num_planes=%d size=%d)\n", @@ -1050,21 +1102,22 @@ static struct vb2_ops pxac_vb2_ops = { .wait_finish = vb2_ops_wait_finish, }; -static int pxa_camera_init_videobuf2(struct vb2_queue *vq, - struct soc_camera_device *icd) +static int pxa_camera_init_videobuf2(struct pxa_camera_dev *pcdev) { - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct pxa_camera_dev *pcdev = ici->priv; int ret; + struct vb2_queue *vq = &pcdev->vb2_vq; + memset(vq, 0, sizeof(*vq)); vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; vq->drv_priv = pcdev; vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; vq->buf_struct_size = sizeof(struct pxa_buffer); + vq->dev = pcdev->v4l2_dev.dev; vq->ops = &pxac_vb2_ops; vq->mem_ops = &vb2_dma_sg_memops; + vq->lock = &pcdev->mlock; ret = vb2_queue_init(vq); dev_dbg(pcdev_to_dev(pcdev), @@ -1076,18 +1129,15 @@ static int pxa_camera_init_videobuf2(struct vb2_queue *vq, /* * Video ioctls section */ -static int pxa_camera_set_bus_param(struct soc_camera_device *icd) +static int pxa_camera_set_bus_param(struct pxa_camera_dev *pcdev) { - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct pxa_camera_dev *pcdev = ici->priv; struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; - u32 pixfmt = icd->current_fmt->host_fmt->fourcc; + u32 pixfmt = pcdev->current_fmt->host_fmt->fourcc; unsigned long bus_flags, common_flags; int ret; - struct pxa_cam *cam = icd->host_priv; - ret = test_platform_param(pcdev, icd->current_fmt->host_fmt->bits_per_sample, + ret = test_platform_param(pcdev, + pcdev->current_fmt->host_fmt->bits_per_sample, &bus_flags); if (ret < 0) return ret; @@ -1138,24 +1188,20 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd) cfg.flags = common_flags; ret = sensor_call(pcdev, video, s_mbus_config, &cfg); if (ret < 0 && ret != -ENOIOCTLCMD) { - dev_dbg(pcdev_to_dev(pcdev), "camera s_mbus_config(0x%lx) returned %d\n", + dev_dbg(pcdev_to_dev(pcdev), + "camera s_mbus_config(0x%lx) returned %d\n", common_flags, ret); return ret; } - cam->flags = common_flags; - - pxa_camera_setup_cicr(icd, common_flags, pixfmt); + pxa_camera_setup_cicr(pcdev, common_flags, pixfmt); return 0; } -static int pxa_camera_try_bus_param(struct soc_camera_device *icd, +static int pxa_camera_try_bus_param(struct pxa_camera_dev *pcdev, unsigned char buswidth) { - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct pxa_camera_dev *pcdev = ici->priv; struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; unsigned long bus_flags, common_flags; int ret = test_platform_param(pcdev, buswidth, &bus_flags); @@ -1201,13 +1247,12 @@ static bool pxa_camera_packing_supported(const struct soc_mbus_pixelfmt *fmt) fmt->packing == SOC_MBUS_PACKING_EXTEND16); } -static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int idx, +static int pxa_camera_get_formats(struct v4l2_device *v4l2_dev, + unsigned int idx, struct soc_camera_format_xlate *xlate) { - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); + struct pxa_camera_dev *pcdev = v4l2_dev_to_pcdev(v4l2_dev); int formats = 0, ret; - struct pxa_cam *cam; struct v4l2_subdev_mbus_code_enum code = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, .index = idx, @@ -1221,25 +1266,16 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id fmt = soc_mbus_get_fmtdesc(code.code); if (!fmt) { - dev_err(pcdev_to_dev(pcdev), "Invalid format code #%u: %d\n", idx, code.code); + dev_err(pcdev_to_dev(pcdev), + "Invalid format code #%u: %d\n", idx, code.code); return 0; } /* This also checks support for the requested bits-per-sample */ - ret = pxa_camera_try_bus_param(icd, fmt->bits_per_sample); + ret = pxa_camera_try_bus_param(pcdev, fmt->bits_per_sample); if (ret < 0) return 0; - if (!icd->host_priv) { - cam = kzalloc(sizeof(*cam), GFP_KERNEL); - if (!cam) - return -ENOMEM; - - icd->host_priv = cam; - } else { - cam = icd->host_priv; - } - switch (code.code) { case MEDIA_BUS_FMT_UYVY8_2X8: formats++; @@ -1281,10 +1317,22 @@ static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int id return formats; } -static void pxa_camera_put_formats(struct soc_camera_device *icd) +static int pxa_camera_build_formats(struct pxa_camera_dev *pcdev) { - kfree(icd->host_priv); - icd->host_priv = NULL; + struct soc_camera_format_xlate *xlate; + + xlate = soc_mbus_build_fmts_xlate(&pcdev->v4l2_dev, pcdev->sensor, + pxa_camera_get_formats); + if (IS_ERR(xlate)) + return PTR_ERR(xlate); + + pcdev->user_formats = xlate; + return 0; +} + +static void pxa_camera_destroy_formats(struct pxa_camera_dev *pcdev) +{ + kfree(pcdev->user_formats); } static int pxa_camera_check_frame(u32 width, u32 height) @@ -1294,86 +1342,44 @@ static int pxa_camera_check_frame(u32 width, u32 height) (width & 0x01); } -static int pxa_camera_set_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) +static int pxac_vidioc_enum_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_fmtdesc *f) { - struct device *dev = icd->parent; - struct soc_camera_host *ici = to_soc_camera_host(dev); - struct pxa_camera_dev *pcdev = ici->priv; - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - const struct soc_camera_format_xlate *xlate = NULL; - struct soc_camera_sense sense = { - .master_clock = pcdev->mclk, - .pixel_clock_max = pcdev->ciclk / 4, - }; - struct v4l2_pix_format *pix = &f->fmt.pix; - struct v4l2_subdev_format format = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - struct v4l2_mbus_framefmt *mf = &format.format; - int ret; + struct pxa_camera_dev *pcdev = video_drvdata(filp); + const struct soc_mbus_pixelfmt *format; + unsigned int idx; - xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); - if (!xlate) { - dev_warn(pcdev_to_dev(pcdev), - "Format %x not found\n", pix->pixelformat); - return -EINVAL; - } - - /* If PCLK is used to latch data from the sensor, check sense */ - if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) - /* The caller holds a mutex. */ - icd->sense = &sense; - - mf->width = pix->width; - mf->height = pix->height; - mf->field = pix->field; - mf->colorspace = pix->colorspace; - mf->code = xlate->code; - - ret = sensor_call(pcdev, pad, set_fmt, NULL, &format); - - if (mf->code != xlate->code) + for (idx = 0; pcdev->user_formats[idx].code; idx++); + if (f->index >= idx) return -EINVAL; - icd->sense = NULL; - - if (ret < 0) { - dev_warn(pcdev_to_dev(pcdev), - "Failed to configure for format %x\n", - pix->pixelformat); - } else if (pxa_camera_check_frame(mf->width, mf->height)) { - dev_warn(pcdev_to_dev(pcdev), - "Camera driver produced an unsupported frame %dx%d\n", - mf->width, mf->height); - ret = -EINVAL; - } else if (sense.flags & SOCAM_SENSE_PCLK_CHANGED) { - if (sense.pixel_clock > sense.pixel_clock_max) { - dev_err(pcdev_to_dev(pcdev), - "pixel clock %lu set by the camera too high!", - sense.pixel_clock); - return -EIO; - } - recalculate_fifo_timeout(pcdev, sense.pixel_clock); - } - - if (ret < 0) - return ret; - - pix->width = mf->width; - pix->height = mf->height; - pix->field = mf->field; - pix->colorspace = mf->colorspace; - icd->current_fmt = xlate; - - return ret; + format = pcdev->user_formats[f->index].host_fmt; + f->pixelformat = format->fourcc; + return 0; } -static int pxa_camera_try_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) +static int pxac_vidioc_g_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *f) { - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct pxa_camera_dev *pcdev = icd_to_pcdev(icd); + struct pxa_camera_dev *pcdev = video_drvdata(filp); + struct v4l2_pix_format *pix = &f->fmt.pix; + + pix->width = pcdev->current_pix.width; + pix->height = pcdev->current_pix.height; + pix->bytesperline = pcdev->current_pix.bytesperline; + pix->sizeimage = pcdev->current_pix.sizeimage; + pix->field = pcdev->current_pix.field; + pix->pixelformat = pcdev->current_fmt->host_fmt->fourcc; + pix->colorspace = pcdev->current_pix.colorspace; + dev_dbg(pcdev_to_dev(pcdev), "current_fmt->fourcc: 0x%08x\n", + pcdev->current_fmt->host_fmt->fourcc); + return 0; +} + +static int pxac_vidioc_try_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *f) +{ + struct pxa_camera_dev *pcdev = video_drvdata(filp); const struct soc_camera_format_xlate *xlate; struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_subdev_pad_config pad_cfg; @@ -1384,7 +1390,7 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, __u32 pixfmt = pix->pixelformat; int ret; - xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); + xlate = soc_mbus_xlate_by_fourcc(pcdev->user_formats, pixfmt); if (!xlate) { dev_warn(pcdev_to_dev(pcdev), "Format %x not found\n", pixfmt); return -EINVAL; @@ -1400,26 +1406,18 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, &pix->height, 32, 2048, 0, pixfmt == V4L2_PIX_FMT_YUV422P ? 4 : 0); - /* limit to sensor capabilities */ - mf->width = pix->width; - mf->height = pix->height; - /* Only progressive video supported so far */ - mf->field = V4L2_FIELD_NONE; - mf->colorspace = pix->colorspace; - mf->code = xlate->code; - + v4l2_fill_mbus_format(mf, pix, xlate->code); ret = sensor_call(pcdev, pad, set_fmt, &pad_cfg, &format); if (ret < 0) return ret; - pix->width = mf->width; - pix->height = mf->height; - pix->colorspace = mf->colorspace; + v4l2_fill_pix_format(pix, mf); + /* Only progressive video supported so far */ switch (mf->field) { case V4L2_FIELD_ANY: case V4L2_FIELD_NONE: - pix->field = V4L2_FIELD_NONE; + pix->field = V4L2_FIELD_NONE; break; default: /* TODO: support interlaced at least in pass-through mode */ @@ -1428,20 +1426,74 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd, return -EINVAL; } + ret = soc_mbus_bytes_per_line(pix->width, xlate->host_fmt); + if (ret < 0) + return ret; + + pix->bytesperline = ret; + ret = soc_mbus_image_size(xlate->host_fmt, pix->bytesperline, + pix->height); + if (ret < 0) + return ret; + + pix->sizeimage = ret; + return 0; +} + +static int pxac_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, + struct v4l2_format *f) +{ + struct pxa_camera_dev *pcdev = video_drvdata(filp); + const struct soc_camera_format_xlate *xlate; + struct v4l2_pix_format *pix = &f->fmt.pix; + struct v4l2_subdev_format format = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + unsigned long flags; + int ret, is_busy; + + dev_dbg(pcdev_to_dev(pcdev), + "s_fmt_vid_cap(pix=%dx%d:%x)\n", + pix->width, pix->height, pix->pixelformat); + + spin_lock_irqsave(&pcdev->lock, flags); + is_busy = pcdev->active || vb2_is_busy(&pcdev->vb2_vq); + spin_unlock_irqrestore(&pcdev->lock, flags); + + if (is_busy) + return -EBUSY; + + ret = pxac_vidioc_try_fmt_vid_cap(filp, priv, f); + if (ret) + return ret; + + xlate = soc_mbus_xlate_by_fourcc(pcdev->user_formats, + pix->pixelformat); + v4l2_fill_mbus_format(&format.format, pix, xlate->code); + ret = sensor_call(pcdev, pad, set_fmt, NULL, &format); + if (ret < 0) { + dev_warn(pcdev_to_dev(pcdev), + "Failed to configure for format %x\n", + pix->pixelformat); + } else if (pxa_camera_check_frame(pix->width, pix->height)) { + dev_warn(pcdev_to_dev(pcdev), + "Camera driver produced an unsupported frame %dx%d\n", + pix->width, pix->height); + return -EINVAL; + } + + pcdev->current_fmt = xlate; + pcdev->current_pix = *pix; + + ret = pxa_camera_set_bus_param(pcdev); return ret; } -static unsigned int pxa_camera_poll(struct file *file, poll_table *pt) +static int pxac_vidioc_querycap(struct file *file, void *priv, + struct v4l2_capability *cap) { - struct soc_camera_device *icd = file->private_data; - - return vb2_poll(&icd->vb2_vidq, file, pt); -} - -static int pxa_camera_querycap(struct soc_camera_host *ici, - struct v4l2_capability *cap) -{ - /* cap->name is set by the firendly caller:-> */ + strlcpy(cap->bus_info, "platform:pxa-camera", sizeof(cap->bus_info)); + strlcpy(cap->driver, PXA_CAM_DRV_NAME, sizeof(cap->driver)); strlcpy(cap->card, pxa_cam_driver_description, sizeof(cap->card)); cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -1449,13 +1501,212 @@ static int pxa_camera_querycap(struct soc_camera_host *ici, return 0; } +static int pxac_vidioc_enum_input(struct file *file, void *priv, + struct v4l2_input *i) +{ + if (i->index > 0) + return -EINVAL; + + i->type = V4L2_INPUT_TYPE_CAMERA; + strlcpy(i->name, "Camera", sizeof(i->name)); + + return 0; +} + +static int pxac_vidioc_g_input(struct file *file, void *priv, unsigned int *i) +{ + *i = 0; + + return 0; +} + +static int pxac_vidioc_s_input(struct file *file, void *priv, unsigned int i) +{ + if (i > 0) + return -EINVAL; + + return 0; +} + +static int pxac_fops_camera_open(struct file *filp) +{ + struct pxa_camera_dev *pcdev = video_drvdata(filp); + int ret; + + mutex_lock(&pcdev->mlock); + ret = v4l2_fh_open(filp); + if (ret < 0) + goto out; + + ret = sensor_call(pcdev, core, s_power, 1); + if (ret) + v4l2_fh_release(filp); +out: + mutex_unlock(&pcdev->mlock); + return ret; +} + +static int pxac_fops_camera_release(struct file *filp) +{ + struct pxa_camera_dev *pcdev = video_drvdata(filp); + int ret; + + ret = vb2_fop_release(filp); + if (ret < 0) + return ret; + + mutex_lock(&pcdev->mlock); + ret = sensor_call(pcdev, core, s_power, 0); + mutex_unlock(&pcdev->mlock); + + return ret; +} + +static const struct v4l2_file_operations pxa_camera_fops = { + .owner = THIS_MODULE, + .open = pxac_fops_camera_open, + .release = pxac_fops_camera_release, + .read = vb2_fop_read, + .poll = vb2_fop_poll, + .mmap = vb2_fop_mmap, + .unlocked_ioctl = video_ioctl2, +}; + +static const struct v4l2_ioctl_ops pxa_camera_ioctl_ops = { + .vidioc_querycap = pxac_vidioc_querycap, + + .vidioc_enum_input = pxac_vidioc_enum_input, + .vidioc_g_input = pxac_vidioc_g_input, + .vidioc_s_input = pxac_vidioc_s_input, + + .vidioc_enum_fmt_vid_cap = pxac_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = pxac_vidioc_g_fmt_vid_cap, + .vidioc_s_fmt_vid_cap = pxac_vidioc_s_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = pxac_vidioc_try_fmt_vid_cap, + + .vidioc_reqbufs = vb2_ioctl_reqbufs, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_expbuf = vb2_ioctl_expbuf, + .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamoff = vb2_ioctl_streamoff, +}; + +static struct v4l2_clk_ops pxa_camera_mclk_ops = { +}; + +static const struct video_device pxa_camera_videodev_template = { + .name = "pxa-camera", + .minor = -1, + .fops = &pxa_camera_fops, + .ioctl_ops = &pxa_camera_ioctl_ops, + .release = video_device_release_empty, + .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING, +}; + +static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_subdev *asd) +{ + int err; + struct v4l2_device *v4l2_dev = notifier->v4l2_dev; + struct pxa_camera_dev *pcdev = v4l2_dev_to_pcdev(v4l2_dev); + struct video_device *vdev = &pcdev->vdev; + struct v4l2_pix_format *pix = &pcdev->current_pix; + struct v4l2_subdev_format format = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct v4l2_mbus_framefmt *mf = &format.format; + + dev_info(pcdev_to_dev(pcdev), "%s(): trying to bind a device\n", + __func__); + mutex_lock(&pcdev->mlock); + *vdev = pxa_camera_videodev_template; + vdev->v4l2_dev = v4l2_dev; + vdev->lock = &pcdev->mlock; + pcdev->sensor = subdev; + pcdev->vdev.queue = &pcdev->vb2_vq; + pcdev->vdev.v4l2_dev = &pcdev->v4l2_dev; + pcdev->vdev.ctrl_handler = subdev->ctrl_handler; + video_set_drvdata(&pcdev->vdev, pcdev); + + err = pxa_camera_build_formats(pcdev); + if (err) { + dev_err(pcdev_to_dev(pcdev), "building formats failed: %d\n", + err); + goto out; + } + + pcdev->current_fmt = pcdev->user_formats; + pix->field = V4L2_FIELD_NONE; + pix->width = DEFAULT_WIDTH; + pix->height = DEFAULT_HEIGHT; + pix->bytesperline = + soc_mbus_bytes_per_line(pix->width, + pcdev->current_fmt->host_fmt); + pix->sizeimage = + soc_mbus_image_size(pcdev->current_fmt->host_fmt, + pix->bytesperline, pix->height); + pix->pixelformat = pcdev->current_fmt->host_fmt->fourcc; + v4l2_fill_mbus_format(mf, pix, pcdev->current_fmt->code); + err = sensor_call(pcdev, pad, set_fmt, NULL, &format); + if (err) + goto out; + + v4l2_fill_pix_format(pix, mf); + pr_info("%s(): colorspace=0x%x pixfmt=0x%x\n", + __func__, pix->colorspace, pix->pixelformat); + + err = pxa_camera_init_videobuf2(pcdev); + if (err) + goto out; + + err = video_register_device(&pcdev->vdev, VFL_TYPE_GRABBER, -1); + if (err) { + v4l2_err(v4l2_dev, "register video device failed: %d\n", err); + pcdev->sensor = NULL; + } else { + dev_info(pcdev_to_dev(pcdev), + "PXA Camera driver attached to camera %s\n", + subdev->name); + } +out: + mutex_unlock(&pcdev->mlock); + return err; +} + +static void pxa_camera_sensor_unbind(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_subdev *asd) +{ + struct pxa_camera_dev *pcdev = v4l2_dev_to_pcdev(notifier->v4l2_dev); + + mutex_lock(&pcdev->mlock); + dev_info(pcdev_to_dev(pcdev), + "PXA Camera driver detached from camera %s\n", + subdev->name); + + /* disable capture, disable interrupts */ + __raw_writel(0x3ff, pcdev->base + CICR0); + + /* Stop DMA engine */ + pxa_dma_stop_channels(pcdev); + + pxa_camera_destroy_formats(pcdev); + video_unregister_device(&pcdev->vdev); + pcdev->sensor = NULL; + + mutex_unlock(&pcdev->mlock); +} + /* * Driver probe, remove, suspend and resume operations */ static int pxa_camera_suspend(struct device *dev) { - struct soc_camera_host *ici = to_soc_camera_host(dev); - struct pxa_camera_dev *pcdev = ici->priv; + struct pxa_camera_dev *pcdev = dev_get_drvdata(dev); int i = 0, ret = 0; pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR0); @@ -1464,8 +1715,7 @@ static int pxa_camera_suspend(struct device *dev) pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR3); pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR4); - if (pcdev->soc_host.icd) { - struct v4l2_subdev *sd = soc_camera_to_subdev(pcdev->soc_host.icd); + if (pcdev->sensor) { ret = sensor_call(pcdev, core, s_power, 0); if (ret == -ENOIOCTLCMD) ret = 0; @@ -1476,8 +1726,7 @@ static int pxa_camera_suspend(struct device *dev) static int pxa_camera_resume(struct device *dev) { - struct soc_camera_host *ici = to_soc_camera_host(dev); - struct pxa_camera_dev *pcdev = ici->priv; + struct pxa_camera_dev *pcdev = dev_get_drvdata(dev); int i = 0, ret = 0; __raw_writel(pcdev->save_cicr[i++] & ~CICR0_ENB, pcdev->base + CICR0); @@ -1486,8 +1735,7 @@ static int pxa_camera_resume(struct device *dev) __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR3); __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR4); - if (pcdev->soc_host.icd) { - struct v4l2_subdev *sd = soc_camera_to_subdev(pcdev->soc_host.icd); + if (pcdev->sensor) { ret = sensor_call(pcdev, core, s_power, 1); if (ret == -ENOIOCTLCMD) ret = 0; @@ -1500,27 +1748,12 @@ static int pxa_camera_resume(struct device *dev) return ret; } -static struct soc_camera_host_ops pxa_soc_camera_host_ops = { - .owner = THIS_MODULE, - .add = pxa_camera_add_device, - .remove = pxa_camera_remove_device, - .clock_start = pxa_camera_clock_start, - .clock_stop = pxa_camera_clock_stop, - .get_formats = pxa_camera_get_formats, - .put_formats = pxa_camera_put_formats, - .set_fmt = pxa_camera_set_fmt, - .try_fmt = pxa_camera_try_fmt, - .init_videobuf2 = pxa_camera_init_videobuf2, - .poll = pxa_camera_poll, - .querycap = pxa_camera_querycap, - .set_bus_param = pxa_camera_set_bus_param, -}; - static int pxa_camera_pdata_from_dt(struct device *dev, - struct pxa_camera_dev *pcdev) + struct pxa_camera_dev *pcdev, + struct v4l2_async_subdev *asd) { u32 mclk_rate; - struct device_node *np = dev->of_node; + struct device_node *remote, *np = dev->of_node; struct v4l2_of_endpoint ep; int err = of_property_read_u32(np, "clock-frequency", &mclk_rate); @@ -1531,13 +1764,13 @@ static int pxa_camera_pdata_from_dt(struct device *dev, np = of_graph_get_next_endpoint(np, NULL); if (!np) { - dev_err(pcdev_to_dev(pcdev), "could not find endpoint\n"); + dev_err(dev, "could not find endpoint\n"); return -EINVAL; } err = v4l2_of_parse_endpoint(np, &ep); if (err) { - dev_err(pcdev_to_dev(pcdev), "could not parse endpoint\n"); + dev_err(dev, "could not parse endpoint\n"); goto out; } @@ -1572,6 +1805,15 @@ static int pxa_camera_pdata_from_dt(struct device *dev, if (ep.bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) pcdev->platform_flags |= PXA_CAMERA_PCLK_EN; + asd->match_type = V4L2_ASYNC_MATCH_OF; + remote = of_graph_get_remote_port(np); + if (remote) { + asd->match.of.node = remote; + of_node_put(remote); + } else { + dev_notice(dev, "no remote for %s\n", of_node_full_name(np)); + } + out: of_node_put(np); @@ -1590,6 +1832,7 @@ static int pxa_camera_probe(struct platform_device *pdev) }; dma_cap_mask_t mask; struct pxad_param params; + char clk_name[V4L2_CLK_NAME_SIZE]; int irq; int err = 0, i; @@ -1612,10 +1855,14 @@ static int pxa_camera_probe(struct platform_device *pdev) pcdev->pdata = pdev->dev.platform_data; if (&pdev->dev.of_node && !pcdev->pdata) { - err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev); + err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev, &pcdev->asd); } else { pcdev->platform_flags = pcdev->pdata->flags; pcdev->mclk = pcdev->pdata->mclk_10khz * 10000; + pcdev->asd.match_type = V4L2_ASYNC_MATCH_I2C; + pcdev->asd.match.i2c.adapter_id = + pcdev->pdata->sensor_i2c_adapter_id; + pcdev->asd.match.i2c.address = pcdev->pdata->sensor_i2c_address; } if (err < 0) return err; @@ -1647,6 +1894,7 @@ static int pxa_camera_probe(struct platform_device *pdev) INIT_LIST_HEAD(&pcdev->capture); spin_lock_init(&pcdev->lock); + mutex_init(&pcdev->mlock); /* * Request the regions. @@ -1709,19 +1957,48 @@ static int pxa_camera_probe(struct platform_device *pdev) goto exit_free_dma; } - pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; - pcdev->soc_host.ops = &pxa_soc_camera_host_ops; - pcdev->soc_host.priv = pcdev; - pcdev->soc_host.v4l2_dev.dev = &pdev->dev; - pcdev->soc_host.nr = pdev->id; tasklet_init(&pcdev->task_eof, pxa_camera_eof, (unsigned long)pcdev); - err = soc_camera_host_register(&pcdev->soc_host); + pxa_camera_activate(pcdev); + + dev_set_drvdata(&pdev->dev, pcdev); + err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev); if (err) goto exit_free_dma; - return 0; + pcdev->asds[0] = &pcdev->asd; + pcdev->notifier.subdevs = pcdev->asds; + pcdev->notifier.num_subdevs = 1; + pcdev->notifier.bound = pxa_camera_sensor_bound; + pcdev->notifier.unbind = pxa_camera_sensor_unbind; + if (!of_have_populated_dt()) + pcdev->asd.match_type = V4L2_ASYNC_MATCH_I2C; + + err = pxa_camera_init_videobuf2(pcdev); + if (err) + goto exit_free_v4l2dev; + + if (pcdev->mclk) { + v4l2_clk_name_i2c(clk_name, sizeof(clk_name), + pcdev->asd.match.i2c.adapter_id, + pcdev->asd.match.i2c.address); + + pcdev->mclk_clk = v4l2_clk_register(&pxa_camera_mclk_ops, + clk_name, NULL); + if (IS_ERR(pcdev->mclk_clk)) + return PTR_ERR(pcdev->mclk_clk); + } + + err = v4l2_async_notifier_register(&pcdev->v4l2_dev, &pcdev->notifier); + if (err) + goto exit_free_clk; + + return 0; +exit_free_clk: + v4l2_clk_unregister(pcdev->mclk_clk); +exit_free_v4l2dev: + v4l2_device_unregister(&pcdev->v4l2_dev); exit_free_dma: dma_release_channel(pcdev->dma_chans[2]); exit_free_dma_u: @@ -1733,15 +2010,15 @@ exit_free_dma_y: static int pxa_camera_remove(struct platform_device *pdev) { - struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); - struct pxa_camera_dev *pcdev = container_of(soc_host, - struct pxa_camera_dev, soc_host); + struct pxa_camera_dev *pcdev = dev_get_drvdata(&pdev->dev); + pxa_camera_deactivate(pcdev); dma_release_channel(pcdev->dma_chans[0]); dma_release_channel(pcdev->dma_chans[1]); dma_release_channel(pcdev->dma_chans[2]); - soc_camera_host_unregister(soc_host); + v4l2_clk_unregister(pcdev->mclk_clk); + v4l2_device_unregister(&pcdev->v4l2_dev); dev_info(&pdev->dev, "PXA Camera driver unloaded\n"); diff --git a/include/linux/platform_data/media/camera-pxa.h b/include/linux/platform_data/media/camera-pxa.h index 6709b1cd7c77..ce5d90e1a6e4 100644 --- a/include/linux/platform_data/media/camera-pxa.h +++ b/include/linux/platform_data/media/camera-pxa.h @@ -37,6 +37,8 @@ struct pxacamera_platform_data { unsigned long flags; unsigned long mclk_10khz; + int sensor_i2c_adapter_id; + int sensor_i2c_address; }; extern void pxa_set_camera_info(struct pxacamera_platform_data *); From cdd657eb441ceb3b938ed0664d90ce07fbde3139 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:21 -0300 Subject: [PATCH 375/591] [media] media: platform: pxa_camera: add debug register access Add pxa_camera registers access through advanced video debugging. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/platform/soc_camera/pxa_camera.c | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index 395cd398c32b..fb89b85f59ab 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -1342,6 +1342,34 @@ static int pxa_camera_check_frame(u32 width, u32 height) (width & 0x01); } +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int pxac_vidioc_g_register(struct file *file, void *priv, + struct v4l2_dbg_register *reg) +{ + struct pxa_camera_dev *pcdev = video_drvdata(file); + + if (reg->reg > CIBR2) + return -ERANGE; + + reg->val = __raw_readl(pcdev->base + reg->reg); + reg->size = sizeof(__u32); + return 0; +} + +static int pxac_vidioc_s_register(struct file *file, void *priv, + const struct v4l2_dbg_register *reg) +{ + struct pxa_camera_dev *pcdev = video_drvdata(file); + + if (reg->reg > CIBR2) + return -ERANGE; + if (reg->size != sizeof(__u32)) + return -EINVAL; + __raw_writel(reg->val, pcdev->base + reg->reg); + return 0; +} +#endif + static int pxac_vidioc_enum_fmt_vid_cap(struct file *filp, void *priv, struct v4l2_fmtdesc *f) { @@ -1592,6 +1620,10 @@ static const struct v4l2_ioctl_ops pxa_camera_ioctl_ops = { .vidioc_expbuf = vb2_ioctl_expbuf, .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, +#ifdef CONFIG_VIDEO_ADV_DEBUG + .vidioc_g_register = pxac_vidioc_g_register, + .vidioc_s_register = pxac_vidioc_s_register, +#endif }; static struct v4l2_clk_ops pxa_camera_mclk_ops = { From fcdf9bbc912516801722ee5a289f6619e3619a14 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:22 -0300 Subject: [PATCH 376/591] [media] media: platform: pxa_camera: change stop_streaming semantics Instead of the legacy behavior where it was required to wait for all video buffers to be finished by the hardware, use a cancel like strategy : as soon as the stop_streaming() call is done, abort all DMA transfers, report the already buffers as failed and return. This makes stop_streaming() more a "cancel capture" than a "wait for end of capture" semantic. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/soc_camera/pxa_camera.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c index fb89b85f59ab..868c6ad4784c 100644 --- a/drivers/media/platform/soc_camera/pxa_camera.c +++ b/drivers/media/platform/soc_camera/pxa_camera.c @@ -523,7 +523,8 @@ static void pxa_camera_stop_capture(struct pxa_camera_dev *pcdev) } static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, - struct pxa_buffer *buf) + struct pxa_buffer *buf, + enum vb2_buffer_state state) { struct vb2_buffer *vb = &buf->vbuf.vb2_buf; struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); @@ -645,7 +646,7 @@ static void pxa_camera_dma_irq(struct pxa_camera_dev *pcdev, } buf->active_dma &= ~act_dma; if (!buf->active_dma) { - pxa_camera_wakeup(pcdev, buf); + pxa_camera_wakeup(pcdev, buf, VB2_BUF_STATE_DONE); pxa_camera_check_link_miss(pcdev, last_buf->cookie[chan], last_issued); } @@ -1087,7 +1088,15 @@ static int pxac_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) static void pxac_vb2_stop_streaming(struct vb2_queue *vq) { - vb2_wait_for_all_buffers(vq); + struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vq); + struct pxa_buffer *buf, *tmp; + + dev_dbg(pcdev_to_dev(pcdev), "%s active=%p\n", + __func__, pcdev->active); + pxa_camera_stop_capture(pcdev); + + list_for_each_entry_safe(buf, tmp, &pcdev->capture, queue) + pxa_camera_wakeup(pcdev, buf, VB2_BUF_STATE_ERROR); } static struct vb2_ops pxac_vb2_ops = { From 4bb738f228b368d32cd8a430e989a2ccc6a20271 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:23 -0300 Subject: [PATCH 377/591] [media] media: platform: pxa_camera: move pxa_camera out of soc_camera As the conversion to a v4l2 standalone device is finished, move pxa_camera one directory up and finish severing any dependency to soc_camera. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/Kconfig | 8 ++++++++ drivers/media/platform/Makefile | 1 + drivers/media/platform/{soc_camera => }/pxa_camera.c | 0 drivers/media/platform/soc_camera/Kconfig | 8 -------- drivers/media/platform/soc_camera/Makefile | 1 - 5 files changed, 9 insertions(+), 9 deletions(-) rename drivers/media/platform/{soc_camera => }/pxa_camera.c (100%) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 124098560d02..66cf1a857825 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -91,6 +91,14 @@ config VIDEO_OMAP3_DEBUG ---help--- Enable debug messages on OMAP 3 camera controller driver. +config VIDEO_PXA27x + tristate "PXA27x Quick Capture Interface driver" + depends on VIDEO_DEV && PXA27x && HAS_DMA + select VIDEOBUF2_DMA_SG + select SG_SPLIT + ---help--- + This is a v4l2 driver for the PXA27x Quick Capture Interface + config VIDEO_S3C_CAMIF tristate "Samsung S3C24XX/S3C64XX SoC Camera Interface driver" depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index b4ee8aaf6d88..c645a50bea5e 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/ obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/ obj-$(CONFIG_VIDEO_OMAP3) += omap3isp/ +obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o soc_camera/soc_mediabus.o obj-$(CONFIG_VIDEO_VIU) += fsl-viu.o diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/pxa_camera.c similarity index 100% rename from drivers/media/platform/soc_camera/pxa_camera.c rename to drivers/media/platform/pxa_camera.c diff --git a/drivers/media/platform/soc_camera/Kconfig b/drivers/media/platform/soc_camera/Kconfig index 6b87b3a9d546..8b046dc49392 100644 --- a/drivers/media/platform/soc_camera/Kconfig +++ b/drivers/media/platform/soc_camera/Kconfig @@ -17,14 +17,6 @@ config SOC_CAMERA_PLATFORM help This is a generic SoC camera platform driver, useful for testing -config VIDEO_PXA27x - tristate "PXA27x Quick Capture Interface driver" - depends on VIDEO_DEV && PXA27x && HAS_DMA - select VIDEOBUF2_DMA_SG - select SG_SPLIT - ---help--- - This is a v4l2 driver for the PXA27x Quick Capture Interface - config VIDEO_RCAR_VIN_OLD tristate "R-Car Video Input (VIN) support (DEPRECATED)" depends on VIDEO_DEV && SOC_CAMERA diff --git a/drivers/media/platform/soc_camera/Makefile b/drivers/media/platform/soc_camera/Makefile index ee8f9a4ae2a4..e189870a333d 100644 --- a/drivers/media/platform/soc_camera/Makefile +++ b/drivers/media/platform/soc_camera/Makefile @@ -7,6 +7,5 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o # soc-camera host drivers have to be linked after camera drivers obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o -obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o obj-$(CONFIG_VIDEO_RCAR_VIN_OLD) += rcar_vin.o From 855f5aa43224f3230dd0e9b50795557b88f464a7 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Tue, 6 Sep 2016 06:04:24 -0300 Subject: [PATCH 378/591] [media] media: platform: pxa_camera: fix style This is a tiny fix for a switch case which quiets 2 checkpatch harmless warnings. The generated code is not affected. Signed-off-by: Robert Jarzmik Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/pxa_camera.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index 868c6ad4784c..c2d1ceaea49b 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -1296,6 +1296,7 @@ static int pxa_camera_get_formats(struct v4l2_device *v4l2_dev, "Providing format %s using code %d\n", pxa_camera_formats[0].name, code.code); } + /* fall through */ case MEDIA_BUS_FMT_VYUY8_2X8: case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YVYU8_2X8: @@ -1313,6 +1314,7 @@ static int pxa_camera_get_formats(struct v4l2_device *v4l2_dev, dev_dbg(pcdev_to_dev(pcdev), "Providing format %s in pass-through mode\n", fmt->name); + break; } /* Generic pass-through */ From 5809ecdd6c3c0d6d568a10280f3736f1f4304930 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 6 Sep 2016 07:37:45 -0300 Subject: [PATCH 379/591] [media] pxa_camera: allow building it if COMPILE_TEST is set Allow building this driver if COMPILE_TEST is set. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 66cf1a857825..f98ed3fd0efd 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -93,7 +93,8 @@ config VIDEO_OMAP3_DEBUG config VIDEO_PXA27x tristate "PXA27x Quick Capture Interface driver" - depends on VIDEO_DEV && PXA27x && HAS_DMA + depends on VIDEO_DEV && HAS_DMA + depends on PXA27x || COMPILE_TEST select VIDEOBUF2_DMA_SG select SG_SPLIT ---help--- From 8f05b34a8be23d483661de181aa77c07d8a1bd58 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 9 Sep 2016 10:58:58 -0300 Subject: [PATCH 380/591] [media] pxa_camera: make soc_mbus_xlate_by_fourcc() static As warned by smatch: drivers/media/platform/pxa_camera.c:283:39: warning: no previous prototype for 'soc_mbus_xlate_by_fourcc' [-Wmissing-prototypes] const struct soc_camera_format_xlate *soc_mbus_xlate_by_fourcc( ^~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/pxa_camera.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index c2d1ceaea49b..733677f06cb4 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -280,8 +280,9 @@ static const char *pxa_cam_driver_description = "PXA_Camera"; /* * Format translation functions */ -const struct soc_camera_format_xlate *soc_mbus_xlate_by_fourcc( - struct soc_camera_format_xlate *user_formats, unsigned int fourcc) +static const struct soc_camera_format_xlate +*soc_mbus_xlate_by_fourcc(struct soc_camera_format_xlate *user_formats, + unsigned int fourcc) { unsigned int i; From ade50f4ff8029a182c16c6418995e6ec569ea9fc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 9 Sep 2016 10:59:57 -0300 Subject: [PATCH 381/591] [media] pxa_camera: remove an unused structure pointer As reported by smatch: drivers/media/platform/pxa_camera.c: In function 'pxa_dma_start_channels': drivers/media/platform/pxa_camera.c:457:21: warning: variable 'active' set but not used [-Wunused-but-set-variable] struct pxa_buffer *active; ^~~~~~ Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/pxa_camera.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index 733677f06cb4..11478364c6d6 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -455,9 +455,6 @@ static void pxa_videobuf_set_actdma(struct pxa_camera_dev *pcdev, static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev) { int i; - struct pxa_buffer *active; - - active = pcdev->active; for (i = 0; i < pcdev->channels; i++) { dev_dbg(pcdev_to_dev(pcdev), From 72e8138c5dc80be9ef2e4623744dc986c8a15037 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 11 Mar 2016 19:47:36 -0300 Subject: [PATCH 382/591] [media] doc-rst: Correct the ordering of LSBs of the 10-bit raw packed formats The 10-bit packed raw bayer format documented that the data of the first pixel of a four-pixel group was found in the first byte and the two highest bits of the fifth byte. This was not entirely correct. The two bits in the fifth byte are the two lowest bits. The second pixel occupies the second byte and third and fourth least significant bits and so on. Signed-off-by: Sakari Ailus Acked-by: Aviv Greenberg Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-srggb10p.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst index a5752b9063e3..cc573c959d82 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst @@ -56,8 +56,8 @@ Each cell is one byte. - G\ :sub:`03high` - - B\ :sub:`00low`\ (bits 7--6) G\ :sub:`01low`\ (bits 5--4) - B\ :sub:`02low`\ (bits 3--2) G\ :sub:`03low`\ (bits 1--0) + - G\ :sub:`03low`\ (bits 7--6) B\ :sub:`02low`\ (bits 5--4) + G\ :sub:`01low`\ (bits 3--2) B\ :sub:`00low`\ (bits 1--0) - .. row 2 @@ -71,8 +71,8 @@ Each cell is one byte. - R\ :sub:`13high` - - G\ :sub:`10low`\ (bits 7--6) R\ :sub:`11low`\ (bits 5--4) - G\ :sub:`12low`\ (bits 3--2) R\ :sub:`13low`\ (bits 1--0) + - R\ :sub:`13low`\ (bits 7--6) G\ :sub:`12low`\ (bits 5--4) + R\ :sub:`11low`\ (bits 3--2) G\ :sub:`10low`\ (bits 1--0) - .. row 3 @@ -86,8 +86,8 @@ Each cell is one byte. - G\ :sub:`23high` - - B\ :sub:`20low`\ (bits 7--6) G\ :sub:`21low`\ (bits 5--4) - B\ :sub:`22low`\ (bits 3--2) G\ :sub:`23low`\ (bits 1--0) + - G\ :sub:`23low`\ (bits 7--6) B\ :sub:`22low`\ (bits 5--4) + G\ :sub:`21low`\ (bits 3--2) B\ :sub:`20low`\ (bits 1--0) - .. row 4 @@ -101,8 +101,8 @@ Each cell is one byte. - R\ :sub:`33high` - - G\ :sub:`30low`\ (bits 7--6) R\ :sub:`31low`\ (bits 5--4) - G\ :sub:`32low`\ (bits 3--2) R\ :sub:`33low`\ (bits 1--0) + - R\ :sub:`33low`\ (bits 7--6) G\ :sub:`32low`\ (bits 5--4) + R\ :sub:`31low`\ (bits 3--2) G\ :sub:`30low`\ (bits 1--0) .. raw:: latex From f5176d3807b3dfba3267cc0b6f4ae4915dc1d7a8 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Thu, 26 May 2016 08:20:42 -0300 Subject: [PATCH 383/591] [media] doc-rst: Fix number of zeroed high order bits in 12-bit raw format defs The number of high order bits in samples was documented to be 6 for 12-bit data. This is clearly wrong, fix it. Signed-off-by: Sakari Ailus Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-srggb12.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst index 109772fd0f23..b2880df4b22f 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst @@ -29,7 +29,7 @@ described as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these formats **Byte Order.** -Each cell is one byte, high 6 bits in high bytes are 0. +Each cell is one byte, high 4 bits in high bytes are 0. From 88646d37dabb3df5030df2f877e91cdb313ff63f Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Mon, 20 Jun 2016 12:53:55 -0300 Subject: [PATCH 384/591] [media] doc-rst: Clean up raw bayer pixel format definitions - Explicitly state that the most significant n bits are zeroed on 10 and 12 bpp formats. - Remove extra comma from the last entry of the format list - Add a missing colon before a list - Use figures versus word numerals consistently Signed-off-by: Sakari Ailus Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-srggb10.rst | 15 ++++++++------- Documentation/media/uapi/v4l/pixfmt-srggb10p.rst | 8 ++++---- Documentation/media/uapi/v4l/pixfmt-srggb12.rst | 5 +++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10.rst index 8af756944fd4..b145c75d19bc 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10.rst @@ -20,15 +20,16 @@ Description =========== These four pixel formats are raw sRGB / Bayer formats with 10 bits per -colour. Each colour component is stored in a 16-bit word, with 6 unused -high bits filled with zeros. Each n-pixel row contains n/2 green samples -and n/2 blue or red samples, with alternating red and blue rows. Bytes -are stored in memory in little endian order. They are conventionally -described as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example -of one of these formats +sample. Each sample is stored in a 16-bit word, with 6 unused +high bits filled with zeros. Each n-pixel row contains n/2 green samples and +n/2 blue or red samples, with alternating red and blue rows. Bytes are +stored in memory in little endian order. They are conventionally described +as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of +these formats: **Byte Order.** -Each cell is one byte, high 6 bits in high bytes are 0. +Each cell is one byte, the 6 most significant bits in the high bytes +are 0. diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst index cc573c959d82..80e345704ae7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst @@ -20,10 +20,10 @@ Description =========== These four pixel formats are packed raw sRGB / Bayer formats with 10 -bits per colour. Every four consecutive colour components are packed -into 5 bytes. Each of the first 4 bytes contain the 8 high order bits of -the pixels, and the fifth byte contains the two least significants bits -of each pixel, in the same order. +bits per sample. Every four consecutive samples are packed into 5 +bytes. Each of the first 4 bytes contain the 8 high order bits +of the pixels, and the 5th byte contains the 2 least significants +bits of each pixel, in the same order. Each n-pixel row contains n/2 green samples and n/2 blue or red samples, with alternating green-red and green-blue rows. They are conventionally diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst index b2880df4b22f..4776f3fb28f1 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst @@ -26,10 +26,11 @@ high bits filled with zeros. Each n-pixel row contains n/2 green samples and n/2 blue or red samples, with alternating red and blue rows. Bytes are stored in memory in little endian order. They are conventionally described as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example -of one of these formats +of one of these formats: **Byte Order.** -Each cell is one byte, high 4 bits in high bytes are 0. +Each cell is one byte, the 4 most significant bits in the high bytes are +0. From 96c59bfbf6298d975d92bf10b815e21702a80d54 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 5 Aug 2016 07:20:21 -0300 Subject: [PATCH 385/591] [media] doc-rst: Unify documentation of the 8-bit bayer formats The other raw bayer formats had a single sample depth dependent definition whereas the 8-bit formats had one page for each. Unify the documentation of the 8-bit formats. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-rgb.rst | 3 - .../media/uapi/v4l/pixfmt-sbggr8.rst | 77 ------------------ .../media/uapi/v4l/pixfmt-sgbrg8.rst | 80 ------------------- .../media/uapi/v4l/pixfmt-sgrbg8.rst | 80 ------------------- .../media/uapi/v4l/pixfmt-srggb8.rst | 38 ++++----- 5 files changed, 20 insertions(+), 258 deletions(-) delete mode 100644 Documentation/media/uapi/v4l/pixfmt-sbggr8.rst delete mode 100644 Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst delete mode 100644 Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-rgb.rst b/Documentation/media/uapi/v4l/pixfmt-rgb.rst index 4b3651cc0a96..9cc980882e80 100644 --- a/Documentation/media/uapi/v4l/pixfmt-rgb.rst +++ b/Documentation/media/uapi/v4l/pixfmt-rgb.rst @@ -11,9 +11,6 @@ RGB Formats :maxdepth: 1 pixfmt-packed-rgb - pixfmt-sbggr8 - pixfmt-sgbrg8 - pixfmt-sgrbg8 pixfmt-srggb8 pixfmt-sbggr16 pixfmt-srggb10 diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst deleted file mode 100644 index e880ba09379c..000000000000 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr8.rst +++ /dev/null @@ -1,77 +0,0 @@ -.. -*- coding: utf-8; mode: rst -*- - -.. _V4L2-PIX-FMT-SBGGR8: - -**************************** -V4L2_PIX_FMT_SBGGR8 ('BA81') -**************************** - -Bayer RGB format - - -Description -=========== - -This is commonly the native format of digital cameras, reflecting the -arrangement of sensors on the CCD device. Only one red, green or blue -value is given for each pixel. Missing components must be interpolated -from neighbouring pixels. From left to right the first row consists of a -blue and green value, the second row of a green and red value. This -scheme repeats to the right and down for every two columns and rows. - -**Byte Order.** -Each cell is one byte. - - -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - start + 0: - - - B\ :sub:`00` - - - G\ :sub:`01` - - - B\ :sub:`02` - - - G\ :sub:`03` - - - .. row 2 - - - start + 4: - - - G\ :sub:`10` - - - R\ :sub:`11` - - - G\ :sub:`12` - - - R\ :sub:`13` - - - .. row 3 - - - start + 8: - - - B\ :sub:`20` - - - G\ :sub:`21` - - - B\ :sub:`22` - - - G\ :sub:`23` - - - .. row 4 - - - start + 12: - - - G\ :sub:`30` - - - R\ :sub:`31` - - - G\ :sub:`32` - - - R\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst b/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst deleted file mode 100644 index 5cd40d611d68..000000000000 --- a/Documentation/media/uapi/v4l/pixfmt-sgbrg8.rst +++ /dev/null @@ -1,80 +0,0 @@ -.. -*- coding: utf-8; mode: rst -*- - -.. _V4L2-PIX-FMT-SGBRG8: - -**************************** -V4L2_PIX_FMT_SGBRG8 ('GBRG') -**************************** - - -Bayer RGB format - - -Description -=========== - -This is commonly the native format of digital cameras, reflecting the -arrangement of sensors on the CCD device. Only one red, green or blue -value is given for each pixel. Missing components must be interpolated -from neighbouring pixels. From left to right the first row consists of a -green and blue value, the second row of a red and green value. This -scheme repeats to the right and down for every two columns and rows. - -**Byte Order.** -Each cell is one byte. - - - - -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - start + 0: - - - G\ :sub:`00` - - - B\ :sub:`01` - - - G\ :sub:`02` - - - B\ :sub:`03` - - - .. row 2 - - - start + 4: - - - R\ :sub:`10` - - - G\ :sub:`11` - - - R\ :sub:`12` - - - G\ :sub:`13` - - - .. row 3 - - - start + 8: - - - G\ :sub:`20` - - - B\ :sub:`21` - - - G\ :sub:`22` - - - B\ :sub:`23` - - - .. row 4 - - - start + 12: - - - R\ :sub:`30` - - - G\ :sub:`31` - - - R\ :sub:`32` - - - G\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst b/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst deleted file mode 100644 index 05a09dbac494..000000000000 --- a/Documentation/media/uapi/v4l/pixfmt-sgrbg8.rst +++ /dev/null @@ -1,80 +0,0 @@ -.. -*- coding: utf-8; mode: rst -*- - -.. _V4L2-PIX-FMT-SGRBG8: - -**************************** -V4L2_PIX_FMT_SGRBG8 ('GRBG') -**************************** - - -Bayer RGB format - - -Description -=========== - -This is commonly the native format of digital cameras, reflecting the -arrangement of sensors on the CCD device. Only one red, green or blue -value is given for each pixel. Missing components must be interpolated -from neighbouring pixels. From left to right the first row consists of a -green and blue value, the second row of a red and green value. This -scheme repeats to the right and down for every two columns and rows. - -**Byte Order.** -Each cell is one byte. - - - - -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - - - - .. row 1 - - - start + 0: - - - G\ :sub:`00` - - - R\ :sub:`01` - - - G\ :sub:`02` - - - R\ :sub:`03` - - - .. row 2 - - - start + 4: - - - B\ :sub:`10` - - - G\ :sub:`11` - - - B\ :sub:`12` - - - G\ :sub:`13` - - - .. row 3 - - - start + 8: - - - G\ :sub:`20` - - - R\ :sub:`21` - - - G\ :sub:`22` - - - R\ :sub:`23` - - - .. row 4 - - - start + 12: - - - B\ :sub:`30` - - - G\ :sub:`31` - - - B\ :sub:`32` - - - G\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb8.rst b/Documentation/media/uapi/v4l/pixfmt-srggb8.rst index 41851bbde2cd..55a1751bfe87 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb8.rst @@ -1,24 +1,26 @@ .. -*- coding: utf-8; mode: rst -*- .. _V4L2-PIX-FMT-SRGGB8: +.. _v4l2-pix-fmt-sbggr8: +.. _v4l2-pix-fmt-sgbrg8: +.. _v4l2-pix-fmt-sgrbg8: -**************************** -V4L2_PIX_FMT_SRGGB8 ('RGGB') -**************************** +*************************************************************************************************************************** +V4L2_PIX_FMT_SRGGB8 ('RGGB'), V4L2_PIX_FMT_SGRBG8 ('GRBG'), V4L2_PIX_FMT_SGBRG8 ('GBRG'), V4L2_PIX_FMT_SBGGR8 ('BA81'), +*************************************************************************************************************************** -Bayer RGB format +8-bit Bayer formats Description =========== -This is commonly the native format of digital cameras, reflecting the -arrangement of sensors on the CCD device. Only one red, green or blue -value is given for each pixel. Missing components must be interpolated -from neighbouring pixels. From left to right the first row consists of a -red and green value, the second row of a green and blue value. This -scheme repeats to the right and down for every two columns and rows. +These four pixel formats are raw sRGB / Bayer formats with 8 bits per +sample. Each sample is stored in a byte. Each n-pixel row contains n/2 +green samples and n/2 blue or red samples, with alternating red and +blue rows. They are conventionally described as GRGR... BGBG..., +RGRG... GBGB..., etc. Below is an example of one of these formats: **Byte Order.** Each cell is one byte. @@ -35,11 +37,11 @@ Each cell is one byte. - start + 0: - - R\ :sub:`00` + - B\ :sub:`00` - G\ :sub:`01` - - R\ :sub:`02` + - B\ :sub:`02` - G\ :sub:`03` @@ -49,21 +51,21 @@ Each cell is one byte. - G\ :sub:`10` - - B\ :sub:`11` + - R\ :sub:`11` - G\ :sub:`12` - - B\ :sub:`13` + - R\ :sub:`13` - .. row 3 - start + 8: - - R\ :sub:`20` + - B\ :sub:`20` - G\ :sub:`21` - - R\ :sub:`22` + - B\ :sub:`22` - G\ :sub:`23` @@ -73,8 +75,8 @@ Each cell is one byte. - G\ :sub:`30` - - B\ :sub:`31` + - R\ :sub:`31` - G\ :sub:`32` - - B\ :sub:`33` + - R\ :sub:`33` From e42c4754181fddbde843197340b1e175ba9e777c Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Thu, 7 Jul 2016 03:10:49 -0300 Subject: [PATCH 386/591] [media] doc-rst: 16-bit BGGR is always 16 bits The V4L2_PIX_FMT_SBGGR16 format is documented to contain samples of fewer than 16 bits. However, we do have specific definitions for smaller sample sizes. Therefore, this note is redundant from the API point of view. Currently only two drivers, am437x and davinci, use the V4L2_PIX_FMT_SBGGR16 pixelformat currently. The sampling precision is understood to be 16 bits in all current cases. Remove the note on sampling precision. Signed-off-by: Sakari Ailus Acked-by: Lad, Prabhakar Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-sbggr16.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst index 801b78ccbc25..e3b53e3b7f2e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst @@ -17,11 +17,6 @@ This format is similar to has a depth of 16 bits. The least significant byte is stored at lower memory addresses (little-endian). -.. note:: - - The actual sampling precision may be lower than 16 bits, - for example 10 bits per pixel with values in tange 0 to 1023. - **Byte Order.** Each cell is one byte. From cfe41359942b933ee0058c73df7dcc00dae64885 Mon Sep 17 00:00:00 2001 From: Jouni Ukkonen Date: Mon, 25 Apr 2016 09:19:10 -0300 Subject: [PATCH 387/591] [media] media: Add 1X14 14-bit raw bayer media bus code definitions The codes will be called: MEDIA_BUS_FMT_SBGGR14_1X14 MEDIA_BUS_FMT_SGBRG14_1X14 MEDIA_BUS_FMT_SGRBG14_1X14 MEDIA_BUS_FMT_SRGGB14_1X14 Signed-off-by: Jouni Ukkonen Signed-off-by: Sakari Ailus Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/subdev-formats.rst | 258 +++++++++++++++++- include/uapi/linux/media-bus-format.h | 6 +- 2 files changed, 262 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 568d5dd56561..273ca484983d 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -2812,7 +2812,7 @@ organization is given as an example for the first pixel only. - Code - - - :cspan:`11` Data organization + - :cspan:`13` Data organization - .. row 2 @@ -2820,6 +2820,10 @@ organization is given as an example for the first pixel only. - - Bit + - 13 + + - 12 + - 11 - 10 @@ -2859,6 +2863,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -2890,6 +2898,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -2921,6 +2933,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -2952,6 +2968,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - r\ :sub:`7` - r\ :sub:`6` @@ -2983,6 +3003,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -3014,6 +3038,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -3045,6 +3073,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -3076,6 +3108,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - r\ :sub:`7` - r\ :sub:`6` @@ -3107,6 +3143,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -3138,6 +3178,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -3169,6 +3213,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -3200,6 +3248,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - r\ :sub:`7` - r\ :sub:`6` @@ -3231,6 +3283,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - 0 - 0 @@ -3260,6 +3316,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -3291,6 +3351,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -3320,6 +3384,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - 0 - 0 @@ -3351,6 +3419,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`9` - b\ :sub:`8` @@ -3380,6 +3452,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`1` - b\ :sub:`0` @@ -3411,6 +3487,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`1` - b\ :sub:`0` @@ -3440,6 +3520,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`9` - b\ :sub:`8` @@ -3467,6 +3551,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - b\ :sub:`9` - b\ :sub:`8` @@ -3498,6 +3586,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - g\ :sub:`9` - g\ :sub:`8` @@ -3529,6 +3621,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - g\ :sub:`9` - g\ :sub:`8` @@ -3560,6 +3656,10 @@ organization is given as an example for the first pixel only. - + - - + + - - + - r\ :sub:`9` - r\ :sub:`8` @@ -3587,6 +3687,10 @@ organization is given as an example for the first pixel only. - 0x3008 - + - - + + - - + - b\ :sub:`11` - b\ :sub:`10` @@ -3618,6 +3722,10 @@ organization is given as an example for the first pixel only. - 0x3010 - + - - + + - - + - g\ :sub:`11` - g\ :sub:`10` @@ -3649,6 +3757,10 @@ organization is given as an example for the first pixel only. - 0x3011 - + - - + + - - + - g\ :sub:`11` - g\ :sub:`10` @@ -3680,6 +3792,150 @@ organization is given as an example for the first pixel only. - 0x3012 - + - - + + - - + + - r\ :sub:`11` + + - r\ :sub:`10` + + - r\ :sub:`9` + + - r\ :sub:`8` + + - r\ :sub:`7` + + - r\ :sub:`6` + + - r\ :sub:`5` + + - r\ :sub:`4` + + - r\ :sub:`3` + + - r\ :sub:`2` + + - r\ :sub:`1` + + - r\ :sub:`0` + + - .. _MEDIA-BUS-FMT-SBGGR14-1X14: + + - MEDIA_BUS_FMT_SBGGR14_1X14 + + - 0x3019 + + - + - b\ :sub:`13` + + - b\ :sub:`12` + + - b\ :sub:`11` + + - b\ :sub:`10` + + - b\ :sub:`9` + + - b\ :sub:`8` + + - b\ :sub:`7` + + - b\ :sub:`6` + + - b\ :sub:`5` + + - b\ :sub:`4` + + - b\ :sub:`3` + + - b\ :sub:`2` + + - b\ :sub:`1` + + - b\ :sub:`0` + + - .. _MEDIA-BUS-FMT-SGBRG14-1X14: + + - MEDIA_BUS_FMT_SGBRG14_1X14 + + - 0x301a + + - + - g\ :sub:`13` + + - g\ :sub:`12` + + - g\ :sub:`11` + + - g\ :sub:`10` + + - g\ :sub:`9` + + - g\ :sub:`8` + + - g\ :sub:`7` + + - g\ :sub:`6` + + - g\ :sub:`5` + + - g\ :sub:`4` + + - g\ :sub:`3` + + - g\ :sub:`2` + + - g\ :sub:`1` + + - g\ :sub:`0` + + - .. _MEDIA-BUS-FMT-SGRBG14-1X14: + + - MEDIA_BUS_FMT_SGRBG14_1X14 + + - 0x301b + + - + - g\ :sub:`13` + + - g\ :sub:`12` + + - g\ :sub:`11` + + - g\ :sub:`10` + + - g\ :sub:`9` + + - g\ :sub:`8` + + - g\ :sub:`7` + + - g\ :sub:`6` + + - g\ :sub:`5` + + - g\ :sub:`4` + + - g\ :sub:`3` + + - g\ :sub:`2` + + - g\ :sub:`1` + + - g\ :sub:`0` + + - .. _MEDIA-BUS-FMT-SRGGB14-1X14: + + - MEDIA_BUS_FMT_SRGGB14_1X14 + + - 0x301c + + - + - r\ :sub:`13` + + - r\ :sub:`12` + - r\ :sub:`11` - r\ :sub:`10` diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h index 190d491d5b13..1dff459ab6ff 100644 --- a/include/uapi/linux/media-bus-format.h +++ b/include/uapi/linux/media-bus-format.h @@ -97,7 +97,7 @@ #define MEDIA_BUS_FMT_YUV10_1X30 0x2016 #define MEDIA_BUS_FMT_AYUV8_1X32 0x2017 -/* Bayer - next is 0x3019 */ +/* Bayer - next is 0x301d */ #define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001 #define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013 #define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002 @@ -122,6 +122,10 @@ #define MEDIA_BUS_FMT_SGBRG12_1X12 0x3010 #define MEDIA_BUS_FMT_SGRBG12_1X12 0x3011 #define MEDIA_BUS_FMT_SRGGB12_1X12 0x3012 +#define MEDIA_BUS_FMT_SBGGR14_1X14 0x3019 +#define MEDIA_BUS_FMT_SGBRG14_1X14 0x301a +#define MEDIA_BUS_FMT_SGRBG14_1X14 0x301b +#define MEDIA_BUS_FMT_SRGGB14_1X14 0x301c /* JPEG compressed formats - next is 0x4002 */ #define MEDIA_BUS_FMT_JPEG_1X8 0x4001 From 82dec0a7db16f7691470b58c28e79a2f65e829c4 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Mon, 27 Jun 2016 11:15:57 -0300 Subject: [PATCH 388/591] [media] media: Add 1X16 16-bit raw bayer media bus code definitions The codes will be called: MEDIA_BUS_FMT_SBGGR16_1X16 MEDIA_BUS_FMT_SGBRG16_1X16 MEDIA_BUS_FMT_SGRBG16_1X16 MEDIA_BUS_FMT_SRGGB16_1X16 Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/subdev-formats.rst | 290 +++++++++++++++++- include/uapi/linux/media-bus-format.h | 6 +- 2 files changed, 294 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 273ca484983d..08d6532b0a26 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -2812,7 +2812,7 @@ organization is given as an example for the first pixel only. - Code - - - :cspan:`13` Data organization + - :cspan:`15` Data organization - .. row 2 @@ -2820,6 +2820,10 @@ organization is given as an example for the first pixel only. - - Bit + - 15 + + - 14 + - 13 - 12 @@ -2867,6 +2871,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -2902,6 +2910,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -2937,6 +2949,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -2972,6 +2988,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - r\ :sub:`7` - r\ :sub:`6` @@ -3007,6 +3027,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -3042,6 +3066,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -3077,6 +3105,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -3112,6 +3144,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - r\ :sub:`7` - r\ :sub:`6` @@ -3147,6 +3183,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -3182,6 +3222,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -3217,6 +3261,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`7` - g\ :sub:`6` @@ -3252,6 +3300,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - r\ :sub:`7` - r\ :sub:`6` @@ -3287,6 +3339,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - 0 - 0 @@ -3320,6 +3376,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -3355,6 +3415,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`7` - b\ :sub:`6` @@ -3388,6 +3452,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - 0 - 0 @@ -3423,6 +3491,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`9` - b\ :sub:`8` @@ -3456,6 +3528,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`1` - b\ :sub:`0` @@ -3491,6 +3567,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`1` - b\ :sub:`0` @@ -3524,6 +3604,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`9` - b\ :sub:`8` @@ -3555,6 +3639,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`9` - b\ :sub:`8` @@ -3590,6 +3678,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`9` - g\ :sub:`8` @@ -3625,6 +3717,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`9` - g\ :sub:`8` @@ -3660,6 +3756,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - r\ :sub:`9` - r\ :sub:`8` @@ -3691,6 +3791,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - b\ :sub:`11` - b\ :sub:`10` @@ -3726,6 +3830,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`11` - g\ :sub:`10` @@ -3761,6 +3869,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - g\ :sub:`11` - g\ :sub:`10` @@ -3796,6 +3908,10 @@ organization is given as an example for the first pixel only. - - + - - + + - - + - r\ :sub:`11` - r\ :sub:`10` @@ -3827,6 +3943,10 @@ organization is given as an example for the first pixel only. - 0x3019 - + - - + + - - + - b\ :sub:`13` - b\ :sub:`12` @@ -3862,6 +3982,10 @@ organization is given as an example for the first pixel only. - 0x301a - + - - + + - - + - g\ :sub:`13` - g\ :sub:`12` @@ -3897,6 +4021,10 @@ organization is given as an example for the first pixel only. - 0x301b - + - - + + - - + - g\ :sub:`13` - g\ :sub:`12` @@ -3932,6 +4060,166 @@ organization is given as an example for the first pixel only. - 0x301c - + - - + + - - + + - r\ :sub:`13` + + - r\ :sub:`12` + + - r\ :sub:`11` + + - r\ :sub:`10` + + - r\ :sub:`9` + + - r\ :sub:`8` + + - r\ :sub:`7` + + - r\ :sub:`6` + + - r\ :sub:`5` + + - r\ :sub:`4` + + - r\ :sub:`3` + + - r\ :sub:`2` + + - r\ :sub:`1` + + - r\ :sub:`0` + + - .. _MEDIA-BUS-FMT-SBGGR16-1X16: + + - MEDIA_BUS_FMT_SBGGR16_1X16 + + - 0x301d + + - + - b\ :sub:`15` + + - b\ :sub:`14` + + - b\ :sub:`13` + + - b\ :sub:`12` + + - b\ :sub:`11` + + - b\ :sub:`10` + + - b\ :sub:`9` + + - b\ :sub:`8` + + - b\ :sub:`7` + + - b\ :sub:`6` + + - b\ :sub:`5` + + - b\ :sub:`4` + + - b\ :sub:`3` + + - b\ :sub:`2` + + - b\ :sub:`1` + + - b\ :sub:`0` + + - .. _MEDIA-BUS-FMT-SGBRG16-1X16: + + - MEDIA_BUS_FMT_SGBRG16_1X16 + + - 0x301e + + - + - g\ :sub:`15` + + - g\ :sub:`14` + + - g\ :sub:`13` + + - g\ :sub:`12` + + - g\ :sub:`11` + + - g\ :sub:`10` + + - g\ :sub:`9` + + - g\ :sub:`8` + + - g\ :sub:`7` + + - g\ :sub:`6` + + - g\ :sub:`5` + + - g\ :sub:`4` + + - g\ :sub:`3` + + - g\ :sub:`2` + + - g\ :sub:`1` + + - g\ :sub:`0` + + - .. _MEDIA-BUS-FMT-SGRBG16-1X16: + + - MEDIA_BUS_FMT_SGRBG16_1X16 + + - 0x301f + + - + - g\ :sub:`15` + + - g\ :sub:`14` + + - g\ :sub:`13` + + - g\ :sub:`12` + + - g\ :sub:`11` + + - g\ :sub:`10` + + - g\ :sub:`9` + + - g\ :sub:`8` + + - g\ :sub:`7` + + - g\ :sub:`6` + + - g\ :sub:`5` + + - g\ :sub:`4` + + - g\ :sub:`3` + + - g\ :sub:`2` + + - g\ :sub:`1` + + - g\ :sub:`0` + + - .. _MEDIA-BUS-FMT-SRGGB16-1X16: + + - MEDIA_BUS_FMT_SRGGB16_1X16 + + - 0x3020 + + - + - r\ :sub:`15` + + - r\ :sub:`14` + - r\ :sub:`13` - r\ :sub:`12` diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h index 1dff459ab6ff..2168759c1287 100644 --- a/include/uapi/linux/media-bus-format.h +++ b/include/uapi/linux/media-bus-format.h @@ -97,7 +97,7 @@ #define MEDIA_BUS_FMT_YUV10_1X30 0x2016 #define MEDIA_BUS_FMT_AYUV8_1X32 0x2017 -/* Bayer - next is 0x301d */ +/* Bayer - next is 0x3021 */ #define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001 #define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013 #define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002 @@ -126,6 +126,10 @@ #define MEDIA_BUS_FMT_SGBRG14_1X14 0x301a #define MEDIA_BUS_FMT_SGRBG14_1X14 0x301b #define MEDIA_BUS_FMT_SRGGB14_1X14 0x301c +#define MEDIA_BUS_FMT_SBGGR16_1X16 0x301d +#define MEDIA_BUS_FMT_SGBRG16_1X16 0x301e +#define MEDIA_BUS_FMT_SGRBG16_1X16 0x301f +#define MEDIA_BUS_FMT_SRGGB16_1X16 0x3020 /* JPEG compressed formats - next is 0x4002 */ #define MEDIA_BUS_FMT_JPEG_1X8 0x4001 From dc3cdbc9d4dc22948d7f934789ee71baba55bc82 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Tue, 6 Sep 2016 07:32:28 -0300 Subject: [PATCH 389/591] [media] smiapp: Add support for 14 and 16 bits per sample depths SMIA++ supports 14 and 16 bits per pixel formats as well. Add support to these formats in the driver. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/smiapp/smiapp-core.c | 8 ++++++++ drivers/media/i2c/smiapp/smiapp.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index d8b78c678f77..44f8c7e10a35 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -328,6 +328,14 @@ static void __smiapp_update_exposure_limits(struct smiapp_sensor *sensor) * orders must be defined. */ static const struct smiapp_csi_data_format smiapp_csi_data_formats[] = { + { MEDIA_BUS_FMT_SGRBG16_1X16, 16, 16, SMIAPP_PIXEL_ORDER_GRBG, }, + { MEDIA_BUS_FMT_SRGGB16_1X16, 16, 16, SMIAPP_PIXEL_ORDER_RGGB, }, + { MEDIA_BUS_FMT_SBGGR16_1X16, 16, 16, SMIAPP_PIXEL_ORDER_BGGR, }, + { MEDIA_BUS_FMT_SGBRG16_1X16, 16, 16, SMIAPP_PIXEL_ORDER_GBRG, }, + { MEDIA_BUS_FMT_SGRBG14_1X14, 14, 14, SMIAPP_PIXEL_ORDER_GRBG, }, + { MEDIA_BUS_FMT_SRGGB14_1X14, 14, 14, SMIAPP_PIXEL_ORDER_RGGB, }, + { MEDIA_BUS_FMT_SBGGR14_1X14, 14, 14, SMIAPP_PIXEL_ORDER_BGGR, }, + { MEDIA_BUS_FMT_SGBRG14_1X14, 14, 14, SMIAPP_PIXEL_ORDER_GBRG, }, { MEDIA_BUS_FMT_SGRBG12_1X12, 12, 12, SMIAPP_PIXEL_ORDER_GRBG, }, { MEDIA_BUS_FMT_SRGGB12_1X12, 12, 12, SMIAPP_PIXEL_ORDER_RGGB, }, { MEDIA_BUS_FMT_SBGGR12_1X12, 12, 12, SMIAPP_PIXEL_ORDER_BGGR, }, diff --git a/drivers/media/i2c/smiapp/smiapp.h b/drivers/media/i2c/smiapp/smiapp.h index c504bd8f36b8..aae72bc87bf7 100644 --- a/drivers/media/i2c/smiapp/smiapp.h +++ b/drivers/media/i2c/smiapp/smiapp.h @@ -151,7 +151,7 @@ struct smiapp_csi_data_format { #define SMIAPP_PADS 2 #define SMIAPP_COMPRESSED_BASE 8 -#define SMIAPP_COMPRESSED_MAX 12 +#define SMIAPP_COMPRESSED_MAX 16 #define SMIAPP_NR_OF_COMPRESSED (SMIAPP_COMPRESSED_MAX - \ SMIAPP_COMPRESSED_BASE + 1) From 68429f50ab60074e58b98010103fcc5bac4afd54 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 3 Nov 2015 00:27:51 -0200 Subject: [PATCH 390/591] [media] media: Move media_device link_notify operation to an ops structure This will allow adding new operations without increasing the media_device structure size for drivers that don't implement any media device operation. Signed-off-by: Laurent Pinchart Signed-off-by: Sakari Ailus Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/media-entity.c | 11 ++++++----- drivers/media/platform/exynos4-is/media-dev.c | 6 +++++- drivers/media/platform/omap3isp/isp.c | 6 +++++- drivers/staging/media/omap4iss/iss.c | 6 +++++- include/media/media-device.h | 16 ++++++++++++---- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 9014362e904d..c68239e60487 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -808,17 +808,18 @@ int __media_entity_setup_link(struct media_link *link, u32 flags) mdev = source->graph_obj.mdev; - if (mdev->link_notify) { - ret = mdev->link_notify(link, flags, - MEDIA_DEV_NOTIFY_PRE_LINK_CH); + if (mdev->ops && mdev->ops->link_notify) { + ret = mdev->ops->link_notify(link, flags, + MEDIA_DEV_NOTIFY_PRE_LINK_CH); if (ret < 0) return ret; } ret = __media_entity_setup_link_notify(link, flags); - if (mdev->link_notify) - mdev->link_notify(link, flags, MEDIA_DEV_NOTIFY_POST_LINK_CH); + if (mdev->ops && mdev->ops->link_notify) + mdev->ops->link_notify(link, flags, + MEDIA_DEV_NOTIFY_POST_LINK_CH); return ret; } diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 891625e77ef5..1a1154a9dfa4 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -1190,6 +1190,10 @@ static int fimc_md_link_notify(struct media_link *link, unsigned int flags, return ret ? -EPIPE : 0; } +static const struct media_device_ops fimc_md_ops = { + .link_notify = fimc_md_link_notify, +}; + static ssize_t fimc_md_sysfs_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1416,7 +1420,7 @@ static int fimc_md_probe(struct platform_device *pdev) strlcpy(fmd->media_dev.model, "SAMSUNG S5P FIMC", sizeof(fmd->media_dev.model)); - fmd->media_dev.link_notify = fimc_md_link_notify; + fmd->media_dev.ops = &fimc_md_ops; fmd->media_dev.dev = dev; v4l2_dev = &fmd->v4l2_dev; diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 5d54e2c6c16b..0321d84addc7 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -657,6 +657,10 @@ static irqreturn_t isp_isr(int irq, void *_isp) return IRQ_HANDLED; } +static const struct media_device_ops isp_media_ops = { + .link_notify = v4l2_pipeline_link_notify, +}; + /* ----------------------------------------------------------------------------- * Pipeline stream management */ @@ -1680,7 +1684,7 @@ static int isp_register_entities(struct isp_device *isp) strlcpy(isp->media_dev.model, "TI OMAP3 ISP", sizeof(isp->media_dev.model)); isp->media_dev.hw_revision = isp->revision; - isp->media_dev.link_notify = v4l2_pipeline_link_notify; + isp->media_dev.ops = &isp_media_ops; media_device_init(&isp->media_dev); isp->v4l2_dev.mdev = &isp->media_dev; diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index 6ceb4eb00493..ffc4900da961 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -362,6 +362,10 @@ static irqreturn_t iss_isr(int irq, void *_iss) return IRQ_HANDLED; } +static const struct media_device_ops iss_media_ops = { + .link_notify = v4l2_pipeline_link_notify, +}; + /* ----------------------------------------------------------------------------- * Pipeline stream management */ @@ -988,7 +992,7 @@ static int iss_register_entities(struct iss_device *iss) strlcpy(iss->media_dev.model, "TI OMAP4 ISS", sizeof(iss->media_dev.model)); iss->media_dev.hw_revision = iss->revision; - iss->media_dev.link_notify = v4l2_pipeline_link_notify; + iss->media_dev.ops = &iss_media_ops; ret = media_device_register(&iss->media_dev); if (ret < 0) { dev_err(iss->dev, "Media device registration failed (%d)\n", diff --git a/include/media/media-device.h b/include/media/media-device.h index 481dd6c672cb..ef93e21335df 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -48,6 +48,16 @@ struct media_entity_notify { void (*notify)(struct media_entity *entity, void *notify_data); }; +/** + * struct media_device_ops - Media device operations + * @link_notify: Link state change notification callback. This callback is + * called with the graph_mutex held. + */ +struct media_device_ops { + int (*link_notify)(struct media_link *link, u32 flags, + unsigned int notification); +}; + /** * struct media_device - Media device * @dev: Parent device @@ -80,8 +90,7 @@ struct media_entity_notify { * @enable_source: Enable Source Handler function pointer * @disable_source: Disable Source Handler function pointer * - * @link_notify: Link state change notification callback. This callback is - * called with the graph_mutex held. + * @ops: Operation handler callbacks * * This structure represents an abstract high-level media device. It allows easy * access to entities and provides basic media device-level support. The @@ -150,8 +159,7 @@ struct media_device { struct media_pipeline *pipe); void (*disable_source)(struct media_entity *entity); - int (*link_notify)(struct media_link *link, u32 flags, - unsigned int notification); + const struct media_device_ops *ops; }; /* We don't need to include pci.h or usb.h here */ From 3933186aec80f66694cbf38ee21bb7011e935dcf Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Mon, 5 Sep 2016 04:09:42 -0300 Subject: [PATCH 391/591] [media] ad5820: Use bool for boolean values The driver used integers for what boolean would have been a better fit. Use boolean instead. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ad5820.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index d7ad5c1a1219..fd4c5f67163d 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -58,7 +58,7 @@ struct ad5820_device { struct mutex power_lock; int power_count; - unsigned int standby : 1; + bool standby; }; static int ad5820_write(struct ad5820_device *coil, u16 data) @@ -108,7 +108,7 @@ static int ad5820_update_hw(struct ad5820_device *coil) /* * Power handling */ -static int ad5820_power_off(struct ad5820_device *coil, int standby) +static int ad5820_power_off(struct ad5820_device *coil, bool standby) { int ret = 0, ret2; @@ -117,7 +117,7 @@ static int ad5820_power_off(struct ad5820_device *coil, int standby) * (single power line control for both coil and sensor). */ if (standby) { - coil->standby = 1; + coil->standby = true; ret = ad5820_update_hw(coil); } @@ -127,7 +127,7 @@ static int ad5820_power_off(struct ad5820_device *coil, int standby) return ret2; } -static int ad5820_power_on(struct ad5820_device *coil, int restore) +static int ad5820_power_on(struct ad5820_device *coil, bool restore) { int ret; @@ -137,7 +137,7 @@ static int ad5820_power_on(struct ad5820_device *coil, int restore) if (restore) { /* Restore the hardware settings. */ - coil->standby = 0; + coil->standby = false; ret = ad5820_update_hw(coil); if (ret) goto fail; @@ -145,7 +145,7 @@ static int ad5820_power_on(struct ad5820_device *coil, int restore) return 0; fail: - coil->standby = 1; + coil->standby = true; regulator_disable(coil->vana); return ret; @@ -227,7 +227,8 @@ ad5820_set_power(struct v4l2_subdev *subdev, int on) * update the power state. */ if (coil->power_count == !on) { - ret = on ? ad5820_power_on(coil, 1) : ad5820_power_off(coil, 1); + ret = on ? ad5820_power_on(coil, true) : + ad5820_power_off(coil, true); if (ret < 0) goto done; } @@ -279,7 +280,7 @@ static int ad5820_suspend(struct device *dev) if (!coil->power_count) return 0; - return ad5820_power_off(coil, 0); + return ad5820_power_off(coil, false); } static int ad5820_resume(struct device *dev) @@ -291,7 +292,7 @@ static int ad5820_resume(struct device *dev) if (!coil->power_count) return 0; - return ad5820_power_on(coil, 1); + return ad5820_power_on(coil, true); } #else From 306dbe5548b4b3cba8fe3c3fa6e08051f85007ab Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Thu, 30 Jun 2016 13:50:28 -0300 Subject: [PATCH 392/591] [media] dt-bindings: Update Renesas R-Car FCP DT bindings for FCPF The FCP driver can also support the FCPF variant for FDP1 compatible processing. Signed-off-by: Kieran Bingham Acked-by: Rob Herring Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- Documentation/devicetree/bindings/media/renesas,fcp.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt b/Documentation/devicetree/bindings/media/renesas,fcp.txt index 6a12960609d8..271dcfdb5a76 100644 --- a/Documentation/devicetree/bindings/media/renesas,fcp.txt +++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt @@ -7,12 +7,14 @@ conversion of AXI transactions in order to reduce the memory bandwidth. There are three types of FCP: FCP for Codec (FCPC), FCP for VSP (FCPV) and FCP for FDP (FCPF). Their configuration and behaviour depend on the module they -are paired with. These DT bindings currently support the FCPV only. +are paired with. These DT bindings currently support the FCPV and FCPF. - compatible: Must be one or more of the following - "renesas,r8a7795-fcpv" for R8A7795 (R-Car H3) compatible 'FCP for VSP' + - "renesas,r8a7795-fcpf" for R8A7795 (R-Car H3) compatible 'FCP for FDP' - "renesas,fcpv" for generic compatible 'FCP for VSP' + - "renesas,fcpf" for generic compatible 'FCP for FDP' When compatible with the generic version, nodes must list the SoC-specific version corresponding to the platform first, followed by the From 147fcfca196d0c16ebe40bcdca18e8f3272a6fda Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Thu, 30 Jun 2016 13:50:29 -0300 Subject: [PATCH 393/591] [media] dt-bindings: Document Renesas R-Car FCP power-domains usage The power domain must be specified to bring the device out of module standby. Document this in the bindings provided, so that new additions are not missed. Signed-off-by: Kieran Bingham Acked-by: Rob Herring Acked-by: Laurent Pinchart Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- Documentation/devicetree/bindings/media/renesas,fcp.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/media/renesas,fcp.txt b/Documentation/devicetree/bindings/media/renesas,fcp.txt index 271dcfdb5a76..27f9b8e459ac 100644 --- a/Documentation/devicetree/bindings/media/renesas,fcp.txt +++ b/Documentation/devicetree/bindings/media/renesas,fcp.txt @@ -23,6 +23,10 @@ are paired with. These DT bindings currently support the FCPV and FCPF. - reg: the register base and size for the device registers - clocks: Reference to the functional clock +Optional properties: + - power-domains : power-domain property defined with a power domain specifier + to respective power domain. + Device node example ------------------- @@ -31,4 +35,5 @@ Device node example compatible = "renesas,r8a7795-fcpv", "renesas,fcpv"; reg = <0 0xfea2f000 0 0x200>; clocks = <&cpg CPG_MOD 602>; + power-domains = <&sysc R8A7795_PD_A3VP>; }; From c49148e87a427e2cfb1fda760534021cfa251f45 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 28 Jun 2016 10:20:10 -0300 Subject: [PATCH 394/591] [media] v4l: ioctl: Clear the v4l2_pix_format_mplane reserved field The S_FMT and TRY_FMT handlers in multiplane mode attempt at clearing the reserved fields of the v4l2_format structure after the pix_mp member. However, the reserved fields are inside pix_mp, not after it. Signed-off-by: Laurent Pinchart Tested-by: Kieran Bingham Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-ioctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index eb6ccc70e9a8..c52d94c018bb 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1504,7 +1504,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: if (unlikely(!is_rx || !is_vid || !ops->vidioc_s_fmt_vid_cap_mplane)) break; - CLEAR_AFTER_FIELD(p, fmt.pix_mp); + CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OVERLAY: if (unlikely(!is_rx || !is_vid || !ops->vidioc_s_fmt_vid_overlay)) @@ -1532,7 +1532,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: if (unlikely(!is_tx || !is_vid || !ops->vidioc_s_fmt_vid_out_mplane)) break; - CLEAR_AFTER_FIELD(p, fmt.pix_mp); + CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: if (unlikely(!is_tx || !is_vid || !ops->vidioc_s_fmt_vid_out_overlay)) @@ -1589,7 +1589,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: if (unlikely(!is_rx || !is_vid || !ops->vidioc_try_fmt_vid_cap_mplane)) break; - CLEAR_AFTER_FIELD(p, fmt.pix_mp); + CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OVERLAY: if (unlikely(!is_rx || !is_vid || !ops->vidioc_try_fmt_vid_overlay)) @@ -1617,7 +1617,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: if (unlikely(!is_tx || !is_vid || !ops->vidioc_try_fmt_vid_out_mplane)) break; - CLEAR_AFTER_FIELD(p, fmt.pix_mp); + CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg); case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: if (unlikely(!is_tx || !is_vid || !ops->vidioc_try_fmt_vid_out_overlay)) From 6eaafbdb668b09b1a06841ccddc405b31c216233 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 9 Aug 2016 12:36:41 -0300 Subject: [PATCH 395/591] [media] v4l: rcar-fcp: Keep the coding style consistent The Renesas multimedia drivers use ret to store return values, fix the only exception in the rcar-fcp driver to keep the coding style consistent. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-fcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c index bc50c69ee0c5..f7bcbf7677a0 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c @@ -99,14 +99,14 @@ EXPORT_SYMBOL_GPL(rcar_fcp_put); */ int rcar_fcp_enable(struct rcar_fcp_device *fcp) { - int error; + int ret; if (!fcp) return 0; - error = pm_runtime_get_sync(fcp->dev); - if (error < 0) - return error; + ret = pm_runtime_get_sync(fcp->dev); + if (ret < 0) + return ret; return 0; } From fd44aa9a254b18176ec3792a18e7de6977030ca8 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 17 Aug 2016 09:57:37 -0300 Subject: [PATCH 396/591] [media] v4l: rcar-fcp: Don't force users to check for disabled FCP support The rcar_fcp_enable() function immediately returns successfully when the FCP device pointer is NULL to avoid forcing the users to check the FCP device manually before every call. However, the stub version of the function used when the FCP driver is disabled returns -ENOSYS unconditionally, resulting in a different API contract for the two versions of the function. As a user that requires FCP support will fail at probe time when calling rcar_fcp_get() if the FCP driver is disabled, the stub version of the rcar_fcp_enable() function will only be called with a NULL FCP device. We can thus return 0 unconditionally to align the behaviour with the normal version of the function. Reported-by: Sergei Shtylyov Signed-off-by: Laurent Pinchart Reviewed-by: Geert Uytterhoeven Signed-off-by: Mauro Carvalho Chehab --- include/media/rcar-fcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h index 4c7fc77eaf29..8723f05c6321 100644 --- a/include/media/rcar-fcp.h +++ b/include/media/rcar-fcp.h @@ -29,7 +29,7 @@ static inline struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np) static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { } static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp) { - return -ENOSYS; + return 0; } static inline void rcar_fcp_disable(struct rcar_fcp_device *fcp) { } #endif From f077aa7774bec90dd0e20708f8d5032a7354bfa3 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Thu, 9 Jun 2016 14:06:43 -0300 Subject: [PATCH 397/591] [media] v4l: rcar-fcp: Extend compatible list to support the FDP The FCP must be powered up for the FDP1 to function, even when the FDP1 does not make use of the FCNL features. Extend the compatible list to allow us to use the power domain and runtime-pm support. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-fcp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c index f7bcbf7677a0..f3a3f31cdfa9 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c @@ -165,6 +165,7 @@ static int rcar_fcp_remove(struct platform_device *pdev) } static const struct of_device_id rcar_fcp_of_match[] = { + { .compatible = "renesas,fcpf" }, { .compatible = "renesas,fcpv" }, { }, }; From 47b4bafd2c510726fd653e7f165634f774e36fb0 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 12 Jul 2016 04:59:52 -0300 Subject: [PATCH 398/591] [media] v4l: vsp1: Report device model and rev through media device information Instead of hardcoding the media device model and hardware revision to "VSP1" and 0 respectively, report the actual hardware device model and IP version number. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1.h | 2 ++ drivers/media/platform/vsp1/vsp1_drv.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h index 06a2ec7e5ad4..b23fa879a9aa 100644 --- a/drivers/media/platform/vsp1/vsp1.h +++ b/drivers/media/platform/vsp1/vsp1.h @@ -53,6 +53,7 @@ struct vsp1_uds; struct vsp1_device_info { u32 version; + const char *model; unsigned int gen; unsigned int features; unsigned int rpf_count; @@ -65,6 +66,7 @@ struct vsp1_device_info { struct vsp1_device { struct device *dev; const struct vsp1_device_info *info; + u32 version; void __iomem *mmio; struct rcar_fcp_device *fcp; diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index cc316d281687..a0f401263bae 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -220,7 +220,8 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) int ret; mdev->dev = vsp1->dev; - strlcpy(mdev->model, "VSP1", sizeof(mdev->model)); + mdev->hw_revision = vsp1->version; + strlcpy(mdev->model, vsp1->info->model, sizeof(mdev->model)); snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s", dev_name(mdev->dev)); media_device_init(mdev); @@ -559,6 +560,7 @@ static const struct dev_pm_ops vsp1_pm_ops = { static const struct vsp1_device_info vsp1_device_infos[] = { { .version = VI6_IP_VERSION_MODEL_VSPS_H2, + .model = "VSP1-S", .gen = 2, .features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP, @@ -569,6 +571,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .uapi = true, }, { .version = VI6_IP_VERSION_MODEL_VSPR_H2, + .model = "VSP1-R", .gen = 2, .features = VSP1_HAS_BRU | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP, .rpf_count = 5, @@ -578,6 +581,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .uapi = true, }, { .version = VI6_IP_VERSION_MODEL_VSPD_GEN2, + .model = "VSP1-D", .gen = 2, .features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_LUT, .rpf_count = 4, @@ -587,6 +591,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .uapi = true, }, { .version = VI6_IP_VERSION_MODEL_VSPS_M2, + .model = "VSP1-S", .gen = 2, .features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP, @@ -597,6 +602,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .uapi = true, }, { .version = VI6_IP_VERSION_MODEL_VSPI_GEN3, + .model = "VSP2-I", .gen = 3, .features = VSP1_HAS_CLU | VSP1_HAS_LUT | VSP1_HAS_SRU | VSP1_HAS_WPF_HFLIP | VSP1_HAS_WPF_VFLIP, @@ -606,6 +612,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .uapi = true, }, { .version = VI6_IP_VERSION_MODEL_VSPBD_GEN3, + .model = "VSP2-BD", .gen = 3, .features = VSP1_HAS_BRU | VSP1_HAS_WPF_VFLIP, .rpf_count = 5, @@ -614,6 +621,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .uapi = true, }, { .version = VI6_IP_VERSION_MODEL_VSPBC_GEN3, + .model = "VSP2-BC", .gen = 3, .features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT | VSP1_HAS_WPF_VFLIP, @@ -623,6 +631,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .uapi = true, }, { .version = VI6_IP_VERSION_MODEL_VSPD_GEN3, + .model = "VSP2-D", .gen = 3, .features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_WPF_VFLIP, .rpf_count = 5, @@ -638,7 +647,6 @@ static int vsp1_probe(struct platform_device *pdev) struct resource *irq; struct resource *io; unsigned int i; - u32 version; int ret; vsp1 = devm_kzalloc(&pdev->dev, sizeof(*vsp1), GFP_KERNEL); @@ -689,11 +697,11 @@ static int vsp1_probe(struct platform_device *pdev) if (ret < 0) goto done; - version = vsp1_read(vsp1, VI6_IP_VERSION); + vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION); pm_runtime_put_sync(&pdev->dev); for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) { - if ((version & VI6_IP_VERSION_MODEL_MASK) == + if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) == vsp1_device_infos[i].version) { vsp1->info = &vsp1_device_infos[i]; break; @@ -701,12 +709,13 @@ static int vsp1_probe(struct platform_device *pdev) } if (!vsp1->info) { - dev_err(&pdev->dev, "unsupported IP version 0x%08x\n", version); + dev_err(&pdev->dev, "unsupported IP version 0x%08x\n", + vsp1->version); ret = -ENXIO; goto done; } - dev_dbg(&pdev->dev, "IP version 0x%08x\n", version); + dev_dbg(&pdev->dev, "IP version 0x%08x\n", vsp1->version); /* Instanciate entities */ ret = vsp1_create_entities(vsp1); From bffba4737bf39542c4cb4d276f4bf18cfa0ffa21 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 18 Aug 2016 10:16:17 -0300 Subject: [PATCH 399/591] [media] v4l: vsp1: Fix tri-planar format support through DRM API The vsp1 driver supports tri-planar formats, but the DRM API only passes two memory addresses. Add a third one. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_drm.c | 6 +++--- include/media/vsp1.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index fe9665e57b3b..06972f612263 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -276,12 +276,12 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, } dev_dbg(vsp1->dev, - "%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma { %pad, %pad } zpos %u\n", + "%s: RPF%u: (%u,%u)/%ux%u -> (%u,%u)/%ux%u (%08x), pitch %u dma { %pad, %pad, %pad } zpos %u\n", __func__, rpf_index, cfg->src.left, cfg->src.top, cfg->src.width, cfg->src.height, cfg->dst.left, cfg->dst.top, cfg->dst.width, cfg->dst.height, cfg->pixelformat, cfg->pitch, &cfg->mem[0], &cfg->mem[1], - cfg->zpos); + &cfg->mem[2], cfg->zpos); /* Store the format, stride, memory buffer address, crop and compose * rectangles and Z-order position and for the input. @@ -301,7 +301,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, rpf->mem.addr[0] = cfg->mem[0]; rpf->mem.addr[1] = cfg->mem[1]; - rpf->mem.addr[2] = 0; + rpf->mem.addr[2] = cfg->mem[2]; vsp1->drm->inputs[rpf_index].crop = cfg->src; vsp1->drm->inputs[rpf_index].compose = cfg->dst; diff --git a/include/media/vsp1.h b/include/media/vsp1.h index 9322d9775fb7..458b400373d4 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -26,7 +26,7 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width, struct vsp1_du_atomic_config { u32 pixelformat; unsigned int pitch; - dma_addr_t mem[2]; + dma_addr_t mem[3]; struct v4l2_rect src; struct v4l2_rect dst; unsigned int alpha; From 8a5a2ba86ab8fc12267fea974b9cd730ad2dee24 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Fri, 19 Aug 2016 18:57:59 -0300 Subject: [PATCH 400/591] [media] v4l: vsp1: Add R8A7792 VSP1V support Add support for the R8A7792 VSP1V cores which are different from the other gen2 VSP1 cores. Signed-off-by: Sergei Shtylyov Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_drv.c | 22 ++++++++++++++++++++++ drivers/media/platform/vsp1/vsp1_regs.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index a0f401263bae..92418fc09511 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -600,6 +600,28 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .wpf_count = 4, .num_bru_inputs = 4, .uapi = true, + }, { + .version = VI6_IP_VERSION_MODEL_VSPS_V2H, + .model = "VSP1V-S", + .gen = 2, + .features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT + | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP, + .rpf_count = 4, + .uds_count = 1, + .wpf_count = 4, + .num_bru_inputs = 4, + .uapi = true, + }, { + .version = VI6_IP_VERSION_MODEL_VSPD_V2H, + .model = "VSP1V-D", + .gen = 2, + .features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT + | VSP1_HAS_LIF, + .rpf_count = 4, + .uds_count = 1, + .wpf_count = 1, + .num_bru_inputs = 4, + .uapi = true, }, { .version = VI6_IP_VERSION_MODEL_VSPI_GEN3, .model = "VSP2-I", diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h index 3b03007ba625..47b1dee044fb 100644 --- a/drivers/media/platform/vsp1/vsp1_regs.h +++ b/drivers/media/platform/vsp1/vsp1_regs.h @@ -660,6 +660,8 @@ #define VI6_IP_VERSION_MODEL_VSPR_H2 (0x0a << 8) #define VI6_IP_VERSION_MODEL_VSPD_GEN2 (0x0b << 8) #define VI6_IP_VERSION_MODEL_VSPS_M2 (0x0c << 8) +#define VI6_IP_VERSION_MODEL_VSPS_V2H (0x12 << 8) +#define VI6_IP_VERSION_MODEL_VSPD_V2H (0x13 << 8) #define VI6_IP_VERSION_MODEL_VSPI_GEN3 (0x14 << 8) #define VI6_IP_VERSION_MODEL_VSPBD_GEN3 (0x15 << 8) #define VI6_IP_VERSION_MODEL_VSPBC_GEN3 (0x16 << 8) From 34b27b13a2cd43e0d27e3ce13b96119efbbbedbc Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 11 Sep 2016 05:51:54 -0300 Subject: [PATCH 401/591] [media] pxa_camera: merge soc_mediabus.c into pxa_camera.c Linking soc_mediabus into this driver causes multiple definition linker warnings if soc_camera is also enabled: drivers/media/platform/soc_camera/built-in.o:(___ksymtab+soc_mbus_image_size+0x0): multiple definition of `__ksymtab_soc_mbus_image_size' drivers/media/platform/soc_camera/soc_mediabus.o:(___ksymtab+soc_mbus_image_size+0x0): first defined here >> drivers/media/platform/soc_camera/built-in.o:(___ksymtab+soc_mbus_samples_per_pixel+0x0): multiple definition of `__ksymtab_soc_mbus_samples_per_pixel' drivers/media/platform/soc_camera/soc_mediabus.o:(___ksymtab+soc_mbus_samples_per_pixel+0x0): first defined here drivers/media/platform/soc_camera/built-in.o: In function `soc_mbus_config_compatible': (.text+0x3840): multiple definition of `soc_mbus_config_compatible' drivers/media/platform/soc_camera/soc_mediabus.o:(.text+0x134): first defined here Since we really don't want to have to use any of the soc-camera code this patch copies the relevant code and data structures from soc_mediabus and renames it to pxa_mbus_*. The large table of formats has been culled a bit, removing formats that are not supported by this driver. Signed-off-by: Hans Verkuil Cc: Robert Jarzmik Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/Makefile | 2 +- drivers/media/platform/pxa_camera.c | 482 ++++++++++++++++++++++++++-- 2 files changed, 459 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index c645a50bea5e..40b18d12726e 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -9,7 +9,7 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/ obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/ obj-$(CONFIG_VIDEO_OMAP3) += omap3isp/ -obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o soc_camera/soc_mediabus.o +obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o obj-$(CONFIG_VIDEO_VIU) += fsl-viu.o diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index 11478364c6d6..1bce7eb62387 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -42,7 +42,6 @@ #include #include -#include #include #include @@ -183,6 +182,441 @@ /* * Format handling */ + +/** + * enum pxa_mbus_packing - data packing types on the media-bus + * @PXA_MBUS_PACKING_NONE: no packing, bit-for-bit transfer to RAM, one + * sample represents one pixel + * @PXA_MBUS_PACKING_2X8_PADHI: 16 bits transferred in 2 8-bit samples, in the + * possibly incomplete byte high bits are padding + * @PXA_MBUS_PACKING_EXTEND16: sample width (e.g., 10 bits) has to be extended + * to 16 bits + */ +enum pxa_mbus_packing { + PXA_MBUS_PACKING_NONE, + PXA_MBUS_PACKING_2X8_PADHI, + PXA_MBUS_PACKING_EXTEND16, +}; + +/** + * enum pxa_mbus_order - sample order on the media bus + * @PXA_MBUS_ORDER_LE: least significant sample first + * @PXA_MBUS_ORDER_BE: most significant sample first + */ +enum pxa_mbus_order { + PXA_MBUS_ORDER_LE, + PXA_MBUS_ORDER_BE, +}; + +/** + * enum pxa_mbus_layout - planes layout in memory + * @PXA_MBUS_LAYOUT_PACKED: color components packed + * @PXA_MBUS_LAYOUT_PLANAR_2Y_U_V: YUV components stored in 3 planes (4:2:2) + * @PXA_MBUS_LAYOUT_PLANAR_2Y_C: YUV components stored in a luma and a + * chroma plane (C plane is half the size + * of Y plane) + * @PXA_MBUS_LAYOUT_PLANAR_Y_C: YUV components stored in a luma and a + * chroma plane (C plane is the same size + * as Y plane) + */ +enum pxa_mbus_layout { + PXA_MBUS_LAYOUT_PACKED = 0, + PXA_MBUS_LAYOUT_PLANAR_2Y_U_V, + PXA_MBUS_LAYOUT_PLANAR_2Y_C, + PXA_MBUS_LAYOUT_PLANAR_Y_C, +}; + +/** + * struct pxa_mbus_pixelfmt - Data format on the media bus + * @name: Name of the format + * @fourcc: Fourcc code, that will be obtained if the data is + * stored in memory in the following way: + * @packing: Type of sample-packing, that has to be used + * @order: Sample order when storing in memory + * @bits_per_sample: How many bits the bridge has to sample + */ +struct pxa_mbus_pixelfmt { + const char *name; + u32 fourcc; + enum pxa_mbus_packing packing; + enum pxa_mbus_order order; + enum pxa_mbus_layout layout; + u8 bits_per_sample; +}; + +/** + * struct pxa_mbus_lookup - Lookup FOURCC IDs by mediabus codes for pass-through + * @code: mediabus pixel-code + * @fmt: pixel format description + */ +struct pxa_mbus_lookup { + u32 code; + struct pxa_mbus_pixelfmt fmt; +}; + +static const struct pxa_mbus_lookup mbus_fmt[] = { +{ + .code = MEDIA_BUS_FMT_YUYV8_2X8, + .fmt = { + .fourcc = V4L2_PIX_FMT_YUYV, + .name = "YUYV", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_YVYU8_2X8, + .fmt = { + .fourcc = V4L2_PIX_FMT_YVYU, + .name = "YVYU", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_UYVY8_2X8, + .fmt = { + .fourcc = V4L2_PIX_FMT_UYVY, + .name = "UYVY", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_VYUY8_2X8, + .fmt = { + .fourcc = V4L2_PIX_FMT_VYUY, + .name = "VYUY", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE, + .fmt = { + .fourcc = V4L2_PIX_FMT_RGB555, + .name = "RGB555", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE, + .fmt = { + .fourcc = V4L2_PIX_FMT_RGB555X, + .name = "RGB555X", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_BE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_RGB565_2X8_LE, + .fmt = { + .fourcc = V4L2_PIX_FMT_RGB565, + .name = "RGB565", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_RGB565_2X8_BE, + .fmt = { + .fourcc = V4L2_PIX_FMT_RGB565X, + .name = "RGB565X", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_BE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SBGGR8_1X8, + .fmt = { + .fourcc = V4L2_PIX_FMT_SBGGR8, + .name = "Bayer 8 BGGR", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_NONE, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SBGGR10_1X10, + .fmt = { + .fourcc = V4L2_PIX_FMT_SBGGR10, + .name = "Bayer 10 BGGR", + .bits_per_sample = 10, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_Y8_1X8, + .fmt = { + .fourcc = V4L2_PIX_FMT_GREY, + .name = "Grey", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_NONE, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_Y10_1X10, + .fmt = { + .fourcc = V4L2_PIX_FMT_Y10, + .name = "Grey 10bit", + .bits_per_sample = 10, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE, + .fmt = { + .fourcc = V4L2_PIX_FMT_SBGGR10, + .name = "Bayer 10 BGGR", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE, + .fmt = { + .fourcc = V4L2_PIX_FMT_SBGGR10, + .name = "Bayer 10 BGGR", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_BE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE, + .fmt = { + .fourcc = V4L2_PIX_FMT_RGB444, + .name = "RGB444", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_BE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_UYVY8_1X16, + .fmt = { + .fourcc = V4L2_PIX_FMT_UYVY, + .name = "UYVY 16bit", + .bits_per_sample = 16, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_VYUY8_1X16, + .fmt = { + .fourcc = V4L2_PIX_FMT_VYUY, + .name = "VYUY 16bit", + .bits_per_sample = 16, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_YUYV8_1X16, + .fmt = { + .fourcc = V4L2_PIX_FMT_YUYV, + .name = "YUYV 16bit", + .bits_per_sample = 16, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_YVYU8_1X16, + .fmt = { + .fourcc = V4L2_PIX_FMT_YVYU, + .name = "YVYU 16bit", + .bits_per_sample = 16, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SGRBG8_1X8, + .fmt = { + .fourcc = V4L2_PIX_FMT_SGRBG8, + .name = "Bayer 8 GRBG", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_NONE, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, + .fmt = { + .fourcc = V4L2_PIX_FMT_SGRBG10DPCM8, + .name = "Bayer 10 BGGR DPCM 8", + .bits_per_sample = 8, + .packing = PXA_MBUS_PACKING_NONE, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SGBRG10_1X10, + .fmt = { + .fourcc = V4L2_PIX_FMT_SGBRG10, + .name = "Bayer 10 GBRG", + .bits_per_sample = 10, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SGRBG10_1X10, + .fmt = { + .fourcc = V4L2_PIX_FMT_SGRBG10, + .name = "Bayer 10 GRBG", + .bits_per_sample = 10, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SRGGB10_1X10, + .fmt = { + .fourcc = V4L2_PIX_FMT_SRGGB10, + .name = "Bayer 10 RGGB", + .bits_per_sample = 10, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SBGGR12_1X12, + .fmt = { + .fourcc = V4L2_PIX_FMT_SBGGR12, + .name = "Bayer 12 BGGR", + .bits_per_sample = 12, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SGBRG12_1X12, + .fmt = { + .fourcc = V4L2_PIX_FMT_SGBRG12, + .name = "Bayer 12 GBRG", + .bits_per_sample = 12, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SGRBG12_1X12, + .fmt = { + .fourcc = V4L2_PIX_FMT_SGRBG12, + .name = "Bayer 12 GRBG", + .bits_per_sample = 12, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, { + .code = MEDIA_BUS_FMT_SRGGB12_1X12, + .fmt = { + .fourcc = V4L2_PIX_FMT_SRGGB12, + .name = "Bayer 12 RGGB", + .bits_per_sample = 12, + .packing = PXA_MBUS_PACKING_EXTEND16, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PACKED, + }, +}, +}; + +static s32 pxa_mbus_bytes_per_line(u32 width, const struct pxa_mbus_pixelfmt *mf) +{ + if (mf->layout != PXA_MBUS_LAYOUT_PACKED) + return width * mf->bits_per_sample / 8; + + switch (mf->packing) { + case PXA_MBUS_PACKING_NONE: + return width * mf->bits_per_sample / 8; + case PXA_MBUS_PACKING_2X8_PADHI: + case PXA_MBUS_PACKING_EXTEND16: + return width * 2; + } + return -EINVAL; +} + +static s32 pxa_mbus_image_size(const struct pxa_mbus_pixelfmt *mf, + u32 bytes_per_line, u32 height) +{ + switch (mf->packing) { + case PXA_MBUS_PACKING_2X8_PADHI: + return bytes_per_line * height * 2; + default: + return -EINVAL; + } +} + +static const struct pxa_mbus_pixelfmt *pxa_mbus_find_fmtdesc( + u32 code, + const struct pxa_mbus_lookup *lookup, + int n) +{ + int i; + + for (i = 0; i < n; i++) + if (lookup[i].code == code) + return &lookup[i].fmt; + + return NULL; +} + +static const struct pxa_mbus_pixelfmt *pxa_mbus_get_fmtdesc( + u32 code) +{ + return pxa_mbus_find_fmtdesc(code, mbus_fmt, ARRAY_SIZE(mbus_fmt)); +} + +static unsigned int pxa_mbus_config_compatible(const struct v4l2_mbus_config *cfg, + unsigned int flags) +{ + unsigned long common_flags; + bool hsync = true, vsync = true, pclk, data, mode; + bool mipi_lanes, mipi_clock; + + common_flags = cfg->flags & flags; + + switch (cfg->type) { + case V4L2_MBUS_PARALLEL: + hsync = common_flags & (V4L2_MBUS_HSYNC_ACTIVE_HIGH | + V4L2_MBUS_HSYNC_ACTIVE_LOW); + vsync = common_flags & (V4L2_MBUS_VSYNC_ACTIVE_HIGH | + V4L2_MBUS_VSYNC_ACTIVE_LOW); + /* fall through */ + case V4L2_MBUS_BT656: + pclk = common_flags & (V4L2_MBUS_PCLK_SAMPLE_RISING | + V4L2_MBUS_PCLK_SAMPLE_FALLING); + data = common_flags & (V4L2_MBUS_DATA_ACTIVE_HIGH | + V4L2_MBUS_DATA_ACTIVE_LOW); + mode = common_flags & (V4L2_MBUS_MASTER | V4L2_MBUS_SLAVE); + return (!hsync || !vsync || !pclk || !data || !mode) ? + 0 : common_flags; + case V4L2_MBUS_CSI2: + mipi_lanes = common_flags & V4L2_MBUS_CSI2_LANES; + mipi_clock = common_flags & (V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK | + V4L2_MBUS_CSI2_CONTINUOUS_CLOCK); + return (!mipi_lanes || !mipi_clock) ? 0 : common_flags; + } + return 0; +} + /** * struct soc_camera_format_xlate - match between host and sensor formats * @code: code of a sensor provided format @@ -195,7 +629,7 @@ */ struct soc_camera_format_xlate { u32 code; - const struct soc_mbus_pixelfmt *host_fmt; + const struct pxa_mbus_pixelfmt *host_fmt; }; /* @@ -281,7 +715,7 @@ static const char *pxa_cam_driver_description = "PXA_Camera"; * Format translation functions */ static const struct soc_camera_format_xlate -*soc_mbus_xlate_by_fourcc(struct soc_camera_format_xlate *user_formats, +*pxa_mbus_xlate_by_fourcc(struct soc_camera_format_xlate *user_formats, unsigned int fourcc) { unsigned int i; @@ -292,7 +726,7 @@ static const struct soc_camera_format_xlate return NULL; } -static struct soc_camera_format_xlate *soc_mbus_build_fmts_xlate( +static struct soc_camera_format_xlate *pxa_mbus_build_fmts_xlate( struct v4l2_device *v4l2_dev, struct v4l2_subdev *subdev, int (*get_formats)(struct v4l2_device *, unsigned int, struct soc_camera_format_xlate *xlate)) @@ -1151,7 +1585,7 @@ static int pxa_camera_set_bus_param(struct pxa_camera_dev *pcdev) ret = sensor_call(pcdev, video, g_mbus_config, &cfg); if (!ret) { - common_flags = soc_mbus_config_compatible(&cfg, + common_flags = pxa_mbus_config_compatible(&cfg, bus_flags); if (!common_flags) { dev_warn(pcdev_to_dev(pcdev), @@ -1218,7 +1652,7 @@ static int pxa_camera_try_bus_param(struct pxa_camera_dev *pcdev, ret = sensor_call(pcdev, video, g_mbus_config, &cfg); if (!ret) { - common_flags = soc_mbus_config_compatible(&cfg, + common_flags = pxa_mbus_config_compatible(&cfg, bus_flags); if (!common_flags) { dev_warn(pcdev_to_dev(pcdev), @@ -1233,25 +1667,25 @@ static int pxa_camera_try_bus_param(struct pxa_camera_dev *pcdev, return ret; } -static const struct soc_mbus_pixelfmt pxa_camera_formats[] = { +static const struct pxa_mbus_pixelfmt pxa_camera_formats[] = { { .fourcc = V4L2_PIX_FMT_YUV422P, .name = "Planar YUV422 16 bit", .bits_per_sample = 8, - .packing = SOC_MBUS_PACKING_2X8_PADHI, - .order = SOC_MBUS_ORDER_LE, - .layout = SOC_MBUS_LAYOUT_PLANAR_2Y_U_V, + .packing = PXA_MBUS_PACKING_2X8_PADHI, + .order = PXA_MBUS_ORDER_LE, + .layout = PXA_MBUS_LAYOUT_PLANAR_2Y_U_V, }, }; /* This will be corrected as we get more formats */ -static bool pxa_camera_packing_supported(const struct soc_mbus_pixelfmt *fmt) +static bool pxa_camera_packing_supported(const struct pxa_mbus_pixelfmt *fmt) { - return fmt->packing == SOC_MBUS_PACKING_NONE || + return fmt->packing == PXA_MBUS_PACKING_NONE || (fmt->bits_per_sample == 8 && - fmt->packing == SOC_MBUS_PACKING_2X8_PADHI) || + fmt->packing == PXA_MBUS_PACKING_2X8_PADHI) || (fmt->bits_per_sample > 8 && - fmt->packing == SOC_MBUS_PACKING_EXTEND16); + fmt->packing == PXA_MBUS_PACKING_EXTEND16); } static int pxa_camera_get_formats(struct v4l2_device *v4l2_dev, @@ -1264,14 +1698,14 @@ static int pxa_camera_get_formats(struct v4l2_device *v4l2_dev, .which = V4L2_SUBDEV_FORMAT_ACTIVE, .index = idx, }; - const struct soc_mbus_pixelfmt *fmt; + const struct pxa_mbus_pixelfmt *fmt; ret = sensor_call(pcdev, pad, enum_mbus_code, NULL, &code); if (ret < 0) /* No more formats */ return 0; - fmt = soc_mbus_get_fmtdesc(code.code); + fmt = pxa_mbus_get_fmtdesc(code.code); if (!fmt) { dev_err(pcdev_to_dev(pcdev), "Invalid format code #%u: %d\n", idx, code.code); @@ -1330,7 +1764,7 @@ static int pxa_camera_build_formats(struct pxa_camera_dev *pcdev) { struct soc_camera_format_xlate *xlate; - xlate = soc_mbus_build_fmts_xlate(&pcdev->v4l2_dev, pcdev->sensor, + xlate = pxa_mbus_build_fmts_xlate(&pcdev->v4l2_dev, pcdev->sensor, pxa_camera_get_formats); if (IS_ERR(xlate)) return PTR_ERR(xlate); @@ -1383,7 +1817,7 @@ static int pxac_vidioc_enum_fmt_vid_cap(struct file *filp, void *priv, struct v4l2_fmtdesc *f) { struct pxa_camera_dev *pcdev = video_drvdata(filp); - const struct soc_mbus_pixelfmt *format; + const struct pxa_mbus_pixelfmt *format; unsigned int idx; for (idx = 0; pcdev->user_formats[idx].code; idx++); @@ -1427,7 +1861,7 @@ static int pxac_vidioc_try_fmt_vid_cap(struct file *filp, void *priv, __u32 pixfmt = pix->pixelformat; int ret; - xlate = soc_mbus_xlate_by_fourcc(pcdev->user_formats, pixfmt); + xlate = pxa_mbus_xlate_by_fourcc(pcdev->user_formats, pixfmt); if (!xlate) { dev_warn(pcdev_to_dev(pcdev), "Format %x not found\n", pixfmt); return -EINVAL; @@ -1463,12 +1897,12 @@ static int pxac_vidioc_try_fmt_vid_cap(struct file *filp, void *priv, return -EINVAL; } - ret = soc_mbus_bytes_per_line(pix->width, xlate->host_fmt); + ret = pxa_mbus_bytes_per_line(pix->width, xlate->host_fmt); if (ret < 0) return ret; pix->bytesperline = ret; - ret = soc_mbus_image_size(xlate->host_fmt, pix->bytesperline, + ret = pxa_mbus_image_size(xlate->host_fmt, pix->bytesperline, pix->height); if (ret < 0) return ret; @@ -1504,7 +1938,7 @@ static int pxac_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, if (ret) return ret; - xlate = soc_mbus_xlate_by_fourcc(pcdev->user_formats, + xlate = pxa_mbus_xlate_by_fourcc(pcdev->user_formats, pix->pixelformat); v4l2_fill_mbus_format(&format.format, pix, xlate->code); ret = sensor_call(pcdev, pad, set_fmt, NULL, &format); @@ -1685,10 +2119,10 @@ static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier, pix->width = DEFAULT_WIDTH; pix->height = DEFAULT_HEIGHT; pix->bytesperline = - soc_mbus_bytes_per_line(pix->width, + pxa_mbus_bytes_per_line(pix->width, pcdev->current_fmt->host_fmt); pix->sizeimage = - soc_mbus_image_size(pcdev->current_fmt->host_fmt, + pxa_mbus_image_size(pcdev->current_fmt->host_fmt, pix->bytesperline, pix->height); pix->pixelformat = pcdev->current_fmt->host_fmt->fourcc; v4l2_fill_mbus_format(mf, pix, pcdev->current_fmt->code); From c3b809834db8b1a8891c7ff873a216eac119628d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 11 Sep 2016 05:57:30 -0300 Subject: [PATCH 402/591] [media] pulse8-cec: fix compiler warning pulse8-cec.c: In function 'pulse8_connect': pulse8-cec.c:447:2: warning: 'pa' may be used uninitialized in this function [-Wmaybe-uninitialized] cec_s_phys_addr(pulse8->adap, pa, false); ^ pulse8-cec.c:609:6: note: 'pa' was declared here u16 pa; ^ As far as I can tell, this can't actually happen. Still, it is better to just initialize it. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/pulse8-cec/pulse8-cec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index cb6a2a3dcc68..13e8f61c0a34 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c @@ -606,7 +606,7 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv) struct pulse8 *pulse8; int err = -ENOMEM; struct cec_log_addrs log_addrs = {}; - u16 pa; + u16 pa = CEC_PHYS_ADDR_INVALID; pulse8 = kzalloc(sizeof(*pulse8), GFP_KERNEL); From 3d8819b761e5bfb25a83b9c843694c19d0a82c94 Mon Sep 17 00:00:00 2001 From: Robert Foss Date: Thu, 8 Sep 2016 18:44:23 -0400 Subject: [PATCH 403/591] Documentation/filesystems: Fixed typo Fixed a -> an typo. Signed-off-by: Robert Foss Acked-by: Kees Cook Signed-off-by: Jonathan Corbet --- Documentation/filesystems/proc.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 68080ad6a75e..fcc1ac094282 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt @@ -145,7 +145,7 @@ Table 1-1: Process specific entries in /proc symbol the task is blocked in - or "0" if not blocked. pagemap Page table stack Report full stack trace, enable via CONFIG_STACKTRACE - smaps a extension based on maps, showing the memory consumption of + smaps an extension based on maps, showing the memory consumption of each mapping and flags associated with it numa_maps an extension based on maps, showing the memory locality and binding policy as well as mem usage (in pages) of each mapping. From b495360e30621e22f7a69a239de0d68bc4e383dd Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 7 Sep 2016 09:12:56 +0200 Subject: [PATCH 404/591] doc-rst:c-domain: fix sphinx version incompatibility The self.indexnode's tuple has changed in sphinx version 1.4, from a former 4 element tuple to a 5 element tuple. https://github.com/sphinx-doc/sphinx/commit/e6a5a3a92e938fcd75866b4227db9e0524d58f7c Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/sphinx/cdomain.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py index 9eb714ada394..5f0c7ed0ddc7 100644 --- a/Documentation/sphinx/cdomain.py +++ b/Documentation/sphinx/cdomain.py @@ -29,11 +29,15 @@ u""" from docutils.parsers.rst import directives +import sphinx from sphinx.domains.c import CObject as Base_CObject from sphinx.domains.c import CDomain as Base_CDomain __version__ = '1.0' +# Get Sphinx version +major, minor, patch = map(int, sphinx.__version__.split(".")) + def setup(app): app.override_domain(CDomain) @@ -85,8 +89,14 @@ class CObject(Base_CObject): indextext = self.get_index_text(name) if indextext: - self.indexnode['entries'].append(('single', indextext, - targetname, '', None)) + if major == 1 and minor < 4: + # indexnode's tuple changed in 1.4 + # https://github.com/sphinx-doc/sphinx/commit/e6a5a3a92e938fcd75866b4227db9e0524d58f7c + self.indexnode['entries'].append( + ('single', indextext, targetname, '')) + else: + self.indexnode['entries'].append( + ('single', indextext, targetname, '', None)) class CDomain(Base_CDomain): From 56cd869288f06cb59b81d3f75568e0d7dc89091f Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 7 Sep 2016 09:12:57 +0200 Subject: [PATCH 405/591] doc-rst:c-domain: function-like macros arguments Handle signatures of function-like macros well. Don't try to deduce arguments types of function-like macros. Signed-off-by: Markus Heiser Signed-off-by: Jonathan Corbet --- Documentation/sphinx/cdomain.py | 55 ++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py index 5f0c7ed0ddc7..df0419c62096 100644 --- a/Documentation/sphinx/cdomain.py +++ b/Documentation/sphinx/cdomain.py @@ -1,4 +1,5 @@ # -*- coding: utf-8; mode: python -*- +# pylint: disable=W0141,C0113,C0103,C0325 u""" cdomain ~~~~~~~ @@ -25,11 +26,18 @@ u""" * :c:func:`VIDIOC_LOG_STATUS` or * :any:`VIDIOC_LOG_STATUS` (``:any:`` needs sphinx 1.3) + + * Handle signatures of function-like macros well. Don't try to deduce + arguments types of function-like macros. + """ +from docutils import nodes from docutils.parsers.rst import directives import sphinx +from sphinx import addnodes +from sphinx.domains.c import c_funcptr_sig_re, c_sig_re from sphinx.domains.c import CObject as Base_CObject from sphinx.domains.c import CDomain as Base_CDomain @@ -57,9 +65,54 @@ class CObject(Base_CObject): "name" : directives.unchanged } + def handle_func_like_macro(self, sig, signode): + u"""Handles signatures of function-like macros. + + If the objtype is 'function' and the the signature ``sig`` is a + function-like macro, the name of the macro is returned. Otherwise + ``False`` is returned. """ + + if not self.objtype == 'function': + return False + + m = c_funcptr_sig_re.match(sig) + if m is None: + m = c_sig_re.match(sig) + if m is None: + raise ValueError('no match') + + rettype, fullname, arglist, _const = m.groups() + arglist = arglist.strip() + if rettype or not arglist: + return False + + arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup + arglist = [a.strip() for a in arglist.split(",")] + + # has the first argument a type? + if len(arglist[0].split(" ")) > 1: + return False + + # This is a function-like macro, it's arguments are typeless! + signode += addnodes.desc_name(fullname, fullname) + paramlist = addnodes.desc_parameterlist() + signode += paramlist + + for argname in arglist: + param = addnodes.desc_parameter('', '', noemph=True) + # separate by non-breaking space in the output + param += nodes.emphasis(argname, argname) + paramlist += param + + return fullname + def handle_signature(self, sig, signode): """Transform a C signature into RST nodes.""" - fullname = super(CObject, self).handle_signature(sig, signode) + + fullname = self.handle_func_like_macro(sig, signode) + if not fullname: + fullname = super(CObject, self).handle_signature(sig, signode) + if "name" in self.options: if self.objtype == 'function': fullname = self.options["name"] From e92ae527e7ba59f9175221a4f5422fb5eaec3dc4 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 11 Sep 2016 15:58:53 +0200 Subject: [PATCH 406/591] DMA-API-HOWTO: is no more So don't mention it. Signed-off-by: Christoph Hellwig Signed-off-by: Jonathan Corbet --- Documentation/DMA-API-HOWTO.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt index 781024ef9050..494ffac655ee 100644 --- a/Documentation/DMA-API-HOWTO.txt +++ b/Documentation/DMA-API-HOWTO.txt @@ -931,10 +931,8 @@ to "Closing". 1) Struct scatterlist requirements. - Don't invent the architecture specific struct scatterlist; just use - . You need to enable - CONFIG_NEED_SG_DMA_LENGTH if the architecture supports IOMMUs - (including software IOMMU). + You need to enable CONFIG_NEED_SG_DMA_LENGTH if the architecture + supports IOMMUs (including software IOMMU). 2) ARCH_DMA_MINALIGN From 829f4c362fc988381870b82cd7405f76fc077855 Mon Sep 17 00:00:00 2001 From: Laurent Navet Date: Thu, 15 Sep 2016 22:49:53 +0200 Subject: [PATCH 407/591] docs/driver-model: fix typo No need to be be, just be should be sufficient. Signed-off-by: Laurent Navet Signed-off-by: Jonathan Corbet --- Documentation/driver-model/device.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/driver-model/device.txt b/Documentation/driver-model/device.txt index 1e70220d20f4..2403eb856187 100644 --- a/Documentation/driver-model/device.txt +++ b/Documentation/driver-model/device.txt @@ -50,7 +50,7 @@ Attributes of devices can be exported by a device driver through sysfs. Please see Documentation/filesystems/sysfs.txt for more information on how sysfs works. -As explained in Documentation/kobject.txt, device attributes must be be +As explained in Documentation/kobject.txt, device attributes must be created before the KOBJ_ADD uevent is generated. The only way to realize that is by defining an attribute group. From c1a2f9898ace7f53cd5219480587b07c04e69c9b Mon Sep 17 00:00:00 2001 From: Benjamin Gaignard Date: Thu, 15 Sep 2016 04:37:43 -0300 Subject: [PATCH 408/591] [media] bindings for stih-cec driver Add bindings documentation for stih-cec driver. Signed-off-by: Benjamin Gaignard Acked-by: Peter Griffin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../devicetree/bindings/media/stih-cec.txt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/stih-cec.txt diff --git a/Documentation/devicetree/bindings/media/stih-cec.txt b/Documentation/devicetree/bindings/media/stih-cec.txt new file mode 100644 index 000000000000..71c4b2f4bcef --- /dev/null +++ b/Documentation/devicetree/bindings/media/stih-cec.txt @@ -0,0 +1,25 @@ +STMicroelectronics STIH4xx HDMI CEC driver + +Required properties: + - compatible : value should be "st,stih-cec" + - reg : Physical base address of the IP registers and length of memory + mapped region. + - clocks : from common clock binding: handle to HDMI CEC clock + - interrupts : HDMI CEC interrupt number to the CPU. + - pinctrl-names: Contains only one value - "default" + - pinctrl-0: Specifies the pin control groups used for CEC hardware. + - resets: Reference to a reset controller + +Example for STIH407: + +sti-cec@094a087c { + compatible = "st,stih-cec"; + reg = <0x94a087c 0x64>; + clocks = <&clk_sysin>; + clock-names = "cec-clk"; + interrupts = ; + interrupt-names = "cec-irq"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_cec0_default>; + resets = <&softreset STIH407_LPM_SOFTRESET>; +}; From 60fe2bda39a1c51d94ac514cfe68dabb11579c2b Mon Sep 17 00:00:00 2001 From: Benjamin Gaignard Date: Thu, 15 Sep 2016 04:37:44 -0300 Subject: [PATCH 409/591] [media] add stih-cec driver This patch implement CEC driver for stih4xx platform. Driver compliance has been test with cec-ctl and cec-compliance tools. Signed-off-by: Benjamin Gaignard Acked-by: Peter Griffin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/st-cec/Kconfig | 8 + drivers/staging/media/st-cec/Makefile | 1 + drivers/staging/media/st-cec/stih-cec.c | 380 ++++++++++++++++++++++++ 5 files changed, 392 insertions(+) create mode 100644 drivers/staging/media/st-cec/Kconfig create mode 100644 drivers/staging/media/st-cec/Makefile create mode 100644 drivers/staging/media/st-cec/stih-cec.c diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index 53827778b414..6620d96ee44d 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -36,4 +36,6 @@ source "drivers/staging/media/s5p-cec/Kconfig" # Keep LIRC at the end, as it has sub-menus source "drivers/staging/media/lirc/Kconfig" +source "drivers/staging/media/st-cec/Kconfig" + endif diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index 6316e8c7a497..906257e94dda 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile @@ -6,3 +6,4 @@ obj-$(CONFIG_LIRC_STAGING) += lirc/ obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/ +obj-$(CONFIG_VIDEO_STI_HDMI_CEC) += st-cec/ diff --git a/drivers/staging/media/st-cec/Kconfig b/drivers/staging/media/st-cec/Kconfig new file mode 100644 index 000000000000..784d2c600aca --- /dev/null +++ b/drivers/staging/media/st-cec/Kconfig @@ -0,0 +1,8 @@ +config VIDEO_STI_HDMI_CEC + tristate "STMicroelectronics STiH4xx HDMI CEC driver" + depends on VIDEO_DEV && MEDIA_CEC && (ARCH_STI || COMPILE_TEST) + ---help--- + This is a driver for STIH4xx HDMI CEC interface. It uses the + generic CEC framework interface. + CEC bus is present in the HDMI connector and enables communication + between compatible devices. diff --git a/drivers/staging/media/st-cec/Makefile b/drivers/staging/media/st-cec/Makefile new file mode 100644 index 000000000000..f07905e1448a --- /dev/null +++ b/drivers/staging/media/st-cec/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_STI_HDMI_CEC) += stih-cec.o diff --git a/drivers/staging/media/st-cec/stih-cec.c b/drivers/staging/media/st-cec/stih-cec.c new file mode 100644 index 000000000000..214344866a6b --- /dev/null +++ b/drivers/staging/media/st-cec/stih-cec.c @@ -0,0 +1,380 @@ +/* + * drivers/staging/media/st-cec/stih-cec.c + * + * STIH4xx CEC driver + * Copyright (C) STMicroelectronic SA 2016 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define CEC_NAME "stih-cec" + +/* CEC registers */ +#define CEC_CLK_DIV 0x0 +#define CEC_CTRL 0x4 +#define CEC_IRQ_CTRL 0x8 +#define CEC_STATUS 0xC +#define CEC_EXT_STATUS 0x10 +#define CEC_TX_CTRL 0x14 +#define CEC_FREE_TIME_THRESH 0x18 +#define CEC_BIT_TOUT_THRESH 0x1C +#define CEC_BIT_PULSE_THRESH 0x20 +#define CEC_DATA 0x24 +#define CEC_TX_ARRAY_CTRL 0x28 +#define CEC_CTRL2 0x2C +#define CEC_TX_ERROR_STS 0x30 +#define CEC_ADDR_TABLE 0x34 +#define CEC_DATA_ARRAY_CTRL 0x38 +#define CEC_DATA_ARRAY_STATUS 0x3C +#define CEC_TX_DATA_BASE 0x40 +#define CEC_TX_DATA_TOP 0x50 +#define CEC_TX_DATA_SIZE 0x1 +#define CEC_RX_DATA_BASE 0x54 +#define CEC_RX_DATA_TOP 0x64 +#define CEC_RX_DATA_SIZE 0x1 + +/* CEC_CTRL2 */ +#define CEC_LINE_INACTIVE_EN BIT(0) +#define CEC_AUTO_BUS_ERR_EN BIT(1) +#define CEC_STOP_ON_ARB_ERR_EN BIT(2) +#define CEC_TX_REQ_WAIT_EN BIT(3) + +/* CEC_DATA_ARRAY_CTRL */ +#define CEC_TX_ARRAY_EN BIT(0) +#define CEC_RX_ARRAY_EN BIT(1) +#define CEC_TX_ARRAY_RESET BIT(2) +#define CEC_RX_ARRAY_RESET BIT(3) +#define CEC_TX_N_OF_BYTES_IRQ_EN BIT(4) +#define CEC_TX_STOP_ON_NACK BIT(7) + +/* CEC_TX_ARRAY_CTRL */ +#define CEC_TX_N_OF_BYTES 0x1F +#define CEC_TX_START BIT(5) +#define CEC_TX_AUTO_SOM_EN BIT(6) +#define CEC_TX_AUTO_EOM_EN BIT(7) + +/* CEC_IRQ_CTRL */ +#define CEC_TX_DONE_IRQ_EN BIT(0) +#define CEC_ERROR_IRQ_EN BIT(2) +#define CEC_RX_DONE_IRQ_EN BIT(3) +#define CEC_RX_SOM_IRQ_EN BIT(4) +#define CEC_RX_EOM_IRQ_EN BIT(5) +#define CEC_FREE_TIME_IRQ_EN BIT(6) +#define CEC_PIN_STS_IRQ_EN BIT(7) + +/* CEC_CTRL */ +#define CEC_IN_FILTER_EN BIT(0) +#define CEC_PWR_SAVE_EN BIT(1) +#define CEC_EN BIT(4) +#define CEC_ACK_CTRL BIT(5) +#define CEC_RX_RESET_EN BIT(6) +#define CEC_IGNORE_RX_ERROR BIT(7) + +/* CEC_STATUS */ +#define CEC_TX_DONE_STS BIT(0) +#define CEC_TX_ACK_GET_STS BIT(1) +#define CEC_ERROR_STS BIT(2) +#define CEC_RX_DONE_STS BIT(3) +#define CEC_RX_SOM_STS BIT(4) +#define CEC_RX_EOM_STS BIT(5) +#define CEC_FREE_TIME_IRQ_STS BIT(6) +#define CEC_PIN_STS BIT(7) +#define CEC_SBIT_TOUT_STS BIT(8) +#define CEC_DBIT_TOUT_STS BIT(9) +#define CEC_LPULSE_ERROR_STS BIT(10) +#define CEC_HPULSE_ERROR_STS BIT(11) +#define CEC_TX_ERROR BIT(12) +#define CEC_TX_ARB_ERROR BIT(13) +#define CEC_RX_ERROR_MIN BIT(14) +#define CEC_RX_ERROR_MAX BIT(15) + +/* Signal free time in bit periods (2.4ms) */ +#define CEC_PRESENT_INIT_SFT 7 +#define CEC_NEW_INIT_SFT 5 +#define CEC_RETRANSMIT_SFT 3 + +/* Constants for CEC_BIT_TOUT_THRESH register */ +#define CEC_SBIT_TOUT_47MS BIT(1) +#define CEC_SBIT_TOUT_48MS BIT(0) | BIT(1) +#define CEC_SBIT_TOUT_50MS BIT(2) +#define CEC_DBIT_TOUT_27MS BIT(0) +#define CEC_DBIT_TOUT_28MS BIT(1) +#define CEC_DBIT_TOUT_29MS BIT(0) | BIT(1) + +/* Constants for CEC_BIT_PULSE_THRESH register */ +#define CEC_BIT_LPULSE_03MS BIT(1) +#define CEC_BIT_HPULSE_03MS BIT(3) + +/* Constants for CEC_DATA_ARRAY_STATUS register */ +#define CEC_RX_N_OF_BYTES 0x1F +#define CEC_TX_N_OF_BYTES_SENT BIT(5) +#define CEC_RX_OVERRUN BIT(6) + +struct stih_cec { + struct cec_adapter *adap; + struct device *dev; + struct clk *clk; + void __iomem *regs; + int irq; + u32 irq_status; +}; + +static int stih_cec_adap_enable(struct cec_adapter *adap, bool enable) +{ + struct stih_cec *cec = adap->priv; + + if (enable) { + /* The doc says (input TCLK_PERIOD * CEC_CLK_DIV) = 0.1ms */ + unsigned long clk_freq = clk_get_rate(cec->clk); + u32 cec_clk_div = clk_freq / 10000; + + writel(cec_clk_div, cec->regs + CEC_CLK_DIV); + + /* Configuration of the durations activating a timeout */ + writel(CEC_SBIT_TOUT_47MS | (CEC_DBIT_TOUT_28MS << 4), + cec->regs + CEC_BIT_TOUT_THRESH); + + /* Configuration of the smallest allowed duration for pulses */ + writel(CEC_BIT_LPULSE_03MS | CEC_BIT_HPULSE_03MS, + cec->regs + CEC_BIT_PULSE_THRESH); + + /* Minimum received bit period threshold */ + writel(BIT(5) | BIT(7), cec->regs + CEC_TX_CTRL); + + /* Configuration of transceiver data arrays */ + writel(CEC_TX_ARRAY_EN | CEC_RX_ARRAY_EN | CEC_TX_STOP_ON_NACK, + cec->regs + CEC_DATA_ARRAY_CTRL); + + /* Configuration of the control bits for CEC Transceiver */ + writel(CEC_IN_FILTER_EN | CEC_EN | CEC_RX_RESET_EN, + cec->regs + CEC_CTRL); + + /* Clear logical addresses */ + writel(0, cec->regs + CEC_ADDR_TABLE); + + /* Clear the status register */ + writel(0x0, cec->regs + CEC_STATUS); + + /* Enable the interrupts */ + writel(CEC_TX_DONE_IRQ_EN | CEC_RX_DONE_IRQ_EN | + CEC_RX_SOM_IRQ_EN | CEC_RX_EOM_IRQ_EN | + CEC_ERROR_IRQ_EN, + cec->regs + CEC_IRQ_CTRL); + + } else { + /* Clear logical addresses */ + writel(0, cec->regs + CEC_ADDR_TABLE); + + /* Clear the status register */ + writel(0x0, cec->regs + CEC_STATUS); + + /* Disable the interrupts */ + writel(0, cec->regs + CEC_IRQ_CTRL); + } + + return 0; +} + +static int stih_cec_adap_log_addr(struct cec_adapter *adap, u8 logical_addr) +{ + struct stih_cec *cec = adap->priv; + u32 reg = readl(cec->regs + CEC_ADDR_TABLE); + + reg |= 1 << logical_addr; + + if (logical_addr == CEC_LOG_ADDR_INVALID) + reg = 0; + + writel(reg, cec->regs + CEC_ADDR_TABLE); + + return 0; +} + +static int stih_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, + u32 signal_free_time, struct cec_msg *msg) +{ + struct stih_cec *cec = adap->priv; + int i; + + /* Copy message into registers */ + for (i = 0; i < msg->len; i++) + writeb(msg->msg[i], cec->regs + CEC_TX_DATA_BASE + i); + + /* Start transmission, configure hardware to add start and stop bits + * Signal free time is handled by the hardware + */ + writel(CEC_TX_AUTO_SOM_EN | CEC_TX_AUTO_EOM_EN | CEC_TX_START | + msg->len, cec->regs + CEC_TX_ARRAY_CTRL); + + return 0; +} + +static void stih_tx_done(struct stih_cec *cec, u32 status) +{ + if (status & CEC_TX_ERROR) { + cec_transmit_done(cec->adap, CEC_TX_STATUS_ERROR, 0, 0, 0, 1); + return; + } + + if (status & CEC_TX_ARB_ERROR) { + cec_transmit_done(cec->adap, + CEC_TX_STATUS_ARB_LOST, 1, 0, 0, 0); + return; + } + + if (!(status & CEC_TX_ACK_GET_STS)) { + cec_transmit_done(cec->adap, CEC_TX_STATUS_NACK, 0, 1, 0, 0); + return; + } + + cec_transmit_done(cec->adap, CEC_TX_STATUS_OK, 0, 0, 0, 0); +} + +static void stih_rx_done(struct stih_cec *cec, u32 status) +{ + struct cec_msg msg = {}; + u8 i; + + if (status & CEC_RX_ERROR_MIN) + return; + + if (status & CEC_RX_ERROR_MAX) + return; + + msg.len = readl(cec->regs + CEC_DATA_ARRAY_STATUS) & 0x1f; + + if (!msg.len) + return; + + if (msg.len > 16) + msg.len = 16; + + for (i = 0; i < msg.len; i++) + msg.msg[i] = readl(cec->regs + CEC_RX_DATA_BASE + i); + + cec_received_msg(cec->adap, &msg); +} + +static irqreturn_t stih_cec_irq_handler_thread(int irq, void *priv) +{ + struct stih_cec *cec = priv; + + if (cec->irq_status & CEC_TX_DONE_STS) + stih_tx_done(cec, cec->irq_status); + + if (cec->irq_status & CEC_RX_DONE_STS) + stih_rx_done(cec, cec->irq_status); + + cec->irq_status = 0; + + return IRQ_HANDLED; +} + +static irqreturn_t stih_cec_irq_handler(int irq, void *priv) +{ + struct stih_cec *cec = priv; + + cec->irq_status = readl(cec->regs + CEC_STATUS); + writel(cec->irq_status, cec->regs + CEC_STATUS); + + return IRQ_WAKE_THREAD; +} + +static const struct cec_adap_ops sti_cec_adap_ops = { + .adap_enable = stih_cec_adap_enable, + .adap_log_addr = stih_cec_adap_log_addr, + .adap_transmit = stih_cec_adap_transmit, +}; + +static int stih_cec_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct resource *res; + struct stih_cec *cec; + int ret; + + cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL); + if (!cec) + return -ENOMEM; + + cec->dev = dev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + cec->regs = devm_ioremap_resource(dev, res); + if (IS_ERR(cec->regs)) + return PTR_ERR(cec->regs); + + cec->irq = platform_get_irq(pdev, 0); + if (cec->irq < 0) + return cec->irq; + + ret = devm_request_threaded_irq(dev, cec->irq, stih_cec_irq_handler, + stih_cec_irq_handler_thread, 0, + pdev->name, cec); + if (ret) + return ret; + + cec->clk = devm_clk_get(dev, "cec-clk"); + if (IS_ERR(cec->clk)) { + dev_err(dev, "Cannot get cec clock\n"); + return PTR_ERR(cec->clk); + } + + cec->adap = cec_allocate_adapter(&sti_cec_adap_ops, cec, + CEC_NAME, + CEC_CAP_LOG_ADDRS | CEC_CAP_PASSTHROUGH | + CEC_CAP_PHYS_ADDR | CEC_CAP_TRANSMIT, + 1, &pdev->dev); + ret = PTR_ERR_OR_ZERO(cec->adap); + if (ret) + return ret; + + ret = cec_register_adapter(cec->adap); + if (ret) { + cec_delete_adapter(cec->adap); + return ret; + } + + platform_set_drvdata(pdev, cec); + return 0; +} + +static int stih_cec_remove(struct platform_device *pdev) +{ + return 0; +} + +static const struct of_device_id stih_cec_match[] = { + { + .compatible = "st,stih-cec", + }, + {}, +}; + +static struct platform_driver stih_cec_pdrv = { + .probe = stih_cec_probe, + .remove = stih_cec_remove, + .driver = { + .name = CEC_NAME, + .of_match_table = stih_cec_match, + }, +}; + +module_platform_driver(stih_cec_pdrv); + +MODULE_AUTHOR("Benjamin Gaignard "); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("STIH4xx CEC driver"); From 7d1837f2a35fcbeda5ce0c9d47f9f76d412bac3e Mon Sep 17 00:00:00 2001 From: Benjamin Gaignard Date: Thu, 15 Sep 2016 04:37:45 -0300 Subject: [PATCH 410/591] [media] add stih-cec driver into DT Signed-off-by: Benjamin Gaignard Acked-by: Peter Griffin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- arch/arm/boot/dts/stih407-family.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi index d294e82447a2..9f88086b8c24 100644 --- a/arch/arm/boot/dts/stih407-family.dtsi +++ b/arch/arm/boot/dts/stih407-family.dtsi @@ -734,6 +734,18 @@ <&clk_s_c0_flexgen CLK_ETH_PHY>; }; + cec: sti-cec@094a087c { + compatible = "st,stih-cec"; + reg = <0x94a087c 0x64>; + clocks = <&clk_sysin>; + clock-names = "cec-clk"; + interrupts = ; + interrupt-names = "cec-irq"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_cec0_default>; + resets = <&softreset STIH407_LPM_SOFTRESET>; + }; + rng10: rng@08a89000 { compatible = "st,rng"; reg = <0x08a89000 0x1000>; From 49fc9361db78a598c53134d083b84f15492da3bc Mon Sep 17 00:00:00 2001 From: Benjamin Gaignard Date: Thu, 15 Sep 2016 04:37:46 -0300 Subject: [PATCH 411/591] [media] add maintainer for stih-cec driver Signed-off-by: Benjamin Gaignard Acked-by: Peter Griffin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9015f04208a7..22feb294de5d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10282,6 +10282,13 @@ S: Maintained F: Documentation/devicetree/bindings/serial/ F: drivers/tty/serial/ +STI CEC DRIVER +M: Benjamin Gaignard +L: kernel@stlinux.com +S: Maintained +F: drivers/staging/media/st-cec/ +F: Documentation/devicetree/bindings/media/stih-cec.txt + SYNOPSYS DESIGNWARE DMAC DRIVER M: Viresh Kumar M: Andy Shevchenko From 53cf70028c28cf4a43581cd639610762fe8bcdd7 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 18 Aug 2016 12:54:57 -0300 Subject: [PATCH 412/591] [media] pxa_camera: fix spelling mistake: "dequeud" -> "dequeued" trivial fix to spelling mistake in pr_debug message Signed-off-by: Colin Ian King Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/pxa_camera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index 1bce7eb62387..23c8780b3b0f 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -967,7 +967,7 @@ static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, vbuf->sequence = pcdev->buf_sequence++; vbuf->field = V4L2_FIELD_NONE; vb2_buffer_done(vb, VB2_BUF_STATE_DONE); - dev_dbg(pcdev_to_dev(pcdev), "%s dequeud buffer (buf=0x%p)\n", + dev_dbg(pcdev_to_dev(pcdev), "%s dequeued buffer (buf=0x%p)\n", __func__, buf); if (list_empty(&pcdev->capture)) { From 5e3deb4dc322060955280a768c0db6af3ed04af5 Mon Sep 17 00:00:00 2001 From: Tiffany Lin Date: Tue, 6 Sep 2016 02:51:45 -0300 Subject: [PATCH 413/591] [media] vcodec: mediatek: Add V4L2_CAP_TIMEPERFRAME capability setting This patch setting V4L2_CAP_TIMEPERFRAME capability in vidioc_venc_s/g_parm functions Signed-off-by: Tiffany Lin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index b1f0acbae50b..7ad7bebf330c 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -243,6 +243,8 @@ static int vidioc_venc_s_parm(struct file *file, void *priv, a->parm.output.timeperframe.numerator; ctx->param_change |= MTK_ENCODE_PARAM_FRAMERATE; + a->parm.output.capability = V4L2_CAP_TIMEPERFRAME; + return 0; } @@ -254,6 +256,7 @@ static int vidioc_venc_g_parm(struct file *file, void *priv, if (a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) return -EINVAL; + a->parm.output.capability = V4L2_CAP_TIMEPERFRAME; a->parm.output.timeperframe.denominator = ctx->enc_params.framerate_num; a->parm.output.timeperframe.numerator = From 09d6e35fdf10f94465620a195da8eaf0b81966bd Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 7 Sep 2016 07:48:41 -0300 Subject: [PATCH 414/591] [media] v4l-drivers/fourcc.rst: fix typo Linux4Linux -> Video4Linux Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/v4l-drivers/fourcc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/v4l-drivers/fourcc.rst b/Documentation/media/v4l-drivers/fourcc.rst index f7c8cefff02a..9c82106e8a26 100644 --- a/Documentation/media/v4l-drivers/fourcc.rst +++ b/Documentation/media/v4l-drivers/fourcc.rst @@ -1,4 +1,4 @@ -Guidelines for Linux4Linux pixel format 4CCs +Guidelines for Video4Linux pixel format 4CCs ============================================ Guidelines for Video4Linux 4CC codes defined using v4l2_fourcc() are From 58584b28a8e57f1262d3c90e8f454f3793f6e8e9 Mon Sep 17 00:00:00 2001 From: Johan Fjeldtvedt Date: Wed, 7 Sep 2016 08:01:11 -0300 Subject: [PATCH 415/591] [media] pulse8-cec: store logical address mask In addition to setting the ACK mask, also set the logical address mask setting in the dongle. This (and not the ACK mask) is persisted for use in autonomous mode. The logical address mask to use is deduced from the primary device type in adap->log_addrs. Signed-off-by: Johan Fjeldtvedt Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/pulse8-cec/pulse8-cec.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index 13e8f61c0a34..8292cab0f73b 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c @@ -498,6 +498,40 @@ static int pulse8_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) if (err) goto unlock; + switch (adap->log_addrs.primary_device_type[0]) { + case CEC_OP_PRIM_DEVTYPE_TV: + mask = CEC_LOG_ADDR_MASK_TV; + break; + case CEC_OP_PRIM_DEVTYPE_RECORD: + mask = CEC_LOG_ADDR_MASK_RECORD; + break; + case CEC_OP_PRIM_DEVTYPE_TUNER: + mask = CEC_LOG_ADDR_MASK_TUNER; + break; + case CEC_OP_PRIM_DEVTYPE_PLAYBACK: + mask = CEC_LOG_ADDR_MASK_PLAYBACK; + break; + case CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM: + mask = CEC_LOG_ADDR_MASK_AUDIOSYSTEM; + break; + case CEC_OP_PRIM_DEVTYPE_SWITCH: + mask = CEC_LOG_ADDR_MASK_UNREGISTERED; + break; + case CEC_OP_PRIM_DEVTYPE_PROCESSOR: + mask = CEC_LOG_ADDR_MASK_SPECIFIC; + break; + default: + mask = 0; + break; + } + cmd[0] = MSGCODE_SET_LOGICAL_ADDRESS_MASK; + cmd[1] = mask >> 8; + cmd[2] = mask & 0xff; + err = pulse8_send_and_wait(pulse8, cmd, 3, + MSGCODE_COMMAND_ACCEPTED, 0); + if (err) + goto unlock; + cmd[0] = MSGCODE_SET_DEFAULT_LOGICAL_ADDRESS; cmd[1] = log_addr; err = pulse8_send_and_wait(pulse8, cmd, 2, From a58d1191ca04ffa8b14dcda5df0c87a2a642d3c7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 8 Sep 2016 12:25:16 -0300 Subject: [PATCH 416/591] [media] cec: fix Kconfig help text MEDIA_CEC is no longer a tristate option, so the user can't actually choose M. Whether the code is built-in or built as a module is decided somewhere else. Fixes: 5bb2399a4fe4 ("[media] cec: fix Kconfig dependency problems") Signed-off-by: Jean Delvare Cc: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/cec/Kconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/media/cec/Kconfig b/drivers/staging/media/cec/Kconfig index 21457a1f6c9f..6e12d41b1f86 100644 --- a/drivers/staging/media/cec/Kconfig +++ b/drivers/staging/media/cec/Kconfig @@ -5,9 +5,6 @@ config MEDIA_CEC ---help--- Enable the CEC API. - To compile this driver as a module, choose M here: the - module will be called cec. - config MEDIA_CEC_DEBUG bool "CEC debugfs interface (EXPERIMENTAL)" depends on MEDIA_CEC && DEBUG_FS From 4540e0ad6fa6fab0e4cc0dc4f74b1ebb676a4404 Mon Sep 17 00:00:00 2001 From: Songjun Wu Date: Mon, 12 Sep 2016 04:47:24 -0300 Subject: [PATCH 417/591] [media] atmel-isc: set the format on the first open Set the current format on the first open. Signed-off-by: Songjun Wu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/atmel/atmel-isc.c | 30 ++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index db6773de92f0..ed8050d6ea71 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -924,10 +924,16 @@ static int isc_open(struct file *file) goto unlock; ret = v4l2_subdev_call(sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD) + if (ret < 0 && ret != -ENOIOCTLCMD) { v4l2_fh_release(file); - else - ret = 0; + goto unlock; + } + + ret = isc_set_fmt(isc, &isc->fmt); + if (ret) { + v4l2_subdev_call(sd, core, s_power, 0); + v4l2_fh_release(file); + } unlock: mutex_unlock(&isc->lock); @@ -1118,8 +1124,16 @@ static int isc_set_default_fmt(struct isc_device *isc) .pixelformat = isc->user_formats[0]->fourcc, }, }; + int ret; - return isc_set_fmt(isc, &f); + ret = isc_try_fmt(isc, &f, NULL); + if (ret) + return ret; + + isc->current_fmt = isc->user_formats[0]; + isc->fmt = f; + + return 0; } static int isc_async_complete(struct v4l2_async_notifier *notifier) @@ -1172,20 +1186,12 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) return ret; } - ret = v4l2_subdev_call(sd_entity->sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD) - return ret; - ret = isc_set_default_fmt(isc); if (ret) { v4l2_err(&isc->v4l2_dev, "Could not set default format\n"); return ret; } - ret = v4l2_subdev_call(sd_entity->sd, core, s_power, 0); - if (ret < 0 && ret != -ENOIOCTLCMD) - return ret; - /* Register video device */ strlcpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name)); vdev->release = video_device_release_empty; From b82e39f85603db6251ffcacf8b0b91674869c6fb Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 12 Sep 2016 05:43:49 -0300 Subject: [PATCH 418/591] [media] pulse8-cec: avoid uninitialized data use Building with -Wmaybe-uninitialized reveals the use on an uninitialized variable containing the physical address of the device whenever firmware before version 2 is used: drivers/staging/media/pulse8-cec/pulse8-cec.c: In function 'pulse8_connect': drivers/staging/media/pulse8-cec/pulse8-cec.c:447:2: error: 'pa' may be used uninitialized in this function [-Werror=maybe-uninitialized] This sets the address to CEC_PHYS_ADDR_INVALID in this case, so we don't try to write back the uninitialized data to the device. Fixes: e28a6c8b3fcc ("[media] pulse8-cec: sync configuration with adapter") Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/pulse8-cec/pulse8-cec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index 8292cab0f73b..9285765323f2 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c @@ -342,8 +342,10 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, return err; pulse8->vers = (data[0] << 8) | data[1]; dev_info(pulse8->dev, "Firmware version %04x\n", pulse8->vers); - if (pulse8->vers < 2) + if (pulse8->vers < 2) { + *pa = CEC_PHYS_ADDR_INVALID; return 0; + } cmd[0] = MSGCODE_GET_BUILDDATE; err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 4); From c9c21c301dcf1219159ec4377c03d6a24a3d2ba0 Mon Sep 17 00:00:00 2001 From: Andrey Utkin Date: Mon, 12 Sep 2016 20:02:37 -0300 Subject: [PATCH 419/591] [media] tw5864: constify vb2_ops structure Inspired by "[media] pci: constify vb2_ops structures" patch from Julia Lawall (dated 9 Sep 2016). Signed-off-by: Andrey Utkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw5864/tw5864-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c index 6c1685aeaea9..7401b64b1784 100644 --- a/drivers/media/pci/tw5864/tw5864-video.c +++ b/drivers/media/pci/tw5864/tw5864-video.c @@ -465,7 +465,7 @@ static void tw5864_stop_streaming(struct vb2_queue *q) spin_unlock_irqrestore(&input->slock, flags); } -static struct vb2_ops tw5864_video_qops = { +static const struct vb2_ops tw5864_video_qops = { .queue_setup = tw5864_queue_setup, .buf_queue = tw5864_buf_queue, .start_streaming = tw5864_start_streaming, From e4011b69ab329cc0d238d4dc530ab870c566c566 Mon Sep 17 00:00:00 2001 From: Andrey Utkin Date: Mon, 12 Sep 2016 20:02:38 -0300 Subject: [PATCH 420/591] [media] tw5864: constify struct video_device template tw5864_video_template is used for filling of actual video_device structures. It is copied by value, and is not used for anything else. Signed-off-by: Andrey Utkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/tw5864/tw5864-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/tw5864/tw5864-video.c b/drivers/media/pci/tw5864/tw5864-video.c index 7401b64b1784..652a059b2e0a 100644 --- a/drivers/media/pci/tw5864/tw5864-video.c +++ b/drivers/media/pci/tw5864/tw5864-video.c @@ -912,7 +912,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { #endif }; -static struct video_device tw5864_video_template = { +static const struct video_device tw5864_video_template = { .name = "tw5864_video", .fops = &video_fops, .ioctl_ops = &video_ioctl_ops, From a2755e1178c33e69a8c0f7a9961d52ce4af8d365 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Wed, 14 Sep 2016 23:21:45 -0300 Subject: [PATCH 421/591] [media] pxa_camera: fix error return code in pxa_camera_probe() Fix to return error code -ENODEV from dma_request_slave_channel_compat() error handling case instead of 0, as done elsewhere in this function. Also fix to release resources in v4l2_clk_register() error handling. Signed-off-by: Wei Yongjun Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/pxa_camera.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index 23c8780b3b0f..f795100854e4 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -2402,6 +2402,7 @@ static int pxa_camera_probe(struct platform_device *pdev) ¶ms, &pdev->dev, "CI_U"); if (!pcdev->dma_chans[1]) { dev_err(&pdev->dev, "Can't request DMA for Y\n"); + err = -ENODEV; goto exit_free_dma_y; } @@ -2411,6 +2412,7 @@ static int pxa_camera_probe(struct platform_device *pdev) ¶ms, &pdev->dev, "CI_V"); if (!pcdev->dma_chans[2]) { dev_err(&pdev->dev, "Can't request DMA for V\n"); + err = -ENODEV; goto exit_free_dma_u; } @@ -2461,8 +2463,10 @@ static int pxa_camera_probe(struct platform_device *pdev) pcdev->mclk_clk = v4l2_clk_register(&pxa_camera_mclk_ops, clk_name, NULL); - if (IS_ERR(pcdev->mclk_clk)) - return PTR_ERR(pcdev->mclk_clk); + if (IS_ERR(pcdev->mclk_clk)) { + err = PTR_ERR(pcdev->mclk_clk); + goto exit_free_v4l2dev; + } } err = v4l2_async_notifier_register(&pcdev->v4l2_dev, &pcdev->notifier); From e1618a57b9951a3182b52c4605948c8bb9bb0ea4 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Wed, 14 Sep 2016 23:22:03 -0300 Subject: [PATCH 422/591] [media] pxa_camera: remove duplicated include from pxa_camera.c Remove duplicated include. Signed-off-by: Wei Yongjun Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/pxa_camera.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index f795100854e4..c12209c701d3 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include From a38aaaa43d1acd037afd1bd84ebf9d855afdf714 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 15 Sep 2016 00:36:09 -0300 Subject: [PATCH 423/591] [media] vivid: fix error return code in vivid_create_instance() Fix to return error code -ENOMEM from the memory or workqueue alloc error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vivid/vivid-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c index 741460ab68ab..5464fefbaab9 100644 --- a/drivers/media/platform/vivid/vivid-core.c +++ b/drivers/media/platform/vivid/vivid-core.c @@ -839,6 +839,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) dev->radio_tx_caps = V4L2_CAP_RDS_OUTPUT | V4L2_CAP_MODULATOR | V4L2_CAP_READWRITE; + ret = -ENOMEM; /* initialize the test pattern generator */ tpg_init(&dev->tpg, 640, 360); if (tpg_alloc(&dev->tpg, MAX_ZOOM * MAX_WIDTH)) @@ -1033,8 +1034,10 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) */ dev->cec_workqueue = alloc_ordered_workqueue("vivid-%03d-cec", WQ_MEM_RECLAIM, inst); - if (!dev->cec_workqueue) + if (!dev->cec_workqueue) { + ret = -ENOMEM; goto unreg_dev; + } /* start creating the vb2 queues */ if (dev->has_vid_cap) { From 618cd932cd38b65d89eb31a5271999b6ccc59b2e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 12 Sep 2016 12:48:54 -0300 Subject: [PATCH 424/591] MAINTAINERS: update documentation for media subsystem With ReST conversion, the media subsystem documentation is now located on different directories. Update them. Suggested-by: Joe Perches Cc: LKML Cc: linux-doc Cc: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 22feb294de5d..de23660823b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2755,7 +2755,7 @@ L: linux-media@vger.kernel.org W: https://linuxtv.org T: git git://linuxtv.org/media_tree.git S: Odd fixes -F: Documentation/video4linux/bttv/ +F: Documentation/media/v4l-drivers/bttv* F: drivers/media/pci/bt8xx/bttv* BUSLOGIC SCSI DRIVER @@ -2800,7 +2800,7 @@ M: Jonathan Corbet L: linux-media@vger.kernel.org T: git git://linuxtv.org/media_tree.git S: Maintained -F: Documentation/video4linux/cafe_ccic +F: Documentation/media/v4l-drivers/cafe_ccic* F: drivers/media/platform/marvell-ccic/ CAIF NETWORK LAYER @@ -2894,7 +2894,7 @@ T: git git://linuxtv.org/media_tree.git W: http://linuxtv.org S: Supported F: Documentation/cec.txt -F: Documentation/DocBook/media/v4l/cec* +F: Documentation/media/uapi/cec F: drivers/staging/media/cec/ F: drivers/media/cec-edid.c F: drivers/media/rc/keymaps/rc-cec.c @@ -3380,7 +3380,7 @@ T: git git://linuxtv.org/media_tree.git W: https://linuxtv.org W: http://www.ivtvdriver.org/index.php/Cx18 S: Maintained -F: Documentation/video4linux/cx18.txt +F: Documentation/media/v4l-drivers/cx18* F: drivers/media/pci/cx18/ F: include/uapi/linux/ivtv* @@ -3409,7 +3409,7 @@ L: linux-media@vger.kernel.org W: https://linuxtv.org T: git git://linuxtv.org/media_tree.git S: Odd fixes -F: Documentation/video4linux/cx88/ +F: Documentation/media/v4l-drivers/cx88* F: drivers/media/pci/cx88/ CXD2820R MEDIA DRIVER @@ -3882,7 +3882,7 @@ X: Documentation/devicetree/ X: Documentation/acpi X: Documentation/power X: Documentation/spi -X: Documentation/DocBook/media +X: Documentation/media T: git git://git.lwn.net/linux.git docs-next DOUBLETALK DRIVER @@ -4577,6 +4577,7 @@ W: https://linuxtv.org T: git git://linuxtv.org/media_tree.git S: Maintained F: drivers/media/usb/em28xx/ +F: Documentation/media/v4l-drivers/em28xx* EMBEDDED LINUX M: Paul Gortmaker @@ -6503,7 +6504,7 @@ L: linux-media@vger.kernel.org T: git git://linuxtv.org/media_tree.git W: http://www.ivtvdriver.org S: Maintained -F: Documentation/video4linux/*.ivtv +F: Documentation/media/v4l-drivers/ivtv* F: drivers/media/pci/ivtv/ F: include/uapi/linux/ivtv* @@ -7583,9 +7584,7 @@ W: https://linuxtv.org Q: http://patchwork.kernel.org/project/linux-media/list/ T: git git://linuxtv.org/media_tree.git S: Maintained -F: Documentation/dvb/ -F: Documentation/video4linux/ -F: Documentation/DocBook/media/ +F: Documentation/media/ F: drivers/media/ F: drivers/staging/media/ F: include/linux/platform_data/media/ @@ -7854,7 +7853,7 @@ F: kernel/module.c MOTION EYE VAIO PICTUREBOOK CAMERA DRIVER W: http://popies.net/meye/ S: Orphan -F: Documentation/video4linux/meye.txt +F: Documentation/media/v4l-drivers/meye* F: drivers/media/pci/meye/ F: include/uapi/linux/meye.h @@ -9498,7 +9497,7 @@ L: linux-media@vger.kernel.org W: http://www.isely.net/pvrusb2/ T: git git://linuxtv.org/media_tree.git S: Maintained -F: Documentation/video4linux/README.pvrusb2 +F: Documentation/media/v4l-drivers/pvrusb2* F: drivers/media/usb/pvrusb2/ PWC WEBCAM DRIVER @@ -10152,7 +10151,7 @@ L: linux-media@vger.kernel.org W: https://linuxtv.org T: git git://linuxtv.org/media_tree.git S: Odd fixes -F: Documentation/video4linux/*.saa7134 +F: Documentation/media/v4l-drivers/saa7134* F: drivers/media/pci/saa7134/ SAA7146 VIDEO4LINUX-2 DRIVER @@ -11853,6 +11852,7 @@ W: https://linuxtv.org T: git git://linuxtv.org/media_tree.git S: Odd fixes F: drivers/media/usb/tm6000/ +F: Documentation/media/v4l-drivers/tm6000* TW5864 VIDEO4LINUX DRIVER M: Bluecherry Maintainers @@ -12357,7 +12357,7 @@ L: linux-media@vger.kernel.org T: git git://linuxtv.org/media_tree.git W: http://royale.zerezo.com/zr364xx/ S: Maintained -F: Documentation/video4linux/zr364xx.txt +F: Documentation/media/v4l-drivers/zr364xx* F: drivers/media/usb/zr364xx/ ULPI BUS From 7389e6ef347443ac90116c2208bbdfb4f9d135ba Mon Sep 17 00:00:00 2001 From: Charles-Antoine Couret Date: Thu, 15 Sep 2016 12:29:50 -0300 Subject: [PATCH 425/591] [media] SDI: add flag for SDI formats and SMPTE 125M definition Adding others generic flags, which could be used by many components like GS1662. Signed-off-by: Charles-Antoine Couret Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-dv-timings.c | 11 +++++++---- include/uapi/linux/v4l2-dv-timings.h | 12 ++++++++++++ include/uapi/linux/videodev2.h | 8 ++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c index 889de0a32152..730a7c392c1d 100644 --- a/drivers/media/v4l2-core/v4l2-dv-timings.c +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c @@ -306,7 +306,7 @@ void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix, (bt->polarities & V4L2_DV_VSYNC_POS_POL) ? "+" : "-", bt->il_vsync, bt->il_vbackporch); pr_info("%s: pixelclock: %llu\n", dev_prefix, bt->pixelclock); - pr_info("%s: flags (0x%x):%s%s%s%s%s%s\n", dev_prefix, bt->flags, + pr_info("%s: flags (0x%x):%s%s%s%s%s%s%s\n", dev_prefix, bt->flags, (bt->flags & V4L2_DV_FL_REDUCED_BLANKING) ? " REDUCED_BLANKING" : "", ((bt->flags & V4L2_DV_FL_REDUCED_BLANKING) && @@ -318,12 +318,15 @@ void v4l2_print_dv_timings(const char *dev_prefix, const char *prefix, (bt->flags & V4L2_DV_FL_HALF_LINE) ? " HALF_LINE" : "", (bt->flags & V4L2_DV_FL_IS_CE_VIDEO) ? - " CE_VIDEO" : ""); - pr_info("%s: standards (0x%x):%s%s%s%s\n", dev_prefix, bt->standards, + " CE_VIDEO" : "", + (bt->flags & V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) ? + " FIRST_FIELD_EXTRA_LINE" : ""); + pr_info("%s: standards (0x%x):%s%s%s%s%s\n", dev_prefix, bt->standards, (bt->standards & V4L2_DV_BT_STD_CEA861) ? " CEA" : "", (bt->standards & V4L2_DV_BT_STD_DMT) ? " DMT" : "", (bt->standards & V4L2_DV_BT_STD_CVT) ? " CVT" : "", - (bt->standards & V4L2_DV_BT_STD_GTF) ? " GTF" : ""); + (bt->standards & V4L2_DV_BT_STD_GTF) ? " GTF" : "", + (bt->standards & V4L2_DV_BT_STD_SDI) ? " SDI" : ""); } EXPORT_SYMBOL_GPL(v4l2_print_dv_timings); diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h index 086168e18ca8..f31957166337 100644 --- a/include/uapi/linux/v4l2-dv-timings.h +++ b/include/uapi/linux/v4l2-dv-timings.h @@ -934,4 +934,16 @@ V4L2_DV_FL_REDUCED_BLANKING) \ } +/* SDI timings definitions */ + +/* SMPTE-125M */ +#define V4L2_DV_BT_SDI_720X487I60 { \ + .type = V4L2_DV_BT_656_1120, \ + V4L2_INIT_BT_TIMINGS(720, 487, 1, \ + V4L2_DV_HSYNC_POS_POL, \ + 13500000, 16, 121, 0, 0, 19, 0, 0, 19, 0, \ + V4L2_DV_BT_STD_SDI, \ + V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) \ +} + #endif diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 5529741202b5..94f123f3e04e 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1274,6 +1274,7 @@ struct v4l2_bt_timings { #define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */ #define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */ #define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */ +#define V4L2_DV_BT_STD_SDI (1 << 4) /* SDI Timings */ /* Flags */ @@ -1305,6 +1306,11 @@ struct v4l2_bt_timings { * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861 * except for the 640x480 format are CE formats. */ #define V4L2_DV_FL_IS_CE_VIDEO (1 << 4) +/* Some formats like SMPTE-125M have an interlaced signal with a odd + * total height. For these formats, if this flag is set, the first + * field has the extra line. If not, it is the second field. + */ +#define V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE (1 << 5) /* A few useful defines to calculate the total blanking and frame sizes */ #define V4L2_DV_BT_BLANKING_WIDTH(bt) \ @@ -1429,6 +1435,8 @@ struct v4l2_input { /* field 'status' - analog */ #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ +#define V4L2_IN_ST_NO_V_LOCK 0x00000400 /* No vertical sync lock */ +#define V4L2_IN_ST_NO_STD_LOCK 0x00000800 /* No standard format lock */ /* field 'status' - digital */ #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ From e74c8cda4ca0c697dd8f0cc5928fe8403fb58f7c Mon Sep 17 00:00:00 2001 From: Charles-Antoine Couret Date: Thu, 15 Sep 2016 10:53:55 -0300 Subject: [PATCH 426/591] [media] V4L2: Add documentation for SDI timings and related flags Describe new needed constants defined by SDI format. Signed-off-by: Charles-Antoine Couret Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/vidioc-enuminput.rst | 31 ++++++++++++++----- .../media/uapi/v4l/vidioc-g-dv-timings.rst | 15 +++++++++ 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index be03e04e3dac..c38bde400dc1 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -272,17 +272,34 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. - .. row 11 - - :cspan:`2` Digital Video + - ``V4L2_IN_ST_NO_V_LOCK`` + + - 0x00000400 + + - No vertical sync lock. - .. row 12 + - ``V4L2_IN_ST_NO_STD_LOCK`` + + - 0x00000800 + + - No standard format lock in case of auto-detection format + by the component. + + - .. row 13 + + - :cspan:`2` Digital Video + + - .. row 14 + - ``V4L2_IN_ST_NO_SYNC`` - 0x00010000 - No synchronization lock. - - .. row 13 + - .. row 15 - ``V4L2_IN_ST_NO_EQU`` @@ -290,7 +307,7 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. - No equalizer lock. - - .. row 14 + - .. row 16 - ``V4L2_IN_ST_NO_CARRIER`` @@ -298,11 +315,11 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. - Carrier recovery failed. - - .. row 15 + - .. row 17 - :cspan:`2` VCR and Set-Top Box - - .. row 16 + - .. row 18 - ``V4L2_IN_ST_MACROVISION`` @@ -312,7 +329,7 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. signal to confuse video recorders. When this flag is set Macrovision has been detected. - - .. row 17 + - .. row 19 - ``V4L2_IN_ST_NO_ACCESS`` @@ -320,7 +337,7 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. - Conditional access denied. - - .. row 18 + - .. row 20 - ``V4L2_IN_ST_VTR`` diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index 379f2be0bc92..a2f58319cebe 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -352,6 +352,13 @@ EBUSY - The timings follow the VESA Generalized Timings Formula standard + - .. row 7 + + - ``V4L2_DV_BT_STD_SDI`` + + - The timings follow the SDI Timings standard. + There are no horizontal syncs/porches at all in this format. + Total blanking timings must be set in hsync or vsync fields only. .. tabularcolumns:: |p{6.0cm}|p{11.5cm}| @@ -424,3 +431,11 @@ EBUSY R'G'B' values use limited range (i.e. 16-235) as opposed to full range (i.e. 0-255). All formats defined in CEA-861 except for the 640x480p59.94 format are CE formats. + + - .. row 8 + + - ``V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE`` + + - Some formats like SMPTE-125M have an interlaced signal with a odd + total height. For these formats, if this flag is set, the first + field has the extra line. Else, it is the second field. From 4053aad5f1fb1bf5df2c57d698a2eea40f919e9c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 19 Sep 2016 14:27:25 -0300 Subject: [PATCH 427/591] [media] videodev2.h.rst.exceptions: fix warnings Changeset ab6343956f9c ("[media] V4L2: Add documentation for SDI timings and related flags") added documentation for new V4L2 defines, but it forgot to update videodev2.h.rst.exceptions to point to where the documentation for those new values will be inside the book, causing those warnings: Documentation/output/videodev2.h.rst:6: WARNING: undefined label: v4l2-dv-bt-std-sdi (if the link has no caption the label must precede a section header) Documentation/output/videodev2.h.rst:6: WARNING: undefined label: v4l2-dv-fl-first-field-extra-line (if the link has no caption the label must precede a section header) Documentation/output/videodev2.h.rst:6: WARNING: undefined label: v4l2-in-st-no-v-lock (if the link has no caption the label must precede a section header) Documentation/output/videodev2.h.rst:6: WARNING: undefined label: v4l2-in-st-no-std-lock (if the link has no caption the label must precede a section header) Fixes: ab6343956f9c ("[media] V4L2: Add documentation for SDI timings and related flags") Cc: Charles-Antoine Couret Cc: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/videodev2.h.rst.exceptions | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions index 3828a2983acb..1d3f27d922b2 100644 --- a/Documentation/media/videodev2.h.rst.exceptions +++ b/Documentation/media/videodev2.h.rst.exceptions @@ -268,12 +268,14 @@ replace define V4L2_DV_BT_STD_CEA861 dv-bt-standards replace define V4L2_DV_BT_STD_DMT dv-bt-standards replace define V4L2_DV_BT_STD_CVT dv-bt-standards replace define V4L2_DV_BT_STD_GTF dv-bt-standards +replace define V4L2_DV_BT_STD_SDI dv-bt-standards replace define V4L2_DV_FL_REDUCED_BLANKING dv-bt-standards replace define V4L2_DV_FL_CAN_REDUCE_FPS dv-bt-standards replace define V4L2_DV_FL_REDUCED_FPS dv-bt-standards replace define V4L2_DV_FL_HALF_LINE dv-bt-standards replace define V4L2_DV_FL_IS_CE_VIDEO dv-bt-standards +replace define V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE dv-bt-standards replace define V4L2_DV_BT_656_1120 dv-timing-types @@ -301,6 +303,8 @@ replace define V4L2_IN_ST_NO_CARRIER input-status replace define V4L2_IN_ST_MACROVISION input-status replace define V4L2_IN_ST_NO_ACCESS input-status replace define V4L2_IN_ST_VTR input-status +replace define V4L2_IN_ST_NO_V_LOCK input-status +replace define V4L2_IN_ST_NO_STD_LOCK input-status replace define V4L2_IN_CAP_DV_TIMINGS input-capabilities replace define V4L2_IN_CAP_STD input-capabilities From 7aae6e2df127f9f7a96c21e21a277dd7ff063e6a Mon Sep 17 00:00:00 2001 From: Charles-Antoine Couret Date: Thu, 15 Sep 2016 12:29:51 -0300 Subject: [PATCH 428/591] [media] Add GS1662 driver, a video serializer You can read datasheet here: http://www.c-dis.net/media/871/GS1662_Datasheet.pdf It's a component which supports HD and SD CEA or SDI formats to SDI output. It's configured through SPI bus. GS1662 driver is implemented as v4l2 subdev. Signed-off-by: Charles-Antoine Couret Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 7 + drivers/media/Kconfig | 1 + drivers/media/Makefile | 2 +- drivers/media/spi/Kconfig | 9 + drivers/media/spi/Makefile | 1 + drivers/media/spi/gs1662.c | 472 +++++++++++++++++++++++++++++++++++++ 6 files changed, 491 insertions(+), 1 deletion(-) create mode 100644 drivers/media/spi/Kconfig create mode 100644 drivers/media/spi/Makefile create mode 100644 drivers/media/spi/gs1662.c diff --git a/MAINTAINERS b/MAINTAINERS index de23660823b8..5678e50fc13a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5259,6 +5259,13 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/aeroflex/ +GS1662 VIDEO SERIALIZER +M: Charles-Antoine Couret +L: linux-media@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: drivers/media/spi/gs1662.c + GSPCA FINEPIX SUBDRIVER M: Frank Zago L: linux-media@vger.kernel.org diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 962f2a9a6614..6600e59eb3c0 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -218,5 +218,6 @@ config MEDIA_ATTACH source "drivers/media/i2c/Kconfig" source "drivers/media/tuners/Kconfig" source "drivers/media/dvb-frontends/Kconfig" +source "drivers/media/spi/Kconfig" endif # MEDIA_SUPPORT diff --git a/drivers/media/Makefile b/drivers/media/Makefile index 081a7866fd44..0deaa93efdee 100644 --- a/drivers/media/Makefile +++ b/drivers/media/Makefile @@ -32,6 +32,6 @@ obj-y += rc/ # Finally, merge the drivers that require the core # -obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ +obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ spi/ obj-$(CONFIG_VIDEO_DEV) += radio/ diff --git a/drivers/media/spi/Kconfig b/drivers/media/spi/Kconfig new file mode 100644 index 000000000000..fa47c90f857d --- /dev/null +++ b/drivers/media/spi/Kconfig @@ -0,0 +1,9 @@ +if VIDEO_V4L2 + +config VIDEO_GS1662 + tristate "Gennum Serializers video" + depends on SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + ---help--- + Enable the GS1662 driver which serializes video streams. + +endif diff --git a/drivers/media/spi/Makefile b/drivers/media/spi/Makefile new file mode 100644 index 000000000000..ea64013d16cc --- /dev/null +++ b/drivers/media/spi/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_GS1662) += gs1662.o diff --git a/drivers/media/spi/gs1662.c b/drivers/media/spi/gs1662.c new file mode 100644 index 000000000000..f74342339e5a --- /dev/null +++ b/drivers/media/spi/gs1662.c @@ -0,0 +1,472 @@ +/* + * GS1662 device registration. + * + * Copyright (C) 2015-2016 Nexvision + * Author: Charles-Antoine Couret + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define REG_STATUS 0x04 +#define REG_FORCE_FMT 0x06 +#define REG_LINES_PER_FRAME 0x12 +#define REG_WORDS_PER_LINE 0x13 +#define REG_WORDS_PER_ACT_LINE 0x14 +#define REG_ACT_LINES_PER_FRAME 0x15 + +#define MASK_H_LOCK 0x001 +#define MASK_V_LOCK 0x002 +#define MASK_STD_LOCK 0x004 +#define MASK_FORCE_STD 0x020 +#define MASK_STD_STATUS 0x3E0 + +#define GS_WIDTH_MIN 720 +#define GS_WIDTH_MAX 2048 +#define GS_HEIGHT_MIN 487 +#define GS_HEIGHT_MAX 1080 +#define GS_PIXELCLOCK_MIN 10519200 +#define GS_PIXELCLOCK_MAX 74250000 + +struct gs { + struct spi_device *pdev; + struct v4l2_subdev sd; + struct v4l2_dv_timings current_timings; + int enabled; +}; + +struct gs_reg_fmt { + u16 reg_value; + struct v4l2_dv_timings format; +}; + +struct gs_reg_fmt_custom { + u16 reg_value; + __u32 width; + __u32 height; + __u64 pixelclock; + __u32 interlaced; +}; + +static const struct spi_device_id gs_id[] = { + { "gs1662", 0 }, + { } +}; +MODULE_DEVICE_TABLE(spi, gs_id); + +static const struct v4l2_dv_timings fmt_cap[] = { + V4L2_DV_BT_SDI_720X487I60, + V4L2_DV_BT_CEA_720X576P50, + V4L2_DV_BT_CEA_1280X720P24, + V4L2_DV_BT_CEA_1280X720P25, + V4L2_DV_BT_CEA_1280X720P30, + V4L2_DV_BT_CEA_1280X720P50, + V4L2_DV_BT_CEA_1280X720P60, + V4L2_DV_BT_CEA_1920X1080P24, + V4L2_DV_BT_CEA_1920X1080P25, + V4L2_DV_BT_CEA_1920X1080P30, + V4L2_DV_BT_CEA_1920X1080I50, + V4L2_DV_BT_CEA_1920X1080I60, +}; + +static const struct gs_reg_fmt reg_fmt[] = { + { 0x00, V4L2_DV_BT_CEA_1280X720P60 }, + { 0x01, V4L2_DV_BT_CEA_1280X720P60 }, + { 0x02, V4L2_DV_BT_CEA_1280X720P30 }, + { 0x03, V4L2_DV_BT_CEA_1280X720P30 }, + { 0x04, V4L2_DV_BT_CEA_1280X720P50 }, + { 0x05, V4L2_DV_BT_CEA_1280X720P50 }, + { 0x06, V4L2_DV_BT_CEA_1280X720P25 }, + { 0x07, V4L2_DV_BT_CEA_1280X720P25 }, + { 0x08, V4L2_DV_BT_CEA_1280X720P24 }, + { 0x09, V4L2_DV_BT_CEA_1280X720P24 }, + { 0x0A, V4L2_DV_BT_CEA_1920X1080I60 }, + { 0x0B, V4L2_DV_BT_CEA_1920X1080P30 }, + + /* Default value: keep this field before 0xC */ + { 0x14, V4L2_DV_BT_CEA_1920X1080I50 }, + { 0x0C, V4L2_DV_BT_CEA_1920X1080I50 }, + { 0x0D, V4L2_DV_BT_CEA_1920X1080P25 }, + { 0x0E, V4L2_DV_BT_CEA_1920X1080P25 }, + { 0x10, V4L2_DV_BT_CEA_1920X1080P24 }, + { 0x12, V4L2_DV_BT_CEA_1920X1080P24 }, + { 0x16, V4L2_DV_BT_SDI_720X487I60 }, + { 0x19, V4L2_DV_BT_SDI_720X487I60 }, + { 0x18, V4L2_DV_BT_CEA_720X576P50 }, + { 0x1A, V4L2_DV_BT_CEA_720X576P50 }, + + /* Implement following timings before enable it. + * Because of we don't have access to these theoretical timings yet. + * Workaround: use functions to get and set registers for these formats. + */ +#if 0 + { 0x0F, V4L2_DV_BT_XXX_1920X1080I25 }, /* SMPTE 274M */ + { 0x11, V4L2_DV_BT_XXX_1920X1080I24 }, /* SMPTE 274M */ + { 0x13, V4L2_DV_BT_XXX_1920X1080I25 }, /* SMPTE 274M */ + { 0x15, V4L2_DV_BT_XXX_1920X1035I60 }, /* SMPTE 260M */ + { 0x17, V4L2_DV_BT_SDI_720X507I60 }, /* SMPTE 125M */ + { 0x1B, V4L2_DV_BT_SDI_720X507I60 }, /* SMPTE 125M */ + { 0x1C, V4L2_DV_BT_XXX_2048X1080P25 }, /* SMPTE 428.1M */ +#endif +}; + +static const struct v4l2_dv_timings_cap gs_timings_cap = { + .type = V4L2_DV_BT_656_1120, + /* keep this initialization for compatibility with GCC < 4.4.6 */ + .reserved = { 0 }, + V4L2_INIT_BT_TIMINGS(GS_WIDTH_MIN, GS_WIDTH_MAX, GS_HEIGHT_MIN, + GS_HEIGHT_MAX, GS_PIXELCLOCK_MIN, GS_PIXELCLOCK_MAX, + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_SDI, + V4L2_DV_BT_CAP_PROGRESSIVE + | V4L2_DV_BT_CAP_INTERLACED) +}; + +static int gs_read_register(struct spi_device *spi, u16 addr, u16 *value) +{ + int ret; + u16 buf_addr = (0x8000 | (0x0FFF & addr)); + u16 buf_value = 0; + struct spi_message msg; + struct spi_transfer tx[] = { + { + .tx_buf = &buf_addr, + .len = 2, + .delay_usecs = 1, + }, { + .rx_buf = &buf_value, + .len = 2, + .delay_usecs = 1, + }, + }; + + spi_message_init(&msg); + spi_message_add_tail(&tx[0], &msg); + spi_message_add_tail(&tx[1], &msg); + ret = spi_sync(spi, &msg); + + *value = buf_value; + + return ret; +} + +static int gs_write_register(struct spi_device *spi, u16 addr, u16 value) +{ + int ret; + u16 buf_addr = addr; + u16 buf_value = value; + struct spi_message msg; + struct spi_transfer tx[] = { + { + .tx_buf = &buf_addr, + .len = 2, + .delay_usecs = 1, + }, { + .tx_buf = &buf_value, + .len = 2, + .delay_usecs = 1, + }, + }; + + spi_message_init(&msg); + spi_message_add_tail(&tx[0], &msg); + spi_message_add_tail(&tx[1], &msg); + ret = spi_sync(spi, &msg); + + return ret; +} + +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int gs_g_register(struct v4l2_subdev *sd, + struct v4l2_dbg_register *reg) +{ + struct spi_device *spi = v4l2_get_subdevdata(sd); + u16 val; + int ret; + + ret = gs_read_register(spi, reg->reg & 0xFFFF, &val); + reg->val = val; + reg->size = 2; + return ret; +} + +static int gs_s_register(struct v4l2_subdev *sd, + const struct v4l2_dbg_register *reg) +{ + struct spi_device *spi = v4l2_get_subdevdata(sd); + + return gs_write_register(spi, reg->reg & 0xFFFF, reg->val & 0xFFFF); +} +#endif + +static int gs_status_format(u16 status, struct v4l2_dv_timings *timings) +{ + int std = (status & MASK_STD_STATUS) >> 5; + int i; + + for (i = 0; i < ARRAY_SIZE(reg_fmt); i++) { + if (reg_fmt[i].reg_value == std) { + *timings = reg_fmt[i].format; + return 0; + } + } + + return -ERANGE; +} + +static u16 get_register_timings(struct v4l2_dv_timings *timings) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(reg_fmt); i++) { + if (v4l2_match_dv_timings(timings, ®_fmt[i].format, 0, false)) + return reg_fmt[i].reg_value | MASK_FORCE_STD; + } + + return 0x0; +} + +static inline struct gs *to_gs(struct v4l2_subdev *sd) +{ + return container_of(sd, struct gs, sd); +} + +static int gs_s_dv_timings(struct v4l2_subdev *sd, + struct v4l2_dv_timings *timings) +{ + struct gs *gs = to_gs(sd); + int reg_value; + + reg_value = get_register_timings(timings); + if (reg_value == 0x0) + return -EINVAL; + + gs->current_timings = *timings; + return 0; +} + +static int gs_g_dv_timings(struct v4l2_subdev *sd, + struct v4l2_dv_timings *timings) +{ + struct gs *gs = to_gs(sd); + + *timings = gs->current_timings; + return 0; +} + +static int gs_query_dv_timings(struct v4l2_subdev *sd, + struct v4l2_dv_timings *timings) +{ + struct gs *gs = to_gs(sd); + struct v4l2_dv_timings fmt; + u16 reg_value, i; + int ret; + + if (gs->enabled) + return -EBUSY; + + /* Check if the component detect a line, a frame or something else + * which looks like a video signal activity.*/ + for (i = 0; i < 4; i++) { + gs_read_register(gs->pdev, REG_LINES_PER_FRAME + i, ®_value); + if (reg_value) + break; + } + + /* If no register reports a video signal */ + if (i >= 4) + return -ENOLINK; + + gs_read_register(gs->pdev, REG_STATUS, ®_value); + if (!(reg_value & MASK_H_LOCK) || !(reg_value & MASK_V_LOCK)) + return -ENOLCK; + if (!(reg_value & MASK_STD_LOCK)) + return -ERANGE; + + ret = gs_status_format(reg_value, &fmt); + + if (ret < 0) + return ret; + + *timings = fmt; + return 0; +} + +static int gs_enum_dv_timings(struct v4l2_subdev *sd, + struct v4l2_enum_dv_timings *timings) +{ + if (timings->index >= ARRAY_SIZE(fmt_cap)) + return -EINVAL; + + if (timings->pad != 0) + return -EINVAL; + + timings->timings = fmt_cap[timings->index]; + return 0; +} + +static int gs_s_stream(struct v4l2_subdev *sd, int enable) +{ + struct gs *gs = to_gs(sd); + int reg_value; + + if (gs->enabled == enable) + return 0; + + gs->enabled = enable; + + if (enable) { + /* To force the specific format */ + reg_value = get_register_timings(&gs->current_timings); + return gs_write_register(gs->pdev, REG_FORCE_FMT, reg_value); + } else { + /* To renable auto-detection mode */ + return gs_write_register(gs->pdev, REG_FORCE_FMT, 0x0); + } +} + +static int gs_g_input_status(struct v4l2_subdev *sd, u32 *status) +{ + struct gs *gs = to_gs(sd); + u16 reg_value, i; + int ret; + + /* Check if the component detect a line, a frame or something else + * which looks like a video signal activity.*/ + for (i = 0; i < 4; i++) { + ret = gs_read_register(gs->pdev, + REG_LINES_PER_FRAME + i, ®_value); + if (reg_value) + break; + if (ret) { + *status = V4L2_IN_ST_NO_POWER; + return ret; + } + } + + /* If no register reports a video signal */ + if (i >= 4) + *status |= V4L2_IN_ST_NO_SIGNAL; + + ret = gs_read_register(gs->pdev, REG_STATUS, ®_value); + if (!(reg_value & MASK_H_LOCK)) + *status |= V4L2_IN_ST_NO_H_LOCK; + if (!(reg_value & MASK_V_LOCK)) + *status |= V4L2_IN_ST_NO_V_LOCK; + if (!(reg_value & MASK_STD_LOCK)) + *status |= V4L2_IN_ST_NO_STD_LOCK; + + return ret; +} + +static int gs_dv_timings_cap(struct v4l2_subdev *sd, + struct v4l2_dv_timings_cap *cap) +{ + if (cap->pad != 0) + return -EINVAL; + + *cap = gs_timings_cap; + return 0; +} + +/* V4L2 core operation handlers */ +static const struct v4l2_subdev_core_ops gs_core_ops = { +#ifdef CONFIG_VIDEO_ADV_DEBUG + .g_register = gs_g_register, + .s_register = gs_s_register, +#endif +}; + +static const struct v4l2_subdev_video_ops gs_video_ops = { + .s_dv_timings = gs_s_dv_timings, + .g_dv_timings = gs_g_dv_timings, + .s_stream = gs_s_stream, + .g_input_status = gs_g_input_status, + .query_dv_timings = gs_query_dv_timings, +}; + +static const struct v4l2_subdev_pad_ops gs_pad_ops = { + .enum_dv_timings= gs_enum_dv_timings, + .dv_timings_cap = gs_dv_timings_cap, +}; + +/* V4L2 top level operation handlers */ +static const struct v4l2_subdev_ops gs_ops = { + .core = &gs_core_ops, + .video = &gs_video_ops, + .pad = &gs_pad_ops, +}; + +static int gs_probe(struct spi_device *spi) +{ + int ret; + struct gs *gs; + struct v4l2_subdev *sd; + + gs = devm_kzalloc(&spi->dev, sizeof(struct gs), GFP_KERNEL); + if (!gs) + return -ENOMEM; + + gs->pdev = spi; + sd = &gs->sd; + + spi->mode = SPI_MODE_0; + spi->irq = -1; + spi->max_speed_hz = 10000000; + spi->bits_per_word = 16; + ret = spi_setup(spi); + v4l2_spi_subdev_init(sd, spi, &gs_ops); + + gs->current_timings = reg_fmt[0].format; + gs->enabled = 0; + + /* Set H_CONFIG to SMPTE timings */ + gs_write_register(spi, 0x0, 0x300); + + return ret; +} + +static int gs_remove(struct spi_device *spi) +{ + struct v4l2_subdev *sd = spi_get_drvdata(spi); + struct gs *gs = to_gs(sd); + + v4l2_device_unregister_subdev(sd); + kfree(gs); + return 0; +} + +static struct spi_driver gs_driver = { + .driver = { + .name = "gs1662", + .owner = THIS_MODULE, + }, + + .probe = gs_probe, + .remove = gs_remove, + .id_table = gs_id, +}; + +module_spi_driver(gs_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Charles-Antoine Couret "); +MODULE_DESCRIPTION("Gennum GS1662 HD/SD-SDI Serializer driver"); From 8283a0929922b331dbd73db26520443136941c48 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 15 Sep 2016 12:18:14 -0300 Subject: [PATCH 429/591] [media] media Kconfig: improve the spi integration The SPI driver looked a bit lonely in the config menu, and it didn't support the autoselect. Shift things around a bit so it looks more logical. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/Kconfig | 8 ++++---- drivers/media/i2c/Kconfig | 2 +- drivers/media/spi/Kconfig | 5 +++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 6600e59eb3c0..7b8540291217 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -180,14 +180,14 @@ source "drivers/media/firewire/Kconfig" # Common driver options source "drivers/media/common/Kconfig" -comment "Media ancillary drivers (tuners, sensors, i2c, frontends)" +comment "Media ancillary drivers (tuners, sensors, i2c, spi, frontends)" # -# Ancillary drivers (tuners, i2c, frontends) +# Ancillary drivers (tuners, i2c, spi, frontends) # config MEDIA_SUBDRV_AUTOSELECT - bool "Autoselect ancillary drivers (tuners, sensors, i2c, frontends)" + bool "Autoselect ancillary drivers (tuners, sensors, i2c, spi, frontends)" depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_CAMERA_SUPPORT || MEDIA_SDR_SUPPORT depends on HAS_IOMEM select I2C @@ -216,8 +216,8 @@ config MEDIA_ATTACH default MODULES source "drivers/media/i2c/Kconfig" +source "drivers/media/spi/Kconfig" source "drivers/media/tuners/Kconfig" source "drivers/media/dvb-frontends/Kconfig" -source "drivers/media/spi/Kconfig" endif # MEDIA_SUPPORT diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 7f929336c409..2669b4bad910 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -21,7 +21,7 @@ config VIDEO_IR_I2C # Encoder / Decoder module configuration # -menu "Encoders, decoders, sensors and other helper chips" +menu "I2C Encoders, decoders, sensors and other helper chips" visible if !MEDIA_SUBDRV_AUTOSELECT || COMPILE_TEST comment "Audio decoders, processors and mixers" diff --git a/drivers/media/spi/Kconfig b/drivers/media/spi/Kconfig index fa47c90f857d..a21f5a39a440 100644 --- a/drivers/media/spi/Kconfig +++ b/drivers/media/spi/Kconfig @@ -1,9 +1,14 @@ if VIDEO_V4L2 +menu "SPI helper chips" + visible if !MEDIA_SUBDRV_AUTOSELECT || COMPILE_TEST + config VIDEO_GS1662 tristate "Gennum Serializers video" depends on SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API ---help--- Enable the GS1662 driver which serializes video streams. +endmenu + endif From 3c3ba5452e8a0e2dd9fb89222feb88f11ec6ff7a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 19 Sep 2016 14:39:49 -0300 Subject: [PATCH 430/591] [media] gs1662: make checkpatch happy WARNING: line over 80 characters + GS_HEIGHT_MAX, GS_PIXELCLOCK_MIN, GS_PIXELCLOCK_MAX, WARNING: line over 80 characters + if (v4l2_match_dv_timings(timings, ®_fmt[i].format, 0, false)) WARNING: Block comments use a trailing */ on a separate line + * which looks like a video signal activity.*/ WARNING: else is not generally useful after a break or return + return gs_write_register(gs->pdev, REG_FORCE_FMT, reg_value); + } else { WARNING: Block comments use a trailing */ on a separate line + * which looks like a video signal activity.*/ ERROR: spaces required around that '=' (ctx:VxW) + .enum_dv_timings= gs_enum_dv_timings, ^ Signed-off-by: Mauro Carvalho Chehab --- drivers/media/spi/gs1662.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/media/spi/gs1662.c b/drivers/media/spi/gs1662.c index f74342339e5a..d76f36233f43 100644 --- a/drivers/media/spi/gs1662.c +++ b/drivers/media/spi/gs1662.c @@ -134,7 +134,8 @@ static const struct v4l2_dv_timings_cap gs_timings_cap = { /* keep this initialization for compatibility with GCC < 4.4.6 */ .reserved = { 0 }, V4L2_INIT_BT_TIMINGS(GS_WIDTH_MIN, GS_WIDTH_MAX, GS_HEIGHT_MIN, - GS_HEIGHT_MAX, GS_PIXELCLOCK_MIN, GS_PIXELCLOCK_MAX, + GS_HEIGHT_MAX, GS_PIXELCLOCK_MIN, + GS_PIXELCLOCK_MAX, V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_SDI, V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_INTERLACED) @@ -237,7 +238,8 @@ static u16 get_register_timings(struct v4l2_dv_timings *timings) int i; for (i = 0; i < ARRAY_SIZE(reg_fmt); i++) { - if (v4l2_match_dv_timings(timings, ®_fmt[i].format, 0, false)) + if (v4l2_match_dv_timings(timings, ®_fmt[i].format, 0, + false)) return reg_fmt[i].reg_value | MASK_FORCE_STD; } @@ -283,8 +285,10 @@ static int gs_query_dv_timings(struct v4l2_subdev *sd, if (gs->enabled) return -EBUSY; - /* Check if the component detect a line, a frame or something else - * which looks like a video signal activity.*/ + /* + * Check if the component detect a line, a frame or something else + * which looks like a video signal activity. + */ for (i = 0; i < 4; i++) { gs_read_register(gs->pdev, REG_LINES_PER_FRAME + i, ®_value); if (reg_value) @@ -337,10 +341,10 @@ static int gs_s_stream(struct v4l2_subdev *sd, int enable) /* To force the specific format */ reg_value = get_register_timings(&gs->current_timings); return gs_write_register(gs->pdev, REG_FORCE_FMT, reg_value); - } else { - /* To renable auto-detection mode */ - return gs_write_register(gs->pdev, REG_FORCE_FMT, 0x0); } + + /* To renable auto-detection mode */ + return gs_write_register(gs->pdev, REG_FORCE_FMT, 0x0); } static int gs_g_input_status(struct v4l2_subdev *sd, u32 *status) @@ -349,8 +353,10 @@ static int gs_g_input_status(struct v4l2_subdev *sd, u32 *status) u16 reg_value, i; int ret; - /* Check if the component detect a line, a frame or something else - * which looks like a video signal activity.*/ + /* + * Check if the component detect a line, a frame or something else + * which looks like a video signal activity. + */ for (i = 0; i < 4; i++) { ret = gs_read_register(gs->pdev, REG_LINES_PER_FRAME + i, ®_value); @@ -404,7 +410,7 @@ static const struct v4l2_subdev_video_ops gs_video_ops = { }; static const struct v4l2_subdev_pad_ops gs_pad_ops = { - .enum_dv_timings= gs_enum_dv_timings, + .enum_dv_timings = gs_enum_dv_timings, .dv_timings_cap = gs_dv_timings_cap, }; From e4e70a147a48618a36ae1b81c641516cb9d45993 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 8 Jul 2016 06:20:51 -0300 Subject: [PATCH 431/591] [media] v4l: vsp1: Prevent pipelines from running when not streaming Pipelines can only be run if all their video nodes are streaming. Commit b4dfb9b35a19 ("[media] v4l: vsp1: Stop the pipeline upon the first STREAMOFF") fixed the pipeline stop sequence, but introduced a race condition that makes it possible to run a pipeline after stopping the stream on a video node by queuing a buffer on the other side of the pipeline. Fix this by clearing the buffers ready flag when stopping the stream, which will prevent the QBUF handler from running the pipeline. Fixes: b4dfb9b35a19 ("[media] v4l: vsp1: Stop the pipeline upon the first STREAMOFF") Reported-by: Kieran Bingham Tested-by: Kieran Bingham Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_video.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index 9fb4fc26a359..ed9759e8a6fc 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -675,6 +675,13 @@ static void vsp1_video_stop_streaming(struct vb2_queue *vq) unsigned long flags; int ret; + /* Clear the buffers ready flag to make sure the device won't be started + * by a QBUF on the video node on the other side of the pipeline. + */ + spin_lock_irqsave(&video->irqlock, flags); + pipe->buffers_ready &= ~(1 << video->pipe_index); + spin_unlock_irqrestore(&video->irqlock, flags); + mutex_lock(&pipe->lock); if (--pipe->stream_count == pipe->num_inputs) { /* Stop the pipeline. */ From 34e77ed84b274d20415067306b855bd87f761f5e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 26 Jun 2016 08:09:31 -0300 Subject: [PATCH 432/591] [media] v4l: vsp1: Protect against race conditions between get and set format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The subdev userspace API isn't serialized in the core, serialize access to formats and selection rectangles in the driver. Signed-off-by: Laurent Pinchart Acked-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_bru.c | 28 +++++++++++---- drivers/media/platform/vsp1/vsp1_clu.c | 15 +++++--- drivers/media/platform/vsp1/vsp1_entity.c | 22 ++++++++++-- drivers/media/platform/vsp1/vsp1_entity.h | 4 ++- drivers/media/platform/vsp1/vsp1_hsit.c | 15 +++++--- drivers/media/platform/vsp1/vsp1_lif.c | 15 +++++--- drivers/media/platform/vsp1/vsp1_lut.c | 15 +++++--- drivers/media/platform/vsp1/vsp1_rwpf.c | 44 +++++++++++++++++------ drivers/media/platform/vsp1/vsp1_sru.c | 26 ++++++++++---- drivers/media/platform/vsp1/vsp1_uds.c | 26 ++++++++++---- 10 files changed, 161 insertions(+), 49 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c index 8268b87727a7..5ae3c8d1dcf0 100644 --- a/drivers/media/platform/vsp1/vsp1_bru.c +++ b/drivers/media/platform/vsp1/vsp1_bru.c @@ -142,10 +142,15 @@ static int bru_set_format(struct v4l2_subdev *subdev, struct vsp1_bru *bru = to_bru(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&bru->entity.lock); config = vsp1_entity_get_pad_config(&bru->entity, cfg, fmt->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } bru_try_format(bru, config, fmt->pad, &fmt->format); @@ -174,7 +179,9 @@ static int bru_set_format(struct v4l2_subdev *subdev, } } - return 0; +done: + mutex_unlock(&bru->entity.lock); + return ret; } static int bru_get_selection(struct v4l2_subdev *subdev, @@ -201,7 +208,9 @@ static int bru_get_selection(struct v4l2_subdev *subdev, if (!config) return -EINVAL; + mutex_lock(&bru->entity.lock); sel->r = *bru_get_compose(bru, config, sel->pad); + mutex_unlock(&bru->entity.lock); return 0; default: @@ -217,6 +226,7 @@ static int bru_set_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; struct v4l2_rect *compose; + int ret = 0; if (sel->pad == bru->entity.source_pad) return -EINVAL; @@ -224,9 +234,13 @@ static int bru_set_selection(struct v4l2_subdev *subdev, if (sel->target != V4L2_SEL_TGT_COMPOSE) return -EINVAL; + mutex_lock(&bru->entity.lock); + config = vsp1_entity_get_pad_config(&bru->entity, cfg, sel->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } /* The compose rectangle top left corner must be inside the output * frame. @@ -246,7 +260,9 @@ static int bru_set_selection(struct v4l2_subdev *subdev, compose = bru_get_compose(bru, config, sel->pad); *compose = sel->r; - return 0; +done: + mutex_unlock(&bru->entity.lock); + return ret; } static const struct v4l2_subdev_pad_ops bru_pad_ops = { diff --git a/drivers/media/platform/vsp1/vsp1_clu.c b/drivers/media/platform/vsp1/vsp1_clu.c index b63d2dbe5ea3..e1fd03811dda 100644 --- a/drivers/media/platform/vsp1/vsp1_clu.c +++ b/drivers/media/platform/vsp1/vsp1_clu.c @@ -148,10 +148,15 @@ static int clu_set_format(struct v4l2_subdev *subdev, struct vsp1_clu *clu = to_clu(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&clu->entity.lock); config = vsp1_entity_get_pad_config(&clu->entity, cfg, fmt->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } /* Default to YUV if the requested format is not supported. */ if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && @@ -164,7 +169,7 @@ static int clu_set_format(struct v4l2_subdev *subdev, if (fmt->pad == CLU_PAD_SOURCE) { /* The CLU output format can't be modified. */ fmt->format = *format; - return 0; + goto done; } format->code = fmt->format.code; @@ -182,7 +187,9 @@ static int clu_set_format(struct v4l2_subdev *subdev, CLU_PAD_SOURCE); *format = fmt->format; - return 0; +done: + mutex_unlock(&clu->entity.lock); + return ret; } /* ----------------------------------------------------------------------------- diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index 4cf6cc719c00..da673495c222 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c @@ -51,6 +51,9 @@ void vsp1_entity_route_setup(struct vsp1_entity *source, * @cfg: the TRY pad configuration * @which: configuration selector (ACTIVE or TRY) * + * When called with which set to V4L2_SUBDEV_FORMAT_ACTIVE the caller must hold + * the entity lock to access the returned configuration. + * * Return the pad configuration requested by the which argument. The TRY * configuration is passed explicitly to the function through the cfg argument * and simply returned when requested. The ACTIVE configuration comes from the @@ -160,7 +163,9 @@ int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev, if (!config) return -EINVAL; + mutex_lock(&entity->lock); fmt->format = *vsp1_entity_get_pad_format(entity, config, fmt->pad); + mutex_unlock(&entity->lock); return 0; } @@ -204,8 +209,10 @@ int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev, if (!config) return -EINVAL; + mutex_lock(&entity->lock); format = vsp1_entity_get_pad_format(entity, config, 0); code->code = format->code; + mutex_unlock(&entity->lock); } return 0; @@ -235,6 +242,7 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, struct vsp1_entity *entity = to_vsp1_entity(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; config = vsp1_entity_get_pad_config(entity, cfg, fse->which); if (!config) @@ -242,8 +250,12 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, format = vsp1_entity_get_pad_format(entity, config, fse->pad); - if (fse->index || fse->code != format->code) - return -EINVAL; + mutex_lock(&entity->lock); + + if (fse->index || fse->code != format->code) { + ret = -EINVAL; + goto done; + } if (fse->pad == 0) { fse->min_width = min_width; @@ -260,7 +272,9 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, fse->max_height = format->height; } - return 0; +done: + mutex_unlock(&entity->lock); + return ret; } /* ----------------------------------------------------------------------------- @@ -358,6 +372,8 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, if (i == ARRAY_SIZE(vsp1_routes)) return -EINVAL; + mutex_init(&entity->lock); + entity->vsp1 = vsp1; entity->source_pad = num_pads - 1; diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index b43457fd2c43..b5e4dbb1f7d4 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h @@ -14,7 +14,7 @@ #define __VSP1_ENTITY_H__ #include -#include +#include #include @@ -96,6 +96,8 @@ struct vsp1_entity { struct v4l2_subdev subdev; struct v4l2_subdev_pad_config *config; + + struct mutex lock; /* Protects the pad config */ }; static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev) diff --git a/drivers/media/platform/vsp1/vsp1_hsit.c b/drivers/media/platform/vsp1/vsp1_hsit.c index 6e5077beb38c..6ffbedb5c095 100644 --- a/drivers/media/platform/vsp1/vsp1_hsit.c +++ b/drivers/media/platform/vsp1/vsp1_hsit.c @@ -71,10 +71,15 @@ static int hsit_set_format(struct v4l2_subdev *subdev, struct vsp1_hsit *hsit = to_hsit(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&hsit->entity.lock); config = vsp1_entity_get_pad_config(&hsit->entity, cfg, fmt->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } format = vsp1_entity_get_pad_format(&hsit->entity, config, fmt->pad); @@ -83,7 +88,7 @@ static int hsit_set_format(struct v4l2_subdev *subdev, * modified. */ fmt->format = *format; - return 0; + goto done; } format->code = hsit->inverse ? MEDIA_BUS_FMT_AHSV8888_1X32 @@ -104,7 +109,9 @@ static int hsit_set_format(struct v4l2_subdev *subdev, format->code = hsit->inverse ? MEDIA_BUS_FMT_ARGB8888_1X32 : MEDIA_BUS_FMT_AHSV8888_1X32; - return 0; +done: + mutex_unlock(&hsit->entity.lock); + return ret; } static const struct v4l2_subdev_pad_ops hsit_pad_ops = { diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c index a720063f38c5..702df863b13a 100644 --- a/drivers/media/platform/vsp1/vsp1_lif.c +++ b/drivers/media/platform/vsp1/vsp1_lif.c @@ -66,10 +66,15 @@ static int lif_set_format(struct v4l2_subdev *subdev, struct vsp1_lif *lif = to_lif(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&lif->entity.lock); config = vsp1_entity_get_pad_config(&lif->entity, cfg, fmt->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } /* Default to YUV if the requested format is not supported. */ if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && @@ -83,7 +88,7 @@ static int lif_set_format(struct v4l2_subdev *subdev, * format. */ fmt->format = *format; - return 0; + goto done; } format->code = fmt->format.code; @@ -101,7 +106,9 @@ static int lif_set_format(struct v4l2_subdev *subdev, LIF_PAD_SOURCE); *format = fmt->format; - return 0; +done: + mutex_unlock(&lif->entity.lock); + return ret; } static const struct v4l2_subdev_pad_ops lif_pad_ops = { diff --git a/drivers/media/platform/vsp1/vsp1_lut.c b/drivers/media/platform/vsp1/vsp1_lut.c index dc31de9602ba..e1c0bb7535e4 100644 --- a/drivers/media/platform/vsp1/vsp1_lut.c +++ b/drivers/media/platform/vsp1/vsp1_lut.c @@ -124,10 +124,15 @@ static int lut_set_format(struct v4l2_subdev *subdev, struct vsp1_lut *lut = to_lut(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&lut->entity.lock); config = vsp1_entity_get_pad_config(&lut->entity, cfg, fmt->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } /* Default to YUV if the requested format is not supported. */ if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && @@ -140,7 +145,7 @@ static int lut_set_format(struct v4l2_subdev *subdev, if (fmt->pad == LUT_PAD_SOURCE) { /* The LUT output format can't be modified. */ fmt->format = *format; - return 0; + goto done; } format->code = fmt->format.code; @@ -158,7 +163,9 @@ static int lut_set_format(struct v4l2_subdev *subdev, LUT_PAD_SOURCE); *format = fmt->format; - return 0; +done: + mutex_unlock(&lut->entity.lock); + return ret; } /* ----------------------------------------------------------------------------- diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rwpf.c index 8d461b375e91..8cb87e96b78b 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/vsp1/vsp1_rwpf.c @@ -67,10 +67,15 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; struct v4l2_rect *crop; + int ret = 0; + + mutex_lock(&rwpf->entity.lock); config = vsp1_entity_get_pad_config(&rwpf->entity, cfg, fmt->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } /* Default to YUV if the requested format is not supported. */ if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && @@ -85,7 +90,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, */ format->code = fmt->format.code; fmt->format = *format; - return 0; + goto done; } format->code = fmt->format.code; @@ -110,7 +115,9 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, RWPF_PAD_SOURCE); *format = fmt->format; - return 0; +done: + mutex_unlock(&rwpf->entity.lock); + return ret; } static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, @@ -120,14 +127,19 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, struct vsp1_rwpf *rwpf = to_rwpf(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; /* Cropping is implemented on the sink pad. */ if (sel->pad != RWPF_PAD_SINK) return -EINVAL; + mutex_lock(&rwpf->entity.lock); + config = vsp1_entity_get_pad_config(&rwpf->entity, cfg, sel->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } switch (sel->target) { case V4L2_SEL_TGT_CROP: @@ -144,10 +156,13 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, break; default: - return -EINVAL; + ret = -EINVAL; + break; } - return 0; +done: + mutex_unlock(&rwpf->entity.lock); + return ret; } static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, @@ -158,6 +173,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; struct v4l2_rect *crop; + int ret = 0; /* Cropping is implemented on the sink pad. */ if (sel->pad != RWPF_PAD_SINK) @@ -166,9 +182,13 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, if (sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; + mutex_lock(&rwpf->entity.lock); + config = vsp1_entity_get_pad_config(&rwpf->entity, cfg, sel->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } /* Make sure the crop rectangle is entirely contained in the image. The * WPF top and left offsets are limited to 255. @@ -206,7 +226,9 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, format->width = crop->width; format->height = crop->height; - return 0; +done: + mutex_unlock(&rwpf->entity.lock); + return ret; } const struct v4l2_subdev_pad_ops vsp1_rwpf_pad_ops = { diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c index 47f5e0cea2ce..6e13cdfa5ed4 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.c +++ b/drivers/media/platform/vsp1/vsp1_sru.c @@ -128,6 +128,7 @@ static int sru_enum_frame_size(struct v4l2_subdev *subdev, struct vsp1_sru *sru = to_sru(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; config = vsp1_entity_get_pad_config(&sru->entity, cfg, fse->which); if (!config) @@ -135,8 +136,12 @@ static int sru_enum_frame_size(struct v4l2_subdev *subdev, format = vsp1_entity_get_pad_format(&sru->entity, config, SRU_PAD_SINK); - if (fse->index || fse->code != format->code) - return -EINVAL; + mutex_lock(&sru->entity.lock); + + if (fse->index || fse->code != format->code) { + ret = -EINVAL; + goto done; + } if (fse->pad == SRU_PAD_SINK) { fse->min_width = SRU_MIN_SIZE; @@ -156,7 +161,9 @@ static int sru_enum_frame_size(struct v4l2_subdev *subdev, } } - return 0; +done: + mutex_unlock(&sru->entity.lock); + return ret; } static void sru_try_format(struct vsp1_sru *sru, @@ -217,10 +224,15 @@ static int sru_set_format(struct v4l2_subdev *subdev, struct vsp1_sru *sru = to_sru(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&sru->entity.lock); config = vsp1_entity_get_pad_config(&sru->entity, cfg, fmt->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } sru_try_format(sru, config, fmt->pad, &fmt->format); @@ -236,7 +248,9 @@ static int sru_set_format(struct v4l2_subdev *subdev, sru_try_format(sru, config, SRU_PAD_SOURCE, format); } - return 0; +done: + mutex_unlock(&sru->entity.lock); + return ret; } static const struct v4l2_subdev_pad_ops sru_pad_ops = { diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c index 652dcd895022..a8fc893a31ee 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.c +++ b/drivers/media/platform/vsp1/vsp1_uds.c @@ -133,6 +133,7 @@ static int uds_enum_frame_size(struct v4l2_subdev *subdev, struct vsp1_uds *uds = to_uds(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; config = vsp1_entity_get_pad_config(&uds->entity, cfg, fse->which); if (!config) @@ -141,8 +142,12 @@ static int uds_enum_frame_size(struct v4l2_subdev *subdev, format = vsp1_entity_get_pad_format(&uds->entity, config, UDS_PAD_SINK); - if (fse->index || fse->code != format->code) - return -EINVAL; + mutex_lock(&uds->entity.lock); + + if (fse->index || fse->code != format->code) { + ret = -EINVAL; + goto done; + } if (fse->pad == UDS_PAD_SINK) { fse->min_width = UDS_MIN_SIZE; @@ -156,7 +161,9 @@ static int uds_enum_frame_size(struct v4l2_subdev *subdev, &fse->max_height); } - return 0; +done: + mutex_unlock(&uds->entity.lock); + return ret; } static void uds_try_format(struct vsp1_uds *uds, @@ -202,10 +209,15 @@ static int uds_set_format(struct v4l2_subdev *subdev, struct vsp1_uds *uds = to_uds(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + int ret = 0; + + mutex_lock(&uds->entity.lock); config = vsp1_entity_get_pad_config(&uds->entity, cfg, fmt->which); - if (!config) - return -EINVAL; + if (!config) { + ret = -EINVAL; + goto done; + } uds_try_format(uds, config, fmt->pad, &fmt->format); @@ -221,7 +233,9 @@ static int uds_set_format(struct v4l2_subdev *subdev, uds_try_format(uds, config, UDS_PAD_SOURCE, format); } - return 0; +done: + mutex_unlock(&uds->entity.lock); + return ret; } /* ----------------------------------------------------------------------------- From 7a9e7bd32ba43a050e868ba44c4a0665079a8264 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Fri, 2 Sep 2016 07:48:27 -0300 Subject: [PATCH 433/591] [media] v4l: vsp1: Ensure pipeline locking in resume path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vsp1_pipeline_ready() and vsp1_pipeline_run() functions must be called with the pipeline lock held, fix the resume code path. Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart Acked-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_pipe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c b/drivers/media/platform/vsp1/vsp1_pipe.c index 3e75fb3fcace..474de82165d8 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.c +++ b/drivers/media/platform/vsp1/vsp1_pipe.c @@ -365,6 +365,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1) void vsp1_pipelines_resume(struct vsp1_device *vsp1) { + unsigned long flags; unsigned int i; /* Resume all running pipelines. */ @@ -379,7 +380,9 @@ void vsp1_pipelines_resume(struct vsp1_device *vsp1) if (pipe == NULL) continue; + spin_lock_irqsave(&pipe->irqlock, flags); if (vsp1_pipeline_ready(pipe)) vsp1_pipeline_run(pipe); + spin_unlock_irqrestore(&pipe->irqlock, flags); } } From bfb4d5be9e1d5a70d0710e815d15a4245eaaafc4 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 6 Sep 2016 14:07:09 -0300 Subject: [PATCH 434/591] [media] v4l: vsp1: Repair race between frame end and qbuf handler The frame-end function releases and completes the buffers on the input and output entities of the pipe before marking the pipe->state as 'STOPPED'. This introduces a race whereby with the pipe->state still 'RUNNING', a QBUF handler can commence processing a frame before the frame_end function has completed. In the event that this happens, a frame queued by QBUF hangs due to the incorrect pipe->state setting which prevents vsp1_pipeline_run from issuing a CMD_STRCMD. By locking the entire function we prevent this from occurring, but we also change the locking state of the buffer release code. This has been analysed visually as acceptable, but it must be considered that this now causes the video->irqlock to be taken under the pipe->irqlock context. Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_video.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index ed9759e8a6fc..cd7d215ed455 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -234,18 +234,13 @@ static void vsp1_video_frame_end(struct vsp1_pipeline *pipe, { struct vsp1_video *video = rwpf->video; struct vsp1_vb2_buffer *buf; - unsigned long flags; buf = vsp1_video_complete_buffer(video); if (buf == NULL) return; - spin_lock_irqsave(&pipe->irqlock, flags); - video->rwpf->mem = buf->mem; pipe->buffers_ready |= 1 << video->pipe_index; - - spin_unlock_irqrestore(&pipe->irqlock, flags); } static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe) @@ -285,6 +280,8 @@ static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe) unsigned long flags; unsigned int i; + spin_lock_irqsave(&pipe->irqlock, flags); + /* Complete buffers on all video nodes. */ for (i = 0; i < vsp1->info->rpf_count; ++i) { if (!pipe->inputs[i]) @@ -295,8 +292,6 @@ static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe) vsp1_video_frame_end(pipe, pipe->output); - spin_lock_irqsave(&pipe->irqlock, flags); - state = pipe->state; pipe->state = VSP1_PIPELINE_STOPPED; From 4c4b57b91bee77c442809b20f1bbeb490a5db5cc Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 6 Sep 2016 06:55:02 -0300 Subject: [PATCH 435/591] [media] v4l: vsp1: Use DFE instead of FRE for frame end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DFE and FRE interrupts are both fired at frame completion, as each display list processes a single frame. This won't be true anymore when using image partitioning, switch to DFE in preparation. Signed-off-by: Laurent Pinchart Signed-off-by: Kieran Bingham Acked-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_drv.c | 2 +- drivers/media/platform/vsp1/vsp1_wpf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index 92418fc09511..57c713a4e1df 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -60,7 +60,7 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data) status = vsp1_read(vsp1, VI6_WPF_IRQ_STA(i)); vsp1_write(vsp1, VI6_WPF_IRQ_STA(i), ~status & mask); - if (status & VI6_WFP_IRQ_STA_FRE) { + if (status & VI6_WFP_IRQ_STA_DFE) { vsp1_pipeline_frame_end(wpf->pipe); ret = IRQ_HANDLED; } diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 31983169c24a..748f5af90b7e 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -318,7 +318,7 @@ static void wpf_configure(struct vsp1_entity *entity, /* Enable interrupts */ vsp1_dl_list_write(dl, VI6_WPF_IRQ_STA(wpf->entity.index), 0); vsp1_dl_list_write(dl, VI6_WPF_IRQ_ENB(wpf->entity.index), - VI6_WFP_IRQ_ENB_FREE); + VI6_WFP_IRQ_ENB_DFEE); } static const struct vsp1_entity_operations wpf_entity_ops = { From b61bead62ec4264fbb529a5730558f4c87a46ae4 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Sep 2016 22:41:06 -0300 Subject: [PATCH 436/591] [media] v4l: vsp1: Disable cropping on WPF sink pad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cropping on the WPF sink pad restricts the left and top coordinates to 0-255. The same result can be obtained by cropping on the RPF without any such restriction, this feature isn't useful. Disable it. Signed-off-by: Laurent Pinchart Acked-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_rwpf.c | 37 +++++++++++++------------ drivers/media/platform/vsp1/vsp1_wpf.c | 18 +++++------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rwpf.c index 8cb87e96b78b..a3ace8df7f4d 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/vsp1/vsp1_rwpf.c @@ -66,7 +66,6 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, struct vsp1_rwpf *rwpf = to_rwpf(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; - struct v4l2_rect *crop; int ret = 0; mutex_lock(&rwpf->entity.lock); @@ -103,12 +102,16 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, fmt->format = *format; - /* Update the sink crop rectangle. */ - crop = vsp1_rwpf_get_crop(rwpf, config); - crop->left = 0; - crop->top = 0; - crop->width = fmt->format.width; - crop->height = fmt->format.height; + if (rwpf->entity.type == VSP1_ENTITY_RPF) { + struct v4l2_rect *crop; + + /* Update the sink crop rectangle. */ + crop = vsp1_rwpf_get_crop(rwpf, config); + crop->left = 0; + crop->top = 0; + crop->width = fmt->format.width; + crop->height = fmt->format.height; + } /* Propagate the format to the source pad. */ format = vsp1_entity_get_pad_format(&rwpf->entity, config, @@ -129,8 +132,10 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, struct v4l2_mbus_framefmt *format; int ret = 0; - /* Cropping is implemented on the sink pad. */ - if (sel->pad != RWPF_PAD_SINK) + /* Cropping is only supported on the RPF and is implemented on the sink + * pad. + */ + if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK) return -EINVAL; mutex_lock(&rwpf->entity.lock); @@ -175,8 +180,10 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, struct v4l2_rect *crop; int ret = 0; - /* Cropping is implemented on the sink pad. */ - if (sel->pad != RWPF_PAD_SINK) + /* Cropping is only supported on the RPF and is implemented on the sink + * pad. + */ + if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK) return -EINVAL; if (sel->target != V4L2_SEL_TGT_CROP) @@ -190,9 +197,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, goto done; } - /* Make sure the crop rectangle is entirely contained in the image. The - * WPF top and left offsets are limited to 255. - */ + /* Make sure the crop rectangle is entirely contained in the image. */ format = vsp1_entity_get_pad_format(&rwpf->entity, config, RWPF_PAD_SINK); @@ -208,10 +213,6 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, sel->r.left = min_t(unsigned int, sel->r.left, format->width - 2); sel->r.top = min_t(unsigned int, sel->r.top, format->height - 2); - if (rwpf->entity.type == VSP1_ENTITY_WPF) { - sel->r.left = min_t(unsigned int, sel->r.left, 255); - sel->r.top = min_t(unsigned int, sel->r.top, 255); - } sel->r.width = min_t(unsigned int, sel->r.width, format->width - sel->r.left); sel->r.height = min_t(unsigned int, sel->r.height, diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 748f5af90b7e..f3a593196282 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -212,7 +212,6 @@ static void wpf_configure(struct vsp1_entity *entity, struct vsp1_device *vsp1 = wpf->entity.vsp1; const struct v4l2_mbus_framefmt *source_format; const struct v4l2_mbus_framefmt *sink_format; - const struct v4l2_rect *crop; unsigned int i; u32 outfmt = 0; u32 srcrpf = 0; @@ -237,16 +236,6 @@ static void wpf_configure(struct vsp1_entity *entity, return; } - /* Cropping */ - crop = vsp1_rwpf_get_crop(wpf, wpf->entity.config); - - vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | - (crop->left << VI6_WPF_SZCLIP_OFST_SHIFT) | - (crop->width << VI6_WPF_SZCLIP_SIZE_SHIFT)); - vsp1_wpf_write(wpf, dl, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN | - (crop->top << VI6_WPF_SZCLIP_OFST_SHIFT) | - (crop->height << VI6_WPF_SZCLIP_SIZE_SHIFT)); - /* Format */ sink_format = vsp1_entity_get_pad_format(&wpf->entity, wpf->entity.config, @@ -255,6 +244,13 @@ static void wpf_configure(struct vsp1_entity *entity, wpf->entity.config, RWPF_PAD_SOURCE); + vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | + (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | + (source_format->width << VI6_WPF_SZCLIP_SIZE_SHIFT)); + vsp1_wpf_write(wpf, dl, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN | + (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | + (source_format->height << VI6_WPF_SZCLIP_SIZE_SHIFT)); + if (!pipe->lif) { const struct v4l2_pix_format_mplane *format = &wpf->format; const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; From abe9609f808140f46d092035b75dd58ae80db056 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 12 Sep 2016 12:38:36 -0300 Subject: [PATCH 437/591] [media] v4l: vsp1: Fix RPF cropping The RPF cropping offset for the chroma planes is incorrectly computed, it needs to be divided by the horizontal subsampling factor. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_rpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index 388838913205..3d6669dbeacf 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -105,7 +105,8 @@ static void rpf_configure(struct vsp1_entity *entity, if (format->num_planes > 1) { rpf->offsets[1] = crop->top * format->plane_fmt[1].bytesperline - + crop->left * fmtinfo->bpp[1] / 8; + + crop->left / fmtinfo->hsub * fmtinfo->bpp[1] + / 8; pstride |= format->plane_fmt[1].bytesperline << VI6_RPF_SRCM_PSTRIDE_C_SHIFT; } else { From d21fbbb4e9705189cabd724de0dec3f01fb362d1 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Sep 2016 19:39:30 -0300 Subject: [PATCH 438/591] [media] v4l: vsp1: Pass parameter type to entity configuration operation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the current boolean parameter (full / !full) with an explicit enum. - VSP1_ENTITY_PARAMS_INIT for parameters to be configured at pipeline initialization time only (V4L2 stream on or DRM atomic update) - VSP1_ENTITY_PARAMS_RUNTIME for all parameters that can be freely modified at runtime (through V4L2 controls) This will allow future extensions when implementing image partitioning support. Signed-off-by: Laurent Pinchart Acked-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_bru.c | 5 +-- drivers/media/platform/vsp1/vsp1_clu.c | 43 +++++++++++++---------- drivers/media/platform/vsp1/vsp1_drm.c | 6 ++-- drivers/media/platform/vsp1/vsp1_entity.h | 12 ++++++- drivers/media/platform/vsp1/vsp1_hsit.c | 5 +-- drivers/media/platform/vsp1/vsp1_lif.c | 5 +-- drivers/media/platform/vsp1/vsp1_lut.c | 26 ++++++++------ drivers/media/platform/vsp1/vsp1_rpf.c | 5 +-- drivers/media/platform/vsp1/vsp1_sru.c | 5 +-- drivers/media/platform/vsp1/vsp1_uds.c | 5 +-- drivers/media/platform/vsp1/vsp1_video.c | 6 ++-- drivers/media/platform/vsp1/vsp1_wpf.c | 5 +-- 12 files changed, 79 insertions(+), 49 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c index 5ae3c8d1dcf0..2f5788c1a5be 100644 --- a/drivers/media/platform/vsp1/vsp1_bru.c +++ b/drivers/media/platform/vsp1/vsp1_bru.c @@ -285,14 +285,15 @@ static const struct v4l2_subdev_ops bru_ops = { static void bru_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { struct vsp1_bru *bru = to_bru(&entity->subdev); struct v4l2_mbus_framefmt *format; unsigned int flags; unsigned int i; - if (!full) + if (params != VSP1_ENTITY_PARAMS_INIT) return; format = vsp1_entity_get_pad_format(&bru->entity, bru->entity.config, diff --git a/drivers/media/platform/vsp1/vsp1_clu.c b/drivers/media/platform/vsp1/vsp1_clu.c index e1fd03811dda..a0a69dfc38fc 100644 --- a/drivers/media/platform/vsp1/vsp1_clu.c +++ b/drivers/media/platform/vsp1/vsp1_clu.c @@ -214,42 +214,47 @@ static const struct v4l2_subdev_ops clu_ops = { static void clu_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { struct vsp1_clu *clu = to_clu(&entity->subdev); struct vsp1_dl_body *dlb; unsigned long flags; u32 ctrl = VI6_CLU_CTRL_AAI | VI6_CLU_CTRL_MVS | VI6_CLU_CTRL_EN; - /* The format can't be changed during streaming, only verify it at - * stream start and store the information internally for future partial - * reconfiguration calls. - */ - if (full) { + switch (params) { + case VSP1_ENTITY_PARAMS_INIT: { + /* The format can't be changed during streaming, only verify it + * at setup time and store the information internally for future + * runtime configuration calls. + */ struct v4l2_mbus_framefmt *format; format = vsp1_entity_get_pad_format(&clu->entity, clu->entity.config, CLU_PAD_SINK); clu->yuv_mode = format->code == MEDIA_BUS_FMT_AYUV8_1X32; - return; + break; } - /* 2D mode can only be used with the YCbCr pixel encoding. */ - if (clu->mode == V4L2_CID_VSP1_CLU_MODE_2D && clu->yuv_mode) - ctrl |= VI6_CLU_CTRL_AX1I_2D | VI6_CLU_CTRL_AX2I_2D - | VI6_CLU_CTRL_OS0_2D | VI6_CLU_CTRL_OS1_2D - | VI6_CLU_CTRL_OS2_2D | VI6_CLU_CTRL_M2D; + case VSP1_ENTITY_PARAMS_RUNTIME: + /* 2D mode can only be used with the YCbCr pixel encoding. */ + if (clu->mode == V4L2_CID_VSP1_CLU_MODE_2D && clu->yuv_mode) + ctrl |= VI6_CLU_CTRL_AX1I_2D | VI6_CLU_CTRL_AX2I_2D + | VI6_CLU_CTRL_OS0_2D | VI6_CLU_CTRL_OS1_2D + | VI6_CLU_CTRL_OS2_2D | VI6_CLU_CTRL_M2D; - vsp1_clu_write(clu, dl, VI6_CLU_CTRL, ctrl); + vsp1_clu_write(clu, dl, VI6_CLU_CTRL, ctrl); - spin_lock_irqsave(&clu->lock, flags); - dlb = clu->clu; - clu->clu = NULL; - spin_unlock_irqrestore(&clu->lock, flags); + spin_lock_irqsave(&clu->lock, flags); + dlb = clu->clu; + clu->clu = NULL; + spin_unlock_irqrestore(&clu->lock, flags); - if (dlb) - vsp1_dl_list_add_fragment(dl, dlb); + if (dlb) + vsp1_dl_list_add_fragment(dl, dlb); + break; + } } static const struct vsp1_entity_operations clu_entity_ops = { diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 06972f612263..6cbd3aeedbe3 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -492,8 +492,10 @@ void vsp1_du_atomic_flush(struct device *dev) vsp1_entity_route_setup(entity, pipe->dl); if (entity->ops->configure) { - entity->ops->configure(entity, pipe, pipe->dl, true); - entity->ops->configure(entity, pipe, pipe->dl, false); + entity->ops->configure(entity, pipe, pipe->dl, + VSP1_ENTITY_PARAMS_INIT); + entity->ops->configure(entity, pipe, pipe->dl, + VSP1_ENTITY_PARAMS_RUNTIME); } /* The memory buffer address must be applied after configuring diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index b5e4dbb1f7d4..51835e73308d 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h @@ -35,6 +35,16 @@ enum vsp1_entity_type { VSP1_ENTITY_WPF, }; +/* + * enum vsp1_entity_params - Entity configuration parameters class + * @VSP1_ENTITY_PARAMS_INIT - Initial parameters + * @VSP1_ENTITY_PARAMS_RUNTIME - Runtime-configurable parameters + */ +enum vsp1_entity_params { + VSP1_ENTITY_PARAMS_INIT, + VSP1_ENTITY_PARAMS_RUNTIME, +}; + #define VSP1_ENTITY_MAX_INPUTS 5 /* For the BRU */ /* @@ -73,7 +83,7 @@ struct vsp1_entity_operations { void (*destroy)(struct vsp1_entity *); void (*set_memory)(struct vsp1_entity *, struct vsp1_dl_list *dl); void (*configure)(struct vsp1_entity *, struct vsp1_pipeline *, - struct vsp1_dl_list *, bool); + struct vsp1_dl_list *, enum vsp1_entity_params); }; struct vsp1_entity { diff --git a/drivers/media/platform/vsp1/vsp1_hsit.c b/drivers/media/platform/vsp1/vsp1_hsit.c index 6ffbedb5c095..94316afc54ff 100644 --- a/drivers/media/platform/vsp1/vsp1_hsit.c +++ b/drivers/media/platform/vsp1/vsp1_hsit.c @@ -132,11 +132,12 @@ static const struct v4l2_subdev_ops hsit_ops = { static void hsit_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { struct vsp1_hsit *hsit = to_hsit(&entity->subdev); - if (!full) + if (params != VSP1_ENTITY_PARAMS_INIT) return; if (hsit->inverse) diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c index 702df863b13a..e32acae1fc6e 100644 --- a/drivers/media/platform/vsp1/vsp1_lif.c +++ b/drivers/media/platform/vsp1/vsp1_lif.c @@ -129,7 +129,8 @@ static const struct v4l2_subdev_ops lif_ops = { static void lif_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { const struct v4l2_mbus_framefmt *format; struct vsp1_lif *lif = to_lif(&entity->subdev); @@ -137,7 +138,7 @@ static void lif_configure(struct vsp1_entity *entity, unsigned int obth = 400; unsigned int lbth = 200; - if (!full) + if (params != VSP1_ENTITY_PARAMS_INIT) return; format = vsp1_entity_get_pad_format(&lif->entity, lif->entity.config, diff --git a/drivers/media/platform/vsp1/vsp1_lut.c b/drivers/media/platform/vsp1/vsp1_lut.c index e1c0bb7535e4..ace8acce2076 100644 --- a/drivers/media/platform/vsp1/vsp1_lut.c +++ b/drivers/media/platform/vsp1/vsp1_lut.c @@ -190,24 +190,28 @@ static const struct v4l2_subdev_ops lut_ops = { static void lut_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { struct vsp1_lut *lut = to_lut(&entity->subdev); struct vsp1_dl_body *dlb; unsigned long flags; - if (full) { + switch (params) { + case VSP1_ENTITY_PARAMS_INIT: vsp1_lut_write(lut, dl, VI6_LUT_CTRL, VI6_LUT_CTRL_EN); - return; + break; + + case VSP1_ENTITY_PARAMS_RUNTIME: + spin_lock_irqsave(&lut->lock, flags); + dlb = lut->lut; + lut->lut = NULL; + spin_unlock_irqrestore(&lut->lock, flags); + + if (dlb) + vsp1_dl_list_add_fragment(dl, dlb); + break; } - - spin_lock_irqsave(&lut->lock, flags); - dlb = lut->lut; - lut->lut = NULL; - spin_unlock_irqrestore(&lut->lock, flags); - - if (dlb) - vsp1_dl_list_add_fragment(dl, dlb); } static const struct vsp1_entity_operations lut_entity_ops = { diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index 3d6669dbeacf..795bf0fd1761 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -60,7 +60,8 @@ static void rpf_set_memory(struct vsp1_entity *entity, struct vsp1_dl_list *dl) static void rpf_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev); const struct vsp1_format_info *fmtinfo = rpf->fmtinfo; @@ -73,7 +74,7 @@ static void rpf_configure(struct vsp1_entity *entity, u32 pstride; u32 infmt; - if (!full) { + if (params == VSP1_ENTITY_PARAMS_RUNTIME) { vsp1_rpf_write(rpf, dl, VI6_RPF_VRTCOL_SET, rpf->alpha << VI6_RPF_VRTCOL_SET_LAYA_SHIFT); vsp1_rpf_write(rpf, dl, VI6_RPF_MULT_ALPHA, rpf->mult_alpha | diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c index 6e13cdfa5ed4..9d4a1afb6634 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.c +++ b/drivers/media/platform/vsp1/vsp1_sru.c @@ -271,7 +271,8 @@ static const struct v4l2_subdev_ops sru_ops = { static void sru_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { const struct vsp1_sru_param *param; struct vsp1_sru *sru = to_sru(&entity->subdev); @@ -279,7 +280,7 @@ static void sru_configure(struct vsp1_entity *entity, struct v4l2_mbus_framefmt *output; u32 ctrl0; - if (!full) + if (params != VSP1_ENTITY_PARAMS_INIT) return; input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c index a8fc893a31ee..62beae5d6944 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.c +++ b/drivers/media/platform/vsp1/vsp1_uds.c @@ -260,7 +260,8 @@ static const struct v4l2_subdev_ops uds_ops = { static void uds_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { struct vsp1_uds *uds = to_uds(&entity->subdev); const struct v4l2_mbus_framefmt *output; @@ -269,7 +270,7 @@ static void uds_configure(struct vsp1_entity *entity, unsigned int vscale; bool multitap; - if (!full) + if (params != VSP1_ENTITY_PARAMS_INIT) return; input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index cd7d215ed455..c66f0b480989 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -254,7 +254,8 @@ static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe) list_for_each_entry(entity, &pipe->entities, list_pipe) { if (entity->ops->configure) - entity->ops->configure(entity, pipe, pipe->dl, false); + entity->ops->configure(entity, pipe, pipe->dl, + VSP1_ENTITY_PARAMS_RUNTIME); } for (i = 0; i < vsp1->info->rpf_count; ++i) { @@ -629,7 +630,8 @@ static int vsp1_video_setup_pipeline(struct vsp1_pipeline *pipe) vsp1_entity_route_setup(entity, pipe->dl); if (entity->ops->configure) - entity->ops->configure(entity, pipe, pipe->dl, true); + entity->ops->configure(entity, pipe, pipe->dl, + VSP1_ENTITY_PARAMS_INIT); } return 0; diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index f3a593196282..adf348d08c64 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -206,7 +206,8 @@ static void wpf_set_memory(struct vsp1_entity *entity, struct vsp1_dl_list *dl) static void wpf_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, - struct vsp1_dl_list *dl, bool full) + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) { struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); struct vsp1_device *vsp1 = wpf->entity.vsp1; @@ -216,7 +217,7 @@ static void wpf_configure(struct vsp1_entity *entity, u32 outfmt = 0; u32 srcrpf = 0; - if (!full) { + if (params == VSP1_ENTITY_PARAMS_RUNTIME) { const unsigned int mask = BIT(WPF_CTRL_VFLIP) | BIT(WPF_CTRL_HFLIP); From 8ddf3784295f1b3341ccc206740afd4235dbcbe0 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 12 Sep 2016 09:50:13 -0300 Subject: [PATCH 439/591] [media] v4l: vsp1: Replace .set_memory() with VSP1_ENTITY_PARAMS_PARTITION The new VSP1_ENTITY_PARAMS_PARTITION configuration parameters type covers all registers that need to be configured for every partition. This prepares for support of image partitioning, and replaces the .set_memory() operation as the memory registers take different values for every partition. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_clu.c | 3 + drivers/media/platform/vsp1/vsp1_drm.c | 9 +-- drivers/media/platform/vsp1/vsp1_entity.h | 6 +- drivers/media/platform/vsp1/vsp1_lut.c | 3 + drivers/media/platform/vsp1/vsp1_rpf.c | 76 ++++++++++---------- drivers/media/platform/vsp1/vsp1_rwpf.h | 13 ---- drivers/media/platform/vsp1/vsp1_video.c | 17 ++--- drivers/media/platform/vsp1/vsp1_wpf.c | 85 ++++++++++++----------- 8 files changed, 99 insertions(+), 113 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_clu.c b/drivers/media/platform/vsp1/vsp1_clu.c index a0a69dfc38fc..f052abd05166 100644 --- a/drivers/media/platform/vsp1/vsp1_clu.c +++ b/drivers/media/platform/vsp1/vsp1_clu.c @@ -237,6 +237,9 @@ static void clu_configure(struct vsp1_entity *entity, break; } + case VSP1_ENTITY_PARAMS_PARTITION: + break; + case VSP1_ENTITY_PARAMS_RUNTIME: /* 2D mode can only be used with the YCbCr pixel encoding. */ if (clu->mode == V4L2_CID_VSP1_CLU_MODE_2D && clu->yuv_mode) diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 6cbd3aeedbe3..832286975e71 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -496,14 +496,9 @@ void vsp1_du_atomic_flush(struct device *dev) VSP1_ENTITY_PARAMS_INIT); entity->ops->configure(entity, pipe, pipe->dl, VSP1_ENTITY_PARAMS_RUNTIME); + entity->ops->configure(entity, pipe, pipe->dl, + VSP1_ENTITY_PARAMS_PARTITION); } - - /* The memory buffer address must be applied after configuring - * the RPF to make sure the crop offset are computed. - */ - if (entity->type == VSP1_ENTITY_RPF) - vsp1_rwpf_set_memory(to_rwpf(&entity->subdev), - pipe->dl); } vsp1_dl_list_commit(pipe->dl); diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index 51835e73308d..0e3e394c44cd 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h @@ -38,10 +38,12 @@ enum vsp1_entity_type { /* * enum vsp1_entity_params - Entity configuration parameters class * @VSP1_ENTITY_PARAMS_INIT - Initial parameters + * @VSP1_ENTITY_PARAMS_PARTITION - Per-image partition parameters * @VSP1_ENTITY_PARAMS_RUNTIME - Runtime-configurable parameters */ enum vsp1_entity_params { VSP1_ENTITY_PARAMS_INIT, + VSP1_ENTITY_PARAMS_PARTITION, VSP1_ENTITY_PARAMS_RUNTIME, }; @@ -73,15 +75,11 @@ struct vsp1_route { /** * struct vsp1_entity_operations - Entity operations * @destroy: Destroy the entity. - * @set_memory: Setup memory buffer access. This operation applies the settings - * stored in the rwpf mem field to the display list. Valid for RPF - * and WPF only. * @configure: Setup the hardware based on the entity state (pipeline, formats, * selection rectangles, ...) */ struct vsp1_entity_operations { void (*destroy)(struct vsp1_entity *); - void (*set_memory)(struct vsp1_entity *, struct vsp1_dl_list *dl); void (*configure)(struct vsp1_entity *, struct vsp1_pipeline *, struct vsp1_dl_list *, enum vsp1_entity_params); }; diff --git a/drivers/media/platform/vsp1/vsp1_lut.c b/drivers/media/platform/vsp1/vsp1_lut.c index ace8acce2076..c67cc60db0db 100644 --- a/drivers/media/platform/vsp1/vsp1_lut.c +++ b/drivers/media/platform/vsp1/vsp1_lut.c @@ -202,6 +202,9 @@ static void lut_configure(struct vsp1_entity *entity, vsp1_lut_write(lut, dl, VI6_LUT_CTRL, VI6_LUT_CTRL_EN); break; + case VSP1_ENTITY_PARAMS_PARTITION: + break; + case VSP1_ENTITY_PARAMS_RUNTIME: spin_lock_irqsave(&lut->lock, flags); dlb = lut->lut; diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index 795bf0fd1761..de5ef76c5004 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -46,18 +46,6 @@ static const struct v4l2_subdev_ops rpf_ops = { * VSP1 Entity Operations */ -static void rpf_set_memory(struct vsp1_entity *entity, struct vsp1_dl_list *dl) -{ - struct vsp1_rwpf *rpf = entity_to_rwpf(entity); - - vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_Y, - rpf->mem.addr[0] + rpf->offsets[0]); - vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_C0, - rpf->mem.addr[1] + rpf->offsets[1]); - vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_C1, - rpf->mem.addr[2] + rpf->offsets[1]); -} - static void rpf_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, struct vsp1_dl_list *dl, @@ -68,7 +56,6 @@ static void rpf_configure(struct vsp1_entity *entity, const struct v4l2_pix_format_mplane *format = &rpf->format; const struct v4l2_mbus_framefmt *source_format; const struct v4l2_mbus_framefmt *sink_format; - const struct v4l2_rect *crop; unsigned int left = 0; unsigned int top = 0; u32 pstride; @@ -84,35 +71,51 @@ static void rpf_configure(struct vsp1_entity *entity, return; } - /* Source size, stride and crop offsets. - * - * The crop offsets correspond to the location of the crop rectangle top - * left corner in the plane buffer. Only two offsets are needed, as - * planes 2 and 3 always have identical strides. - */ - crop = vsp1_rwpf_get_crop(rpf, rpf->entity.config); + if (params == VSP1_ENTITY_PARAMS_PARTITION) { + const struct v4l2_rect *crop; + unsigned int offsets[2]; - vsp1_rpf_write(rpf, dl, VI6_RPF_SRC_BSIZE, - (crop->width << VI6_RPF_SRC_BSIZE_BHSIZE_SHIFT) | - (crop->height << VI6_RPF_SRC_BSIZE_BVSIZE_SHIFT)); - vsp1_rpf_write(rpf, dl, VI6_RPF_SRC_ESIZE, - (crop->width << VI6_RPF_SRC_ESIZE_EHSIZE_SHIFT) | - (crop->height << VI6_RPF_SRC_ESIZE_EVSIZE_SHIFT)); + /* Source size and crop offsets. + * + * The crop offsets correspond to the location of the crop + * rectangle top left corner in the plane buffer. Only two + * offsets are needed, as planes 2 and 3 always have identical + * strides. + */ + crop = vsp1_rwpf_get_crop(rpf, rpf->entity.config); - rpf->offsets[0] = crop->top * format->plane_fmt[0].bytesperline - + crop->left * fmtinfo->bpp[0] / 8; + vsp1_rpf_write(rpf, dl, VI6_RPF_SRC_BSIZE, + (crop->width << VI6_RPF_SRC_BSIZE_BHSIZE_SHIFT) | + (crop->height << VI6_RPF_SRC_BSIZE_BVSIZE_SHIFT)); + vsp1_rpf_write(rpf, dl, VI6_RPF_SRC_ESIZE, + (crop->width << VI6_RPF_SRC_ESIZE_EHSIZE_SHIFT) | + (crop->height << VI6_RPF_SRC_ESIZE_EVSIZE_SHIFT)); + + offsets[0] = crop->top * format->plane_fmt[0].bytesperline + + crop->left * fmtinfo->bpp[0] / 8; + + if (format->num_planes > 1) + offsets[1] = crop->top * format->plane_fmt[1].bytesperline + + crop->left / fmtinfo->hsub + * fmtinfo->bpp[1] / 8; + else + offsets[1] = 0; + + vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_Y, + rpf->mem.addr[0] + offsets[0]); + vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_C0, + rpf->mem.addr[1] + offsets[1]); + vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_C1, + rpf->mem.addr[2] + offsets[1]); + return; + } + + /* Stride */ pstride = format->plane_fmt[0].bytesperline << VI6_RPF_SRCM_PSTRIDE_Y_SHIFT; - - if (format->num_planes > 1) { - rpf->offsets[1] = crop->top * format->plane_fmt[1].bytesperline - + crop->left / fmtinfo->hsub * fmtinfo->bpp[1] - / 8; + if (format->num_planes > 1) pstride |= format->plane_fmt[1].bytesperline << VI6_RPF_SRCM_PSTRIDE_C_SHIFT; - } else { - rpf->offsets[1] = 0; - } vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_PSTRIDE, pstride); @@ -217,7 +220,6 @@ static void rpf_configure(struct vsp1_entity *entity, } static const struct vsp1_entity_operations rpf_entity_ops = { - .set_memory = rpf_set_memory, .configure = rpf_configure, }; diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h index cb20484e80da..1c98aff3da5d 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.h +++ b/drivers/media/platform/vsp1/vsp1_rwpf.h @@ -61,7 +61,6 @@ struct vsp1_rwpf { unsigned int active; } flip; - unsigned int offsets[2]; struct vsp1_rwpf_memory mem; struct vsp1_dl_manager *dlm; @@ -86,17 +85,5 @@ extern const struct v4l2_subdev_pad_ops vsp1_rwpf_pad_ops; struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf, struct v4l2_subdev_pad_config *config); -/** - * vsp1_rwpf_set_memory - Configure DMA addresses for a [RW]PF - * @rwpf: the [RW]PF instance - * @dl: the display list - * - * This function applies the cached memory buffer address to the display list. - */ -static inline void vsp1_rwpf_set_memory(struct vsp1_rwpf *rwpf, - struct vsp1_dl_list *dl) -{ - rwpf->entity.ops->set_memory(&rwpf->entity, dl); -} #endif /* __VSP1_RWPF_H__ */ diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index c66f0b480989..b8339d874df4 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -245,29 +245,20 @@ static void vsp1_video_frame_end(struct vsp1_pipeline *pipe, static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe) { - struct vsp1_device *vsp1 = pipe->output->entity.vsp1; struct vsp1_entity *entity; - unsigned int i; if (!pipe->dl) pipe->dl = vsp1_dl_list_get(pipe->output->dlm); list_for_each_entry(entity, &pipe->entities, list_pipe) { - if (entity->ops->configure) + if (entity->ops->configure) { entity->ops->configure(entity, pipe, pipe->dl, VSP1_ENTITY_PARAMS_RUNTIME); + entity->ops->configure(entity, pipe, pipe->dl, + VSP1_ENTITY_PARAMS_PARTITION); + } } - for (i = 0; i < vsp1->info->rpf_count; ++i) { - struct vsp1_rwpf *rwpf = pipe->inputs[i]; - - if (rwpf) - vsp1_rwpf_set_memory(rwpf, pipe->dl); - } - - if (!pipe->lif) - vsp1_rwpf_set_memory(pipe->output, pipe->dl); - vsp1_dl_list_commit(pipe->dl); pipe->dl = NULL; diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index adf348d08c64..717c0be58bfb 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -173,37 +173,6 @@ static void vsp1_wpf_destroy(struct vsp1_entity *entity) vsp1_dlm_destroy(wpf->dlm); } -static void wpf_set_memory(struct vsp1_entity *entity, struct vsp1_dl_list *dl) -{ - struct vsp1_rwpf *wpf = entity_to_rwpf(entity); - const struct v4l2_pix_format_mplane *format = &wpf->format; - struct vsp1_rwpf_memory mem = wpf->mem; - unsigned int flip = wpf->flip.active; - unsigned int offset; - - /* Update the memory offsets based on flipping configuration. The - * destination addresses point to the locations where the VSP starts - * writing to memory, which can be different corners of the image - * depending on vertical flipping. Horizontal flipping is handled - * through a line buffer and doesn't modify the start address. - */ - if (flip & BIT(WPF_CTRL_VFLIP)) { - mem.addr[0] += (format->height - 1) - * format->plane_fmt[0].bytesperline; - - if (format->num_planes > 1) { - offset = (format->height / wpf->fmtinfo->vsub - 1) - * format->plane_fmt[1].bytesperline; - mem.addr[1] += offset; - mem.addr[2] += offset; - } - } - - vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_Y, mem.addr[0]); - vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C0, mem.addr[1]); - vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]); -} - static void wpf_configure(struct vsp1_entity *entity, struct vsp1_pipeline *pipe, struct vsp1_dl_list *dl, @@ -237,7 +206,6 @@ static void wpf_configure(struct vsp1_entity *entity, return; } - /* Format */ sink_format = vsp1_entity_get_pad_format(&wpf->entity, wpf->entity.config, RWPF_PAD_SINK); @@ -245,13 +213,53 @@ static void wpf_configure(struct vsp1_entity *entity, wpf->entity.config, RWPF_PAD_SOURCE); - vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | - (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | - (source_format->width << VI6_WPF_SZCLIP_SIZE_SHIFT)); - vsp1_wpf_write(wpf, dl, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN | - (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | - (source_format->height << VI6_WPF_SZCLIP_SIZE_SHIFT)); + if (params == VSP1_ENTITY_PARAMS_PARTITION) { + const struct v4l2_pix_format_mplane *format = &wpf->format; + struct vsp1_rwpf_memory mem = wpf->mem; + unsigned int flip = wpf->flip.active; + unsigned int width = source_format->width; + unsigned int height = source_format->height; + unsigned int offset; + /* Cropping. The partition algorithm can split the image into + * multiple slices. + */ + vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | + (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | + (width << VI6_WPF_SZCLIP_SIZE_SHIFT)); + vsp1_wpf_write(wpf, dl, VI6_WPF_VSZCLIP, VI6_WPF_SZCLIP_EN | + (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | + (height << VI6_WPF_SZCLIP_SIZE_SHIFT)); + + if (pipe->lif) + return; + + /* Update the memory offsets based on flipping configuration. + * The destination addresses point to the locations where the + * VSP starts writing to memory, which can be different corners + * of the image depending on vertical flipping. Horizontal + * flipping is handled through a line buffer and doesn't modify + * the start address. + */ + if (flip & BIT(WPF_CTRL_VFLIP)) { + mem.addr[0] += (format->height - 1) + * format->plane_fmt[0].bytesperline; + + if (format->num_planes > 1) { + offset = (format->height / wpf->fmtinfo->vsub - 1) + * format->plane_fmt[1].bytesperline; + mem.addr[1] += offset; + mem.addr[2] += offset; + } + } + + vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_Y, mem.addr[0]); + vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C0, mem.addr[1]); + vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]); + return; + } + + /* Format */ if (!pipe->lif) { const struct v4l2_pix_format_mplane *format = &wpf->format; const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; @@ -320,7 +328,6 @@ static void wpf_configure(struct vsp1_entity *entity, static const struct vsp1_entity_operations wpf_entity_ops = { .destroy = vsp1_wpf_destroy, - .set_memory = wpf_set_memory, .configure = wpf_configure, }; From 76e48896c0b7b25a65740f03c6c5d3f35a02fd74 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 12 Jul 2016 13:49:46 -0300 Subject: [PATCH 440/591] [media] v4l: vsp1: Support chained display lists When display lists are linked in a chain, they will be processed automatically by the hardware, with each list linking to the next. Only on the last display list will the frame end interrupt be fired to mark the completion event. Upon frame-end, the chain will be iterated to release each display list back to the free list. The chained lists use case (image partitioning) can require up to 64 lists per frame in the worst case scenario, bump up the number of preallocated lists. Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_dl.c | 119 +++++++++++++++++++++---- drivers/media/platform/vsp1/vsp1_dl.h | 1 + drivers/media/platform/vsp1/vsp1_wpf.c | 2 +- 3 files changed, 102 insertions(+), 20 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c index 37c3518aa2a8..0af3e8fdc714 100644 --- a/drivers/media/platform/vsp1/vsp1_dl.c +++ b/drivers/media/platform/vsp1/vsp1_dl.c @@ -21,7 +21,6 @@ #include "vsp1_dl.h" #define VSP1_DL_NUM_ENTRIES 256 -#define VSP1_DL_NUM_LISTS 3 #define VSP1_DLH_INT_ENABLE (1 << 1) #define VSP1_DLH_AUTO_START (1 << 0) @@ -71,6 +70,7 @@ struct vsp1_dl_body { * @dma: DMA address for the header * @body0: first display list body * @fragments: list of extra display list bodies + * @chain: entry in the display list partition chain */ struct vsp1_dl_list { struct list_head list; @@ -81,6 +81,9 @@ struct vsp1_dl_list { struct vsp1_dl_body body0; struct list_head fragments; + + bool has_chain; + struct list_head chain; }; enum vsp1_dl_mode { @@ -262,7 +265,6 @@ static struct vsp1_dl_list *vsp1_dl_list_alloc(struct vsp1_dl_manager *dlm) memset(dl->header, 0, sizeof(*dl->header)); dl->header->lists[0].addr = dl->body0.dma; - dl->header->flags = VSP1_DLH_INT_ENABLE; } return dl; @@ -293,6 +295,11 @@ struct vsp1_dl_list *vsp1_dl_list_get(struct vsp1_dl_manager *dlm) if (!list_empty(&dlm->free)) { dl = list_first_entry(&dlm->free, struct vsp1_dl_list, list); list_del(&dl->list); + + /* The display list chain must be initialised to ensure every + * display list can assert list_empty() if it is not in a chain. + */ + INIT_LIST_HEAD(&dl->chain); } spin_unlock_irqrestore(&dlm->lock, flags); @@ -303,9 +310,21 @@ struct vsp1_dl_list *vsp1_dl_list_get(struct vsp1_dl_manager *dlm) /* This function must be called with the display list manager lock held.*/ static void __vsp1_dl_list_put(struct vsp1_dl_list *dl) { + struct vsp1_dl_list *dl_child; + if (!dl) return; + /* Release any linked display-lists which were chained for a single + * hardware operation. + */ + if (dl->has_chain) { + list_for_each_entry(dl_child, &dl->chain, chain) + __vsp1_dl_list_put(dl_child); + } + + dl->has_chain = false; + /* We can't free fragments here as DMA memory can only be freed in * interruptible context. Move all fragments to the display list * manager's list of fragments to be freed, they will be @@ -383,6 +402,74 @@ int vsp1_dl_list_add_fragment(struct vsp1_dl_list *dl, return 0; } +/** + * vsp1_dl_list_add_chain - Add a display list to a chain + * @head: The head display list + * @dl: The new display list + * + * Add a display list to an existing display list chain. The chained lists + * will be automatically processed by the hardware without intervention from + * the CPU. A display list end interrupt will only complete after the last + * display list in the chain has completed processing. + * + * Adding a display list to a chain passes ownership of the display list to + * the head display list item. The chain is released when the head dl item is + * put back with __vsp1_dl_list_put(). + * + * Chained display lists are only usable in header mode. Attempts to add a + * display list to a chain in header-less mode will return an error. + */ +int vsp1_dl_list_add_chain(struct vsp1_dl_list *head, + struct vsp1_dl_list *dl) +{ + /* Chained lists are only available in header mode. */ + if (head->dlm->mode != VSP1_DL_MODE_HEADER) + return -EINVAL; + + head->has_chain = true; + list_add_tail(&dl->chain, &head->chain); + return 0; +} + +static void vsp1_dl_list_fill_header(struct vsp1_dl_list *dl, bool is_last) +{ + struct vsp1_dl_header_list *hdr = dl->header->lists; + struct vsp1_dl_body *dlb; + unsigned int num_lists = 0; + + /* Fill the header with the display list bodies addresses and sizes. The + * address of the first body has already been filled when the display + * list was allocated. + */ + + hdr->num_bytes = dl->body0.num_entries + * sizeof(*dl->header->lists); + + list_for_each_entry(dlb, &dl->fragments, list) { + num_lists++; + hdr++; + + hdr->addr = dlb->dma; + hdr->num_bytes = dlb->num_entries + * sizeof(*dl->header->lists); + } + + dl->header->num_lists = num_lists; + + /* If this display list's chain is not empty, we are on a list, where + * the next item in the list is the display list entity which should be + * automatically queued by the hardware. + */ + if (!list_empty(&dl->chain) && !is_last) { + struct vsp1_dl_list *next = list_next_entry(dl, chain); + + dl->header->next_header = next->dma; + dl->header->flags = VSP1_DLH_AUTO_START; + } else { + dl->header->flags = VSP1_DLH_INT_ENABLE; + } +} + void vsp1_dl_list_commit(struct vsp1_dl_list *dl) { struct vsp1_dl_manager *dlm = dl->dlm; @@ -393,30 +480,24 @@ void vsp1_dl_list_commit(struct vsp1_dl_list *dl) spin_lock_irqsave(&dlm->lock, flags); if (dl->dlm->mode == VSP1_DL_MODE_HEADER) { - struct vsp1_dl_header_list *hdr = dl->header->lists; - struct vsp1_dl_body *dlb; - unsigned int num_lists = 0; + struct vsp1_dl_list *dl_child; - /* Fill the header with the display list bodies addresses and - * sizes. The address of the first body has already been filled - * when the display list was allocated. - * - * In header mode the caller guarantees that the hardware is + /* In header mode the caller guarantees that the hardware is * idle at this point. */ - hdr->num_bytes = dl->body0.num_entries - * sizeof(*dl->header->lists); - list_for_each_entry(dlb, &dl->fragments, list) { - num_lists++; - hdr++; + /* Fill the header for the head and chained display lists. */ + vsp1_dl_list_fill_header(dl, list_empty(&dl->chain)); - hdr->addr = dlb->dma; - hdr->num_bytes = dlb->num_entries - * sizeof(*dl->header->lists); + list_for_each_entry(dl_child, &dl->chain, chain) { + bool last = list_is_last(&dl_child->chain, &dl->chain); + + vsp1_dl_list_fill_header(dl_child, last); } - dl->header->num_lists = num_lists; + /* Commit the head display list to hardware. Chained headers + * will auto-start. + */ vsp1_write(vsp1, VI6_DL_HDR_ADDR(dlm->index), dl->dma); dlm->active = dl; diff --git a/drivers/media/platform/vsp1/vsp1_dl.h b/drivers/media/platform/vsp1/vsp1_dl.h index de387cd4d745..7131aa3c5978 100644 --- a/drivers/media/platform/vsp1/vsp1_dl.h +++ b/drivers/media/platform/vsp1/vsp1_dl.h @@ -41,5 +41,6 @@ void vsp1_dl_fragment_free(struct vsp1_dl_body *dlb); void vsp1_dl_fragment_write(struct vsp1_dl_body *dlb, u32 reg, u32 data); int vsp1_dl_list_add_fragment(struct vsp1_dl_list *dl, struct vsp1_dl_body *dlb); +int vsp1_dl_list_add_chain(struct vsp1_dl_list *head, struct vsp1_dl_list *dl); #endif /* __VSP1_DL_H__ */ diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 717c0be58bfb..b757d2579d6c 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -364,7 +364,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index) return ERR_PTR(ret); /* Initialize the display list manager. */ - wpf->dlm = vsp1_dlm_create(vsp1, index, 4); + wpf->dlm = vsp1_dlm_create(vsp1, index, 64); if (!wpf->dlm) { ret = -ENOMEM; goto error; From df32c924518716160d43defc444199e894859c08 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Tue, 12 Jul 2016 10:06:34 -0300 Subject: [PATCH 441/591] [media] v4l: vsp1: Determine partition requirements for scaled images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The partition algorithm needs to determine the capabilities of each entity in the pipeline to identify the correct maximum partition width. Extend the vsp1 entity operations to provide a max_width operation and use this call to calculate the number of partitions that will be processed by the algorithm. Gen 2 hardware does not require multiple partitioning, and as such will always return a single partition. Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart Acked-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_entity.h | 3 ++ drivers/media/platform/vsp1/vsp1_pipe.h | 5 +++ drivers/media/platform/vsp1/vsp1_sru.c | 19 +++++++++++ drivers/media/platform/vsp1/vsp1_uds.c | 25 ++++++++++++++ drivers/media/platform/vsp1/vsp1_video.c | 40 +++++++++++++++++++++++ 5 files changed, 92 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index 0e3e394c44cd..90a4d95c0a50 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h @@ -77,11 +77,14 @@ struct vsp1_route { * @destroy: Destroy the entity. * @configure: Setup the hardware based on the entity state (pipeline, formats, * selection rectangles, ...) + * @max_width: Return the max supported width of data that the entity can + * process in a single operation. */ struct vsp1_entity_operations { void (*destroy)(struct vsp1_entity *); void (*configure)(struct vsp1_entity *, struct vsp1_pipeline *, struct vsp1_dl_list *, enum vsp1_entity_params); + unsigned int (*max_width)(struct vsp1_entity *, struct vsp1_pipeline *); }; struct vsp1_entity { diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h b/drivers/media/platform/vsp1/vsp1_pipe.h index d20d997b1fda..af4cd23d399b 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.h +++ b/drivers/media/platform/vsp1/vsp1_pipe.h @@ -77,6 +77,8 @@ enum vsp1_pipeline_state { * @uds_input: entity at the input of the UDS, if the UDS is present * @entities: list of entities in the pipeline * @dl: display list associated with the pipeline + * @div_size: The maximum allowed partition size for the pipeline + * @partitions: The number of partitions used to process one frame */ struct vsp1_pipeline { struct media_pipeline pipe; @@ -104,6 +106,9 @@ struct vsp1_pipeline { struct list_head entities; struct vsp1_dl_list *dl; + + unsigned int div_size; + unsigned int partitions; }; void vsp1_pipeline_reset(struct vsp1_pipeline *pipe); diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c index 9d4a1afb6634..b4e568a3b4ed 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.c +++ b/drivers/media/platform/vsp1/vsp1_sru.c @@ -306,8 +306,27 @@ static void sru_configure(struct vsp1_entity *entity, vsp1_sru_write(sru, dl, VI6_SRU_CTRL2, param->ctrl2); } +static unsigned int sru_max_width(struct vsp1_entity *entity, + struct vsp1_pipeline *pipe) +{ + struct vsp1_sru *sru = to_sru(&entity->subdev); + struct v4l2_mbus_framefmt *input; + struct v4l2_mbus_framefmt *output; + + input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, + SRU_PAD_SINK); + output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, + SRU_PAD_SOURCE); + + if (input->width != output->width) + return 512; + else + return 256; +} + static const struct vsp1_entity_operations sru_entity_ops = { .configure = sru_configure, + .max_width = sru_max_width, }; /* ----------------------------------------------------------------------------- diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c index 62beae5d6944..706b6e85f47d 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.c +++ b/drivers/media/platform/vsp1/vsp1_uds.c @@ -311,8 +311,33 @@ static void uds_configure(struct vsp1_entity *entity, (output->height << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT)); } +static unsigned int uds_max_width(struct vsp1_entity *entity, + struct vsp1_pipeline *pipe) +{ + struct vsp1_uds *uds = to_uds(&entity->subdev); + const struct v4l2_mbus_framefmt *output; + const struct v4l2_mbus_framefmt *input; + unsigned int hscale; + + input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, + UDS_PAD_SINK); + output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, + UDS_PAD_SOURCE); + hscale = output->width / input->width; + + if (hscale <= 2) + return 256; + else if (hscale <= 4) + return 512; + else if (hscale <= 8) + return 1024; + else + return 2048; +} + static const struct vsp1_entity_operations uds_entity_ops = { .configure = uds_configure, + .max_width = uds_max_width, }; /* ----------------------------------------------------------------------------- diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index b8339d874df4..b903cc5471e0 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -168,6 +168,43 @@ static int __vsp1_video_try_format(struct vsp1_video *video, return 0; } +/* ----------------------------------------------------------------------------- + * VSP1 Partition Algorithm support + */ + +static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) +{ + struct vsp1_device *vsp1 = pipe->output->entity.vsp1; + const struct v4l2_mbus_framefmt *format; + struct vsp1_entity *entity; + unsigned int div_size; + + format = vsp1_entity_get_pad_format(&pipe->output->entity, + pipe->output->entity.config, + RWPF_PAD_SOURCE); + div_size = format->width; + + /* Gen2 hardware doesn't require image partitioning. */ + if (vsp1->info->gen == 2) { + pipe->div_size = div_size; + pipe->partitions = 1; + return; + } + + list_for_each_entry(entity, &pipe->entities, list_pipe) { + unsigned int entity_max = VSP1_VIDEO_MAX_WIDTH; + + if (entity->ops->max_width) { + entity_max = entity->ops->max_width(entity, pipe); + if (entity_max) + div_size = min(div_size, entity_max); + } + } + + pipe->div_size = div_size; + pipe->partitions = DIV_ROUND_UP(format->width, div_size); +} + /* ----------------------------------------------------------------------------- * Pipeline Management */ @@ -594,6 +631,9 @@ static int vsp1_video_setup_pipeline(struct vsp1_pipeline *pipe) { struct vsp1_entity *entity; + /* Determine this pipelines sizes for image partitioning support. */ + vsp1_video_pipeline_setup_partitions(pipe); + /* Prepare the display list. */ pipe->dl = vsp1_dl_list_get(pipe->output->dlm); if (!pipe->dl) From fc6e514a72c718f025d69e3006d6827b25a6df27 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Sun, 11 Sep 2016 23:26:35 -0300 Subject: [PATCH 442/591] [media] v4l: vsp1: Support multiple partitions per frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adapt vsp1_video_pipeline_run() such that it can iterate each partition required for constructing this frame's display list chain in the event that multiple display lists are required to process in hardware. The first display list is held as the head list object, whilst any following parition display lists are linked to the head by means of vsp1_dl_list_add_chain(). Linking the chained display list headers to process using the auto start mechanism of the hardware is performed during the vsp1_dl_list_commit(). Signed-off-by: Kieran Bingham Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_pipe.h | 3 + drivers/media/platform/vsp1/vsp1_rpf.c | 46 +++++++-- drivers/media/platform/vsp1/vsp1_uds.c | 15 ++- drivers/media/platform/vsp1/vsp1_video.c | 123 ++++++++++++++++++++++- drivers/media/platform/vsp1/vsp1_wpf.c | 30 +++++- 5 files changed, 196 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h b/drivers/media/platform/vsp1/vsp1_pipe.h index af4cd23d399b..f15b697ad999 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.h +++ b/drivers/media/platform/vsp1/vsp1_pipe.h @@ -79,6 +79,7 @@ enum vsp1_pipeline_state { * @dl: display list associated with the pipeline * @div_size: The maximum allowed partition size for the pipeline * @partitions: The number of partitions used to process one frame + * @current_partition: The partition number currently being configured */ struct vsp1_pipeline { struct media_pipeline pipe; @@ -109,6 +110,8 @@ struct vsp1_pipeline { unsigned int div_size; unsigned int partitions; + struct v4l2_rect partition; + unsigned int current_partition; }; void vsp1_pipeline_reset(struct vsp1_pipeline *pipe); diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index de5ef76c5004..e6236ff2f74a 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -72,8 +72,8 @@ static void rpf_configure(struct vsp1_entity *entity, } if (params == VSP1_ENTITY_PARAMS_PARTITION) { - const struct v4l2_rect *crop; unsigned int offsets[2]; + struct v4l2_rect crop; /* Source size and crop offsets. * @@ -82,21 +82,47 @@ static void rpf_configure(struct vsp1_entity *entity, * offsets are needed, as planes 2 and 3 always have identical * strides. */ - crop = vsp1_rwpf_get_crop(rpf, rpf->entity.config); + crop = *vsp1_rwpf_get_crop(rpf, rpf->entity.config); + + /* Partition Algorithm Control + * + * The partition algorithm can split this frame into multiple + * slices. We must scale our partition window based on the pipe + * configuration to match the destination partition window. + * To achieve this, we adjust our crop to provide a 'sub-crop' + * matching the expected partition window. Only 'left' and + * 'width' need to be adjusted. + */ + if (pipe->partitions > 1) { + const struct v4l2_mbus_framefmt *output; + struct vsp1_entity *wpf = &pipe->output->entity; + unsigned int input_width = crop.width; + + /* Scale the partition window based on the configuration + * of the pipeline. + */ + output = vsp1_entity_get_pad_format(wpf, wpf->config, + RWPF_PAD_SOURCE); + + crop.width = pipe->partition.width * input_width + / output->width; + crop.left += pipe->partition.left * input_width + / output->width; + } vsp1_rpf_write(rpf, dl, VI6_RPF_SRC_BSIZE, - (crop->width << VI6_RPF_SRC_BSIZE_BHSIZE_SHIFT) | - (crop->height << VI6_RPF_SRC_BSIZE_BVSIZE_SHIFT)); + (crop.width << VI6_RPF_SRC_BSIZE_BHSIZE_SHIFT) | + (crop.height << VI6_RPF_SRC_BSIZE_BVSIZE_SHIFT)); vsp1_rpf_write(rpf, dl, VI6_RPF_SRC_ESIZE, - (crop->width << VI6_RPF_SRC_ESIZE_EHSIZE_SHIFT) | - (crop->height << VI6_RPF_SRC_ESIZE_EVSIZE_SHIFT)); + (crop.width << VI6_RPF_SRC_ESIZE_EHSIZE_SHIFT) | + (crop.height << VI6_RPF_SRC_ESIZE_EVSIZE_SHIFT)); - offsets[0] = crop->top * format->plane_fmt[0].bytesperline - + crop->left * fmtinfo->bpp[0] / 8; + offsets[0] = crop.top * format->plane_fmt[0].bytesperline + + crop.left * fmtinfo->bpp[0] / 8; if (format->num_planes > 1) - offsets[1] = crop->top * format->plane_fmt[1].bytesperline - + crop->left / fmtinfo->hsub + offsets[1] = crop.top * format->plane_fmt[1].bytesperline + + crop.left / fmtinfo->hsub * fmtinfo->bpp[1] / 8; else offsets[1] = 0; diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c index 706b6e85f47d..da8f89a31ea4 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.c +++ b/drivers/media/platform/vsp1/vsp1_uds.c @@ -18,6 +18,7 @@ #include "vsp1.h" #include "vsp1_dl.h" +#include "vsp1_pipe.h" #include "vsp1_uds.h" #define UDS_MIN_SIZE 4U @@ -270,6 +271,15 @@ static void uds_configure(struct vsp1_entity *entity, unsigned int vscale; bool multitap; + if (params == VSP1_ENTITY_PARAMS_PARTITION) { + const struct v4l2_rect *clip = &pipe->partition; + + vsp1_uds_write(uds, dl, VI6_UDS_CLIP_SIZE, + (clip->width << VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) | + (clip->height << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT)); + return; + } + if (params != VSP1_ENTITY_PARAMS_INIT) return; @@ -302,13 +312,10 @@ static void uds_configure(struct vsp1_entity *entity, (uds_passband_width(vscale) << VI6_UDS_PASS_BWIDTH_V_SHIFT)); - /* Set the scaling ratios and the output size. */ + /* Set the scaling ratios. */ vsp1_uds_write(uds, dl, VI6_UDS_SCALE, (hscale << VI6_UDS_SCALE_HFRAC_SHIFT) | (vscale << VI6_UDS_SCALE_VFRAC_SHIFT)); - vsp1_uds_write(uds, dl, VI6_UDS_CLIP_SIZE, - (output->width << VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) | - (output->height << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT)); } static unsigned int uds_max_width(struct vsp1_entity *entity, diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index b903cc5471e0..15d08cb50bd1 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -205,6 +205,74 @@ static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) pipe->partitions = DIV_ROUND_UP(format->width, div_size); } +/* + * vsp1_video_partition - Calculate the active partition output window + * + * @div_size: pre-determined maximum partition division size + * @index: partition index + * + * Returns a v4l2_rect describing the partition window. + */ +static struct v4l2_rect vsp1_video_partition(struct vsp1_pipeline *pipe, + unsigned int div_size, + unsigned int index) +{ + const struct v4l2_mbus_framefmt *format; + struct v4l2_rect partition; + unsigned int modulus; + + format = vsp1_entity_get_pad_format(&pipe->output->entity, + pipe->output->entity.config, + RWPF_PAD_SOURCE); + + /* A single partition simply processes the output size in full. */ + if (pipe->partitions <= 1) { + partition.left = 0; + partition.top = 0; + partition.width = format->width; + partition.height = format->height; + return partition; + } + + /* Initialise the partition with sane starting conditions. */ + partition.left = index * div_size; + partition.top = 0; + partition.width = div_size; + partition.height = format->height; + + modulus = format->width % div_size; + + /* We need to prevent the last partition from being smaller than the + * *minimum* width of the hardware capabilities. + * + * If the modulus is less than half of the partition size, + * the penultimate partition is reduced to half, which is added + * to the final partition: |1234|1234|1234|12|341| + * to prevents this: |1234|1234|1234|1234|1|. + */ + if (modulus) { + /* pipe->partitions is 1 based, whilst index is a 0 based index. + * Normalise this locally. + */ + unsigned int partitions = pipe->partitions - 1; + + if (modulus < div_size / 2) { + if (index == partitions - 1) { + /* Halve the penultimate partition. */ + partition.width = div_size / 2; + } else if (index == partitions) { + /* Increase the final partition. */ + partition.width = (div_size / 2) + modulus; + partition.left -= div_size / 2; + } + } else if (index == partitions) { + partition.width = modulus; + } + } + + return partition; +} + /* ----------------------------------------------------------------------------- * Pipeline Management */ @@ -280,22 +348,69 @@ static void vsp1_video_frame_end(struct vsp1_pipeline *pipe, pipe->buffers_ready |= 1 << video->pipe_index; } +static void vsp1_video_pipeline_run_partition(struct vsp1_pipeline *pipe, + struct vsp1_dl_list *dl) +{ + struct vsp1_entity *entity; + + pipe->partition = vsp1_video_partition(pipe, pipe->div_size, + pipe->current_partition); + + list_for_each_entry(entity, &pipe->entities, list_pipe) { + if (entity->ops->configure) + entity->ops->configure(entity, pipe, dl, + VSP1_ENTITY_PARAMS_PARTITION); + } +} + static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe) { + struct vsp1_device *vsp1 = pipe->output->entity.vsp1; struct vsp1_entity *entity; if (!pipe->dl) pipe->dl = vsp1_dl_list_get(pipe->output->dlm); + /* Start with the runtime parameters as the configure operation can + * compute/cache information needed when configuring partitions. This + * is the case with flipping in the WPF. + */ list_for_each_entry(entity, &pipe->entities, list_pipe) { - if (entity->ops->configure) { + if (entity->ops->configure) entity->ops->configure(entity, pipe, pipe->dl, VSP1_ENTITY_PARAMS_RUNTIME); - entity->ops->configure(entity, pipe, pipe->dl, - VSP1_ENTITY_PARAMS_PARTITION); - } } + /* Run the first partition */ + pipe->current_partition = 0; + vsp1_video_pipeline_run_partition(pipe, pipe->dl); + + /* Process consecutive partitions as necessary */ + for (pipe->current_partition = 1; + pipe->current_partition < pipe->partitions; + pipe->current_partition++) { + struct vsp1_dl_list *dl; + + /* Partition configuration operations will utilise + * the pipe->current_partition variable to determine + * the work they should complete. + */ + dl = vsp1_dl_list_get(pipe->output->dlm); + + /* An incomplete chain will still function, but output only + * the partitions that had a dl available. The frame end + * interrupt will be marked on the last dl in the chain. + */ + if (!dl) { + dev_err(vsp1->dev, "Failed to obtain a dl list. Frame will be incomplete\n"); + break; + } + + vsp1_video_pipeline_run_partition(pipe, dl); + vsp1_dl_list_add_chain(pipe->dl, dl); + } + + /* Complete, and commit the head display list. */ vsp1_dl_list_commit(pipe->dl); pipe->dl = NULL; diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index b757d2579d6c..fdee5a891e40 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -224,6 +224,9 @@ static void wpf_configure(struct vsp1_entity *entity, /* Cropping. The partition algorithm can split the image into * multiple slices. */ + if (pipe->partitions > 1) + width = pipe->partition.width; + vsp1_wpf_write(wpf, dl, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | (width << VI6_WPF_SZCLIP_SIZE_SHIFT)); @@ -237,10 +240,31 @@ static void wpf_configure(struct vsp1_entity *entity, /* Update the memory offsets based on flipping configuration. * The destination addresses point to the locations where the * VSP starts writing to memory, which can be different corners - * of the image depending on vertical flipping. Horizontal - * flipping is handled through a line buffer and doesn't modify - * the start address. + * of the image depending on vertical flipping. */ + if (pipe->partitions > 1) { + const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; + + /* Horizontal flipping is handled through a line buffer + * and doesn't modify the start address, but still needs + * to be handled when image partitioning is in effect to + * order the partitions correctly. + */ + if (flip & BIT(WPF_CTRL_HFLIP)) + offset = format->width - pipe->partition.left + - pipe->partition.width; + else + offset = pipe->partition.left; + + mem.addr[0] += offset * fmtinfo->bpp[0] / 8; + if (format->num_planes > 1) { + mem.addr[1] += offset / fmtinfo->hsub + * fmtinfo->bpp[1] / 8; + mem.addr[2] += offset / fmtinfo->hsub + * fmtinfo->bpp[2] / 8; + } + } + if (flip & BIT(WPF_CTRL_VFLIP)) { mem.addr[0] += (format->height - 1) * format->plane_fmt[0].bytesperline; From 225c2926d85bd2f9aebd5a122fa14a44b74d2594 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 13 Sep 2016 20:19:29 -0300 Subject: [PATCH 443/591] [media] v4l: vsp1: Fix spinlock in mixed IRQ context function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wpf_configure() function can be called both from IRQ and non-IRQ contexts, use spin_lock_irqsave(). Signed-off-by: Laurent Pinchart Acked-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_wpf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index fdee5a891e40..deb53b5df1cf 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -189,11 +189,12 @@ static void wpf_configure(struct vsp1_entity *entity, if (params == VSP1_ENTITY_PARAMS_RUNTIME) { const unsigned int mask = BIT(WPF_CTRL_VFLIP) | BIT(WPF_CTRL_HFLIP); + unsigned long flags; - spin_lock(&wpf->flip.lock); + spin_lock_irqsave(&wpf->flip.lock, flags); wpf->flip.active = (wpf->flip.active & ~mask) | (wpf->flip.pending & mask); - spin_unlock(&wpf->flip.lock); + spin_unlock_irqrestore(&wpf->flip.lock, flags); outfmt = (wpf->alpha << VI6_WPF_OUTFMT_PDV_SHIFT) | wpf->outfmt; From c9f49607f133615ac5efe7e10722c2952659c0ec Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 15 Sep 2016 16:08:09 -0300 Subject: [PATCH 444/591] [media] v4l: vsp1: Disable VYUY on Gen3 The VYUY format isn't supported on Gen3 hardware, disable it. Gen2 hardware supports VYUY in practice even though the documentation doesn't advertise it, so keep it for Gen2 devices. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_drm.c | 2 +- drivers/media/platform/vsp1/vsp1_pipe.c | 8 +++++++- drivers/media/platform/vsp1/vsp1_pipe.h | 3 ++- drivers/media/platform/vsp1/vsp1_video.c | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 832286975e71..54795b5e5a8a 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -286,7 +286,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, /* Store the format, stride, memory buffer address, crop and compose * rectangles and Z-order position and for the input. */ - fmtinfo = vsp1_get_format_info(cfg->pixelformat); + fmtinfo = vsp1_get_format_info(vsp1, cfg->pixelformat); if (!fmtinfo) { dev_dbg(vsp1->dev, "Unsupport pixel format %08x for RPF\n", cfg->pixelformat); diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c b/drivers/media/platform/vsp1/vsp1_pipe.c index 474de82165d8..78b6184f91ce 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.c +++ b/drivers/media/platform/vsp1/vsp1_pipe.c @@ -138,15 +138,21 @@ static const struct vsp1_format_info vsp1_video_formats[] = { /* * vsp1_get_format_info - Retrieve format information for a 4CC + * @vsp1: the VSP1 device * @fourcc: the format 4CC * * Return a pointer to the format information structure corresponding to the * given V4L2 format 4CC, or NULL if no corresponding format can be found. */ -const struct vsp1_format_info *vsp1_get_format_info(u32 fourcc) +const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1, + u32 fourcc) { unsigned int i; + /* Special case, the VYUY format is supported on Gen2 only. */ + if (vsp1->info->gen != 2 && fourcc == V4L2_PIX_FMT_VYUY) + return NULL; + for (i = 0; i < ARRAY_SIZE(vsp1_video_formats); ++i) { const struct vsp1_format_info *info = &vsp1_video_formats[i]; diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h b/drivers/media/platform/vsp1/vsp1_pipe.h index f15b697ad999..ac4ad2655551 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.h +++ b/drivers/media/platform/vsp1/vsp1_pipe.h @@ -130,6 +130,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe, void vsp1_pipelines_suspend(struct vsp1_device *vsp1); void vsp1_pipelines_resume(struct vsp1_device *vsp1); -const struct vsp1_format_info *vsp1_get_format_info(u32 fourcc); +const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1, + u32 fourcc); #endif /* __VSP1_PIPE_H__ */ diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index 15d08cb50bd1..e773d3d30df2 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -117,9 +117,9 @@ static int __vsp1_video_try_format(struct vsp1_video *video, /* Retrieve format information and select the default format if the * requested format isn't supported. */ - info = vsp1_get_format_info(pix->pixelformat); + info = vsp1_get_format_info(video->vsp1, pix->pixelformat); if (info == NULL) - info = vsp1_get_format_info(VSP1_VIDEO_DEF_FORMAT); + info = vsp1_get_format_info(video->vsp1, VSP1_VIDEO_DEF_FORMAT); pix->pixelformat = info->fourcc; pix->colorspace = V4L2_COLORSPACE_SRGB; From b61873922d2c0029411304e66f810f5133b32c4d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 19 Sep 2016 15:18:01 -0300 Subject: [PATCH 445/591] [media] vsp1: fix CodingStyle violations on multi-line comments Several multi-line comments added at the vsp1 patch series violate the Kernel CodingStyle. Fix them. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_bru.c | 3 ++- drivers/media/platform/vsp1/vsp1_clu.c | 3 ++- drivers/media/platform/vsp1/vsp1_dl.c | 21 ++++++++++++++------- drivers/media/platform/vsp1/vsp1_drm.c | 3 ++- drivers/media/platform/vsp1/vsp1_entity.h | 2 +- drivers/media/platform/vsp1/vsp1_pipe.c | 2 +- drivers/media/platform/vsp1/vsp1_rpf.c | 9 ++++++--- drivers/media/platform/vsp1/vsp1_rwpf.c | 6 ++++-- drivers/media/platform/vsp1/vsp1_video.c | 20 +++++++++++++------- drivers/media/platform/vsp1/vsp1_wpf.c | 9 ++++++--- 10 files changed, 51 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c index 2f5788c1a5be..ee8355c28f94 100644 --- a/drivers/media/platform/vsp1/vsp1_bru.c +++ b/drivers/media/platform/vsp1/vsp1_bru.c @@ -242,7 +242,8 @@ static int bru_set_selection(struct v4l2_subdev *subdev, goto done; } - /* The compose rectangle top left corner must be inside the output + /* + * The compose rectangle top left corner must be inside the output * frame. */ format = vsp1_entity_get_pad_format(&bru->entity, config, diff --git a/drivers/media/platform/vsp1/vsp1_clu.c b/drivers/media/platform/vsp1/vsp1_clu.c index f052abd05166..f2fb26e5ab4e 100644 --- a/drivers/media/platform/vsp1/vsp1_clu.c +++ b/drivers/media/platform/vsp1/vsp1_clu.c @@ -224,7 +224,8 @@ static void clu_configure(struct vsp1_entity *entity, switch (params) { case VSP1_ENTITY_PARAMS_INIT: { - /* The format can't be changed during streaming, only verify it + /* + * The format can't be changed during streaming, only verify it * at setup time and store the information internally for future * runtime configuration calls. */ diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c index 0af3e8fdc714..ad545aff4e35 100644 --- a/drivers/media/platform/vsp1/vsp1_dl.c +++ b/drivers/media/platform/vsp1/vsp1_dl.c @@ -296,7 +296,8 @@ struct vsp1_dl_list *vsp1_dl_list_get(struct vsp1_dl_manager *dlm) dl = list_first_entry(&dlm->free, struct vsp1_dl_list, list); list_del(&dl->list); - /* The display list chain must be initialised to ensure every + /* + * The display list chain must be initialised to ensure every * display list can assert list_empty() if it is not in a chain. */ INIT_LIST_HEAD(&dl->chain); @@ -315,7 +316,8 @@ static void __vsp1_dl_list_put(struct vsp1_dl_list *dl) if (!dl) return; - /* Release any linked display-lists which were chained for a single + /* + * Release any linked display-lists which were chained for a single * hardware operation. */ if (dl->has_chain) { @@ -325,7 +327,8 @@ static void __vsp1_dl_list_put(struct vsp1_dl_list *dl) dl->has_chain = false; - /* We can't free fragments here as DMA memory can only be freed in + /* + * We can't free fragments here as DMA memory can only be freed in * interruptible context. Move all fragments to the display list * manager's list of fragments to be freed, they will be * garbage-collected by the work queue. @@ -437,7 +440,8 @@ static void vsp1_dl_list_fill_header(struct vsp1_dl_list *dl, bool is_last) struct vsp1_dl_body *dlb; unsigned int num_lists = 0; - /* Fill the header with the display list bodies addresses and sizes. The + /* + * Fill the header with the display list bodies addresses and sizes. The * address of the first body has already been filled when the display * list was allocated. */ @@ -456,7 +460,8 @@ static void vsp1_dl_list_fill_header(struct vsp1_dl_list *dl, bool is_last) dl->header->num_lists = num_lists; - /* If this display list's chain is not empty, we are on a list, where + /* + * If this display list's chain is not empty, we are on a list, where * the next item in the list is the display list entity which should be * automatically queued by the hardware. */ @@ -482,7 +487,8 @@ void vsp1_dl_list_commit(struct vsp1_dl_list *dl) if (dl->dlm->mode == VSP1_DL_MODE_HEADER) { struct vsp1_dl_list *dl_child; - /* In header mode the caller guarantees that the hardware is + /* + * In header mode the caller guarantees that the hardware is * idle at this point. */ @@ -495,7 +501,8 @@ void vsp1_dl_list_commit(struct vsp1_dl_list *dl) vsp1_dl_list_fill_header(dl_child, last); } - /* Commit the head display list to hardware. Chained headers + /* + * Commit the head display list to hardware. Chained headers * will auto-start. */ vsp1_write(vsp1, VI6_DL_HDR_ADDR(dlm->index), dl->dma); diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 54795b5e5a8a..cd209dccff1b 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -283,7 +283,8 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index, cfg->pixelformat, cfg->pitch, &cfg->mem[0], &cfg->mem[1], &cfg->mem[2], cfg->zpos); - /* Store the format, stride, memory buffer address, crop and compose + /* + * Store the format, stride, memory buffer address, crop and compose * rectangles and Z-order position and for the input. */ fmtinfo = vsp1_get_format_info(vsp1, cfg->pixelformat); diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index 90a4d95c0a50..901146f807b9 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h @@ -35,7 +35,7 @@ enum vsp1_entity_type { VSP1_ENTITY_WPF, }; -/* +/** * enum vsp1_entity_params - Entity configuration parameters class * @VSP1_ENTITY_PARAMS_INIT - Initial parameters * @VSP1_ENTITY_PARAMS_PARTITION - Per-image partition parameters diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c b/drivers/media/platform/vsp1/vsp1_pipe.c index 78b6184f91ce..756ca4ea7668 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.c +++ b/drivers/media/platform/vsp1/vsp1_pipe.c @@ -136,7 +136,7 @@ static const struct vsp1_format_info vsp1_video_formats[] = { 3, { 8, 8, 8 }, false, true, 1, 1, false }, }; -/* +/** * vsp1_get_format_info - Retrieve format information for a 4CC * @vsp1: the VSP1 device * @fourcc: the format 4CC diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index e6236ff2f74a..b2e34a800ffa 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -75,7 +75,8 @@ static void rpf_configure(struct vsp1_entity *entity, unsigned int offsets[2]; struct v4l2_rect crop; - /* Source size and crop offsets. + /* + * Source size and crop offsets. * * The crop offsets correspond to the location of the crop * rectangle top left corner in the plane buffer. Only two @@ -84,7 +85,8 @@ static void rpf_configure(struct vsp1_entity *entity, */ crop = *vsp1_rwpf_get_crop(rpf, rpf->entity.config); - /* Partition Algorithm Control + /* + * Partition Algorithm Control * * The partition algorithm can split this frame into multiple * slices. We must scale our partition window based on the pipe @@ -98,7 +100,8 @@ static void rpf_configure(struct vsp1_entity *entity, struct vsp1_entity *wpf = &pipe->output->entity; unsigned int input_width = crop.width; - /* Scale the partition window based on the configuration + /* + * Scale the partition window based on the configuration * of the pipeline. */ output = vsp1_entity_get_pad_format(wpf, wpf->config, diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rwpf.c index a3ace8df7f4d..66e4d7ea31d6 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/vsp1/vsp1_rwpf.c @@ -132,7 +132,8 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, struct v4l2_mbus_framefmt *format; int ret = 0; - /* Cropping is only supported on the RPF and is implemented on the sink + /* + * Cropping is only supported on the RPF and is implemented on the sink * pad. */ if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK) @@ -180,7 +181,8 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, struct v4l2_rect *crop; int ret = 0; - /* Cropping is only supported on the RPF and is implemented on the sink + /* + * Cropping is only supported on the RPF and is implemented on the sink * pad. */ if (rwpf->entity.type == VSP1_ENTITY_WPF || sel->pad != RWPF_PAD_SINK) diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index e773d3d30df2..d351b9c768d2 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -205,7 +205,7 @@ static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) pipe->partitions = DIV_ROUND_UP(format->width, div_size); } -/* +/** * vsp1_video_partition - Calculate the active partition output window * * @div_size: pre-determined maximum partition division size @@ -242,7 +242,8 @@ static struct v4l2_rect vsp1_video_partition(struct vsp1_pipeline *pipe, modulus = format->width % div_size; - /* We need to prevent the last partition from being smaller than the + /* + * We need to prevent the last partition from being smaller than the * *minimum* width of the hardware capabilities. * * If the modulus is less than half of the partition size, @@ -251,7 +252,8 @@ static struct v4l2_rect vsp1_video_partition(struct vsp1_pipeline *pipe, * to prevents this: |1234|1234|1234|1234|1|. */ if (modulus) { - /* pipe->partitions is 1 based, whilst index is a 0 based index. + /* + * pipe->partitions is 1 based, whilst index is a 0 based index. * Normalise this locally. */ unsigned int partitions = pipe->partitions - 1; @@ -371,7 +373,8 @@ static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe) if (!pipe->dl) pipe->dl = vsp1_dl_list_get(pipe->output->dlm); - /* Start with the runtime parameters as the configure operation can + /* + * Start with the runtime parameters as the configure operation can * compute/cache information needed when configuring partitions. This * is the case with flipping in the WPF. */ @@ -391,13 +394,15 @@ static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe) pipe->current_partition++) { struct vsp1_dl_list *dl; - /* Partition configuration operations will utilise + /* + * Partition configuration operations will utilise * the pipe->current_partition variable to determine * the work they should complete. */ dl = vsp1_dl_list_get(pipe->output->dlm); - /* An incomplete chain will still function, but output only + /* + * An incomplete chain will still function, but output only * the partitions that had a dl available. The frame end * interrupt will be marked on the last dl in the chain. */ @@ -818,7 +823,8 @@ static void vsp1_video_stop_streaming(struct vb2_queue *vq) unsigned long flags; int ret; - /* Clear the buffers ready flag to make sure the device won't be started + /* + * Clear the buffers ready flag to make sure the device won't be started * by a QBUF on the video node on the other side of the pipeline. */ spin_lock_irqsave(&video->irqlock, flags); diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index deb53b5df1cf..7c48f81cd5c1 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -222,7 +222,8 @@ static void wpf_configure(struct vsp1_entity *entity, unsigned int height = source_format->height; unsigned int offset; - /* Cropping. The partition algorithm can split the image into + /* + * Cropping. The partition algorithm can split the image into * multiple slices. */ if (pipe->partitions > 1) @@ -238,7 +239,8 @@ static void wpf_configure(struct vsp1_entity *entity, if (pipe->lif) return; - /* Update the memory offsets based on flipping configuration. + /* + * Update the memory offsets based on flipping configuration. * The destination addresses point to the locations where the * VSP starts writing to memory, which can be different corners * of the image depending on vertical flipping. @@ -246,7 +248,8 @@ static void wpf_configure(struct vsp1_entity *entity, if (pipe->partitions > 1) { const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; - /* Horizontal flipping is handled through a line buffer + /* + * Horizontal flipping is handled through a line buffer * and doesn't modify the start address, but still needs * to be handled when image partitioning is in effect to * order the partitions correctly. From 5c8d8c0192385f448320f6b3bd00b3aaf68ab74f Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 7 Sep 2016 21:44:39 -0300 Subject: [PATCH 446/591] [media] pci: constify snd_pcm_ops structures Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // Signed-off-by: Julia Lawall Acked-by: Andrey Utkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cobalt/cobalt-alsa-pcm.c | 4 ++-- drivers/media/pci/cx18/cx18-alsa-pcm.c | 2 +- drivers/media/pci/cx23885/cx23885-alsa.c | 2 +- drivers/media/pci/cx25821/cx25821-alsa.c | 2 +- drivers/media/pci/cx88/cx88-alsa.c | 2 +- drivers/media/pci/ivtv/ivtv-alsa-pcm.c | 2 +- drivers/media/pci/saa7134/saa7134-alsa.c | 2 +- drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +- drivers/media/pci/tw686x/tw686x-audio.c | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/pci/cobalt/cobalt-alsa-pcm.c b/drivers/media/pci/cobalt/cobalt-alsa-pcm.c index f0bdf10cfd57..49013c6b8646 100644 --- a/drivers/media/pci/cobalt/cobalt-alsa-pcm.c +++ b/drivers/media/pci/cobalt/cobalt-alsa-pcm.c @@ -510,7 +510,7 @@ static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, return vmalloc_to_page(pageptr); } -static struct snd_pcm_ops snd_cobalt_pcm_capture_ops = { +static const struct snd_pcm_ops snd_cobalt_pcm_capture_ops = { .open = snd_cobalt_pcm_capture_open, .close = snd_cobalt_pcm_capture_close, .ioctl = snd_cobalt_pcm_ioctl, @@ -522,7 +522,7 @@ static struct snd_pcm_ops snd_cobalt_pcm_capture_ops = { .page = snd_pcm_get_vmalloc_page, }; -static struct snd_pcm_ops snd_cobalt_pcm_playback_ops = { +static const struct snd_pcm_ops snd_cobalt_pcm_playback_ops = { .open = snd_cobalt_pcm_playback_open, .close = snd_cobalt_pcm_playback_close, .ioctl = snd_cobalt_pcm_ioctl, diff --git a/drivers/media/pci/cx18/cx18-alsa-pcm.c b/drivers/media/pci/cx18/cx18-alsa-pcm.c index ffb6acdc575f..5344510fbea3 100644 --- a/drivers/media/pci/cx18/cx18-alsa-pcm.c +++ b/drivers/media/pci/cx18/cx18-alsa-pcm.c @@ -311,7 +311,7 @@ static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, return vmalloc_to_page(pageptr); } -static struct snd_pcm_ops snd_cx18_pcm_capture_ops = { +static const struct snd_pcm_ops snd_cx18_pcm_capture_ops = { .open = snd_cx18_pcm_capture_open, .close = snd_cx18_pcm_capture_close, .ioctl = snd_cx18_pcm_ioctl, diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index ae7c2e89ad1c..6115d4e148ba 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++ b/drivers/media/pci/cx23885/cx23885-alsa.c @@ -506,7 +506,7 @@ static struct page *snd_cx23885_page(struct snd_pcm_substream *substream, /* * operators */ -static struct snd_pcm_ops snd_cx23885_pcm_ops = { +static const struct snd_pcm_ops snd_cx23885_pcm_ops = { .open = snd_cx23885_pcm_open, .close = snd_cx23885_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/pci/cx25821/cx25821-alsa.c b/drivers/media/pci/cx25821/cx25821-alsa.c index df189b16af12..4711583de8fe 100644 --- a/drivers/media/pci/cx25821/cx25821-alsa.c +++ b/drivers/media/pci/cx25821/cx25821-alsa.c @@ -649,7 +649,7 @@ static struct page *snd_cx25821_page(struct snd_pcm_substream *substream, /* * operators */ -static struct snd_pcm_ops snd_cx25821_pcm_ops = { +static const struct snd_pcm_ops snd_cx25821_pcm_ops = { .open = snd_cx25821_pcm_open, .close = snd_cx25821_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c index f3f13eb0c16e..723f06462104 100644 --- a/drivers/media/pci/cx88/cx88-alsa.c +++ b/drivers/media/pci/cx88/cx88-alsa.c @@ -599,7 +599,7 @@ static struct page *snd_cx88_page(struct snd_pcm_substream *substream, /* * operators */ -static struct snd_pcm_ops snd_cx88_pcm_ops = { +static const struct snd_pcm_ops snd_cx88_pcm_ops = { .open = snd_cx88_pcm_open, .close = snd_cx88_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/pci/ivtv/ivtv-alsa-pcm.c b/drivers/media/pci/ivtv/ivtv-alsa-pcm.c index f198b9826ed8..a26f9800eca3 100644 --- a/drivers/media/pci/ivtv/ivtv-alsa-pcm.c +++ b/drivers/media/pci/ivtv/ivtv-alsa-pcm.c @@ -318,7 +318,7 @@ static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, return vmalloc_to_page(pageptr); } -static struct snd_pcm_ops snd_ivtv_pcm_capture_ops = { +static const struct snd_pcm_ops snd_ivtv_pcm_capture_ops = { .open = snd_ivtv_pcm_capture_open, .close = snd_ivtv_pcm_capture_close, .ioctl = snd_ivtv_pcm_ioctl, diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c index 94f816244407..dc0e2fc5f68b 100644 --- a/drivers/media/pci/saa7134/saa7134-alsa.c +++ b/drivers/media/pci/saa7134/saa7134-alsa.c @@ -877,7 +877,7 @@ static struct page *snd_card_saa7134_page(struct snd_pcm_substream *substream, * ALSA capture callbacks definition */ -static struct snd_pcm_ops snd_card_saa7134_capture_ops = { +static const struct snd_pcm_ops snd_card_saa7134_capture_ops = { .open = snd_card_saa7134_capture_open, .close = snd_card_saa7134_capture_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c index 4a37a1c51c48..6a35107aca25 100644 --- a/drivers/media/pci/solo6x10/solo6x10-g723.c +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c @@ -252,7 +252,7 @@ static int snd_solo_pcm_copy(struct snd_pcm_substream *ss, int channel, return 0; } -static struct snd_pcm_ops snd_solo_pcm_ops = { +static const struct snd_pcm_ops snd_solo_pcm_ops = { .open = snd_solo_pcm_open, .close = snd_solo_pcm_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/pci/tw686x/tw686x-audio.c b/drivers/media/pci/tw686x/tw686x-audio.c index 96e444c49173..77190768622a 100644 --- a/drivers/media/pci/tw686x/tw686x-audio.c +++ b/drivers/media/pci/tw686x/tw686x-audio.c @@ -269,7 +269,7 @@ static snd_pcm_uframes_t tw686x_pcm_pointer(struct snd_pcm_substream *ss) return bytes_to_frames(ss->runtime, ac->ptr); } -static struct snd_pcm_ops tw686x_pcm_ops = { +static const struct snd_pcm_ops tw686x_pcm_ops = { .open = tw686x_pcm_open, .close = tw686x_pcm_close, .ioctl = snd_pcm_lib_ioctl, From 22511cfa7d98d5fec6086b3bae130caaf6b661fa Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 7 Sep 2016 21:59:06 -0300 Subject: [PATCH 447/591] [media] usb: constify snd_pcm_ops structures Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-audio.c | 2 +- drivers/media/usb/em28xx/em28xx-audio.c | 2 +- drivers/media/usb/go7007/snd-go7007.c | 2 +- drivers/media/usb/tm6000/tm6000-alsa.c | 2 +- drivers/media/usb/usbtv/usbtv-audio.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c index 4cd5fa91612f..8263c4b0610b 100644 --- a/drivers/media/usb/cx231xx/cx231xx-audio.c +++ b/drivers/media/usb/cx231xx/cx231xx-audio.c @@ -635,7 +635,7 @@ static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, return vmalloc_to_page(pageptr); } -static struct snd_pcm_ops snd_cx231xx_pcm_capture = { +static const struct snd_pcm_ops snd_cx231xx_pcm_capture = { .open = snd_cx231xx_capture_open, .close = snd_cx231xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index 78f3687772bf..e11fe46a547c 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -695,7 +695,7 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, /* * register/unregister code and data */ -static struct snd_pcm_ops snd_em28xx_pcm_capture = { +static const struct snd_pcm_ops snd_em28xx_pcm_capture = { .open = snd_em28xx_capture_open, .close = snd_em28xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/usb/go7007/snd-go7007.c b/drivers/media/usb/go7007/snd-go7007.c index d22d7d574672..070871fb1fc4 100644 --- a/drivers/media/usb/go7007/snd-go7007.c +++ b/drivers/media/usb/go7007/snd-go7007.c @@ -198,7 +198,7 @@ static struct page *go7007_snd_pcm_page(struct snd_pcm_substream *substream, return vmalloc_to_page(substream->runtime->dma_area + offset); } -static struct snd_pcm_ops go7007_snd_capture_ops = { +static const struct snd_pcm_ops go7007_snd_capture_ops = { .open = go7007_snd_capture_open, .close = go7007_snd_capture_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/usb/tm6000/tm6000-alsa.c b/drivers/media/usb/tm6000/tm6000-alsa.c index e21c7aacecb6..f16fbd1f9f51 100644 --- a/drivers/media/usb/tm6000/tm6000-alsa.c +++ b/drivers/media/usb/tm6000/tm6000-alsa.c @@ -388,7 +388,7 @@ static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, /* * operators */ -static struct snd_pcm_ops snd_tm6000_pcm_ops = { +static const struct snd_pcm_ops snd_tm6000_pcm_ops = { .open = snd_tm6000_pcm_open, .close = snd_tm6000_close, .ioctl = snd_pcm_lib_ioctl, diff --git a/drivers/media/usb/usbtv/usbtv-audio.c b/drivers/media/usb/usbtv/usbtv-audio.c index 1965ff1b1f12..9db31db7d9ac 100644 --- a/drivers/media/usb/usbtv/usbtv-audio.c +++ b/drivers/media/usb/usbtv/usbtv-audio.c @@ -332,7 +332,7 @@ static snd_pcm_uframes_t snd_usbtv_pointer(struct snd_pcm_substream *substream) return chip->snd_buffer_pos; } -static struct snd_pcm_ops snd_usbtv_pcm_ops = { +static const struct snd_pcm_ops snd_usbtv_pcm_ops = { .open = snd_usbtv_pcm_open, .close = snd_usbtv_pcm_close, .ioctl = snd_pcm_lib_ioctl, From 6dca6cf072038ecd591789cfd94accc6fc053300 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 8 Sep 2016 10:05:40 -0300 Subject: [PATCH 448/591] [media] ov9650: add support for asynchronous probing Allow the sub-device to be probed asynchronously so a bridge driver that's waiting for the device can be notified and its .bound callback executed. Signed-off-by: Javier Martinez Canillas Tested-by: H . Nikolaus Schaller Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov9650.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c index be5a7fd4f076..502c72238a4a 100644 --- a/drivers/media/i2c/ov9650.c +++ b/drivers/media/i2c/ov9650.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -1520,6 +1521,10 @@ static int ov965x_probe(struct i2c_client *client, /* Update exposure time min/max to match frame format */ ov965x_update_exposure_ctrl(ov965x); + ret = v4l2_async_register_subdev(sd); + if (ret < 0) + goto err_ctrls; + return 0; err_ctrls: v4l2_ctrl_handler_free(sd->ctrl_handler); @@ -1532,7 +1537,7 @@ static int ov965x_remove(struct i2c_client *client) { struct v4l2_subdev *sd = i2c_get_clientdata(client); - v4l2_device_unregister_subdev(sd); + v4l2_async_unregister_subdev(sd); v4l2_ctrl_handler_free(sd->ctrl_handler); media_entity_cleanup(&sd->entity); From 1bc177174b97e4df8d27b6c3cdd79ffea9e2d18e Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 8 Sep 2016 20:59:01 -0300 Subject: [PATCH 449/591] [media] usb: constify vb2_ops structures Check for vb2_ops structures that are only stored in the ops field of a vb2_queue structure. That field is declared const, so vb2_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct vb2_ops i@p = { ... }; @ok@ identifier r.i; struct vb2_queue e; position p; @@ e.ops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct vb2_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct vb2_ops i = { ... }; // Signed-off-by: Julia Lawall Reviewed-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/airspy/airspy.c | 2 +- drivers/media/usb/au0828/au0828-video.c | 2 +- drivers/media/usb/em28xx/em28xx-video.c | 2 +- drivers/media/usb/go7007/go7007-v4l2.c | 2 +- drivers/media/usb/hackrf/hackrf.c | 2 +- drivers/media/usb/msi2500/msi2500.c | 2 +- drivers/media/usb/pwc/pwc-if.c | 2 +- drivers/media/usb/s2255/s2255drv.c | 2 +- drivers/media/usb/stk1160/stk1160-v4l.c | 2 +- drivers/media/usb/usbtv/usbtv-video.c | 2 +- drivers/media/usb/uvc/uvc_queue.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index 3c556ee306cd..8251942bcd12 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c @@ -605,7 +605,7 @@ static void airspy_stop_streaming(struct vb2_queue *vq) mutex_unlock(&s->v4l2_lock); } -static struct vb2_ops airspy_vb2_ops = { +static const struct vb2_ops airspy_vb2_ops = { .queue_setup = airspy_queue_setup, .buf_queue = airspy_buf_queue, .start_streaming = airspy_start_streaming, diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index 13b8387082f2..85dd9a8e83ff 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -928,7 +928,7 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq) del_timer_sync(&dev->vbi_timeout); } -static struct vb2_ops au0828_video_qops = { +static const struct vb2_ops au0828_video_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_queue = buffer_queue, diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 7968695217f3..1f7fa059eb34 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1204,7 +1204,7 @@ buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&dev->slock, flags); } -static struct vb2_ops em28xx_video_qops = { +static const struct vb2_ops em28xx_video_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_queue = buffer_queue, diff --git a/drivers/media/usb/go7007/go7007-v4l2.c b/drivers/media/usb/go7007/go7007-v4l2.c index af8458996d91..4eaba0c24629 100644 --- a/drivers/media/usb/go7007/go7007-v4l2.c +++ b/drivers/media/usb/go7007/go7007-v4l2.c @@ -477,7 +477,7 @@ static void go7007_stop_streaming(struct vb2_queue *q) go7007_write_addr(go, 0x3c82, 0x000d); } -static struct vb2_ops go7007_video_qops = { +static const struct vb2_ops go7007_video_qops = { .queue_setup = go7007_queue_setup, .buf_queue = go7007_buf_queue, .buf_prepare = go7007_buf_prepare, diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 662d5090a12e..d9a525260511 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c @@ -891,7 +891,7 @@ static void hackrf_stop_streaming(struct vb2_queue *vq) mutex_unlock(&dev->v4l2_lock); } -static struct vb2_ops hackrf_vb2_ops = { +static const struct vb2_ops hackrf_vb2_ops = { .queue_setup = hackrf_queue_setup, .buf_queue = hackrf_buf_queue, .start_streaming = hackrf_start_streaming, diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c index 367eb7e2a31d..bb3d31e2a0b5 100644 --- a/drivers/media/usb/msi2500/msi2500.c +++ b/drivers/media/usb/msi2500/msi2500.c @@ -897,7 +897,7 @@ static void msi2500_stop_streaming(struct vb2_queue *vq) mutex_unlock(&dev->v4l2_lock); } -static struct vb2_ops msi2500_vb2_ops = { +static const struct vb2_ops msi2500_vb2_ops = { .queue_setup = msi2500_queue_setup, .buf_queue = msi2500_buf_queue, .start_streaming = msi2500_start_streaming, diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index c4454c928776..ff657644b6b3 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c @@ -707,7 +707,7 @@ static void stop_streaming(struct vb2_queue *vq) mutex_unlock(&pdev->v4l2_lock); } -static struct vb2_ops pwc_vb_queue_ops = { +static const struct vb2_ops pwc_vb_queue_ops = { .queue_setup = queue_setup, .buf_init = buffer_init, .buf_prepare = buffer_prepare, diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 9458eb0ef66f..c3a0e87066eb 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -717,7 +717,7 @@ static void buffer_queue(struct vb2_buffer *vb) static int start_streaming(struct vb2_queue *vq, unsigned int count); static void stop_streaming(struct vb2_queue *vq); -static struct vb2_ops s2255_video_qops = { +static const struct vb2_ops s2255_video_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_queue = buffer_queue, diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c index 5fab3bee8c74..a005d262392a 100644 --- a/drivers/media/usb/stk1160/stk1160-v4l.c +++ b/drivers/media/usb/stk1160/stk1160-v4l.c @@ -742,7 +742,7 @@ static void stop_streaming(struct vb2_queue *vq) stk1160_stop_streaming(dev); } -static struct vb2_ops stk1160_video_qops = { +static const struct vb2_ops stk1160_video_qops = { .queue_setup = queue_setup, .buf_queue = buffer_queue, .start_streaming = start_streaming, diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c index 2a089756c988..6cbe4a245c9f 100644 --- a/drivers/media/usb/usbtv/usbtv-video.c +++ b/drivers/media/usb/usbtv/usbtv-video.c @@ -689,7 +689,7 @@ static void usbtv_stop_streaming(struct vb2_queue *vq) usbtv_stop(usbtv); } -static struct vb2_ops usbtv_vb2_ops = { +static const struct vb2_ops usbtv_vb2_ops = { .queue_setup = usbtv_queue_setup, .buf_queue = usbtv_buf_queue, .start_streaming = usbtv_start_streaming, diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index 773fefb52d7a..77edd206d345 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -177,7 +177,7 @@ static void uvc_stop_streaming(struct vb2_queue *vq) spin_unlock_irqrestore(&queue->irqlock, flags); } -static struct vb2_ops uvc_queue_qops = { +static const struct vb2_ops uvc_queue_qops = { .queue_setup = uvc_queue_setup, .buf_prepare = uvc_buffer_prepare, .buf_queue = uvc_buffer_queue, From b7b361f091c3e70e671aa0a9daadb4fb5420f736 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 8 Sep 2016 20:59:10 -0300 Subject: [PATCH 450/591] [media] platform: constify vb2_ops structures Check for vb2_ops structures that are only stored in the ops field of a vb2_queue structure. That field is declared const, so vb2_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct vb2_ops i@p = { ... }; @ok@ identifier r.i; struct vb2_queue e; position p; @@ e.ops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct vb2_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct vb2_ops i = { ... }; // Signed-off-by: Julia Lawall Reviewed-by: Laurent Pinchart Reviewed-by: Fabien Dessenne Reviewed-by: Jacek Anaszewski Reviewed-by: Benoit Parrot [hans.verkuil@cisco.com: dropped soc_camera/rcar_vin.c patch because that driver will be removed] Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos-gsc/gsc-m2m.c | 2 +- drivers/media/platform/exynos4-is/fimc-capture.c | 2 +- drivers/media/platform/exynos4-is/fimc-m2m.c | 2 +- drivers/media/platform/m2m-deinterlace.c | 2 +- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 2 +- drivers/media/platform/mx2_emmaprp.c | 2 +- drivers/media/platform/rcar-vin/rcar-dma.c | 2 +- drivers/media/platform/rcar_jpu.c | 2 +- drivers/media/platform/s5p-g2d/g2d.c | 2 +- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 +- drivers/media/platform/sh_vou.c | 2 +- drivers/media/platform/soc_camera/atmel-isi.c | 2 +- drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | 2 +- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 2 +- drivers/media/platform/ti-vpe/cal.c | 2 +- drivers/media/platform/ti-vpe/vpe.c | 2 +- drivers/media/platform/vim2m.c | 2 +- drivers/media/platform/xilinx/xilinx-dma.c | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index c019db81b8c2..9f03b791b711 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -261,7 +261,7 @@ static void gsc_m2m_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf); } -static struct vb2_ops gsc_m2m_qops = { +static const struct vb2_ops gsc_m2m_qops = { .queue_setup = gsc_m2m_queue_setup, .buf_prepare = gsc_m2m_buf_prepare, .buf_queue = gsc_m2m_buf_queue, diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c index fdec499fbbda..344028ea7d55 100644 --- a/drivers/media/platform/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/exynos4-is/fimc-capture.c @@ -452,7 +452,7 @@ static void buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&fimc->slock, flags); } -static struct vb2_ops fimc_capture_qops = { +static const struct vb2_ops fimc_capture_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_queue = buffer_queue, diff --git a/drivers/media/platform/exynos4-is/fimc-m2m.c b/drivers/media/platform/exynos4-is/fimc-m2m.c index b1309e114edb..6028e4fbaed3 100644 --- a/drivers/media/platform/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/exynos4-is/fimc-m2m.c @@ -219,7 +219,7 @@ static void fimc_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); } -static struct vb2_ops fimc_qops = { +static const struct vb2_ops fimc_qops = { .queue_setup = fimc_queue_setup, .buf_prepare = fimc_buf_prepare, .buf_queue = fimc_buf_queue, diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index 5a5dec348f4d..bedc7cc4c7d6 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -852,7 +852,7 @@ static void deinterlace_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf); } -static struct vb2_ops deinterlace_qops = { +static const struct vb2_ops deinterlace_qops = { .queue_setup = deinterlace_queue_setup, .buf_prepare = deinterlace_buf_prepare, .buf_queue = deinterlace_buf_queue, diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 7ad7bebf330c..2ed53e44ec89 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -933,7 +933,7 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q) ctx->state = MTK_STATE_FREE; } -static struct vb2_ops mtk_venc_vb2_ops = { +static const struct vb2_ops mtk_venc_vb2_ops = { .queue_setup = vb2ops_venc_queue_setup, .buf_prepare = vb2ops_venc_buf_prepare, .buf_queue = vb2ops_venc_buf_queue, diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c index c639406fe72e..e68d271b10af 100644 --- a/drivers/media/platform/mx2_emmaprp.c +++ b/drivers/media/platform/mx2_emmaprp.c @@ -743,7 +743,7 @@ static void emmaprp_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf); } -static struct vb2_ops emmaprp_qops = { +static const struct vb2_ops emmaprp_qops = { .queue_setup = emmaprp_queue_setup, .buf_prepare = emmaprp_buf_prepare, .buf_queue = emmaprp_buf_queue, diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 46abdb0ea663..9d9f02b1a4d9 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1114,7 +1114,7 @@ static void rvin_stop_streaming(struct vb2_queue *vq) rvin_disable_interrupts(vin); } -static struct vb2_ops rvin_qops = { +static const struct vb2_ops rvin_qops = { .queue_setup = rvin_queue_setup, .buf_prepare = rvin_buffer_prepare, .buf_queue = rvin_buffer_queue, diff --git a/drivers/media/platform/rcar_jpu.c b/drivers/media/platform/rcar_jpu.c index 16782ceb29c3..d1746ecc645d 100644 --- a/drivers/media/platform/rcar_jpu.c +++ b/drivers/media/platform/rcar_jpu.c @@ -1183,7 +1183,7 @@ static void jpu_stop_streaming(struct vb2_queue *vq) } } -static struct vb2_ops jpu_qops = { +static const struct vb2_ops jpu_qops = { .queue_setup = jpu_queue_setup, .buf_prepare = jpu_buf_prepare, .buf_queue = jpu_buf_queue, diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index 391dd7a7b362..62c0dec30b59 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c @@ -138,7 +138,7 @@ static void g2d_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); } -static struct vb2_ops g2d_qops = { +static const struct vb2_ops g2d_qops = { .queue_setup = g2d_queue_setup, .buf_prepare = g2d_buf_prepare, .buf_queue = g2d_buf_queue, diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index dde9d3598c48..d5e7762b7059 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2545,7 +2545,7 @@ static void s5p_jpeg_stop_streaming(struct vb2_queue *q) pm_runtime_put(ctx->jpeg->dev); } -static struct vb2_ops s5p_jpeg_qops = { +static const struct vb2_ops s5p_jpeg_qops = { .queue_setup = s5p_jpeg_queue_setup, .buf_prepare = s5p_jpeg_buf_prepare, .buf_queue = s5p_jpeg_buf_queue, diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 4ee7b1570f62..ef2a519bcd4c 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c @@ -362,7 +362,7 @@ static void sh_vou_stop_streaming(struct vb2_queue *vq) spin_unlock_irqrestore(&vou_dev->lock, flags); } -static struct vb2_ops sh_vou_qops = { +static const struct vb2_ops sh_vou_qops = { .queue_setup = sh_vou_queue_setup, .buf_prepare = sh_vou_buf_prepare, .buf_queue = sh_vou_buf_queue, diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 30211f6b4483..46de657c3e6d 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -536,7 +536,7 @@ static void stop_streaming(struct vb2_queue *vq) pm_runtime_put(ici->v4l2_dev.dev); } -static struct vb2_ops isi_video_qops = { +static const struct vb2_ops isi_video_qops = { .queue_setup = queue_setup, .buf_init = buffer_init, .buf_prepare = buffer_prepare, diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index e5571c8a368e..a15bfb5aea47 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c @@ -464,7 +464,7 @@ static void sh_mobile_ceu_stop_streaming(struct vb2_queue *q) sh_mobile_ceu_soft_reset(pcdev); } -static struct vb2_ops sh_mobile_ceu_videobuf_ops = { +static const struct vb2_ops sh_mobile_ceu_videobuf_ops = { .queue_setup = sh_mobile_ceu_videobuf_setup, .buf_prepare = sh_mobile_ceu_videobuf_prepare, .buf_queue = sh_mobile_ceu_videobuf_queue, diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c index 3b1ac687d0df..45f82b5ddd77 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c @@ -527,7 +527,7 @@ static void bdisp_stop_streaming(struct vb2_queue *q) pm_runtime_put(ctx->bdisp_dev->dev); } -static struct vb2_ops bdisp_qops = { +static const struct vb2_ops bdisp_qops = { .queue_setup = bdisp_queue_setup, .buf_prepare = bdisp_buf_prepare, .buf_queue = bdisp_buf_queue, diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index e967fcfdc1d8..44323cb5d287 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -1379,7 +1379,7 @@ static void cal_stop_streaming(struct vb2_queue *vq) cal_runtime_put(ctx->dev); } -static struct vb2_ops cal_video_qops = { +static const struct vb2_ops cal_video_qops = { .queue_setup = cal_queue_setup, .buf_prepare = cal_buffer_prepare, .buf_queue = cal_buffer_queue, diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index 55a1458ac783..0189f7f7cb03 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -1878,7 +1878,7 @@ static void vpe_stop_streaming(struct vb2_queue *q) vpdma_dump_regs(ctx->dev->vpdma); } -static struct vb2_ops vpe_qops = { +static const struct vb2_ops vpe_qops = { .queue_setup = vpe_queue_setup, .buf_prepare = vpe_buf_prepare, .buf_queue = vpe_buf_queue, diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index cd0ff4a66fdc..a98f679bd88d 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c @@ -815,7 +815,7 @@ static void vim2m_stop_streaming(struct vb2_queue *q) } } -static struct vb2_ops vim2m_qops = { +static const struct vb2_ops vim2m_qops = { .queue_setup = vim2m_queue_setup, .buf_prepare = vim2m_buf_prepare, .buf_queue = vim2m_buf_queue, diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c index 7ae1a134b1ff..1d5836c3fb7a 100644 --- a/drivers/media/platform/xilinx/xilinx-dma.c +++ b/drivers/media/platform/xilinx/xilinx-dma.c @@ -474,7 +474,7 @@ static void xvip_dma_stop_streaming(struct vb2_queue *vq) spin_unlock_irq(&dma->queued_lock); } -static struct vb2_ops xvip_dma_queue_qops = { +static const struct vb2_ops xvip_dma_queue_qops = { .queue_setup = xvip_dma_queue_setup, .buf_prepare = xvip_dma_buffer_prepare, .buf_queue = xvip_dma_buffer_queue, From 10accd2e6890b57db8e717e9aee91b791f90fe14 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 8 Sep 2016 20:59:18 -0300 Subject: [PATCH 451/591] [media] pci: constify vb2_ops structures Check for vb2_ops structures that are only stored in the ops field of a vb2_queue structure. That field is declared const, so vb2_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct vb2_ops i@p = { ... }; @ok@ identifier r.i; struct vb2_queue e; position p; @@ e.ops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct vb2_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct vb2_ops i = { ... }; // Signed-off-by: Julia Lawall Acked-by: Andrey Utkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-417.c | 2 +- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/pci/cx23885/cx23885-video.c | 2 +- drivers/media/pci/cx25821/cx25821-video.c | 2 +- drivers/media/pci/cx88/cx88-blackbird.c | 2 +- drivers/media/pci/cx88/cx88-dvb.c | 2 +- drivers/media/pci/cx88/cx88-video.c | 2 +- drivers/media/pci/netup_unidvb/netup_unidvb_core.c | 2 +- drivers/media/pci/saa7134/saa7134-empress.c | 2 +- drivers/media/pci/saa7134/saa7134-video.c | 2 +- drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 2 +- drivers/media/pci/tw68/tw68-video.c | 2 +- drivers/media/pci/tw686x/tw686x-video.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index efec2d1a7afd..c95db4de932c 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1223,7 +1223,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q) cx23885_cancel_buffers(&dev->ts1); } -static struct vb2_ops cx23885_qops = { +static const struct vb2_ops cx23885_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_finish = buffer_finish, diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index c5daa2306155..6855d621b82a 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -173,7 +173,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q) cx23885_cancel_buffers(port); } -static struct vb2_ops dvb_qops = { +static const struct vb2_ops dvb_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_finish = buffer_finish, diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 6d735222a958..33d168ef278d 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -517,7 +517,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q) spin_unlock_irqrestore(&dev->slock, flags); } -static struct vb2_ops cx23885_video_qops = { +static const struct vb2_ops cx23885_video_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_finish = buffer_finish, diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c index adcd09be347d..7ce352a0f2d3 100644 --- a/drivers/media/pci/cx25821/cx25821-video.c +++ b/drivers/media/pci/cx25821/cx25821-video.c @@ -307,7 +307,7 @@ static void cx25821_stop_streaming(struct vb2_queue *q) spin_unlock_irqrestore(&dev->slock, flags); } -static struct vb2_ops cx25821_video_qops = { +static const struct vb2_ops cx25821_video_qops = { .queue_setup = cx25821_queue_setup, .buf_prepare = cx25821_buffer_prepare, .buf_finish = cx25821_buffer_finish, diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c index 04fe9af2a802..b532e49e8f33 100644 --- a/drivers/media/pci/cx88/cx88-blackbird.c +++ b/drivers/media/pci/cx88/cx88-blackbird.c @@ -756,7 +756,7 @@ static void stop_streaming(struct vb2_queue *q) spin_unlock_irqrestore(&dev->slock, flags); } -static struct vb2_ops blackbird_qops = { +static const struct vb2_ops blackbird_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_finish = buffer_finish, diff --git a/drivers/media/pci/cx88/cx88-dvb.c b/drivers/media/pci/cx88/cx88-dvb.c index 5bb63e7a5691..ac2392d8887a 100644 --- a/drivers/media/pci/cx88/cx88-dvb.c +++ b/drivers/media/pci/cx88/cx88-dvb.c @@ -156,7 +156,7 @@ static void stop_streaming(struct vb2_queue *q) spin_unlock_irqrestore(&dev->slock, flags); } -static struct vb2_ops dvb_qops = { +static const struct vb2_ops dvb_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_finish = buffer_finish, diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 5dc1e3f08d50..d83eb3b10f54 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -567,7 +567,7 @@ static void stop_streaming(struct vb2_queue *q) spin_unlock_irqrestore(&dev->slock, flags); } -static struct vb2_ops cx8800_video_qops = { +static const struct vb2_ops cx8800_video_qops = { .queue_setup = queue_setup, .buf_prepare = buffer_prepare, .buf_finish = buffer_finish, diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c index ac547cb84de8..b078ac2a682c 100644 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c @@ -353,7 +353,7 @@ static void netup_unidvb_stop_streaming(struct vb2_queue *q) netup_unidvb_queue_cleanup(dma); } -static struct vb2_ops dvb_qops = { +static const struct vb2_ops dvb_qops = { .queue_setup = netup_unidvb_queue_setup, .buf_prepare = netup_unidvb_buf_prepare, .buf_queue = netup_unidvb_buf_queue, diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index ca417a454d67..b56b5f7d8725 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c @@ -85,7 +85,7 @@ static void stop_streaming(struct vb2_queue *vq) dev->empress_started = 0; } -static struct vb2_ops saa7134_empress_qops = { +static const struct vb2_ops saa7134_empress_qops = { .queue_setup = saa7134_ts_queue_setup, .buf_init = saa7134_ts_buffer_init, .buf_prepare = saa7134_ts_buffer_prepare, diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 20baa22afc42..cbb173d99085 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -1054,7 +1054,7 @@ void saa7134_vb2_stop_streaming(struct vb2_queue *vq) pm_qos_remove_request(&dev->qos_request); } -static struct vb2_ops vb2_qops = { +static const struct vb2_ops vb2_qops = { .queue_setup = queue_setup, .buf_init = buffer_init, .buf_prepare = buffer_prepare, diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c index 399164314c28..25a2137ab799 100644 --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c @@ -759,7 +759,7 @@ static void solo_enc_buf_finish(struct vb2_buffer *vb) } } -static struct vb2_ops solo_enc_video_qops = { +static const struct vb2_ops solo_enc_video_qops = { .queue_setup = solo_enc_queue_setup, .buf_queue = solo_enc_buf_queue, .buf_finish = solo_enc_buf_finish, diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 5e8212845c87..a45e02367321 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -535,7 +535,7 @@ static void tw68_stop_streaming(struct vb2_queue *q) } } -static struct vb2_ops tw68_video_qops = { +static const struct vb2_ops tw68_video_qops = { .queue_setup = tw68_queue_setup, .buf_queue = tw68_buf_queue, .buf_prepare = tw68_buf_prepare, diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index 9621588be12c..c3fafa97b2d0 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -577,7 +577,7 @@ static int tw686x_buf_prepare(struct vb2_buffer *vb) return 0; } -static struct vb2_ops tw686x_video_qops = { +static const struct vb2_ops tw686x_video_qops = { .queue_setup = tw686x_queue_setup, .buf_queue = tw686x_buf_queue, .buf_prepare = tw686x_buf_prepare, From db83d08dee3324dc8b0bf0d02ba295ba25a01758 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 11 Sep 2016 10:05:55 -0300 Subject: [PATCH 452/591] [media] constify local structures For structure types defined in the same file or local header files, find top-level static structure declarations that have the following properties: 1. Never reassigned. 2. Address never taken 3. Not passed to a top-level macro call 4. No pointer or array-typed field passed to a function or stored in a variable. Declare structures having all of these properties as const. Done using Coccinelle. Based on a suggestion by Joe Perches . Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/tvp514x.c | 2 +- drivers/media/pci/ddbridge/ddbridge-core.c | 18 +++++++++--------- drivers/media/pci/ngene/ngene-cards.c | 14 +++++++------- drivers/media/pci/smipcie/smipcie-main.c | 8 ++++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c index 7cf749fc7143..d5c9347f4c6d 100644 --- a/drivers/media/i2c/tvp514x.c +++ b/drivers/media/i2c/tvp514x.c @@ -977,7 +977,7 @@ static const struct v4l2_subdev_ops tvp514x_ops = { .pad = &tvp514x_pad_ops, }; -static struct tvp514x_decoder tvp514x_dev = { +static const struct tvp514x_decoder tvp514x_dev = { .streaming = 0, .fmt_list = tvp514x_fmt_list, .num_fmts = ARRAY_SIZE(tvp514x_fmt_list), diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 47def73b3502..18e3a4deee64 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -1643,53 +1643,53 @@ fail: /******************************************************************************/ /******************************************************************************/ -static struct ddb_info ddb_none = { +static const struct ddb_info ddb_none = { .type = DDB_NONE, .name = "Digital Devices PCIe bridge", }; -static struct ddb_info ddb_octopus = { +static const struct ddb_info ddb_octopus = { .type = DDB_OCTOPUS, .name = "Digital Devices Octopus DVB adapter", .port_num = 4, }; -static struct ddb_info ddb_octopus_le = { +static const struct ddb_info ddb_octopus_le = { .type = DDB_OCTOPUS, .name = "Digital Devices Octopus LE DVB adapter", .port_num = 2, }; -static struct ddb_info ddb_octopus_mini = { +static const struct ddb_info ddb_octopus_mini = { .type = DDB_OCTOPUS, .name = "Digital Devices Octopus Mini", .port_num = 4, }; -static struct ddb_info ddb_v6 = { +static const struct ddb_info ddb_v6 = { .type = DDB_OCTOPUS, .name = "Digital Devices Cine S2 V6 DVB adapter", .port_num = 3, }; -static struct ddb_info ddb_v6_5 = { +static const struct ddb_info ddb_v6_5 = { .type = DDB_OCTOPUS, .name = "Digital Devices Cine S2 V6.5 DVB adapter", .port_num = 4, }; -static struct ddb_info ddb_dvbct = { +static const struct ddb_info ddb_dvbct = { .type = DDB_OCTOPUS, .name = "Digital Devices DVBCT V6.1 DVB adapter", .port_num = 3, }; -static struct ddb_info ddb_satixS2v3 = { +static const struct ddb_info ddb_satixS2v3 = { .type = DDB_OCTOPUS, .name = "Mystique SaTiX-S2 V3 DVB adapter", .port_num = 3, }; -static struct ddb_info ddb_octopusv3 = { +static const struct ddb_info ddb_octopusv3 = { .type = DDB_OCTOPUS, .name = "Digital Devices Octopus V3 DVB adapter", .port_num = 4, diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c index 4e783a68bf4a..423e8c889310 100644 --- a/drivers/media/pci/ngene/ngene-cards.c +++ b/drivers/media/pci/ngene/ngene-cards.c @@ -613,7 +613,7 @@ static struct stv6110x_config tuner_cineS2_1 = { .clk_div = 1, }; -static struct ngene_info ngene_info_cineS2 = { +static const struct ngene_info ngene_info_cineS2 = { .type = NGENE_SIDEWINDER, .name = "Linux4Media cineS2 DVB-S2 Twin Tuner", .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, @@ -627,7 +627,7 @@ static struct ngene_info ngene_info_cineS2 = { .msi_supported = true, }; -static struct ngene_info ngene_info_satixS2 = { +static const struct ngene_info ngene_info_satixS2 = { .type = NGENE_SIDEWINDER, .name = "Mystique SaTiX-S2 Dual", .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, @@ -641,7 +641,7 @@ static struct ngene_info ngene_info_satixS2 = { .msi_supported = true, }; -static struct ngene_info ngene_info_satixS2v2 = { +static const struct ngene_info ngene_info_satixS2v2 = { .type = NGENE_SIDEWINDER, .name = "Mystique SaTiX-S2 Dual (v2)", .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, @@ -656,7 +656,7 @@ static struct ngene_info ngene_info_satixS2v2 = { .msi_supported = true, }; -static struct ngene_info ngene_info_cineS2v5 = { +static const struct ngene_info ngene_info_cineS2v5 = { .type = NGENE_SIDEWINDER, .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)", .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, @@ -672,7 +672,7 @@ static struct ngene_info ngene_info_cineS2v5 = { }; -static struct ngene_info ngene_info_duoFlex = { +static const struct ngene_info ngene_info_duoFlex = { .type = NGENE_SIDEWINDER, .name = "Digital Devices DuoFlex PCIe or miniPCIe", .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, NGENE_IO_TSIN, @@ -687,7 +687,7 @@ static struct ngene_info ngene_info_duoFlex = { .msi_supported = true, }; -static struct ngene_info ngene_info_m780 = { +static const struct ngene_info ngene_info_m780 = { .type = NGENE_APP, .name = "Aver M780 ATSC/QAM-B", @@ -727,7 +727,7 @@ static struct drxd_config fe_terratec_dvbt_1 = { .osc_deviation = osc_deviation, }; -static struct ngene_info ngene_info_terratec = { +static const struct ngene_info ngene_info_terratec = { .type = NGENE_TERRATEC, .name = "Terratec Integra/Cinergy2400i Dual DVB-T", .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, diff --git a/drivers/media/pci/smipcie/smipcie-main.c b/drivers/media/pci/smipcie/smipcie-main.c index 83981d611a79..6dbe3b4d09ce 100644 --- a/drivers/media/pci/smipcie/smipcie-main.c +++ b/drivers/media/pci/smipcie/smipcie-main.c @@ -1060,7 +1060,7 @@ static void smi_remove(struct pci_dev *pdev) } /* DVBSky cards */ -static struct smi_cfg_info dvbsky_s950_cfg = { +static const struct smi_cfg_info dvbsky_s950_cfg = { .type = SMI_DVBSKY_S950, .name = "DVBSky S950 V3", .ts_0 = SMI_TS_NULL, @@ -1070,7 +1070,7 @@ static struct smi_cfg_info dvbsky_s950_cfg = { .rc_map = RC_MAP_DVBSKY, }; -static struct smi_cfg_info dvbsky_s952_cfg = { +static const struct smi_cfg_info dvbsky_s952_cfg = { .type = SMI_DVBSKY_S952, .name = "DVBSky S952 V3", .ts_0 = SMI_TS_DMA_BOTH, @@ -1080,7 +1080,7 @@ static struct smi_cfg_info dvbsky_s952_cfg = { .rc_map = RC_MAP_DVBSKY, }; -static struct smi_cfg_info dvbsky_t9580_cfg = { +static const struct smi_cfg_info dvbsky_t9580_cfg = { .type = SMI_DVBSKY_T9580, .name = "DVBSky T9580 V3", .ts_0 = SMI_TS_DMA_BOTH, @@ -1090,7 +1090,7 @@ static struct smi_cfg_info dvbsky_t9580_cfg = { .rc_map = RC_MAP_DVBSKY, }; -static struct smi_cfg_info technotrend_s2_4200_cfg = { +static const struct smi_cfg_info technotrend_s2_4200_cfg = { .type = SMI_TECHNOTREND_S2_4200, .name = "TechnoTrend TT-budget S2-4200 Twin", .ts_0 = SMI_TS_DMA_BOTH, From 14c4bf3c6f7d76d2b2b50cc82f6830d6948f6faa Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 11 Sep 2016 11:44:12 -0300 Subject: [PATCH 453/591] [media] dvb-frontends: constify dvb_tuner_ops structures These structures are only used to copy into other structures, so declare them as const. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct dvb_tuner_ops i@p = { ... }; @ok1@ identifier r.i; expression e; position p; @@ e = i@p @ok2@ identifier r.i; expression e1, e2; position p; @@ memcpy(e1, &i@p, e2) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct dvb_tuner_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct dvb_tuner_ops i = { ... }; // Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/ascot2e.c | 2 +- drivers/media/dvb-frontends/dvb-pll.c | 2 +- drivers/media/dvb-frontends/helene.c | 4 ++-- drivers/media/dvb-frontends/horus3a.c | 2 +- drivers/media/dvb-frontends/ix2505v.c | 2 +- drivers/media/dvb-frontends/stb6000.c | 2 +- drivers/media/dvb-frontends/stb6100.c | 2 +- drivers/media/dvb-frontends/stv6110.c | 2 +- drivers/media/dvb-frontends/stv6110x.c | 2 +- drivers/media/dvb-frontends/tda18271c2dd.c | 2 +- drivers/media/dvb-frontends/tda665x.c | 2 +- drivers/media/dvb-frontends/tda8261.c | 2 +- drivers/media/dvb-frontends/tda826x.c | 2 +- drivers/media/dvb-frontends/ts2020.c | 2 +- drivers/media/dvb-frontends/tua6100.c | 2 +- drivers/media/dvb-frontends/zl10036.c | 2 +- drivers/media/dvb-frontends/zl10039.c | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/ascot2e.c index 8cc8c4597b6a..ad304eed656d 100644 --- a/drivers/media/dvb-frontends/ascot2e.c +++ b/drivers/media/dvb-frontends/ascot2e.c @@ -464,7 +464,7 @@ static int ascot2e_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static struct dvb_tuner_ops ascot2e_tuner_ops = { +static const struct dvb_tuner_ops ascot2e_tuner_ops = { .info = { .name = "Sony ASCOT2E", .frequency_min = 1000000, diff --git a/drivers/media/dvb-frontends/dvb-pll.c b/drivers/media/dvb-frontends/dvb-pll.c index 53089e142715..735a96662022 100644 --- a/drivers/media/dvb-frontends/dvb-pll.c +++ b/drivers/media/dvb-frontends/dvb-pll.c @@ -739,7 +739,7 @@ static int dvb_pll_init(struct dvb_frontend *fe) return -EINVAL; } -static struct dvb_tuner_ops dvb_pll_tuner_ops = { +static const struct dvb_tuner_ops dvb_pll_tuner_ops = { .release = dvb_pll_release, .sleep = dvb_pll_sleep, .init = dvb_pll_init, diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c index 3d1cd5fa4904..dc43c5f6d0ea 100644 --- a/drivers/media/dvb-frontends/helene.c +++ b/drivers/media/dvb-frontends/helene.c @@ -842,7 +842,7 @@ static int helene_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static struct dvb_tuner_ops helene_tuner_ops = { +static const struct dvb_tuner_ops helene_tuner_ops = { .info = { .name = "Sony HELENE Ter tuner", .frequency_min = 1000000, @@ -856,7 +856,7 @@ static struct dvb_tuner_ops helene_tuner_ops = { .get_frequency = helene_get_frequency, }; -static struct dvb_tuner_ops helene_tuner_ops_s = { +static const struct dvb_tuner_ops helene_tuner_ops_s = { .info = { .name = "Sony HELENE Sat tuner", .frequency_min = 500000, diff --git a/drivers/media/dvb-frontends/horus3a.c b/drivers/media/dvb-frontends/horus3a.c index a98bca5270d9..0c089b5986a1 100644 --- a/drivers/media/dvb-frontends/horus3a.c +++ b/drivers/media/dvb-frontends/horus3a.c @@ -326,7 +326,7 @@ static int horus3a_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static struct dvb_tuner_ops horus3a_tuner_ops = { +static const struct dvb_tuner_ops horus3a_tuner_ops = { .info = { .name = "Sony Horus3a", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/ix2505v.c b/drivers/media/dvb-frontends/ix2505v.c index 0e3387e00952..2826bbb36b73 100644 --- a/drivers/media/dvb-frontends/ix2505v.c +++ b/drivers/media/dvb-frontends/ix2505v.c @@ -258,7 +258,7 @@ static int ix2505v_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static struct dvb_tuner_ops ix2505v_tuner_ops = { +static const struct dvb_tuner_ops ix2505v_tuner_ops = { .info = { .name = "Sharp IX2505V (B0017)", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/stb6000.c b/drivers/media/dvb-frontends/stb6000.c index a0c3c526b132..73347d51f340 100644 --- a/drivers/media/dvb-frontends/stb6000.c +++ b/drivers/media/dvb-frontends/stb6000.c @@ -186,7 +186,7 @@ static int stb6000_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static struct dvb_tuner_ops stb6000_tuner_ops = { +static const struct dvb_tuner_ops stb6000_tuner_ops = { .info = { .name = "ST STB6000", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/stb6100.c b/drivers/media/dvb-frontends/stb6100.c index b9c2511bf019..5add1182c3ca 100644 --- a/drivers/media/dvb-frontends/stb6100.c +++ b/drivers/media/dvb-frontends/stb6100.c @@ -522,7 +522,7 @@ static int stb6100_set_params(struct dvb_frontend *fe) return 0; } -static struct dvb_tuner_ops stb6100_ops = { +static const struct dvb_tuner_ops stb6100_ops = { .info = { .name = "STB6100 Silicon Tuner", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/stv6110.c b/drivers/media/dvb-frontends/stv6110.c index 91c6dcf65d2a..66a5a7f2295c 100644 --- a/drivers/media/dvb-frontends/stv6110.c +++ b/drivers/media/dvb-frontends/stv6110.c @@ -382,7 +382,7 @@ static int stv6110_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) return 0; } -static struct dvb_tuner_ops stv6110_tuner_ops = { +static const struct dvb_tuner_ops stv6110_tuner_ops = { .info = { .name = "ST STV6110", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/stv6110x.c b/drivers/media/dvb-frontends/stv6110x.c index a62c01e454f5..c611ad210b5c 100644 --- a/drivers/media/dvb-frontends/stv6110x.c +++ b/drivers/media/dvb-frontends/stv6110x.c @@ -345,7 +345,7 @@ static int stv6110x_release(struct dvb_frontend *fe) return 0; } -static struct dvb_tuner_ops stv6110x_ops = { +static const struct dvb_tuner_ops stv6110x_ops = { .info = { .name = "STV6110(A) Silicon Tuner", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c index de0a1c110972..bc247f9b553a 100644 --- a/drivers/media/dvb-frontends/tda18271c2dd.c +++ b/drivers/media/dvb-frontends/tda18271c2dd.c @@ -1217,7 +1217,7 @@ static int get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) } -static struct dvb_tuner_ops tuner_ops = { +static const struct dvb_tuner_ops tuner_ops = { .info = { .name = "NXP TDA18271C2D", .frequency_min = 47125000, diff --git a/drivers/media/dvb-frontends/tda665x.c b/drivers/media/dvb-frontends/tda665x.c index 82f8cc534f33..7ca965987f40 100644 --- a/drivers/media/dvb-frontends/tda665x.c +++ b/drivers/media/dvb-frontends/tda665x.c @@ -206,7 +206,7 @@ static int tda665x_release(struct dvb_frontend *fe) return 0; } -static struct dvb_tuner_ops tda665x_ops = { +static const struct dvb_tuner_ops tda665x_ops = { .get_status = tda665x_get_status, .set_params = tda665x_set_params, .get_frequency = tda665x_get_frequency, diff --git a/drivers/media/dvb-frontends/tda8261.c b/drivers/media/dvb-frontends/tda8261.c index 3285b1bc4642..e0df93191b9e 100644 --- a/drivers/media/dvb-frontends/tda8261.c +++ b/drivers/media/dvb-frontends/tda8261.c @@ -161,7 +161,7 @@ static int tda8261_release(struct dvb_frontend *fe) return 0; } -static struct dvb_tuner_ops tda8261_ops = { +static const struct dvb_tuner_ops tda8261_ops = { .info = { .name = "TDA8261", diff --git a/drivers/media/dvb-frontends/tda826x.c b/drivers/media/dvb-frontends/tda826x.c index 04bbcc24de0a..2ec671df1441 100644 --- a/drivers/media/dvb-frontends/tda826x.c +++ b/drivers/media/dvb-frontends/tda826x.c @@ -129,7 +129,7 @@ static int tda826x_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static struct dvb_tuner_ops tda826x_tuner_ops = { +static const struct dvb_tuner_ops tda826x_tuner_ops = { .info = { .name = "Philips TDA826X", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index 14b410ffe612..a9f6bbea6df3 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -496,7 +496,7 @@ static int ts2020_read_signal_strength(struct dvb_frontend *fe, return 0; } -static struct dvb_tuner_ops ts2020_tuner_ops = { +static const struct dvb_tuner_ops ts2020_tuner_ops = { .info = { .name = "TS2020", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/tua6100.c b/drivers/media/dvb-frontends/tua6100.c index 029384d1fddd..6da12b9e55eb 100644 --- a/drivers/media/dvb-frontends/tua6100.c +++ b/drivers/media/dvb-frontends/tua6100.c @@ -157,7 +157,7 @@ static int tua6100_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static struct dvb_tuner_ops tua6100_tuner_ops = { +static const struct dvb_tuner_ops tua6100_tuner_ops = { .info = { .name = "Infineon TUA6100", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/zl10036.c b/drivers/media/dvb-frontends/zl10036.c index 0903d461b8fa..7ed81315965f 100644 --- a/drivers/media/dvb-frontends/zl10036.c +++ b/drivers/media/dvb-frontends/zl10036.c @@ -446,7 +446,7 @@ static int zl10036_init(struct dvb_frontend *fe) return ret; } -static struct dvb_tuner_ops zl10036_tuner_ops = { +static const struct dvb_tuner_ops zl10036_tuner_ops = { .info = { .name = "Zarlink ZL10036", .frequency_min = 950000, diff --git a/drivers/media/dvb-frontends/zl10039.c b/drivers/media/dvb-frontends/zl10039.c index ee09ec26c553..f8c271be196c 100644 --- a/drivers/media/dvb-frontends/zl10039.c +++ b/drivers/media/dvb-frontends/zl10039.c @@ -255,7 +255,7 @@ static int zl10039_release(struct dvb_frontend *fe) return 0; } -static struct dvb_tuner_ops zl10039_ops = { +static const struct dvb_tuner_ops zl10039_ops = { .release = zl10039_release, .init = zl10039_init, .sleep = zl10039_sleep, From 96105144475eeafa8445d2f9f3077a39dd7369a5 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 11 Sep 2016 11:44:13 -0300 Subject: [PATCH 454/591] [media] tuners: constify dvb_tuner_ops structures These structures are only used to copy into other structures, so declare them as const. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct dvb_tuner_ops i@p = { ... }; @ok1@ identifier r.i; expression e; position p; @@ e = i@p @ok2@ identifier r.i; expression e1, e2; position p; @@ memcpy(e1, &i@p, e2) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct dvb_tuner_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct dvb_tuner_ops i = { ... }; // Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/tuners/mt2063.c | 2 +- drivers/media/tuners/mt20xx.c | 4 ++-- drivers/media/tuners/mxl5007t.c | 2 +- drivers/media/tuners/tda827x.c | 4 ++-- drivers/media/tuners/tea5761.c | 2 +- drivers/media/tuners/tea5767.c | 2 +- drivers/media/tuners/tuner-simple.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/tuners/mt2063.c b/drivers/media/tuners/mt2063.c index 7f0b9d5940db..dfec23743afe 100644 --- a/drivers/media/tuners/mt2063.c +++ b/drivers/media/tuners/mt2063.c @@ -2201,7 +2201,7 @@ static int mt2063_get_bandwidth(struct dvb_frontend *fe, u32 *bw) return 0; } -static struct dvb_tuner_ops mt2063_ops = { +static const struct dvb_tuner_ops mt2063_ops = { .info = { .name = "MT2063 Silicon Tuner", .frequency_min = 45000000, diff --git a/drivers/media/tuners/mt20xx.c b/drivers/media/tuners/mt20xx.c index 9e031040c13f..52da4671b0e0 100644 --- a/drivers/media/tuners/mt20xx.c +++ b/drivers/media/tuners/mt20xx.c @@ -363,7 +363,7 @@ static int mt2032_set_params(struct dvb_frontend *fe, return ret; } -static struct dvb_tuner_ops mt2032_tuner_ops = { +static const struct dvb_tuner_ops mt2032_tuner_ops = { .set_analog_params = mt2032_set_params, .release = microtune_release, .get_frequency = microtune_get_frequency, @@ -563,7 +563,7 @@ static int mt2050_set_params(struct dvb_frontend *fe, return ret; } -static struct dvb_tuner_ops mt2050_tuner_ops = { +static const struct dvb_tuner_ops mt2050_tuner_ops = { .set_analog_params = mt2050_set_params, .release = microtune_release, .get_frequency = microtune_get_frequency, diff --git a/drivers/media/tuners/mxl5007t.c b/drivers/media/tuners/mxl5007t.c index f4ae04c3328a..42569c6811e6 100644 --- a/drivers/media/tuners/mxl5007t.c +++ b/drivers/media/tuners/mxl5007t.c @@ -794,7 +794,7 @@ static int mxl5007t_release(struct dvb_frontend *fe) /* ------------------------------------------------------------------------- */ -static struct dvb_tuner_ops mxl5007t_tuner_ops = { +static const struct dvb_tuner_ops mxl5007t_tuner_ops = { .info = { .name = "MaxLinear MxL5007T", }, diff --git a/drivers/media/tuners/tda827x.c b/drivers/media/tuners/tda827x.c index edcb4a723aa1..5050ce9be423 100644 --- a/drivers/media/tuners/tda827x.c +++ b/drivers/media/tuners/tda827x.c @@ -818,7 +818,7 @@ static int tda827x_initial_sleep(struct dvb_frontend *fe) return fe->ops.tuner_ops.sleep(fe); } -static struct dvb_tuner_ops tda827xo_tuner_ops = { +static const struct dvb_tuner_ops tda827xo_tuner_ops = { .info = { .name = "Philips TDA827X", .frequency_min = 55000000, @@ -834,7 +834,7 @@ static struct dvb_tuner_ops tda827xo_tuner_ops = { .get_bandwidth = tda827x_get_bandwidth, }; -static struct dvb_tuner_ops tda827xa_tuner_ops = { +static const struct dvb_tuner_ops tda827xa_tuner_ops = { .info = { .name = "Philips TDA827XA", .frequency_min = 44000000, diff --git a/drivers/media/tuners/tea5761.c b/drivers/media/tuners/tea5761.c index bf78cb9fc52c..36b0b1e1d05b 100644 --- a/drivers/media/tuners/tea5761.c +++ b/drivers/media/tuners/tea5761.c @@ -301,7 +301,7 @@ static int tea5761_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static struct dvb_tuner_ops tea5761_tuner_ops = { +static const struct dvb_tuner_ops tea5761_tuner_ops = { .info = { .name = "tea5761", // Philips TEA5761HN FM Radio }, diff --git a/drivers/media/tuners/tea5767.c b/drivers/media/tuners/tea5767.c index cd535cd4c071..d62a6d6b1f42 100644 --- a/drivers/media/tuners/tea5767.c +++ b/drivers/media/tuners/tea5767.c @@ -426,7 +426,7 @@ static int tea5767_set_config (struct dvb_frontend *fe, void *priv_cfg) return 0; } -static struct dvb_tuner_ops tea5767_tuner_ops = { +static const struct dvb_tuner_ops tea5767_tuner_ops = { .info = { .name = "tea5767", // Philips TEA5767HN FM Radio }, diff --git a/drivers/media/tuners/tuner-simple.c b/drivers/media/tuners/tuner-simple.c index 8e9ce144da9a..9ba9582e7765 100644 --- a/drivers/media/tuners/tuner-simple.c +++ b/drivers/media/tuners/tuner-simple.c @@ -1035,7 +1035,7 @@ static int simple_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) return 0; } -static struct dvb_tuner_ops simple_tuner_ops = { +static const struct dvb_tuner_ops simple_tuner_ops = { .init = simple_init, .sleep = simple_sleep, .set_analog_params = simple_set_params, From 7a4b9a29f8e5e16c28dbc56a8d2da7b6b3e482c7 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 12 Sep 2016 12:30:32 -0300 Subject: [PATCH 455/591] [media] Input: atmel_mxt: disallow impossible configuration The newnly added debug mode for the atmel_mxt_ts driver relies on the v4l2 interface and vb2_vmalloc, but those might be configured as loadable modules when the driver itself is built-in, resulting in a link failure: drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_vidioc_querycap': atmel_mxt_ts.c:(.text.mxt_vidioc_querycap+0x10): undefined reference to `video_devdata' drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_buffer_queue': atmel_mxt_ts.c:(.text.mxt_buffer_queue+0x20): undefined reference to `vb2_plane_vaddr' atmel_mxt_ts.c:(.text.mxt_buffer_queue+0x164): undefined reference to `vb2_buffer_done' drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_free_object_table': atmel_mxt_ts.c:(.text.mxt_free_object_table+0x18): undefined reference to `video_unregister_device' atmel_mxt_ts.c:(.text.mxt_free_object_table+0x20): undefined reference to `v4l2_device_unregister' The best workaround I could come up with is to disallow the debug mode unless it's actually possible to call it. Fixes: ecfdd7e2660e ("[media] Input: atmel_mxt_ts - output diagnostic debug via V4L2 device") Signed-off-by: Arnd Bergmann Acked-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/input/touchscreen/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 754e6aa0851d..ec41df887278 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -117,7 +117,8 @@ config TOUCHSCREEN_ATMEL_MXT config TOUCHSCREEN_ATMEL_MXT_T37 bool "Support T37 Diagnostic Data" - depends on TOUCHSCREEN_ATMEL_MXT && VIDEO_V4L2 + depends on TOUCHSCREEN_ATMEL_MXT + depends on VIDEO_V4L2=y || (TOUCHSCREEN_ATMEL_MXT=m && VIDEO_V4L2=m) select VIDEOBUF2_VMALLOC help Say Y here if you want support to output data from the T37 From 47d8e00ca3f9269498b4333d5c787f1442ebdbb6 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 12 Sep 2016 12:30:33 -0300 Subject: [PATCH 456/591] [media] Input: synaptics-rmi4: disallow impossible configuration The newly added debug mode for the synaptics-rmi4 driver relies on the v4l2 interface and vb2_vmalloc, but those might be configured as loadable modules when the driver itself is built-in, resulting in a link failure: drivers/input/rmi4/rmi_core.o: In function `rmi_f54_remove': rmi_f54.c:(.text.rmi_f54_remove+0x14): undefined reference to `video_unregister_device' rmi_f54.c:(.text.rmi_f54_remove+0x20): undefined reference to `v4l2_device_unregister' drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_s_input': rmi_f54.c:(.text.rmi_f54_vidioc_s_input+0x10): undefined reference to `video_devdata' drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_g_input': rmi_f54.c:(.text.rmi_f54_vidioc_g_input+0x10): undefined reference to `video_devdata' drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_fmt': rmi_f54.c:(.text.rmi_f54_vidioc_fmt+0x10): undefined reference to `video_devdata' drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_enum_input': rmi_f54.c:(.text.rmi_f54_vidioc_enum_input+0x10): undefined reference to `video_devdata' drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_querycap': ... The best workaround I could come up with is to disallow the debug mode unless it's actually possible to call it. Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 diagnostics") Signed-off-by: Arnd Bergmann Acked-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/input/rmi4/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index f3418b65eb41..4c8a55857e00 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -65,7 +65,7 @@ config RMI4_F30 config RMI4_F54 bool "RMI4 Function 54 (Analog diagnostics)" depends on RMI4_CORE - depends on VIDEO_V4L2 + depends on VIDEO_V4L2=y || (RMI4_CORE=m && VIDEO_V4L2=m) select VIDEOBUF2_VMALLOC help Say Y here if you want to add support for RMI4 function 54 From 37f0644f3a5648e6c081587e05df0572e33c70a6 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 12 Sep 2016 12:32:57 -0300 Subject: [PATCH 457/591] [media] ad5820: use __maybe_unused for PM functions The new ad5820 driver uses #ifdef to hide the suspend/resume functions, but gets it wrong when CONFIG_PM_SLEEP is disabled: drivers/media/i2c/ad5820.c:286:12: error: 'ad5820_resume' defined but not used [-Werror=unused-function] drivers/media/i2c/ad5820.c:274:12: error: 'ad5820_suspend' defined but not used [-Werror=unused-function] This replaces the #ifdef with a __maybe_unused annotation that is simpler and harder to get wrong, avoiding the warning. Fixes: bee3d5115611 ("[media] ad5820: Add driver for auto-focus coil") Signed-off-by: Arnd Bergmann Acked-by: Pavel Machek Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ad5820.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index fd4c5f67163d..beab2f381b81 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -269,9 +269,7 @@ static const struct v4l2_subdev_internal_ops ad5820_internal_ops = { /* * I2C driver */ -#ifdef CONFIG_PM - -static int ad5820_suspend(struct device *dev) +static int __maybe_unused ad5820_suspend(struct device *dev) { struct i2c_client *client = container_of(dev, struct i2c_client, dev); struct v4l2_subdev *subdev = i2c_get_clientdata(client); @@ -283,7 +281,7 @@ static int ad5820_suspend(struct device *dev) return ad5820_power_off(coil, false); } -static int ad5820_resume(struct device *dev) +static int __maybe_unused ad5820_resume(struct device *dev) { struct i2c_client *client = container_of(dev, struct i2c_client, dev); struct v4l2_subdev *subdev = i2c_get_clientdata(client); @@ -295,13 +293,6 @@ static int ad5820_resume(struct device *dev) return ad5820_power_on(coil, true); } -#else - -#define ad5820_suspend NULL -#define ad5820_resume NULL - -#endif /* CONFIG_PM */ - static int ad5820_probe(struct i2c_client *client, const struct i2c_device_id *devid) { From b7e5063589646f95520bc21d1c87c96671bd5101 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 12 Sep 2016 12:32:58 -0300 Subject: [PATCH 458/591] [media] atmel-isc: mark PM functions as __maybe_unused The newly added atmel-isc driver uses SET_RUNTIME_PM_OPS() to refer to its suspend/resume functions, causing a warning when CONFIG_PM is not set: media/platform/atmel/atmel-isc.c:1477:12: error: 'isc_runtime_resume' defined but not used [-Werror=unused-function] media/platform/atmel/atmel-isc.c:1467:12: error: 'isc_runtime_suspend' defined but not used [-Werror=unused-function] This adds __maybe_unused annotations to avoid the warning without adding an error-prone #ifdef around it. Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/atmel/atmel-isc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index ed8050d6ea71..ccfe13b7d3f8 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -1470,7 +1470,7 @@ static int atmel_isc_remove(struct platform_device *pdev) return 0; } -static int isc_runtime_suspend(struct device *dev) +static int __maybe_unused isc_runtime_suspend(struct device *dev) { struct isc_device *isc = dev_get_drvdata(dev); @@ -1480,7 +1480,7 @@ static int isc_runtime_suspend(struct device *dev) return 0; } -static int isc_runtime_resume(struct device *dev) +static int __maybe_unused isc_runtime_resume(struct device *dev) { struct isc_device *isc = dev_get_drvdata(dev); int ret; From d1463e52003033cf936182b02ae60d9c066000de Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 12 Sep 2016 12:34:57 -0300 Subject: [PATCH 459/591] [media] usb: gadget: uvc: add V4L2 dependency Building the UVC gadget into the kernel fails to build when CONFIG_VIDEO_V4L2 is a loadable module: drivers/usb/gadget/function/usb_f_uvc.o: In function `uvc_function_ep0_complete': uvc_configfs.c:(.text.uvc_function_ep0_complete+0x84): undefined reference to `v4l2_event_queue' drivers/usb/gadget/function/usb_f_uvc.o: In function `uvc_function_disable': uvc_configfs.c:(.text.uvc_function_disable+0x34): undefined reference to `v4l2_event_queue' Adding a dependency in USB_CONFIGFS_F_UVC (which is a bool symbol) make the 'select USB_F_UVC' statement turn the USB_F_UVC into 'm' whenever CONFIG_VIDEO_V4L2=m too, avoiding the link failure. Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 3c3f31ceece7..4e7503da2fcf 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -439,6 +439,7 @@ config USB_CONFIGFS_F_HID config USB_CONFIGFS_F_UVC bool "USB Webcam function" depends on USB_CONFIGFS + depends on VIDEO_V4L2 depends on VIDEO_DEV select VIDEOBUF2_VMALLOC select USB_F_UVC From f3c4a8f8d8eb3ed97bccf4776079af3ec5daa147 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Thu, 15 Sep 2016 17:30:43 -0300 Subject: [PATCH 460/591] [media] Input: v4l-touch - add copyright lines Add copyright lines for Zodiac who paid for the V4L touch work. Signed-off-by: Nick Dyer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/input/rmi4/rmi_f54.c | 1 + drivers/input/touchscreen/atmel_mxt_ts.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c index bd86d3d599e7..cf805b960866 100644 --- a/drivers/input/rmi4/rmi_f54.c +++ b/drivers/input/rmi4/rmi_f54.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012-2015 Synaptics Incorporated + * Copyright (C) 2016 Zodiac Inflight Innovations * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index beede8fe511c..e5d185fe69b9 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -4,6 +4,7 @@ * Copyright (C) 2010 Samsung Electronics Co.Ltd * Copyright (C) 2011-2014 Atmel Corporation * Copyright (C) 2012 Google, Inc. + * Copyright (C) 2016 Zodiac Inflight Innovations * * Author: Joonyoung Shim * From 78f2c50bb4e1884318542cc5f674afb106555273 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Mon, 29 Aug 2016 10:12:01 -0300 Subject: [PATCH 461/591] [media] constify i2c_algorithm structures These i2c_algorithm structures are only stored in the alg field of an i2c_adapter structure, which is declared as const. This declare the structures as const as well. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.alg = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; // Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-i2c.c | 2 +- drivers/media/pci/cx25821/cx25821-i2c.c | 2 +- drivers/media/pci/ivtv/ivtv-i2c.c | 2 +- drivers/media/pci/saa7134/saa7134-i2c.c | 2 +- drivers/media/pci/saa7164/saa7164-i2c.c | 2 +- drivers/media/radio/si4713/radio-usb-si4713.c | 2 +- drivers/media/usb/cx231xx/cx231xx-i2c.c | 2 +- drivers/media/usb/em28xx/em28xx-i2c.c | 2 +- drivers/media/usb/go7007/go7007-i2c.c | 2 +- drivers/media/usb/go7007/go7007-usb.c | 2 +- drivers/media/usb/hdpvr/hdpvr-i2c.c | 2 +- drivers/media/usb/stk1160/stk1160-i2c.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-i2c.c b/drivers/media/pci/cx23885/cx23885-i2c.c index ae061b358591..61591225be9a 100644 --- a/drivers/media/pci/cx23885/cx23885-i2c.c +++ b/drivers/media/pci/cx23885/cx23885-i2c.c @@ -258,7 +258,7 @@ static u32 cx23885_functionality(struct i2c_adapter *adap) return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; } -static struct i2c_algorithm cx23885_i2c_algo_template = { +static const struct i2c_algorithm cx23885_i2c_algo_template = { .master_xfer = i2c_xfer, .functionality = cx23885_functionality, }; diff --git a/drivers/media/pci/cx25821/cx25821-i2c.c b/drivers/media/pci/cx25821/cx25821-i2c.c index dca37c7dba73..63ba25b82692 100644 --- a/drivers/media/pci/cx25821/cx25821-i2c.c +++ b/drivers/media/pci/cx25821/cx25821-i2c.c @@ -281,7 +281,7 @@ static u32 cx25821_functionality(struct i2c_adapter *adap) I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_WRITE_WORD_DATA; } -static struct i2c_algorithm cx25821_i2c_algo_template = { +static const struct i2c_algorithm cx25821_i2c_algo_template = { .master_xfer = i2c_xfer, .functionality = cx25821_functionality, #ifdef NEED_ALGO_CONTROL diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c index bccbf2d18e30..dd57442cf086 100644 --- a/drivers/media/pci/ivtv/ivtv-i2c.c +++ b/drivers/media/pci/ivtv/ivtv-i2c.c @@ -625,7 +625,7 @@ static u32 ivtv_functionality(struct i2c_adapter *adap) return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; } -static struct i2c_algorithm ivtv_algo = { +static const struct i2c_algorithm ivtv_algo = { .master_xfer = ivtv_xfer, .functionality = ivtv_functionality, }; diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c b/drivers/media/pci/saa7134/saa7134-i2c.c index 8ef6399d794f..2dac48fa1386 100644 --- a/drivers/media/pci/saa7134/saa7134-i2c.c +++ b/drivers/media/pci/saa7134/saa7134-i2c.c @@ -338,7 +338,7 @@ static u32 functionality(struct i2c_adapter *adap) return I2C_FUNC_SMBUS_EMUL; } -static struct i2c_algorithm saa7134_algo = { +static const struct i2c_algorithm saa7134_algo = { .master_xfer = saa7134_i2c_xfer, .functionality = functionality, }; diff --git a/drivers/media/pci/saa7164/saa7164-i2c.c b/drivers/media/pci/saa7164/saa7164-i2c.c index 0342d84913b8..024f4e29e840 100644 --- a/drivers/media/pci/saa7164/saa7164-i2c.c +++ b/drivers/media/pci/saa7164/saa7164-i2c.c @@ -75,7 +75,7 @@ static u32 saa7164_functionality(struct i2c_adapter *adap) return I2C_FUNC_I2C; } -static struct i2c_algorithm saa7164_i2c_algo_template = { +static const struct i2c_algorithm saa7164_i2c_algo_template = { .master_xfer = i2c_xfer, .functionality = saa7164_functionality, }; diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c b/drivers/media/radio/si4713/radio-usb-si4713.c index 5146be2a1a50..e5e5a1672bdb 100644 --- a/drivers/media/radio/si4713/radio-usb-si4713.c +++ b/drivers/media/radio/si4713/radio-usb-si4713.c @@ -402,7 +402,7 @@ static u32 si4713_functionality(struct i2c_adapter *adapter) return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; } -static struct i2c_algorithm si4713_algo = { +static const struct i2c_algorithm si4713_algo = { .master_xfer = si4713_transfer, .functionality = si4713_functionality, }; diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 3e7982ef180a..35e9acfe63d3 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -454,7 +454,7 @@ static u32 functionality(struct i2c_adapter *adap) return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; } -static struct i2c_algorithm cx231xx_algo = { +static const struct i2c_algorithm cx231xx_algo = { .master_xfer = cx231xx_i2c_xfer, .functionality = functionality, }; diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index 1a9e1e556706..8b690ac908a4 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c @@ -855,7 +855,7 @@ static u32 functionality(struct i2c_adapter *i2c_adap) return 0; } -static struct i2c_algorithm em28xx_algo = { +static const struct i2c_algorithm em28xx_algo = { .master_xfer = em28xx_i2c_xfer, .functionality = functionality, }; diff --git a/drivers/media/usb/go7007/go7007-i2c.c b/drivers/media/usb/go7007/go7007-i2c.c index 55addfa855d4..c084bf794b56 100644 --- a/drivers/media/usb/go7007/go7007-i2c.c +++ b/drivers/media/usb/go7007/go7007-i2c.c @@ -191,7 +191,7 @@ static u32 go7007_functionality(struct i2c_adapter *adapter) return I2C_FUNC_SMBUS_BYTE_DATA; } -static struct i2c_algorithm go7007_algo = { +static const struct i2c_algorithm go7007_algo = { .smbus_xfer = go7007_smbus_xfer, .master_xfer = go7007_i2c_master_xfer, .functionality = go7007_functionality, diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c index 14d3f8c1ce4a..ed9bcaf08d5e 100644 --- a/drivers/media/usb/go7007/go7007-usb.c +++ b/drivers/media/usb/go7007/go7007-usb.c @@ -1032,7 +1032,7 @@ static u32 go7007_usb_functionality(struct i2c_adapter *adapter) return (I2C_FUNC_SMBUS_EMUL) & ~I2C_FUNC_SMBUS_QUICK; } -static struct i2c_algorithm go7007_usb_algo = { +static const struct i2c_algorithm go7007_usb_algo = { .master_xfer = go7007_usb_i2c_master_xfer, .functionality = go7007_usb_functionality, }; diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c index a38f58c4c6bf..608ae96dc0e5 100644 --- a/drivers/media/usb/hdpvr/hdpvr-i2c.c +++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c @@ -180,7 +180,7 @@ static u32 hdpvr_functionality(struct i2c_adapter *adapter) return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; } -static struct i2c_algorithm hdpvr_algo = { +static const struct i2c_algorithm hdpvr_algo = { .master_xfer = hdpvr_transfer, .functionality = hdpvr_functionality, }; diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c b/drivers/media/usb/stk1160/stk1160-i2c.c index 850cf285ada8..3f2517be02bb 100644 --- a/drivers/media/usb/stk1160/stk1160-i2c.c +++ b/drivers/media/usb/stk1160/stk1160-i2c.c @@ -235,7 +235,7 @@ static u32 functionality(struct i2c_adapter *adap) return I2C_FUNC_SMBUS_EMUL; } -static struct i2c_algorithm algo = { +static const struct i2c_algorithm algo = { .master_xfer = stk1160_i2c_xfer, .functionality = functionality, }; From 1c195cb1def158a390669fb4a3989092b413e0c7 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 1 Sep 2016 08:03:14 -0300 Subject: [PATCH 462/591] [media] rc/streamzap: fix spelling mistake "sumbiting" -> "submitting" Trivial fix to spelling mistake in dev_err message. Signed-off-by: Colin Ian King Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/streamzap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index 815243c65bc3..4004260a7c69 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -499,7 +499,7 @@ static int streamzap_resume(struct usb_interface *intf) struct streamzap_ir *sz = usb_get_intfdata(intf); if (usb_submit_urb(sz->urb_in, GFP_ATOMIC)) { - dev_err(sz->dev, "Error sumbiting urb\n"); + dev_err(sz->dev, "Error submitting urb\n"); return -EIO; } From f86548cf53970abd5eed75e55e635dc77e90fd04 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 1 Sep 2016 08:09:41 -0300 Subject: [PATCH 463/591] [media] lgdt3306a: fix spelling mistake "supportted" -> "supported" Trivial fix to spelling mistake in pr_warn message. Signed-off-by: Colin Ian King Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/lgdt3306a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c index 179c26e5eb4e..afb9d731e60e 100644 --- a/drivers/media/dvb-frontends/lgdt3306a.c +++ b/drivers/media/dvb-frontends/lgdt3306a.c @@ -731,7 +731,7 @@ static int lgdt3306a_set_if(struct lgdt3306a_state *state, switch (if_freq_khz) { default: - pr_warn("IF=%d KHz is not supportted, 3250 assumed\n", + pr_warn("IF=%d KHz is not supported, 3250 assumed\n", if_freq_khz); /* fallthrough */ case 3250: /* 3.25Mhz */ From cafddc652cdb9aa81f7319001e42d755bf956c9d Mon Sep 17 00:00:00 2001 From: Baoyou Xie Date: Sun, 4 Sep 2016 03:41:41 -0300 Subject: [PATCH 464/591] [media] staging: media: omap4iss: mark omap4iss_flush() static We get 1 warning when building kernel with W=1: drivers/staging/media/omap4iss/iss.c:64:6: warning: no previous prototype for 'omap4iss_flush' [-Wmissing-prototypes] In fact, this function is only used in the file in which it is declared and don't need a declaration, but can be made static. so this patch marks this function with 'static'. Signed-off-by: Baoyou Xie Acked-by: Arnd Bergmann Acked-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap4iss/iss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index ffc4900da961..c26c99fd4a24 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -61,7 +61,7 @@ static void iss_print_status(struct iss_device *iss) * See this link for reference: * http://www.mail-archive.com/linux-omap@vger.kernel.org/msg08149.html */ -void omap4iss_flush(struct iss_device *iss) +static void omap4iss_flush(struct iss_device *iss) { iss_reg_write(iss, OMAP4_ISS_MEM_TOP, ISS_HL_REVISION, 0); iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_REVISION); From 56e247a55a6bf256714e6bc46bd176341bce52aa Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 11 Sep 2016 11:44:14 -0300 Subject: [PATCH 465/591] [media] mxl111sf-tuner: constify dvb_tuner_ops structures These structures are only used to copy into other structures, so declare them as const. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct dvb_tuner_ops i@p = { ... }; @ok1@ identifier r.i; expression e; position p; @@ e = i@p @ok2@ identifier r.i; expression e1, e2; position p; @@ memcpy(e1, &i@p, e2) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct dvb_tuner_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct dvb_tuner_ops i = { ... }; // Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c index 7d16252dbb71..f141dcc55cc9 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c @@ -466,7 +466,7 @@ static int mxl111sf_tuner_release(struct dvb_frontend *fe) /* ------------------------------------------------------------------------- */ -static struct dvb_tuner_ops mxl111sf_tuner_tuner_ops = { +static const struct dvb_tuner_ops mxl111sf_tuner_tuner_ops = { .info = { .name = "MaxLinear MxL111SF", #if 0 From 19de16c045e1b82a3e80832c9bd90f78b2693832 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 16 Sep 2016 05:23:53 -0300 Subject: [PATCH 466/591] [media] hva: fix sparse warnings drivers/media/platform/sti/hva/hva-v4l2.c:43:22: warning: symbol 'hva_encoders' was not declared. Should it be static? drivers/media/platform/sti/hva/hva-v4l2.c:1401:24: warning: symbol 'hva_driver' was not declared. Should it be static? Make these static. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/sti/hva/hva-v4l2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/sti/hva/hva-v4l2.c b/drivers/media/platform/sti/hva/hva-v4l2.c index 1696e02c5707..6bf3c8588230 100644 --- a/drivers/media/platform/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/sti/hva/hva-v4l2.c @@ -40,7 +40,7 @@ #define fh_to_ctx(f) (container_of(f, struct hva_ctx, fh)) /* registry of available encoders */ -const struct hva_enc *hva_encoders[] = { +static const struct hva_enc *hva_encoders[] = { &nv12h264enc, &nv21h264enc, }; @@ -1398,7 +1398,7 @@ static const struct of_device_id hva_match_types[] = { MODULE_DEVICE_TABLE(of, hva_match_types); -struct platform_driver hva_driver = { +static struct platform_driver hva_driver = { .probe = hva_probe, .remove = hva_remove, .driver = { From f429b56a7f8037ce58cf258b3bce182e376438c7 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 1 Aug 2016 04:54:24 -0300 Subject: [PATCH 467/591] [media] soc-camera/rcar-vin: remove obsolete driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This driver has been replaced by the non-soc-camera rcar-vin driver. The soc-camera framework is being deprecated, so drop this older rcar-vin driver in favor of the newer version that does not rely on this deprecated framework. Signed-off-by: Hans Verkuil Cc: Guennadi Liakhovetski Cc: Niklas Söderlund Acked-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/soc_camera/Kconfig | 10 - drivers/media/platform/soc_camera/Makefile | 1 - drivers/media/platform/soc_camera/rcar_vin.c | 1968 ------------------ 3 files changed, 1979 deletions(-) delete mode 100644 drivers/media/platform/soc_camera/rcar_vin.c diff --git a/drivers/media/platform/soc_camera/Kconfig b/drivers/media/platform/soc_camera/Kconfig index 8b046dc49392..86d74788544f 100644 --- a/drivers/media/platform/soc_camera/Kconfig +++ b/drivers/media/platform/soc_camera/Kconfig @@ -17,16 +17,6 @@ config SOC_CAMERA_PLATFORM help This is a generic SoC camera platform driver, useful for testing -config VIDEO_RCAR_VIN_OLD - tristate "R-Car Video Input (VIN) support (DEPRECATED)" - depends on VIDEO_DEV && SOC_CAMERA - depends on ARCH_RENESAS || COMPILE_TEST - depends on HAS_DMA - select VIDEOBUF2_DMA_CONTIG - select SOC_CAMERA_SCALE_CROP - ---help--- - This is a v4l2 driver for the R-Car VIN Interface - config VIDEO_SH_MOBILE_CEU tristate "SuperH Mobile CEU Interface driver" depends on VIDEO_DEV && SOC_CAMERA && HAS_DMA && HAVE_CLK diff --git a/drivers/media/platform/soc_camera/Makefile b/drivers/media/platform/soc_camera/Makefile index e189870a333d..7633a0f2f66f 100644 --- a/drivers/media/platform/soc_camera/Makefile +++ b/drivers/media/platform/soc_camera/Makefile @@ -8,4 +8,3 @@ obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o # soc-camera host drivers have to be linked after camera drivers obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o -obj-$(CONFIG_VIDEO_RCAR_VIN_OLD) += rcar_vin.o diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c deleted file mode 100644 index 077f12d1575f..000000000000 --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ /dev/null @@ -1,1968 +0,0 @@ -/* - * SoC-camera host driver for Renesas R-Car VIN unit - * - * Copyright (C) 2011-2013 Renesas Solutions Corp. - * Copyright (C) 2013 Cogent Embedded, Inc., - * - * Based on V4L2 Driver for SuperH Mobile CEU interface "sh_mobile_ceu_camera.c" - * - * Copyright (C) 2008 Magnus Damm - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "soc_scale_crop.h" - -#define DRV_NAME "rcar_vin" - -/* Register offsets for R-Car VIN */ -#define VNMC_REG 0x00 /* Video n Main Control Register */ -#define VNMS_REG 0x04 /* Video n Module Status Register */ -#define VNFC_REG 0x08 /* Video n Frame Capture Register */ -#define VNSLPRC_REG 0x0C /* Video n Start Line Pre-Clip Register */ -#define VNELPRC_REG 0x10 /* Video n End Line Pre-Clip Register */ -#define VNSPPRC_REG 0x14 /* Video n Start Pixel Pre-Clip Register */ -#define VNEPPRC_REG 0x18 /* Video n End Pixel Pre-Clip Register */ -#define VNSLPOC_REG 0x1C /* Video n Start Line Post-Clip Register */ -#define VNELPOC_REG 0x20 /* Video n End Line Post-Clip Register */ -#define VNSPPOC_REG 0x24 /* Video n Start Pixel Post-Clip Register */ -#define VNEPPOC_REG 0x28 /* Video n End Pixel Post-Clip Register */ -#define VNIS_REG 0x2C /* Video n Image Stride Register */ -#define VNMB_REG(m) (0x30 + ((m) << 2)) /* Video n Memory Base m Register */ -#define VNIE_REG 0x40 /* Video n Interrupt Enable Register */ -#define VNINTS_REG 0x44 /* Video n Interrupt Status Register */ -#define VNSI_REG 0x48 /* Video n Scanline Interrupt Register */ -#define VNMTC_REG 0x4C /* Video n Memory Transfer Control Register */ -#define VNYS_REG 0x50 /* Video n Y Scale Register */ -#define VNXS_REG 0x54 /* Video n X Scale Register */ -#define VNDMR_REG 0x58 /* Video n Data Mode Register */ -#define VNDMR2_REG 0x5C /* Video n Data Mode Register 2 */ -#define VNUVAOF_REG 0x60 /* Video n UV Address Offset Register */ -#define VNC1A_REG 0x80 /* Video n Coefficient Set C1A Register */ -#define VNC1B_REG 0x84 /* Video n Coefficient Set C1B Register */ -#define VNC1C_REG 0x88 /* Video n Coefficient Set C1C Register */ -#define VNC2A_REG 0x90 /* Video n Coefficient Set C2A Register */ -#define VNC2B_REG 0x94 /* Video n Coefficient Set C2B Register */ -#define VNC2C_REG 0x98 /* Video n Coefficient Set C2C Register */ -#define VNC3A_REG 0xA0 /* Video n Coefficient Set C3A Register */ -#define VNC3B_REG 0xA4 /* Video n Coefficient Set C3B Register */ -#define VNC3C_REG 0xA8 /* Video n Coefficient Set C3C Register */ -#define VNC4A_REG 0xB0 /* Video n Coefficient Set C4A Register */ -#define VNC4B_REG 0xB4 /* Video n Coefficient Set C4B Register */ -#define VNC4C_REG 0xB8 /* Video n Coefficient Set C4C Register */ -#define VNC5A_REG 0xC0 /* Video n Coefficient Set C5A Register */ -#define VNC5B_REG 0xC4 /* Video n Coefficient Set C5B Register */ -#define VNC5C_REG 0xC8 /* Video n Coefficient Set C5C Register */ -#define VNC6A_REG 0xD0 /* Video n Coefficient Set C6A Register */ -#define VNC6B_REG 0xD4 /* Video n Coefficient Set C6B Register */ -#define VNC6C_REG 0xD8 /* Video n Coefficient Set C6C Register */ -#define VNC7A_REG 0xE0 /* Video n Coefficient Set C7A Register */ -#define VNC7B_REG 0xE4 /* Video n Coefficient Set C7B Register */ -#define VNC7C_REG 0xE8 /* Video n Coefficient Set C7C Register */ -#define VNC8A_REG 0xF0 /* Video n Coefficient Set C8A Register */ -#define VNC8B_REG 0xF4 /* Video n Coefficient Set C8B Register */ -#define VNC8C_REG 0xF8 /* Video n Coefficient Set C8C Register */ - -/* Register bit fields for R-Car VIN */ -/* Video n Main Control Register bits */ -#define VNMC_FOC (1 << 21) -#define VNMC_YCAL (1 << 19) -#define VNMC_INF_YUV8_BT656 (0 << 16) -#define VNMC_INF_YUV8_BT601 (1 << 16) -#define VNMC_INF_YUV10_BT656 (2 << 16) -#define VNMC_INF_YUV10_BT601 (3 << 16) -#define VNMC_INF_YUV16 (5 << 16) -#define VNMC_INF_RGB888 (6 << 16) -#define VNMC_VUP (1 << 10) -#define VNMC_IM_ODD (0 << 3) -#define VNMC_IM_ODD_EVEN (1 << 3) -#define VNMC_IM_EVEN (2 << 3) -#define VNMC_IM_FULL (3 << 3) -#define VNMC_BPS (1 << 1) -#define VNMC_ME (1 << 0) - -/* Video n Module Status Register bits */ -#define VNMS_FBS_MASK (3 << 3) -#define VNMS_FBS_SHIFT 3 -#define VNMS_AV (1 << 1) -#define VNMS_CA (1 << 0) - -/* Video n Frame Capture Register bits */ -#define VNFC_C_FRAME (1 << 1) -#define VNFC_S_FRAME (1 << 0) - -/* Video n Interrupt Enable Register bits */ -#define VNIE_FIE (1 << 4) -#define VNIE_EFE (1 << 1) - -/* Video n Data Mode Register bits */ -#define VNDMR_EXRGB (1 << 8) -#define VNDMR_BPSM (1 << 4) -#define VNDMR_DTMD_YCSEP (1 << 1) -#define VNDMR_DTMD_ARGB (1 << 0) - -/* Video n Data Mode Register 2 bits */ -#define VNDMR2_VPS (1 << 30) -#define VNDMR2_HPS (1 << 29) -#define VNDMR2_FTEV (1 << 17) -#define VNDMR2_VLV(n) ((n & 0xf) << 12) - -#define VIN_MAX_WIDTH 2048 -#define VIN_MAX_HEIGHT 2048 - -#define TIMEOUT_MS 100 - -#define RCAR_VIN_HSYNC_ACTIVE_LOW (1 << 0) -#define RCAR_VIN_VSYNC_ACTIVE_LOW (1 << 1) -#define RCAR_VIN_BT601 (1 << 2) -#define RCAR_VIN_BT656 (1 << 3) - -enum chip_id { - RCAR_GEN3, - RCAR_GEN2, - RCAR_H1, - RCAR_M1, - RCAR_E1, -}; - -struct vin_coeff { - unsigned short xs_value; - u32 coeff_set[24]; -}; - -static const struct vin_coeff vin_coeff_set[] = { - { 0x0000, { - 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000 }, - }, - { 0x1000, { - 0x000fa400, 0x000fa400, 0x09625902, - 0x000003f8, 0x00000403, 0x3de0d9f0, - 0x001fffed, 0x00000804, 0x3cc1f9c3, - 0x001003de, 0x00000c01, 0x3cb34d7f, - 0x002003d2, 0x00000c00, 0x3d24a92d, - 0x00200bca, 0x00000bff, 0x3df600d2, - 0x002013cc, 0x000007ff, 0x3ed70c7e, - 0x00100fde, 0x00000000, 0x3f87c036 }, - }, - { 0x1200, { - 0x002ffff1, 0x002ffff1, 0x02a0a9c8, - 0x002003e7, 0x001ffffa, 0x000185bc, - 0x002007dc, 0x000003ff, 0x3e52859c, - 0x00200bd4, 0x00000002, 0x3d53996b, - 0x00100fd0, 0x00000403, 0x3d04ad2d, - 0x00000bd5, 0x00000403, 0x3d35ace7, - 0x3ff003e4, 0x00000801, 0x3dc674a1, - 0x3fffe800, 0x00000800, 0x3e76f461 }, - }, - { 0x1400, { - 0x00100be3, 0x00100be3, 0x04d1359a, - 0x00000fdb, 0x002003ed, 0x0211fd93, - 0x00000fd6, 0x002003f4, 0x0002d97b, - 0x000007d6, 0x002ffffb, 0x3e93b956, - 0x3ff003da, 0x001003ff, 0x3db49926, - 0x3fffefe9, 0x00100001, 0x3d655cee, - 0x3fffd400, 0x00000003, 0x3d65f4b6, - 0x000fb421, 0x00000402, 0x3dc6547e }, - }, - { 0x1600, { - 0x00000bdd, 0x00000bdd, 0x06519578, - 0x3ff007da, 0x00000be3, 0x03c24973, - 0x3ff003d9, 0x00000be9, 0x01b30d5f, - 0x3ffff7df, 0x001003f1, 0x0003c542, - 0x000fdfec, 0x001003f7, 0x3ec4711d, - 0x000fc400, 0x002ffffd, 0x3df504f1, - 0x001fa81a, 0x002ffc00, 0x3d957cc2, - 0x002f8c3c, 0x00100000, 0x3db5c891 }, - }, - { 0x1800, { - 0x3ff003dc, 0x3ff003dc, 0x0791e558, - 0x000ff7dd, 0x3ff007de, 0x05328554, - 0x000fe7e3, 0x3ff00be2, 0x03232546, - 0x000fd7ee, 0x000007e9, 0x0143bd30, - 0x001fb800, 0x000007ee, 0x00044511, - 0x002fa015, 0x000007f4, 0x3ef4bcee, - 0x002f8832, 0x001003f9, 0x3e4514c7, - 0x001f7853, 0x001003fd, 0x3de54c9f }, - }, - { 0x1a00, { - 0x000fefe0, 0x000fefe0, 0x08721d3c, - 0x001fdbe7, 0x000ffbde, 0x0652a139, - 0x001fcbf0, 0x000003df, 0x0463292e, - 0x002fb3ff, 0x3ff007e3, 0x0293a91d, - 0x002f9c12, 0x3ff00be7, 0x01241905, - 0x001f8c29, 0x000007ed, 0x3fe470eb, - 0x000f7c46, 0x000007f2, 0x3f04b8ca, - 0x3fef7865, 0x000007f6, 0x3e74e4a8 }, - }, - { 0x1c00, { - 0x001fd3e9, 0x001fd3e9, 0x08f23d26, - 0x002fbff3, 0x001fe3e4, 0x0712ad23, - 0x002fa800, 0x000ff3e0, 0x05631d1b, - 0x001f9810, 0x000ffbe1, 0x03b3890d, - 0x000f8c23, 0x000003e3, 0x0233e8fa, - 0x3fef843b, 0x000003e7, 0x00f430e4, - 0x3fbf8456, 0x3ff00bea, 0x00046cc8, - 0x3f8f8c72, 0x3ff00bef, 0x3f3490ac }, - }, - { 0x1e00, { - 0x001fbbf4, 0x001fbbf4, 0x09425112, - 0x001fa800, 0x002fc7ed, 0x0792b110, - 0x000f980e, 0x001fdbe6, 0x0613110a, - 0x3fff8c20, 0x001fe7e3, 0x04a368fd, - 0x3fcf8c33, 0x000ff7e2, 0x0343b8ed, - 0x3f9f8c4a, 0x000fffe3, 0x0203f8da, - 0x3f5f9c61, 0x000003e6, 0x00e428c5, - 0x3f1fb07b, 0x000003eb, 0x3fe440af }, - }, - { 0x2000, { - 0x000fa400, 0x000fa400, 0x09625902, - 0x3fff980c, 0x001fb7f5, 0x0812b0ff, - 0x3fdf901c, 0x001fc7ed, 0x06b2fcfa, - 0x3faf902d, 0x001fd3e8, 0x055348f1, - 0x3f7f983f, 0x001fe3e5, 0x04038ce3, - 0x3f3fa454, 0x001fefe3, 0x02e3c8d1, - 0x3f0fb86a, 0x001ff7e4, 0x01c3e8c0, - 0x3ecfd880, 0x000fffe6, 0x00c404ac }, - }, - { 0x2200, { - 0x3fdf9c0b, 0x3fdf9c0b, 0x09725cf4, - 0x3fbf9818, 0x3fffa400, 0x0842a8f1, - 0x3f8f9827, 0x000fb3f7, 0x0702f0ec, - 0x3f5fa037, 0x000fc3ef, 0x05d330e4, - 0x3f2fac49, 0x001fcfea, 0x04a364d9, - 0x3effc05c, 0x001fdbe7, 0x038394ca, - 0x3ecfdc6f, 0x001fe7e6, 0x0273b0bb, - 0x3ea00083, 0x001fefe6, 0x0183c0a9 }, - }, - { 0x2400, { - 0x3f9fa014, 0x3f9fa014, 0x098260e6, - 0x3f7f9c23, 0x3fcf9c0a, 0x08629ce5, - 0x3f4fa431, 0x3fefa400, 0x0742d8e1, - 0x3f1fb440, 0x3fffb3f8, 0x062310d9, - 0x3eefc850, 0x000fbbf2, 0x050340d0, - 0x3ecfe062, 0x000fcbec, 0x041364c2, - 0x3ea00073, 0x001fd3ea, 0x03037cb5, - 0x3e902086, 0x001fdfe8, 0x022388a5 }, - }, - { 0x2600, { - 0x3f5fa81e, 0x3f5fa81e, 0x096258da, - 0x3f3fac2b, 0x3f8fa412, 0x088290d8, - 0x3f0fbc38, 0x3fafa408, 0x0772c8d5, - 0x3eefcc47, 0x3fcfa800, 0x0672f4ce, - 0x3ecfe456, 0x3fefaffa, 0x05531cc6, - 0x3eb00066, 0x3fffbbf3, 0x047334bb, - 0x3ea01c77, 0x000fc7ee, 0x039348ae, - 0x3ea04486, 0x000fd3eb, 0x02b350a1 }, - }, - { 0x2800, { - 0x3f2fb426, 0x3f2fb426, 0x094250ce, - 0x3f0fc032, 0x3f4fac1b, 0x086284cd, - 0x3eefd040, 0x3f7fa811, 0x0782acc9, - 0x3ecfe84c, 0x3f9fa807, 0x06a2d8c4, - 0x3eb0005b, 0x3fbfac00, 0x05b2f4bc, - 0x3eb0186a, 0x3fdfb3fa, 0x04c308b4, - 0x3eb04077, 0x3fefbbf4, 0x03f31ca8, - 0x3ec06884, 0x000fbff2, 0x03031c9e }, - }, - { 0x2a00, { - 0x3f0fc42d, 0x3f0fc42d, 0x090240c4, - 0x3eefd439, 0x3f2fb822, 0x08526cc2, - 0x3edfe845, 0x3f4fb018, 0x078294bf, - 0x3ec00051, 0x3f6fac0f, 0x06b2b4bb, - 0x3ec0185f, 0x3f8fac07, 0x05e2ccb4, - 0x3ec0386b, 0x3fafac00, 0x0502e8ac, - 0x3ed05c77, 0x3fcfb3fb, 0x0432f0a3, - 0x3ef08482, 0x3fdfbbf6, 0x0372f898 }, - }, - { 0x2c00, { - 0x3eefdc31, 0x3eefdc31, 0x08e238b8, - 0x3edfec3d, 0x3f0fc828, 0x082258b9, - 0x3ed00049, 0x3f1fc01e, 0x077278b6, - 0x3ed01455, 0x3f3fb815, 0x06c294b2, - 0x3ed03460, 0x3f5fb40d, 0x0602acac, - 0x3ef0506c, 0x3f7fb006, 0x0542c0a4, - 0x3f107476, 0x3f9fb400, 0x0472c89d, - 0x3f309c80, 0x3fbfb7fc, 0x03b2cc94 }, - }, - { 0x2e00, { - 0x3eefec37, 0x3eefec37, 0x088220b0, - 0x3ee00041, 0x3effdc2d, 0x07f244ae, - 0x3ee0144c, 0x3f0fd023, 0x07625cad, - 0x3ef02c57, 0x3f1fc81a, 0x06c274a9, - 0x3f004861, 0x3f3fbc13, 0x060288a6, - 0x3f20686b, 0x3f5fb80c, 0x05529c9e, - 0x3f408c74, 0x3f6fb805, 0x04b2ac96, - 0x3f80ac7e, 0x3f8fb800, 0x0402ac8e }, - }, - { 0x3000, { - 0x3ef0003a, 0x3ef0003a, 0x084210a6, - 0x3ef01045, 0x3effec32, 0x07b228a7, - 0x3f00284e, 0x3f0fdc29, 0x073244a4, - 0x3f104058, 0x3f0fd420, 0x06a258a2, - 0x3f305c62, 0x3f2fc818, 0x0612689d, - 0x3f508069, 0x3f3fc011, 0x05728496, - 0x3f80a072, 0x3f4fc00a, 0x04d28c90, - 0x3fc0c07b, 0x3f6fbc04, 0x04429088 }, - }, - { 0x3200, { - 0x3f00103e, 0x3f00103e, 0x07f1fc9e, - 0x3f102447, 0x3f000035, 0x0782149d, - 0x3f203c4f, 0x3f0ff02c, 0x07122c9c, - 0x3f405458, 0x3f0fe424, 0x06924099, - 0x3f607061, 0x3f1fd41d, 0x06024c97, - 0x3f909068, 0x3f2fcc16, 0x05726490, - 0x3fc0b070, 0x3f3fc80f, 0x04f26c8a, - 0x0000d077, 0x3f4fc409, 0x04627484 }, - }, - { 0x3400, { - 0x3f202040, 0x3f202040, 0x07a1e898, - 0x3f303449, 0x3f100c38, 0x0741fc98, - 0x3f504c50, 0x3f10002f, 0x06e21495, - 0x3f706459, 0x3f1ff028, 0x06722492, - 0x3fa08060, 0x3f1fe421, 0x05f2348f, - 0x3fd09c67, 0x3f1fdc19, 0x05824c89, - 0x0000bc6e, 0x3f2fd014, 0x04f25086, - 0x0040dc74, 0x3f3fcc0d, 0x04825c7f }, - }, - { 0x3600, { - 0x3f403042, 0x3f403042, 0x0761d890, - 0x3f504848, 0x3f301c3b, 0x0701f090, - 0x3f805c50, 0x3f200c33, 0x06a2008f, - 0x3fa07458, 0x3f10002b, 0x06520c8d, - 0x3fd0905e, 0x3f1ff424, 0x05e22089, - 0x0000ac65, 0x3f1fe81d, 0x05823483, - 0x0030cc6a, 0x3f2fdc18, 0x04f23c81, - 0x0080e871, 0x3f2fd412, 0x0482407c }, - }, - { 0x3800, { - 0x3f604043, 0x3f604043, 0x0721c88a, - 0x3f80544a, 0x3f502c3c, 0x06d1d88a, - 0x3fb06851, 0x3f301c35, 0x0681e889, - 0x3fd08456, 0x3f30082f, 0x0611fc88, - 0x00009c5d, 0x3f200027, 0x05d20884, - 0x0030b863, 0x3f2ff421, 0x05621880, - 0x0070d468, 0x3f2fe81b, 0x0502247c, - 0x00c0ec6f, 0x3f2fe015, 0x04a22877 }, - }, - { 0x3a00, { - 0x3f904c44, 0x3f904c44, 0x06e1b884, - 0x3fb0604a, 0x3f70383e, 0x0691c885, - 0x3fe07451, 0x3f502c36, 0x0661d483, - 0x00009055, 0x3f401831, 0x0601ec81, - 0x0030a85b, 0x3f300c2a, 0x05b1f480, - 0x0070c061, 0x3f300024, 0x0562047a, - 0x00b0d867, 0x3f3ff41e, 0x05020c77, - 0x00f0f46b, 0x3f2fec19, 0x04a21474 }, - }, - { 0x3c00, { - 0x3fb05c43, 0x3fb05c43, 0x06c1b07e, - 0x3fe06c4b, 0x3f902c3f, 0x0681c081, - 0x0000844f, 0x3f703838, 0x0631cc7d, - 0x00309855, 0x3f602433, 0x05d1d47e, - 0x0060b459, 0x3f50142e, 0x0581e47b, - 0x00a0c85f, 0x3f400828, 0x0531f078, - 0x00e0e064, 0x3f300021, 0x0501fc73, - 0x00b0fc6a, 0x3f3ff41d, 0x04a20873 }, - }, - { 0x3e00, { - 0x3fe06444, 0x3fe06444, 0x0681a07a, - 0x00007849, 0x3fc0503f, 0x0641b07a, - 0x0020904d, 0x3fa0403a, 0x05f1c07a, - 0x0060a453, 0x3f803034, 0x05c1c878, - 0x0090b858, 0x3f70202f, 0x0571d477, - 0x00d0d05d, 0x3f501829, 0x0531e073, - 0x0110e462, 0x3f500825, 0x04e1e471, - 0x01510065, 0x3f40001f, 0x04a1f06d }, - }, - { 0x4000, { - 0x00007044, 0x00007044, 0x06519476, - 0x00208448, 0x3fe05c3f, 0x0621a476, - 0x0050984d, 0x3fc04c3a, 0x05e1b075, - 0x0080ac52, 0x3fa03c35, 0x05a1b875, - 0x00c0c056, 0x3f803030, 0x0561c473, - 0x0100d45b, 0x3f70202b, 0x0521d46f, - 0x0140e860, 0x3f601427, 0x04d1d46e, - 0x01810064, 0x3f500822, 0x0491dc6b }, - }, - { 0x5000, { - 0x0110a442, 0x0110a442, 0x0551545e, - 0x0140b045, 0x00e0983f, 0x0531585f, - 0x0160c047, 0x00c08c3c, 0x0511645e, - 0x0190cc4a, 0x00908039, 0x04f1685f, - 0x01c0dc4c, 0x00707436, 0x04d1705e, - 0x0200e850, 0x00506833, 0x04b1785b, - 0x0230f453, 0x00305c30, 0x0491805a, - 0x02710056, 0x0010542d, 0x04718059 }, - }, - { 0x6000, { - 0x01c0bc40, 0x01c0bc40, 0x04c13052, - 0x01e0c841, 0x01a0b43d, 0x04c13851, - 0x0210cc44, 0x0180a83c, 0x04a13453, - 0x0230d845, 0x0160a03a, 0x04913c52, - 0x0260e047, 0x01409838, 0x04714052, - 0x0280ec49, 0x01208c37, 0x04514c50, - 0x02b0f44b, 0x01008435, 0x04414c50, - 0x02d1004c, 0x00e07c33, 0x0431544f }, - }, - { 0x7000, { - 0x0230c83e, 0x0230c83e, 0x04711c4c, - 0x0250d03f, 0x0210c43c, 0x0471204b, - 0x0270d840, 0x0200b83c, 0x0451244b, - 0x0290dc42, 0x01e0b43a, 0x0441244c, - 0x02b0e443, 0x01c0b038, 0x0441284b, - 0x02d0ec44, 0x01b0a438, 0x0421304a, - 0x02f0f445, 0x0190a036, 0x04213449, - 0x0310f847, 0x01709c34, 0x04213848 }, - }, - { 0x8000, { - 0x0280d03d, 0x0280d03d, 0x04310c48, - 0x02a0d43e, 0x0270c83c, 0x04311047, - 0x02b0dc3e, 0x0250c83a, 0x04311447, - 0x02d0e040, 0x0240c03a, 0x04211446, - 0x02e0e840, 0x0220bc39, 0x04111847, - 0x0300e842, 0x0210b438, 0x04012445, - 0x0310f043, 0x0200b037, 0x04012045, - 0x0330f444, 0x01e0ac36, 0x03f12445 }, - }, - { 0xefff, { - 0x0340dc3a, 0x0340dc3a, 0x03b0ec40, - 0x0340e03a, 0x0330e039, 0x03c0f03e, - 0x0350e03b, 0x0330dc39, 0x03c0ec3e, - 0x0350e43a, 0x0320dc38, 0x03c0f43e, - 0x0360e43b, 0x0320d839, 0x03b0f03e, - 0x0360e83b, 0x0310d838, 0x03c0fc3b, - 0x0370e83b, 0x0310d439, 0x03a0f83d, - 0x0370e83c, 0x0300d438, 0x03b0fc3c }, - } -}; - -enum rcar_vin_state { - STOPPED = 0, - RUNNING, - STOPPING, -}; - -struct rcar_vin_priv { - void __iomem *base; - spinlock_t lock; - int sequence; - /* State of the VIN module in capturing mode */ - enum rcar_vin_state state; - struct soc_camera_host ici; - struct list_head capture; -#define MAX_BUFFER_NUM 3 - struct vb2_v4l2_buffer *queue_buf[MAX_BUFFER_NUM]; - enum v4l2_field field; - unsigned int pdata_flags; - unsigned int vb_count; - unsigned int nr_hw_slots; - bool request_to_stop; - struct completion capture_stop; - enum chip_id chip; -}; - -#define is_continuous_transfer(priv) (priv->vb_count > MAX_BUFFER_NUM) - -struct rcar_vin_buffer { - struct vb2_v4l2_buffer vb; - struct list_head list; -}; - -#define to_buf_list(vb2_buffer) (&container_of(vb2_buffer, \ - struct rcar_vin_buffer, \ - vb)->list) - -struct rcar_vin_cam { - /* VIN offsets within the camera output, before the VIN scaler */ - unsigned int vin_left; - unsigned int vin_top; - /* Client output, as seen by the VIN */ - unsigned int width; - unsigned int height; - /* User window from S_FMT */ - unsigned int out_width; - unsigned int out_height; - /* - * User window from S_SELECTION / G_SELECTION, produced by client cropping and - * scaling, VIN scaling and VIN cropping, mapped back onto the client - * input window - */ - struct v4l2_rect subrect; - /* Camera cropping rectangle */ - struct v4l2_rect rect; - const struct soc_mbus_pixelfmt *extra_fmt; -}; - -/* - * .queue_setup() is called to check whether the driver can accept the requested - * number of buffers and to fill in plane sizes for the current frame format if - * required - */ -static int rcar_vin_videobuf_setup(struct vb2_queue *vq, - unsigned int *count, - unsigned int *num_planes, - unsigned int sizes[], struct device *alloc_devs[]) -{ - struct soc_camera_device *icd = soc_camera_from_vb2q(vq); - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_priv *priv = ici->priv; - - if (!vq->num_buffers) - priv->sequence = 0; - - if (!*count) - *count = 2; - priv->vb_count = *count; - - /* Number of hardware slots */ - if (is_continuous_transfer(priv)) - priv->nr_hw_slots = MAX_BUFFER_NUM; - else - priv->nr_hw_slots = 1; - - if (*num_planes) - return sizes[0] < icd->sizeimage ? -EINVAL : 0; - - sizes[0] = icd->sizeimage; - *num_planes = 1; - - dev_dbg(icd->parent, "count=%d, size=%u\n", *count, sizes[0]); - - return 0; -} - -static int rcar_vin_setup(struct rcar_vin_priv *priv) -{ - struct soc_camera_device *icd = priv->ici.icd; - struct rcar_vin_cam *cam = icd->host_priv; - u32 vnmc, dmr, interrupts; - bool progressive = false, output_is_yuv = false, input_is_yuv = false; - - switch (priv->field) { - case V4L2_FIELD_TOP: - vnmc = VNMC_IM_ODD; - break; - case V4L2_FIELD_BOTTOM: - vnmc = VNMC_IM_EVEN; - break; - case V4L2_FIELD_INTERLACED: - case V4L2_FIELD_INTERLACED_TB: - vnmc = VNMC_IM_FULL; - break; - case V4L2_FIELD_INTERLACED_BT: - vnmc = VNMC_IM_FULL | VNMC_FOC; - break; - case V4L2_FIELD_NONE: - if (is_continuous_transfer(priv)) { - vnmc = VNMC_IM_ODD_EVEN; - progressive = true; - } else { - vnmc = VNMC_IM_ODD; - } - break; - default: - vnmc = VNMC_IM_ODD; - break; - } - - /* input interface */ - switch (icd->current_fmt->code) { - case MEDIA_BUS_FMT_YUYV8_1X16: - /* BT.601/BT.1358 16bit YCbCr422 */ - vnmc |= VNMC_INF_YUV16; - input_is_yuv = true; - break; - case MEDIA_BUS_FMT_YUYV8_2X8: - /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */ - vnmc |= priv->pdata_flags & RCAR_VIN_BT656 ? - VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601; - input_is_yuv = true; - break; - case MEDIA_BUS_FMT_RGB888_1X24: - vnmc |= VNMC_INF_RGB888; - break; - case MEDIA_BUS_FMT_YUYV10_2X10: - /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */ - vnmc |= priv->pdata_flags & RCAR_VIN_BT656 ? - VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601; - input_is_yuv = true; - break; - default: - break; - } - - /* output format */ - switch (icd->current_fmt->host_fmt->fourcc) { - case V4L2_PIX_FMT_NV16: - iowrite32(ALIGN(cam->width * cam->height, 0x80), - priv->base + VNUVAOF_REG); - dmr = VNDMR_DTMD_YCSEP; - output_is_yuv = true; - break; - case V4L2_PIX_FMT_YUYV: - dmr = VNDMR_BPSM; - output_is_yuv = true; - break; - case V4L2_PIX_FMT_UYVY: - dmr = 0; - output_is_yuv = true; - break; - case V4L2_PIX_FMT_RGB555X: - dmr = VNDMR_DTMD_ARGB; - break; - case V4L2_PIX_FMT_RGB565: - dmr = 0; - break; - case V4L2_PIX_FMT_RGB32: - if (priv->chip != RCAR_GEN2 && priv->chip != RCAR_H1 && - priv->chip != RCAR_E1) - goto e_format; - - dmr = VNDMR_EXRGB; - break; - case V4L2_PIX_FMT_ARGB32: - if (priv->chip != RCAR_GEN3) - goto e_format; - - dmr = VNDMR_EXRGB | VNDMR_DTMD_ARGB; - break; - default: - goto e_format; - } - - /* Always update on field change */ - vnmc |= VNMC_VUP; - - /* If input and output use the same colorspace, use bypass mode */ - if (input_is_yuv == output_is_yuv) - vnmc |= VNMC_BPS; - - /* progressive or interlaced mode */ - interrupts = progressive ? VNIE_FIE : VNIE_EFE; - - /* ack interrupts */ - iowrite32(interrupts, priv->base + VNINTS_REG); - /* enable interrupts */ - iowrite32(interrupts, priv->base + VNIE_REG); - /* start capturing */ - iowrite32(dmr, priv->base + VNDMR_REG); - iowrite32(vnmc | VNMC_ME, priv->base + VNMC_REG); - - return 0; - -e_format: - dev_warn(icd->parent, "Invalid fourcc format (0x%x)\n", - icd->current_fmt->host_fmt->fourcc); - return -EINVAL; -} - -static void rcar_vin_capture(struct rcar_vin_priv *priv) -{ - if (is_continuous_transfer(priv)) - /* Continuous Frame Capture Mode */ - iowrite32(VNFC_C_FRAME, priv->base + VNFC_REG); - else - /* Single Frame Capture Mode */ - iowrite32(VNFC_S_FRAME, priv->base + VNFC_REG); -} - -static void rcar_vin_request_capture_stop(struct rcar_vin_priv *priv) -{ - priv->state = STOPPING; - - /* set continuous & single transfer off */ - iowrite32(0, priv->base + VNFC_REG); - /* disable capture (release DMA buffer), reset */ - iowrite32(ioread32(priv->base + VNMC_REG) & ~VNMC_ME, - priv->base + VNMC_REG); - - /* update the status if stopped already */ - if (!(ioread32(priv->base + VNMS_REG) & VNMS_CA)) - priv->state = STOPPED; -} - -static int rcar_vin_get_free_hw_slot(struct rcar_vin_priv *priv) -{ - int slot; - - for (slot = 0; slot < priv->nr_hw_slots; slot++) - if (priv->queue_buf[slot] == NULL) - return slot; - - return -1; -} - -static int rcar_vin_hw_ready(struct rcar_vin_priv *priv) -{ - /* Ensure all HW slots are filled */ - return rcar_vin_get_free_hw_slot(priv) < 0 ? 1 : 0; -} - -/* Moves a buffer from the queue to the HW slots */ -static int rcar_vin_fill_hw_slot(struct rcar_vin_priv *priv) -{ - struct vb2_v4l2_buffer *vbuf; - dma_addr_t phys_addr_top; - int slot; - - if (list_empty(&priv->capture)) - return 0; - - /* Find a free HW slot */ - slot = rcar_vin_get_free_hw_slot(priv); - if (slot < 0) - return 0; - - vbuf = &list_entry(priv->capture.next, - struct rcar_vin_buffer, list)->vb; - list_del_init(to_buf_list(vbuf)); - priv->queue_buf[slot] = vbuf; - phys_addr_top = vb2_dma_contig_plane_dma_addr(&vbuf->vb2_buf, 0); - iowrite32(phys_addr_top, priv->base + VNMB_REG(slot)); - - return 1; -} - -static void rcar_vin_videobuf_queue(struct vb2_buffer *vb) -{ - struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); - struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_priv *priv = ici->priv; - unsigned long size; - - size = icd->sizeimage; - - if (vb2_plane_size(vb, 0) < size) { - dev_err(icd->parent, "Buffer #%d too small (%lu < %lu)\n", - vb->index, vb2_plane_size(vb, 0), size); - goto error; - } - - vb2_set_plane_payload(vb, 0, size); - - dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu\n", __func__, - vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); - - spin_lock_irq(&priv->lock); - - list_add_tail(to_buf_list(vbuf), &priv->capture); - rcar_vin_fill_hw_slot(priv); - - /* If we weren't running, and have enough buffers, start capturing! */ - if (priv->state != RUNNING && rcar_vin_hw_ready(priv)) { - if (rcar_vin_setup(priv)) { - /* Submit error */ - list_del_init(to_buf_list(vbuf)); - spin_unlock_irq(&priv->lock); - goto error; - } - priv->request_to_stop = false; - init_completion(&priv->capture_stop); - priv->state = RUNNING; - rcar_vin_capture(priv); - } - - spin_unlock_irq(&priv->lock); - - return; - -error: - vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); -} - -/* - * Wait for capture to stop and all in-flight buffers to be finished with by - * the video hardware. This must be called under &priv->lock - * - */ -static void rcar_vin_wait_stop_streaming(struct rcar_vin_priv *priv) -{ - while (priv->state != STOPPED) { - /* issue stop if running */ - if (priv->state == RUNNING) - rcar_vin_request_capture_stop(priv); - - /* wait until capturing has been stopped */ - if (priv->state == STOPPING) { - priv->request_to_stop = true; - spin_unlock_irq(&priv->lock); - if (!wait_for_completion_timeout( - &priv->capture_stop, - msecs_to_jiffies(TIMEOUT_MS))) - priv->state = STOPPED; - spin_lock_irq(&priv->lock); - } - } -} - -static void rcar_vin_stop_streaming(struct vb2_queue *vq) -{ - struct soc_camera_device *icd = soc_camera_from_vb2q(vq); - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_priv *priv = ici->priv; - struct list_head *buf_head, *tmp; - int i; - - spin_lock_irq(&priv->lock); - rcar_vin_wait_stop_streaming(priv); - - for (i = 0; i < MAX_BUFFER_NUM; i++) { - if (priv->queue_buf[i]) { - vb2_buffer_done(&priv->queue_buf[i]->vb2_buf, - VB2_BUF_STATE_ERROR); - priv->queue_buf[i] = NULL; - } - } - - list_for_each_safe(buf_head, tmp, &priv->capture) { - vb2_buffer_done(&list_entry(buf_head, - struct rcar_vin_buffer, list)->vb.vb2_buf, - VB2_BUF_STATE_ERROR); - list_del_init(buf_head); - } - spin_unlock_irq(&priv->lock); -} - -static struct vb2_ops rcar_vin_vb2_ops = { - .queue_setup = rcar_vin_videobuf_setup, - .buf_queue = rcar_vin_videobuf_queue, - .stop_streaming = rcar_vin_stop_streaming, - .wait_prepare = vb2_ops_wait_prepare, - .wait_finish = vb2_ops_wait_finish, -}; - -static irqreturn_t rcar_vin_irq(int irq, void *data) -{ - struct rcar_vin_priv *priv = data; - u32 int_status; - bool can_run = false, hw_stopped; - int slot; - unsigned int handled = 0; - - spin_lock(&priv->lock); - - int_status = ioread32(priv->base + VNINTS_REG); - if (!int_status) - goto done; - /* ack interrupts */ - iowrite32(int_status, priv->base + VNINTS_REG); - handled = 1; - - /* nothing to do if capture status is 'STOPPED' */ - if (priv->state == STOPPED) - goto done; - - hw_stopped = !(ioread32(priv->base + VNMS_REG) & VNMS_CA); - - if (!priv->request_to_stop) { - if (is_continuous_transfer(priv)) - slot = (ioread32(priv->base + VNMS_REG) & - VNMS_FBS_MASK) >> VNMS_FBS_SHIFT; - else - slot = 0; - - priv->queue_buf[slot]->field = priv->field; - priv->queue_buf[slot]->sequence = priv->sequence++; - priv->queue_buf[slot]->vb2_buf.timestamp = ktime_get_ns(); - vb2_buffer_done(&priv->queue_buf[slot]->vb2_buf, - VB2_BUF_STATE_DONE); - priv->queue_buf[slot] = NULL; - - if (priv->state != STOPPING) - can_run = rcar_vin_fill_hw_slot(priv); - - if (hw_stopped || !can_run) { - priv->state = STOPPED; - } else if (is_continuous_transfer(priv) && - list_empty(&priv->capture) && - priv->state == RUNNING) { - /* - * The continuous capturing requires an explicit stop - * operation when there is no buffer to be set into - * the VnMBm registers. - */ - rcar_vin_request_capture_stop(priv); - } else { - rcar_vin_capture(priv); - } - - } else if (hw_stopped) { - priv->state = STOPPED; - priv->request_to_stop = false; - complete(&priv->capture_stop); - } - -done: - spin_unlock(&priv->lock); - - return IRQ_RETVAL(handled); -} - -static int rcar_vin_add_device(struct soc_camera_device *icd) -{ - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_priv *priv = ici->priv; - int i; - - for (i = 0; i < MAX_BUFFER_NUM; i++) - priv->queue_buf[i] = NULL; - - pm_runtime_get_sync(ici->v4l2_dev.dev); - - dev_dbg(icd->parent, "R-Car VIN driver attached to camera %d\n", - icd->devnum); - - return 0; -} - -static void rcar_vin_remove_device(struct soc_camera_device *icd) -{ - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_priv *priv = ici->priv; - struct vb2_v4l2_buffer *vbuf; - int i; - - /* disable capture, disable interrupts */ - iowrite32(ioread32(priv->base + VNMC_REG) & ~VNMC_ME, - priv->base + VNMC_REG); - iowrite32(0, priv->base + VNIE_REG); - - priv->state = STOPPED; - priv->request_to_stop = false; - - /* make sure active buffer is cancelled */ - spin_lock_irq(&priv->lock); - for (i = 0; i < MAX_BUFFER_NUM; i++) { - vbuf = priv->queue_buf[i]; - if (vbuf) { - list_del_init(to_buf_list(vbuf)); - vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_ERROR); - } - } - spin_unlock_irq(&priv->lock); - - pm_runtime_put(ici->v4l2_dev.dev); - - dev_dbg(icd->parent, "R-Car VIN driver detached from camera %d\n", - icd->devnum); -} - -static void set_coeff(struct rcar_vin_priv *priv, unsigned short xs) -{ - int i; - const struct vin_coeff *p_prev_set = NULL; - const struct vin_coeff *p_set = NULL; - - /* Look for suitable coefficient values */ - for (i = 0; i < ARRAY_SIZE(vin_coeff_set); i++) { - p_prev_set = p_set; - p_set = &vin_coeff_set[i]; - - if (xs < p_set->xs_value) - break; - } - - /* Use previous value if its XS value is closer */ - if (p_prev_set && p_set && - xs - p_prev_set->xs_value < p_set->xs_value - xs) - p_set = p_prev_set; - - /* Set coefficient registers */ - iowrite32(p_set->coeff_set[0], priv->base + VNC1A_REG); - iowrite32(p_set->coeff_set[1], priv->base + VNC1B_REG); - iowrite32(p_set->coeff_set[2], priv->base + VNC1C_REG); - - iowrite32(p_set->coeff_set[3], priv->base + VNC2A_REG); - iowrite32(p_set->coeff_set[4], priv->base + VNC2B_REG); - iowrite32(p_set->coeff_set[5], priv->base + VNC2C_REG); - - iowrite32(p_set->coeff_set[6], priv->base + VNC3A_REG); - iowrite32(p_set->coeff_set[7], priv->base + VNC3B_REG); - iowrite32(p_set->coeff_set[8], priv->base + VNC3C_REG); - - iowrite32(p_set->coeff_set[9], priv->base + VNC4A_REG); - iowrite32(p_set->coeff_set[10], priv->base + VNC4B_REG); - iowrite32(p_set->coeff_set[11], priv->base + VNC4C_REG); - - iowrite32(p_set->coeff_set[12], priv->base + VNC5A_REG); - iowrite32(p_set->coeff_set[13], priv->base + VNC5B_REG); - iowrite32(p_set->coeff_set[14], priv->base + VNC5C_REG); - - iowrite32(p_set->coeff_set[15], priv->base + VNC6A_REG); - iowrite32(p_set->coeff_set[16], priv->base + VNC6B_REG); - iowrite32(p_set->coeff_set[17], priv->base + VNC6C_REG); - - iowrite32(p_set->coeff_set[18], priv->base + VNC7A_REG); - iowrite32(p_set->coeff_set[19], priv->base + VNC7B_REG); - iowrite32(p_set->coeff_set[20], priv->base + VNC7C_REG); - - iowrite32(p_set->coeff_set[21], priv->base + VNC8A_REG); - iowrite32(p_set->coeff_set[22], priv->base + VNC8B_REG); - iowrite32(p_set->coeff_set[23], priv->base + VNC8C_REG); -} - -/* rect is guaranteed to not exceed the scaled camera rectangle */ -static int rcar_vin_set_rect(struct soc_camera_device *icd) -{ - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_cam *cam = icd->host_priv; - struct rcar_vin_priv *priv = ici->priv; - unsigned int left_offset, top_offset; - unsigned char dsize = 0; - struct v4l2_rect *cam_subrect = &cam->subrect; - u32 value; - - dev_dbg(icd->parent, "Crop %ux%u@%u:%u\n", - icd->user_width, icd->user_height, cam->vin_left, cam->vin_top); - - left_offset = cam->vin_left; - top_offset = cam->vin_top; - - if (icd->current_fmt->host_fmt->fourcc == V4L2_PIX_FMT_RGB32 && - priv->chip == RCAR_E1) - dsize = 1; - - dev_dbg(icd->parent, "Cam %ux%u@%u:%u\n", - cam->width, cam->height, cam->vin_left, cam->vin_top); - dev_dbg(icd->parent, "Cam subrect %ux%u@%u:%u\n", - cam_subrect->width, cam_subrect->height, - cam_subrect->left, cam_subrect->top); - - /* Set Start/End Pixel/Line Pre-Clip */ - iowrite32(left_offset << dsize, priv->base + VNSPPRC_REG); - iowrite32((left_offset + cam_subrect->width - 1) << dsize, - priv->base + VNEPPRC_REG); - switch (priv->field) { - case V4L2_FIELD_INTERLACED: - case V4L2_FIELD_INTERLACED_TB: - case V4L2_FIELD_INTERLACED_BT: - iowrite32(top_offset / 2, priv->base + VNSLPRC_REG); - iowrite32((top_offset + cam_subrect->height) / 2 - 1, - priv->base + VNELPRC_REG); - break; - default: - iowrite32(top_offset, priv->base + VNSLPRC_REG); - iowrite32(top_offset + cam_subrect->height - 1, - priv->base + VNELPRC_REG); - break; - } - - /* Set scaling coefficient */ - value = 0; - if (cam_subrect->height != cam->out_height) - value = (4096 * cam_subrect->height) / cam->out_height; - dev_dbg(icd->parent, "YS Value: %x\n", value); - iowrite32(value, priv->base + VNYS_REG); - - value = 0; - if (cam_subrect->width != cam->out_width) - value = (4096 * cam_subrect->width) / cam->out_width; - - /* Horizontal upscaling is up to double size */ - if (0 < value && value < 2048) - value = 2048; - - dev_dbg(icd->parent, "XS Value: %x\n", value); - iowrite32(value, priv->base + VNXS_REG); - - /* Horizontal upscaling is carried out by scaling down from double size */ - if (value < 4096) - value *= 2; - - set_coeff(priv, value); - - /* Set Start/End Pixel/Line Post-Clip */ - iowrite32(0, priv->base + VNSPPOC_REG); - iowrite32(0, priv->base + VNSLPOC_REG); - iowrite32((cam->out_width - 1) << dsize, priv->base + VNEPPOC_REG); - switch (priv->field) { - case V4L2_FIELD_INTERLACED: - case V4L2_FIELD_INTERLACED_TB: - case V4L2_FIELD_INTERLACED_BT: - iowrite32(cam->out_height / 2 - 1, - priv->base + VNELPOC_REG); - break; - default: - iowrite32(cam->out_height - 1, priv->base + VNELPOC_REG); - break; - } - - iowrite32(ALIGN(cam->out_width, 0x10), priv->base + VNIS_REG); - - return 0; -} - -static void capture_stop_preserve(struct rcar_vin_priv *priv, u32 *vnmc) -{ - *vnmc = ioread32(priv->base + VNMC_REG); - /* module disable */ - iowrite32(*vnmc & ~VNMC_ME, priv->base + VNMC_REG); -} - -static void capture_restore(struct rcar_vin_priv *priv, u32 vnmc) -{ - unsigned long timeout = jiffies + 10 * HZ; - - /* - * Wait until the end of the current frame. It can take a long time, - * but if it has been aborted by a MRST1 reset, it should exit sooner. - */ - while ((ioread32(priv->base + VNMS_REG) & VNMS_AV) && - time_before(jiffies, timeout)) - msleep(1); - - if (time_after(jiffies, timeout)) { - dev_err(priv->ici.v4l2_dev.dev, - "Timeout waiting for frame end! Interface problem?\n"); - return; - } - - iowrite32(vnmc, priv->base + VNMC_REG); -} - -#define VIN_MBUS_FLAGS (V4L2_MBUS_MASTER | \ - V4L2_MBUS_PCLK_SAMPLE_RISING | \ - V4L2_MBUS_HSYNC_ACTIVE_HIGH | \ - V4L2_MBUS_HSYNC_ACTIVE_LOW | \ - V4L2_MBUS_VSYNC_ACTIVE_HIGH | \ - V4L2_MBUS_VSYNC_ACTIVE_LOW | \ - V4L2_MBUS_DATA_ACTIVE_HIGH) - -static int rcar_vin_set_bus_param(struct soc_camera_device *icd) -{ - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_priv *priv = ici->priv; - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct v4l2_mbus_config cfg; - unsigned long common_flags; - u32 vnmc; - u32 val; - int ret; - - capture_stop_preserve(priv, &vnmc); - - ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg); - if (!ret) { - common_flags = soc_mbus_config_compatible(&cfg, VIN_MBUS_FLAGS); - if (!common_flags) { - dev_warn(icd->parent, - "MBUS flags incompatible: camera 0x%x, host 0x%x\n", - cfg.flags, VIN_MBUS_FLAGS); - return -EINVAL; - } - } else if (ret != -ENOIOCTLCMD) { - return ret; - } else { - common_flags = VIN_MBUS_FLAGS; - } - - /* Make choises, based on platform preferences */ - if ((common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) && - (common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) { - if (priv->pdata_flags & RCAR_VIN_HSYNC_ACTIVE_LOW) - common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_HIGH; - else - common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_LOW; - } - - if ((common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) && - (common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) { - if (priv->pdata_flags & RCAR_VIN_VSYNC_ACTIVE_LOW) - common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_HIGH; - else - common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_LOW; - } - - cfg.flags = common_flags; - ret = v4l2_subdev_call(sd, video, s_mbus_config, &cfg); - if (ret < 0 && ret != -ENOIOCTLCMD) - return ret; - - val = VNDMR2_FTEV | VNDMR2_VLV(1); - if (!(common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) - val |= VNDMR2_VPS; - if (!(common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) - val |= VNDMR2_HPS; - iowrite32(val, priv->base + VNDMR2_REG); - - ret = rcar_vin_set_rect(icd); - if (ret < 0) - return ret; - - capture_restore(priv, vnmc); - - return 0; -} - -static int rcar_vin_try_bus_param(struct soc_camera_device *icd, - unsigned char buswidth) -{ - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct v4l2_mbus_config cfg; - int ret; - - ret = v4l2_subdev_call(sd, video, g_mbus_config, &cfg); - if (ret == -ENOIOCTLCMD) - return 0; - else if (ret) - return ret; - - if (buswidth > 24) - return -EINVAL; - - /* check is there common mbus flags */ - ret = soc_mbus_config_compatible(&cfg, VIN_MBUS_FLAGS); - if (ret) - return 0; - - dev_warn(icd->parent, - "MBUS flags incompatible: camera 0x%x, host 0x%x\n", - cfg.flags, VIN_MBUS_FLAGS); - - return -EINVAL; -} - -static bool rcar_vin_packing_supported(const struct soc_mbus_pixelfmt *fmt) -{ - return fmt->packing == SOC_MBUS_PACKING_NONE || - (fmt->bits_per_sample > 8 && - fmt->packing == SOC_MBUS_PACKING_EXTEND16); -} - -static const struct soc_mbus_pixelfmt rcar_vin_formats[] = { - { - .fourcc = V4L2_PIX_FMT_NV16, - .name = "NV16", - .bits_per_sample = 8, - .packing = SOC_MBUS_PACKING_2X8_PADHI, - .order = SOC_MBUS_ORDER_LE, - .layout = SOC_MBUS_LAYOUT_PLANAR_Y_C, - }, - { - .fourcc = V4L2_PIX_FMT_YUYV, - .name = "YUYV", - .bits_per_sample = 16, - .packing = SOC_MBUS_PACKING_NONE, - .order = SOC_MBUS_ORDER_LE, - .layout = SOC_MBUS_LAYOUT_PACKED, - }, - { - .fourcc = V4L2_PIX_FMT_UYVY, - .name = "UYVY", - .bits_per_sample = 16, - .packing = SOC_MBUS_PACKING_NONE, - .order = SOC_MBUS_ORDER_LE, - .layout = SOC_MBUS_LAYOUT_PACKED, - }, - { - .fourcc = V4L2_PIX_FMT_RGB565, - .name = "RGB565", - .bits_per_sample = 16, - .packing = SOC_MBUS_PACKING_NONE, - .order = SOC_MBUS_ORDER_LE, - .layout = SOC_MBUS_LAYOUT_PACKED, - }, - { - .fourcc = V4L2_PIX_FMT_RGB555X, - .name = "ARGB1555", - .bits_per_sample = 16, - .packing = SOC_MBUS_PACKING_NONE, - .order = SOC_MBUS_ORDER_LE, - .layout = SOC_MBUS_LAYOUT_PACKED, - }, - { - .fourcc = V4L2_PIX_FMT_RGB32, - .name = "RGB888", - .bits_per_sample = 32, - .packing = SOC_MBUS_PACKING_NONE, - .order = SOC_MBUS_ORDER_LE, - .layout = SOC_MBUS_LAYOUT_PACKED, - }, - { - .fourcc = V4L2_PIX_FMT_ARGB32, - .name = "ARGB8888", - .bits_per_sample = 32, - .packing = SOC_MBUS_PACKING_NONE, - .order = SOC_MBUS_ORDER_LE, - .layout = SOC_MBUS_LAYOUT_PACKED, - }, -}; - -static int rcar_vin_get_formats(struct soc_camera_device *icd, unsigned int idx, - struct soc_camera_format_xlate *xlate) -{ - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct device *dev = icd->parent; - int ret, k, n; - int formats = 0; - struct rcar_vin_cam *cam; - struct v4l2_subdev_mbus_code_enum code = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - .index = idx, - }; - const struct soc_mbus_pixelfmt *fmt; - - ret = v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code); - if (ret < 0) - return 0; - - fmt = soc_mbus_get_fmtdesc(code.code); - if (!fmt) { - dev_warn(dev, "unsupported format code #%u: %d\n", idx, code.code); - return 0; - } - - ret = rcar_vin_try_bus_param(icd, fmt->bits_per_sample); - if (ret < 0) - return 0; - - if (!icd->host_priv) { - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - struct v4l2_mbus_framefmt *mf = &fmt.format; - struct v4l2_rect rect; - struct device *dev = icd->parent; - int shift; - - ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); - if (ret < 0) - return ret; - - /* Cache current client geometry */ - ret = soc_camera_client_g_rect(sd, &rect); - if (ret == -ENOIOCTLCMD) { - /* Sensor driver doesn't support cropping */ - rect.left = 0; - rect.top = 0; - rect.width = mf->width; - rect.height = mf->height; - } else if (ret < 0) { - return ret; - } - - /* - * If sensor proposes too large format then try smaller ones: - * 1280x960, 640x480, 320x240 - */ - for (shift = 0; shift < 3; shift++) { - if (mf->width <= VIN_MAX_WIDTH && - mf->height <= VIN_MAX_HEIGHT) - break; - - mf->width = 1280 >> shift; - mf->height = 960 >> shift; - ret = v4l2_device_call_until_err(sd->v4l2_dev, - soc_camera_grp_id(icd), - pad, set_fmt, NULL, - &fmt); - if (ret < 0) - return ret; - } - - if (shift == 3) { - dev_err(dev, - "Failed to configure the client below %ux%u\n", - mf->width, mf->height); - return -EIO; - } - - dev_dbg(dev, "camera fmt %ux%u\n", mf->width, mf->height); - - cam = kzalloc(sizeof(*cam), GFP_KERNEL); - if (!cam) - return -ENOMEM; - /* - * We are called with current camera crop, - * initialise subrect with it - */ - cam->rect = rect; - cam->subrect = rect; - cam->width = mf->width; - cam->height = mf->height; - cam->out_width = mf->width; - cam->out_height = mf->height; - - icd->host_priv = cam; - } else { - cam = icd->host_priv; - } - - /* Beginning of a pass */ - if (!idx) - cam->extra_fmt = NULL; - - switch (code.code) { - case MEDIA_BUS_FMT_YUYV8_1X16: - case MEDIA_BUS_FMT_YUYV8_2X8: - case MEDIA_BUS_FMT_YUYV10_2X10: - case MEDIA_BUS_FMT_RGB888_1X24: - if (cam->extra_fmt) - break; - - /* Add all our formats that can be generated by VIN */ - cam->extra_fmt = rcar_vin_formats; - - n = ARRAY_SIZE(rcar_vin_formats); - formats += n; - for (k = 0; xlate && k < n; k++, xlate++) { - xlate->host_fmt = &rcar_vin_formats[k]; - xlate->code = code.code; - dev_dbg(dev, "Providing format %s using code %d\n", - rcar_vin_formats[k].name, code.code); - } - break; - default: - if (!rcar_vin_packing_supported(fmt)) - return 0; - - dev_dbg(dev, "Providing format %s in pass-through mode\n", - fmt->name); - break; - } - - /* Generic pass-through */ - formats++; - if (xlate) { - xlate->host_fmt = fmt; - xlate->code = code.code; - xlate++; - } - - return formats; -} - -static void rcar_vin_put_formats(struct soc_camera_device *icd) -{ - kfree(icd->host_priv); - icd->host_priv = NULL; -} - -static int rcar_vin_set_selection(struct soc_camera_device *icd, - struct v4l2_selection *sel) -{ - const struct v4l2_rect *rect = &sel->r; - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_priv *priv = ici->priv; - struct v4l2_selection cam_sel; - struct rcar_vin_cam *cam = icd->host_priv; - struct v4l2_rect *cam_rect = &cam_sel.r; - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct device *dev = icd->parent; - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - struct v4l2_mbus_framefmt *mf = &fmt.format; - u32 vnmc; - int ret, i; - - dev_dbg(dev, "S_SELECTION(%ux%u@%u:%u)\n", rect->width, rect->height, - rect->left, rect->top); - - /* During camera cropping its output window can change too, stop VIN */ - capture_stop_preserve(priv, &vnmc); - dev_dbg(dev, "VNMC_REG 0x%x\n", vnmc); - - /* Apply iterative camera S_SELECTION for new input window. */ - ret = soc_camera_client_s_selection(sd, sel, &cam_sel, - &cam->rect, &cam->subrect); - if (ret < 0) - return ret; - - dev_dbg(dev, "camera cropped to %ux%u@%u:%u\n", - cam_rect->width, cam_rect->height, - cam_rect->left, cam_rect->top); - - /* On success cam_crop contains current camera crop */ - - /* Retrieve camera output window */ - ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); - if (ret < 0) - return ret; - - if (mf->width > VIN_MAX_WIDTH || mf->height > VIN_MAX_HEIGHT) - return -EINVAL; - - /* Cache camera output window */ - cam->width = mf->width; - cam->height = mf->height; - - icd->user_width = cam->width; - icd->user_height = cam->height; - - cam->vin_left = rect->left & ~1; - cam->vin_top = rect->top & ~1; - - /* Use VIN cropping to crop to the new window. */ - ret = rcar_vin_set_rect(icd); - if (ret < 0) - return ret; - - cam->subrect = *rect; - - dev_dbg(dev, "VIN cropped to %ux%u@%u:%u\n", - icd->user_width, icd->user_height, - cam->vin_left, cam->vin_top); - - /* Restore capture */ - for (i = 0; i < MAX_BUFFER_NUM; i++) { - if (priv->queue_buf[i] && priv->state == STOPPED) { - vnmc |= VNMC_ME; - break; - } - } - capture_restore(priv, vnmc); - - /* Even if only camera cropping succeeded */ - return ret; -} - -static int rcar_vin_get_selection(struct soc_camera_device *icd, - struct v4l2_selection *sel) -{ - struct rcar_vin_cam *cam = icd->host_priv; - - sel->r = cam->subrect; - - return 0; -} - -/* Similar to set_crop multistage iterative algorithm */ -static int rcar_vin_set_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) -{ - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - struct rcar_vin_priv *priv = ici->priv; - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct rcar_vin_cam *cam = icd->host_priv; - struct v4l2_pix_format *pix = &f->fmt.pix; - struct v4l2_mbus_framefmt mf; - struct device *dev = icd->parent; - __u32 pixfmt = pix->pixelformat; - const struct soc_camera_format_xlate *xlate; - unsigned int vin_sub_width = 0, vin_sub_height = 0; - int ret; - bool can_scale; - enum v4l2_field field; - v4l2_std_id std; - - dev_dbg(dev, "S_FMT(pix=0x%x, %ux%u)\n", - pixfmt, pix->width, pix->height); - - switch (pix->field) { - default: - pix->field = V4L2_FIELD_NONE; - /* fall-through */ - case V4L2_FIELD_NONE: - case V4L2_FIELD_TOP: - case V4L2_FIELD_BOTTOM: - case V4L2_FIELD_INTERLACED_TB: - case V4L2_FIELD_INTERLACED_BT: - field = pix->field; - break; - case V4L2_FIELD_INTERLACED: - /* Query for standard if not explicitly mentioned _TB/_BT */ - ret = v4l2_subdev_call(sd, video, querystd, &std); - if (ret == -ENOIOCTLCMD) { - field = V4L2_FIELD_NONE; - } else if (ret < 0) { - return ret; - } else { - field = std & V4L2_STD_625_50 ? - V4L2_FIELD_INTERLACED_TB : - V4L2_FIELD_INTERLACED_BT; - } - break; - } - - xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); - if (!xlate) { - dev_warn(dev, "Format %x not found\n", pixfmt); - return -EINVAL; - } - /* Calculate client output geometry */ - soc_camera_calc_client_output(icd, &cam->rect, &cam->subrect, pix, &mf, - 12); - mf.field = pix->field; - mf.colorspace = pix->colorspace; - mf.code = xlate->code; - - switch (pixfmt) { - case V4L2_PIX_FMT_RGB32: - can_scale = priv->chip != RCAR_E1; - break; - case V4L2_PIX_FMT_ARGB32: - case V4L2_PIX_FMT_UYVY: - case V4L2_PIX_FMT_YUYV: - case V4L2_PIX_FMT_RGB565: - case V4L2_PIX_FMT_RGB555X: - can_scale = true; - break; - default: - can_scale = false; - break; - } - - dev_dbg(dev, "request camera output %ux%u\n", mf.width, mf.height); - - ret = soc_camera_client_scale(icd, &cam->rect, &cam->subrect, - &mf, &vin_sub_width, &vin_sub_height, - can_scale, 12); - - /* Done with the camera. Now see if we can improve the result */ - dev_dbg(dev, "Camera %d fmt %ux%u, requested %ux%u\n", - ret, mf.width, mf.height, pix->width, pix->height); - - if (ret == -ENOIOCTLCMD) - dev_dbg(dev, "Sensor doesn't support scaling\n"); - else if (ret < 0) - return ret; - - if (mf.code != xlate->code) - return -EINVAL; - - /* Prepare VIN crop */ - cam->width = mf.width; - cam->height = mf.height; - - /* Use VIN scaling to scale to the requested user window. */ - - /* We cannot scale up */ - if (pix->width > vin_sub_width) - vin_sub_width = pix->width; - - if (pix->height > vin_sub_height) - vin_sub_height = pix->height; - - pix->colorspace = mf.colorspace; - - if (!can_scale) { - pix->width = vin_sub_width; - pix->height = vin_sub_height; - } - - /* - * We have calculated CFLCR, the actual configuration will be performed - * in rcar_vin_set_bus_param() - */ - - dev_dbg(dev, "W: %u : %u, H: %u : %u\n", - vin_sub_width, pix->width, vin_sub_height, pix->height); - - cam->out_width = pix->width; - cam->out_height = pix->height; - - icd->current_fmt = xlate; - - priv->field = field; - - return 0; -} - -static int rcar_vin_try_fmt(struct soc_camera_device *icd, - struct v4l2_format *f) -{ - const struct soc_camera_format_xlate *xlate; - struct v4l2_pix_format *pix = &f->fmt.pix; - struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - struct v4l2_subdev_pad_config pad_cfg; - struct v4l2_subdev_format format = { - .which = V4L2_SUBDEV_FORMAT_TRY, - }; - struct v4l2_mbus_framefmt *mf = &format.format; - __u32 pixfmt = pix->pixelformat; - int width, height; - int ret; - - xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); - if (!xlate) { - xlate = icd->current_fmt; - dev_dbg(icd->parent, "Format %x not found, keeping %x\n", - pixfmt, xlate->host_fmt->fourcc); - pixfmt = xlate->host_fmt->fourcc; - pix->pixelformat = pixfmt; - pix->colorspace = icd->colorspace; - } - - /* FIXME: calculate using depth and bus width */ - v4l_bound_align_image(&pix->width, 2, VIN_MAX_WIDTH, 1, - &pix->height, 4, VIN_MAX_HEIGHT, 2, 0); - - width = pix->width; - height = pix->height; - - /* let soc-camera calculate these values */ - pix->bytesperline = 0; - pix->sizeimage = 0; - - /* limit to sensor capabilities */ - mf->width = pix->width; - mf->height = pix->height; - mf->field = pix->field; - mf->code = xlate->code; - mf->colorspace = pix->colorspace; - - ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd), - pad, set_fmt, &pad_cfg, &format); - if (ret < 0) - return ret; - - /* Adjust only if VIN cannot scale */ - if (pix->width > mf->width * 2) - pix->width = mf->width * 2; - if (pix->height > mf->height * 3) - pix->height = mf->height * 3; - - pix->field = mf->field; - pix->colorspace = mf->colorspace; - - if (pixfmt == V4L2_PIX_FMT_NV16) { - /* FIXME: check against rect_max after converting soc-camera */ - /* We can scale precisely, need a bigger image from camera */ - if (pix->width < width || pix->height < height) { - /* - * We presume, the sensor behaves sanely, i.e. if - * requested a bigger rectangle, it will not return a - * smaller one. - */ - mf->width = VIN_MAX_WIDTH; - mf->height = VIN_MAX_HEIGHT; - ret = v4l2_device_call_until_err(sd->v4l2_dev, - soc_camera_grp_id(icd), - pad, set_fmt, &pad_cfg, - &format); - if (ret < 0) { - dev_err(icd->parent, - "client try_fmt() = %d\n", ret); - return ret; - } - } - /* We will scale exactly */ - if (mf->width > width) - pix->width = width; - if (mf->height > height) - pix->height = height; - } - - return ret; -} - -static unsigned int rcar_vin_poll(struct file *file, poll_table *pt) -{ - struct soc_camera_device *icd = file->private_data; - - return vb2_poll(&icd->vb2_vidq, file, pt); -} - -static int rcar_vin_querycap(struct soc_camera_host *ici, - struct v4l2_capability *cap) -{ - strlcpy(cap->card, "R_Car_VIN", sizeof(cap->card)); - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; - snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s%d", DRV_NAME, ici->nr); - - return 0; -} - -static int rcar_vin_init_videobuf2(struct vb2_queue *vq, - struct soc_camera_device *icd) -{ - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - - vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - vq->io_modes = VB2_MMAP | VB2_USERPTR; - vq->drv_priv = icd; - vq->ops = &rcar_vin_vb2_ops; - vq->mem_ops = &vb2_dma_contig_memops; - vq->buf_struct_size = sizeof(struct rcar_vin_buffer); - vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - vq->lock = &ici->host_lock; - vq->dev = ici->v4l2_dev.dev; - - return vb2_queue_init(vq); -} - -static struct soc_camera_host_ops rcar_vin_host_ops = { - .owner = THIS_MODULE, - .add = rcar_vin_add_device, - .remove = rcar_vin_remove_device, - .get_formats = rcar_vin_get_formats, - .put_formats = rcar_vin_put_formats, - .get_selection = rcar_vin_get_selection, - .set_selection = rcar_vin_set_selection, - .try_fmt = rcar_vin_try_fmt, - .set_fmt = rcar_vin_set_fmt, - .poll = rcar_vin_poll, - .querycap = rcar_vin_querycap, - .set_bus_param = rcar_vin_set_bus_param, - .init_videobuf2 = rcar_vin_init_videobuf2, -}; - -#ifdef CONFIG_OF -static const struct of_device_id rcar_vin_of_table[] = { - { .compatible = "renesas,vin-r8a7795", .data = (void *)RCAR_GEN3 }, - { .compatible = "renesas,vin-r8a7794", .data = (void *)RCAR_GEN2 }, - { .compatible = "renesas,vin-r8a7793", .data = (void *)RCAR_GEN2 }, - { .compatible = "renesas,vin-r8a7791", .data = (void *)RCAR_GEN2 }, - { .compatible = "renesas,vin-r8a7790", .data = (void *)RCAR_GEN2 }, - { .compatible = "renesas,vin-r8a7779", .data = (void *)RCAR_H1 }, - { .compatible = "renesas,vin-r8a7778", .data = (void *)RCAR_M1 }, - { .compatible = "renesas,rcar-gen3-vin", .data = (void *)RCAR_GEN3 }, - { .compatible = "renesas,rcar-gen2-vin", .data = (void *)RCAR_GEN2 }, - { }, -}; -MODULE_DEVICE_TABLE(of, rcar_vin_of_table); -#endif - -static int rcar_vin_probe(struct platform_device *pdev) -{ - const struct of_device_id *match = NULL; - struct rcar_vin_priv *priv; - struct v4l2_of_endpoint ep; - struct device_node *np; - struct resource *mem; - unsigned int pdata_flags; - int irq, ret; - - match = of_match_device(of_match_ptr(rcar_vin_of_table), &pdev->dev); - - np = of_graph_get_next_endpoint(pdev->dev.of_node, NULL); - if (!np) { - dev_err(&pdev->dev, "could not find endpoint\n"); - return -EINVAL; - } - - ret = v4l2_of_parse_endpoint(np, &ep); - if (ret) { - dev_err(&pdev->dev, "could not parse endpoint\n"); - return ret; - } - - if (ep.bus_type == V4L2_MBUS_BT656) - pdata_flags = RCAR_VIN_BT656; - else { - pdata_flags = 0; - if (ep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW) - pdata_flags |= RCAR_VIN_HSYNC_ACTIVE_LOW; - if (ep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW) - pdata_flags |= RCAR_VIN_VSYNC_ACTIVE_LOW; - } - - of_node_put(np); - - dev_dbg(&pdev->dev, "pdata_flags = %08x\n", pdata_flags); - - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (mem == NULL) - return -EINVAL; - - irq = platform_get_irq(pdev, 0); - if (irq <= 0) - return -EINVAL; - - priv = devm_kzalloc(&pdev->dev, sizeof(struct rcar_vin_priv), - GFP_KERNEL); - if (!priv) - return -ENOMEM; - - priv->base = devm_ioremap_resource(&pdev->dev, mem); - if (IS_ERR(priv->base)) - return PTR_ERR(priv->base); - - ret = devm_request_irq(&pdev->dev, irq, rcar_vin_irq, IRQF_SHARED, - dev_name(&pdev->dev), priv); - if (ret) - return ret; - - priv->ici.priv = priv; - priv->ici.v4l2_dev.dev = &pdev->dev; - priv->ici.drv_name = dev_name(&pdev->dev); - priv->ici.ops = &rcar_vin_host_ops; - - priv->pdata_flags = pdata_flags; - if (!match) { - priv->ici.nr = pdev->id; - priv->chip = pdev->id_entry->driver_data; - } else { - priv->ici.nr = of_alias_get_id(pdev->dev.of_node, "vin"); - priv->chip = (enum chip_id)match->data; - } - - spin_lock_init(&priv->lock); - INIT_LIST_HEAD(&priv->capture); - - priv->state = STOPPED; - - pm_suspend_ignore_children(&pdev->dev, true); - pm_runtime_enable(&pdev->dev); - - ret = soc_camera_host_register(&priv->ici); - if (ret) - goto cleanup; - - return 0; - -cleanup: - pm_runtime_disable(&pdev->dev); - - return ret; -} - -static int rcar_vin_remove(struct platform_device *pdev) -{ - struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); - - soc_camera_host_unregister(soc_host); - pm_runtime_disable(&pdev->dev); - - return 0; -} - -static struct platform_driver rcar_vin_driver = { - .probe = rcar_vin_probe, - .remove = rcar_vin_remove, - .driver = { - .name = DRV_NAME, - .of_match_table = of_match_ptr(rcar_vin_of_table), - }, -}; - -module_platform_driver(rcar_vin_driver); - -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:rcar_vin"); -MODULE_DESCRIPTION("Renesas R-Car VIN camera host driver"); From 6de690dd4e78b1bfd8e6777905203e55649d4d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 2 Sep 2016 12:37:06 -0300 Subject: [PATCH 468/591] [media] adv7180: rcar-vin: change mbus format to UYVY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The media bus format reported by the adv7180 is wrong. Steve Longerbeam posted a patch which changed the format to UYVY8_2X8 with the commit message: Change the media bus format from YUYV8_2X8 to UYVY8_2X8. Colors now look correct when capturing with the i.mx6 backend. The other option is to set the SWPC bit in register 0x27 to swap the Cr and Cb output samples. The rcar-vin driver was developed and tested with the adv7180 and therefor suffers from the same issue, looking for the wrong media bus format. The two errors corrected each other. This patch takes Steve's patch and merge it with a fix for rcar-vin driver. The rcar-vin driver is used used in together with the adv7180 och Koelsch and this ensures it will not break while fixing the adv7180 issue. I checked wit Steve and he was fine with me merging the patches. ADV7180 parts: Signed-off-by: Niklas Söderlund Suggested-by: Steve Longerbeam Signed-off-by: Steve Longerbeam Acked-by: Lars-Peter Clausen Tested-by: Tim Harvey Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv7180.c | 4 ++-- drivers/media/platform/rcar-vin/rcar-core.c | 4 ++-- drivers/media/platform/rcar-vin/rcar-dma.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 515ea6ae41d7..a6ac78bef4f6 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -633,7 +633,7 @@ static int adv7180_enum_mbus_code(struct v4l2_subdev *sd, if (code->index != 0) return -EINVAL; - code->code = MEDIA_BUS_FMT_YUYV8_2X8; + code->code = MEDIA_BUS_FMT_UYVY8_2X8; return 0; } @@ -643,7 +643,7 @@ static int adv7180_mbus_fmt(struct v4l2_subdev *sd, { struct adv7180_state *state = to_state(sd); - fmt->code = MEDIA_BUS_FMT_YUYV8_2X8; + fmt->code = MEDIA_BUS_FMT_UYVY8_2X8; fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; fmt->width = 720; fmt->height = state->curr_norm & V4L2_STD_525_60 ? 480 : 576; diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 64999a2fba15..6219cbaea940 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -43,8 +43,8 @@ static bool rvin_mbus_supported(struct rvin_graph_entity *entity) code.index++; switch (code.code) { case MEDIA_BUS_FMT_YUYV8_1X16: - case MEDIA_BUS_FMT_YUYV8_2X8: - case MEDIA_BUS_FMT_YUYV10_2X10: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: case MEDIA_BUS_FMT_RGB888_1X24: entity->code = code.code; return true; diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 9d9f02b1a4d9..8397125a8968 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -169,7 +169,7 @@ static int rvin_setup(struct rvin_dev *vin) vnmc |= VNMC_INF_YUV16; input_is_yuv = true; break; - case MEDIA_BUS_FMT_YUYV8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */ vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ? VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601; @@ -178,7 +178,7 @@ static int rvin_setup(struct rvin_dev *vin) case MEDIA_BUS_FMT_RGB888_1X24: vnmc |= VNMC_INF_RGB888; break; - case MEDIA_BUS_FMT_YUYV10_2X10: + case MEDIA_BUS_FMT_UYVY10_2X10: /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */ vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ? VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601; From e0ad7a9b90a7a6fc077c975dbbb00142c0a28645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 2 Sep 2016 13:44:56 -0300 Subject: [PATCH 469/591] [media] media: adv7180: fill in mbus format in set_fmt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the V4L2_SUBDEV_FORMAT_TRY is used in set_fmt the width, height etc would not be filled. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv7180.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index a6ac78bef4f6..cbed2bc29325 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -711,6 +711,7 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd, { struct adv7180_state *state = to_state(sd); struct v4l2_mbus_framefmt *framefmt; + int ret; switch (format->format.field) { case V4L2_FIELD_NONE: @@ -722,8 +723,9 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd, break; } + ret = adv7180_mbus_fmt(sd, &format->format); + if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) { - framefmt = &format->format; if (state->field != format->format.field) { state->field = format->format.field; adv7180_set_power(state, false); @@ -735,7 +737,7 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd, *framefmt = format->format; } - return adv7180_mbus_fmt(sd, framefmt); + return ret; } static int adv7180_g_mbus_config(struct v4l2_subdev *sd, From 7e13a8a45e3ec1c712f1f3995f7f3daf7fa07ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 2 Sep 2016 13:44:57 -0300 Subject: [PATCH 470/591] [media] media: rcar-vin: make V4L2_FIELD_INTERLACED standard dependent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The field V4L2_FIELD_INTERLACED is standard dependent and should not unconditionally be equivalent to V4L2_FIELD_INTERLACED_TB. This patch adds a check to see if the video standard can be obtained and if it's a 60 Hz format. If the condition is met V4L2_FIELD_INTERLACED is treated as V4L2_FIELD_INTERLACED_BT if not as V4L2_FIELD_INTERLACED_TB. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-dma.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 8397125a8968..01182e0a86f8 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -131,6 +131,7 @@ static u32 rvin_read(struct rvin_dev *vin, u32 offset) static int rvin_setup(struct rvin_dev *vin) { u32 vnmc, dmr, dmr2, interrupts; + v4l2_std_id std; bool progressive = false, output_is_yuv = false, input_is_yuv = false; switch (vin->format.field) { @@ -141,6 +142,14 @@ static int rvin_setup(struct rvin_dev *vin) vnmc = VNMC_IM_EVEN; break; case V4L2_FIELD_INTERLACED: + /* Default to TB */ + vnmc = VNMC_IM_FULL; + /* Use BT if video standard can be read and is 60 Hz format */ + if (!v4l2_subdev_call(vin_to_source(vin), video, g_std, &std)) { + if (std & V4L2_STD_525_60) + vnmc = VNMC_IM_FULL | VNMC_FOC; + } + break; case V4L2_FIELD_INTERLACED_TB: vnmc = VNMC_IM_FULL; break; From 52a1b4e93518c7625fa9756637e54400637ad7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 2 Sep 2016 13:44:58 -0300 Subject: [PATCH 471/591] [media] media: rcar-vin: allow field to be changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The driver forced whatever field was set by the source subdevice to be used. This patch allows the user to change from the default field. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 62ca7e35517e..88bfee33b478 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -102,6 +102,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin, struct v4l2_subdev_format format = { .which = which, }; + enum v4l2_field field; int ret; sd = vin_to_source(vin); @@ -114,12 +115,16 @@ static int __rvin_try_format_source(struct rvin_dev *vin, format.pad = vin->src_pad_idx; + field = pix->field; + ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format); if (ret < 0 && ret != -ENOIOCTLCMD) goto done; v4l2_fill_pix_format(pix, &format.format); + pix->field = field; + source->width = pix->width; source->height = pix->height; @@ -143,6 +148,10 @@ static int __rvin_try_format(struct rvin_dev *vin, rwidth = pix->width; rheight = pix->height; + /* Keep current field if no specific one is asked for */ + if (pix->field == V4L2_FIELD_ANY) + pix->field = vin->format.field; + /* * Retrieve format information and select the current format if the * requested format isn't supported. From d6482537f666ab024925e5a126cfaeede34a3801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 2 Sep 2016 13:44:59 -0300 Subject: [PATCH 472/591] [media] media: rcar-vin: fix bug in scaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was not possible to scale beyond the image size of the video source limitation. The output frame would be bigger but the captured image was limited to the size of the video source. The error was that the crop boundary was set after the requested frame size and not the video source size. This patch breaks out the resetting of the crop, compose and format to separate functions so the error wont creep back. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 105 ++++++++++---------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 88bfee33b478..47d8d9745747 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -92,6 +92,54 @@ static u32 rvin_format_sizeimage(struct v4l2_pix_format *pix) * V4L2 */ +static void rvin_reset_crop_compose(struct rvin_dev *vin) +{ + vin->crop.top = vin->crop.left = 0; + vin->crop.width = vin->source.width; + vin->crop.height = vin->source.height; + + vin->compose.top = vin->compose.left = 0; + vin->compose.width = vin->format.width; + vin->compose.height = vin->format.height; +} + +static int rvin_reset_format(struct rvin_dev *vin) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct v4l2_mbus_framefmt *mf = &fmt.format; + int ret; + + fmt.pad = vin->src_pad_idx; + + ret = v4l2_subdev_call(vin_to_source(vin), pad, get_fmt, NULL, &fmt); + if (ret) + return ret; + + vin->format.width = mf->width; + vin->format.height = mf->height; + vin->format.colorspace = mf->colorspace; + vin->format.field = mf->field; + + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + break; + default: + vin->format.field = V4L2_FIELD_NONE; + break; + } + + rvin_reset_crop_compose(vin); + + return 0; +} + static int __rvin_try_format_source(struct rvin_dev *vin, u32 which, struct v4l2_pix_format *pix, @@ -255,6 +303,8 @@ static int rvin_s_fmt_vid_cap(struct file *file, void *priv, vin->format = f->fmt.pix; + rvin_reset_crop_compose(vin); + return 0; } @@ -446,35 +496,14 @@ static int rvin_querystd(struct file *file, void *priv, v4l2_std_id *a) static int rvin_s_std(struct file *file, void *priv, v4l2_std_id a) { struct rvin_dev *vin = video_drvdata(file); - struct v4l2_subdev *sd = vin_to_source(vin); - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - struct v4l2_mbus_framefmt *mf = &fmt.format; - int ret = v4l2_subdev_call(sd, video, s_std, a); + int ret; + ret = v4l2_subdev_call(vin_to_source(vin), video, s_std, a); if (ret < 0) return ret; /* Changing the standard will change the width/height */ - ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); - if (ret) { - vin_err(vin, "Failed to get initial format\n"); - return ret; - } - - vin->format.width = mf->width; - vin->format.height = mf->height; - - vin->crop.top = vin->crop.left = 0; - vin->crop.width = mf->width; - vin->crop.height = mf->height; - - vin->compose.top = vin->compose.left = 0; - vin->compose.width = mf->width; - vin->compose.height = mf->height; - - return 0; + return rvin_reset_format(vin); } static int rvin_g_std(struct file *file, void *priv, v4l2_std_id *a) @@ -779,10 +808,6 @@ static void rvin_notify(struct v4l2_subdev *sd, int rvin_v4l2_probe(struct rvin_dev *vin) { - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - struct v4l2_mbus_framefmt *mf = &fmt.format; struct video_device *vdev = &vin->vdev; struct v4l2_subdev *sd = vin_to_source(vin); int pad_idx, ret; @@ -839,31 +864,9 @@ int rvin_v4l2_probe(struct rvin_dev *vin) return -EINVAL; vin->src_pad_idx = pad_idx; - fmt.pad = vin->src_pad_idx; - /* Try to improve our guess of a reasonable window format */ - ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt); - if (ret) { - vin_err(vin, "Failed to get initial format\n"); - return ret; - } - - /* Set default format */ - vin->format.width = mf->width; - vin->format.height = mf->height; - vin->format.colorspace = mf->colorspace; - vin->format.field = mf->field; vin->format.pixelformat = RVIN_DEFAULT_FORMAT; - - - /* Set initial crop and compose */ - vin->crop.top = vin->crop.left = 0; - vin->crop.width = mf->width; - vin->crop.height = mf->height; - - vin->compose.top = vin->compose.left = 0; - vin->compose.width = mf->width; - vin->compose.height = mf->height; + rvin_reset_format(vin); ret = video_register_device(&vin->vdev, VFL_TYPE_GRABBER, -1); if (ret) { From c6b3d8fc79a93aa1139c080bbb7402db846cc9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 2 Sep 2016 13:45:00 -0300 Subject: [PATCH 473/591] [media] media: rcar-vin: fix height for TOP and BOTTOM fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The height used for V4L2_FIELD_TOP and V4L2_FIELD_BOTTOM where wrong. The frames only contain one field so the height should be half of the frame. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 31 ++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 47d8d9745747..1392514d4072 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -125,6 +125,8 @@ static int rvin_reset_format(struct rvin_dev *vin) switch (vin->format.field) { case V4L2_FIELD_TOP: case V4L2_FIELD_BOTTOM: + vin->format.height /= 2; + break; case V4L2_FIELD_NONE: case V4L2_FIELD_INTERLACED_TB: case V4L2_FIELD_INTERLACED_BT: @@ -220,6 +222,22 @@ static int __rvin_try_format(struct rvin_dev *vin, /* Limit to source capabilities */ __rvin_try_format_source(vin, which, pix, source); + switch (pix->field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + pix->height /= 2; + source->height /= 2; + break; + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + break; + default: + pix->field = V4L2_FIELD_NONE; + break; + } + /* If source can't match format try if VIN can scale */ if (source->width != rwidth || source->height != rheight) rvin_scale_try(vin, pix, rwidth, rheight); @@ -231,19 +249,6 @@ static int __rvin_try_format(struct rvin_dev *vin, v4l_bound_align_image(&pix->width, 2, RVIN_MAX_WIDTH, walign, &pix->height, 4, RVIN_MAX_HEIGHT, 2, 0); - switch (pix->field) { - case V4L2_FIELD_NONE: - case V4L2_FIELD_TOP: - case V4L2_FIELD_BOTTOM: - case V4L2_FIELD_INTERLACED_TB: - case V4L2_FIELD_INTERLACED_BT: - case V4L2_FIELD_INTERLACED: - break; - default: - pix->field = V4L2_FIELD_NONE; - break; - } - pix->bytesperline = max_t(u32, pix->bytesperline, rvin_format_bytesperline(pix)); pix->sizeimage = max_t(u32, pix->sizeimage, From b6f556cb93a97de133efb8bad37e298b49d8ac78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 2 Sep 2016 13:45:01 -0300 Subject: [PATCH 474/591] [media] media: rcar-vin: add support for V4L2_FIELD_ALTERNATE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HW can capture both ODD and EVEN fields in separate buffers so it's possible to support V4L2_FIELD_ALTERNATE. This patch add support for this mode. At probe time and when S_STD is called the driver will default to use V4L2_FIELD_INTERLACED if the subdevice reports V4L2_FIELD_ALTERNATE. The driver will only change the field type if the subdevice implements G_STD, if not it will keep the default at V4L2_FIELD_ALTERNATE. The user can always explicitly ask for V4L2_FIELD_ALTERNATE in S_FMT and the driver will use that field format. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-dma.c | 26 ++++++++++++++++----- drivers/media/platform/rcar-vin/rcar-v4l2.c | 13 +++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 01182e0a86f8..9ccd5ff55e19 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -95,6 +95,7 @@ /* Video n Module Status Register bits */ #define VNMS_FBS_MASK (3 << 3) #define VNMS_FBS_SHIFT 3 +#define VNMS_FS (1 << 2) #define VNMS_AV (1 << 1) #define VNMS_CA (1 << 0) @@ -156,6 +157,7 @@ static int rvin_setup(struct rvin_dev *vin) case V4L2_FIELD_INTERLACED_BT: vnmc = VNMC_IM_FULL | VNMC_FOC; break; + case V4L2_FIELD_ALTERNATE: case V4L2_FIELD_NONE: if (vin->continuous) { vnmc = VNMC_IM_ODD_EVEN; @@ -329,15 +331,26 @@ static bool rvin_capture_active(struct rvin_dev *vin) return rvin_read(vin, VNMS_REG) & VNMS_CA; } -static int rvin_get_active_slot(struct rvin_dev *vin) +static int rvin_get_active_slot(struct rvin_dev *vin, u32 vnms) { if (vin->continuous) - return (rvin_read(vin, VNMS_REG) & VNMS_FBS_MASK) - >> VNMS_FBS_SHIFT; + return (vnms & VNMS_FBS_MASK) >> VNMS_FBS_SHIFT; return 0; } +static enum v4l2_field rvin_get_active_field(struct rvin_dev *vin, u32 vnms) +{ + if (vin->format.field == V4L2_FIELD_ALTERNATE) { + /* If FS is set it's a Even field */ + if (vnms & VNMS_FS) + return V4L2_FIELD_BOTTOM; + return V4L2_FIELD_TOP; + } + + return vin->format.field; +} + static void rvin_set_slot_addr(struct rvin_dev *vin, int slot, dma_addr_t addr) { const struct rvin_video_format *fmt; @@ -878,7 +891,7 @@ static bool rvin_fill_hw(struct rvin_dev *vin) static irqreturn_t rvin_irq(int irq, void *data) { struct rvin_dev *vin = data; - u32 int_status; + u32 int_status, vnms; int slot; unsigned int sequence, handled = 0; unsigned long flags; @@ -905,7 +918,8 @@ static irqreturn_t rvin_irq(int irq, void *data) } /* Prepare for capture and update state */ - slot = rvin_get_active_slot(vin); + vnms = rvin_read(vin, VNMS_REG); + slot = rvin_get_active_slot(vin, vnms); sequence = vin->sequence++; vin_dbg(vin, "IRQ %02d: %d\tbuf0: %c buf1: %c buf2: %c\tmore: %d\n", @@ -920,7 +934,7 @@ static irqreturn_t rvin_irq(int irq, void *data) goto done; /* Capture frame */ - vin->queue_buf[slot]->field = vin->format.field; + vin->queue_buf[slot]->field = rvin_get_active_field(vin, vnms); vin->queue_buf[slot]->sequence = sequence; vin->queue_buf[slot]->vb2_buf.timestamp = ktime_get_ns(); vb2_buffer_done(&vin->queue_buf[slot]->vb2_buf, VB2_BUF_STATE_DONE); diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 1392514d4072..61e9b59dcf44 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -122,9 +122,21 @@ static int rvin_reset_format(struct rvin_dev *vin) vin->format.colorspace = mf->colorspace; vin->format.field = mf->field; + /* + * If the subdevice uses ALTERNATE field mode and G_STD is + * implemented use the VIN HW to combine the two fields to + * one INTERLACED frame. The ALTERNATE field mode can still + * be requested in S_FMT and be respected, this is just the + * default which is applied at probing or when S_STD is called. + */ + if (vin->format.field == V4L2_FIELD_ALTERNATE && + v4l2_subdev_has_op(vin_to_source(vin), video, g_std)) + vin->format.field = V4L2_FIELD_INTERLACED; + switch (vin->format.field) { case V4L2_FIELD_TOP: case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_ALTERNATE: vin->format.height /= 2; break; case V4L2_FIELD_NONE: @@ -225,6 +237,7 @@ static int __rvin_try_format(struct rvin_dev *vin, switch (pix->field) { case V4L2_FIELD_TOP: case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_ALTERNATE: pix->height /= 2; source->height /= 2; break; From 474cde669dfe49da07eed8e9c2d8c30016fa701c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Thu, 15 Sep 2016 09:18:36 -0300 Subject: [PATCH 475/591] [media] MAINTAINERS: Add entry for the Renesas VIN driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The driver is maintained and supported, document it as such. Signed-off-by: Niklas Söderlund Acked-by: Laurent Pinchart Acked-by: Simon Horman Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5678e50fc13a..d5c793b0f30f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7514,6 +7514,15 @@ F: Documentation/devicetree/bindings/media/renesas,fcp.txt F: drivers/media/platform/rcar-fcp.c F: include/media/rcar-fcp.h +MEDIA DRIVERS FOR RENESAS - VIN +M: Niklas Söderlund +L: linux-media@vger.kernel.org +L: linux-renesas-soc@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Supported +F: Documentation/devicetree/bindings/media/rcar_vin.txt +F: drivers/media/platform/rcar-vin/ + MEDIA DRIVERS FOR RENESAS - VSP1 M: Laurent Pinchart L: linux-media@vger.kernel.org From 8a2192be4e272e9105b5ed97f154f5bf396ca9d0 Mon Sep 17 00:00:00 2001 From: Ulrich Hecht Date: Thu, 15 Sep 2016 14:33:23 -0300 Subject: [PATCH 476/591] [media] rcar-vin: implement EDID control ioctls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds G_EDID and S_EDID. Signed-off-by: Ulrich Hecht Acked-by: Niklas Söderlund Acked-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 48 +++++++++++++++++++++ drivers/media/platform/rcar-vin/rcar-vin.h | 2 + 2 files changed, 50 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 61e9b59dcf44..f35005c875ad 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -613,6 +613,44 @@ static int rvin_dv_timings_cap(struct file *file, void *priv_fh, return ret; } +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_source(vin); + int input, ret; + + if (edid->pad) + return -EINVAL; + + input = edid->pad; + edid->pad = vin->sink_pad_idx; + + ret = v4l2_subdev_call(sd, pad, get_edid, edid); + + edid->pad = input; + + return ret; +} + +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid) +{ + struct rvin_dev *vin = video_drvdata(file); + struct v4l2_subdev *sd = vin_to_source(vin); + int input, ret; + + if (edid->pad) + return -EINVAL; + + input = edid->pad; + edid->pad = vin->sink_pad_idx; + + ret = v4l2_subdev_call(sd, pad, set_edid, edid); + + edid->pad = input; + + return ret; +} + static const struct v4l2_ioctl_ops rvin_ioctl_ops = { .vidioc_querycap = rvin_querycap, .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap, @@ -635,6 +673,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = { .vidioc_s_dv_timings = rvin_s_dv_timings, .vidioc_query_dv_timings = rvin_query_dv_timings, + .vidioc_g_edid = rvin_g_edid, + .vidioc_s_edid = rvin_s_edid, + .vidioc_querystd = rvin_querystd, .vidioc_g_std = rvin_g_std, .vidioc_s_std = rvin_s_std, @@ -883,6 +924,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin) vin->src_pad_idx = pad_idx; + vin->sink_pad_idx = 0; + for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++) + if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) { + vin->sink_pad_idx = pad_idx; + break; + } + vin->format.pixelformat = RVIN_DEFAULT_FORMAT; rvin_reset_format(vin); diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 793184d26c17..727e215c0871 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -92,6 +92,7 @@ struct rvin_graph_entity { * @vdev: V4L2 video device associated with VIN * @v4l2_dev: V4L2 device * @src_pad_idx: source pad index for media controller drivers + * @sink_pad_idx: sink pad index for media controller drivers * @ctrl_handler: V4L2 control handler * @notifier: V4L2 asynchronous subdevs notifier * @digital: entity in the DT for local digital subdevice @@ -121,6 +122,7 @@ struct rvin_dev { struct video_device vdev; struct v4l2_device v4l2_dev; int src_pad_idx; + int sink_pad_idx; struct v4l2_ctrl_handler ctrl_handler; struct v4l2_async_notifier notifier; struct rvin_graph_entity digital; From 6ff7b7aff34a4c21953ebf360d8941aeec0a215e Mon Sep 17 00:00:00 2001 From: Ulrich Hecht Date: Thu, 15 Sep 2016 14:33:24 -0300 Subject: [PATCH 477/591] [media] media: rcar-vin: use sink pad index for DV timings Signed-off-by: Ulrich Hecht Acked-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index f35005c875ad..2bbe6d495fa6 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -550,7 +550,7 @@ static int rvin_enum_dv_timings(struct file *file, void *priv_fh, int pad, ret; pad = timings->pad; - timings->pad = vin->src_pad_idx; + timings->pad = vin->sink_pad_idx; ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings); @@ -604,7 +604,7 @@ static int rvin_dv_timings_cap(struct file *file, void *priv_fh, int pad, ret; pad = cap->pad; - cap->pad = vin->src_pad_idx; + cap->pad = vin->sink_pad_idx; ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap); From c19584882a435bbe41fa555620c7261ba9155ae2 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 21 Sep 2016 05:13:08 -0300 Subject: [PATCH 478/591] [media] v4l: doc: Prepare for table reorganization Fix a few indentation issues to enable automated table reorganization by a regex-based script. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/vidioc-enumstd.rst | 2 +- Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst | 2 +- Documentation/media/uapi/v4l/vidioc-g-tuner.rst | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index 7a3a6d6aeb17..7a882cd8f944 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -335,7 +335,7 @@ support digital TV. See also the Linux DVB API at - 4433618.75 ± 5 - (3582056.25 ± 5) + (3582056.25 ± 5) - :cspan:`3` 4433618.75 ± 5 diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index a2f58319cebe..f1afed7a5958 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -234,7 +234,7 @@ EBUSY - ``reserved[14]`` - Reserved for future extensions. Drivers and applications must set - the array to zero. + the array to zero. .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index bfeeeb22c41f..d0251a1b6303 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -277,7 +277,7 @@ To change the radio frequency the - 1 - - Tuner supports radio + - Tuner supports radio - .. row 2 @@ -285,7 +285,7 @@ To change the radio frequency the - 2 - - Tuner supports analog TV + - Tuner supports analog TV - .. row 3 @@ -293,8 +293,8 @@ To change the radio frequency the - 4 - - Tuner controls the A/D and/or D/A block of a - Sofware Digital Radio (SDR) + - Tuner controls the A/D and/or D/A block of a + Sofware Digital Radio (SDR) - .. row 4 @@ -302,7 +302,7 @@ To change the radio frequency the - 5 - - Tuner controls the RF part of a Sofware Digital Radio (SDR) + - Tuner controls the RF part of a Sofware Digital Radio (SDR) .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| From c2b66cafdf020856f6981d03efd9f2706d5f0156 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 5 Sep 2016 08:44:34 -0300 Subject: [PATCH 479/591] [media] v4l: doc: Remove row numbers from tables Shorten the tables by removing row numbers in comments, allowing for later insertion of rows with minimal diffs. All changes have been generated by the following script. import io import re import sys def process_table(fname, data): if fname.endswith('hist-v4l2.rst'): data = re.sub(u'\n{1,2}\t( ?) -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE) data = re.sub(u'\n(\t| )- \.\. row [0-9]+\n\t ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE) else: data = re.sub(u'\n{1,2} -( ?) ?', u'\n -\\1', data, flags = re.MULTILINE) data = re.sub(u'(\n?)(\n\n - \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE) data = re.sub(u'\n - \.\. row [0-9]+\n -( ?) ?', u' * -\\1', data, flags = re.MULTILINE) data = re.sub(u'\n - \.\. row [0-9]+\n \.\. (_[A-Z0-9_`-]*:)', u'\n - .. \\1', data, flags = re.MULTILINE) data = re.sub(u'\n - \.\. (_[A-Z0-9_`-]*:)\n -', u' * .. \\1\n\n -', data, flags = re.MULTILINE) data = re.sub(u'^ - ', u' -', data, flags = re.MULTILINE) data = re.sub(u'^(\t{1,2}) ', u'\\1', data, flags = re.MULTILINE) return data def process_file(fname, data): buf = io.StringIO(data) output = '' in_table = False table_separator = 0 for line in buf.readlines(): if line.find('.. flat-table::') != -1: in_table = True table = '' elif in_table and not re.match('^[\t\n]|( )', line): in_table = False output += process_table(fname, table) if in_table: table += line else: output += line if in_table: in_table = False output += process_table(fname, table) return output fname = sys.argv[1] data = file(fname, 'rb').read().decode('utf-8') data = process_file(fname, data) file(fname, 'wb').write(data.encode('utf-8')) Signed-off-by: Laurent Pinchart --- Documentation/media/uapi/v4l/buffer.rst | 1329 +- Documentation/media/uapi/v4l/control.rst | 133 +- Documentation/media/uapi/v4l/dev-raw-vbi.rst | 235 +- Documentation/media/uapi/v4l/dev-rds.rst | 191 +- Documentation/media/uapi/v4l/dev-sdr.rst | 43 +- .../media/uapi/v4l/dev-sliced-vbi.rst | 704 +- Documentation/media/uapi/v4l/dev-subdev.rst | 114 +- Documentation/media/uapi/v4l/diff-v4l.rst | 674 +- .../media/uapi/v4l/extended-controls.rst | 2753 +-- Documentation/media/uapi/v4l/field-order.rst | 188 +- Documentation/media/uapi/v4l/hist-v4l2.rst | 231 +- Documentation/media/uapi/v4l/pixfmt-002.rst | 284 +- Documentation/media/uapi/v4l/pixfmt-003.rst | 195 +- Documentation/media/uapi/v4l/pixfmt-006.rst | 306 +- Documentation/media/uapi/v4l/pixfmt-007.rst | 495 +- Documentation/media/uapi/v4l/pixfmt-013.rst | 160 +- Documentation/media/uapi/v4l/pixfmt-grey.rst | 68 +- .../media/uapi/v4l/pixfmt-indexed.rst | 80 +- Documentation/media/uapi/v4l/pixfmt-m420.rst | 249 +- Documentation/media/uapi/v4l/pixfmt-nv12.rst | 248 +- Documentation/media/uapi/v4l/pixfmt-nv12m.rst | 255 +- Documentation/media/uapi/v4l/pixfmt-nv16.rst | 320 +- Documentation/media/uapi/v4l/pixfmt-nv16m.rst | 325 +- Documentation/media/uapi/v4l/pixfmt-nv24.rst | 183 +- .../media/uapi/v4l/pixfmt-packed-rgb.rst | 2134 +- .../media/uapi/v4l/pixfmt-packed-yuv.rst | 439 +- .../media/uapi/v4l/pixfmt-reserved.rst | 539 +- .../media/uapi/v4l/pixfmt-sbggr16.rst | 115 +- .../media/uapi/v4l/pixfmt-sdr-cs08.rst | 16 +- .../media/uapi/v4l/pixfmt-sdr-cs14le.rst | 21 +- .../media/uapi/v4l/pixfmt-sdr-cu08.rst | 15 +- .../media/uapi/v4l/pixfmt-sdr-cu16le.rst | 21 +- .../media/uapi/v4l/pixfmt-sdr-ru12le.rst | 11 +- .../media/uapi/v4l/pixfmt-srggb10.rst | 116 +- .../media/uapi/v4l/pixfmt-srggb10p.rst | 87 +- .../media/uapi/v4l/pixfmt-srggb12.rst | 116 +- .../media/uapi/v4l/pixfmt-srggb8.rst | 68 +- .../media/uapi/v4l/pixfmt-tch-td08.rst | 68 +- .../media/uapi/v4l/pixfmt-tch-td16.rst | 116 +- .../media/uapi/v4l/pixfmt-tch-tu08.rst | 68 +- .../media/uapi/v4l/pixfmt-tch-tu16.rst | 116 +- Documentation/media/uapi/v4l/pixfmt-uv8.rst | 68 +- Documentation/media/uapi/v4l/pixfmt-uyvy.rst | 228 +- Documentation/media/uapi/v4l/pixfmt-vyuy.rst | 228 +- Documentation/media/uapi/v4l/pixfmt-y10.rst | 116 +- Documentation/media/uapi/v4l/pixfmt-y10b.rst | 16 +- Documentation/media/uapi/v4l/pixfmt-y12.rst | 116 +- Documentation/media/uapi/v4l/pixfmt-y12i.rst | 11 +- .../media/uapi/v4l/pixfmt-y16-be.rst | 116 +- Documentation/media/uapi/v4l/pixfmt-y16.rst | 116 +- Documentation/media/uapi/v4l/pixfmt-y41p.rst | 336 +- Documentation/media/uapi/v4l/pixfmt-y8i.rst | 116 +- .../media/uapi/v4l/pixfmt-yuv410.rst | 228 +- .../media/uapi/v4l/pixfmt-yuv411p.rst | 230 +- .../media/uapi/v4l/pixfmt-yuv420.rst | 273 +- .../media/uapi/v4l/pixfmt-yuv420m.rst | 283 +- .../media/uapi/v4l/pixfmt-yuv422m.rst | 278 +- .../media/uapi/v4l/pixfmt-yuv422p.rst | 268 +- .../media/uapi/v4l/pixfmt-yuv444m.rst | 298 +- Documentation/media/uapi/v4l/pixfmt-yuyv.rst | 238 +- Documentation/media/uapi/v4l/pixfmt-yvyu.rst | 228 +- Documentation/media/uapi/v4l/pixfmt-z16.rst | 116 +- .../media/uapi/v4l/subdev-formats.rst | 18062 ++++++---------- .../media/uapi/v4l/v4l2-selection-flags.rst | 84 +- .../media/uapi/v4l/v4l2-selection-targets.rst | 171 +- .../media/uapi/v4l/vidioc-create-bufs.rst | 73 +- .../media/uapi/v4l/vidioc-cropcap.rst | 126 +- .../media/uapi/v4l/vidioc-dbg-g-chip-info.rst | 123 +- .../media/uapi/v4l/vidioc-dbg-g-register.rst | 117 +- .../media/uapi/v4l/vidioc-decoder-cmd.rst | 292 +- .../media/uapi/v4l/vidioc-dqevent.rst | 660 +- .../media/uapi/v4l/vidioc-dv-timings-cap.rst | 231 +- .../media/uapi/v4l/vidioc-encoder-cmd.rst | 134 +- .../media/uapi/v4l/vidioc-enum-dv-timings.rst | 50 +- .../media/uapi/v4l/vidioc-enum-fmt.rst | 130 +- .../uapi/v4l/vidioc-enum-frameintervals.rst | 184 +- .../media/uapi/v4l/vidioc-enum-framesizes.rst | 213 +- .../media/uapi/v4l/vidioc-enum-freq-bands.rst | 181 +- .../media/uapi/v4l/vidioc-enuminput.rst | 433 +- .../media/uapi/v4l/vidioc-enumoutput.rst | 204 +- .../media/uapi/v4l/vidioc-enumstd.rst | 288 +- .../media/uapi/v4l/vidioc-expbuf.rst | 90 +- .../media/uapi/v4l/vidioc-g-audio.rst | 102 +- .../media/uapi/v4l/vidioc-g-audioout.rst | 65 +- .../media/uapi/v4l/vidioc-g-crop.rst | 30 +- .../media/uapi/v4l/vidioc-g-ctrl.rst | 22 +- .../media/uapi/v4l/vidioc-g-dv-timings.rst | 465 +- .../media/uapi/v4l/vidioc-g-edid.rst | 73 +- .../media/uapi/v4l/vidioc-g-enc-index.rst | 167 +- .../media/uapi/v4l/vidioc-g-ext-ctrls.rst | 516 +- .../media/uapi/v4l/vidioc-g-fbuf.rst | 581 +- Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 128 +- .../media/uapi/v4l/vidioc-g-frequency.rst | 74 +- .../media/uapi/v4l/vidioc-g-jpegcomp.rst | 144 +- .../media/uapi/v4l/vidioc-g-modulator.rst | 260 +- .../media/uapi/v4l/vidioc-g-parm.rst | 362 +- .../media/uapi/v4l/vidioc-g-priority.rst | 73 +- .../media/uapi/v4l/vidioc-g-selection.rst | 63 +- .../uapi/v4l/vidioc-g-sliced-vbi-cap.rst | 300 +- .../media/uapi/v4l/vidioc-g-tuner.rst | 883 +- .../media/uapi/v4l/vidioc-querycap.rst | 541 +- .../media/uapi/v4l/vidioc-queryctrl.rst | 951 +- .../media/uapi/v4l/vidioc-reqbufs.rst | 54 +- .../media/uapi/v4l/vidioc-s-hw-freq-seek.rst | 132 +- .../v4l/vidioc-subdev-enum-frame-interval.rst | 94 +- .../v4l/vidioc-subdev-enum-frame-size.rst | 105 +- .../uapi/v4l/vidioc-subdev-enum-mbus-code.rst | 61 +- .../media/uapi/v4l/vidioc-subdev-g-crop.rst | 48 +- .../media/uapi/v4l/vidioc-subdev-g-fmt.rst | 72 +- .../v4l/vidioc-subdev-g-frame-interval.rst | 35 +- .../uapi/v4l/vidioc-subdev-g-selection.rst | 70 +- .../media/uapi/v4l/vidioc-subscribe-event.rst | 112 +- 112 files changed, 15269 insertions(+), 30896 deletions(-) diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index 21893ee1384a..ac58966ccb9b 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -48,236 +48,149 @@ struct v4l2_buffer :stub-columns: 0 :widths: 1 2 1 10 - - - .. row 1 - - - __u32 - - - ``index`` - - - - - Number of the buffer, set by the application except when calling - :ref:`VIDIOC_DQBUF `, then it is set by the - driver. This field can range from zero to the number of buffers - allocated with the :ref:`VIDIOC_REQBUFS` ioctl - (struct :c:type:`v4l2_requestbuffers` - ``count``), plus any buffers allocated with - :ref:`VIDIOC_CREATE_BUFS` minus one. - - - .. row 2 - - - __u32 - - - ``type`` - - - - - Type of the buffer, same as struct - :c:type:`v4l2_format` ``type`` or struct - :c:type:`v4l2_requestbuffers` ``type``, set - by the application. See :c:type:`v4l2_buf_type` - - - .. row 3 - - - __u32 - - - ``bytesused`` - - - - - The number of bytes occupied by the data in the buffer. It depends - on the negotiated data format and may change with each buffer for - compressed variable size data like JPEG images. Drivers must set - this field when ``type`` refers to a capture stream, applications - when it refers to an output stream. If the application sets this - to 0 for an output stream, then ``bytesused`` will be set to the - size of the buffer (see the ``length`` field of this struct) by - the driver. For multiplanar formats this field is ignored and the - ``planes`` pointer is used instead. - - - .. row 4 - - - __u32 - - - ``flags`` - - - - - Flags set by the application or driver, see :ref:`buffer-flags`. - - - .. row 5 - - - __u32 - - - ``field`` - - - - - Indicates the field order of the image in the buffer, see - :c:type:`v4l2_field`. This field is not used when the buffer - contains VBI data. Drivers must set it when ``type`` refers to a - capture stream, applications when it refers to an output stream. - - - .. row 6 - - - struct timeval - - - ``timestamp`` - - - - - For capture streams this is time when the first data byte was - captured, as returned by the :c:func:`clock_gettime()` function - for the relevant clock id; see ``V4L2_BUF_FLAG_TIMESTAMP_*`` in - :ref:`buffer-flags`. For output streams the driver stores the - time at which the last data byte was actually sent out in the - ``timestamp`` field. This permits applications to monitor the - drift between the video and system clock. For output streams that - use ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` the application has to fill - in the timestamp which will be copied by the driver to the capture - stream. - - - .. row 7 - - - struct :c:type:`v4l2_timecode` - - - ``timecode`` - - - - - When ``type`` is ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` and the - ``V4L2_BUF_FLAG_TIMECODE`` flag is set in ``flags``, this - structure contains a frame timecode. In - :c:type:`V4L2_FIELD_ALTERNATE ` mode the top and - bottom field contain the same timecode. Timecodes are intended to - help video editing and are typically recorded on video tapes, but - also embedded in compressed formats like MPEG. This field is - independent of the ``timestamp`` and ``sequence`` fields. - - - .. row 8 - - - __u32 - - - ``sequence`` - - - - - Set by the driver, counting the frames (not fields!) in sequence. - This field is set for both input and output devices. - - - .. row 9 - - - :cspan:`3` - - In :c:type:`V4L2_FIELD_ALTERNATE ` mode the top and - bottom field have the same sequence number. The count starts at - zero and includes dropped or repeated frames. A dropped frame was - received by an input device but could not be stored due to lack of - free buffer space. A repeated frame was displayed again by an - output device because the application did not pass new data in - time. - - .. note:: - - This may count the frames received e.g. over USB, without - taking into account the frames dropped by the remote hardware due - to limited compression throughput or bus bandwidth. These devices - identify by not enumerating any video standards, see - :ref:`standard`. - - - - .. row 10 - - - __u32 - - - ``memory`` - - - - - This field must be set by applications and/or drivers in - accordance with the selected I/O method. See :c:type:`v4l2_memory` - - - .. row 11 - - - union - - - ``m`` - - - .. row 12 - - - - - __u32 - - - ``offset`` - - - For the single-planar API and when ``memory`` is - ``V4L2_MEMORY_MMAP`` this is the offset of the buffer from the - start of the device memory. The value is returned by the driver - and apart of serving as parameter to the - :ref:`mmap() ` function not useful for applications. - See :ref:`mmap` for details - - - .. row 13 - - - - - unsigned long - - - ``userptr`` - - - For the single-planar API and when ``memory`` is - ``V4L2_MEMORY_USERPTR`` this is a pointer to the buffer (casted to - unsigned long type) in virtual memory, set by the application. See - :ref:`userp` for details. - - - .. row 14 - - - - - struct v4l2_plane - - - ``*planes`` - - - When using the multi-planar API, contains a userspace pointer to - an array of struct :c:type:`v4l2_plane`. The size of - the array should be put in the ``length`` field of this - struct :c:type:`v4l2_buffer` structure. - - - .. row 15 - - - - - int - - - ``fd`` - - - For the single-plane API and when ``memory`` is - ``V4L2_MEMORY_DMABUF`` this is the file descriptor associated with - a DMABUF buffer. - - - .. row 16 - - - __u32 - - - ``length`` - - - - - Size of the buffer (not the payload) in bytes for the - single-planar API. This is set by the driver based on the calls to - :ref:`VIDIOC_REQBUFS` and/or - :ref:`VIDIOC_CREATE_BUFS`. For the - multi-planar API the application sets this to the number of - elements in the ``planes`` array. The driver will fill in the - actual number of valid elements in that array. - - - .. row 17 - - - __u32 - - - ``reserved2`` - - - - - A place holder for future extensions. Drivers and applications - must set this to 0. - - - .. row 18 - - - __u32 - - - ``reserved`` - - - - - A place holder for future extensions. Drivers and applications - must set this to 0. + * - __u32 + - ``index`` + - + - Number of the buffer, set by the application except when calling + :ref:`VIDIOC_DQBUF `, then it is set by the + driver. This field can range from zero to the number of buffers + allocated with the :ref:`VIDIOC_REQBUFS` ioctl + (struct :c:type:`v4l2_requestbuffers` + ``count``), plus any buffers allocated with + :ref:`VIDIOC_CREATE_BUFS` minus one. + * - __u32 + - ``type`` + - + - Type of the buffer, same as struct + :c:type:`v4l2_format` ``type`` or struct + :c:type:`v4l2_requestbuffers` ``type``, set + by the application. See :c:type:`v4l2_buf_type` + * - __u32 + - ``bytesused`` + - + - The number of bytes occupied by the data in the buffer. It depends + on the negotiated data format and may change with each buffer for + compressed variable size data like JPEG images. Drivers must set + this field when ``type`` refers to a capture stream, applications + when it refers to an output stream. If the application sets this + to 0 for an output stream, then ``bytesused`` will be set to the + size of the buffer (see the ``length`` field of this struct) by + the driver. For multiplanar formats this field is ignored and the + ``planes`` pointer is used instead. + * - __u32 + - ``flags`` + - + - Flags set by the application or driver, see :ref:`buffer-flags`. + * - __u32 + - ``field`` + - + - Indicates the field order of the image in the buffer, see + :c:type:`v4l2_field`. This field is not used when the buffer + contains VBI data. Drivers must set it when ``type`` refers to a + capture stream, applications when it refers to an output stream. + * - struct timeval + - ``timestamp`` + - + - For capture streams this is time when the first data byte was + captured, as returned by the :c:func:`clock_gettime()` function + for the relevant clock id; see ``V4L2_BUF_FLAG_TIMESTAMP_*`` in + :ref:`buffer-flags`. For output streams the driver stores the + time at which the last data byte was actually sent out in the + ``timestamp`` field. This permits applications to monitor the + drift between the video and system clock. For output streams that + use ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` the application has to fill + in the timestamp which will be copied by the driver to the capture + stream. + * - struct :c:type:`v4l2_timecode` + - ``timecode`` + - + - When ``type`` is ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` and the + ``V4L2_BUF_FLAG_TIMECODE`` flag is set in ``flags``, this + structure contains a frame timecode. In + :c:type:`V4L2_FIELD_ALTERNATE ` mode the top and + bottom field contain the same timecode. Timecodes are intended to + help video editing and are typically recorded on video tapes, but + also embedded in compressed formats like MPEG. This field is + independent of the ``timestamp`` and ``sequence`` fields. + * - __u32 + - ``sequence`` + - + - Set by the driver, counting the frames (not fields!) in sequence. + This field is set for both input and output devices. + * - :cspan:`3` + + In :c:type:`V4L2_FIELD_ALTERNATE ` mode the top and + bottom field have the same sequence number. The count starts at + zero and includes dropped or repeated frames. A dropped frame was + received by an input device but could not be stored due to lack of + free buffer space. A repeated frame was displayed again by an + output device because the application did not pass new data in + time. + + .. note:: + + This may count the frames received e.g. over USB, without + taking into account the frames dropped by the remote hardware due + to limited compression throughput or bus bandwidth. These devices + identify by not enumerating any video standards, see + :ref:`standard`. + + * - __u32 + - ``memory`` + - + - This field must be set by applications and/or drivers in + accordance with the selected I/O method. See :c:type:`v4l2_memory` + * - union + - ``m`` + * - + - __u32 + - ``offset`` + - For the single-planar API and when ``memory`` is + ``V4L2_MEMORY_MMAP`` this is the offset of the buffer from the + start of the device memory. The value is returned by the driver + and apart of serving as parameter to the + :ref:`mmap() ` function not useful for applications. + See :ref:`mmap` for details + * - + - unsigned long + - ``userptr`` + - For the single-planar API and when ``memory`` is + ``V4L2_MEMORY_USERPTR`` this is a pointer to the buffer (casted to + unsigned long type) in virtual memory, set by the application. See + :ref:`userp` for details. + * - + - struct v4l2_plane + - ``*planes`` + - When using the multi-planar API, contains a userspace pointer to + an array of struct :c:type:`v4l2_plane`. The size of + the array should be put in the ``length`` field of this + struct :c:type:`v4l2_buffer` structure. + * - + - int + - ``fd`` + - For the single-plane API and when ``memory`` is + ``V4L2_MEMORY_DMABUF`` this is the file descriptor associated with + a DMABUF buffer. + * - __u32 + - ``length`` + - + - Size of the buffer (not the payload) in bytes for the + single-planar API. This is set by the driver based on the calls to + :ref:`VIDIOC_REQBUFS` and/or + :ref:`VIDIOC_CREATE_BUFS`. For the + multi-planar API the application sets this to the number of + elements in the ``planes`` array. The driver will fill in the + actual number of valid elements in that array. + * - __u32 + - ``reserved2`` + - + - A place holder for future extensions. Drivers and applications + must set this to 0. + * - __u32 + - ``reserved`` + - + - A place holder for future extensions. Drivers and applications + must set this to 0. @@ -295,110 +208,70 @@ struct v4l2_plane :stub-columns: 0 :widths: 1 1 1 2 + * - __u32 + - ``bytesused`` + - + - The number of bytes occupied by data in the plane (its payload). + Drivers must set this field when ``type`` refers to a capture + stream, applications when it refers to an output stream. If the + application sets this to 0 for an output stream, then + ``bytesused`` will be set to the size of the plane (see the + ``length`` field of this struct) by the driver. - - .. row 1 + .. note:: - - __u32 + Note that the actual image data starts at ``data_offset`` + which may not be 0. + * - __u32 + - ``length`` + - + - Size in bytes of the plane (not its payload). This is set by the + driver based on the calls to + :ref:`VIDIOC_REQBUFS` and/or + :ref:`VIDIOC_CREATE_BUFS`. + * - union + - ``m`` + - + - + * - + - __u32 + - ``mem_offset`` + - When the memory type in the containing struct + :c:type:`v4l2_buffer` is ``V4L2_MEMORY_MMAP``, this + is the value that should be passed to :ref:`mmap() `, + similar to the ``offset`` field in struct + :c:type:`v4l2_buffer`. + * - + - unsigned long + - ``userptr`` + - When the memory type in the containing struct + :c:type:`v4l2_buffer` is ``V4L2_MEMORY_USERPTR``, + this is a userspace pointer to the memory allocated for this plane + by an application. + * - + - int + - ``fd`` + - When the memory type in the containing struct + :c:type:`v4l2_buffer` is ``V4L2_MEMORY_DMABUF``, + this is a file descriptor associated with a DMABUF buffer, similar + to the ``fd`` field in struct :c:type:`v4l2_buffer`. + * - __u32 + - ``data_offset`` + - + - Offset in bytes to video data in the plane. Drivers must set this + field when ``type`` refers to a capture stream, applications when + it refers to an output stream. - - ``bytesused`` + .. note:: - - - - The number of bytes occupied by data in the plane (its payload). - Drivers must set this field when ``type`` refers to a capture - stream, applications when it refers to an output stream. If the - application sets this to 0 for an output stream, then - ``bytesused`` will be set to the size of the plane (see the - ``length`` field of this struct) by the driver. - - .. note:: - - Note that the actual image data starts at ``data_offset`` - which may not be 0. - - - .. row 2 - - - __u32 - - - ``length`` - - - - - Size in bytes of the plane (not its payload). This is set by the - driver based on the calls to - :ref:`VIDIOC_REQBUFS` and/or - :ref:`VIDIOC_CREATE_BUFS`. - - - .. row 3 - - - union - - - ``m`` - - - - - - - - .. row 4 - - - - - __u32 - - - ``mem_offset`` - - - When the memory type in the containing struct - :c:type:`v4l2_buffer` is ``V4L2_MEMORY_MMAP``, this - is the value that should be passed to :ref:`mmap() `, - similar to the ``offset`` field in struct - :c:type:`v4l2_buffer`. - - - .. row 5 - - - - - unsigned long - - - ``userptr`` - - - When the memory type in the containing struct - :c:type:`v4l2_buffer` is ``V4L2_MEMORY_USERPTR``, - this is a userspace pointer to the memory allocated for this plane - by an application. - - - .. row 6 - - - - - int - - - ``fd`` - - - When the memory type in the containing struct - :c:type:`v4l2_buffer` is ``V4L2_MEMORY_DMABUF``, - this is a file descriptor associated with a DMABUF buffer, similar - to the ``fd`` field in struct :c:type:`v4l2_buffer`. - - - .. row 7 - - - __u32 - - - ``data_offset`` - - - - - Offset in bytes to video data in the plane. Drivers must set this - field when ``type`` refers to a capture stream, applications when - it refers to an output stream. - - .. note:: - - That data_offset is included in ``bytesused``. So the - size of the image in the plane is ``bytesused``-``data_offset`` - at offset ``data_offset`` from the start of the plane. - - - .. row 8 - - - __u32 - - - ``reserved[11]`` - - - - - Reserved for future use. Should be zeroed by drivers and - applications. + That data_offset is included in ``bytesused``. So the + size of the image in the plane is ``bytesused``-``data_offset`` + at offset ``data_offset`` from the start of the plane. + * - __u32 + - ``reserved[11]`` + - + - Reserved for future use. Should be zeroed by drivers and + applications. @@ -416,107 +289,47 @@ enum v4l2_buf_type :stub-columns: 0 :widths: 4 1 9 - - - .. row 1 - - - ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` - - - 1 - - - Buffer of a single-planar video capture stream, see - :ref:`capture`. - - - .. row 2 - - - ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`` - - - 9 - - - Buffer of a multi-planar video capture stream, see - :ref:`capture`. - - - .. row 3 - - - ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` - - - 2 - - - Buffer of a single-planar video output stream, see - :ref:`output`. - - - .. row 4 - - - ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` - - - 10 - - - Buffer of a multi-planar video output stream, see :ref:`output`. - - - .. row 5 - - - ``V4L2_BUF_TYPE_VIDEO_OVERLAY`` - - - 3 - - - Buffer for video overlay, see :ref:`overlay`. - - - .. row 6 - - - ``V4L2_BUF_TYPE_VBI_CAPTURE`` - - - 4 - - - Buffer of a raw VBI capture stream, see :ref:`raw-vbi`. - - - .. row 7 - - - ``V4L2_BUF_TYPE_VBI_OUTPUT`` - - - 5 - - - Buffer of a raw VBI output stream, see :ref:`raw-vbi`. - - - .. row 8 - - - ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE`` - - - 6 - - - Buffer of a sliced VBI capture stream, see :ref:`sliced`. - - - .. row 9 - - - ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT`` - - - 7 - - - Buffer of a sliced VBI output stream, see :ref:`sliced`. - - - .. row 10 - - - ``V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY`` - - - 8 - - - Buffer for video output overlay (OSD), see :ref:`osd`. - - - .. row 11 - - - ``V4L2_BUF_TYPE_SDR_CAPTURE`` - - - 11 - - - Buffer for Software Defined Radio (SDR) capture stream, see - :ref:`sdr`. - - - .. row 12 - - - ``V4L2_BUF_TYPE_SDR_OUTPUT`` - - - 12 - - - Buffer for Software Defined Radio (SDR) output stream, see - :ref:`sdr`. + * - ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` + - 1 + - Buffer of a single-planar video capture stream, see + :ref:`capture`. + * - ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE`` + - 9 + - Buffer of a multi-planar video capture stream, see + :ref:`capture`. + * - ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` + - 2 + - Buffer of a single-planar video output stream, see + :ref:`output`. + * - ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` + - 10 + - Buffer of a multi-planar video output stream, see :ref:`output`. + * - ``V4L2_BUF_TYPE_VIDEO_OVERLAY`` + - 3 + - Buffer for video overlay, see :ref:`overlay`. + * - ``V4L2_BUF_TYPE_VBI_CAPTURE`` + - 4 + - Buffer of a raw VBI capture stream, see :ref:`raw-vbi`. + * - ``V4L2_BUF_TYPE_VBI_OUTPUT`` + - 5 + - Buffer of a raw VBI output stream, see :ref:`raw-vbi`. + * - ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE`` + - 6 + - Buffer of a sliced VBI capture stream, see :ref:`sliced`. + * - ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT`` + - 7 + - Buffer of a sliced VBI output stream, see :ref:`sliced`. + * - ``V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY`` + - 8 + - Buffer for video output overlay (OSD), see :ref:`osd`. + * - ``V4L2_BUF_TYPE_SDR_CAPTURE`` + - 11 + - Buffer for Software Defined Radio (SDR) capture stream, see + :ref:`sdr`. + * - ``V4L2_BUF_TYPE_SDR_OUTPUT`` + - 12 + - Buffer for Software Defined Radio (SDR) output stream, see + :ref:`sdr`. @@ -534,242 +347,185 @@ Buffer Flags :stub-columns: 0 :widths: 3 1 4 - - - .. _`V4L2-BUF-FLAG-MAPPED`: - - - ``V4L2_BUF_FLAG_MAPPED`` - - - 0x00000001 - - - The buffer resides in device memory and has been mapped into the - application's address space, see :ref:`mmap` for details. - Drivers set or clear this flag when the - :ref:`VIDIOC_QUERYBUF`, - :ref:`VIDIOC_QBUF` or - :ref:`VIDIOC_DQBUF ` ioctl is called. Set by the - driver. - - - .. _`V4L2-BUF-FLAG-QUEUED`: - - - ``V4L2_BUF_FLAG_QUEUED`` - - - 0x00000002 - - - Internally drivers maintain two buffer queues, an incoming and - outgoing queue. When this flag is set, the buffer is currently on - the incoming queue. It automatically moves to the outgoing queue - after the buffer has been filled (capture devices) or displayed - (output devices). Drivers set or clear this flag when the - ``VIDIOC_QUERYBUF`` ioctl is called. After (successful) calling - the ``VIDIOC_QBUF``\ ioctl it is always set and after - ``VIDIOC_DQBUF`` always cleared. - - - .. _`V4L2-BUF-FLAG-DONE`: - - - ``V4L2_BUF_FLAG_DONE`` - - - 0x00000004 - - - 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 ``VIDIOC_QUERYBUF`` ioctl is called. After - calling the ``VIDIOC_QBUF`` or ``VIDIOC_DQBUF`` it is always - cleared. Of course a buffer cannot be on both queues at the same - time, the ``V4L2_BUF_FLAG_QUEUED`` and ``V4L2_BUF_FLAG_DONE`` flag - are mutually exclusive. They can be both cleared however, then the - buffer is in "dequeued" state, in the application domain so to - say. - - - .. _`V4L2-BUF-FLAG-ERROR`: - - - ``V4L2_BUF_FLAG_ERROR`` - - - 0x00000040 - - - When this flag is set, the buffer has been dequeued successfully, - although the data might have been corrupted. This is recoverable, - streaming may continue as normal and the buffer may be reused - normally. Drivers set this flag when the ``VIDIOC_DQBUF`` ioctl is - called. - - - .. _`V4L2-BUF-FLAG-KEYFRAME`: - - - ``V4L2_BUF_FLAG_KEYFRAME`` - - - 0x00000008 - - - Drivers set or clear this flag when calling the ``VIDIOC_DQBUF`` - ioctl. It may be set by video capture devices when the buffer - contains a compressed image which is a key frame (or field), i. e. - can be decompressed on its own. Also known as an I-frame. - Applications can set this bit when ``type`` refers to an output - stream. - - - .. _`V4L2-BUF-FLAG-PFRAME`: - - - ``V4L2_BUF_FLAG_PFRAME`` - - - 0x00000010 - - - Similar to ``V4L2_BUF_FLAG_KEYFRAME`` this flags predicted frames - or fields which contain only differences to a previous key frame. - Applications can set this bit when ``type`` refers to an output - stream. - - - .. _`V4L2-BUF-FLAG-BFRAME`: - - - ``V4L2_BUF_FLAG_BFRAME`` - - - 0x00000020 - - - Similar to ``V4L2_BUF_FLAG_KEYFRAME`` 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 - ``type`` refers to an output stream. - - - .. _`V4L2-BUF-FLAG-TIMECODE`: - - - ``V4L2_BUF_FLAG_TIMECODE`` - - - 0x00000100 - - - The ``timecode`` field is valid. Drivers set or clear this flag - when the ``VIDIOC_DQBUF`` ioctl is called. Applications can set - this bit and the corresponding ``timecode`` structure when - ``type`` refers to an output stream. - - - .. _`V4L2-BUF-FLAG-PREPARED`: - - - ``V4L2_BUF_FLAG_PREPARED`` - - - 0x00000400 - - - The buffer has been prepared for I/O and can be queued by the - application. Drivers set or clear this flag when the - :ref:`VIDIOC_QUERYBUF`, - :ref:`VIDIOC_PREPARE_BUF `, - :ref:`VIDIOC_QBUF` or - :ref:`VIDIOC_DQBUF ` ioctl is called. - - - .. _`V4L2-BUF-FLAG-NO-CACHE-INVALIDATE`: - - - ``V4L2_BUF_FLAG_NO_CACHE_INVALIDATE`` - - - 0x00000800 - - - 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 passed on to a DMA-capable hardware unit for - further processing or output. - - - .. _`V4L2-BUF-FLAG-NO-CACHE-CLEAN`: - - - ``V4L2_BUF_FLAG_NO_CACHE_CLEAN`` - - - 0x00001000 - - - 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, in which case caches have not been used. - - - .. _`V4L2-BUF-FLAG-LAST`: - - - ``V4L2_BUF_FLAG_LAST`` - - - 0x00100000 - - - Last buffer produced by the hardware. mem2mem codec drivers set - this flag on the capture queue for the last buffer when the - :ref:`VIDIOC_QUERYBUF` or - :ref:`VIDIOC_DQBUF ` ioctl is called. Due to - hardware limitations, the last buffer may be empty. In this case - the driver will set the ``bytesused`` field to 0, regardless of - the format. Any Any subsequent call to the - :ref:`VIDIOC_DQBUF ` ioctl will not block anymore, - but return an ``EPIPE`` error code. - - - .. _`V4L2-BUF-FLAG-TIMESTAMP-MASK`: - - - ``V4L2_BUF_FLAG_TIMESTAMP_MASK`` - - - 0x0000e000 - - - 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 flags and timestamp mask. - - - .. _`V4L2-BUF-FLAG-TIMESTAMP-UNKNOWN`: - - - ``V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN`` - - - 0x00000000 - - - 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 favoured in embedded systems - whereas most of the drivers use the realtime clock. Either kinds - of timestamps are available in user space via - :c:func:`clock_gettime` using clock IDs ``CLOCK_MONOTONIC`` - and ``CLOCK_REALTIME``, respectively. - - - .. _`V4L2-BUF-FLAG-TIMESTAMP-MONOTONIC`: - - - ``V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC`` - - - 0x00002000 - - - The buffer timestamp has been taken from the ``CLOCK_MONOTONIC`` - clock. To access the same clock outside V4L2, use - :c:func:`clock_gettime`. - - - .. _`V4L2-BUF-FLAG-TIMESTAMP-COPY`: - - - ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` - - - 0x00004000 - - - The CAPTURE buffer timestamp has been taken from the corresponding - OUTPUT buffer. This flag applies only to mem2mem devices. - - - .. _`V4L2-BUF-FLAG-TSTAMP-SRC-MASK`: - - - ``V4L2_BUF_FLAG_TSTAMP_SRC_MASK`` - - - 0x00070000 - - - 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 ``flags`` field and - ``V4L2_BUF_FLAG_TSTAMP_SRC_MASK`` produces the value of the - timestamp source. Applications must set the timestamp source when - ``type`` refers to an output stream and - ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` is set. - - - .. _`V4L2-BUF-FLAG-TSTAMP-SRC-EOF`: - - - ``V4L2_BUF_FLAG_TSTAMP_SRC_EOF`` - - - 0x00000000 - - - 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. - - - .. _`V4L2-BUF-FLAG-TSTAMP-SRC-SOE`: - - - ``V4L2_BUF_FLAG_TSTAMP_SRC_SOE`` - - - 0x00010000 - - - Start Of Exposure. The buffer timestamp has been taken when the - exposure of the frame has begun. This is only valid for the - ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` buffer type. + * .. _`V4L2-BUF-FLAG-MAPPED`: + + - ``V4L2_BUF_FLAG_MAPPED`` + - 0x00000001 + - The buffer resides in device memory and has been mapped into the + application's address space, see :ref:`mmap` for details. + Drivers set or clear this flag when the + :ref:`VIDIOC_QUERYBUF`, + :ref:`VIDIOC_QBUF` or + :ref:`VIDIOC_DQBUF ` ioctl is called. Set by the + driver. + * .. _`V4L2-BUF-FLAG-QUEUED`: + + - ``V4L2_BUF_FLAG_QUEUED`` + - 0x00000002 + - Internally drivers maintain two buffer queues, an incoming and + outgoing queue. When this flag is set, the buffer is currently on + the incoming queue. It automatically moves to the outgoing queue + after the buffer has been filled (capture devices) or displayed + (output devices). Drivers set or clear this flag when the + ``VIDIOC_QUERYBUF`` ioctl is called. After (successful) calling + the ``VIDIOC_QBUF``\ ioctl it is always set and after + ``VIDIOC_DQBUF`` always cleared. + * .. _`V4L2-BUF-FLAG-DONE`: + + - ``V4L2_BUF_FLAG_DONE`` + - 0x00000004 + - 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 ``VIDIOC_QUERYBUF`` ioctl is called. After + calling the ``VIDIOC_QBUF`` or ``VIDIOC_DQBUF`` it is always + cleared. Of course a buffer cannot be on both queues at the same + time, the ``V4L2_BUF_FLAG_QUEUED`` and ``V4L2_BUF_FLAG_DONE`` flag + are mutually exclusive. They can be both cleared however, then the + buffer is in "dequeued" state, in the application domain so to + say. + * .. _`V4L2-BUF-FLAG-ERROR`: + + - ``V4L2_BUF_FLAG_ERROR`` + - 0x00000040 + - When this flag is set, the buffer has been dequeued successfully, + although the data might have been corrupted. This is recoverable, + streaming may continue as normal and the buffer may be reused + normally. Drivers set this flag when the ``VIDIOC_DQBUF`` ioctl is + called. + * .. _`V4L2-BUF-FLAG-KEYFRAME`: + + - ``V4L2_BUF_FLAG_KEYFRAME`` + - 0x00000008 + - Drivers set or clear this flag when calling the ``VIDIOC_DQBUF`` + ioctl. It may be set by video capture devices when the buffer + contains a compressed image which is a key frame (or field), i. e. + can be decompressed on its own. Also known as an I-frame. + Applications can set this bit when ``type`` refers to an output + stream. + * .. _`V4L2-BUF-FLAG-PFRAME`: + + - ``V4L2_BUF_FLAG_PFRAME`` + - 0x00000010 + - Similar to ``V4L2_BUF_FLAG_KEYFRAME`` this flags predicted frames + or fields which contain only differences to a previous key frame. + Applications can set this bit when ``type`` refers to an output + stream. + * .. _`V4L2-BUF-FLAG-BFRAME`: + + - ``V4L2_BUF_FLAG_BFRAME`` + - 0x00000020 + - Similar to ``V4L2_BUF_FLAG_KEYFRAME`` 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 + ``type`` refers to an output stream. + * .. _`V4L2-BUF-FLAG-TIMECODE`: + + - ``V4L2_BUF_FLAG_TIMECODE`` + - 0x00000100 + - The ``timecode`` field is valid. Drivers set or clear this flag + when the ``VIDIOC_DQBUF`` ioctl is called. Applications can set + this bit and the corresponding ``timecode`` structure when + ``type`` refers to an output stream. + * .. _`V4L2-BUF-FLAG-PREPARED`: + + - ``V4L2_BUF_FLAG_PREPARED`` + - 0x00000400 + - The buffer has been prepared for I/O and can be queued by the + application. Drivers set or clear this flag when the + :ref:`VIDIOC_QUERYBUF`, + :ref:`VIDIOC_PREPARE_BUF `, + :ref:`VIDIOC_QBUF` or + :ref:`VIDIOC_DQBUF ` ioctl is called. + * .. _`V4L2-BUF-FLAG-NO-CACHE-INVALIDATE`: + + - ``V4L2_BUF_FLAG_NO_CACHE_INVALIDATE`` + - 0x00000800 + - 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 passed on to a DMA-capable hardware unit for + further processing or output. + * .. _`V4L2-BUF-FLAG-NO-CACHE-CLEAN`: + + - ``V4L2_BUF_FLAG_NO_CACHE_CLEAN`` + - 0x00001000 + - 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, in which case caches have not been used. + * .. _`V4L2-BUF-FLAG-LAST`: + + - ``V4L2_BUF_FLAG_LAST`` + - 0x00100000 + - Last buffer produced by the hardware. mem2mem codec drivers set + this flag on the capture queue for the last buffer when the + :ref:`VIDIOC_QUERYBUF` or + :ref:`VIDIOC_DQBUF ` ioctl is called. Due to + hardware limitations, the last buffer may be empty. In this case + the driver will set the ``bytesused`` field to 0, regardless of + the format. Any Any subsequent call to the + :ref:`VIDIOC_DQBUF ` ioctl will not block anymore, + but return an ``EPIPE`` error code. + * .. _`V4L2-BUF-FLAG-TIMESTAMP-MASK`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_MASK`` + - 0x0000e000 + - 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 flags and timestamp mask. + * .. _`V4L2-BUF-FLAG-TIMESTAMP-UNKNOWN`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN`` + - 0x00000000 + - 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 favoured in embedded systems + whereas most of the drivers use the realtime clock. Either kinds + of timestamps are available in user space via + :c:func:`clock_gettime` using clock IDs ``CLOCK_MONOTONIC`` + and ``CLOCK_REALTIME``, respectively. + * .. _`V4L2-BUF-FLAG-TIMESTAMP-MONOTONIC`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC`` + - 0x00002000 + - The buffer timestamp has been taken from the ``CLOCK_MONOTONIC`` + clock. To access the same clock outside V4L2, use + :c:func:`clock_gettime`. + * .. _`V4L2-BUF-FLAG-TIMESTAMP-COPY`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` + - 0x00004000 + - The CAPTURE buffer timestamp has been taken from the corresponding + OUTPUT buffer. This flag applies only to mem2mem devices. + * .. _`V4L2-BUF-FLAG-TSTAMP-SRC-MASK`: + + - ``V4L2_BUF_FLAG_TSTAMP_SRC_MASK`` + - 0x00070000 + - 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 ``flags`` field and + ``V4L2_BUF_FLAG_TSTAMP_SRC_MASK`` produces the value of the + timestamp source. Applications must set the timestamp source when + ``type`` refers to an output stream and + ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` is set. + * .. _`V4L2-BUF-FLAG-TSTAMP-SRC-EOF`: + + - ``V4L2_BUF_FLAG_TSTAMP_SRC_EOF`` + - 0x00000000 + - 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. + * .. _`V4L2-BUF-FLAG-TSTAMP-SRC-SOE`: + + - ``V4L2_BUF_FLAG_TSTAMP_SRC_SOE`` + - 0x00010000 + - Start Of Exposure. The buffer timestamp has been taken when the + exposure of the frame has begun. This is only valid for the + ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` buffer type. @@ -785,38 +541,18 @@ enum v4l2_memory :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_MEMORY_MMAP`` - - - 1 - - - The buffer is used for :ref:`memory mapping ` I/O. - - - .. row 2 - - - ``V4L2_MEMORY_USERPTR`` - - - 2 - - - The buffer is used for :ref:`user pointer ` I/O. - - - .. row 3 - - - ``V4L2_MEMORY_OVERLAY`` - - - 3 - - - [to do] - - - .. row 4 - - - ``V4L2_MEMORY_DMABUF`` - - - 4 - - - The buffer is used for :ref:`DMA shared buffer ` I/O. + * - ``V4L2_MEMORY_MMAP`` + - 1 + - The buffer is used for :ref:`memory mapping ` I/O. + * - ``V4L2_MEMORY_USERPTR`` + - 2 + - The buffer is used for :ref:`user pointer ` I/O. + * - ``V4L2_MEMORY_OVERLAY`` + - 3 + - [to do] + * - ``V4L2_MEMORY_DMABUF`` + - 4 + - The buffer is used for :ref:`DMA shared buffer ` I/O. @@ -841,63 +577,28 @@ struct v4l2_timecode :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``type`` - - - Frame rate the timecodes are based on, see :ref:`timecode-type`. - - - .. row 2 - - - __u32 - - - ``flags`` - - - Timecode flags, see :ref:`timecode-flags`. - - - .. row 3 - - - __u8 - - - ``frames`` - - - Frame count, 0 ... 23/24/29/49/59, depending on the type of - timecode. - - - .. row 4 - - - __u8 - - - ``seconds`` - - - Seconds count, 0 ... 59. This is a binary, not BCD number. - - - .. row 5 - - - __u8 - - - ``minutes`` - - - Minutes count, 0 ... 59. This is a binary, not BCD number. - - - .. row 6 - - - __u8 - - - ``hours`` - - - Hours count, 0 ... 29. This is a binary, not BCD number. - - - .. row 7 - - - __u8 - - - ``userbits``\ [4] - - - The "user group" bits from the timecode. + * - __u32 + - ``type`` + - Frame rate the timecodes are based on, see :ref:`timecode-type`. + * - __u32 + - ``flags`` + - Timecode flags, see :ref:`timecode-flags`. + * - __u8 + - ``frames`` + - Frame count, 0 ... 23/24/29/49/59, depending on the type of + timecode. + * - __u8 + - ``seconds`` + - Seconds count, 0 ... 59. This is a binary, not BCD number. + * - __u8 + - ``minutes`` + - Minutes count, 0 ... 59. This is a binary, not BCD number. + * - __u8 + - ``hours`` + - Hours count, 0 ... 29. This is a binary, not BCD number. + * - __u8 + - ``userbits``\ [4] + - The "user group" bits from the timecode. @@ -913,46 +614,21 @@ Timecode Types :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_TC_TYPE_24FPS`` - - - 1 - - - 24 frames per second, i. e. film. - - - .. row 2 - - - ``V4L2_TC_TYPE_25FPS`` - - - 2 - - - 25 frames per second, i. e. PAL or SECAM video. - - - .. row 3 - - - ``V4L2_TC_TYPE_30FPS`` - - - 3 - - - 30 frames per second, i. e. NTSC video. - - - .. row 4 - - - ``V4L2_TC_TYPE_50FPS`` - - - 4 - - - - - - .. row 5 - - - ``V4L2_TC_TYPE_60FPS`` - - - 5 - - - + * - ``V4L2_TC_TYPE_24FPS`` + - 1 + - 24 frames per second, i. e. film. + * - ``V4L2_TC_TYPE_25FPS`` + - 2 + - 25 frames per second, i. e. PAL or SECAM video. + * - ``V4L2_TC_TYPE_30FPS`` + - 3 + - 30 frames per second, i. e. NTSC video. + * - ``V4L2_TC_TYPE_50FPS`` + - 4 + - + * - ``V4L2_TC_TYPE_60FPS`` + - 5 + - @@ -968,46 +644,21 @@ Timecode Flags :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_TC_FLAG_DROPFRAME`` - - - 0x0001 - - - Indicates "drop frame" semantics for counting frames in 29.97 fps - material. When set, frame numbers 0 and 1 at the start of each - minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the - count. - - - .. row 2 - - - ``V4L2_TC_FLAG_COLORFRAME`` - - - 0x0002 - - - The "color frame" flag. - - - .. row 3 - - - ``V4L2_TC_USERBITS_field`` - - - 0x000C - - - Field mask for the "binary group flags". - - - .. row 4 - - - ``V4L2_TC_USERBITS_USERDEFINED`` - - - 0x0000 - - - Unspecified format. - - - .. row 5 - - - ``V4L2_TC_USERBITS_8BITCHARS`` - - - 0x0008 - - - 8-bit ISO characters. + * - ``V4L2_TC_FLAG_DROPFRAME`` + - 0x0001 + - Indicates "drop frame" semantics for counting frames in 29.97 fps + material. When set, frame numbers 0 and 1 at the start of each + minute, except minutes 0, 10, 20, 30, 40, 50 are omitted from the + count. + * - ``V4L2_TC_FLAG_COLORFRAME`` + - 0x0002 + - The "color frame" flag. + * - ``V4L2_TC_USERBITS_field`` + - 0x000C + - Field mask for the "binary group flags". + * - ``V4L2_TC_USERBITS_USERDEFINED`` + - 0x0000 + - Unspecified format. + * - ``V4L2_TC_USERBITS_8BITCHARS`` + - 0x0008 + - 8-bit ISO characters. diff --git a/Documentation/media/uapi/v4l/control.rst b/Documentation/media/uapi/v4l/control.rst index e881cd1f30d6..d3f1450c4b08 100644 --- a/Documentation/media/uapi/v4l/control.rst +++ b/Documentation/media/uapi/v4l/control.rst @@ -198,104 +198,41 @@ Control IDs :stub-columns: 0 :widths: 11 24 - - .. row 1 - - - ``V4L2_COLORFX_NONE`` - - - Color effect is disabled. - - - .. row 2 - - - ``V4L2_COLORFX_ANTIQUE`` - - - An aging (old photo) effect. - - - .. row 3 - - - ``V4L2_COLORFX_ART_FREEZE`` - - - Frost color effect. - - - .. row 4 - - - ``V4L2_COLORFX_AQUA`` - - - Water color, cool tone. - - - .. row 5 - - - ``V4L2_COLORFX_BW`` - - - Black and white. - - - .. row 6 - - - ``V4L2_COLORFX_EMBOSS`` - - - Emboss, the highlights and shadows replace light/dark boundaries - and low contrast areas are set to a gray background. - - - .. row 7 - - - ``V4L2_COLORFX_GRASS_GREEN`` - - - Grass green. - - - .. row 8 - - - ``V4L2_COLORFX_NEGATIVE`` - - - Negative. - - - .. row 9 - - - ``V4L2_COLORFX_SEPIA`` - - - Sepia tone. - - - .. row 10 - - - ``V4L2_COLORFX_SKETCH`` - - - Sketch. - - - .. row 11 - - - ``V4L2_COLORFX_SKIN_WHITEN`` - - - Skin whiten. - - - .. row 12 - - - ``V4L2_COLORFX_SKY_BLUE`` - - - Sky blue. - - - .. row 13 - - - ``V4L2_COLORFX_SOLARIZATION`` - - - Solarization, the image is partially reversed in tone, only color - values above or below a certain threshold are inverted. - - - .. row 14 - - - ``V4L2_COLORFX_SILHOUETTE`` - - - Silhouette (outline). - - - .. row 15 - - - ``V4L2_COLORFX_VIVID`` - - - Vivid colors. - - - .. row 16 - - - ``V4L2_COLORFX_SET_CBCR`` - - - The Cb and Cr chroma components are replaced by fixed coefficients - determined by ``V4L2_CID_COLORFX_CBCR`` control. + * - ``V4L2_COLORFX_NONE`` + - Color effect is disabled. + * - ``V4L2_COLORFX_ANTIQUE`` + - An aging (old photo) effect. + * - ``V4L2_COLORFX_ART_FREEZE`` + - Frost color effect. + * - ``V4L2_COLORFX_AQUA`` + - Water color, cool tone. + * - ``V4L2_COLORFX_BW`` + - Black and white. + * - ``V4L2_COLORFX_EMBOSS`` + - Emboss, the highlights and shadows replace light/dark boundaries + and low contrast areas are set to a gray background. + * - ``V4L2_COLORFX_GRASS_GREEN`` + - Grass green. + * - ``V4L2_COLORFX_NEGATIVE`` + - Negative. + * - ``V4L2_COLORFX_SEPIA`` + - Sepia tone. + * - ``V4L2_COLORFX_SKETCH`` + - Sketch. + * - ``V4L2_COLORFX_SKIN_WHITEN`` + - Skin whiten. + * - ``V4L2_COLORFX_SKY_BLUE`` + - Sky blue. + * - ``V4L2_COLORFX_SOLARIZATION`` + - Solarization, the image is partially reversed in tone, only color + values above or below a certain threshold are inverted. + * - ``V4L2_COLORFX_SILHOUETTE`` + - Silhouette (outline). + * - ``V4L2_COLORFX_VIVID`` + - Vivid colors. + * - ``V4L2_COLORFX_SET_CBCR`` + - The Cb and Cr chroma components are replaced by fixed coefficients + determined by ``V4L2_CID_COLORFX_CBCR`` control. diff --git a/Documentation/media/uapi/v4l/dev-raw-vbi.rst b/Documentation/media/uapi/v4l/dev-raw-vbi.rst index 26ec24a94103..b82d837e4ff1 100644 --- a/Documentation/media/uapi/v4l/dev-raw-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-raw-vbi.rst @@ -110,120 +110,77 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``sampling_rate`` + - Samples per second, i. e. unit 1 Hz. + * - __u32 + - ``offset`` + - Horizontal offset of the VBI image, relative to the leading edge + of the line synchronization pulse and counted in samples: The + first sample in the VBI image will be located ``offset`` / + ``sampling_rate`` seconds following the leading edge. See also + :ref:`vbi-hsync`. + * - __u32 + - ``samples_per_line`` + - + * - __u32 + - ``sample_format`` + - Defines the sample format as in :ref:`pixfmt`, a + four-character-code. [#f2]_ Usually this is ``V4L2_PIX_FMT_GREY``, + i. e. each sample consists of 8 bits with lower values oriented + towards the black level. Do not assume any other correlation of + values with the signal level. For example, the MSB does not + necessarily indicate if the signal is 'high' or 'low' because 128 + may not be the mean value of the signal. Drivers shall not convert + the sample format by software. + * - __u32 + - ``start``\ [#f2]_ + - This is the scanning system line number associated with the first + line of the VBI image, of the first and the second field + respectively. See :ref:`vbi-525` and :ref:`vbi-625` for valid + values. The ``V4L2_VBI_ITU_525_F1_START``, + ``V4L2_VBI_ITU_525_F2_START``, ``V4L2_VBI_ITU_625_F1_START`` and + ``V4L2_VBI_ITU_625_F2_START`` defines give the start line numbers + for each field for each 525 or 625 line format as a convenience. + Don't forget that ITU line numbering starts at 1, not 0. VBI input + drivers can return start values 0 if the hardware cannot reliable + identify scanning lines, VBI acquisition may not require this + information. + * - __u32 + - ``count``\ [#f2]_ + - The number of lines in the first and second field image, + respectively. + * - :cspan:`2` - - .. row 1 + Drivers should be as flexibility as possible. For example, it may + be possible to extend or move the VBI capture window down to the + picture area, implementing a 'full field mode' to capture data + service transmissions embedded in the picture. - - __u32 + An application can set the first or second ``count`` value to zero + if no data is required from the respective field; ``count``\ [1] + if the scanning system is progressive, i. e. not interlaced. The + corresponding start value shall be ignored by the application and + driver. Anyway, drivers may not support single field capturing and + return both count values non-zero. - - ``sampling_rate`` + Both ``count`` values set to zero, or line numbers are outside the + bounds depicted\ [#f4]_, or a field image covering lines of two + fields, are invalid and shall not be returned by the driver. - - Samples per second, i. e. unit 1 Hz. - - - .. row 2 - - - __u32 - - - ``offset`` - - - Horizontal offset of the VBI image, relative to the leading edge - of the line synchronization pulse and counted in samples: The - first sample in the VBI image will be located ``offset`` / - ``sampling_rate`` seconds following the leading edge. See also - :ref:`vbi-hsync`. - - - .. row 3 - - - __u32 - - - ``samples_per_line`` - - - - - - .. row 4 - - - __u32 - - - ``sample_format`` - - - Defines the sample format as in :ref:`pixfmt`, a - four-character-code. [#f2]_ Usually this is ``V4L2_PIX_FMT_GREY``, - i. e. each sample consists of 8 bits with lower values oriented - towards the black level. Do not assume any other correlation of - values with the signal level. For example, the MSB does not - necessarily indicate if the signal is 'high' or 'low' because 128 - may not be the mean value of the signal. Drivers shall not convert - the sample format by software. - - - .. row 5 - - - __u32 - - - ``start``\ [#f2]_ - - - This is the scanning system line number associated with the first - line of the VBI image, of the first and the second field - respectively. See :ref:`vbi-525` and :ref:`vbi-625` for valid - values. The ``V4L2_VBI_ITU_525_F1_START``, - ``V4L2_VBI_ITU_525_F2_START``, ``V4L2_VBI_ITU_625_F1_START`` and - ``V4L2_VBI_ITU_625_F2_START`` defines give the start line numbers - for each field for each 525 or 625 line format as a convenience. - Don't forget that ITU line numbering starts at 1, not 0. VBI input - drivers can return start values 0 if the hardware cannot reliable - identify scanning lines, VBI acquisition may not require this - information. - - - .. row 6 - - - __u32 - - - ``count``\ [#f2]_ - - - The number of lines in the first and second field image, - respectively. - - - .. row 7 - - - :cspan:`2` - - Drivers should be as flexibility as possible. For example, it may - be possible to extend or move the VBI capture window down to the - picture area, implementing a 'full field mode' to capture data - service transmissions embedded in the picture. - - An application can set the first or second ``count`` value to zero - if no data is required from the respective field; ``count``\ [1] - if the scanning system is progressive, i. e. not interlaced. The - corresponding start value shall be ignored by the application and - driver. Anyway, drivers may not support single field capturing and - return both count values non-zero. - - Both ``count`` values set to zero, or line numbers are outside the - bounds depicted\ [#f4]_, or a field image covering lines of two - fields, are invalid and shall not be returned by the driver. - - To initialize the ``start`` and ``count`` fields, applications - must first determine the current video standard selection. The - :ref:`v4l2_std_id ` or the ``framelines`` field - of struct :c:type:`v4l2_standard` can be evaluated - for this purpose. - - - .. row 8 - - - __u32 - - - ``flags`` - - - See :ref:`vbifmt-flags` below. Currently only drivers set flags, - applications must set this field to zero. - - - .. row 9 - - - __u32 - - - ``reserved``\ [#f2]_ - - - This array is reserved for future extensions. Drivers and - applications must set it to zero. + To initialize the ``start`` and ``count`` fields, applications + must first determine the current video standard selection. The + :ref:`v4l2_std_id ` or the ``framelines`` field + of struct :c:type:`v4l2_standard` can be evaluated + for this purpose. + * - __u32 + - ``flags`` + - See :ref:`vbifmt-flags` below. Currently only drivers set flags, + applications must set this field to zero. + * - __u32 + - ``reserved``\ [#f2]_ + - This array is reserved for future extensions. Drivers and + applications must set it to zero. .. tabularcolumns:: |p{4.0cm}|p{1.5cm}|p{12.0cm}| @@ -235,40 +192,30 @@ and always returns default parameters as :ref:`VIDIOC_G_FMT ` does :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_VBI_UNSYNC`` - - - 0x0001 - - - This flag indicates hardware which does not properly distinguish - between fields. Normally the VBI image stores the first field - (lower scanning line numbers) first in memory. This may be a top - or bottom field depending on the video standard. When this flag is - set the first or second field may be stored first, however the - fields are still in correct temporal order with the older field - first in memory. [#f3]_ - - - .. row 2 - - - ``V4L2_VBI_INTERLACED`` - - - 0x0002 - - - By default the two field images will be passed sequentially; all - lines of the first field followed by all lines of the second field - (compare :ref:`field-order` ``V4L2_FIELD_SEQ_TB`` and - ``V4L2_FIELD_SEQ_BT``, whether the top or bottom field is first in - memory depends on the video standard). When this flag is set, the - two fields are interlaced (cf. ``V4L2_FIELD_INTERLACED``). The - first line of the first field followed by the first line of the - second field, then the two second lines, and so on. Such a layout - may be necessary when the hardware has been programmed to capture - or output interlaced video images and is unable to separate the - fields for VBI capturing at the same time. For simplicity setting - this flag implies that both ``count`` values are equal and - non-zero. + * - ``V4L2_VBI_UNSYNC`` + - 0x0001 + - This flag indicates hardware which does not properly distinguish + between fields. Normally the VBI image stores the first field + (lower scanning line numbers) first in memory. This may be a top + or bottom field depending on the video standard. When this flag is + set the first or second field may be stored first, however the + fields are still in correct temporal order with the older field + first in memory. [#f3]_ + * - ``V4L2_VBI_INTERLACED`` + - 0x0002 + - By default the two field images will be passed sequentially; all + lines of the first field followed by all lines of the second field + (compare :ref:`field-order` ``V4L2_FIELD_SEQ_TB`` and + ``V4L2_FIELD_SEQ_BT``, whether the top or bottom field is first in + memory depends on the video standard). When this flag is set, the + two fields are interlaced (cf. ``V4L2_FIELD_INTERLACED``). The + first line of the first field followed by the first line of the + second field, then the two second lines, and so on. Such a layout + may be necessary when the hardware has been programmed to capture + or output interlaced video images and is unable to separate the + fields for VBI capturing at the same time. For simplicity setting + this flag implies that both ``count`` values are equal and + non-zero. diff --git a/Documentation/media/uapi/v4l/dev-rds.rst b/Documentation/media/uapi/v4l/dev-rds.rst index 4a8e1d2efd06..9c4e39dd66bd 100644 --- a/Documentation/media/uapi/v4l/dev-rds.rst +++ b/Documentation/media/uapi/v4l/dev-rds.rst @@ -102,30 +102,15 @@ RDS datastructures :stub-columns: 0 :widths: 1 1 5 - - - .. row 1 - - - __u8 - - - ``lsb`` - - - Least Significant Byte of RDS Block - - - .. row 2 - - - __u8 - - - ``msb`` - - - Most Significant Byte of RDS Block - - - .. row 3 - - - __u8 - - - ``block`` - - - Block description + * - __u8 + - ``lsb`` + - Least Significant Byte of RDS Block + * - __u8 + - ``msb`` + - Most Significant Byte of RDS Block + * - __u8 + - ``block`` + - Block description @@ -138,33 +123,17 @@ RDS datastructures :stub-columns: 0 :widths: 1 5 - - - .. row 1 - - - Bits 0-2 - - - Block (aka offset) of the received data. - - - .. row 2 - - - Bits 3-5 - - - Deprecated. Currently identical to bits 0-2. Do not use these - bits. - - - .. row 3 - - - Bit 6 - - - Corrected bit. Indicates that an error was corrected for this data - block. - - - .. row 4 - - - Bit 7 - - - Error bit. Indicates that an uncorrectable error occurred during - reception of this block. + * - Bits 0-2 + - Block (aka offset) of the received data. + * - Bits 3-5 + - Deprecated. Currently identical to bits 0-2. Do not use these + bits. + * - Bit 6 + - Corrected bit. Indicates that an error was corrected for this data + block. + * - Bit 7 + - Error bit. Indicates that an uncorrectable error occurred during + reception of this block. @@ -177,87 +146,39 @@ RDS datastructures :stub-columns: 0 :widths: 1 1 1 5 - - - .. row 1 - - - V4L2_RDS_BLOCK_MSK - - - - - 7 - - - Mask for bits 0-2 to get the block ID. - - - .. row 2 - - - V4L2_RDS_BLOCK_A - - - - - 0 - - - Block A. - - - .. row 3 - - - V4L2_RDS_BLOCK_B - - - - - 1 - - - Block B. - - - .. row 4 - - - V4L2_RDS_BLOCK_C - - - - - 2 - - - Block C. - - - .. row 5 - - - V4L2_RDS_BLOCK_D - - - - - 3 - - - Block D. - - - .. row 6 - - - V4L2_RDS_BLOCK_C_ALT - - - - - 4 - - - Block C'. - - - .. row 7 - - - V4L2_RDS_BLOCK_INVALID - - - read-only - - - 7 - - - An invalid block. - - - .. row 8 - - - V4L2_RDS_BLOCK_CORRECTED - - - read-only - - - 0x40 - - - A bit error was detected but corrected. - - - .. row 9 - - - V4L2_RDS_BLOCK_ERROR - - - read-only - - - 0x80 - - - An uncorrectable error occurred. + * - V4L2_RDS_BLOCK_MSK + - + - 7 + - Mask for bits 0-2 to get the block ID. + * - V4L2_RDS_BLOCK_A + - + - 0 + - Block A. + * - V4L2_RDS_BLOCK_B + - + - 1 + - Block B. + * - V4L2_RDS_BLOCK_C + - + - 2 + - Block C. + * - V4L2_RDS_BLOCK_D + - + - 3 + - Block D. + * - V4L2_RDS_BLOCK_C_ALT + - + - 4 + - Block C'. + * - V4L2_RDS_BLOCK_INVALID + - read-only + - 7 + - An invalid block. + * - V4L2_RDS_BLOCK_CORRECTED + - read-only + - 0x40 + - A bit error was detected but corrected. + * - V4L2_RDS_BLOCK_ERROR + - read-only + - 0x80 + - An uncorrectable error occurred. diff --git a/Documentation/media/uapi/v4l/dev-sdr.rst b/Documentation/media/uapi/v4l/dev-sdr.rst index 5f82d760e188..b3e828d8cb1f 100644 --- a/Documentation/media/uapi/v4l/dev-sdr.rst +++ b/Documentation/media/uapi/v4l/dev-sdr.rst @@ -87,35 +87,20 @@ data transfer, set by the driver in order to inform application. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``pixelformat`` - - - The data format or type of compression, set by the application. - This is a little endian - :ref:`four character code `. V4L2 defines SDR - formats in :ref:`sdr-formats`. - - - .. row 2 - - - __u32 - - - ``buffersize`` - - - Maximum size in bytes required for data. Value is set by the - driver. - - - .. row 3 - - - __u8 - - - ``reserved[24]`` - - - This array is reserved for future extensions. Drivers and - applications must set it to zero. + * - __u32 + - ``pixelformat`` + - The data format or type of compression, set by the application. + This is a little endian + :ref:`four character code `. V4L2 defines SDR + formats in :ref:`sdr-formats`. + * - __u32 + - ``buffersize`` + - Maximum size in bytes required for data. Value is set by the + driver. + * - __u8 + - ``reserved[24]`` + - This array is reserved for future extensions. Drivers and + applications must set it to zero. An SDR device may support :ref:`read/write ` and/or streaming diff --git a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst index 019cac7e90e4..5f6d534ea73b 100644 --- a/Documentation/media/uapi/v4l/dev-sliced-vbi.rst +++ b/Documentation/media/uapi/v4l/dev-sliced-vbi.rst @@ -114,138 +114,90 @@ struct v4l2_sliced_vbi_format :stub-columns: 0 :widths: 3 3 2 2 2 + * - __u32 + - ``service_set`` + - :cspan:`2` - - .. row 1 + If ``service_set`` is non-zero when passed with + :ref:`VIDIOC_S_FMT ` or + :ref:`VIDIOC_TRY_FMT `, the ``service_lines`` + array will be filled by the driver according to the services + specified in this field. For example, if ``service_set`` is + initialized with ``V4L2_SLICED_TELETEXT_B | V4L2_SLICED_WSS_625``, + a driver for the cx25840 video decoder sets lines 7-22 of both + fields [#f1]_ to ``V4L2_SLICED_TELETEXT_B`` and line 23 of the first + field to ``V4L2_SLICED_WSS_625``. If ``service_set`` is set to + zero, then the values of ``service_lines`` will be used instead. - - __u32 + On return the driver sets this field to the union of all elements + of the returned ``service_lines`` array. It may contain less + services than requested, perhaps just one, if the hardware cannot + handle more services simultaneously. It may be empty (zero) if + none of the requested services are supported by the hardware. + * - __u16 + - ``service_lines``\ [2][24] + - :cspan:`2` - - ``service_set`` + Applications initialize this array with sets of data services the + driver shall look for or insert on the respective scan line. + Subject to hardware capabilities drivers return the requested set, + a subset, which may be just a single service, or an empty set. + When the hardware cannot handle multiple services on the same line + the driver shall choose one. No assumptions can be made on which + service the driver chooses. - - :cspan:`2` + Data services are defined in :ref:`vbi-services2`. Array indices + map to ITU-R line numbers\ [#f2]_ as follows: + * - + - + - Element + - 525 line systems + - 625 line systems + * - + - + - ``service_lines``\ [0][1] + - 1 + - 1 + * - + - + - ``service_lines``\ [0][23] + - 23 + - 23 + * - + - + - ``service_lines``\ [1][1] + - 264 + - 314 + * - + - + - ``service_lines``\ [1][23] + - 286 + - 336 + * - + - + - :cspan:`2` Drivers must set ``service_lines`` [0][0] and + ``service_lines``\ [1][0] to zero. The + ``V4L2_VBI_ITU_525_F1_START``, ``V4L2_VBI_ITU_525_F2_START``, + ``V4L2_VBI_ITU_625_F1_START`` and ``V4L2_VBI_ITU_625_F2_START`` + defines give the start line numbers for each field for each 525 or + 625 line format as a convenience. Don't forget that ITU line + numbering starts at 1, not 0. + * - __u32 + - ``io_size`` + - :cspan:`2` Maximum number of bytes passed by one + :ref:`read() ` or :ref:`write() ` call, + and the buffer size in bytes for the + :ref:`VIDIOC_QBUF` and + :ref:`VIDIOC_DQBUF ` ioctl. Drivers set this field + to the size of struct + :c:type:`v4l2_sliced_vbi_data` times the + number of non-zero elements in the returned ``service_lines`` + array (that is the number of lines potentially carrying data). + * - __u32 + - ``reserved``\ [2] + - :cspan:`2` This array is reserved for future extensions. - If ``service_set`` is non-zero when passed with - :ref:`VIDIOC_S_FMT ` or - :ref:`VIDIOC_TRY_FMT `, the ``service_lines`` - array will be filled by the driver according to the services - specified in this field. For example, if ``service_set`` is - initialized with ``V4L2_SLICED_TELETEXT_B | V4L2_SLICED_WSS_625``, - a driver for the cx25840 video decoder sets lines 7-22 of both - fields [#f1]_ to ``V4L2_SLICED_TELETEXT_B`` and line 23 of the first - field to ``V4L2_SLICED_WSS_625``. If ``service_set`` is set to - zero, then the values of ``service_lines`` will be used instead. - - On return the driver sets this field to the union of all elements - of the returned ``service_lines`` array. It may contain less - services than requested, perhaps just one, if the hardware cannot - handle more services simultaneously. It may be empty (zero) if - none of the requested services are supported by the hardware. - - - .. row 2 - - - __u16 - - - ``service_lines``\ [2][24] - - - :cspan:`2` - - Applications initialize this array with sets of data services the - driver shall look for or insert on the respective scan line. - Subject to hardware capabilities drivers return the requested set, - a subset, which may be just a single service, or an empty set. - When the hardware cannot handle multiple services on the same line - the driver shall choose one. No assumptions can be made on which - service the driver chooses. - - Data services are defined in :ref:`vbi-services2`. Array indices - map to ITU-R line numbers\ [#f2]_ as follows: - - - .. row 3 - - - - - - - Element - - - 525 line systems - - - 625 line systems - - - .. row 4 - - - - - - - ``service_lines``\ [0][1] - - - 1 - - - 1 - - - .. row 5 - - - - - - - ``service_lines``\ [0][23] - - - 23 - - - 23 - - - .. row 6 - - - - - - - ``service_lines``\ [1][1] - - - 264 - - - 314 - - - .. row 7 - - - - - - - ``service_lines``\ [1][23] - - - 286 - - - 336 - - - .. row 8 - - - - - - - :cspan:`2` Drivers must set ``service_lines`` [0][0] and - ``service_lines``\ [1][0] to zero. The - ``V4L2_VBI_ITU_525_F1_START``, ``V4L2_VBI_ITU_525_F2_START``, - ``V4L2_VBI_ITU_625_F1_START`` and ``V4L2_VBI_ITU_625_F2_START`` - defines give the start line numbers for each field for each 525 or - 625 line format as a convenience. Don't forget that ITU line - numbering starts at 1, not 0. - - - .. row 9 - - - __u32 - - - ``io_size`` - - - :cspan:`2` Maximum number of bytes passed by one - :ref:`read() ` or :ref:`write() ` call, - and the buffer size in bytes for the - :ref:`VIDIOC_QBUF` and - :ref:`VIDIOC_DQBUF ` ioctl. Drivers set this field - to the size of struct - :c:type:`v4l2_sliced_vbi_data` times the - number of non-zero elements in the returned ``service_lines`` - array (that is the number of lines potentially carrying data). - - - .. row 10 - - - __u32 - - - ``reserved``\ [2] - - - :cspan:`2` This array is reserved for future extensions. - - Applications and drivers must set it to zero. + Applications and drivers must set it to zero. .. _vbi-services2: @@ -264,95 +216,50 @@ Sliced VBI services :stub-columns: 0 :widths: 2 1 1 2 2 + * - Symbol + - Value + - Reference + - Lines, usually + - Payload + * - ``V4L2_SLICED_TELETEXT_B`` (Teletext System B) + - 0x0001 + - :ref:`ets300706`, - - .. row 1 + :ref:`itu653` + - PAL/SECAM line 7-22, 320-335 (second field 7-22) + - Last 42 of the 45 byte Teletext packet, that is without clock + run-in and framing code, lsb first transmitted. + * - ``V4L2_SLICED_VPS`` + - 0x0400 + - :ref:`ets300231` + - PAL line 16 + - Byte number 3 to 15 according to Figure 9 of ETS 300 231, lsb + first transmitted. + * - ``V4L2_SLICED_CAPTION_525`` + - 0x1000 + - :ref:`cea608` + - NTSC line 21, 284 (second field 21) + - Two bytes in transmission order, including parity bit, lsb first + transmitted. + * - ``V4L2_SLICED_WSS_625`` + - 0x4000 + - :ref:`itu1119`, - - Symbol + :ref:`en300294` + - PAL/SECAM line 23 + - - - Value + :: - - Reference - - - Lines, usually - - - Payload - - - .. row 2 - - - ``V4L2_SLICED_TELETEXT_B`` (Teletext System B) - - - 0x0001 - - - :ref:`ets300706`, - - :ref:`itu653` - - - PAL/SECAM line 7-22, 320-335 (second field 7-22) - - - Last 42 of the 45 byte Teletext packet, that is without clock - run-in and framing code, lsb first transmitted. - - - .. row 3 - - - ``V4L2_SLICED_VPS`` - - - 0x0400 - - - :ref:`ets300231` - - - PAL line 16 - - - Byte number 3 to 15 according to Figure 9 of ETS 300 231, lsb - first transmitted. - - - .. row 4 - - - ``V4L2_SLICED_CAPTION_525`` - - - 0x1000 - - - :ref:`cea608` - - - NTSC line 21, 284 (second field 21) - - - Two bytes in transmission order, including parity bit, lsb first - transmitted. - - - .. row 5 - - - ``V4L2_SLICED_WSS_625`` - - - 0x4000 - - - :ref:`itu1119`, - - :ref:`en300294` - - - PAL/SECAM line 23 - - - - - :: - - Byte 0 1 - msb lsb msb lsb - Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 - - - .. row 6 - - - ``V4L2_SLICED_VBI_525`` - - - 0x1000 - - - :cspan:`2` Set of services applicable to 525 line systems. - - - .. row 7 - - - ``V4L2_SLICED_VBI_625`` - - - 0x4401 - - - :cspan:`2` Set of services applicable to 625 line systems. + Byte 0 1 + msb lsb msb lsb + Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 + * - ``V4L2_SLICED_VBI_525`` + - 0x1000 + - :cspan:`2` Set of services applicable to 525 line systems. + * - ``V4L2_SLICED_VBI_625`` + - 0x4401 + - :cspan:`2` Set of services applicable to 625 line systems. .. raw:: latex @@ -395,63 +302,38 @@ struct v4l2_sliced_vbi_data :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - __u32 - - - ``id`` - - - A flag from :ref:`vbi-services` identifying the type of data in - this packet. Only a single bit must be set. When the ``id`` of a - captured packet is zero, the packet is empty and the contents of - other fields are undefined. Applications shall ignore empty - packets. When the ``id`` of a packet for output is zero the - contents of the ``data`` field are undefined and the driver must - no longer insert data on the requested ``field`` and ``line``. - - - .. row 2 - - - __u32 - - - ``field`` - - - The video field number this data has been captured from, or shall - be inserted at. ``0`` for the first field, ``1`` for the second - field. - - - .. row 3 - - - __u32 - - - ``line`` - - - The field (as opposed to frame) line number this data has been - captured from, or shall be inserted at. See :ref:`vbi-525` and - :ref:`vbi-625` for valid values. Sliced VBI capture devices can - set the line number of all packets to ``0`` if the hardware cannot - reliably identify scan lines. The field number must always be - valid. - - - .. row 4 - - - __u32 - - - ``reserved`` - - - This field is reserved for future extensions. Applications and - drivers must set it to zero. - - - .. row 5 - - - __u8 - - - ``data``\ [48] - - - The packet payload. See :ref:`vbi-services` for the contents and - number of bytes passed for each data type. The contents of padding - bytes at the end of this array are undefined, drivers and - applications shall ignore them. + * - __u32 + - ``id`` + - A flag from :ref:`vbi-services` identifying the type of data in + this packet. Only a single bit must be set. When the ``id`` of a + captured packet is zero, the packet is empty and the contents of + other fields are undefined. Applications shall ignore empty + packets. When the ``id`` of a packet for output is zero the + contents of the ``data`` field are undefined and the driver must + no longer insert data on the requested ``field`` and ``line``. + * - __u32 + - ``field`` + - The video field number this data has been captured from, or shall + be inserted at. ``0`` for the first field, ``1`` for the second + field. + * - __u32 + - ``line`` + - The field (as opposed to frame) line number this data has been + captured from, or shall be inserted at. See :ref:`vbi-525` and + :ref:`vbi-625` for valid values. Sliced VBI capture devices can + set the line number of all packets to ``0`` if the hardware cannot + reliably identify scan lines. The field number must always be + valid. + * - __u32 + - ``reserved`` + - This field is reserved for future extensions. Applications and + drivers must set it to zero. + * - __u8 + - ``data``\ [48] + - The packet payload. See :ref:`vbi-services` for the contents and + number of bytes passed for each data type. The contents of padding + bytes at the end of this array are undefined, drivers and + applications shall ignore them. Packets are always passed in ascending line number order, without @@ -582,48 +464,29 @@ struct v4l2_mpeg_vbi_fmt_ivtv :stub-columns: 0 :widths: 1 1 1 2 - - - .. row 1 - - - __u8 - - - ``magic``\ [4] - - - - - A "magic" constant from :ref:`v4l2-mpeg-vbi-fmt-ivtv-magic` that - indicates this is a valid sliced VBI data payload and also - indicates which member of the anonymous union, ``itv0`` or - ``ITV0``, to use for the payload data. - - - .. row 2 - - - union - - - (anonymous) - - - .. row 3 - - - - - struct :c:type:`v4l2_mpeg_vbi_itv0` - - - ``itv0`` - - - The primary form of the sliced VBI data payload that contains - anywhere from 1 to 35 lines of sliced VBI data. Line masks are - provided in this form of the payload indicating which VBI lines - are provided. - - - .. row 4 - - - - - struct :ref:`v4l2_mpeg_vbi_ITV0 ` - - - ``ITV0`` - - - An alternate form of the sliced VBI data payload used when 36 - lines of sliced VBI data are present. No line masks are provided - in this form of the payload; all valid line mask bits are - implcitly set. + * - __u8 + - ``magic``\ [4] + - + - A "magic" constant from :ref:`v4l2-mpeg-vbi-fmt-ivtv-magic` that + indicates this is a valid sliced VBI data payload and also + indicates which member of the anonymous union, ``itv0`` or + ``ITV0``, to use for the payload data. + * - union + - (anonymous) + * - + - struct :c:type:`v4l2_mpeg_vbi_itv0` + - ``itv0`` + - The primary form of the sliced VBI data payload that contains + anywhere from 1 to 35 lines of sliced VBI data. Line masks are + provided in this form of the payload indicating which VBI lines + are provided. + * - + - struct :ref:`v4l2_mpeg_vbi_ITV0 ` + - ``ITV0`` + - An alternate form of the sliced VBI data payload used when 36 + lines of sliced VBI data are present. No line masks are provided + in this form of the payload; all valid line mask bits are + implcitly set. @@ -639,34 +502,19 @@ Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - Defined Symbol - - - Value - - - Description - - - .. row 2 - - - ``V4L2_MPEG_VBI_IVTV_MAGIC0`` - - - "itv0" - - - Indicates the ``itv0`` member of the union in struct - :c:type:`v4l2_mpeg_vbi_fmt_ivtv` is - valid. - - - .. row 3 - - - ``V4L2_MPEG_VBI_IVTV_MAGIC1`` - - - "ITV0" - - - Indicates the ``ITV0`` member of the union in struct - :c:type:`v4l2_mpeg_vbi_fmt_ivtv` is - valid and that 36 lines of sliced VBI data are present. + * - Defined Symbol + - Value + - Description + * - ``V4L2_MPEG_VBI_IVTV_MAGIC0`` + - "itv0" + - Indicates the ``itv0`` member of the union in struct + :c:type:`v4l2_mpeg_vbi_fmt_ivtv` is + valid. + * - ``V4L2_MPEG_VBI_IVTV_MAGIC1`` + - "ITV0" + - Indicates the ``ITV0`` member of the union in struct + :c:type:`v4l2_mpeg_vbi_fmt_ivtv` is + valid and that 36 lines of sliced VBI data are present. @@ -684,50 +532,40 @@ structs v4l2_mpeg_vbi_itv0 and v4l2_mpeg_vbi_ITV0 :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __le32 - - - ``linemask``\ [2] - - - Bitmasks indicating the VBI service lines present. These - ``linemask`` values are stored in little endian byte order in the - MPEG stream. Some reference ``linemask`` bit positions with their - corresponding VBI line number and video field are given below. - b\ :sub:`0` indicates the least significant bit of a ``linemask`` - value: + * - __le32 + - ``linemask``\ [2] + - Bitmasks indicating the VBI service lines present. These + ``linemask`` values are stored in little endian byte order in the + MPEG stream. Some reference ``linemask`` bit positions with their + corresponding VBI line number and video field are given below. + b\ :sub:`0` indicates the least significant bit of a ``linemask`` + value: - :: + :: - linemask[0] b0: line 6 first field - linemask[0] b17: line 23 first field - linemask[0] b18: line 6 second field - linemask[0] b31: line 19 second field - linemask[1] b0: line 20 second field - linemask[1] b3: line 23 second field - linemask[1] b4-b31: unused and set to 0 - - - .. row 2 - - - struct - :c:type:`v4l2_mpeg_vbi_itv0_line` - - - ``line``\ [35] - - - This is a variable length array that holds from 1 to 35 lines of - sliced VBI data. The sliced VBI data lines present correspond to - the bits set in the ``linemask`` array, starting from b\ :sub:`0` - of ``linemask``\ [0] up through b\ :sub:`31` of ``linemask``\ [0], - and from b\ :sub:`0` of ``linemask``\ [1] up through b\ :sub:`3` of - ``linemask``\ [1]. ``line``\ [0] corresponds to the first bit - found set in the ``linemask`` array, ``line``\ [1] corresponds to - the second bit found set in the ``linemask`` array, etc. If no - ``linemask`` array bits are set, then ``line``\ [0] may contain - one line of unspecified data that should be ignored by - applications. + linemask[0] b0: line 6 first field + linemask[0] b17: line 23 first field + linemask[0] b18: line 6 second field + linemask[0] b31: line 19 second field + linemask[1] b0: line 20 second field + linemask[1] b3: line 23 second field + linemask[1] b4-b31: unused and set to 0 + * - struct + :c:type:`v4l2_mpeg_vbi_itv0_line` + - ``line``\ [35] + - This is a variable length array that holds from 1 to 35 lines of + sliced VBI data. The sliced VBI data lines present correspond to + the bits set in the ``linemask`` array, starting from b\ :sub:`0` + of ``linemask``\ [0] up through b\ :sub:`31` of ``linemask``\ [0], + and from b\ :sub:`0` of ``linemask``\ [1] up through b\ :sub:`3` of + ``linemask``\ [1]. ``line``\ [0] corresponds to the first bit + found set in the ``linemask`` array, ``line``\ [1] corresponds to + the second bit found set in the ``linemask`` array, etc. If no + ``linemask`` array bits are set, then ``line``\ [0] may contain + one line of unspecified data that should be ignored by + applications. @@ -743,18 +581,13 @@ struct v4l2_mpeg_vbi_ITV0 :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - struct - :c:type:`v4l2_mpeg_vbi_itv0_line` - - - ``line``\ [36] - - - A fixed length array of 36 lines of sliced VBI data. ``line``\ [0] - through ``line``\ [17] correspond to lines 6 through 23 of the - first field. ``line``\ [18] through ``line``\ [35] corresponds to - lines 6 through 23 of the second field. + * - struct + :c:type:`v4l2_mpeg_vbi_itv0_line` + - ``line``\ [36] + - A fixed length array of 36 lines of sliced VBI data. ``line``\ [0] + through ``line``\ [17] correspond to lines 6 through 23 of the + first field. ``line``\ [18] through ``line``\ [35] corresponds to + lines 6 through 23 of the second field. @@ -770,24 +603,14 @@ struct v4l2_mpeg_vbi_itv0_line :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u8 - - - ``id`` - - - A line identifier value from - :ref:`ITV0-Line-Identifier-Constants` that indicates the type of - sliced VBI data stored on this line. - - - .. row 2 - - - __u8 - - - ``data``\ [42] - - - The sliced VBI data for the line. + * - __u8 + - ``id`` + - A line identifier value from + :ref:`ITV0-Line-Identifier-Constants` that indicates the type of + sliced VBI data stored on this line. + * - __u8 + - ``data``\ [42] + - The sliced VBI data for the line. @@ -803,50 +626,25 @@ Line Identifiers for struct v4l2_mpeg_vbi_itv0_line id field :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - Defined Symbol - - - Value - - - Description - - - .. row 2 - - - ``V4L2_MPEG_VBI_IVTV_TELETEXT_B`` - - - 1 - - - Refer to :ref:`Sliced VBI services ` for a - description of the line payload. - - - .. row 3 - - - ``V4L2_MPEG_VBI_IVTV_CAPTION_525`` - - - 4 - - - Refer to :ref:`Sliced VBI services ` for a - description of the line payload. - - - .. row 4 - - - ``V4L2_MPEG_VBI_IVTV_WSS_625`` - - - 5 - - - Refer to :ref:`Sliced VBI services ` for a - description of the line payload. - - - .. row 5 - - - ``V4L2_MPEG_VBI_IVTV_VPS`` - - - 7 - - - Refer to :ref:`Sliced VBI services ` for a - description of the line payload. + * - Defined Symbol + - Value + - Description + * - ``V4L2_MPEG_VBI_IVTV_TELETEXT_B`` + - 1 + - Refer to :ref:`Sliced VBI services ` for a + description of the line payload. + * - ``V4L2_MPEG_VBI_IVTV_CAPTION_525`` + - 4 + - Refer to :ref:`Sliced VBI services ` for a + description of the line payload. + * - ``V4L2_MPEG_VBI_IVTV_WSS_625`` + - 5 + - Refer to :ref:`Sliced VBI services ` for a + description of the line payload. + * - ``V4L2_MPEG_VBI_IVTV_VPS`` + - 7 + - Refer to :ref:`Sliced VBI services ` for a + description of the line payload. diff --git a/Documentation/media/uapi/v4l/dev-subdev.rst b/Documentation/media/uapi/v4l/dev-subdev.rst index 6dc7f13780ba..fb4d0d45b216 100644 --- a/Documentation/media/uapi/v4l/dev-subdev.rst +++ b/Documentation/media/uapi/v4l/dev-subdev.rst @@ -215,85 +215,41 @@ list entity names and pad numbers). :stub-columns: 0 :widths: 5 5 5 5 5 5 5 - - - .. row 1 - - - - - Sensor/0 format - - - Frontend/0 format - - - Frontend/1 format - - - Scaler/0 format - - - Scaler/0 compose selection rectangle - - - Scaler/1 format - - - .. row 2 - - - Initial state - - - 2048x1536/SGRBG8_1X8 - - - (default) - - - (default) - - - (default) - - - (default) - - - (default) - - - .. row 3 - - - Configure frontend sink format - - - 2048x1536/SGRBG8_1X8 - - - *2048x1536/SGRBG8_1X8* - - - *2046x1534/SGRBG8_1X8* - - - (default) - - - (default) - - - (default) - - - .. row 4 - - - Configure scaler sink format - - - 2048x1536/SGRBG8_1X8 - - - 2048x1536/SGRBG8_1X8 - - - 2046x1534/SGRBG8_1X8 - - - *2046x1534/SGRBG8_1X8* - - - *0,0/2046x1534* - - - *2046x1534/SGRBG8_1X8* - - - .. row 5 - - - Configure scaler sink compose selection - - - 2048x1536/SGRBG8_1X8 - - - 2048x1536/SGRBG8_1X8 - - - 2046x1534/SGRBG8_1X8 - - - 2046x1534/SGRBG8_1X8 - - - *0,0/1280x960* - - - *1280x960/SGRBG8_1X8* + * - + - Sensor/0 format + - Frontend/0 format + - Frontend/1 format + - Scaler/0 format + - Scaler/0 compose selection rectangle + - Scaler/1 format + * - Initial state + - 2048x1536/SGRBG8_1X8 + - (default) + - (default) + - (default) + - (default) + - (default) + * - Configure frontend sink format + - 2048x1536/SGRBG8_1X8 + - *2048x1536/SGRBG8_1X8* + - *2046x1534/SGRBG8_1X8* + - (default) + - (default) + - (default) + * - Configure scaler sink format + - 2048x1536/SGRBG8_1X8 + - 2048x1536/SGRBG8_1X8 + - 2046x1534/SGRBG8_1X8 + - *2046x1534/SGRBG8_1X8* + - *0,0/2046x1534* + - *2046x1534/SGRBG8_1X8* + * - Configure scaler sink compose selection + - 2048x1536/SGRBG8_1X8 + - 2048x1536/SGRBG8_1X8 + - 2046x1534/SGRBG8_1X8 + - 2046x1534/SGRBG8_1X8 + - *0,0/1280x960* + - *1280x960/SGRBG8_1X8* .. raw:: latex diff --git a/Documentation/media/uapi/v4l/diff-v4l.rst b/Documentation/media/uapi/v4l/diff-v4l.rst index 0419e2051759..76b2ecab8657 100644 --- a/Documentation/media/uapi/v4l/diff-v4l.rst +++ b/Documentation/media/uapi/v4l/diff-v4l.rst @@ -39,39 +39,19 @@ using driver module options. The major device number remains 81. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Device Type - - - File Name - - - Minor Numbers - - - .. row 2 - - - Video capture and overlay - - - ``/dev/video`` and ``/dev/bttv0``\ [#f1]_, ``/dev/video0`` to - ``/dev/video63`` - - - 0-63 - - - .. row 3 - - - Radio receiver - - - ``/dev/radio``\ [#f2]_, ``/dev/radio0`` to ``/dev/radio63`` - - - 64-127 - - - .. row 4 - - - Raw VBI capture - - - ``/dev/vbi``, ``/dev/vbi0`` to ``/dev/vbi31`` - - - 224-255 + * - Device Type + - File Name + - Minor Numbers + * - Video capture and overlay + - ``/dev/video`` and ``/dev/bttv0``\ [#f1]_, ``/dev/video0`` to + ``/dev/video63`` + - 0-63 + * - Radio receiver + - ``/dev/radio``\ [#f2]_, ``/dev/radio0`` to ``/dev/radio63`` + - 64-127 + * - Raw VBI capture + - ``/dev/vbi``, ``/dev/vbi0`` to ``/dev/vbi31`` + - 224-255 V4L prohibits (or used to prohibit) multiple opens of a device file. @@ -103,148 +83,73 @@ introduction. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - ``struct video_capability`` ``type`` - - - struct :c:type:`v4l2_capability` - ``capabilities`` flags - - - Purpose - - - .. row 2 - - - ``VID_TYPE_CAPTURE`` - - - ``V4L2_CAP_VIDEO_CAPTURE`` - - - The :ref:`video capture ` interface is supported. - - - .. row 3 - - - ``VID_TYPE_TUNER`` - - - ``V4L2_CAP_TUNER`` - - - The device has a :ref:`tuner or modulator `. - - - .. row 4 - - - ``VID_TYPE_TELETEXT`` - - - ``V4L2_CAP_VBI_CAPTURE`` - - - The :ref:`raw VBI capture ` interface is supported. - - - .. row 5 - - - ``VID_TYPE_OVERLAY`` - - - ``V4L2_CAP_VIDEO_OVERLAY`` - - - The :ref:`video overlay ` interface is supported. - - - .. row 6 - - - ``VID_TYPE_CHROMAKEY`` - - - ``V4L2_FBUF_CAP_CHROMAKEY`` in field ``capability`` of struct - :c:type:`v4l2_framebuffer` - - - Whether chromakey overlay is supported. For more information on - overlay see :ref:`overlay`. - - - .. row 7 - - - ``VID_TYPE_CLIPPING`` - - - ``V4L2_FBUF_CAP_LIST_CLIPPING`` and - ``V4L2_FBUF_CAP_BITMAP_CLIPPING`` in field ``capability`` of - struct :c:type:`v4l2_framebuffer` - - - Whether clipping the overlaid image is supported, see - :ref:`overlay`. - - - .. row 8 - - - ``VID_TYPE_FRAMERAM`` - - - ``V4L2_FBUF_CAP_EXTERNOVERLAY`` *not set* in field ``capability`` - of struct :c:type:`v4l2_framebuffer` - - - Whether overlay overwrites frame buffer memory, see - :ref:`overlay`. - - - .. row 9 - - - ``VID_TYPE_SCALES`` - - - ``-`` - - - This flag indicates if the hardware can scale images. The V4L2 API - implies the scale factor by setting the cropping dimensions and - image size with the :ref:`VIDIOC_S_CROP ` and - :ref:`VIDIOC_S_FMT ` ioctl, respectively. The - driver returns the closest sizes possible. For more information on - cropping and scaling see :ref:`crop`. - - - .. row 10 - - - ``VID_TYPE_MONOCHROME`` - - - ``-`` - - - Applications can enumerate the supported image formats with the - :ref:`VIDIOC_ENUM_FMT` ioctl to determine if - the device supports grey scale capturing only. For more - information on image formats see :ref:`pixfmt`. - - - .. row 11 - - - ``VID_TYPE_SUBCAPTURE`` - - - ``-`` - - - Applications can call the :ref:`VIDIOC_G_CROP ` - ioctl to determine if the device supports capturing a subsection - of the full picture ("cropping" in V4L2). If not, the ioctl - returns the ``EINVAL`` error code. For more information on cropping - and scaling see :ref:`crop`. - - - .. row 12 - - - ``VID_TYPE_MPEG_DECODER`` - - - ``-`` - - - Applications can enumerate the supported image formats with the - :ref:`VIDIOC_ENUM_FMT` ioctl to determine if - the device supports MPEG streams. - - - .. row 13 - - - ``VID_TYPE_MPEG_ENCODER`` - - - ``-`` - - - See above. - - - .. row 14 - - - ``VID_TYPE_MJPEG_DECODER`` - - - ``-`` - - - See above. - - - .. row 15 - - - ``VID_TYPE_MJPEG_ENCODER`` - - - ``-`` - - - See above. + * - ``struct video_capability`` ``type`` + - struct :c:type:`v4l2_capability` + ``capabilities`` flags + - Purpose + * - ``VID_TYPE_CAPTURE`` + - ``V4L2_CAP_VIDEO_CAPTURE`` + - The :ref:`video capture ` interface is supported. + * - ``VID_TYPE_TUNER`` + - ``V4L2_CAP_TUNER`` + - The device has a :ref:`tuner or modulator `. + * - ``VID_TYPE_TELETEXT`` + - ``V4L2_CAP_VBI_CAPTURE`` + - The :ref:`raw VBI capture ` interface is supported. + * - ``VID_TYPE_OVERLAY`` + - ``V4L2_CAP_VIDEO_OVERLAY`` + - The :ref:`video overlay ` interface is supported. + * - ``VID_TYPE_CHROMAKEY`` + - ``V4L2_FBUF_CAP_CHROMAKEY`` in field ``capability`` of struct + :c:type:`v4l2_framebuffer` + - Whether chromakey overlay is supported. For more information on + overlay see :ref:`overlay`. + * - ``VID_TYPE_CLIPPING`` + - ``V4L2_FBUF_CAP_LIST_CLIPPING`` and + ``V4L2_FBUF_CAP_BITMAP_CLIPPING`` in field ``capability`` of + struct :c:type:`v4l2_framebuffer` + - Whether clipping the overlaid image is supported, see + :ref:`overlay`. + * - ``VID_TYPE_FRAMERAM`` + - ``V4L2_FBUF_CAP_EXTERNOVERLAY`` *not set* in field ``capability`` + of struct :c:type:`v4l2_framebuffer` + - Whether overlay overwrites frame buffer memory, see + :ref:`overlay`. + * - ``VID_TYPE_SCALES`` + - ``-`` + - This flag indicates if the hardware can scale images. The V4L2 API + implies the scale factor by setting the cropping dimensions and + image size with the :ref:`VIDIOC_S_CROP ` and + :ref:`VIDIOC_S_FMT ` ioctl, respectively. The + driver returns the closest sizes possible. For more information on + cropping and scaling see :ref:`crop`. + * - ``VID_TYPE_MONOCHROME`` + - ``-`` + - Applications can enumerate the supported image formats with the + :ref:`VIDIOC_ENUM_FMT` ioctl to determine if + the device supports grey scale capturing only. For more + information on image formats see :ref:`pixfmt`. + * - ``VID_TYPE_SUBCAPTURE`` + - ``-`` + - Applications can call the :ref:`VIDIOC_G_CROP ` + ioctl to determine if the device supports capturing a subsection + of the full picture ("cropping" in V4L2). If not, the ioctl + returns the ``EINVAL`` error code. For more information on cropping + and scaling see :ref:`crop`. + * - ``VID_TYPE_MPEG_DECODER`` + - ``-`` + - Applications can enumerate the supported image formats with the + :ref:`VIDIOC_ENUM_FMT` ioctl to determine if + the device supports MPEG streams. + * - ``VID_TYPE_MPEG_ENCODER`` + - ``-`` + - See above. + * - ``VID_TYPE_MJPEG_DECODER`` + - ``-`` + - See above. + * - ``VID_TYPE_MJPEG_ENCODER`` + - ``-`` + - See above. The ``audios`` field was replaced by ``capabilities`` flag @@ -280,24 +185,12 @@ video input types were renamed as follows: :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - struct ``video_channel`` ``type`` - - - struct :c:type:`v4l2_input` ``type`` - - - .. row 2 - - - ``VIDEO_TYPE_TV`` - - - ``V4L2_INPUT_TYPE_TUNER`` - - - .. row 3 - - - ``VIDEO_TYPE_CAMERA`` - - - ``V4L2_INPUT_TYPE_CAMERA`` + * - struct ``video_channel`` ``type`` + - struct :c:type:`v4l2_input` ``type`` + * - ``VIDEO_TYPE_TV`` + - ``V4L2_INPUT_TYPE_TUNER`` + * - ``VIDEO_TYPE_CAMERA`` + - ``V4L2_INPUT_TYPE_CAMERA`` Unlike the ``tuners`` field expressing the number of tuners of this @@ -386,42 +279,18 @@ replaced by V4L2 controls accessible with the :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - struct ``video_picture`` - - - V4L2 Control ID - - - .. row 2 - - - ``brightness`` - - - ``V4L2_CID_BRIGHTNESS`` - - - .. row 3 - - - ``hue`` - - - ``V4L2_CID_HUE`` - - - .. row 4 - - - ``colour`` - - - ``V4L2_CID_SATURATION`` - - - .. row 5 - - - ``contrast`` - - - ``V4L2_CID_CONTRAST`` - - - .. row 6 - - - ``whiteness`` - - - ``V4L2_CID_WHITENESS`` + * - struct ``video_picture`` + - V4L2 Control ID + * - ``brightness`` + - ``V4L2_CID_BRIGHTNESS`` + * - ``hue`` + - ``V4L2_CID_HUE`` + * - ``colour`` + - ``V4L2_CID_SATURATION`` + * - ``contrast`` + - ``V4L2_CID_CONTRAST`` + * - ``whiteness`` + - ``V4L2_CID_WHITENESS`` The V4L picture controls are assumed to range from 0 to 65535 with no @@ -442,108 +311,40 @@ into the struct :c:type:`v4l2_pix_format`: :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - struct ``video_picture`` ``palette`` - - - struct :c:type:`v4l2_pix_format` ``pixfmt`` - - - .. row 2 - - - ``VIDEO_PALETTE_GREY`` - - - :ref:`V4L2_PIX_FMT_GREY ` - - - .. row 3 - - - ``VIDEO_PALETTE_HI240`` - - - :ref:`V4L2_PIX_FMT_HI240 ` [#f3]_ - - - .. row 4 - - - ``VIDEO_PALETTE_RGB565`` - - - :ref:`V4L2_PIX_FMT_RGB565 ` - - - .. row 5 - - - ``VIDEO_PALETTE_RGB555`` - - - :ref:`V4L2_PIX_FMT_RGB555 ` - - - .. row 6 - - - ``VIDEO_PALETTE_RGB24`` - - - :ref:`V4L2_PIX_FMT_BGR24 ` - - - .. row 7 - - - ``VIDEO_PALETTE_RGB32`` - - - :ref:`V4L2_PIX_FMT_BGR32 ` [#f4]_ - - - .. row 8 - - - ``VIDEO_PALETTE_YUV422`` - - - :ref:`V4L2_PIX_FMT_YUYV ` - - - .. row 9 - - - ``VIDEO_PALETTE_YUYV``\ [#f5]_ - - - :ref:`V4L2_PIX_FMT_YUYV ` - - - .. row 10 - - - ``VIDEO_PALETTE_UYVY`` - - - :ref:`V4L2_PIX_FMT_UYVY ` - - - .. row 11 - - - ``VIDEO_PALETTE_YUV420`` - - - None - - - .. row 12 - - - ``VIDEO_PALETTE_YUV411`` - - - :ref:`V4L2_PIX_FMT_Y41P ` [#f6]_ - - - .. row 13 - - - ``VIDEO_PALETTE_RAW`` - - - None [#f7]_ - - - .. row 14 - - - ``VIDEO_PALETTE_YUV422P`` - - - :ref:`V4L2_PIX_FMT_YUV422P ` - - - .. row 15 - - - ``VIDEO_PALETTE_YUV411P`` - - - :ref:`V4L2_PIX_FMT_YUV411P ` [#f8]_ - - - .. row 16 - - - ``VIDEO_PALETTE_YUV420P`` - - - :ref:`V4L2_PIX_FMT_YVU420 ` - - - .. row 17 - - - ``VIDEO_PALETTE_YUV410P`` - - - :ref:`V4L2_PIX_FMT_YVU410 ` + * - struct ``video_picture`` ``palette`` + - struct :c:type:`v4l2_pix_format` ``pixfmt`` + * - ``VIDEO_PALETTE_GREY`` + - :ref:`V4L2_PIX_FMT_GREY ` + * - ``VIDEO_PALETTE_HI240`` + - :ref:`V4L2_PIX_FMT_HI240 ` [#f3]_ + * - ``VIDEO_PALETTE_RGB565`` + - :ref:`V4L2_PIX_FMT_RGB565 ` + * - ``VIDEO_PALETTE_RGB555`` + - :ref:`V4L2_PIX_FMT_RGB555 ` + * - ``VIDEO_PALETTE_RGB24`` + - :ref:`V4L2_PIX_FMT_BGR24 ` + * - ``VIDEO_PALETTE_RGB32`` + - :ref:`V4L2_PIX_FMT_BGR32 ` [#f4]_ + * - ``VIDEO_PALETTE_YUV422`` + - :ref:`V4L2_PIX_FMT_YUYV ` + * - ``VIDEO_PALETTE_YUYV``\ [#f5]_ + - :ref:`V4L2_PIX_FMT_YUYV ` + * - ``VIDEO_PALETTE_UYVY`` + - :ref:`V4L2_PIX_FMT_UYVY ` + * - ``VIDEO_PALETTE_YUV420`` + - None + * - ``VIDEO_PALETTE_YUV411`` + - :ref:`V4L2_PIX_FMT_Y41P ` [#f6]_ + * - ``VIDEO_PALETTE_RAW`` + - None [#f7]_ + * - ``VIDEO_PALETTE_YUV422P`` + - :ref:`V4L2_PIX_FMT_YUV422P ` + * - ``VIDEO_PALETTE_YUV411P`` + - :ref:`V4L2_PIX_FMT_YUV411P ` [#f8]_ + * - ``VIDEO_PALETTE_YUV420P`` + - :ref:`V4L2_PIX_FMT_YVU420 ` + * - ``VIDEO_PALETTE_YUV410P`` + - :ref:`V4L2_PIX_FMT_YVU410 ` V4L2 image formats are defined in :ref:`pixfmt`. The image format can @@ -588,36 +389,16 @@ The following fields where replaced by V4L2 controls accessible with the :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - struct ``video_audio`` - - - V4L2 Control ID - - - .. row 2 - - - ``volume`` - - - ``V4L2_CID_AUDIO_VOLUME`` - - - .. row 3 - - - ``bass`` - - - ``V4L2_CID_AUDIO_BASS`` - - - .. row 4 - - - ``treble`` - - - ``V4L2_CID_AUDIO_TREBLE`` - - - .. row 5 - - - ``balance`` - - - ``V4L2_CID_AUDIO_BALANCE`` + * - struct ``video_audio`` + - V4L2 Control ID + * - ``volume`` + - ``V4L2_CID_AUDIO_VOLUME`` + * - ``bass`` + - ``V4L2_CID_AUDIO_BASS`` + * - ``treble`` + - ``V4L2_CID_AUDIO_TREBLE`` + * - ``balance`` + - ``V4L2_CID_AUDIO_BALANCE`` To determine which of these controls are supported by a driver V4L @@ -752,68 +533,49 @@ differences. :header-rows: 1 :stub-columns: 0 + * - V4L + - V4L2 + * - + - The image format must be selected before buffers are allocated, + with the :ref:`VIDIOC_S_FMT ` ioctl. When no + format is selected the driver may use the last, possibly by + another application requested format. + * - Applications cannot change the number of buffers. The it is built + into the driver, unless it has a module option to change the + number when the driver module is loaded. + - The :ref:`VIDIOC_REQBUFS` ioctl allocates the + desired number of buffers, this is a required step in the + initialization sequence. + * - Drivers map all buffers as one contiguous range of memory. The + ``VIDIOCGMBUF`` ioctl is available to query the number of buffers, + the offset of each buffer from the start of the virtual file, and + the overall amount of memory used, which can be used as arguments + for the :ref:`mmap() ` function. + - Buffers are individually mapped. The offset and size of each + buffer can be determined with the + :ref:`VIDIOC_QUERYBUF` ioctl. + * - The ``VIDIOCMCAPTURE`` ioctl prepares a buffer for capturing. It + also determines the image format for this buffer. The ioctl + returns immediately, eventually with an ``EAGAIN`` error code if no + video signal had been detected. When the driver supports more than + one buffer applications can call the ioctl multiple times and thus + have multiple outstanding capture requests. - - .. row 1 - - - V4L - - - V4L2 - - - .. row 2 - - - - - The image format must be selected before buffers are allocated, - with the :ref:`VIDIOC_S_FMT ` ioctl. When no - format is selected the driver may use the last, possibly by - another application requested format. - - - .. row 3 - - - Applications cannot change the number of buffers. The it is built - into the driver, unless it has a module option to change the - number when the driver module is loaded. - - - The :ref:`VIDIOC_REQBUFS` ioctl allocates the - desired number of buffers, this is a required step in the - initialization sequence. - - - .. row 4 - - - Drivers map all buffers as one contiguous range of memory. The - ``VIDIOCGMBUF`` ioctl is available to query the number of buffers, - the offset of each buffer from the start of the virtual file, and - the overall amount of memory used, which can be used as arguments - for the :ref:`mmap() ` function. - - - Buffers are individually mapped. The offset and size of each - buffer can be determined with the - :ref:`VIDIOC_QUERYBUF` ioctl. - - - .. row 5 - - - The ``VIDIOCMCAPTURE`` ioctl prepares a buffer for capturing. It - also determines the image format for this buffer. The ioctl - returns immediately, eventually with an ``EAGAIN`` error code if no - video signal had been detected. When the driver supports more than - one buffer applications can call the ioctl multiple times and thus - have multiple outstanding capture requests. - - The ``VIDIOCSYNC`` ioctl suspends execution until a particular - buffer has been filled. - - - Drivers maintain an incoming and outgoing queue. - :ref:`VIDIOC_QBUF` enqueues any empty buffer into - the incoming queue. Filled buffers are dequeued from the outgoing - queue with the :ref:`VIDIOC_DQBUF ` ioctl. To wait - until filled buffers become available this function, - :ref:`select() ` or :ref:`poll() ` can - be used. The :ref:`VIDIOC_STREAMON` ioctl - must be called once after enqueuing one or more buffers to start - capturing. Its counterpart - :ref:`VIDIOC_STREAMOFF ` stops capturing and - dequeues all buffers from both queues. Applications can query the - signal status, if known, with the - :ref:`VIDIOC_ENUMINPUT` ioctl. + The ``VIDIOCSYNC`` ioctl suspends execution until a particular + buffer has been filled. + - Drivers maintain an incoming and outgoing queue. + :ref:`VIDIOC_QBUF` enqueues any empty buffer into + the incoming queue. Filled buffers are dequeued from the outgoing + queue with the :ref:`VIDIOC_DQBUF ` ioctl. To wait + until filled buffers become available this function, + :ref:`select() ` or :ref:`poll() ` can + be used. The :ref:`VIDIOC_STREAMON` ioctl + must be called once after enqueuing one or more buffers to start + capturing. Its counterpart + :ref:`VIDIOC_STREAMOFF ` stops capturing and + dequeues all buffers from both queues. Applications can query the + signal status, if known, with the + :ref:`VIDIOC_ENUMINPUT` ioctl. For a more in-depth discussion of memory mapping and examples, see @@ -835,56 +597,24 @@ with the following parameters: :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - struct :c:type:`v4l2_vbi_format` - - - V4L, BTTV driver - - - .. row 2 - - - sampling_rate - - - 28636363 Hz NTSC (or any other 525-line standard); 35468950 Hz PAL - and SECAM (625-line standards) - - - .. row 3 - - - offset - - - ? - - - .. row 4 - - - samples_per_line - - - 2048 - - - .. row 5 - - - sample_format - - - V4L2_PIX_FMT_GREY. The last four bytes (a machine endianness - integer) contain a frame counter. - - - .. row 6 - - - start[] - - - 10, 273 NTSC; 22, 335 PAL and SECAM - - - .. row 7 - - - count[] - - - 16, 16 [#f9]_ - - - .. row 8 - - - flags - - - 0 + * - struct :c:type:`v4l2_vbi_format` + - V4L, BTTV driver + * - sampling_rate + - 28636363 Hz NTSC (or any other 525-line standard); 35468950 Hz PAL + and SECAM (625-line standards) + * - offset + - ? + * - samples_per_line + - 2048 + * - sample_format + - V4L2_PIX_FMT_GREY. The last four bytes (a machine endianness + integer) contain a frame counter. + * - start[] + - 10, 273 NTSC; 22, 335 PAL and SECAM + * - count[] + - 16, 16 [#f9]_ + * - flags + - 0 Undocumented in the V4L specification, in Linux 2.3 the diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 85e536971923..7725c33d8b69 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -224,42 +224,18 @@ enum v4l2_mpeg_stream_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_STREAM_TYPE_MPEG2_PS`` - - - MPEG-2 program stream - - - .. row 2 - - - ``V4L2_MPEG_STREAM_TYPE_MPEG2_TS`` - - - MPEG-2 transport stream - - - .. row 3 - - - ``V4L2_MPEG_STREAM_TYPE_MPEG1_SS`` - - - MPEG-1 system stream - - - .. row 4 - - - ``V4L2_MPEG_STREAM_TYPE_MPEG2_DVD`` - - - MPEG-2 DVD-compatible stream - - - .. row 5 - - - ``V4L2_MPEG_STREAM_TYPE_MPEG1_VCD`` - - - MPEG-1 VCD-compatible stream - - - .. row 6 - - - ``V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD`` - - - MPEG-2 SVCD-compatible stream + * - ``V4L2_MPEG_STREAM_TYPE_MPEG2_PS`` + - MPEG-2 program stream + * - ``V4L2_MPEG_STREAM_TYPE_MPEG2_TS`` + - MPEG-2 transport stream + * - ``V4L2_MPEG_STREAM_TYPE_MPEG1_SS`` + - MPEG-1 system stream + * - ``V4L2_MPEG_STREAM_TYPE_MPEG2_DVD`` + - MPEG-2 DVD-compatible stream + * - ``V4L2_MPEG_STREAM_TYPE_MPEG1_VCD`` + - MPEG-1 VCD-compatible stream + * - ``V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD`` + - MPEG-2 SVCD-compatible stream @@ -303,20 +279,12 @@ enum v4l2_mpeg_stream_vbi_fmt - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_STREAM_VBI_FMT_NONE`` - - - No VBI in the MPEG stream - - - .. row 2 - - - ``V4L2_MPEG_STREAM_VBI_FMT_IVTV`` - - - VBI in private packets, IVTV format (documented in the kernel - sources in the file - ``Documentation/video4linux/cx2341x/README.vbi``) + * - ``V4L2_MPEG_STREAM_VBI_FMT_NONE`` + - No VBI in the MPEG stream + * - ``V4L2_MPEG_STREAM_VBI_FMT_IVTV`` + - VBI in private packets, IVTV format (documented in the kernel + sources in the file + ``Documentation/video4linux/cx2341x/README.vbi``) @@ -334,24 +302,12 @@ enum v4l2_mpeg_audio_sampling_freq - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100`` - - - 44.1 kHz - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000`` - - - 48 kHz - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000`` - - - 32 kHz + * - ``V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100`` + - 44.1 kHz + * - ``V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000`` + - 48 kHz + * - ``V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000`` + - 32 kHz @@ -370,36 +326,16 @@ enum v4l2_mpeg_audio_encoding - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_ENCODING_LAYER_1`` - - - MPEG-1/2 Layer I encoding - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_ENCODING_LAYER_2`` - - - MPEG-1/2 Layer II encoding - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_ENCODING_LAYER_3`` - - - MPEG-1/2 Layer III encoding - - - .. row 4 - - - ``V4L2_MPEG_AUDIO_ENCODING_AAC`` - - - MPEG-2/4 AAC (Advanced Audio Coding) - - - .. row 5 - - - ``V4L2_MPEG_AUDIO_ENCODING_AC3`` - - - AC-3 aka ATSC A/52 encoding + * - ``V4L2_MPEG_AUDIO_ENCODING_LAYER_1`` + - MPEG-1/2 Layer I encoding + * - ``V4L2_MPEG_AUDIO_ENCODING_LAYER_2`` + - MPEG-1/2 Layer II encoding + * - ``V4L2_MPEG_AUDIO_ENCODING_LAYER_3`` + - MPEG-1/2 Layer III encoding + * - ``V4L2_MPEG_AUDIO_ENCODING_AAC`` + - MPEG-2/4 AAC (Advanced Audio Coding) + * - ``V4L2_MPEG_AUDIO_ENCODING_AC3`` + - AC-3 aka ATSC A/52 encoding @@ -417,90 +353,34 @@ enum v4l2_mpeg_audio_l1_bitrate - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_32K`` - - - 32 kbit/s - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_64K`` - - - 64 kbit/s - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_96K`` - - - 96 kbit/s - - - .. row 4 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_128K`` - - - 128 kbit/s - - - .. row 5 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_160K`` - - - 160 kbit/s - - - .. row 6 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_192K`` - - - 192 kbit/s - - - .. row 7 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_224K`` - - - 224 kbit/s - - - .. row 8 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_256K`` - - - 256 kbit/s - - - .. row 9 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_288K`` - - - 288 kbit/s - - - .. row 10 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_320K`` - - - 320 kbit/s - - - .. row 11 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_352K`` - - - 352 kbit/s - - - .. row 12 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_384K`` - - - 384 kbit/s - - - .. row 13 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_416K`` - - - 416 kbit/s - - - .. row 14 - - - ``V4L2_MPEG_AUDIO_L1_BITRATE_448K`` - - - 448 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_32K`` + - 32 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_64K`` + - 64 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_96K`` + - 96 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_128K`` + - 128 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_160K`` + - 160 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_192K`` + - 192 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_224K`` + - 224 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_256K`` + - 256 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_288K`` + - 288 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_320K`` + - 320 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_352K`` + - 352 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_384K`` + - 384 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_416K`` + - 416 kbit/s + * - ``V4L2_MPEG_AUDIO_L1_BITRATE_448K`` + - 448 kbit/s @@ -518,90 +398,34 @@ enum v4l2_mpeg_audio_l2_bitrate - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_32K`` - - - 32 kbit/s - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_48K`` - - - 48 kbit/s - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_56K`` - - - 56 kbit/s - - - .. row 4 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_64K`` - - - 64 kbit/s - - - .. row 5 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_80K`` - - - 80 kbit/s - - - .. row 6 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_96K`` - - - 96 kbit/s - - - .. row 7 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_112K`` - - - 112 kbit/s - - - .. row 8 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_128K`` - - - 128 kbit/s - - - .. row 9 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_160K`` - - - 160 kbit/s - - - .. row 10 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_192K`` - - - 192 kbit/s - - - .. row 11 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_224K`` - - - 224 kbit/s - - - .. row 12 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_256K`` - - - 256 kbit/s - - - .. row 13 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_320K`` - - - 320 kbit/s - - - .. row 14 - - - ``V4L2_MPEG_AUDIO_L2_BITRATE_384K`` - - - 384 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_32K`` + - 32 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_48K`` + - 48 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_56K`` + - 56 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_64K`` + - 64 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_80K`` + - 80 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_96K`` + - 96 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_112K`` + - 112 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_128K`` + - 128 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_160K`` + - 160 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_192K`` + - 192 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_224K`` + - 224 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_256K`` + - 256 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_320K`` + - 320 kbit/s + * - ``V4L2_MPEG_AUDIO_L2_BITRATE_384K`` + - 384 kbit/s @@ -619,90 +443,34 @@ enum v4l2_mpeg_audio_l3_bitrate - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_32K`` - - - 32 kbit/s - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_40K`` - - - 40 kbit/s - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_48K`` - - - 48 kbit/s - - - .. row 4 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_56K`` - - - 56 kbit/s - - - .. row 5 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_64K`` - - - 64 kbit/s - - - .. row 6 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_80K`` - - - 80 kbit/s - - - .. row 7 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_96K`` - - - 96 kbit/s - - - .. row 8 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_112K`` - - - 112 kbit/s - - - .. row 9 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_128K`` - - - 128 kbit/s - - - .. row 10 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_160K`` - - - 160 kbit/s - - - .. row 11 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_192K`` - - - 192 kbit/s - - - .. row 12 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_224K`` - - - 224 kbit/s - - - .. row 13 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_256K`` - - - 256 kbit/s - - - .. row 14 - - - ``V4L2_MPEG_AUDIO_L3_BITRATE_320K`` - - - 320 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_32K`` + - 32 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_40K`` + - 40 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_48K`` + - 48 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_56K`` + - 56 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_64K`` + - 64 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_80K`` + - 80 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_96K`` + - 96 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_112K`` + - 112 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_128K`` + - 128 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_160K`` + - 160 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_192K`` + - 192 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_224K`` + - 224 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_256K`` + - 256 kbit/s + * - ``V4L2_MPEG_AUDIO_L3_BITRATE_320K`` + - 320 kbit/s @@ -723,120 +491,44 @@ enum v4l2_mpeg_audio_ac3_bitrate - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_32K`` - - - 32 kbit/s - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_40K`` - - - 40 kbit/s - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_48K`` - - - 48 kbit/s - - - .. row 4 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_56K`` - - - 56 kbit/s - - - .. row 5 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_64K`` - - - 64 kbit/s - - - .. row 6 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_80K`` - - - 80 kbit/s - - - .. row 7 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_96K`` - - - 96 kbit/s - - - .. row 8 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_112K`` - - - 112 kbit/s - - - .. row 9 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_128K`` - - - 128 kbit/s - - - .. row 10 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_160K`` - - - 160 kbit/s - - - .. row 11 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_192K`` - - - 192 kbit/s - - - .. row 12 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_224K`` - - - 224 kbit/s - - - .. row 13 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_256K`` - - - 256 kbit/s - - - .. row 14 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_320K`` - - - 320 kbit/s - - - .. row 15 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_384K`` - - - 384 kbit/s - - - .. row 16 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_448K`` - - - 448 kbit/s - - - .. row 17 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_512K`` - - - 512 kbit/s - - - .. row 18 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_576K`` - - - 576 kbit/s - - - .. row 19 - - - ``V4L2_MPEG_AUDIO_AC3_BITRATE_640K`` - - - 640 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_32K`` + - 32 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_40K`` + - 40 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_48K`` + - 48 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_56K`` + - 56 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_64K`` + - 64 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_80K`` + - 80 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_96K`` + - 96 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_112K`` + - 112 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_128K`` + - 128 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_160K`` + - 160 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_192K`` + - 192 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_224K`` + - 224 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_256K`` + - 256 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_320K`` + - 320 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_384K`` + - 384 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_448K`` + - 448 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_512K`` + - 512 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_576K`` + - 576 kbit/s + * - ``V4L2_MPEG_AUDIO_AC3_BITRATE_640K`` + - 640 kbit/s @@ -854,30 +546,14 @@ enum v4l2_mpeg_audio_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_MODE_STEREO`` - - - Stereo - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_MODE_JOINT_STEREO`` - - - Joint Stereo - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_MODE_DUAL`` - - - Bilingual - - - .. row 4 - - - ``V4L2_MPEG_AUDIO_MODE_MONO`` - - - Mono + * - ``V4L2_MPEG_AUDIO_MODE_STEREO`` + - Stereo + * - ``V4L2_MPEG_AUDIO_MODE_JOINT_STEREO`` + - Joint Stereo + * - ``V4L2_MPEG_AUDIO_MODE_DUAL`` + - Bilingual + * - ``V4L2_MPEG_AUDIO_MODE_MONO`` + - Mono @@ -897,30 +573,14 @@ enum v4l2_mpeg_audio_mode_extension - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4`` - - - Subbands 4-31 in intensity stereo - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8`` - - - Subbands 8-31 in intensity stereo - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12`` - - - Subbands 12-31 in intensity stereo - - - .. row 4 - - - ``V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16`` - - - Subbands 16-31 in intensity stereo + * - ``V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4`` + - Subbands 4-31 in intensity stereo + * - ``V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8`` + - Subbands 8-31 in intensity stereo + * - ``V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12`` + - Subbands 12-31 in intensity stereo + * - ``V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16`` + - Subbands 16-31 in intensity stereo @@ -938,24 +598,12 @@ enum v4l2_mpeg_audio_emphasis - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_EMPHASIS_NONE`` - - - None - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS`` - - - 50/15 microsecond emphasis - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17`` - - - CCITT J.17 + * - ``V4L2_MPEG_AUDIO_EMPHASIS_NONE`` + - None + * - ``V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS`` + - 50/15 microsecond emphasis + * - ``V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17`` + - CCITT J.17 @@ -973,18 +621,10 @@ enum v4l2_mpeg_audio_crc - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_CRC_NONE`` - - - None - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_CRC_CRC16`` - - - 16 bit parity check + * - ``V4L2_MPEG_AUDIO_CRC_NONE`` + - None + * - ``V4L2_MPEG_AUDIO_CRC_CRC16`` + - 16 bit parity check @@ -1011,42 +651,18 @@ enum v4l2_mpeg_audio_dec_playback - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO`` - - - Automatically determines the best playback mode. - - - .. row 2 - - - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO`` - - - Stereo playback. - - - .. row 3 - - - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT`` - - - Left channel playback. - - - .. row 4 - - - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT`` - - - Right channel playback. - - - .. row 5 - - - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO`` - - - Mono playback. - - - .. row 6 - - - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO`` - - - Stereo playback with swapped left and right channels. + * - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO`` + - Automatically determines the best playback mode. + * - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO`` + - Stereo playback. + * - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT`` + - Left channel playback. + * - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT`` + - Right channel playback. + * - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO`` + - Mono playback. + * - ``V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO`` + - Stereo playback with swapped left and right channels. @@ -1073,24 +689,12 @@ enum v4l2_mpeg_video_encoding - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_ENCODING_MPEG_1`` - - - MPEG-1 Video encoding - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_ENCODING_MPEG_2`` - - - MPEG-2 Video encoding - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC`` - - - MPEG-4 AVC (H.264) Video encoding + * - ``V4L2_MPEG_VIDEO_ENCODING_MPEG_1`` + - MPEG-1 Video encoding + * - ``V4L2_MPEG_VIDEO_ENCODING_MPEG_2`` + - MPEG-2 Video encoding + * - ``V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC`` + - MPEG-4 AVC (H.264) Video encoding @@ -1108,22 +712,10 @@ enum v4l2_mpeg_video_aspect - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_ASPECT_1x1`` - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_ASPECT_4x3`` - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_ASPECT_16x9`` - - - .. row 4 - - - ``V4L2_MPEG_VIDEO_ASPECT_221x100`` + * - ``V4L2_MPEG_VIDEO_ASPECT_1x1`` + * - ``V4L2_MPEG_VIDEO_ASPECT_4x3`` + * - ``V4L2_MPEG_VIDEO_ASPECT_16x9`` + * - ``V4L2_MPEG_VIDEO_ASPECT_221x100`` @@ -1153,18 +745,10 @@ enum v4l2_mpeg_video_bitrate_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_BITRATE_MODE_VBR`` - - - Variable bitrate - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_BITRATE_MODE_CBR`` - - - Constant bitrate + * - ``V4L2_MPEG_VIDEO_BITRATE_MODE_VBR`` + - Variable bitrate + * - ``V4L2_MPEG_VIDEO_BITRATE_MODE_CBR`` + - Constant bitrate @@ -1195,30 +779,14 @@ enum v4l2_mpeg_video_bitrate_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - Bit 0:7 - - - V chrominance information - - - .. row 2 - - - Bit 8:15 - - - U chrominance information - - - .. row 3 - - - Bit 16:23 - - - Y luminance information - - - .. row 4 - - - Bit 24:31 - - - Must be zero. + * - Bit 0:7 + - V chrominance information + * - Bit 8:15 + - U chrominance information + * - Bit 16:23 + - Y luminance information + * - Bit 24:31 + - Must be zero. @@ -1262,114 +830,42 @@ enum v4l2_mpeg_video_h264_vui_sar_idc - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED`` - - - Unspecified - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1`` - - - 1x1 - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11`` - - - 12x11 - - - .. row 4 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11`` - - - 10x11 - - - .. row 5 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11`` - - - 16x11 - - - .. row 6 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33`` - - - 40x33 - - - .. row 7 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11`` - - - 24x11 - - - .. row 8 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11`` - - - 20x11 - - - .. row 9 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11`` - - - 32x11 - - - .. row 10 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33`` - - - 80x33 - - - .. row 11 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11`` - - - 18x11 - - - .. row 12 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11`` - - - 15x11 - - - .. row 13 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33`` - - - 64x33 - - - .. row 14 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99`` - - - 160x99 - - - .. row 15 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3`` - - - 4x3 - - - .. row 16 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2`` - - - 3x2 - - - .. row 17 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1`` - - - 2x1 - - - .. row 18 - - - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED`` - - - Extended SAR + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED`` + - Unspecified + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1`` + - 1x1 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11`` + - 12x11 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11`` + - 10x11 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11`` + - 16x11 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33`` + - 40x33 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11`` + - 24x11 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11`` + - 20x11 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11`` + - 32x11 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33`` + - 80x33 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11`` + - 18x11 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11`` + - 15x11 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33`` + - 64x33 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99`` + - 160x99 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3`` + - 4x3 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2`` + - 3x2 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1`` + - 2x1 + * - ``V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED`` + - Extended SAR @@ -1396,102 +892,38 @@ enum v4l2_mpeg_video_h264_level - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_1_0`` - - - Level 1.0 - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_1B`` - - - Level 1B - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_1_1`` - - - Level 1.1 - - - .. row 4 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_1_2`` - - - Level 1.2 - - - .. row 5 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_1_3`` - - - Level 1.3 - - - .. row 6 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_2_0`` - - - Level 2.0 - - - .. row 7 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_2_1`` - - - Level 2.1 - - - .. row 8 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_2_2`` - - - Level 2.2 - - - .. row 9 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_3_0`` - - - Level 3.0 - - - .. row 10 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_3_1`` - - - Level 3.1 - - - .. row 11 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_3_2`` - - - Level 3.2 - - - .. row 12 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_4_0`` - - - Level 4.0 - - - .. row 13 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_4_1`` - - - Level 4.1 - - - .. row 14 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_4_2`` - - - Level 4.2 - - - .. row 15 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_5_0`` - - - Level 5.0 - - - .. row 16 - - - ``V4L2_MPEG_VIDEO_H264_LEVEL_5_1`` - - - Level 5.1 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_1_0`` + - Level 1.0 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_1B`` + - Level 1B + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_1_1`` + - Level 1.1 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_1_2`` + - Level 1.2 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_1_3`` + - Level 1.3 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_2_0`` + - Level 2.0 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_2_1`` + - Level 2.1 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_2_2`` + - Level 2.2 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_3_0`` + - Level 3.0 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_3_1`` + - Level 3.1 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_3_2`` + - Level 3.2 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_4_0`` + - Level 4.0 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_4_1`` + - Level 4.1 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_4_2`` + - Level 4.2 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_5_0`` + - Level 5.0 + * - ``V4L2_MPEG_VIDEO_H264_LEVEL_5_1`` + - Level 5.1 @@ -1510,54 +942,22 @@ enum v4l2_mpeg_video_mpeg4_level - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_LEVEL_0`` - - - Level 0 - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_LEVEL_0B`` - - - Level 0b - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_LEVEL_1`` - - - Level 1 - - - .. row 4 - - - ``V4L2_MPEG_VIDEO_LEVEL_2`` - - - Level 2 - - - .. row 5 - - - ``V4L2_MPEG_VIDEO_LEVEL_3`` - - - Level 3 - - - .. row 6 - - - ``V4L2_MPEG_VIDEO_LEVEL_3B`` - - - Level 3b - - - .. row 7 - - - ``V4L2_MPEG_VIDEO_LEVEL_4`` - - - Level 4 - - - .. row 8 - - - ``V4L2_MPEG_VIDEO_LEVEL_5`` - - - Level 5 + * - ``V4L2_MPEG_VIDEO_LEVEL_0`` + - Level 0 + * - ``V4L2_MPEG_VIDEO_LEVEL_0B`` + - Level 0b + * - ``V4L2_MPEG_VIDEO_LEVEL_1`` + - Level 1 + * - ``V4L2_MPEG_VIDEO_LEVEL_2`` + - Level 2 + * - ``V4L2_MPEG_VIDEO_LEVEL_3`` + - Level 3 + * - ``V4L2_MPEG_VIDEO_LEVEL_3B`` + - Level 3b + * - ``V4L2_MPEG_VIDEO_LEVEL_4`` + - Level 4 + * - ``V4L2_MPEG_VIDEO_LEVEL_5`` + - Level 5 @@ -1576,108 +976,40 @@ enum v4l2_mpeg_video_h264_profile - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE`` - - - Baseline profile - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE`` - - - Constrained Baseline profile - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_MAIN`` - - - Main profile - - - .. row 4 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED`` - - - Extended profile - - - .. row 5 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH`` - - - High profile - - - .. row 6 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10`` - - - High 10 profile - - - .. row 7 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422`` - - - High 422 profile - - - .. row 8 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE`` - - - High 444 Predictive profile - - - .. row 9 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA`` - - - High 10 Intra profile - - - .. row 10 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA`` - - - High 422 Intra profile - - - .. row 11 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA`` - - - High 444 Intra profile - - - .. row 12 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA`` - - - CAVLC 444 Intra profile - - - .. row 13 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE`` - - - Scalable Baseline profile - - - .. row 14 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH`` - - - Scalable High profile - - - .. row 15 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA`` - - - Scalable High Intra profile - - - .. row 16 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH`` - - - Stereo High profile - - - .. row 17 - - - ``V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH`` - - - Multiview High profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE`` + - Baseline profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE`` + - Constrained Baseline profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_MAIN`` + - Main profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED`` + - Extended profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH`` + - High profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10`` + - High 10 profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422`` + - High 422 profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE`` + - High 444 Predictive profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA`` + - High 10 Intra profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA`` + - High 422 Intra profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA`` + - High 444 Intra profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA`` + - CAVLC 444 Intra profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE`` + - Scalable Baseline profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH`` + - Scalable High profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA`` + - Scalable High Intra profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH`` + - Stereo High profile + * - ``V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH`` + - Multiview High profile @@ -1696,36 +1028,16 @@ enum v4l2_mpeg_video_mpeg4_profile - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_PROFILE_SIMPLE`` - - - Simple profile - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_PROFILE_ADVANCED_SIMPLE`` - - - Advanced Simple profile - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_PROFILE_CORE`` - - - Core profile - - - .. row 4 - - - ``V4L2_MPEG_VIDEO_PROFILE_SIMPLE_SCALABLE`` - - - Simple Scalable profile - - - .. row 5 - - - ``V4L2_MPEG_VIDEO_PROFILE_ADVANCED_CODING_EFFICIENCY`` - - - + * - ``V4L2_MPEG_VIDEO_PROFILE_SIMPLE`` + - Simple profile + * - ``V4L2_MPEG_VIDEO_PROFILE_ADVANCED_SIMPLE`` + - Advanced Simple profile + * - ``V4L2_MPEG_VIDEO_PROFILE_CORE`` + - Core profile + * - ``V4L2_MPEG_VIDEO_PROFILE_SIMPLE_SCALABLE`` + - Simple Scalable profile + * - ``V4L2_MPEG_VIDEO_PROFILE_ADVANCED_CODING_EFFICIENCY`` + - @@ -1750,24 +1062,12 @@ enum v4l2_mpeg_video_multi_slice_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE`` - - - Single slice per frame. - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB`` - - - Multiple slices with set maximum number of macroblocks per slice. - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES`` - - - Multiple slice with set maximum size in bytes per slice. + * - ``V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE`` + - Single slice per frame. + * - ``V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB`` + - Multiple slices with set maximum number of macroblocks per slice. + * - ``V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES`` + - Multiple slice with set maximum size in bytes per slice. @@ -1799,23 +1099,12 @@ enum v4l2_mpeg_video_h264_loop_filter_mode - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED`` - - - Loop filter is enabled. - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED`` - - - Loop filter is disabled. - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY`` - - - Loop filter is disabled at the slice boundary. + * - ``V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED`` + - Loop filter is enabled. + * - ``V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED`` + - Loop filter is disabled. + * - ``V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY`` + - Loop filter is disabled at the slice boundary. @@ -1842,18 +1131,10 @@ enum v4l2_mpeg_video_h264_entropy_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC`` - - - Use CAVLC entropy coding. - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC`` - - - Use CABAC entropy coding. + * - ``V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC`` + - Use CAVLC entropy coding. + * - ``V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC`` + - Use CABAC entropy coding. @@ -2009,19 +1290,11 @@ enum v4l2_mpeg_video_header_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE`` - - - The stream header is returned separately in the first buffer. - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME`` - - - The stream header is returned together with the first encoded - frame. + * - ``V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE`` + - The stream header is returned separately in the first buffer. + * - ``V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME`` + - The stream header is returned together with the first encoded + frame. @@ -2067,41 +1340,18 @@ enum v4l2_mpeg_video_h264_sei_fp_arrangement_type - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHEKERBOARD`` - - - Pixels are alternatively from L and R. - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_COLUMN`` - - - L and R are interlaced by column. - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_ROW`` - - - L and R are interlaced by row. - - - .. row 4 - - - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_SIDE_BY_SIDE`` - - - L is on the left, R on the right. - - - .. row 5 - - - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM`` - - - L is on top, R on bottom. - - - .. row 6 - - - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TEMPORAL`` - - - One view per frame. + * - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHEKERBOARD`` + - Pixels are alternatively from L and R. + * - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_COLUMN`` + - L and R are interlaced by column. + * - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_ROW`` + - L and R are interlaced by row. + * - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_SIDE_BY_SIDE`` + - L is on the left, R on the right. + * - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM`` + - L is on top, R on bottom. + * - ``V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TEMPORAL`` + - One view per frame. @@ -2126,49 +1376,22 @@ enum v4l2_mpeg_video_h264_fmo_map_type - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES`` - - - Slices are interleaved one after other with macroblocks in run - length order. - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES`` - - - Scatters the macroblocks based on a mathematical function known to - both encoder and decoder. - - - .. row 3 - - - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER`` - - - Macroblocks arranged in rectangular areas or regions of interest. - - - .. row 4 - - - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT`` - - - Slice groups grow in a cyclic way from centre to outwards. - - - .. row 5 - - - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN`` - - - Slice groups grow in raster scan pattern from left to right. - - - .. row 6 - - - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN`` - - - Slice groups grow in wipe scan pattern from top to bottom. - - - .. row 7 - - - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT`` - - - User defined map type. + * - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES`` + - Slices are interleaved one after other with macroblocks in run + length order. + * - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES`` + - Scatters the macroblocks based on a mathematical function known to + both encoder and decoder. + * - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER`` + - Macroblocks arranged in rectangular areas or regions of interest. + * - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT`` + - Slice groups grow in a cyclic way from centre to outwards. + * - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN`` + - Slice groups grow in raster scan pattern from left to right. + * - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN`` + - Slice groups grow in wipe scan pattern from top to bottom. + * - ``V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT`` + - User defined map type. @@ -2190,18 +1413,10 @@ enum v4l2_mpeg_video_h264_fmo_change_dir - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT`` - - - Raster scan or wipe right. - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT`` - - - Reverse raster scan or wipe left. + * - ``V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT`` + - Raster scan or wipe right. + * - ``V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT`` + - Reverse raster scan or wipe left. @@ -2228,18 +1443,10 @@ enum v4l2_mpeg_video_h264_fmo_change_dir - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - Bit 0:15 - - - Slice ID - - - .. row 2 - - - Bit 16:32 - - - Slice position or order + * - Bit 0:15 + - Slice ID + * - Bit 16:32 + - Slice position or order @@ -2261,18 +1468,10 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B`` - - - Hierarchical B coding. - - - .. row 2 - - - ``V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P`` - - - Hierarchical P coding. + * - ``V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B`` + - Hierarchical B coding. + * - ``V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P`` + - Hierarchical P coding. @@ -2291,18 +1490,10 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - Bit 0:15 - - - QP value - - - .. row 2 - - - Bit 16:32 - - - Layer number + * - Bit 0:15 + - QP value + * - Bit 16:32 + - Layer number @@ -2354,30 +1545,14 @@ MFC 5.1 Control IDs :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - Bit 0:7 - - - V chrominance information - - - .. row 2 - - - Bit 8:15 - - - U chrominance information - - - .. row 3 - - - Bit 16:23 - - - Y luminance information - - - .. row 4 - - - Bit 24:31 - - - Must be zero. + * - Bit 0:7 + - V chrominance information + * - Bit 8:15 + - U chrominance information + * - Bit 16:23 + - Y luminance information + * - Bit 24:31 + - Must be zero. @@ -2436,25 +1611,14 @@ enum v4l2_mpeg_mfc51_video_frame_skip_mode - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_MPEG_MFC51_FRAME_SKIP_MODE_DISABLED`` - - - Frame skip mode is disabled. - - - .. row 2 - - - ``V4L2_MPEG_MFC51_FRAME_SKIP_MODE_LEVEL_LIMIT`` - - - Frame skip mode enabled and buffer limit is set by the chosen - level and is defined by the standard. - - - .. row 3 - - - ``V4L2_MPEG_MFC51_FRAME_SKIP_MODE_BUF_LIMIT`` - - - Frame skip mode enabled and buffer limit is set by the VBV - (MPEG1/2/4) or CPB (H264) buffer size control. + * - ``V4L2_MPEG_MFC51_FRAME_SKIP_MODE_DISABLED`` + - Frame skip mode is disabled. + * - ``V4L2_MPEG_MFC51_FRAME_SKIP_MODE_LEVEL_LIMIT`` + - Frame skip mode enabled and buffer limit is set by the chosen + level and is defined by the standard. + * - ``V4L2_MPEG_MFC51_FRAME_SKIP_MODE_BUF_LIMIT`` + - Frame skip mode enabled and buffer limit is set by the VBV + (MPEG1/2/4) or CPB (H264) buffer size control. @@ -2485,24 +1649,12 @@ enum v4l2_mpeg_mfc51_video_force_frame_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_MFC51_FORCE_FRAME_TYPE_DISABLED`` - - - Forcing a specific frame type disabled. - - - .. row 2 - - - ``V4L2_MPEG_MFC51_FORCE_FRAME_TYPE_I_FRAME`` - - - Force an I-frame. - - - .. row 3 - - - ``V4L2_MPEG_MFC51_FORCE_FRAME_TYPE_NOT_CODED`` - - - Force a non-coded frame. + * - ``V4L2_MPEG_MFC51_FORCE_FRAME_TYPE_DISABLED`` + - Forcing a specific frame type disabled. + * - ``V4L2_MPEG_MFC51_FORCE_FRAME_TYPE_I_FRAME`` + - Force an I-frame. + * - ``V4L2_MPEG_MFC51_FORCE_FRAME_TYPE_NOT_CODED`` + - Force a non-coded frame. @@ -2534,18 +1686,10 @@ enum v4l2_mpeg_cx2341x_video_spatial_filter_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL`` - - - Choose the filter manually - - - .. row 2 - - - ``V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO`` - - - Choose the filter automatically + * - ``V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL`` + - Choose the filter manually + * - ``V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO`` + - Choose the filter automatically @@ -2570,36 +1714,16 @@ enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF`` - - - No filter - - - .. row 2 - - - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR`` - - - One-dimensional horizontal - - - .. row 3 - - - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT`` - - - One-dimensional vertical - - - .. row 4 - - - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE`` - - - Two-dimensional separable - - - .. row 5 - - - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE`` - - - Two-dimensional symmetrical non-separable + * - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF`` + - No filter + * - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR`` + - One-dimensional horizontal + * - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT`` + - One-dimensional vertical + * - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE`` + - Two-dimensional separable + * - ``V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE`` + - Two-dimensional symmetrical non-separable @@ -2618,18 +1742,10 @@ enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF`` - - - No filter - - - .. row 2 - - - ``V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR`` - - - One-dimensional horizontal + * - ``V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF`` + - No filter + * - ``V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR`` + - One-dimensional horizontal @@ -2648,18 +1764,10 @@ enum v4l2_mpeg_cx2341x_video_temporal_filter_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL`` - - - Choose the filter manually - - - .. row 2 - - - ``V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO`` - - - Choose the filter automatically + * - ``V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL`` + - Choose the filter manually + * - ``V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO`` + - Choose the filter automatically @@ -2681,36 +1789,16 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF`` - - - No filter - - - .. row 2 - - - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR`` - - - Horizontal filter - - - .. row 3 - - - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT`` - - - Vertical filter - - - .. row 4 - - - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT`` - - - Horizontal and vertical filter - - - .. row 5 - - - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG`` - - - Diagonal filter + * - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF`` + - No filter + * - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR`` + - Horizontal filter + * - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT`` + - Vertical filter + * - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT`` + - Horizontal and vertical filter + * - ``V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG`` + - Diagonal filter @@ -2766,30 +1854,14 @@ enum v4l2_vp8_num_partitions - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION`` - - - 1 coefficient partition - - - .. row 2 - - - ``V4L2_CID_MPEG_VIDEO_VPX_2_PARTITIONS`` - - - 2 coefficient partitions - - - .. row 3 - - - ``V4L2_CID_MPEG_VIDEO_VPX_4_PARTITIONS`` - - - 4 coefficient partitions - - - .. row 4 - - - ``V4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS`` - - - 8 coefficient partitions + * - ``V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION`` + - 1 coefficient partition + * - ``V4L2_CID_MPEG_VIDEO_VPX_2_PARTITIONS`` + - 2 coefficient partitions + * - ``V4L2_CID_MPEG_VIDEO_VPX_4_PARTITIONS`` + - 4 coefficient partitions + * - ``V4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS`` + - 8 coefficient partitions @@ -2811,26 +1883,15 @@ enum v4l2_vp8_num_ref_frames - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME`` - - - Last encoded frame will be searched - - - .. row 2 - - - ``V4L2_CID_MPEG_VIDEO_VPX_2_REF_FRAME`` - - - Two frames will be searched among the last encoded frame, the - golden frame and the alternate reference (altref) frame. The - encoder implementation will decide which two are chosen. - - - .. row 3 - - - ``V4L2_CID_MPEG_VIDEO_VPX_3_REF_FRAME`` - - - The last encoded frame, the golden frame and the altref frame will - be searched. + * - ``V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME`` + - Last encoded frame will be searched + * - ``V4L2_CID_MPEG_VIDEO_VPX_2_REF_FRAME`` + - Two frames will be searched among the last encoded frame, the + golden frame and the alternate reference (altref) frame. The + encoder implementation will decide which two are chosen. + * - ``V4L2_CID_MPEG_VIDEO_VPX_3_REF_FRAME`` + - The last encoded frame, the golden frame and the altref frame will + be searched. @@ -2869,20 +1930,13 @@ enum v4l2_vp8_golden_frame_sel - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_PREV`` - - - Use the (n-2)th frame as a golden frame, current frame index being - 'n'. - - - .. row 2 - - - ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_REF_PERIOD`` - - - Use the previous specific frame indicated by - ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD`` as a - golden frame. + * - ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_PREV`` + - Use the (n-2)th frame as a golden frame, current frame index being + 'n'. + * - ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_REF_PERIOD`` + - Use the previous specific frame indicated by + ``V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD`` as a + golden frame. .. raw:: latex @@ -2942,30 +1996,14 @@ enum v4l2_exposure_auto_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_EXPOSURE_AUTO`` - - - Automatic exposure time, automatic iris aperture. - - - .. row 2 - - - ``V4L2_EXPOSURE_MANUAL`` - - - Manual exposure time, manual iris. - - - .. row 3 - - - ``V4L2_EXPOSURE_SHUTTER_PRIORITY`` - - - Manual exposure time, auto iris. - - - .. row 4 - - - ``V4L2_EXPOSURE_APERTURE_PRIORITY`` - - - Auto exposure time, manual iris. + * - ``V4L2_EXPOSURE_AUTO`` + - Automatic exposure time, automatic iris aperture. + * - ``V4L2_EXPOSURE_MANUAL`` + - Manual exposure time, manual iris. + * - ``V4L2_EXPOSURE_SHUTTER_PRIORITY`` + - Manual exposure time, auto iris. + * - ``V4L2_EXPOSURE_APERTURE_PRIORITY`` + - Auto exposure time, manual iris. @@ -3008,34 +2046,19 @@ enum v4l2_exposure_metering - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_EXPOSURE_METERING_AVERAGE`` - - - Use the light information coming from the entire frame and average - giving no weighting to any particular portion of the metered area. - - - .. row 2 - - - ``V4L2_EXPOSURE_METERING_CENTER_WEIGHTED`` - - - Average the light information coming from the entire frame giving - priority to the center of the metered area. - - - .. row 3 - - - ``V4L2_EXPOSURE_METERING_SPOT`` - - - Measure only very small area at the center of the frame. - - - .. row 4 - - - ``V4L2_EXPOSURE_METERING_MATRIX`` - - - A multi-zone metering. The light intensity is measured in several - points of the frame and the results are combined. The algorithm of - the zones selection and their significance in calculating the - final value is device dependent. + * - ``V4L2_EXPOSURE_METERING_AVERAGE`` + - Use the light information coming from the entire frame and average + giving no weighting to any particular portion of the metered area. + * - ``V4L2_EXPOSURE_METERING_CENTER_WEIGHTED`` + - Average the light information coming from the entire frame giving + priority to the center of the metered area. + * - ``V4L2_EXPOSURE_METERING_SPOT`` + - Measure only very small area at the center of the frame. + * - ``V4L2_EXPOSURE_METERING_MATRIX`` + - A multi-zone metering. The light intensity is measured in several + points of the frame and the results are combined. The algorithm of + the zones selection and their significance in calculating the + final value is device dependent. @@ -3115,30 +2138,15 @@ enum v4l2_exposure_metering - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_AUTO_FOCUS_STATUS_IDLE`` - - - Automatic focus is not active. - - - .. row 2 - - - ``V4L2_AUTO_FOCUS_STATUS_BUSY`` - - - Automatic focusing is in progress. - - - .. row 3 - - - ``V4L2_AUTO_FOCUS_STATUS_REACHED`` - - - Focus has been reached. - - - .. row 4 - - - ``V4L2_AUTO_FOCUS_STATUS_FAILED`` - - - Automatic focus has failed, the driver will not transition from - this state until another action is performed by an application. + * - ``V4L2_AUTO_FOCUS_STATUS_IDLE`` + - Automatic focus is not active. + * - ``V4L2_AUTO_FOCUS_STATUS_BUSY`` + - Automatic focusing is in progress. + * - ``V4L2_AUTO_FOCUS_STATUS_REACHED`` + - Focus has been reached. + * - ``V4L2_AUTO_FOCUS_STATUS_FAILED`` + - Automatic focus has failed, the driver will not transition from + this state until another action is performed by an application. @@ -3156,32 +2164,16 @@ enum v4l2_auto_focus_range - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_AUTO_FOCUS_RANGE_AUTO`` - - - The camera automatically selects the focus range. - - - .. row 2 - - - ``V4L2_AUTO_FOCUS_RANGE_NORMAL`` - - - Normal distance range, limited for best automatic focus - performance. - - - .. row 3 - - - ``V4L2_AUTO_FOCUS_RANGE_MACRO`` - - - Macro (close-up) auto focus. The camera will use its minimum - possible distance for auto focus. - - - .. row 4 - - - ``V4L2_AUTO_FOCUS_RANGE_INFINITY`` - - - The lens is set to focus on an object at infinite distance. + * - ``V4L2_AUTO_FOCUS_RANGE_AUTO`` + - The camera automatically selects the focus range. + * - ``V4L2_AUTO_FOCUS_RANGE_NORMAL`` + - Normal distance range, limited for best automatic focus + performance. + * - ``V4L2_AUTO_FOCUS_RANGE_MACRO`` + - Macro (close-up) auto focus. The camera will use its minimum + possible distance for auto focus. + * - ``V4L2_AUTO_FOCUS_RANGE_INFINITY`` + - The lens is set to focus on an object at infinite distance. @@ -3247,76 +2239,37 @@ enum v4l2_auto_n_preset_white_balance - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_WHITE_BALANCE_MANUAL`` - - - Manual white balance. - - - .. row 2 - - - ``V4L2_WHITE_BALANCE_AUTO`` - - - Automatic white balance adjustments. - - - .. row 3 - - - ``V4L2_WHITE_BALANCE_INCANDESCENT`` - - - White balance setting for incandescent (tungsten) lighting. It - generally cools down the colors and corresponds approximately to - 2500...3500 K color temperature range. - - - .. row 4 - - - ``V4L2_WHITE_BALANCE_FLUORESCENT`` - - - White balance preset for fluorescent lighting. It corresponds - approximately to 4000...5000 K color temperature. - - - .. row 5 - - - ``V4L2_WHITE_BALANCE_FLUORESCENT_H`` - - - With this setting the camera will compensate for fluorescent H - lighting. - - - .. row 6 - - - ``V4L2_WHITE_BALANCE_HORIZON`` - - - White balance setting for horizon daylight. It corresponds - approximately to 5000 K color temperature. - - - .. row 7 - - - ``V4L2_WHITE_BALANCE_DAYLIGHT`` - - - White balance preset for daylight (with clear sky). It corresponds - approximately to 5000...6500 K color temperature. - - - .. row 8 - - - ``V4L2_WHITE_BALANCE_FLASH`` - - - With this setting the camera will compensate for the flash light. - It slightly warms up the colors and corresponds roughly to - 5000...5500 K color temperature. - - - .. row 9 - - - ``V4L2_WHITE_BALANCE_CLOUDY`` - - - White balance preset for moderately overcast sky. This option - corresponds approximately to 6500...8000 K color temperature - range. - - - .. row 10 - - - ``V4L2_WHITE_BALANCE_SHADE`` - - - White balance preset for shade or heavily overcast sky. It - corresponds approximately to 9000...10000 K color temperature. + * - ``V4L2_WHITE_BALANCE_MANUAL`` + - Manual white balance. + * - ``V4L2_WHITE_BALANCE_AUTO`` + - Automatic white balance adjustments. + * - ``V4L2_WHITE_BALANCE_INCANDESCENT`` + - White balance setting for incandescent (tungsten) lighting. It + generally cools down the colors and corresponds approximately to + 2500...3500 K color temperature range. + * - ``V4L2_WHITE_BALANCE_FLUORESCENT`` + - White balance preset for fluorescent lighting. It corresponds + approximately to 4000...5000 K color temperature. + * - ``V4L2_WHITE_BALANCE_FLUORESCENT_H`` + - With this setting the camera will compensate for fluorescent H + lighting. + * - ``V4L2_WHITE_BALANCE_HORIZON`` + - White balance setting for horizon daylight. It corresponds + approximately to 5000 K color temperature. + * - ``V4L2_WHITE_BALANCE_DAYLIGHT`` + - White balance preset for daylight (with clear sky). It corresponds + approximately to 5000...6500 K color temperature. + * - ``V4L2_WHITE_BALANCE_FLASH`` + - With this setting the camera will compensate for the flash light. + It slightly warms up the colors and corresponds roughly to + 5000...5500 K color temperature. + * - ``V4L2_WHITE_BALANCE_CLOUDY`` + - White balance preset for moderately overcast sky. This option + corresponds approximately to 6500...8000 K color temperature + range. + * - ``V4L2_WHITE_BALANCE_SHADE`` + - White balance preset for shade or heavily overcast sky. It + corresponds approximately to 9000...10000 K color temperature. @@ -3362,18 +2315,10 @@ enum v4l2_iso_sensitivity_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_CID_ISO_SENSITIVITY_MANUAL`` - - - Manual ISO sensitivity. - - - .. row 2 - - - ``V4L2_CID_ISO_SENSITIVITY_AUTO`` - - - Automatic ISO sensitivity adjustments. + * - ``V4L2_CID_ISO_SENSITIVITY_MANUAL`` + - Manual ISO sensitivity. + * - ``V4L2_CID_ISO_SENSITIVITY_AUTO`` + - Automatic ISO sensitivity adjustments. @@ -3400,126 +2345,71 @@ enum v4l2_scene_mode - :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_SCENE_MODE_NONE`` - - - The scene mode feature is disabled. - - - .. row 2 - - - ``V4L2_SCENE_MODE_BACKLIGHT`` - - - Backlight. Compensates for dark shadows when light is coming from - behind a subject, also by automatically turning on the flash. - - - .. row 3 - - - ``V4L2_SCENE_MODE_BEACH_SNOW`` - - - Beach and snow. This mode compensates for all-white or bright - scenes, which tend to look gray and low contrast, when camera's - automatic exposure is based on an average scene brightness. To - compensate, this mode automatically slightly overexposes the - frames. The white balance may also be adjusted to compensate for - the fact that reflected snow looks bluish rather than white. - - - .. row 4 - - - ``V4L2_SCENE_MODE_CANDLELIGHT`` - - - Candle light. The camera generally raises the ISO sensitivity and - lowers the shutter speed. This mode compensates for relatively - close subject in the scene. The flash is disabled in order to - preserve the ambiance of the light. - - - .. row 5 - - - ``V4L2_SCENE_MODE_DAWN_DUSK`` - - - Dawn and dusk. Preserves the colors seen in low natural light - before dusk and after down. The camera may turn off the flash, and - automatically focus at infinity. It will usually boost saturation - and lower the shutter speed. - - - .. row 6 - - - ``V4L2_SCENE_MODE_FALL_COLORS`` - - - Fall colors. Increases saturation and adjusts white balance for - color enhancement. Pictures of autumn leaves get saturated reds - and yellows. - - - .. row 7 - - - ``V4L2_SCENE_MODE_FIREWORKS`` - - - Fireworks. Long exposure times are used to capture the expanding - burst of light from a firework. The camera may invoke image - stabilization. - - - .. row 8 - - - ``V4L2_SCENE_MODE_LANDSCAPE`` - - - Landscape. The camera may choose a small aperture to provide deep - depth of field and long exposure duration to help capture detail - in dim light conditions. The focus is fixed at infinity. Suitable - for distant and wide scenery. - - - .. row 9 - - - ``V4L2_SCENE_MODE_NIGHT`` - - - Night, also known as Night Landscape. Designed for low light - conditions, it preserves detail in the dark areas without blowing - out bright objects. The camera generally sets itself to a - medium-to-high ISO sensitivity, with a relatively long exposure - time, and turns flash off. As such, there will be increased image - noise and the possibility of blurred image. - - - .. row 10 - - - ``V4L2_SCENE_MODE_PARTY_INDOOR`` - - - Party and indoor. Designed to capture indoor scenes that are lit - by indoor background lighting as well as the flash. The camera - usually increases ISO sensitivity, and adjusts exposure for the - low light conditions. - - - .. row 11 - - - ``V4L2_SCENE_MODE_PORTRAIT`` - - - Portrait. The camera adjusts the aperture so that the depth of - field is reduced, which helps to isolate the subject against a - smooth background. Most cameras recognize the presence of faces in - the scene and focus on them. The color hue is adjusted to enhance - skin tones. The intensity of the flash is often reduced. - - - .. row 12 - - - ``V4L2_SCENE_MODE_SPORTS`` - - - Sports. Significantly increases ISO and uses a fast shutter speed - to freeze motion of rapidly-moving subjects. Increased image noise - may be seen in this mode. - - - .. row 13 - - - ``V4L2_SCENE_MODE_SUNSET`` - - - Sunset. Preserves deep hues seen in sunsets and sunrises. It bumps - up the saturation. - - - .. row 14 - - - ``V4L2_SCENE_MODE_TEXT`` - - - Text. It applies extra contrast and sharpness, it is typically a - black-and-white mode optimized for readability. Automatic focus - may be switched to close-up mode and this setting may also involve - some lens-distortion correction. + * - ``V4L2_SCENE_MODE_NONE`` + - The scene mode feature is disabled. + * - ``V4L2_SCENE_MODE_BACKLIGHT`` + - Backlight. Compensates for dark shadows when light is coming from + behind a subject, also by automatically turning on the flash. + * - ``V4L2_SCENE_MODE_BEACH_SNOW`` + - Beach and snow. This mode compensates for all-white or bright + scenes, which tend to look gray and low contrast, when camera's + automatic exposure is based on an average scene brightness. To + compensate, this mode automatically slightly overexposes the + frames. The white balance may also be adjusted to compensate for + the fact that reflected snow looks bluish rather than white. + * - ``V4L2_SCENE_MODE_CANDLELIGHT`` + - Candle light. The camera generally raises the ISO sensitivity and + lowers the shutter speed. This mode compensates for relatively + close subject in the scene. The flash is disabled in order to + preserve the ambiance of the light. + * - ``V4L2_SCENE_MODE_DAWN_DUSK`` + - Dawn and dusk. Preserves the colors seen in low natural light + before dusk and after down. The camera may turn off the flash, and + automatically focus at infinity. It will usually boost saturation + and lower the shutter speed. + * - ``V4L2_SCENE_MODE_FALL_COLORS`` + - Fall colors. Increases saturation and adjusts white balance for + color enhancement. Pictures of autumn leaves get saturated reds + and yellows. + * - ``V4L2_SCENE_MODE_FIREWORKS`` + - Fireworks. Long exposure times are used to capture the expanding + burst of light from a firework. The camera may invoke image + stabilization. + * - ``V4L2_SCENE_MODE_LANDSCAPE`` + - Landscape. The camera may choose a small aperture to provide deep + depth of field and long exposure duration to help capture detail + in dim light conditions. The focus is fixed at infinity. Suitable + for distant and wide scenery. + * - ``V4L2_SCENE_MODE_NIGHT`` + - Night, also known as Night Landscape. Designed for low light + conditions, it preserves detail in the dark areas without blowing + out bright objects. The camera generally sets itself to a + medium-to-high ISO sensitivity, with a relatively long exposure + time, and turns flash off. As such, there will be increased image + noise and the possibility of blurred image. + * - ``V4L2_SCENE_MODE_PARTY_INDOOR`` + - Party and indoor. Designed to capture indoor scenes that are lit + by indoor background lighting as well as the flash. The camera + usually increases ISO sensitivity, and adjusts exposure for the + low light conditions. + * - ``V4L2_SCENE_MODE_PORTRAIT`` + - Portrait. The camera adjusts the aperture so that the depth of + field is reduced, which helps to isolate the subject against a + smooth background. Most cameras recognize the presence of faces in + the scene and focus on them. The color hue is adjusted to enhance + skin tones. The intensity of the flash is often reduced. + * - ``V4L2_SCENE_MODE_SPORTS`` + - Sports. Significantly increases ISO and uses a fast shutter speed + to freeze motion of rapidly-moving subjects. Increased image noise + may be seen in this mode. + * - ``V4L2_SCENE_MODE_SUNSET`` + - Sunset. Preserves deep hues seen in sunsets and sunrises. It bumps + up the saturation. + * - ``V4L2_SCENE_MODE_TEXT`` + - Text. It applies extra contrast and sharpness, it is typically a + black-and-white mode optimized for readability. Automatic focus + may be switched to close-up mode and this setting may also involve + some lens-distortion correction. @@ -3543,24 +2433,12 @@ enum v4l2_scene_mode - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_LOCK_EXPOSURE`` - - - Automatic exposure adjustments lock. - - - .. row 2 - - - ``V4L2_LOCK_WHITE_BALANCE`` - - - Automatic white balance adjustments lock. - - - .. row 3 - - - ``V4L2_LOCK_FOCUS`` - - - Automatic focus lock. + * - ``V4L2_LOCK_EXPOSURE`` + - Automatic exposure adjustments lock. + * - ``V4L2_LOCK_WHITE_BALANCE`` + - Automatic white balance adjustments lock. + * - ``V4L2_LOCK_FOCUS`` + - Automatic focus lock. @@ -3736,24 +2614,12 @@ enum v4l2_preemphasis - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_PREEMPHASIS_DISABLED`` - - - No pre-emphasis is applied. - - - .. row 2 - - - ``V4L2_PREEMPHASIS_50_uS`` - - - A pre-emphasis of 50 uS is used. - - - .. row 3 - - - ``V4L2_PREEMPHASIS_75_uS`` - - - A pre-emphasis of 75 uS is used. + * - ``V4L2_PREEMPHASIS_DISABLED`` + - No pre-emphasis is applied. + * - ``V4L2_PREEMPHASIS_50_uS`` + - A pre-emphasis of 50 uS is used. + * - ``V4L2_PREEMPHASIS_75_uS`` + - A pre-emphasis of 75 uS is used. @@ -3837,24 +2703,12 @@ Flash Control IDs :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_FLASH_LED_MODE_NONE`` - - - Off. - - - .. row 2 - - - ``V4L2_FLASH_LED_MODE_FLASH`` - - - Flash mode. - - - .. row 3 - - - ``V4L2_FLASH_LED_MODE_TORCH`` - - - Torch mode. See V4L2_CID_FLASH_TORCH_INTENSITY. + * - ``V4L2_FLASH_LED_MODE_NONE`` + - Off. + * - ``V4L2_FLASH_LED_MODE_FLASH`` + - Flash mode. + * - ``V4L2_FLASH_LED_MODE_TORCH`` + - Torch mode. See V4L2_CID_FLASH_TORCH_INTENSITY. @@ -3867,20 +2721,13 @@ Flash Control IDs :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - ``V4L2_FLASH_STROBE_SOURCE_SOFTWARE`` - - - The flash strobe is triggered by using the - V4L2_CID_FLASH_STROBE control. - - - .. row 2 - - - ``V4L2_FLASH_STROBE_SOURCE_EXTERNAL`` - - - The flash strobe is triggered by an external source. Typically - this is a sensor, which makes it possible to synchronises the - flash strobe start to exposure start. + * - ``V4L2_FLASH_STROBE_SOURCE_SOFTWARE`` + - The flash strobe is triggered by using the + V4L2_CID_FLASH_STROBE control. + * - ``V4L2_FLASH_STROBE_SOURCE_EXTERNAL`` + - The flash strobe is triggered by an external source. Typically + this is a sensor, which makes it possible to synchronises the + flash strobe start to exposure start. @@ -3933,69 +2780,33 @@ Flash Control IDs :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_FLASH_FAULT_OVER_VOLTAGE`` - - - Flash controller voltage to the flash LED has exceeded the limit - specific to the flash controller. - - - .. row 2 - - - ``V4L2_FLASH_FAULT_TIMEOUT`` - - - The flash strobe was still on when the timeout set by the user --- - V4L2_CID_FLASH_TIMEOUT control --- has expired. Not all flash - controllers may set this in all such conditions. - - - .. row 3 - - - ``V4L2_FLASH_FAULT_OVER_TEMPERATURE`` - - - The flash controller has overheated. - - - .. row 4 - - - ``V4L2_FLASH_FAULT_SHORT_CIRCUIT`` - - - The short circuit protection of the flash controller has been - triggered. - - - .. row 5 - - - ``V4L2_FLASH_FAULT_OVER_CURRENT`` - - - Current in the LED power supply has exceeded the limit specific to - the flash controller. - - - .. row 6 - - - ``V4L2_FLASH_FAULT_INDICATOR`` - - - The flash controller has detected a short or open circuit - condition on the indicator LED. - - - .. row 7 - - - ``V4L2_FLASH_FAULT_UNDER_VOLTAGE`` - - - Flash controller voltage to the flash LED has been below the - minimum limit specific to the flash controller. - - - .. row 8 - - - ``V4L2_FLASH_FAULT_INPUT_VOLTAGE`` - - - 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. - - - .. row 9 - - - ``V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE`` - - - The temperature of the LED has exceeded its allowed upper limit. + * - ``V4L2_FLASH_FAULT_OVER_VOLTAGE`` + - Flash controller voltage to the flash LED has exceeded the limit + specific to the flash controller. + * - ``V4L2_FLASH_FAULT_TIMEOUT`` + - The flash strobe was still on when the timeout set by the user --- + V4L2_CID_FLASH_TIMEOUT control --- has expired. Not all flash + controllers may set this in all such conditions. + * - ``V4L2_FLASH_FAULT_OVER_TEMPERATURE`` + - The flash controller has overheated. + * - ``V4L2_FLASH_FAULT_SHORT_CIRCUIT`` + - The short circuit protection of the flash controller has been + triggered. + * - ``V4L2_FLASH_FAULT_OVER_CURRENT`` + - Current in the LED power supply has exceeded the limit specific to + the flash controller. + * - ``V4L2_FLASH_FAULT_INDICATOR`` + - The flash controller has detected a short or open circuit + condition on the indicator LED. + * - ``V4L2_FLASH_FAULT_UNDER_VOLTAGE`` + - Flash controller voltage to the flash LED has been below the + minimum limit specific to the flash controller. + * - ``V4L2_FLASH_FAULT_INPUT_VOLTAGE`` + - 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. + * - ``V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE`` + - The temperature of the LED has exceeded its allowed upper limit. @@ -4044,42 +2855,18 @@ JPEG Control IDs :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_JPEG_CHROMA_SUBSAMPLING_444`` - - - No chroma subsampling, each pixel has Y, Cr and Cb values. - - - .. row 2 - - - ``V4L2_JPEG_CHROMA_SUBSAMPLING_422`` - - - Horizontally subsample Cr, Cb components by a factor of 2. - - - .. row 3 - - - ``V4L2_JPEG_CHROMA_SUBSAMPLING_420`` - - - Subsample Cr, Cb components horizontally and vertically by 2. - - - .. row 4 - - - ``V4L2_JPEG_CHROMA_SUBSAMPLING_411`` - - - Horizontally subsample Cr, Cb components by a factor of 4. - - - .. row 5 - - - ``V4L2_JPEG_CHROMA_SUBSAMPLING_410`` - - - Subsample Cr, Cb components horizontally by 4 and vertically by 2. - - - .. row 6 - - - ``V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY`` - - - Use only luminance component. + * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_444`` + - No chroma subsampling, each pixel has Y, Cr and Cb values. + * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_422`` + - Horizontally subsample Cr, Cb components by a factor of 2. + * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_420`` + - Subsample Cr, Cb components horizontally and vertically by 2. + * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_411`` + - Horizontally subsample Cr, Cb components by a factor of 4. + * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_410`` + - Subsample Cr, Cb components horizontally by 4 and vertically by 2. + * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY`` + - Use only luminance component. @@ -4121,36 +2908,16 @@ JPEG Control IDs :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_JPEG_ACTIVE_MARKER_APP0`` - - - Application data segment APP\ :sub:`0`. - - - .. row 2 - - - ``V4L2_JPEG_ACTIVE_MARKER_APP1`` - - - Application data segment APP\ :sub:`1`. - - - .. row 3 - - - ``V4L2_JPEG_ACTIVE_MARKER_COM`` - - - Comment segment. - - - .. row 4 - - - ``V4L2_JPEG_ACTIVE_MARKER_DQT`` - - - Quantization tables segment. - - - .. row 5 - - - ``V4L2_JPEG_ACTIVE_MARKER_DHT`` - - - Huffman tables segment. + * - ``V4L2_JPEG_ACTIVE_MARKER_APP0`` + - Application data segment APP\ :sub:`0`. + * - ``V4L2_JPEG_ACTIVE_MARKER_APP1`` + - Application data segment APP\ :sub:`1`. + * - ``V4L2_JPEG_ACTIVE_MARKER_COM`` + - Comment segment. + * - ``V4L2_JPEG_ACTIVE_MARKER_DQT`` + - Quantization tables segment. + * - ``V4L2_JPEG_ACTIVE_MARKER_DHT`` + - Huffman tables segment. @@ -4355,40 +3122,20 @@ enum v4l2_dv_it_content_type - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_DV_IT_CONTENT_TYPE_GRAPHICS`` - - - Graphics content. Pixel data should be passed unfiltered and - without analog reconstruction. - - - .. row 2 - - - ``V4L2_DV_IT_CONTENT_TYPE_PHOTO`` - - - Photo content. The content is derived from digital still pictures. - The content should be passed through with minimal scaling and - picture enhancements. - - - .. row 3 - - - ``V4L2_DV_IT_CONTENT_TYPE_CINEMA`` - - - Cinema content. - - - .. row 4 - - - ``V4L2_DV_IT_CONTENT_TYPE_GAME`` - - - Game content. Audio and video latency should be minimized. - - - .. row 5 - - - ``V4L2_DV_IT_CONTENT_TYPE_NO_ITC`` - - - No IT Content information is available and the ITC bit in the AVI - InfoFrame is set to 0. + * - ``V4L2_DV_IT_CONTENT_TYPE_GRAPHICS`` + - Graphics content. Pixel data should be passed unfiltered and + without analog reconstruction. + * - ``V4L2_DV_IT_CONTENT_TYPE_PHOTO`` + - Photo content. The content is derived from digital still pictures. + The content should be passed through with minimal scaling and + picture enhancements. + * - ``V4L2_DV_IT_CONTENT_TYPE_CINEMA`` + - Cinema content. + * - ``V4L2_DV_IT_CONTENT_TYPE_GAME`` + - Game content. Audio and video latency should be minimized. + * - ``V4L2_DV_IT_CONTENT_TYPE_NO_ITC`` + - No IT Content information is available and the ITC bit in the AVI + InfoFrame is set to 0. @@ -4508,24 +3255,12 @@ enum v4l2_deemphasis - :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_DEEMPHASIS_DISABLED`` - - - No de-emphasis is applied. - - - .. row 2 - - - ``V4L2_DEEMPHASIS_50_uS`` - - - A de-emphasis of 50 uS is used. - - - .. row 3 - - - ``V4L2_DEEMPHASIS_75_uS`` - - - A de-emphasis of 75 uS is used. + * - ``V4L2_DEEMPHASIS_DISABLED`` + - No de-emphasis is applied. + * - ``V4L2_DEEMPHASIS_50_uS`` + - A de-emphasis of 50 uS is used. + * - ``V4L2_DEEMPHASIS_75_uS`` + - A de-emphasis of 75 uS is used. @@ -4558,37 +3293,21 @@ Detect Control IDs :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - ``V4L2_DETECT_MD_MODE_DISABLED`` - - - Disable motion detection. - - - .. row 2 - - - ``V4L2_DETECT_MD_MODE_GLOBAL`` - - - Use a single motion detection threshold. - - - .. row 3 - - - ``V4L2_DETECT_MD_MODE_THRESHOLD_GRID`` - - - The image is divided into a grid, each cell with its own motion - detection threshold. These thresholds are set through the - ``V4L2_CID_DETECT_MD_THRESHOLD_GRID`` matrix control. - - - .. row 4 - - - ``V4L2_DETECT_MD_MODE_REGION_GRID`` - - - The image is divided into a grid, each cell with its own region - value that specifies which per-region motion detection thresholds - should be used. Each region has its own thresholds. How these - per-region thresholds are set up is driver-specific. The region - values for the grid are set through the - ``V4L2_CID_DETECT_MD_REGION_GRID`` matrix control. + * - ``V4L2_DETECT_MD_MODE_DISABLED`` + - Disable motion detection. + * - ``V4L2_DETECT_MD_MODE_GLOBAL`` + - Use a single motion detection threshold. + * - ``V4L2_DETECT_MD_MODE_THRESHOLD_GRID`` + - The image is divided into a grid, each cell with its own motion + detection threshold. These thresholds are set through the + ``V4L2_CID_DETECT_MD_THRESHOLD_GRID`` matrix control. + * - ``V4L2_DETECT_MD_MODE_REGION_GRID`` + - The image is divided into a grid, each cell with its own region + value that specifies which per-region motion detection thresholds + should be used. Each region has its own thresholds. How these + per-region thresholds are set up is driver-specific. The region + values for the grid are set through the + ``V4L2_CID_DETECT_MD_REGION_GRID`` matrix control. diff --git a/Documentation/media/uapi/v4l/field-order.rst b/Documentation/media/uapi/v4l/field-order.rst index 0d71d5a3fbde..50779a67c3fd 100644 --- a/Documentation/media/uapi/v4l/field-order.rst +++ b/Documentation/media/uapi/v4l/field-order.rst @@ -64,125 +64,75 @@ enum v4l2_field :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_FIELD_ANY`` - - - 0 - - - Applications request this field order when any one of the - ``V4L2_FIELD_NONE``, ``V4L2_FIELD_TOP``, ``V4L2_FIELD_BOTTOM``, or - ``V4L2_FIELD_INTERLACED`` formats is acceptable. Drivers choose - depending on hardware capabilities or e. g. the requested image - size, and return the actual field order. Drivers must never return - ``V4L2_FIELD_ANY``. If multiple field orders are possible the - driver must choose one of the possible field orders during - :ref:`VIDIOC_S_FMT ` or - :ref:`VIDIOC_TRY_FMT `. struct - :c:type:`v4l2_buffer` ``field`` can never be - ``V4L2_FIELD_ANY``. - - - .. row 2 - - - ``V4L2_FIELD_NONE`` - - - 1 - - - Images are in progressive format, not interlaced. The driver may - also indicate this order when it cannot distinguish between - ``V4L2_FIELD_TOP`` and ``V4L2_FIELD_BOTTOM``. - - - .. row 3 - - - ``V4L2_FIELD_TOP`` - - - 2 - - - Images consist of the top (aka odd) field only. - - - .. row 4 - - - ``V4L2_FIELD_BOTTOM`` - - - 3 - - - Images consist of the bottom (aka even) field only. Applications - may wish to prevent a device from capturing interlaced images - because they will have "comb" or "feathering" artefacts around - moving objects. - - - .. row 5 - - - ``V4L2_FIELD_INTERLACED`` - - - 4 - - - Images contain both fields, interleaved line by line. The temporal - order of the fields (whether the top or bottom field is first - transmitted) depends on the current video standard. M/NTSC - transmits the bottom field first, all other standards the top - field first. - - - .. row 6 - - - ``V4L2_FIELD_SEQ_TB`` - - - 5 - - - Images contain both fields, the top field lines are stored first - in memory, immediately followed by the bottom field lines. Fields - are always stored in temporal order, the older one first in - memory. Image sizes refer to the frame, not fields. - - - .. row 7 - - - ``V4L2_FIELD_SEQ_BT`` - - - 6 - - - Images contain both fields, the bottom field lines are stored - first in memory, immediately followed by the top field lines. - Fields are always stored in temporal order, the older one first in - memory. Image sizes refer to the frame, not fields. - - - .. row 8 - - - ``V4L2_FIELD_ALTERNATE`` - - - 7 - - - The two fields of a frame are passed in separate buffers, in - temporal order, i. e. the older one first. To indicate the field - parity (whether the current field is a top or bottom field) the - driver or application, depending on data direction, must set - struct :c:type:`v4l2_buffer` ``field`` to - ``V4L2_FIELD_TOP`` or ``V4L2_FIELD_BOTTOM``. 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 struct - :c:type:`v4l2_buffer` ``sequence`` 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. - - - .. row 9 - - - ``V4L2_FIELD_INTERLACED_TB`` - - - 8 - - - Images contain both fields, interleaved line by line, top field - first. The top field is transmitted first. - - - .. row 10 - - - ``V4L2_FIELD_INTERLACED_BT`` - - - 9 - - - Images contain both fields, interleaved line by line, top field - first. The bottom field is transmitted first. + * - ``V4L2_FIELD_ANY`` + - 0 + - Applications request this field order when any one of the + ``V4L2_FIELD_NONE``, ``V4L2_FIELD_TOP``, ``V4L2_FIELD_BOTTOM``, or + ``V4L2_FIELD_INTERLACED`` formats is acceptable. Drivers choose + depending on hardware capabilities or e. g. the requested image + size, and return the actual field order. Drivers must never return + ``V4L2_FIELD_ANY``. If multiple field orders are possible the + driver must choose one of the possible field orders during + :ref:`VIDIOC_S_FMT ` or + :ref:`VIDIOC_TRY_FMT `. struct + :c:type:`v4l2_buffer` ``field`` can never be + ``V4L2_FIELD_ANY``. + * - ``V4L2_FIELD_NONE`` + - 1 + - Images are in progressive format, not interlaced. The driver may + also indicate this order when it cannot distinguish between + ``V4L2_FIELD_TOP`` and ``V4L2_FIELD_BOTTOM``. + * - ``V4L2_FIELD_TOP`` + - 2 + - Images consist of the top (aka odd) field only. + * - ``V4L2_FIELD_BOTTOM`` + - 3 + - Images consist of the bottom (aka even) field only. Applications + may wish to prevent a device from capturing interlaced images + because they will have "comb" or "feathering" artefacts around + moving objects. + * - ``V4L2_FIELD_INTERLACED`` + - 4 + - Images contain both fields, interleaved line by line. The temporal + order of the fields (whether the top or bottom field is first + transmitted) depends on the current video standard. M/NTSC + transmits the bottom field first, all other standards the top + field first. + * - ``V4L2_FIELD_SEQ_TB`` + - 5 + - Images contain both fields, the top field lines are stored first + in memory, immediately followed by the bottom field lines. Fields + are always stored in temporal order, the older one first in + memory. Image sizes refer to the frame, not fields. + * - ``V4L2_FIELD_SEQ_BT`` + - 6 + - Images contain both fields, the bottom field lines are stored + first in memory, immediately followed by the top field lines. + Fields are always stored in temporal order, the older one first in + memory. Image sizes refer to the frame, not fields. + * - ``V4L2_FIELD_ALTERNATE`` + - 7 + - The two fields of a frame are passed in separate buffers, in + temporal order, i. e. the older one first. To indicate the field + parity (whether the current field is a top or bottom field) the + driver or application, depending on data direction, must set + struct :c:type:`v4l2_buffer` ``field`` to + ``V4L2_FIELD_TOP`` or ``V4L2_FIELD_BOTTOM``. 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 struct + :c:type:`v4l2_buffer` ``sequence`` 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. + * - ``V4L2_FIELD_INTERLACED_TB`` + - 8 + - Images contain both fields, interleaved line by line, top field + first. The top field is transmitted first. + * - ``V4L2_FIELD_INTERLACED_BT`` + - 9 + - Images contain both fields, interleaved line by line, top field + first. The bottom field is transmitted first. diff --git a/Documentation/media/uapi/v4l/hist-v4l2.rst b/Documentation/media/uapi/v4l/hist-v4l2.rst index dfd55e9066b3..058b5db95c32 100644 --- a/Documentation/media/uapi/v4l/hist-v4l2.rst +++ b/Documentation/media/uapi/v4l/hist-v4l2.rst @@ -447,90 +447,34 @@ This unnamed version was finally merged into Linux 2.5.46. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Old defines - - - enum :c:type:`v4l2_buf_type` - - - .. row 2 - - - ``V4L2_BUF_TYPE_CAPTURE`` - - - ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` - - - .. row 3 - - - ``V4L2_BUF_TYPE_CODECIN`` - - - Omitted for now - - - .. row 4 - - - ``V4L2_BUF_TYPE_CODECOUT`` - - - Omitted for now - - - .. row 5 - - - ``V4L2_BUF_TYPE_EFFECTSIN`` - - - Omitted for now - - - .. row 6 - - - ``V4L2_BUF_TYPE_EFFECTSIN2`` - - - Omitted for now - - - .. row 7 - - - ``V4L2_BUF_TYPE_EFFECTSOUT`` - - - Omitted for now - - - .. row 8 - - - ``V4L2_BUF_TYPE_VIDEOOUT`` - - - ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` - - - .. row 9 - - - ``-`` - - - ``V4L2_BUF_TYPE_VIDEO_OVERLAY`` - - - .. row 10 - - - ``-`` - - - ``V4L2_BUF_TYPE_VBI_CAPTURE`` - - - .. row 11 - - - ``-`` - - - ``V4L2_BUF_TYPE_VBI_OUTPUT`` - - - .. row 12 - - - ``-`` - - - ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE`` - - - .. row 13 - - - ``-`` - - - ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT`` - - - .. row 14 - - - ``V4L2_BUF_TYPE_PRIVATE_BASE`` - - - ``V4L2_BUF_TYPE_PRIVATE`` (but this is deprecated) + * - Old defines + - enum :c:type:`v4l2_buf_type` + * - ``V4L2_BUF_TYPE_CAPTURE`` + - ``V4L2_BUF_TYPE_VIDEO_CAPTURE`` + * - ``V4L2_BUF_TYPE_CODECIN`` + - Omitted for now + * - ``V4L2_BUF_TYPE_CODECOUT`` + - Omitted for now + * - ``V4L2_BUF_TYPE_EFFECTSIN`` + - Omitted for now + * - ``V4L2_BUF_TYPE_EFFECTSIN2`` + - Omitted for now + * - ``V4L2_BUF_TYPE_EFFECTSOUT`` + - Omitted for now + * - ``V4L2_BUF_TYPE_VIDEOOUT`` + - ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` + * - ``-`` + - ``V4L2_BUF_TYPE_VIDEO_OVERLAY`` + * - ``-`` + - ``V4L2_BUF_TYPE_VBI_CAPTURE`` + * - ``-`` + - ``V4L2_BUF_TYPE_VBI_OUTPUT`` + * - ``-`` + - ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE`` + * - ``-`` + - ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT`` + * - ``V4L2_BUF_TYPE_PRIVATE_BASE`` + - ``V4L2_BUF_TYPE_PRIVATE`` (but this is deprecated) 10. In struct :c:type:`v4l2_fmtdesc` a enum @@ -564,54 +508,22 @@ This unnamed version was finally merged into Linux 2.5.46. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Old flag - - - enum :c:type:`v4l2_field` - - - .. row 2 - - - ``V4L2_FMT_FLAG_NOT_INTERLACED`` - - - ? - - - .. row 3 - - - ``V4L2_FMT_FLAG_INTERLACED`` = ``V4L2_FMT_FLAG_COMBINED`` - - - ``V4L2_FIELD_INTERLACED`` - - - .. row 4 - - - ``V4L2_FMT_FLAG_TOPFIELD`` = ``V4L2_FMT_FLAG_ODDFIELD`` - - - ``V4L2_FIELD_TOP`` - - - .. row 5 - - - ``V4L2_FMT_FLAG_BOTFIELD`` = ``V4L2_FMT_FLAG_EVENFIELD`` - - - ``V4L2_FIELD_BOTTOM`` - - - .. row 6 - - - ``-`` - - - ``V4L2_FIELD_SEQ_TB`` - - - .. row 7 - - - ``-`` - - - ``V4L2_FIELD_SEQ_BT`` - - - .. row 8 - - - ``-`` - - - ``V4L2_FIELD_ALTERNATE`` + * - Old flag + - enum :c:type:`v4l2_field` + * - ``V4L2_FMT_FLAG_NOT_INTERLACED`` + - ? + * - ``V4L2_FMT_FLAG_INTERLACED`` = ``V4L2_FMT_FLAG_COMBINED`` + - ``V4L2_FIELD_INTERLACED`` + * - ``V4L2_FMT_FLAG_TOPFIELD`` = ``V4L2_FMT_FLAG_ODDFIELD`` + - ``V4L2_FIELD_TOP`` + * - ``V4L2_FMT_FLAG_BOTFIELD`` = ``V4L2_FMT_FLAG_EVENFIELD`` + - ``V4L2_FIELD_BOTTOM`` + * - ``-`` + - ``V4L2_FIELD_SEQ_TB`` + * - ``-`` + - ``V4L2_FIELD_SEQ_BT`` + * - ``-`` + - ``V4L2_FIELD_ALTERNATE`` The color space flags were replaced by a enum @@ -768,46 +680,21 @@ V4L2 2003-11-05 :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Symbol - - - In this document prior to revision 0.5 - - - Corrected - - - .. row 2 - - - ``V4L2_PIX_FMT_RGB24`` - - - B, G, R - - - R, G, B - - - .. row 3 - - - ``V4L2_PIX_FMT_BGR24`` - - - R, G, B - - - B, G, R - - - .. row 4 - - - ``V4L2_PIX_FMT_RGB32`` - - - B, G, R, X - - - R, G, B, X - - - .. row 5 - - - ``V4L2_PIX_FMT_BGR32`` - - - R, G, B, X - - - B, G, R, X + * - Symbol + - In this document prior to revision 0.5 + - Corrected + * - ``V4L2_PIX_FMT_RGB24`` + - B, G, R + - R, G, B + * - ``V4L2_PIX_FMT_BGR24`` + - R, G, B + - B, G, R + * - ``V4L2_PIX_FMT_RGB32`` + - B, G, R, X + - R, G, B, X + * - ``V4L2_PIX_FMT_BGR32`` + - R, G, B, X + - B, G, R, X The ``V4L2_PIX_FMT_BGR24`` example was always correct. diff --git a/Documentation/media/uapi/v4l/pixfmt-002.rst b/Documentation/media/uapi/v4l/pixfmt-002.rst index fd73f4697878..0d9e697f5d4e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-002.rst +++ b/Documentation/media/uapi/v4l/pixfmt-002.rst @@ -15,185 +15,119 @@ Single-planar format structure :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``width`` + - Image width in pixels. + * - __u32 + - ``height`` + - Image height in pixels. If ``field`` is one of ``V4L2_FIELD_TOP``, + ``V4L2_FIELD_BOTTOM`` or ``V4L2_FIELD_ALTERNATE`` 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). + * - :cspan:`2` Applications set these fields to request an image + size, drivers return the closest possible values. In case of + planar formats the ``width`` and ``height`` applies to the largest + plane. To avoid ambiguities drivers must return values rounded up + to a multiple of the scale factor of any smaller planes. For + example when the image format is YUV 4:2:0, ``width`` and + ``height`` must be multiples of two. + * - __u32 + - ``pixelformat`` + - The pixel format or type of compression, set by the application. + This is a little endian + :ref:`four character code `. V4L2 defines standard + RGB formats in :ref:`rgb-formats`, YUV formats in + :ref:`yuv-formats`, and reserved codes in + :ref:`reserved-formats` + * - enum :c:type::`v4l2_field` + - ``field`` + - Video images are typically interlaced. Applications 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 more details on fields see :ref:`field-order`. + * - __u32 + - ``bytesperline`` + - Distance in bytes between the leftmost pixels in two adjacent + lines. + * - :cspan:`2` - - .. row 1 + Both applications and drivers can set this field to request + padding bytes at the end of each line. Drivers however may ignore + the value requested by the application, returning ``width`` times + bytes per pixel or a larger value required by the hardware. That + implies applications can just set this field to zero to get a + reasonable default. - - __u32 + Video hardware may access padding bytes, therefore they must + reside in accessible memory. Consider cases where padding bytes + after the last line of an image cross a system page boundary. + Input devices may write padding bytes, the value is undefined. + Output devices ignore the contents of padding bytes. - - ``width`` + When the image format is planar the ``bytesperline`` value applies + to the first plane and is divided by the same factor as the + ``width`` field for the other planes. For 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 ``bytesperline`` value rounded up to a multiple of + the scale factor. - - Image width in pixels. + For compressed formats the ``bytesperline`` value makes no sense. + Applications and drivers must set this to 0 in that case. + * - __u32 + - ``sizeimage`` + - Size in bytes of the buffer to hold a complete image, set by the + driver. Usually this is ``bytesperline`` times ``height``. When + the image consists of variable length compressed data this is the + maximum number of bytes required to hold an image. + * - enum :c:type:`v4l2_colorspace` + - ``colorspace`` + - This information supplements the ``pixelformat`` and must be set + by the driver for capture streams and by the application for + output streams, see :ref:`colorspaces`. + * - __u32 + - ``priv`` + - This field indicates whether the remaining fields of the + struct :c:type:`v4l2_pix_format`, also called the + extended fields, are valid. When set to + ``V4L2_PIX_FMT_PRIV_MAGIC``, it indicates that the extended fields + have been correctly initialized. When set to any other value it + indicates that the extended fields contain undefined values. - - .. row 2 + Applications that wish to use the pixel format extended fields + must first ensure that the feature is supported by querying the + device for the :ref:`V4L2_CAP_EXT_PIX_FORMAT ` + capability. If the capability isn't set the pixel format extended + fields are not supported and using the extended fields will lead + to undefined results. - - __u32 + To use the extended fields, applications must set the ``priv`` + field to ``V4L2_PIX_FMT_PRIV_MAGIC``, initialize all the extended + fields and zero the unused bytes of the + struct :c:type:`v4l2_format` ``raw_data`` field. - - ``height`` - - - Image height in pixels. If ``field`` is one of ``V4L2_FIELD_TOP``, - ``V4L2_FIELD_BOTTOM`` or ``V4L2_FIELD_ALTERNATE`` 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). - - - .. row 3 - - - :cspan:`2` Applications set these fields to request an image - size, drivers return the closest possible values. In case of - planar formats the ``width`` and ``height`` applies to the largest - plane. To avoid ambiguities drivers must return values rounded up - to a multiple of the scale factor of any smaller planes. For - example when the image format is YUV 4:2:0, ``width`` and - ``height`` must be multiples of two. - - - .. row 4 - - - __u32 - - - ``pixelformat`` - - - The pixel format or type of compression, set by the application. - This is a little endian - :ref:`four character code `. V4L2 defines standard - RGB formats in :ref:`rgb-formats`, YUV formats in - :ref:`yuv-formats`, and reserved codes in - :ref:`reserved-formats` - - - .. row 5 - - - enum :c:type::`v4l2_field` - - - ``field`` - - - Video images are typically interlaced. Applications 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 more details on fields see :ref:`field-order`. - - - .. row 6 - - - __u32 - - - ``bytesperline`` - - - Distance in bytes between the leftmost pixels in two adjacent - lines. - - - .. row 7 - - - :cspan:`2` - - Both applications and drivers can set this field to request - padding bytes at the end of each line. Drivers however may ignore - the value requested by the application, returning ``width`` times - bytes per pixel or a larger value required by the hardware. That - implies applications can just set this field to zero to get a - reasonable default. - - Video hardware may access padding bytes, therefore they must - reside in accessible memory. Consider cases where padding bytes - after the last line of an image cross a system page boundary. - Input devices may write padding bytes, the value is undefined. - Output devices ignore the contents of padding bytes. - - When the image format is planar the ``bytesperline`` value applies - to the first plane and is divided by the same factor as the - ``width`` field for the other planes. For 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 ``bytesperline`` value rounded up to a multiple of - the scale factor. - - For compressed formats the ``bytesperline`` value makes no sense. - Applications and drivers must set this to 0 in that case. - - - .. row 8 - - - __u32 - - - ``sizeimage`` - - - Size in bytes of the buffer to hold a complete image, set by the - driver. Usually this is ``bytesperline`` times ``height``. When - the image consists of variable length compressed data this is the - maximum number of bytes required to hold an image. - - - .. row 9 - - - enum :c:type:`v4l2_colorspace` - - - ``colorspace`` - - - This information supplements the ``pixelformat`` and must be set - by the driver for capture streams and by the application for - output streams, see :ref:`colorspaces`. - - - .. row 10 - - - __u32 - - - ``priv`` - - - This field indicates whether the remaining fields of the - struct :c:type:`v4l2_pix_format`, also called the - extended fields, are valid. When set to - ``V4L2_PIX_FMT_PRIV_MAGIC``, it indicates that the extended fields - have been correctly initialized. When set to any other value it - indicates that the extended fields contain undefined values. - - Applications that wish to use the pixel format extended fields - must first ensure that the feature is supported by querying the - device for the :ref:`V4L2_CAP_EXT_PIX_FORMAT ` - capability. If the capability isn't set the pixel format extended - fields are not supported and using the extended fields will lead - to undefined results. - - To use the extended fields, applications must set the ``priv`` - field to ``V4L2_PIX_FMT_PRIV_MAGIC``, initialize all the extended - fields and zero the unused bytes of the - struct :c:type:`v4l2_format` ``raw_data`` field. - - When the ``priv`` field isn't set to ``V4L2_PIX_FMT_PRIV_MAGIC`` - drivers must act as if all the extended fields were set to zero. - On return drivers must set the ``priv`` field to - ``V4L2_PIX_FMT_PRIV_MAGIC`` and all the extended fields to - applicable values. - - - .. row 11 - - - __u32 - - - ``flags`` - - - Flags set by the application or driver, see :ref:`format-flags`. - - - .. row 12 - - - enum :c:type:`v4l2_ycbcr_encoding` - - - ``ycbcr_enc`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. - - - .. row 13 - - - enum :c:type:`v4l2_quantization` - - - ``quantization`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. - - - .. row 14 - - - enum :c:type:`v4l2_xfer_func` - - - ``xfer_func`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. + When the ``priv`` field isn't set to ``V4L2_PIX_FMT_PRIV_MAGIC`` + drivers must act as if all the extended fields were set to zero. + On return drivers must set the ``priv`` field to + ``V4L2_PIX_FMT_PRIV_MAGIC`` and all the extended fields to + applicable values. + * - __u32 + - ``flags`` + - Flags set by the application or driver, see :ref:`format-flags`. + * - enum :c:type:`v4l2_ycbcr_encoding` + - ``ycbcr_enc`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. + * - enum :c:type:`v4l2_quantization` + - ``quantization`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. + * - enum :c:type:`v4l2_xfer_func` + - ``xfer_func`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. diff --git a/Documentation/media/uapi/v4l/pixfmt-003.rst b/Documentation/media/uapi/v4l/pixfmt-003.rst index a3c83df3bce5..ae9ea7a791de 100644 --- a/Documentation/media/uapi/v4l/pixfmt-003.rst +++ b/Documentation/media/uapi/v4l/pixfmt-003.rst @@ -21,32 +21,17 @@ describing all planes of that format. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``sizeimage`` - - - Maximum size in bytes required for image data in this plane. - - - .. row 2 - - - __u32 - - - ``bytesperline`` - - - Distance in bytes between the leftmost pixels in two adjacent - lines. See struct :c:type:`v4l2_pix_format`. - - - .. row 3 - - - __u16 - - - ``reserved[6]`` - - - Reserved for future extensions. Should be zeroed by drivers and - applications. + * - __u32 + - ``sizeimage`` + - Maximum size in bytes required for image data in this plane. + * - __u32 + - ``bytesperline`` + - Distance in bytes between the leftmost pixels in two adjacent + lines. See struct :c:type:`v4l2_pix_format`. + * - __u16 + - ``reserved[6]`` + - Reserved for future extensions. Should be zeroed by drivers and + applications. .. tabularcolumns:: |p{4.4cm}|p{5.6cm}|p{7.5cm}| @@ -58,112 +43,52 @@ describing all planes of that format. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``width`` - - - Image width in pixels. See struct - :c:type:`v4l2_pix_format`. - - - .. row 2 - - - __u32 - - - ``height`` - - - Image height in pixels. See struct - :c:type:`v4l2_pix_format`. - - - .. row 3 - - - __u32 - - - ``pixelformat`` - - - The pixel format. Both single- and multi-planar four character - codes can be used. - - - .. row 4 - - - enum :c:type:`v4l2_field` - - - ``field`` - - - See struct :c:type:`v4l2_pix_format`. - - - .. row 5 - - - enum :c:type:`v4l2_colorspace` - - - ``colorspace`` - - - See struct :c:type:`v4l2_pix_format`. - - - .. row 6 - - - struct :c:type:`v4l2_plane_pix_format` - - - ``plane_fmt[VIDEO_MAX_PLANES]`` - - - An array of structures describing format of each plane this pixel - format consists of. The number of valid entries in this array has - to be put in the ``num_planes`` field. - - - .. row 7 - - - __u8 - - - ``num_planes`` - - - Number of planes (i.e. separate memory buffers) for this format - and the number of valid entries in the ``plane_fmt`` array. - - - .. row 8 - - - __u8 - - - ``flags`` - - - Flags set by the application or driver, see :ref:`format-flags`. - - - .. row 9 - - - enum :c:type:`v4l2_ycbcr_encoding` - - - ``ycbcr_enc`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. - - - .. row 10 - - - enum :c:type:`v4l2_quantization` - - - ``quantization`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. - - - .. row 11 - - - enum :c:type:`v4l2_xfer_func` - - - ``xfer_func`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. - - - .. row 12 - - - __u8 - - - ``reserved[7]`` - - - Reserved for future extensions. Should be zeroed by drivers and - applications. + * - __u32 + - ``width`` + - Image width in pixels. See struct + :c:type:`v4l2_pix_format`. + * - __u32 + - ``height`` + - Image height in pixels. See struct + :c:type:`v4l2_pix_format`. + * - __u32 + - ``pixelformat`` + - The pixel format. Both single- and multi-planar four character + codes can be used. + * - enum :c:type:`v4l2_field` + - ``field`` + - See struct :c:type:`v4l2_pix_format`. + * - enum :c:type:`v4l2_colorspace` + - ``colorspace`` + - See struct :c:type:`v4l2_pix_format`. + * - struct :c:type:`v4l2_plane_pix_format` + - ``plane_fmt[VIDEO_MAX_PLANES]`` + - An array of structures describing format of each plane this pixel + format consists of. The number of valid entries in this array has + to be put in the ``num_planes`` field. + * - __u8 + - ``num_planes`` + - Number of planes (i.e. separate memory buffers) for this format + and the number of valid entries in the ``plane_fmt`` array. + * - __u8 + - ``flags`` + - Flags set by the application or driver, see :ref:`format-flags`. + * - enum :c:type:`v4l2_ycbcr_encoding` + - ``ycbcr_enc`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. + * - enum :c:type:`v4l2_quantization` + - ``quantization`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. + * - enum :c:type:`v4l2_xfer_func` + - ``xfer_func`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. + * - __u8 + - ``reserved[7]`` + - Reserved for future extensions. Should be zeroed by drivers and + applications. diff --git a/Documentation/media/uapi/v4l/pixfmt-006.rst b/Documentation/media/uapi/v4l/pixfmt-006.rst index 819299d0291a..a9890ff6038b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-006.rst +++ b/Documentation/media/uapi/v4l/pixfmt-006.rst @@ -33,89 +33,37 @@ needs to be filled in. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Details - - - .. row 2 - - - ``V4L2_COLORSPACE_DEFAULT`` - - - The default colorspace. This can be used by applications to let - the driver fill in the colorspace. - - - .. row 3 - - - ``V4L2_COLORSPACE_SMPTE170M`` - - - See :ref:`col-smpte-170m`. - - - .. row 4 - - - ``V4L2_COLORSPACE_REC709`` - - - See :ref:`col-rec709`. - - - .. row 5 - - - ``V4L2_COLORSPACE_SRGB`` - - - See :ref:`col-srgb`. - - - .. row 6 - - - ``V4L2_COLORSPACE_ADOBERGB`` - - - See :ref:`col-adobergb`. - - - .. row 7 - - - ``V4L2_COLORSPACE_BT2020`` - - - See :ref:`col-bt2020`. - - - .. row 8 - - - ``V4L2_COLORSPACE_DCI_P3`` - - - See :ref:`col-dcip3`. - - - .. row 9 - - - ``V4L2_COLORSPACE_SMPTE240M`` - - - See :ref:`col-smpte-240m`. - - - .. row 10 - - - ``V4L2_COLORSPACE_470_SYSTEM_M`` - - - See :ref:`col-sysm`. - - - .. row 11 - - - ``V4L2_COLORSPACE_470_SYSTEM_BG`` - - - See :ref:`col-sysbg`. - - - .. row 12 - - - ``V4L2_COLORSPACE_JPEG`` - - - See :ref:`col-jpeg`. - - - .. row 13 - - - ``V4L2_COLORSPACE_RAW`` - - - The raw colorspace. This is used for raw image capture where the - image is minimally processed and is using the internal colorspace - of the device. The software that processes an image using this - 'colorspace' will have to know the internals of the capture - device. + * - Identifier + - Details + * - ``V4L2_COLORSPACE_DEFAULT`` + - The default colorspace. This can be used by applications to let + the driver fill in the colorspace. + * - ``V4L2_COLORSPACE_SMPTE170M`` + - See :ref:`col-smpte-170m`. + * - ``V4L2_COLORSPACE_REC709`` + - See :ref:`col-rec709`. + * - ``V4L2_COLORSPACE_SRGB`` + - See :ref:`col-srgb`. + * - ``V4L2_COLORSPACE_ADOBERGB`` + - See :ref:`col-adobergb`. + * - ``V4L2_COLORSPACE_BT2020`` + - See :ref:`col-bt2020`. + * - ``V4L2_COLORSPACE_DCI_P3`` + - See :ref:`col-dcip3`. + * - ``V4L2_COLORSPACE_SMPTE240M`` + - See :ref:`col-smpte-240m`. + * - ``V4L2_COLORSPACE_470_SYSTEM_M`` + - See :ref:`col-sysm`. + * - ``V4L2_COLORSPACE_470_SYSTEM_BG`` + - See :ref:`col-sysbg`. + * - ``V4L2_COLORSPACE_JPEG`` + - See :ref:`col-jpeg`. + * - ``V4L2_COLORSPACE_RAW`` + - The raw colorspace. This is used for raw image capture where the + image is minimally processed and is using the internal colorspace + of the device. The software that processes an image using this + 'colorspace' will have to know the internals of the capture + device. @@ -125,60 +73,24 @@ needs to be filled in. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Details - - - .. row 2 - - - ``V4L2_XFER_FUNC_DEFAULT`` - - - Use the default transfer function as defined by the colorspace. - - - .. row 3 - - - ``V4L2_XFER_FUNC_709`` - - - Use the Rec. 709 transfer function. - - - .. row 4 - - - ``V4L2_XFER_FUNC_SRGB`` - - - Use the sRGB transfer function. - - - .. row 5 - - - ``V4L2_XFER_FUNC_ADOBERGB`` - - - Use the AdobeRGB transfer function. - - - .. row 6 - - - ``V4L2_XFER_FUNC_SMPTE240M`` - - - Use the SMPTE 240M transfer function. - - - .. row 7 - - - ``V4L2_XFER_FUNC_NONE`` - - - Do not use a transfer function (i.e. use linear RGB values). - - - .. row 8 - - - ``V4L2_XFER_FUNC_DCI_P3`` - - - Use the DCI-P3 transfer function. - - - .. row 9 - - - ``V4L2_XFER_FUNC_SMPTE2084`` - - - Use the SMPTE 2084 transfer function. + * - Identifier + - Details + * - ``V4L2_XFER_FUNC_DEFAULT`` + - Use the default transfer function as defined by the colorspace. + * - ``V4L2_XFER_FUNC_709`` + - Use the Rec. 709 transfer function. + * - ``V4L2_XFER_FUNC_SRGB`` + - Use the sRGB transfer function. + * - ``V4L2_XFER_FUNC_ADOBERGB`` + - Use the AdobeRGB transfer function. + * - ``V4L2_XFER_FUNC_SMPTE240M`` + - Use the SMPTE 240M transfer function. + * - ``V4L2_XFER_FUNC_NONE`` + - Do not use a transfer function (i.e. use linear RGB values). + * - ``V4L2_XFER_FUNC_DCI_P3`` + - Use the DCI-P3 transfer function. + * - ``V4L2_XFER_FUNC_SMPTE2084`` + - Use the SMPTE 2084 transfer function. @@ -190,60 +102,24 @@ needs to be filled in. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Details - - - .. row 2 - - - ``V4L2_YCBCR_ENC_DEFAULT`` - - - Use the default Y'CbCr encoding as defined by the colorspace. - - - .. row 3 - - - ``V4L2_YCBCR_ENC_601`` - - - Use the BT.601 Y'CbCr encoding. - - - .. row 4 - - - ``V4L2_YCBCR_ENC_709`` - - - Use the Rec. 709 Y'CbCr encoding. - - - .. row 5 - - - ``V4L2_YCBCR_ENC_XV601`` - - - Use the extended gamut xvYCC BT.601 encoding. - - - .. row 6 - - - ``V4L2_YCBCR_ENC_XV709`` - - - Use the extended gamut xvYCC Rec. 709 encoding. - - - .. row 7 - - - ``V4L2_YCBCR_ENC_BT2020`` - - - Use the default non-constant luminance BT.2020 Y'CbCr encoding. - - - .. row 8 - - - ``V4L2_YCBCR_ENC_BT2020_CONST_LUM`` - - - Use the constant luminance BT.2020 Yc'CbcCrc encoding. - - - .. row 9 - - - ``V4L2_YCBCR_ENC_SMPTE_240M`` - - - Use the SMPTE 240M Y'CbCr encoding. + * - Identifier + - Details + * - ``V4L2_YCBCR_ENC_DEFAULT`` + - Use the default Y'CbCr encoding as defined by the colorspace. + * - ``V4L2_YCBCR_ENC_601`` + - Use the BT.601 Y'CbCr encoding. + * - ``V4L2_YCBCR_ENC_709`` + - Use the Rec. 709 Y'CbCr encoding. + * - ``V4L2_YCBCR_ENC_XV601`` + - Use the extended gamut xvYCC BT.601 encoding. + * - ``V4L2_YCBCR_ENC_XV709`` + - Use the extended gamut xvYCC Rec. 709 encoding. + * - ``V4L2_YCBCR_ENC_BT2020`` + - Use the default non-constant luminance BT.2020 Y'CbCr encoding. + * - ``V4L2_YCBCR_ENC_BT2020_CONST_LUM`` + - Use the constant luminance BT.2020 Yc'CbcCrc encoding. + * - ``V4L2_YCBCR_ENC_SMPTE_240M`` + - Use the SMPTE 240M Y'CbCr encoding. @@ -255,35 +131,19 @@ needs to be filled in. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Details - - - .. row 2 - - - ``V4L2_QUANTIZATION_DEFAULT`` - - - Use the default quantization encoding as defined by the - colorspace. This is always full range for R'G'B' (except for the - BT.2020 colorspace) and usually limited range for Y'CbCr. - - - .. row 3 - - - ``V4L2_QUANTIZATION_FULL_RANGE`` - - - Use the full range quantization encoding. I.e. the range [0…1] is - mapped to [0…255] (with possible clipping to [1…254] to avoid the - 0x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to - [0…255] (with possible clipping to [1…254] to avoid the 0x00 and - 0xff values). - - - .. row 4 - - - ``V4L2_QUANTIZATION_LIM_RANGE`` - - - Use the limited range quantization encoding. I.e. the range [0…1] - is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to - [16…240]. + * - Identifier + - Details + * - ``V4L2_QUANTIZATION_DEFAULT`` + - Use the default quantization encoding as defined by the + colorspace. This is always full range for R'G'B' (except for the + BT.2020 colorspace) and usually limited range for Y'CbCr. + * - ``V4L2_QUANTIZATION_FULL_RANGE`` + - Use the full range quantization encoding. I.e. the range [0…1] is + mapped to [0…255] (with possible clipping to [1…254] to avoid the + 0x00 and 0xff values). Cb and Cr are mapped from [-0.5…0.5] to + [0…255] (with possible clipping to [1…254] to avoid the 0x00 and + 0xff values). + * - ``V4L2_QUANTIZATION_LIM_RANGE`` + - Use the limited range quantization encoding. I.e. the range [0…1] + is mapped to [16…235]. Cb and Cr are mapped from [-0.5…0.5] to + [16…240]. diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index f3e7f9e4c616..44bb5a7059b3 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst @@ -26,46 +26,21 @@ are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.630 - - - 0.340 - - - .. row 3 - - - Green - - - 0.310 - - - 0.595 - - - .. row 4 - - - Blue - - - 0.155 - - - 0.070 - - - .. row 5 - - - White Reference (D65) - - - 0.3127 - - - 0.3290 + * - Color + - x + - y + * - Red + - 0.630 + - 0.340 + * - Green + - 0.310 + - 0.595 + * - Blue + - 0.155 + - 0.070 + * - White Reference (D65) + - 0.3127 + - 0.3290 The red, green and blue chromaticities are also often referred to as the @@ -132,46 +107,21 @@ and the white reference are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.640 - - - 0.330 - - - .. row 3 - - - Green - - - 0.300 - - - 0.600 - - - .. row 4 - - - Blue - - - 0.150 - - - 0.060 - - - .. row 5 - - - White Reference (D65) - - - 0.3127 - - - 0.3290 + * - Color + - x + - y + * - Red + - 0.640 + - 0.330 + * - Green + - 0.300 + - 0.600 + * - Blue + - 0.150 + - 0.060 + * - White Reference (D65) + - 0.3127 + - 0.3290 The full name of this standard is Rec. ITU-R BT.709-5. @@ -273,46 +223,21 @@ The chromaticities of the primary colors and the white reference are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.640 - - - 0.330 - - - .. row 3 - - - Green - - - 0.300 - - - 0.600 - - - .. row 4 - - - Blue - - - 0.150 - - - 0.060 - - - .. row 5 - - - White Reference (D65) - - - 0.3127 - - - 0.3290 + * - Color + - x + - y + * - Red + - 0.640 + - 0.330 + * - Green + - 0.300 + - 0.600 + * - Blue + - 0.150 + - 0.060 + * - White Reference (D65) + - 0.3127 + - 0.3290 These chromaticities are identical to the Rec. 709 colorspace. @@ -376,46 +301,21 @@ are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.6400 - - - 0.3300 - - - .. row 3 - - - Green - - - 0.2100 - - - 0.7100 - - - .. row 4 - - - Blue - - - 0.1500 - - - 0.0600 - - - .. row 5 - - - White Reference (D65) - - - 0.3127 - - - 0.3290 + * - Color + - x + - y + * - Red + - 0.6400 + - 0.3300 + * - Green + - 0.2100 + - 0.7100 + * - Blue + - 0.1500 + - 0.0600 + * - White Reference (D65) + - 0.3127 + - 0.3290 @@ -468,46 +368,21 @@ of the primary colors and the white reference are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.708 - - - 0.292 - - - .. row 3 - - - Green - - - 0.170 - - - 0.797 - - - .. row 4 - - - Blue - - - 0.131 - - - 0.046 - - - .. row 5 - - - White Reference (D65) - - - 0.3127 - - - 0.3290 + * - Color + - x + - y + * - Red + - 0.708 + - 0.292 + * - Green + - 0.170 + - 0.797 + * - Blue + - 0.131 + - 0.046 + * - White Reference (D65) + - 0.3127 + - 0.3290 @@ -592,46 +467,21 @@ The chromaticities of the primary colors and the white reference are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.6800 - - - 0.3200 - - - .. row 3 - - - Green - - - 0.2650 - - - 0.6900 - - - .. row 4 - - - Blue - - - 0.1500 - - - 0.0600 - - - .. row 5 - - - White Reference - - - 0.3140 - - - 0.3510 + * - Color + - x + - y + * - Red + - 0.6800 + - 0.3200 + * - Green + - 0.2650 + - 0.6900 + * - Blue + - 0.1500 + - 0.0600 + * - White Reference + - 0.3140 + - 0.3510 @@ -671,46 +521,21 @@ and the white reference are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.630 - - - 0.340 - - - .. row 3 - - - Green - - - 0.310 - - - 0.595 - - - .. row 4 - - - Blue - - - 0.155 - - - 0.070 - - - .. row 5 - - - White Reference (D65) - - - 0.3127 - - - 0.3290 + * - Color + - x + - y + * - Red + - 0.630 + - 0.340 + * - Green + - 0.310 + - 0.595 + * - Blue + - 0.155 + - 0.070 + * - White Reference (D65) + - 0.3127 + - 0.3290 These chromaticities are identical to the SMPTE 170M colorspace. @@ -767,46 +592,21 @@ reference are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.67 - - - 0.33 - - - .. row 3 - - - Green - - - 0.21 - - - 0.71 - - - .. row 4 - - - Blue - - - 0.14 - - - 0.08 - - - .. row 5 - - - White Reference (C) - - - 0.310 - - - 0.316 + * - Color + - x + - y + * - Red + - 0.67 + - 0.33 + * - Green + - 0.21 + - 0.71 + * - Blue + - 0.14 + - 0.08 + * - White Reference (C) + - 0.310 + - 0.316 .. note:: @@ -871,46 +671,21 @@ are: :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Color - - - x - - - y - - - .. row 2 - - - Red - - - 0.64 - - - 0.33 - - - .. row 3 - - - Green - - - 0.29 - - - 0.60 - - - .. row 4 - - - Blue - - - 0.15 - - - 0.06 - - - .. row 5 - - - White Reference (D65) - - - 0.3127 - - - 0.3290 + * - Color + - x + - y + * - Red + - 0.64 + - 0.33 + * - Green + - 0.29 + - 0.60 + * - Blue + - 0.15 + - 0.06 + * - White Reference (D65) + - 0.3127 + - 0.3290 diff --git a/Documentation/media/uapi/v4l/pixfmt-013.rst b/Documentation/media/uapi/v4l/pixfmt-013.rst index bfef4f4ce6b1..542c087152e3 100644 --- a/Documentation/media/uapi/v4l/pixfmt-013.rst +++ b/Documentation/media/uapi/v4l/pixfmt-013.rst @@ -14,118 +14,74 @@ Compressed Formats :stub-columns: 0 :widths: 3 1 4 + * - Identifier + - Code + - Details + * .. _V4L2-PIX-FMT-JPEG: - - .. row 1 + - ``V4L2_PIX_FMT_JPEG`` + - 'JPEG' + - TBD. See also :ref:`VIDIOC_G_JPEGCOMP `, + :ref:`VIDIOC_S_JPEGCOMP `. + * .. _V4L2-PIX-FMT-MPEG: - - Identifier + - ``V4L2_PIX_FMT_MPEG`` + - 'MPEG' + - MPEG multiplexed stream. The actual format is determined by + extended control ``V4L2_CID_MPEG_STREAM_TYPE``, see + :ref:`mpeg-control-id`. + * .. _V4L2-PIX-FMT-H264: - - Code + - ``V4L2_PIX_FMT_H264`` + - 'H264' + - H264 video elementary stream with start codes. + * .. _V4L2-PIX-FMT-H264-NO-SC: - - Details + - ``V4L2_PIX_FMT_H264_NO_SC`` + - 'AVC1' + - H264 video elementary stream without start codes. + * .. _V4L2-PIX-FMT-H264-MVC: - - .. _V4L2-PIX-FMT-JPEG: + - ``V4L2_PIX_FMT_H264_MVC`` + - 'M264' + - H264 MVC video elementary stream. + * .. _V4L2-PIX-FMT-H263: - - ``V4L2_PIX_FMT_JPEG`` + - ``V4L2_PIX_FMT_H263`` + - 'H263' + - H263 video elementary stream. + * .. _V4L2-PIX-FMT-MPEG1: - - 'JPEG' + - ``V4L2_PIX_FMT_MPEG1`` + - 'MPG1' + - MPEG1 video elementary stream. + * .. _V4L2-PIX-FMT-MPEG2: - - TBD. See also :ref:`VIDIOC_G_JPEGCOMP `, - :ref:`VIDIOC_S_JPEGCOMP `. + - ``V4L2_PIX_FMT_MPEG2`` + - 'MPG2' + - MPEG2 video elementary stream. + * .. _V4L2-PIX-FMT-MPEG4: - - .. _V4L2-PIX-FMT-MPEG: + - ``V4L2_PIX_FMT_MPEG4`` + - 'MPG4' + - MPEG4 video elementary stream. + * .. _V4L2-PIX-FMT-XVID: - - ``V4L2_PIX_FMT_MPEG`` + - ``V4L2_PIX_FMT_XVID`` + - 'XVID' + - Xvid video elementary stream. + * .. _V4L2-PIX-FMT-VC1-ANNEX-G: - - 'MPEG' + - ``V4L2_PIX_FMT_VC1_ANNEX_G`` + - 'VC1G' + - VC1, SMPTE 421M Annex G compliant stream. + * .. _V4L2-PIX-FMT-VC1-ANNEX-L: - - MPEG multiplexed stream. The actual format is determined by - extended control ``V4L2_CID_MPEG_STREAM_TYPE``, see - :ref:`mpeg-control-id`. + - ``V4L2_PIX_FMT_VC1_ANNEX_L`` + - 'VC1L' + - VC1, SMPTE 421M Annex L compliant stream. + * .. _V4L2-PIX-FMT-VP8: - - .. _V4L2-PIX-FMT-H264: - - - ``V4L2_PIX_FMT_H264`` - - - 'H264' - - - H264 video elementary stream with start codes. - - - .. _V4L2-PIX-FMT-H264-NO-SC: - - - ``V4L2_PIX_FMT_H264_NO_SC`` - - - 'AVC1' - - - H264 video elementary stream without start codes. - - - .. _V4L2-PIX-FMT-H264-MVC: - - - ``V4L2_PIX_FMT_H264_MVC`` - - - 'M264' - - - H264 MVC video elementary stream. - - - .. _V4L2-PIX-FMT-H263: - - - ``V4L2_PIX_FMT_H263`` - - - 'H263' - - - H263 video elementary stream. - - - .. _V4L2-PIX-FMT-MPEG1: - - - ``V4L2_PIX_FMT_MPEG1`` - - - 'MPG1' - - - MPEG1 video elementary stream. - - - .. _V4L2-PIX-FMT-MPEG2: - - - ``V4L2_PIX_FMT_MPEG2`` - - - 'MPG2' - - - MPEG2 video elementary stream. - - - .. _V4L2-PIX-FMT-MPEG4: - - - ``V4L2_PIX_FMT_MPEG4`` - - - 'MPG4' - - - MPEG4 video elementary stream. - - - .. _V4L2-PIX-FMT-XVID: - - - ``V4L2_PIX_FMT_XVID`` - - - 'XVID' - - - Xvid video elementary stream. - - - .. _V4L2-PIX-FMT-VC1-ANNEX-G: - - - ``V4L2_PIX_FMT_VC1_ANNEX_G`` - - - 'VC1G' - - - VC1, SMPTE 421M Annex G compliant stream. - - - .. _V4L2-PIX-FMT-VC1-ANNEX-L: - - - ``V4L2_PIX_FMT_VC1_ANNEX_L`` - - - 'VC1L' - - - VC1, SMPTE 421M Annex L compliant stream. - - - .. _V4L2-PIX-FMT-VP8: - - - ``V4L2_PIX_FMT_VP8`` - - - 'VP80' - - - VP8 video elementary stream. + - ``V4L2_PIX_FMT_VP8`` + - 'VP80' + - VP8 video elementary stream. diff --git a/Documentation/media/uapi/v4l/pixfmt-grey.rst b/Documentation/media/uapi/v4l/pixfmt-grey.rst index fef58ca50f66..dad813819d3e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-grey.rst +++ b/Documentation/media/uapi/v4l/pixfmt-grey.rst @@ -22,51 +22,23 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-indexed.rst b/Documentation/media/uapi/v4l/pixfmt-indexed.rst index 99a780fe6b61..6edac54dad74 100644 --- a/Documentation/media/uapi/v4l/pixfmt-indexed.rst +++ b/Documentation/media/uapi/v4l/pixfmt-indexed.rst @@ -17,57 +17,31 @@ the palette, this must be done with ioctls of the Linux framebuffer API. :header-rows: 2 :stub-columns: 0 + * - Identifier + - Code + - + - :cspan:`7` Byte 0 + * - + - + - Bit + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * .. _V4L2-PIX-FMT-PAL8: - - .. row 1 - - - Identifier - - - Code - - - - - :cspan:`7` Byte 0 - - - .. row 2 - - - - - - - Bit - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _V4L2-PIX-FMT-PAL8: - - - ``V4L2_PIX_FMT_PAL8`` - - - 'PAL8' - - - - - i\ :sub:`7` - - - i\ :sub:`6` - - - i\ :sub:`5` - - - i\ :sub:`4` - - - i\ :sub:`3` - - - i\ :sub:`2` - - - i\ :sub:`1` - - - i\ :sub:`0` + - ``V4L2_PIX_FMT_PAL8`` + - 'PAL8' + - + - i\ :sub:`7` + - i\ :sub:`6` + - i\ :sub:`5` + - i\ :sub:`4` + - i\ :sub:`3` + - i\ :sub:`2` + - i\ :sub:`1` + - i\ :sub:`0` diff --git a/Documentation/media/uapi/v4l/pixfmt-m420.rst b/Documentation/media/uapi/v4l/pixfmt-m420.rst index f4a21a8a6dcc..7dd47c071e2f 100644 --- a/Documentation/media/uapi/v4l/pixfmt-m420.rst +++ b/Documentation/media/uapi/v4l/pixfmt-m420.rst @@ -34,78 +34,36 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Cb\ :sub:`00` - - - Cr\ :sub:`00` - - - Cb\ :sub:`01` - - - Cr\ :sub:`01` - - - .. row 4 - - - start + 16: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 5 - - - start + 20: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 6 - - - start + 24: - - - Cb\ :sub:`10` - - - Cr\ :sub:`10` - - - Cb\ :sub:`11` - - - Cr\ :sub:`11` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start + 16: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 20: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 24: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` **Color Sample Location..** @@ -116,100 +74,53 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 3 - - - - - - - C - - - - - - - C - - - - - - .. row 4 - - - 1 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 5 - - - - - - .. row 6 - - - 2 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 7 - - - - - - - C - - - - - - - C - - - - - - .. row 8 - - - 3 - - - Y - - - - - Y - - - Y - - - - - Y + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 1 + - Y + - + - Y + - Y + - + - Y + * - + * - 2 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 3 + - Y + - + - Y + - Y + - + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12.rst b/Documentation/media/uapi/v4l/pixfmt-nv12.rst index 6bbdc01362af..5b45a6d2ac95 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12.rst @@ -39,77 +39,36 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - start + 16: - - - Cb\ :sub:`00` - - - Cr\ :sub:`00` - - - Cb\ :sub:`01` - - - Cr\ :sub:`01` - - - .. row 6 - - - start + 20: - - - Cb\ :sub:`10` - - - Cr\ :sub:`10` - - - Cb\ :sub:`11` - - - Cr\ :sub:`11` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 16: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start + 20: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` **Color Sample Location..** @@ -118,100 +77,53 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 3 - - - - - - - C - - - - - - - C - - - - - - .. row 4 - - - 1 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 5 - - - - - - .. row 6 - - - 2 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 7 - - - - - - - C - - - - - - - C - - - - - - .. row 8 - - - 3 - - - Y - - - - - Y - - - Y - - - - - Y + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 1 + - Y + - + - Y + - Y + - + - Y + * - + * - 2 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 3 + - Y + - + - Y + - Y + - + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-nv12m.rst b/Documentation/media/uapi/v4l/pixfmt-nv12m.rst index 5c2e0648204b..de3051fd6b50 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv12m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv12m.rst @@ -50,81 +50,37 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start0 + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start0 + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start0 + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start0 + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - - - - .. row 6 - - - start1 + 0: - - - Cb\ :sub:`00` - - - Cr\ :sub:`00` - - - Cb\ :sub:`01` - - - Cr\ :sub:`01` - - - .. row 7 - - - start1 + 4: - - - Cb\ :sub:`10` - - - Cr\ :sub:`10` - - - Cb\ :sub:`11` - - - Cr\ :sub:`11` + * - start0 + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start0 + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start0 + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start0 + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - + * - start1 + 0: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start1 + 4: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` **Color Sample Location..** @@ -135,101 +91,54 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 3 - - - - - - - C - - - - - - - C - - - - - - .. row 4 - - - 1 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 5 - - - - - - .. row 6 - - - 2 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 7 - - - - - - - C - - - - - - - - - C - - - - - - .. row 8 - - - 3 - - - Y - - - - - Y - - - Y - - - - - Y + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 1 + - Y + - + - Y + - Y + - + - Y + * - + * - 2 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - + - C + - + * - 3 + - Y + - + - Y + - Y + - + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-nv16.rst b/Documentation/media/uapi/v4l/pixfmt-nv16.rst index e2ea0fcdccc7..8ceba79ff636 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv16.rst @@ -37,101 +37,46 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - start + 16: - - - Cb\ :sub:`00` - - - Cr\ :sub:`00` - - - Cb\ :sub:`01` - - - Cr\ :sub:`01` - - - .. row 6 - - - start + 20: - - - Cb\ :sub:`10` - - - Cr\ :sub:`10` - - - Cb\ :sub:`11` - - - Cr\ :sub:`11` - - - .. row 7 - - - start + 24: - - - Cb\ :sub:`20` - - - Cr\ :sub:`20` - - - Cb\ :sub:`21` - - - Cr\ :sub:`21` - - - .. row 8 - - - start + 28: - - - Cb\ :sub:`30` - - - Cr\ :sub:`30` - - - Cb\ :sub:`31` - - - Cr\ :sub:`31` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 16: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start + 20: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` + * - start + 24: + - Cb\ :sub:`20` + - Cr\ :sub:`20` + - Cb\ :sub:`21` + - Cr\ :sub:`21` + * - start + 28: + - Cb\ :sub:`30` + - Cr\ :sub:`30` + - Cb\ :sub:`31` + - Cr\ :sub:`31` **Color Sample Location..** @@ -142,124 +87,67 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 3 - - - - - - - C - - - - - - - C - - - - - - .. row 4 - - - 1 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 5 - - - - - - - C - - - - - - - C - - - - - - .. row 6 - - - - - - .. row 7 - - - 2 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 8 - - - - - - - C - - - - - - - C - - - - - - .. row 9 - - - 3 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 10 - - - - - - - C - - - - - - - C - - - + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 1 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - + * - 2 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 3 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - diff --git a/Documentation/media/uapi/v4l/pixfmt-nv16m.rst b/Documentation/media/uapi/v4l/pixfmt-nv16m.rst index 5908b0437697..4d46ab39f9f1 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv16m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv16m.rst @@ -40,105 +40,47 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start0 + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start0 + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start0 + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start0 + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - - - - .. row 6 - - - start1 + 0: - - - Cb\ :sub:`00` - - - Cr\ :sub:`00` - - - Cb\ :sub:`02` - - - Cr\ :sub:`02` - - - .. row 7 - - - start1 + 4: - - - Cb\ :sub:`10` - - - Cr\ :sub:`10` - - - Cb\ :sub:`12` - - - Cr\ :sub:`12` - - - .. row 8 - - - start1 + 8: - - - Cb\ :sub:`20` - - - Cr\ :sub:`20` - - - Cb\ :sub:`22` - - - Cr\ :sub:`22` - - - .. row 9 - - - start1 + 12: - - - Cb\ :sub:`30` - - - Cr\ :sub:`30` - - - Cb\ :sub:`32` - - - Cr\ :sub:`32` + * - start0 + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start0 + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start0 + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start0 + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - + * - start1 + 0: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`02` + - Cr\ :sub:`02` + * - start1 + 4: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`12` + - Cr\ :sub:`12` + * - start1 + 8: + - Cb\ :sub:`20` + - Cr\ :sub:`20` + - Cb\ :sub:`22` + - Cr\ :sub:`22` + * - start1 + 12: + - Cb\ :sub:`30` + - Cr\ :sub:`30` + - Cb\ :sub:`32` + - Cr\ :sub:`32` **Color Sample Location..** @@ -149,124 +91,67 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 3 - - - - - - - C - - - - - - - C - - - - - - .. row 4 - - - 1 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 5 - - - - - - - C - - - - - - - C - - - - - - .. row 6 - - - - - - .. row 7 - - - 2 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 8 - - - - - - - C - - - - - - - C - - - - - - .. row 9 - - - 3 - - - Y - - - - - Y - - - Y - - - - - Y - - - .. row 10 - - - - - - - C - - - - - - - C - - - + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 1 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - + * - 2 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - + * - 3 + - Y + - + - Y + - Y + - + - Y + * - + - + - C + - + - + - C + - diff --git a/Documentation/media/uapi/v4l/pixfmt-nv24.rst b/Documentation/media/uapi/v4l/pixfmt-nv24.rst index 67f3c53ac48d..bda973e86227 100644 --- a/Documentation/media/uapi/v4l/pixfmt-nv24.rst +++ b/Documentation/media/uapi/v4l/pixfmt-nv24.rst @@ -37,130 +37,59 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - start + 16: - - - Cb\ :sub:`00` - - - Cr\ :sub:`00` - - - Cb\ :sub:`01` - - - Cr\ :sub:`01` - - - Cb\ :sub:`02` - - - Cr\ :sub:`02` - - - Cb\ :sub:`03` - - - Cr\ :sub:`03` - - - .. row 6 - - - start + 24: - - - Cb\ :sub:`10` - - - Cr\ :sub:`10` - - - Cb\ :sub:`11` - - - Cr\ :sub:`11` - - - Cb\ :sub:`12` - - - Cr\ :sub:`12` - - - Cb\ :sub:`13` - - - Cr\ :sub:`13` - - - .. row 7 - - - start + 32: - - - Cb\ :sub:`20` - - - Cr\ :sub:`20` - - - Cb\ :sub:`21` - - - Cr\ :sub:`21` - - - Cb\ :sub:`22` - - - Cr\ :sub:`22` - - - Cb\ :sub:`23` - - - Cr\ :sub:`23` - - - .. row 8 - - - start + 40: - - - Cb\ :sub:`30` - - - Cr\ :sub:`30` - - - Cb\ :sub:`31` - - - Cr\ :sub:`31` - - - Cb\ :sub:`32` - - - Cr\ :sub:`32` - - - Cb\ :sub:`33` - - - Cr\ :sub:`33` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 16: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + - Cb\ :sub:`02` + - Cr\ :sub:`02` + - Cb\ :sub:`03` + - Cr\ :sub:`03` + * - start + 24: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` + - Cb\ :sub:`12` + - Cr\ :sub:`12` + - Cb\ :sub:`13` + - Cr\ :sub:`13` + * - start + 32: + - Cb\ :sub:`20` + - Cr\ :sub:`20` + - Cb\ :sub:`21` + - Cr\ :sub:`21` + - Cb\ :sub:`22` + - Cr\ :sub:`22` + - Cb\ :sub:`23` + - Cr\ :sub:`23` + * - start + 40: + - Cb\ :sub:`30` + - Cr\ :sub:`30` + - Cb\ :sub:`31` + - Cr\ :sub:`31` + - Cb\ :sub:`32` + - Cr\ :sub:`32` + - Cb\ :sub:`33` + - Cr\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst index 4eba72266587..84fcbcb74171 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst @@ -26,924 +26,505 @@ next to each other in memory. :header-rows: 2 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Code - - - - - :cspan:`7` Byte 0 in memory - - - - - :cspan:`7` Byte 1 - - - - - :cspan:`7` Byte 2 - - - - - :cspan:`7` Byte 3 - - - .. row 2 - - - - - - - Bit - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _V4L2-PIX-FMT-RGB332: - - - ``V4L2_PIX_FMT_RGB332`` - - - 'RGB1' - - - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _V4L2-PIX-FMT-ARGB444: - - - ``V4L2_PIX_FMT_ARGB444`` - - - 'AR12' - - - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _V4L2-PIX-FMT-XRGB444: - - - ``V4L2_PIX_FMT_XRGB444`` - - - 'XR12' - - - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - - - - - - - - - - - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _V4L2-PIX-FMT-ARGB555: - - - ``V4L2_PIX_FMT_ARGB555`` - - - 'AR15' - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - a - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. _V4L2-PIX-FMT-XRGB555: - - - ``V4L2_PIX_FMT_XRGB555`` - - - 'XR15' - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. _V4L2-PIX-FMT-RGB565: - - - ``V4L2_PIX_FMT_RGB565`` - - - 'RGBP' - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. _V4L2-PIX-FMT-ARGB555X: - - - ``V4L2_PIX_FMT_ARGB555X`` - - - 'AR15' | (1 << 31) - - - - - a - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _V4L2-PIX-FMT-XRGB555X: - - - ``V4L2_PIX_FMT_XRGB555X`` - - - 'XR15' | (1 << 31) - - - - - - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _V4L2-PIX-FMT-RGB565X: - - - ``V4L2_PIX_FMT_RGB565X`` - - - 'RGBR' - - - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _V4L2-PIX-FMT-BGR24: - - - ``V4L2_PIX_FMT_BGR24`` - - - 'BGR3' - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _V4L2-PIX-FMT-RGB24: - - - ``V4L2_PIX_FMT_RGB24`` - - - 'RGB3' - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _V4L2-PIX-FMT-BGR666: - - - ``V4L2_PIX_FMT_BGR666`` - - - 'BGRH' - - - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - - - r\ :sub:`1` - - - r\ :sub:`0` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .. _V4L2-PIX-FMT-ABGR32: - - - ``V4L2_PIX_FMT_ABGR32`` - - - 'AR24' - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - - - a\ :sub:`7` - - - a\ :sub:`6` - - - a\ :sub:`5` - - - a\ :sub:`4` - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - .. _V4L2-PIX-FMT-XBGR32: - - - ``V4L2_PIX_FMT_XBGR32`` - - - 'XR24' - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .. _V4L2-PIX-FMT-ARGB32: - - - ``V4L2_PIX_FMT_ARGB32`` - - - 'BA24' - - - - - a\ :sub:`7` - - - a\ :sub:`6` - - - a\ :sub:`5` - - - a\ :sub:`4` - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _V4L2-PIX-FMT-XRGB32: - - - ``V4L2_PIX_FMT_XRGB32`` - - - 'BX24' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` + * - Identifier + - Code + - + - :cspan:`7` Byte 0 in memory + - + - :cspan:`7` Byte 1 + - + - :cspan:`7` Byte 2 + - + - :cspan:`7` Byte 3 + * - + - + - Bit + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * .. _V4L2-PIX-FMT-RGB332: + + - ``V4L2_PIX_FMT_RGB332`` + - 'RGB1' + - + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _V4L2-PIX-FMT-ARGB444: + + - ``V4L2_PIX_FMT_ARGB444`` + - 'AR12' + - + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _V4L2-PIX-FMT-XRGB444: + + - ``V4L2_PIX_FMT_XRGB444`` + - 'XR12' + - + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - + - + - + - + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _V4L2-PIX-FMT-ARGB555: + + - ``V4L2_PIX_FMT_ARGB555`` + - 'AR15' + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - a + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`4` + - g\ :sub:`3` + * .. _V4L2-PIX-FMT-XRGB555: + + - ``V4L2_PIX_FMT_XRGB555`` + - 'XR15' + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`4` + - g\ :sub:`3` + * .. _V4L2-PIX-FMT-RGB565: + + - ``V4L2_PIX_FMT_RGB565`` + - 'RGBP' + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + * .. _V4L2-PIX-FMT-ARGB555X: + + - ``V4L2_PIX_FMT_ARGB555X`` + - 'AR15' | (1 << 31) + - + - a + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`4` + - g\ :sub:`3` + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _V4L2-PIX-FMT-XRGB555X: + + - ``V4L2_PIX_FMT_XRGB555X`` + - 'XR15' | (1 << 31) + - + - + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`4` + - g\ :sub:`3` + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _V4L2-PIX-FMT-RGB565X: + + - ``V4L2_PIX_FMT_RGB565X`` + - 'RGBR' + - + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _V4L2-PIX-FMT-BGR24: + + - ``V4L2_PIX_FMT_BGR24`` + - 'BGR3' + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _V4L2-PIX-FMT-RGB24: + + - ``V4L2_PIX_FMT_RGB24`` + - 'RGB3' + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _V4L2-PIX-FMT-BGR666: + + - ``V4L2_PIX_FMT_BGR666`` + - 'BGRH' + - + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - + - r\ :sub:`1` + - r\ :sub:`0` + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + * .. _V4L2-PIX-FMT-ABGR32: + + - ``V4L2_PIX_FMT_ABGR32`` + - 'AR24' + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - + - a\ :sub:`7` + - a\ :sub:`6` + - a\ :sub:`5` + - a\ :sub:`4` + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + * .. _V4L2-PIX-FMT-XBGR32: + + - ``V4L2_PIX_FMT_XBGR32`` + - 'XR24' + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - + - + - + - + - + - + - + - + - + * .. _V4L2-PIX-FMT-ARGB32: + + - ``V4L2_PIX_FMT_ARGB32`` + - 'BA24' + - + - a\ :sub:`7` + - a\ :sub:`6` + - a\ :sub:`5` + - a\ :sub:`4` + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _V4L2-PIX-FMT-XRGB32: + + - ``V4L2_PIX_FMT_XRGB32`` + - 'BX24' + - + - + - + - + - + - + - + - + - + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` .. raw:: latex @@ -990,118 +571,58 @@ Each cell is one byte. :stub-columns: 0 :widths: 11 3 3 3 3 3 3 3 3 3 3 3 3 - - - .. row 1 - - - start + 0: - - - B\ :sub:`00` - - - G\ :sub:`00` - - - R\ :sub:`00` - - - B\ :sub:`01` - - - G\ :sub:`01` - - - R\ :sub:`01` - - - B\ :sub:`02` - - - G\ :sub:`02` - - - R\ :sub:`02` - - - B\ :sub:`03` - - - G\ :sub:`03` - - - R\ :sub:`03` - - - .. row 2 - - - start + 12: - - - B\ :sub:`10` - - - G\ :sub:`10` - - - R\ :sub:`10` - - - B\ :sub:`11` - - - G\ :sub:`11` - - - R\ :sub:`11` - - - B\ :sub:`12` - - - G\ :sub:`12` - - - R\ :sub:`12` - - - B\ :sub:`13` - - - G\ :sub:`13` - - - R\ :sub:`13` - - - .. row 3 - - - start + 24: - - - B\ :sub:`20` - - - G\ :sub:`20` - - - R\ :sub:`20` - - - B\ :sub:`21` - - - G\ :sub:`21` - - - R\ :sub:`21` - - - B\ :sub:`22` - - - G\ :sub:`22` - - - R\ :sub:`22` - - - B\ :sub:`23` - - - G\ :sub:`23` - - - R\ :sub:`23` - - - .. row 4 - - - start + 36: - - - B\ :sub:`30` - - - G\ :sub:`30` - - - R\ :sub:`30` - - - B\ :sub:`31` - - - G\ :sub:`31` - - - R\ :sub:`31` - - - B\ :sub:`32` - - - G\ :sub:`32` - - - R\ :sub:`32` - - - B\ :sub:`33` - - - G\ :sub:`33` - - - R\ :sub:`33` + * - start + 0: + - B\ :sub:`00` + - G\ :sub:`00` + - R\ :sub:`00` + - B\ :sub:`01` + - G\ :sub:`01` + - R\ :sub:`01` + - B\ :sub:`02` + - G\ :sub:`02` + - R\ :sub:`02` + - B\ :sub:`03` + - G\ :sub:`03` + - R\ :sub:`03` + * - start + 12: + - B\ :sub:`10` + - G\ :sub:`10` + - R\ :sub:`10` + - B\ :sub:`11` + - G\ :sub:`11` + - R\ :sub:`11` + - B\ :sub:`12` + - G\ :sub:`12` + - R\ :sub:`12` + - B\ :sub:`13` + - G\ :sub:`13` + - R\ :sub:`13` + * - start + 24: + - B\ :sub:`20` + - G\ :sub:`20` + - R\ :sub:`20` + - B\ :sub:`21` + - G\ :sub:`21` + - R\ :sub:`21` + - B\ :sub:`22` + - G\ :sub:`22` + - R\ :sub:`22` + - B\ :sub:`23` + - G\ :sub:`23` + - R\ :sub:`23` + * - start + 36: + - B\ :sub:`30` + - G\ :sub:`30` + - R\ :sub:`30` + - B\ :sub:`31` + - G\ :sub:`31` + - R\ :sub:`31` + - B\ :sub:`32` + - G\ :sub:`32` + - R\ :sub:`32` + - B\ :sub:`33` + - G\ :sub:`33` + - R\ :sub:`33` .. raw:: latex @@ -1125,365 +646,200 @@ either the corresponding ARGB or XRGB format, depending on the driver. :header-rows: 2 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Code - - - - - :cspan:`7` Byte 0 in memory - - - - - :cspan:`7` Byte 1 - - - - - :cspan:`7` Byte 2 - - - - - :cspan:`7` Byte 3 - - - .. row 2 - - - - - - - Bit - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _V4L2-PIX-FMT-RGB444: - - - ``V4L2_PIX_FMT_RGB444`` - - - 'R444' - - - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _V4L2-PIX-FMT-RGB555: - - - ``V4L2_PIX_FMT_RGB555`` - - - 'RGBO' - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - a - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. _V4L2-PIX-FMT-RGB555X: - - - ``V4L2_PIX_FMT_RGB555X`` - - - 'RGBQ' - - - - - a - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _V4L2-PIX-FMT-BGR32: - - - ``V4L2_PIX_FMT_BGR32`` - - - 'BGR4' - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - - - a\ :sub:`7` - - - a\ :sub:`6` - - - a\ :sub:`5` - - - a\ :sub:`4` - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - .. _V4L2-PIX-FMT-RGB32: - - - ``V4L2_PIX_FMT_RGB32`` - - - 'RGB4' - - - - - a\ :sub:`7` - - - a\ :sub:`6` - - - a\ :sub:`5` - - - a\ :sub:`4` - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` + * - Identifier + - Code + - + - :cspan:`7` Byte 0 in memory + - + - :cspan:`7` Byte 1 + - + - :cspan:`7` Byte 2 + - + - :cspan:`7` Byte 3 + * - + - + - Bit + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * .. _V4L2-PIX-FMT-RGB444: + + - ``V4L2_PIX_FMT_RGB444`` + - 'R444' + - + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _V4L2-PIX-FMT-RGB555: + + - ``V4L2_PIX_FMT_RGB555`` + - 'RGBO' + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - a + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`4` + - g\ :sub:`3` + * .. _V4L2-PIX-FMT-RGB555X: + + - ``V4L2_PIX_FMT_RGB555X`` + - 'RGBQ' + - + - a + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`4` + - g\ :sub:`3` + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _V4L2-PIX-FMT-BGR32: + + - ``V4L2_PIX_FMT_BGR32`` + - 'BGR4' + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - + - a\ :sub:`7` + - a\ :sub:`6` + - a\ :sub:`5` + - a\ :sub:`4` + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + * .. _V4L2-PIX-FMT-RGB32: + + - ``V4L2_PIX_FMT_RGB32`` + - 'RGB4' + - + - a\ :sub:`7` + - a\ :sub:`6` + - a\ :sub:`5` + - a\ :sub:`4` + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` .. raw:: latex diff --git a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst index 36a221753b37..ebc8fcc937ad 100644 --- a/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst @@ -24,291 +24,160 @@ component of each pixel in one 16 or 32 bit word. :header-rows: 2 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Code - - - - - :cspan:`7` Byte 0 in memory - - - - - :cspan:`7` Byte 1 - - - - - :cspan:`7` Byte 2 - - - - - :cspan:`7` Byte 3 - - - .. row 2 - - - - - - - Bit - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _V4L2-PIX-FMT-YUV444: - - - ``V4L2_PIX_FMT_YUV444`` - - - 'Y444' - - - - - Cb\ :sub:`3` - - - Cb\ :sub:`2` - - - Cb\ :sub:`1` - - - Cb\ :sub:`0` - - - Cr\ :sub:`3` - - - Cr\ :sub:`2` - - - Cr\ :sub:`1` - - - Cr\ :sub:`0` - - - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - Y'\ :sub:`3` - - - Y'\ :sub:`2` - - - Y'\ :sub:`1` - - - Y'\ :sub:`0` - - - .. _V4L2-PIX-FMT-YUV555: - - - ``V4L2_PIX_FMT_YUV555`` - - - 'YUVO' - - - - - Cb\ :sub:`2` - - - Cb\ :sub:`1` - - - Cb\ :sub:`0` - - - Cr\ :sub:`4` - - - Cr\ :sub:`3` - - - Cr\ :sub:`2` - - - Cr\ :sub:`1` - - - Cr\ :sub:`0` - - - - - a - - - Y'\ :sub:`4` - - - Y'\ :sub:`3` - - - Y'\ :sub:`2` - - - Y'\ :sub:`1` - - - Y'\ :sub:`0` - - - Cb\ :sub:`4` - - - Cb\ :sub:`3` - - - .. _V4L2-PIX-FMT-YUV565: - - - ``V4L2_PIX_FMT_YUV565`` - - - 'YUVP' - - - - - Cb\ :sub:`2` - - - Cb\ :sub:`1` - - - Cb\ :sub:`0` - - - Cr\ :sub:`4` - - - Cr\ :sub:`3` - - - Cr\ :sub:`2` - - - Cr\ :sub:`1` - - - Cr\ :sub:`0` - - - - - Y'\ :sub:`4` - - - Y'\ :sub:`3` - - - Y'\ :sub:`2` - - - Y'\ :sub:`1` - - - Y'\ :sub:`0` - - - Cb\ :sub:`5` - - - Cb\ :sub:`4` - - - Cb\ :sub:`3` - - - .. _V4L2-PIX-FMT-YUV32: - - - ``V4L2_PIX_FMT_YUV32`` - - - 'YUV4' - - - - - a\ :sub:`7` - - - a\ :sub:`6` - - - a\ :sub:`5` - - - a\ :sub:`4` - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - - - Y'\ :sub:`7` - - - Y'\ :sub:`6` - - - Y'\ :sub:`5` - - - Y'\ :sub:`4` - - - Y'\ :sub:`3` - - - Y'\ :sub:`2` - - - Y'\ :sub:`1` - - - Y'\ :sub:`0` - - - - - Cb\ :sub:`7` - - - Cb\ :sub:`6` - - - Cb\ :sub:`5` - - - Cb\ :sub:`4` - - - Cb\ :sub:`3` - - - Cb\ :sub:`2` - - - Cb\ :sub:`1` - - - Cb\ :sub:`0` - - - - - Cr\ :sub:`7` - - - Cr\ :sub:`6` - - - Cr\ :sub:`5` - - - Cr\ :sub:`4` - - - Cr\ :sub:`3` - - - Cr\ :sub:`2` - - - Cr\ :sub:`1` - - - Cr\ :sub:`0` + * - Identifier + - Code + - + - :cspan:`7` Byte 0 in memory + - + - :cspan:`7` Byte 1 + - + - :cspan:`7` Byte 2 + - + - :cspan:`7` Byte 3 + * - + - + - Bit + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * .. _V4L2-PIX-FMT-YUV444: + + - ``V4L2_PIX_FMT_YUV444`` + - 'Y444' + - + - Cb\ :sub:`3` + - Cb\ :sub:`2` + - Cb\ :sub:`1` + - Cb\ :sub:`0` + - Cr\ :sub:`3` + - Cr\ :sub:`2` + - Cr\ :sub:`1` + - Cr\ :sub:`0` + - + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - Y'\ :sub:`3` + - Y'\ :sub:`2` + - Y'\ :sub:`1` + - Y'\ :sub:`0` + * .. _V4L2-PIX-FMT-YUV555: + + - ``V4L2_PIX_FMT_YUV555`` + - 'YUVO' + - + - Cb\ :sub:`2` + - Cb\ :sub:`1` + - Cb\ :sub:`0` + - Cr\ :sub:`4` + - Cr\ :sub:`3` + - Cr\ :sub:`2` + - Cr\ :sub:`1` + - Cr\ :sub:`0` + - + - a + - Y'\ :sub:`4` + - Y'\ :sub:`3` + - Y'\ :sub:`2` + - Y'\ :sub:`1` + - Y'\ :sub:`0` + - Cb\ :sub:`4` + - Cb\ :sub:`3` + * .. _V4L2-PIX-FMT-YUV565: + + - ``V4L2_PIX_FMT_YUV565`` + - 'YUVP' + - + - Cb\ :sub:`2` + - Cb\ :sub:`1` + - Cb\ :sub:`0` + - Cr\ :sub:`4` + - Cr\ :sub:`3` + - Cr\ :sub:`2` + - Cr\ :sub:`1` + - Cr\ :sub:`0` + - + - Y'\ :sub:`4` + - Y'\ :sub:`3` + - Y'\ :sub:`2` + - Y'\ :sub:`1` + - Y'\ :sub:`0` + - Cb\ :sub:`5` + - Cb\ :sub:`4` + - Cb\ :sub:`3` + * .. _V4L2-PIX-FMT-YUV32: + + - ``V4L2_PIX_FMT_YUV32`` + - 'YUV4' + - + - a\ :sub:`7` + - a\ :sub:`6` + - a\ :sub:`5` + - a\ :sub:`4` + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - + - Y'\ :sub:`7` + - Y'\ :sub:`6` + - Y'\ :sub:`5` + - Y'\ :sub:`4` + - Y'\ :sub:`3` + - Y'\ :sub:`2` + - Y'\ :sub:`1` + - Y'\ :sub:`0` + - + - Cb\ :sub:`7` + - Cb\ :sub:`6` + - Cb\ :sub:`5` + - Cb\ :sub:`4` + - Cb\ :sub:`3` + - Cb\ :sub:`2` + - Cb\ :sub:`1` + - Cb\ :sub:`0` + - + - Cr\ :sub:`7` + - Cr\ :sub:`6` + - Cr\ :sub:`5` + - Cr\ :sub:`4` + - Cr\ :sub:`3` + - Cr\ :sub:`2` + - Cr\ :sub:`1` + - Cr\ :sub:`0` .. raw:: latex diff --git a/Documentation/media/uapi/v4l/pixfmt-reserved.rst b/Documentation/media/uapi/v4l/pixfmt-reserved.rst index 0dd2f7fe096f..bd7bf3dae6af 100644 --- a/Documentation/media/uapi/v4l/pixfmt-reserved.rst +++ b/Documentation/media/uapi/v4l/pixfmt-reserved.rst @@ -26,318 +26,214 @@ please make a proposal on the linux-media mailing list. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - Identifier - - - Code - - - Details - - - .. _V4L2-PIX-FMT-DV: - - - ``V4L2_PIX_FMT_DV`` - - - 'dvsd' - - - unknown - - - .. _V4L2-PIX-FMT-ET61X251: - - - ``V4L2_PIX_FMT_ET61X251`` - - - 'E625' - - - Compressed format of the ET61X251 driver. - - - .. _V4L2-PIX-FMT-HI240: - - - ``V4L2_PIX_FMT_HI240`` - - - 'HI24' - - - 8 bit RGB format used by the BTTV driver. - - - .. _V4L2-PIX-FMT-HM12: - - - ``V4L2_PIX_FMT_HM12`` - - - 'HM12' - - - YUV 4:2:0 format used by the IVTV driver, - `http://www.ivtvdriver.org/ `__ - - The format is documented in the kernel sources in the file - ``Documentation/video4linux/cx2341x/README.hm12`` - - - .. _V4L2-PIX-FMT-CPIA1: - - - ``V4L2_PIX_FMT_CPIA1`` - - - 'CPIA' - - - YUV format used by the gspca cpia1 driver. - - - .. _V4L2-PIX-FMT-JPGL: - - - ``V4L2_PIX_FMT_JPGL`` - - - 'JPGL' - - - JPEG-Light format (Pegasus Lossless JPEG) used in Divio webcams NW - 80x. - - - .. _V4L2-PIX-FMT-SPCA501: - - - ``V4L2_PIX_FMT_SPCA501`` - - - 'S501' - - - YUYV per line used by the gspca driver. - - - .. _V4L2-PIX-FMT-SPCA505: - - - ``V4L2_PIX_FMT_SPCA505`` - - - 'S505' - - - YYUV per line used by the gspca driver. - - - .. _V4L2-PIX-FMT-SPCA508: - - - ``V4L2_PIX_FMT_SPCA508`` - - - 'S508' - - - YUVY per line used by the gspca driver. - - - .. _V4L2-PIX-FMT-SPCA561: - - - ``V4L2_PIX_FMT_SPCA561`` - - - 'S561' - - - Compressed GBRG Bayer format used by the gspca driver. - - - .. _V4L2-PIX-FMT-PAC207: - - - ``V4L2_PIX_FMT_PAC207`` - - - 'P207' - - - Compressed BGGR Bayer format used by the gspca driver. - - - .. _V4L2-PIX-FMT-MR97310A: - - - ``V4L2_PIX_FMT_MR97310A`` - - - 'M310' - - - Compressed BGGR Bayer format used by the gspca driver. - - - .. _V4L2-PIX-FMT-JL2005BCD: - - - ``V4L2_PIX_FMT_JL2005BCD`` - - - 'JL20' - - - JPEG compressed RGGB Bayer format used by the gspca driver. - - - .. _V4L2-PIX-FMT-OV511: - - - ``V4L2_PIX_FMT_OV511`` - - - 'O511' - - - OV511 JPEG format used by the gspca driver. - - - .. _V4L2-PIX-FMT-OV518: - - - ``V4L2_PIX_FMT_OV518`` - - - 'O518' - - - OV518 JPEG format used by the gspca driver. - - - .. _V4L2-PIX-FMT-PJPG: - - - ``V4L2_PIX_FMT_PJPG`` - - - 'PJPG' - - - Pixart 73xx JPEG format used by the gspca driver. - - - .. _V4L2-PIX-FMT-SE401: - - - ``V4L2_PIX_FMT_SE401`` - - - 'S401' - - - Compressed RGB format used by the gspca se401 driver - - - .. _V4L2-PIX-FMT-SQ905C: - - - ``V4L2_PIX_FMT_SQ905C`` - - - '905C' - - - Compressed RGGB bayer format used by the gspca driver. - - - .. _V4L2-PIX-FMT-MJPEG: - - - ``V4L2_PIX_FMT_MJPEG`` - - - 'MJPG' - - - Compressed format used by the Zoran driver - - - .. _V4L2-PIX-FMT-PWC1: - - - ``V4L2_PIX_FMT_PWC1`` - - - 'PWC1' - - - Compressed format of the PWC driver. - - - .. _V4L2-PIX-FMT-PWC2: - - - ``V4L2_PIX_FMT_PWC2`` - - - 'PWC2' - - - Compressed format of the PWC driver. - - - .. _V4L2-PIX-FMT-SN9C10X: - - - ``V4L2_PIX_FMT_SN9C10X`` - - - 'S910' - - - Compressed format of the SN9C102 driver. - - - .. _V4L2-PIX-FMT-SN9C20X-I420: - - - ``V4L2_PIX_FMT_SN9C20X_I420`` - - - 'S920' - - - YUV 4:2:0 format of the gspca sn9c20x driver. - - - .. _V4L2-PIX-FMT-SN9C2028: - - - ``V4L2_PIX_FMT_SN9C2028`` - - - 'SONX' - - - Compressed GBRG bayer format of the gspca sn9c2028 driver. - - - .. _V4L2-PIX-FMT-STV0680: - - - ``V4L2_PIX_FMT_STV0680`` - - - 'S680' - - - Bayer format of the gspca stv0680 driver. - - - .. _V4L2-PIX-FMT-WNVA: - - - ``V4L2_PIX_FMT_WNVA`` - - - 'WNVA' - - - Used by the Winnov Videum driver, - `http://www.thedirks.org/winnov/ `__ - - - .. _V4L2-PIX-FMT-TM6000: - - - ``V4L2_PIX_FMT_TM6000`` - - - 'TM60' - - - Used by Trident tm6000 - - - .. _V4L2-PIX-FMT-CIT-YYVYUY: - - - ``V4L2_PIX_FMT_CIT_YYVYUY`` - - - 'CITV' - - - Used by xirlink CIT, found at IBM webcams. - - Uses one line of Y then 1 line of VYUY - - - .. _V4L2-PIX-FMT-KONICA420: - - - ``V4L2_PIX_FMT_KONICA420`` - - - 'KONI' - - - Used by Konica webcams. - - YUV420 planar in blocks of 256 pixels. - - - .. _V4L2-PIX-FMT-YYUV: - - - ``V4L2_PIX_FMT_YYUV`` - - - 'YYUV' - - - unknown - - - .. _V4L2-PIX-FMT-Y4: - - - ``V4L2_PIX_FMT_Y4`` - - - 'Y04 ' - - - Old 4-bit greyscale format. Only the most significant 4 bits of - each byte are used, the other bits are set to 0. - - - .. _V4L2-PIX-FMT-Y6: - - - ``V4L2_PIX_FMT_Y6`` - - - 'Y06 ' - - - Old 6-bit greyscale format. Only the most significant 6 bits of - each byte are used, the other bits are set to 0. - - - .. _V4L2-PIX-FMT-S5C-UYVY-JPG: - - - ``V4L2_PIX_FMT_S5C_UYVY_JPG`` - - - 'S5CI' - - - Two-planar format used by Samsung S5C73MX cameras. The first plane - contains interleaved JPEG and UYVY image data, followed by meta - data in form of an array of offsets to the UYVY data blocks. The - actual pointer array follows immediately the interleaved JPEG/UYVY - data, the number of entries in this array equals the height of the - UYVY image. Each entry is a 4-byte unsigned integer in big endian - order and it's an offset to a single pixel line of the UYVY image. - The first plane can start either with JPEG or UYVY data chunk. The - size of a single UYVY block equals the UYVY image's width - multiplied by 2. The size of a JPEG chunk depends on the image and - can vary with each line. - - The second plane, at an offset of 4084 bytes, contains a 4-byte - offset to the pointer array in the first plane. This offset is - followed by a 4-byte value indicating size of the pointer array. - All numbers in the second plane are also in big endian order. - Remaining data in the second plane is undefined. The information - in the second plane allows to easily find location of the pointer - array, which can be different for each frame. The size of the - pointer array is constant for given UYVY image height. - - In order to extract UYVY and JPEG frames an application can - initially set a data pointer to the start of first plane and then - add an offset from the first entry of the pointers table. Such a - pointer indicates start of an UYVY image pixel line. Whole UYVY - line can be copied to a separate buffer. These steps should be - repeated for each line, i.e. the number of entries in the pointer - array. Anything what's in between the UYVY lines is JPEG data and - should be concatenated to form the JPEG stream. + * - Identifier + - Code + - Details + * .. _V4L2-PIX-FMT-DV: + + - ``V4L2_PIX_FMT_DV`` + - 'dvsd' + - unknown + * .. _V4L2-PIX-FMT-ET61X251: + + - ``V4L2_PIX_FMT_ET61X251`` + - 'E625' + - Compressed format of the ET61X251 driver. + * .. _V4L2-PIX-FMT-HI240: + + - ``V4L2_PIX_FMT_HI240`` + - 'HI24' + - 8 bit RGB format used by the BTTV driver. + * .. _V4L2-PIX-FMT-HM12: + + - ``V4L2_PIX_FMT_HM12`` + - 'HM12' + - YUV 4:2:0 format used by the IVTV driver, + `http://www.ivtvdriver.org/ `__ + + The format is documented in the kernel sources in the file + ``Documentation/video4linux/cx2341x/README.hm12`` + * .. _V4L2-PIX-FMT-CPIA1: + + - ``V4L2_PIX_FMT_CPIA1`` + - 'CPIA' + - YUV format used by the gspca cpia1 driver. + * .. _V4L2-PIX-FMT-JPGL: + + - ``V4L2_PIX_FMT_JPGL`` + - 'JPGL' + - JPEG-Light format (Pegasus Lossless JPEG) used in Divio webcams NW + 80x. + * .. _V4L2-PIX-FMT-SPCA501: + + - ``V4L2_PIX_FMT_SPCA501`` + - 'S501' + - YUYV per line used by the gspca driver. + * .. _V4L2-PIX-FMT-SPCA505: + + - ``V4L2_PIX_FMT_SPCA505`` + - 'S505' + - YYUV per line used by the gspca driver. + * .. _V4L2-PIX-FMT-SPCA508: + + - ``V4L2_PIX_FMT_SPCA508`` + - 'S508' + - YUVY per line used by the gspca driver. + * .. _V4L2-PIX-FMT-SPCA561: + + - ``V4L2_PIX_FMT_SPCA561`` + - 'S561' + - Compressed GBRG Bayer format used by the gspca driver. + * .. _V4L2-PIX-FMT-PAC207: + + - ``V4L2_PIX_FMT_PAC207`` + - 'P207' + - Compressed BGGR Bayer format used by the gspca driver. + * .. _V4L2-PIX-FMT-MR97310A: + + - ``V4L2_PIX_FMT_MR97310A`` + - 'M310' + - Compressed BGGR Bayer format used by the gspca driver. + * .. _V4L2-PIX-FMT-JL2005BCD: + + - ``V4L2_PIX_FMT_JL2005BCD`` + - 'JL20' + - JPEG compressed RGGB Bayer format used by the gspca driver. + * .. _V4L2-PIX-FMT-OV511: + + - ``V4L2_PIX_FMT_OV511`` + - 'O511' + - OV511 JPEG format used by the gspca driver. + * .. _V4L2-PIX-FMT-OV518: + + - ``V4L2_PIX_FMT_OV518`` + - 'O518' + - OV518 JPEG format used by the gspca driver. + * .. _V4L2-PIX-FMT-PJPG: + + - ``V4L2_PIX_FMT_PJPG`` + - 'PJPG' + - Pixart 73xx JPEG format used by the gspca driver. + * .. _V4L2-PIX-FMT-SE401: + + - ``V4L2_PIX_FMT_SE401`` + - 'S401' + - Compressed RGB format used by the gspca se401 driver + * .. _V4L2-PIX-FMT-SQ905C: + + - ``V4L2_PIX_FMT_SQ905C`` + - '905C' + - Compressed RGGB bayer format used by the gspca driver. + * .. _V4L2-PIX-FMT-MJPEG: + + - ``V4L2_PIX_FMT_MJPEG`` + - 'MJPG' + - Compressed format used by the Zoran driver + * .. _V4L2-PIX-FMT-PWC1: + + - ``V4L2_PIX_FMT_PWC1`` + - 'PWC1' + - Compressed format of the PWC driver. + * .. _V4L2-PIX-FMT-PWC2: + + - ``V4L2_PIX_FMT_PWC2`` + - 'PWC2' + - Compressed format of the PWC driver. + * .. _V4L2-PIX-FMT-SN9C10X: + + - ``V4L2_PIX_FMT_SN9C10X`` + - 'S910' + - Compressed format of the SN9C102 driver. + * .. _V4L2-PIX-FMT-SN9C20X-I420: + + - ``V4L2_PIX_FMT_SN9C20X_I420`` + - 'S920' + - YUV 4:2:0 format of the gspca sn9c20x driver. + * .. _V4L2-PIX-FMT-SN9C2028: + + - ``V4L2_PIX_FMT_SN9C2028`` + - 'SONX' + - Compressed GBRG bayer format of the gspca sn9c2028 driver. + * .. _V4L2-PIX-FMT-STV0680: + + - ``V4L2_PIX_FMT_STV0680`` + - 'S680' + - Bayer format of the gspca stv0680 driver. + * .. _V4L2-PIX-FMT-WNVA: + + - ``V4L2_PIX_FMT_WNVA`` + - 'WNVA' + - Used by the Winnov Videum driver, + `http://www.thedirks.org/winnov/ `__ + * .. _V4L2-PIX-FMT-TM6000: + + - ``V4L2_PIX_FMT_TM6000`` + - 'TM60' + - Used by Trident tm6000 + * .. _V4L2-PIX-FMT-CIT-YYVYUY: + + - ``V4L2_PIX_FMT_CIT_YYVYUY`` + - 'CITV' + - Used by xirlink CIT, found at IBM webcams. + + Uses one line of Y then 1 line of VYUY + * .. _V4L2-PIX-FMT-KONICA420: + + - ``V4L2_PIX_FMT_KONICA420`` + - 'KONI' + - Used by Konica webcams. + + YUV420 planar in blocks of 256 pixels. + * .. _V4L2-PIX-FMT-YYUV: + + - ``V4L2_PIX_FMT_YYUV`` + - 'YYUV' + - unknown + * .. _V4L2-PIX-FMT-Y4: + + - ``V4L2_PIX_FMT_Y4`` + - 'Y04 ' + - Old 4-bit greyscale format. Only the most significant 4 bits of + each byte are used, the other bits are set to 0. + * .. _V4L2-PIX-FMT-Y6: + + - ``V4L2_PIX_FMT_Y6`` + - 'Y06 ' + - Old 6-bit greyscale format. Only the most significant 6 bits of + each byte are used, the other bits are set to 0. + * .. _V4L2-PIX-FMT-S5C-UYVY-JPG: + + - ``V4L2_PIX_FMT_S5C_UYVY_JPG`` + - 'S5CI' + - Two-planar format used by Samsung S5C73MX cameras. The first plane + contains interleaved JPEG and UYVY image data, followed by meta + data in form of an array of offsets to the UYVY data blocks. The + actual pointer array follows immediately the interleaved JPEG/UYVY + data, the number of entries in this array equals the height of the + UYVY image. Each entry is a 4-byte unsigned integer in big endian + order and it's an offset to a single pixel line of the UYVY image. + The first plane can start either with JPEG or UYVY data chunk. The + size of a single UYVY block equals the UYVY image's width + multiplied by 2. The size of a JPEG chunk depends on the image and + can vary with each line. + + The second plane, at an offset of 4084 bytes, contains a 4-byte + offset to the pointer array in the first plane. This offset is + followed by a 4-byte value indicating size of the pointer array. + All numbers in the second plane are also in big endian order. + Remaining data in the second plane is undefined. The information + in the second plane allows to easily find location of the pointer + array, which can be different for each frame. The size of the + pointer array is constant for given UYVY image height. + + In order to extract UYVY and JPEG frames an application can + initially set a data pointer to the start of first plane and then + add an offset from the first entry of the pointers table. Such a + pointer indicates start of an UYVY image pixel line. Whole UYVY + line can be copied to a separate buffer. These steps should be + repeated for each line, i.e. the number of entries in the pointer + array. Anything what's in between the UYVY lines is JPEG data and + should be concatenated to form the JPEG stream. @@ -350,15 +246,10 @@ please make a proposal on the linux-media mailing list. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_PIX_FMT_FLAG_PREMUL_ALPHA`` - - - 0x00000001 - - - The color values are premultiplied by the alpha channel value. For - example, if a light blue pixel with 50% transparency was described - by RGBA values (128, 192, 255, 128), the same pixel described with - premultiplied colors would be described by RGBA values (64, 96, - 128, 128) + * - ``V4L2_PIX_FMT_FLAG_PREMUL_ALPHA`` + - 0x00000001 + - The color values are premultiplied by the alpha channel value. For + example, if a light blue pixel with 50% transparency was described + by RGBA values (128, 192, 255, 128), the same pixel described with + premultiplied colors would be described by RGBA values (64, 96, + 128, 128) diff --git a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst index e3b53e3b7f2e..6f7f327db85c 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sbggr16.rst @@ -24,82 +24,39 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start + 0: - - - B\ :sub:`00low` - - - B\ :sub:`00high` - - - G\ :sub:`01low` - - - G\ :sub:`01high` - - - B\ :sub:`02low` - - - B\ :sub:`02high` - - - G\ :sub:`03low` - - - G\ :sub:`03high` - - - .. row 2 - - - start + 8: - - - G\ :sub:`10low` - - - G\ :sub:`10high` - - - R\ :sub:`11low` - - - R\ :sub:`11high` - - - G\ :sub:`12low` - - - G\ :sub:`12high` - - - R\ :sub:`13low` - - - R\ :sub:`13high` - - - .. row 3 - - - start + 16: - - - B\ :sub:`20low` - - - B\ :sub:`20high` - - - G\ :sub:`21low` - - - G\ :sub:`21high` - - - B\ :sub:`22low` - - - B\ :sub:`22high` - - - G\ :sub:`23low` - - - G\ :sub:`23high` - - - .. row 4 - - - start + 24: - - - G\ :sub:`30low` - - - G\ :sub:`30high` - - - R\ :sub:`31low` - - - R\ :sub:`31high` - - - G\ :sub:`32low` - - - G\ :sub:`32high` - - - R\ :sub:`33low` - - - R\ :sub:`33high` + * - start + 0: + - B\ :sub:`00low` + - B\ :sub:`00high` + - G\ :sub:`01low` + - G\ :sub:`01high` + - B\ :sub:`02low` + - B\ :sub:`02high` + - G\ :sub:`03low` + - G\ :sub:`03high` + * - start + 8: + - G\ :sub:`10low` + - G\ :sub:`10high` + - R\ :sub:`11low` + - R\ :sub:`11high` + - G\ :sub:`12low` + - G\ :sub:`12high` + - R\ :sub:`13low` + - R\ :sub:`13high` + * - start + 16: + - B\ :sub:`20low` + - B\ :sub:`20high` + - G\ :sub:`21low` + - G\ :sub:`21high` + - B\ :sub:`22low` + - B\ :sub:`22high` + - G\ :sub:`23low` + - G\ :sub:`23high` + * - start + 24: + - G\ :sub:`30low` + - G\ :sub:`30high` + - R\ :sub:`31low` + - R\ :sub:`31high` + - G\ :sub:`32low` + - G\ :sub:`32high` + - R\ :sub:`33low` + - R\ :sub:`33high` diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst index 82b9995155fa..179894f6f8fb 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst @@ -24,15 +24,7 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - I'\ :sub:`0` - - - .. row 2 - - - start + 1: - - - Q'\ :sub:`0` + * - start + 0: + - I'\ :sub:`0` + * - start + 1: + - Q'\ :sub:`0` diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst index f06cbeb15dc2..5cf7d387447c 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst @@ -26,18 +26,9 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start + 0: - - - I'\ :sub:`0[7:0]` - - - I'\ :sub:`0[13:8]` - - - .. row 2 - - - start + 2: - - - Q'\ :sub:`0[7:0]` - - - Q'\ :sub:`0[13:8]` + * - start + 0: + - I'\ :sub:`0[7:0]` + - I'\ :sub:`0[13:8]` + * - start + 2: + - Q'\ :sub:`0[7:0]` + - Q'\ :sub:`0[13:8]` diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst index bd81eb2e0549..fd915b7629b7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst @@ -24,14 +24,7 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start + 0: - - - I'\ :sub:`0` - - - .. row 2 - - - start + 1: - - - Q'\ :sub:`0` + * - start + 0: + - I'\ :sub:`0` + * - start + 1: + - Q'\ :sub:`0` diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst index c72587de4a8d..8922f5b35457 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst @@ -26,18 +26,9 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - start + 0: - - - I'\ :sub:`0[7:0]` - - - I'\ :sub:`0[15:8]` - - - .. row 2 - - - start + 2: - - - Q'\ :sub:`0[7:0]` - - - Q'\ :sub:`0[15:8]` + * - start + 0: + - I'\ :sub:`0[7:0]` + - I'\ :sub:`0[15:8]` + * - start + 2: + - Q'\ :sub:`0[7:0]` + - Q'\ :sub:`0[15:8]` diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst index b5f0ca0f0c45..5e383382802f 100644 --- a/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst @@ -27,11 +27,6 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - I'\ :sub:`0[7:0]` - - - I'\ :sub:`0[11:8]` + * - start + 0: + - I'\ :sub:`0[7:0]` + - I'\ :sub:`0[11:8]` diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10.rst index b145c75d19bc..af2538ce34e5 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10.rst @@ -38,83 +38,39 @@ are 0. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - B\ :sub:`00low` - - - B\ :sub:`00high` - - - G\ :sub:`01low` - - - G\ :sub:`01high` - - - B\ :sub:`02low` - - - B\ :sub:`02high` - - - G\ :sub:`03low` - - - G\ :sub:`03high` - - - .. row 2 - - - start + 8: - - - G\ :sub:`10low` - - - G\ :sub:`10high` - - - R\ :sub:`11low` - - - R\ :sub:`11high` - - - G\ :sub:`12low` - - - G\ :sub:`12high` - - - R\ :sub:`13low` - - - R\ :sub:`13high` - - - .. row 3 - - - start + 16: - - - B\ :sub:`20low` - - - B\ :sub:`20high` - - - G\ :sub:`21low` - - - G\ :sub:`21high` - - - B\ :sub:`22low` - - - B\ :sub:`22high` - - - G\ :sub:`23low` - - - G\ :sub:`23high` - - - .. row 4 - - - start + 24: - - - G\ :sub:`30low` - - - G\ :sub:`30high` - - - R\ :sub:`31low` - - - R\ :sub:`31high` - - - G\ :sub:`32low` - - - G\ :sub:`32high` - - - R\ :sub:`33low` - - - R\ :sub:`33high` + * - start + 0: + - B\ :sub:`00low` + - B\ :sub:`00high` + - G\ :sub:`01low` + - G\ :sub:`01high` + - B\ :sub:`02low` + - B\ :sub:`02high` + - G\ :sub:`03low` + - G\ :sub:`03high` + * - start + 8: + - G\ :sub:`10low` + - G\ :sub:`10high` + - R\ :sub:`11low` + - R\ :sub:`11high` + - G\ :sub:`12low` + - G\ :sub:`12high` + - R\ :sub:`13low` + - R\ :sub:`13high` + * - start + 16: + - B\ :sub:`20low` + - B\ :sub:`20high` + - G\ :sub:`21low` + - G\ :sub:`21high` + - B\ :sub:`22low` + - B\ :sub:`22high` + - G\ :sub:`23low` + - G\ :sub:`23high` + * - start + 24: + - G\ :sub:`30low` + - G\ :sub:`30high` + - R\ :sub:`31low` + - R\ :sub:`31high` + - G\ :sub:`32low` + - G\ :sub:`32high` + - R\ :sub:`33low` + - R\ :sub:`33high` diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst index 80e345704ae7..9a41c8d811d0 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb10p.rst @@ -44,65 +44,34 @@ Each cell is one byte. :stub-columns: 0 :widths: 12 8 8 8 8 68 - - .. row 1 - - - start + 0: - - - B\ :sub:`00high` - - - G\ :sub:`01high` - - - B\ :sub:`02high` - - - G\ :sub:`03high` - - - G\ :sub:`03low`\ (bits 7--6) B\ :sub:`02low`\ (bits 5--4) - G\ :sub:`01low`\ (bits 3--2) B\ :sub:`00low`\ (bits 1--0) - - - .. row 2 - - - start + 5: - - - G\ :sub:`10high` - - - R\ :sub:`11high` - - - G\ :sub:`12high` - - - R\ :sub:`13high` - - - R\ :sub:`13low`\ (bits 7--6) G\ :sub:`12low`\ (bits 5--4) - R\ :sub:`11low`\ (bits 3--2) G\ :sub:`10low`\ (bits 1--0) - - - .. row 3 - - - start + 10: - - - B\ :sub:`20high` - - - G\ :sub:`21high` - - - B\ :sub:`22high` - - - G\ :sub:`23high` - - - G\ :sub:`23low`\ (bits 7--6) B\ :sub:`22low`\ (bits 5--4) - G\ :sub:`21low`\ (bits 3--2) B\ :sub:`20low`\ (bits 1--0) - - - .. row 4 - - - start + 15: - - - G\ :sub:`30high` - - - R\ :sub:`31high` - - - G\ :sub:`32high` - - - R\ :sub:`33high` - - - R\ :sub:`33low`\ (bits 7--6) G\ :sub:`32low`\ (bits 5--4) - R\ :sub:`31low`\ (bits 3--2) G\ :sub:`30low`\ (bits 1--0) + * - start + 0: + - B\ :sub:`00high` + - G\ :sub:`01high` + - B\ :sub:`02high` + - G\ :sub:`03high` + - G\ :sub:`03low`\ (bits 7--6) B\ :sub:`02low`\ (bits 5--4) + G\ :sub:`01low`\ (bits 3--2) B\ :sub:`00low`\ (bits 1--0) + * - start + 5: + - G\ :sub:`10high` + - R\ :sub:`11high` + - G\ :sub:`12high` + - R\ :sub:`13high` + - R\ :sub:`13low`\ (bits 7--6) G\ :sub:`12low`\ (bits 5--4) + R\ :sub:`11low`\ (bits 3--2) G\ :sub:`10low`\ (bits 1--0) + * - start + 10: + - B\ :sub:`20high` + - G\ :sub:`21high` + - B\ :sub:`22high` + - G\ :sub:`23high` + - G\ :sub:`23low`\ (bits 7--6) B\ :sub:`22low`\ (bits 5--4) + G\ :sub:`21low`\ (bits 3--2) B\ :sub:`20low`\ (bits 1--0) + * - start + 15: + - G\ :sub:`30high` + - R\ :sub:`31high` + - G\ :sub:`32high` + - R\ :sub:`33high` + - R\ :sub:`33low`\ (bits 7--6) G\ :sub:`32low`\ (bits 5--4) + R\ :sub:`31low`\ (bits 3--2) G\ :sub:`30low`\ (bits 1--0) .. raw:: latex diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst index 4776f3fb28f1..a50ee143cb08 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb12.rst @@ -39,83 +39,39 @@ Each cell is one byte, the 4 most significant bits in the high bytes are :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - B\ :sub:`00low` - - - B\ :sub:`00high` - - - G\ :sub:`01low` - - - G\ :sub:`01high` - - - B\ :sub:`02low` - - - B\ :sub:`02high` - - - G\ :sub:`03low` - - - G\ :sub:`03high` - - - .. row 2 - - - start + 8: - - - G\ :sub:`10low` - - - G\ :sub:`10high` - - - R\ :sub:`11low` - - - R\ :sub:`11high` - - - G\ :sub:`12low` - - - G\ :sub:`12high` - - - R\ :sub:`13low` - - - R\ :sub:`13high` - - - .. row 3 - - - start + 16: - - - B\ :sub:`20low` - - - B\ :sub:`20high` - - - G\ :sub:`21low` - - - G\ :sub:`21high` - - - B\ :sub:`22low` - - - B\ :sub:`22high` - - - G\ :sub:`23low` - - - G\ :sub:`23high` - - - .. row 4 - - - start + 24: - - - G\ :sub:`30low` - - - G\ :sub:`30high` - - - R\ :sub:`31low` - - - R\ :sub:`31high` - - - G\ :sub:`32low` - - - G\ :sub:`32high` - - - R\ :sub:`33low` - - - R\ :sub:`33high` + * - start + 0: + - B\ :sub:`00low` + - B\ :sub:`00high` + - G\ :sub:`01low` + - G\ :sub:`01high` + - B\ :sub:`02low` + - B\ :sub:`02high` + - G\ :sub:`03low` + - G\ :sub:`03high` + * - start + 8: + - G\ :sub:`10low` + - G\ :sub:`10high` + - R\ :sub:`11low` + - R\ :sub:`11high` + - G\ :sub:`12low` + - G\ :sub:`12high` + - R\ :sub:`13low` + - R\ :sub:`13high` + * - start + 16: + - B\ :sub:`20low` + - B\ :sub:`20high` + - G\ :sub:`21low` + - G\ :sub:`21high` + - B\ :sub:`22low` + - B\ :sub:`22high` + - G\ :sub:`23low` + - G\ :sub:`23high` + * - start + 24: + - G\ :sub:`30low` + - G\ :sub:`30high` + - R\ :sub:`31low` + - R\ :sub:`31high` + - G\ :sub:`32low` + - G\ :sub:`32high` + - R\ :sub:`33low` + - R\ :sub:`33high` diff --git a/Documentation/media/uapi/v4l/pixfmt-srggb8.rst b/Documentation/media/uapi/v4l/pixfmt-srggb8.rst index 55a1751bfe87..a3987d2e97fd 100644 --- a/Documentation/media/uapi/v4l/pixfmt-srggb8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-srggb8.rst @@ -32,51 +32,23 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - B\ :sub:`00` - - - G\ :sub:`01` - - - B\ :sub:`02` - - - G\ :sub:`03` - - - .. row 2 - - - start + 4: - - - G\ :sub:`10` - - - R\ :sub:`11` - - - G\ :sub:`12` - - - R\ :sub:`13` - - - .. row 3 - - - start + 8: - - - B\ :sub:`20` - - - G\ :sub:`21` - - - B\ :sub:`22` - - - G\ :sub:`23` - - - .. row 4 - - - start + 12: - - - G\ :sub:`30` - - - R\ :sub:`31` - - - G\ :sub:`32` - - - R\ :sub:`33` + * - start + 0: + - B\ :sub:`00` + - G\ :sub:`01` + - B\ :sub:`02` + - G\ :sub:`03` + * - start + 4: + - G\ :sub:`10` + - R\ :sub:`11` + - G\ :sub:`12` + - R\ :sub:`13` + * - start + 8: + - B\ :sub:`20` + - G\ :sub:`21` + - B\ :sub:`22` + - G\ :sub:`23` + * - start + 12: + - G\ :sub:`30` + - R\ :sub:`31` + - G\ :sub:`32` + - R\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-td08.rst b/Documentation/media/uapi/v4l/pixfmt-tch-td08.rst index e1d1b75454cd..07834cd1249e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-tch-td08.rst +++ b/Documentation/media/uapi/v4l/pixfmt-tch-td08.rst @@ -30,51 +30,23 @@ Each cell is one byte. :stub-columns: 0 :widths: 2 1 1 1 1 - - - .. row 1 - - - start + 0: - - - D'\ :sub:`00` - - - D'\ :sub:`01` - - - D'\ :sub:`02` - - - D'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - D'\ :sub:`10` - - - D'\ :sub:`11` - - - D'\ :sub:`12` - - - D'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - D'\ :sub:`20` - - - D'\ :sub:`21` - - - D'\ :sub:`22` - - - D'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - D'\ :sub:`30` - - - D'\ :sub:`31` - - - D'\ :sub:`32` - - - D'\ :sub:`33` + * - start + 0: + - D'\ :sub:`00` + - D'\ :sub:`01` + - D'\ :sub:`02` + - D'\ :sub:`03` + * - start + 4: + - D'\ :sub:`10` + - D'\ :sub:`11` + - D'\ :sub:`12` + - D'\ :sub:`13` + * - start + 8: + - D'\ :sub:`20` + - D'\ :sub:`21` + - D'\ :sub:`22` + - D'\ :sub:`23` + * - start + 12: + - D'\ :sub:`30` + - D'\ :sub:`31` + - D'\ :sub:`32` + - D'\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst b/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst index dfbbc405f889..29ebcf40a989 100644 --- a/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst @@ -29,83 +29,39 @@ Each cell is one byte. :stub-columns: 0 :widths: 2 1 1 1 1 1 1 1 1 - - - .. row 1 - - - start + 0: - - - D'\ :sub:`00high` - - - D'\ :sub:`00low` - - - D'\ :sub:`01high` - - - D'\ :sub:`01low` - - - D'\ :sub:`02high` - - - D'\ :sub:`02low` - - - D'\ :sub:`03high` - - - D'\ :sub:`03low` - - - .. row 2 - - - start + 8: - - - D'\ :sub:`10high` - - - D'\ :sub:`10low` - - - D'\ :sub:`11high` - - - D'\ :sub:`11low` - - - D'\ :sub:`12high` - - - D'\ :sub:`12low` - - - D'\ :sub:`13high` - - - D'\ :sub:`13low` - - - .. row 3 - - - start + 16: - - - D'\ :sub:`20high` - - - D'\ :sub:`20low` - - - D'\ :sub:`21high` - - - D'\ :sub:`21low` - - - D'\ :sub:`22high` - - - D'\ :sub:`22low` - - - D'\ :sub:`23high` - - - D'\ :sub:`23low` - - - .. row 4 - - - start + 24: - - - D'\ :sub:`30high` - - - D'\ :sub:`30low` - - - D'\ :sub:`31high` - - - D'\ :sub:`31low` - - - D'\ :sub:`32high` - - - D'\ :sub:`32low` - - - D'\ :sub:`33high` - - - D'\ :sub:`33low` + * - start + 0: + - D'\ :sub:`00high` + - D'\ :sub:`00low` + - D'\ :sub:`01high` + - D'\ :sub:`01low` + - D'\ :sub:`02high` + - D'\ :sub:`02low` + - D'\ :sub:`03high` + - D'\ :sub:`03low` + * - start + 8: + - D'\ :sub:`10high` + - D'\ :sub:`10low` + - D'\ :sub:`11high` + - D'\ :sub:`11low` + - D'\ :sub:`12high` + - D'\ :sub:`12low` + - D'\ :sub:`13high` + - D'\ :sub:`13low` + * - start + 16: + - D'\ :sub:`20high` + - D'\ :sub:`20low` + - D'\ :sub:`21high` + - D'\ :sub:`21low` + - D'\ :sub:`22high` + - D'\ :sub:`22low` + - D'\ :sub:`23high` + - D'\ :sub:`23low` + * - start + 24: + - D'\ :sub:`30high` + - D'\ :sub:`30low` + - D'\ :sub:`31high` + - D'\ :sub:`31low` + - D'\ :sub:`32high` + - D'\ :sub:`32low` + - D'\ :sub:`33high` + - D'\ :sub:`33low` diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst b/Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst index 18408afe39f5..e7fb7ddd191b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst +++ b/Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst @@ -28,51 +28,23 @@ Each cell is one byte. :stub-columns: 0 :widths: 2 1 1 1 1 - - - .. row 1 - - - start + 0: - - - R'\ :sub:`00` - - - R'\ :sub:`01` - - - R'\ :sub:`02` - - - R'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - R'\ :sub:`10` - - - R'\ :sub:`11` - - - R'\ :sub:`12` - - - R'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - R'\ :sub:`20` - - - R'\ :sub:`21` - - - R'\ :sub:`22` - - - R'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - R'\ :sub:`30` - - - R'\ :sub:`31` - - - R'\ :sub:`32` - - - R'\ :sub:`33` + * - start + 0: + - R'\ :sub:`00` + - R'\ :sub:`01` + - R'\ :sub:`02` + - R'\ :sub:`03` + * - start + 4: + - R'\ :sub:`10` + - R'\ :sub:`11` + - R'\ :sub:`12` + - R'\ :sub:`13` + * - start + 8: + - R'\ :sub:`20` + - R'\ :sub:`21` + - R'\ :sub:`22` + - R'\ :sub:`23` + * - start + 12: + - R'\ :sub:`30` + - R'\ :sub:`31` + - R'\ :sub:`32` + - R'\ :sub:`33` diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst b/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst index 67be13d9e550..1588fcc3f1e7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst @@ -28,83 +28,39 @@ Each cell is one byte. :stub-columns: 0 :widths: 2 1 1 1 1 1 1 1 1 - - - .. row 1 - - - start + 0: - - - R'\ :sub:`00high` - - - R'\ :sub:`00low` - - - R'\ :sub:`01high` - - - R'\ :sub:`01low` - - - R'\ :sub:`02high` - - - R'\ :sub:`02low` - - - R'\ :sub:`03high` - - - R'\ :sub:`03low` - - - .. row 2 - - - start + 8: - - - R'\ :sub:`10high` - - - R'\ :sub:`10low` - - - R'\ :sub:`11high` - - - R'\ :sub:`11low` - - - R'\ :sub:`12high` - - - R'\ :sub:`12low` - - - R'\ :sub:`13high` - - - R'\ :sub:`13low` - - - .. row 3 - - - start + 16: - - - R'\ :sub:`20high` - - - R'\ :sub:`20low` - - - R'\ :sub:`21high` - - - R'\ :sub:`21low` - - - R'\ :sub:`22high` - - - R'\ :sub:`22low` - - - R'\ :sub:`23high` - - - R'\ :sub:`23low` - - - .. row 4 - - - start + 24: - - - R'\ :sub:`30high` - - - R'\ :sub:`30low` - - - R'\ :sub:`31high` - - - R'\ :sub:`31low` - - - R'\ :sub:`32high` - - - R'\ :sub:`32low` - - - R'\ :sub:`33high` - - - R'\ :sub:`33low` + * - start + 0: + - R'\ :sub:`00high` + - R'\ :sub:`00low` + - R'\ :sub:`01high` + - R'\ :sub:`01low` + - R'\ :sub:`02high` + - R'\ :sub:`02low` + - R'\ :sub:`03high` + - R'\ :sub:`03low` + * - start + 8: + - R'\ :sub:`10high` + - R'\ :sub:`10low` + - R'\ :sub:`11high` + - R'\ :sub:`11low` + - R'\ :sub:`12high` + - R'\ :sub:`12low` + - R'\ :sub:`13high` + - R'\ :sub:`13low` + * - start + 16: + - R'\ :sub:`20high` + - R'\ :sub:`20low` + - R'\ :sub:`21high` + - R'\ :sub:`21low` + - R'\ :sub:`22high` + - R'\ :sub:`22low` + - R'\ :sub:`23high` + - R'\ :sub:`23low` + * - start + 24: + - R'\ :sub:`30high` + - R'\ :sub:`30low` + - R'\ :sub:`31high` + - R'\ :sub:`31low` + - R'\ :sub:`32high` + - R'\ :sub:`32low` + - R'\ :sub:`33high` + - R'\ :sub:`33low` diff --git a/Documentation/media/uapi/v4l/pixfmt-uv8.rst b/Documentation/media/uapi/v4l/pixfmt-uv8.rst index 8c4ebbf79ca0..c449231b51bb 100644 --- a/Documentation/media/uapi/v4l/pixfmt-uv8.rst +++ b/Documentation/media/uapi/v4l/pixfmt-uv8.rst @@ -25,51 +25,23 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Cb\ :sub:`00` - - - Cr\ :sub:`00` - - - Cb\ :sub:`01` - - - Cr\ :sub:`01` - - - .. row 2 - - - start + 4: - - - Cb\ :sub:`10` - - - Cr\ :sub:`10` - - - Cb\ :sub:`11` - - - Cr\ :sub:`11` - - - .. row 3 - - - start + 8: - - - Cb\ :sub:`20` - - - Cr\ :sub:`20` - - - Cb\ :sub:`21` - - - Cr\ :sub:`21` - - - .. row 4 - - - start + 12: - - - Cb\ :sub:`30` - - - Cr\ :sub:`30` - - - Cb\ :sub:`31` - - - Cr\ :sub:`31` + * - start + 0: + - Cb\ :sub:`00` + - Cr\ :sub:`00` + - Cb\ :sub:`01` + - Cr\ :sub:`01` + * - start + 4: + - Cb\ :sub:`10` + - Cr\ :sub:`10` + - Cb\ :sub:`11` + - Cr\ :sub:`11` + * - start + 8: + - Cb\ :sub:`20` + - Cr\ :sub:`20` + - Cb\ :sub:`21` + - Cr\ :sub:`21` + * - start + 12: + - Cb\ :sub:`30` + - Cr\ :sub:`30` + - Cb\ :sub:`31` + - Cr\ :sub:`31` diff --git a/Documentation/media/uapi/v4l/pixfmt-uyvy.rst b/Documentation/media/uapi/v4l/pixfmt-uyvy.rst index ed8ccf52b1db..30660e04dd0e 100644 --- a/Documentation/media/uapi/v4l/pixfmt-uyvy.rst +++ b/Documentation/media/uapi/v4l/pixfmt-uyvy.rst @@ -27,86 +27,42 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Cb\ :sub:`00` - - - Y'\ :sub:`00` - - - Cr\ :sub:`00` - - - Y'\ :sub:`01` - - - Cb\ :sub:`01` - - - Y'\ :sub:`02` - - - Cr\ :sub:`01` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 8: - - - Cb\ :sub:`10` - - - Y'\ :sub:`10` - - - Cr\ :sub:`10` - - - Y'\ :sub:`11` - - - Cb\ :sub:`11` - - - Y'\ :sub:`12` - - - Cr\ :sub:`11` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 16: - - - Cb\ :sub:`20` - - - Y'\ :sub:`20` - - - Cr\ :sub:`20` - - - Y'\ :sub:`21` - - - Cb\ :sub:`21` - - - Y'\ :sub:`22` - - - Cr\ :sub:`21` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 24: - - - Cb\ :sub:`30` - - - Y'\ :sub:`30` - - - Cr\ :sub:`30` - - - Y'\ :sub:`31` - - - Cb\ :sub:`31` - - - Y'\ :sub:`32` - - - Cr\ :sub:`31` - - - Y'\ :sub:`33` + * - start + 0: + - Cb\ :sub:`00` + - Y'\ :sub:`00` + - Cr\ :sub:`00` + - Y'\ :sub:`01` + - Cb\ :sub:`01` + - Y'\ :sub:`02` + - Cr\ :sub:`01` + - Y'\ :sub:`03` + * - start + 8: + - Cb\ :sub:`10` + - Y'\ :sub:`10` + - Cr\ :sub:`10` + - Y'\ :sub:`11` + - Cb\ :sub:`11` + - Y'\ :sub:`12` + - Cr\ :sub:`11` + - Y'\ :sub:`13` + * - start + 16: + - Cb\ :sub:`20` + - Y'\ :sub:`20` + - Cr\ :sub:`20` + - Y'\ :sub:`21` + - Cb\ :sub:`21` + - Y'\ :sub:`22` + - Cr\ :sub:`21` + - Y'\ :sub:`23` + * - start + 24: + - Cb\ :sub:`30` + - Y'\ :sub:`30` + - Cr\ :sub:`30` + - Y'\ :sub:`31` + - Cb\ :sub:`31` + - Y'\ :sub:`32` + - Cr\ :sub:`31` + - Y'\ :sub:`33` **Color Sample Location..** @@ -117,80 +73,38 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 3 - - - 1 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 4 - - - 2 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 5 - - - 3 - - - Y - - - C - - - Y - - - Y - - - C - - - Y + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - C + - Y + - Y + - C + - Y + * - 1 + - Y + - C + - Y + - Y + - C + - Y + * - 2 + - Y + - C + - Y + - Y + - C + - Y + * - 3 + - Y + - C + - Y + - Y + - C + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-vyuy.rst b/Documentation/media/uapi/v4l/pixfmt-vyuy.rst index d62c1ac4ed08..a3f61f280b94 100644 --- a/Documentation/media/uapi/v4l/pixfmt-vyuy.rst +++ b/Documentation/media/uapi/v4l/pixfmt-vyuy.rst @@ -27,86 +27,42 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Cr\ :sub:`00` - - - Y'\ :sub:`00` - - - Cb\ :sub:`00` - - - Y'\ :sub:`01` - - - Cr\ :sub:`01` - - - Y'\ :sub:`02` - - - Cb\ :sub:`01` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 8: - - - Cr\ :sub:`10` - - - Y'\ :sub:`10` - - - Cb\ :sub:`10` - - - Y'\ :sub:`11` - - - Cr\ :sub:`11` - - - Y'\ :sub:`12` - - - Cb\ :sub:`11` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 16: - - - Cr\ :sub:`20` - - - Y'\ :sub:`20` - - - Cb\ :sub:`20` - - - Y'\ :sub:`21` - - - Cr\ :sub:`21` - - - Y'\ :sub:`22` - - - Cb\ :sub:`21` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 24: - - - Cr\ :sub:`30` - - - Y'\ :sub:`30` - - - Cb\ :sub:`30` - - - Y'\ :sub:`31` - - - Cr\ :sub:`31` - - - Y'\ :sub:`32` - - - Cb\ :sub:`31` - - - Y'\ :sub:`33` + * - start + 0: + - Cr\ :sub:`00` + - Y'\ :sub:`00` + - Cb\ :sub:`00` + - Y'\ :sub:`01` + - Cr\ :sub:`01` + - Y'\ :sub:`02` + - Cb\ :sub:`01` + - Y'\ :sub:`03` + * - start + 8: + - Cr\ :sub:`10` + - Y'\ :sub:`10` + - Cb\ :sub:`10` + - Y'\ :sub:`11` + - Cr\ :sub:`11` + - Y'\ :sub:`12` + - Cb\ :sub:`11` + - Y'\ :sub:`13` + * - start + 16: + - Cr\ :sub:`20` + - Y'\ :sub:`20` + - Cb\ :sub:`20` + - Y'\ :sub:`21` + - Cr\ :sub:`21` + - Y'\ :sub:`22` + - Cb\ :sub:`21` + - Y'\ :sub:`23` + * - start + 24: + - Cr\ :sub:`30` + - Y'\ :sub:`30` + - Cb\ :sub:`30` + - Y'\ :sub:`31` + - Cr\ :sub:`31` + - Y'\ :sub:`32` + - Cb\ :sub:`31` + - Y'\ :sub:`33` **Color Sample Location..** @@ -115,80 +71,38 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - - - 2 - - - 3 - - - .. row 2 - - - 0 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 3 - - - 1 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 4 - - - 2 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 5 - - - 3 - - - Y - - - C - - - Y - - - Y - - - C - - - Y + * - + - 0 + - + - 1 + - + - 2 + - 3 + * - 0 + - Y + - C + - Y + - Y + - C + - Y + * - 1 + - Y + - C + - Y + - Y + - C + - Y + * - 2 + - Y + - C + - Y + - Y + - C + - Y + * - 3 + - Y + - C + - Y + - Y + - C + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-y10.rst b/Documentation/media/uapi/v4l/pixfmt-y10.rst index cb78e365a84c..89e22899cd81 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y10.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y10.rst @@ -27,83 +27,39 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00low` - - - Y'\ :sub:`00high` - - - Y'\ :sub:`01low` - - - Y'\ :sub:`01high` - - - Y'\ :sub:`02low` - - - Y'\ :sub:`02high` - - - Y'\ :sub:`03low` - - - Y'\ :sub:`03high` - - - .. row 2 - - - start + 8: - - - Y'\ :sub:`10low` - - - Y'\ :sub:`10high` - - - Y'\ :sub:`11low` - - - Y'\ :sub:`11high` - - - Y'\ :sub:`12low` - - - Y'\ :sub:`12high` - - - Y'\ :sub:`13low` - - - Y'\ :sub:`13high` - - - .. row 3 - - - start + 16: - - - Y'\ :sub:`20low` - - - Y'\ :sub:`20high` - - - Y'\ :sub:`21low` - - - Y'\ :sub:`21high` - - - Y'\ :sub:`22low` - - - Y'\ :sub:`22high` - - - Y'\ :sub:`23low` - - - Y'\ :sub:`23high` - - - .. row 4 - - - start + 24: - - - Y'\ :sub:`30low` - - - Y'\ :sub:`30high` - - - Y'\ :sub:`31low` - - - Y'\ :sub:`31high` - - - Y'\ :sub:`32low` - - - Y'\ :sub:`32high` - - - Y'\ :sub:`33low` - - - Y'\ :sub:`33high` + * - start + 0: + - Y'\ :sub:`00low` + - Y'\ :sub:`00high` + - Y'\ :sub:`01low` + - Y'\ :sub:`01high` + - Y'\ :sub:`02low` + - Y'\ :sub:`02high` + - Y'\ :sub:`03low` + - Y'\ :sub:`03high` + * - start + 8: + - Y'\ :sub:`10low` + - Y'\ :sub:`10high` + - Y'\ :sub:`11low` + - Y'\ :sub:`11high` + - Y'\ :sub:`12low` + - Y'\ :sub:`12high` + - Y'\ :sub:`13low` + - Y'\ :sub:`13high` + * - start + 16: + - Y'\ :sub:`20low` + - Y'\ :sub:`20high` + - Y'\ :sub:`21low` + - Y'\ :sub:`21high` + - Y'\ :sub:`22low` + - Y'\ :sub:`22high` + - Y'\ :sub:`23low` + - Y'\ :sub:`23high` + * - start + 24: + - Y'\ :sub:`30low` + - Y'\ :sub:`30high` + - Y'\ :sub:`31low` + - Y'\ :sub:`31high` + - Y'\ :sub:`32low` + - Y'\ :sub:`32high` + - Y'\ :sub:`33low` + - Y'\ :sub:`33high` diff --git a/Documentation/media/uapi/v4l/pixfmt-y10b.rst b/Documentation/media/uapi/v4l/pixfmt-y10b.rst index e89850bfef58..9feddf3ae07b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y10b.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y10b.rst @@ -26,14 +26,8 @@ pixels. :header-rows: 0 :stub-columns: 0 - - .. row 1 - - - Y'\ :sub:`00[9:2]` - - - Y'\ :sub:`00[1:0]`\ Y'\ :sub:`01[9:4]` - - - Y'\ :sub:`01[3:0]`\ Y'\ :sub:`02[9:6]` - - - Y'\ :sub:`02[5:0]`\ Y'\ :sub:`03[9:8]` - - - Y'\ :sub:`03[7:0]` + * - Y'\ :sub:`00[9:2]` + - Y'\ :sub:`00[1:0]`\ Y'\ :sub:`01[9:4]` + - Y'\ :sub:`01[3:0]`\ Y'\ :sub:`02[9:6]` + - Y'\ :sub:`02[5:0]`\ Y'\ :sub:`03[9:8]` + - Y'\ :sub:`03[7:0]` diff --git a/Documentation/media/uapi/v4l/pixfmt-y12.rst b/Documentation/media/uapi/v4l/pixfmt-y12.rst index 0958e87b6d22..0f230713290b 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y12.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y12.rst @@ -27,83 +27,39 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00low` - - - Y'\ :sub:`00high` - - - Y'\ :sub:`01low` - - - Y'\ :sub:`01high` - - - Y'\ :sub:`02low` - - - Y'\ :sub:`02high` - - - Y'\ :sub:`03low` - - - Y'\ :sub:`03high` - - - .. row 2 - - - start + 8: - - - Y'\ :sub:`10low` - - - Y'\ :sub:`10high` - - - Y'\ :sub:`11low` - - - Y'\ :sub:`11high` - - - Y'\ :sub:`12low` - - - Y'\ :sub:`12high` - - - Y'\ :sub:`13low` - - - Y'\ :sub:`13high` - - - .. row 3 - - - start + 16: - - - Y'\ :sub:`20low` - - - Y'\ :sub:`20high` - - - Y'\ :sub:`21low` - - - Y'\ :sub:`21high` - - - Y'\ :sub:`22low` - - - Y'\ :sub:`22high` - - - Y'\ :sub:`23low` - - - Y'\ :sub:`23high` - - - .. row 4 - - - start + 24: - - - Y'\ :sub:`30low` - - - Y'\ :sub:`30high` - - - Y'\ :sub:`31low` - - - Y'\ :sub:`31high` - - - Y'\ :sub:`32low` - - - Y'\ :sub:`32high` - - - Y'\ :sub:`33low` - - - Y'\ :sub:`33high` + * - start + 0: + - Y'\ :sub:`00low` + - Y'\ :sub:`00high` + - Y'\ :sub:`01low` + - Y'\ :sub:`01high` + - Y'\ :sub:`02low` + - Y'\ :sub:`02high` + - Y'\ :sub:`03low` + - Y'\ :sub:`03high` + * - start + 8: + - Y'\ :sub:`10low` + - Y'\ :sub:`10high` + - Y'\ :sub:`11low` + - Y'\ :sub:`11high` + - Y'\ :sub:`12low` + - Y'\ :sub:`12high` + - Y'\ :sub:`13low` + - Y'\ :sub:`13high` + * - start + 16: + - Y'\ :sub:`20low` + - Y'\ :sub:`20high` + - Y'\ :sub:`21low` + - Y'\ :sub:`21high` + - Y'\ :sub:`22low` + - Y'\ :sub:`22high` + - Y'\ :sub:`23low` + - Y'\ :sub:`23high` + * - start + 24: + - Y'\ :sub:`30low` + - Y'\ :sub:`30high` + - Y'\ :sub:`31low` + - Y'\ :sub:`31high` + - Y'\ :sub:`32low` + - Y'\ :sub:`32high` + - Y'\ :sub:`33low` + - Y'\ :sub:`33high` diff --git a/Documentation/media/uapi/v4l/pixfmt-y12i.rst b/Documentation/media/uapi/v4l/pixfmt-y12i.rst index e66d8bcdb410..bb39a2463564 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y12i.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y12i.rst @@ -31,11 +31,6 @@ interleaved pixel. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - Y'\ :sub:`0left[7:0]` - - - Y'\ :sub:`0right[3:0]`\ Y'\ :sub:`0left[11:8]` - - - Y'\ :sub:`0right[11:4]` + * - Y'\ :sub:`0left[7:0]` + - Y'\ :sub:`0right[3:0]`\ Y'\ :sub:`0left[11:8]` + - Y'\ :sub:`0right[11:4]` diff --git a/Documentation/media/uapi/v4l/pixfmt-y16-be.rst b/Documentation/media/uapi/v4l/pixfmt-y16-be.rst index fc23c6b12193..54ce35ef84b7 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y16-be.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y16-be.rst @@ -31,83 +31,39 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00high` - - - Y'\ :sub:`00low` - - - Y'\ :sub:`01high` - - - Y'\ :sub:`01low` - - - Y'\ :sub:`02high` - - - Y'\ :sub:`02low` - - - Y'\ :sub:`03high` - - - Y'\ :sub:`03low` - - - .. row 2 - - - start + 8: - - - Y'\ :sub:`10high` - - - Y'\ :sub:`10low` - - - Y'\ :sub:`11high` - - - Y'\ :sub:`11low` - - - Y'\ :sub:`12high` - - - Y'\ :sub:`12low` - - - Y'\ :sub:`13high` - - - Y'\ :sub:`13low` - - - .. row 3 - - - start + 16: - - - Y'\ :sub:`20high` - - - Y'\ :sub:`20low` - - - Y'\ :sub:`21high` - - - Y'\ :sub:`21low` - - - Y'\ :sub:`22high` - - - Y'\ :sub:`22low` - - - Y'\ :sub:`23high` - - - Y'\ :sub:`23low` - - - .. row 4 - - - start + 24: - - - Y'\ :sub:`30high` - - - Y'\ :sub:`30low` - - - Y'\ :sub:`31high` - - - Y'\ :sub:`31low` - - - Y'\ :sub:`32high` - - - Y'\ :sub:`32low` - - - Y'\ :sub:`33high` - - - Y'\ :sub:`33low` + * - start + 0: + - Y'\ :sub:`00high` + - Y'\ :sub:`00low` + - Y'\ :sub:`01high` + - Y'\ :sub:`01low` + - Y'\ :sub:`02high` + - Y'\ :sub:`02low` + - Y'\ :sub:`03high` + - Y'\ :sub:`03low` + * - start + 8: + - Y'\ :sub:`10high` + - Y'\ :sub:`10low` + - Y'\ :sub:`11high` + - Y'\ :sub:`11low` + - Y'\ :sub:`12high` + - Y'\ :sub:`12low` + - Y'\ :sub:`13high` + - Y'\ :sub:`13low` + * - start + 16: + - Y'\ :sub:`20high` + - Y'\ :sub:`20low` + - Y'\ :sub:`21high` + - Y'\ :sub:`21low` + - Y'\ :sub:`22high` + - Y'\ :sub:`22low` + - Y'\ :sub:`23high` + - Y'\ :sub:`23low` + * - start + 24: + - Y'\ :sub:`30high` + - Y'\ :sub:`30low` + - Y'\ :sub:`31high` + - Y'\ :sub:`31low` + - Y'\ :sub:`32high` + - Y'\ :sub:`32low` + - Y'\ :sub:`33high` + - Y'\ :sub:`33low` diff --git a/Documentation/media/uapi/v4l/pixfmt-y16.rst b/Documentation/media/uapi/v4l/pixfmt-y16.rst index 6b4edc4e34e5..bcbd52de3aca 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y16.rst @@ -31,83 +31,39 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00low` - - - Y'\ :sub:`00high` - - - Y'\ :sub:`01low` - - - Y'\ :sub:`01high` - - - Y'\ :sub:`02low` - - - Y'\ :sub:`02high` - - - Y'\ :sub:`03low` - - - Y'\ :sub:`03high` - - - .. row 2 - - - start + 8: - - - Y'\ :sub:`10low` - - - Y'\ :sub:`10high` - - - Y'\ :sub:`11low` - - - Y'\ :sub:`11high` - - - Y'\ :sub:`12low` - - - Y'\ :sub:`12high` - - - Y'\ :sub:`13low` - - - Y'\ :sub:`13high` - - - .. row 3 - - - start + 16: - - - Y'\ :sub:`20low` - - - Y'\ :sub:`20high` - - - Y'\ :sub:`21low` - - - Y'\ :sub:`21high` - - - Y'\ :sub:`22low` - - - Y'\ :sub:`22high` - - - Y'\ :sub:`23low` - - - Y'\ :sub:`23high` - - - .. row 4 - - - start + 24: - - - Y'\ :sub:`30low` - - - Y'\ :sub:`30high` - - - Y'\ :sub:`31low` - - - Y'\ :sub:`31high` - - - Y'\ :sub:`32low` - - - Y'\ :sub:`32high` - - - Y'\ :sub:`33low` - - - Y'\ :sub:`33high` + * - start + 0: + - Y'\ :sub:`00low` + - Y'\ :sub:`00high` + - Y'\ :sub:`01low` + - Y'\ :sub:`01high` + - Y'\ :sub:`02low` + - Y'\ :sub:`02high` + - Y'\ :sub:`03low` + - Y'\ :sub:`03high` + * - start + 8: + - Y'\ :sub:`10low` + - Y'\ :sub:`10high` + - Y'\ :sub:`11low` + - Y'\ :sub:`11high` + - Y'\ :sub:`12low` + - Y'\ :sub:`12high` + - Y'\ :sub:`13low` + - Y'\ :sub:`13high` + * - start + 16: + - Y'\ :sub:`20low` + - Y'\ :sub:`20high` + - Y'\ :sub:`21low` + - Y'\ :sub:`21high` + - Y'\ :sub:`22low` + - Y'\ :sub:`22high` + - Y'\ :sub:`23low` + - Y'\ :sub:`23high` + * - start + 24: + - Y'\ :sub:`30low` + - Y'\ :sub:`30high` + - Y'\ :sub:`31low` + - Y'\ :sub:`31high` + - Y'\ :sub:`32low` + - Y'\ :sub:`32high` + - Y'\ :sub:`33low` + - Y'\ :sub:`33high` diff --git a/Documentation/media/uapi/v4l/pixfmt-y41p.rst b/Documentation/media/uapi/v4l/pixfmt-y41p.rst index 9c3194bbf77e..05d040c46a47 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y41p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y41p.rst @@ -34,118 +34,58 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Cb\ :sub:`00` - - - Y'\ :sub:`00` - - - Cr\ :sub:`00` - - - Y'\ :sub:`01` - - - Cb\ :sub:`01` - - - Y'\ :sub:`02` - - - Cr\ :sub:`01` - - - Y'\ :sub:`03` - - - Y'\ :sub:`04` - - - Y'\ :sub:`05` - - - Y'\ :sub:`06` - - - Y'\ :sub:`07` - - - .. row 2 - - - start + 12: - - - Cb\ :sub:`10` - - - Y'\ :sub:`10` - - - Cr\ :sub:`10` - - - Y'\ :sub:`11` - - - Cb\ :sub:`11` - - - Y'\ :sub:`12` - - - Cr\ :sub:`11` - - - Y'\ :sub:`13` - - - Y'\ :sub:`14` - - - Y'\ :sub:`15` - - - Y'\ :sub:`16` - - - Y'\ :sub:`17` - - - .. row 3 - - - start + 24: - - - Cb\ :sub:`20` - - - Y'\ :sub:`20` - - - Cr\ :sub:`20` - - - Y'\ :sub:`21` - - - Cb\ :sub:`21` - - - Y'\ :sub:`22` - - - Cr\ :sub:`21` - - - Y'\ :sub:`23` - - - Y'\ :sub:`24` - - - Y'\ :sub:`25` - - - Y'\ :sub:`26` - - - Y'\ :sub:`27` - - - .. row 4 - - - start + 36: - - - Cb\ :sub:`30` - - - Y'\ :sub:`30` - - - Cr\ :sub:`30` - - - Y'\ :sub:`31` - - - Cb\ :sub:`31` - - - Y'\ :sub:`32` - - - Cr\ :sub:`31` - - - Y'\ :sub:`33` - - - Y'\ :sub:`34` - - - Y'\ :sub:`35` - - - Y'\ :sub:`36` - - - Y'\ :sub:`37` + * - start + 0: + - Cb\ :sub:`00` + - Y'\ :sub:`00` + - Cr\ :sub:`00` + - Y'\ :sub:`01` + - Cb\ :sub:`01` + - Y'\ :sub:`02` + - Cr\ :sub:`01` + - Y'\ :sub:`03` + - Y'\ :sub:`04` + - Y'\ :sub:`05` + - Y'\ :sub:`06` + - Y'\ :sub:`07` + * - start + 12: + - Cb\ :sub:`10` + - Y'\ :sub:`10` + - Cr\ :sub:`10` + - Y'\ :sub:`11` + - Cb\ :sub:`11` + - Y'\ :sub:`12` + - Cr\ :sub:`11` + - Y'\ :sub:`13` + - Y'\ :sub:`14` + - Y'\ :sub:`15` + - Y'\ :sub:`16` + - Y'\ :sub:`17` + * - start + 24: + - Cb\ :sub:`20` + - Y'\ :sub:`20` + - Cr\ :sub:`20` + - Y'\ :sub:`21` + - Cb\ :sub:`21` + - Y'\ :sub:`22` + - Cr\ :sub:`21` + - Y'\ :sub:`23` + - Y'\ :sub:`24` + - Y'\ :sub:`25` + - Y'\ :sub:`26` + - Y'\ :sub:`27` + * - start + 36: + - Cb\ :sub:`30` + - Y'\ :sub:`30` + - Cr\ :sub:`30` + - Y'\ :sub:`31` + - Cb\ :sub:`31` + - Y'\ :sub:`32` + - Cr\ :sub:`31` + - Y'\ :sub:`33` + - Y'\ :sub:`34` + - Y'\ :sub:`35` + - Y'\ :sub:`36` + - Y'\ :sub:`37` **Color Sample Location..** @@ -154,120 +94,58 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - 1 - - - - - 2 - - - 3 - - - 4 - - - 5 - - - - - 6 - - - 7 - - - .. row 2 - - - 0 - - - Y - - - Y - - - C - - - Y - - - Y - - - Y - - - Y - - - C - - - Y - - - Y - - - .. row 3 - - - 1 - - - Y - - - Y - - - C - - - Y - - - Y - - - Y - - - Y - - - C - - - Y - - - Y - - - .. row 4 - - - 2 - - - Y - - - Y - - - C - - - Y - - - Y - - - Y - - - Y - - - C - - - Y - - - Y - - - .. row 5 - - - 3 - - - Y - - - Y - - - C - - - Y - - - Y - - - Y - - - Y - - - C - - - Y - - - Y + * - + - 0 + - 1 + - + - 2 + - 3 + - 4 + - 5 + - + - 6 + - 7 + * - 0 + - Y + - Y + - C + - Y + - Y + - Y + - Y + - C + - Y + - Y + * - 1 + - Y + - Y + - C + - Y + - Y + - Y + - Y + - C + - Y + - Y + * - 2 + - Y + - Y + - C + - Y + - Y + - Y + - Y + - C + - Y + - Y + * - 3 + - Y + - Y + - C + - Y + - Y + - Y + - Y + - C + - Y + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-y8i.rst b/Documentation/media/uapi/v4l/pixfmt-y8i.rst index 16bdfbbe6915..fd8ed23dd342 100644 --- a/Documentation/media/uapi/v4l/pixfmt-y8i.rst +++ b/Documentation/media/uapi/v4l/pixfmt-y8i.rst @@ -28,83 +28,39 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00left` - - - Y'\ :sub:`00right` - - - Y'\ :sub:`01left` - - - Y'\ :sub:`01right` - - - Y'\ :sub:`02left` - - - Y'\ :sub:`02right` - - - Y'\ :sub:`03left` - - - Y'\ :sub:`03right` - - - .. row 2 - - - start + 8: - - - Y'\ :sub:`10left` - - - Y'\ :sub:`10right` - - - Y'\ :sub:`11left` - - - Y'\ :sub:`11right` - - - Y'\ :sub:`12left` - - - Y'\ :sub:`12right` - - - Y'\ :sub:`13left` - - - Y'\ :sub:`13right` - - - .. row 3 - - - start + 16: - - - Y'\ :sub:`20left` - - - Y'\ :sub:`20right` - - - Y'\ :sub:`21left` - - - Y'\ :sub:`21right` - - - Y'\ :sub:`22left` - - - Y'\ :sub:`22right` - - - Y'\ :sub:`23left` - - - Y'\ :sub:`23right` - - - .. row 4 - - - start + 24: - - - Y'\ :sub:`30left` - - - Y'\ :sub:`30right` - - - Y'\ :sub:`31left` - - - Y'\ :sub:`31right` - - - Y'\ :sub:`32left` - - - Y'\ :sub:`32right` - - - Y'\ :sub:`33left` - - - Y'\ :sub:`33right` + * - start + 0: + - Y'\ :sub:`00left` + - Y'\ :sub:`00right` + - Y'\ :sub:`01left` + - Y'\ :sub:`01right` + - Y'\ :sub:`02left` + - Y'\ :sub:`02right` + - Y'\ :sub:`03left` + - Y'\ :sub:`03right` + * - start + 8: + - Y'\ :sub:`10left` + - Y'\ :sub:`10right` + - Y'\ :sub:`11left` + - Y'\ :sub:`11right` + - Y'\ :sub:`12left` + - Y'\ :sub:`12right` + - Y'\ :sub:`13left` + - Y'\ :sub:`13right` + * - start + 16: + - Y'\ :sub:`20left` + - Y'\ :sub:`20right` + - Y'\ :sub:`21left` + - Y'\ :sub:`21right` + - Y'\ :sub:`22left` + - Y'\ :sub:`22right` + - Y'\ :sub:`23left` + - Y'\ :sub:`23right` + * - start + 24: + - Y'\ :sub:`30left` + - Y'\ :sub:`30right` + - Y'\ :sub:`31left` + - Y'\ :sub:`31right` + - Y'\ :sub:`32left` + - Y'\ :sub:`32right` + - Y'\ :sub:`33left` + - Y'\ :sub:`33right` diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv410.rst b/Documentation/media/uapi/v4l/pixfmt-yuv410.rst index 54909839b0d1..0c49915af850 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv410.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv410.rst @@ -41,66 +41,30 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - start + 16: - - - Cr\ :sub:`00` - - - .. row 6 - - - start + 17: - - - Cb\ :sub:`00` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 16: + - Cr\ :sub:`00` + * - start + 17: + - Cb\ :sub:`00` **Color Sample Location..** @@ -111,97 +75,53 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 3 - - - - - - .. row 4 - - - 1 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 5 - - - - - - - - - - - C - - - - - - - - - - .. row 6 - - - 2 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 7 - - - - - - .. row 8 - - - 3 - - - Y - - - - - Y - - - - - Y - - - - - Y + * - + - 0 + - + - 1 + - + - 2 + - + - 3 + * - 0 + - Y + - + - Y + - + - Y + - + - Y + * - + * - 1 + - Y + - + - Y + - + - Y + - + - Y + * - + - + - + - + - C + - + - + - + * - 2 + - Y + - + - Y + - + - Y + - + - Y + * - + * - 3 + - Y + - + - Y + - + - Y + - + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst b/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst index 913f68fe2536..2cf33fad7254 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv411p.rst @@ -37,102 +37,42 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - start + 16: - - - Cb\ :sub:`00` - - - .. row 6 - - - start + 17: - - - Cb\ :sub:`10` - - - .. row 7 - - - start + 18: - - - Cb\ :sub:`20` - - - .. row 8 - - - start + 19: - - - Cb\ :sub:`30` - - - .. row 9 - - - start + 20: - - - Cr\ :sub:`00` - - - .. row 10 - - - start + 21: - - - Cr\ :sub:`10` - - - .. row 11 - - - start + 22: - - - Cr\ :sub:`20` - - - .. row 12 - - - start + 23: - - - Cr\ :sub:`30` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 16: + - Cb\ :sub:`00` + * - start + 17: + - Cb\ :sub:`10` + * - start + 18: + - Cb\ :sub:`20` + * - start + 19: + - Cb\ :sub:`30` + * - start + 20: + - Cr\ :sub:`00` + * - start + 21: + - Cr\ :sub:`10` + * - start + 22: + - Cr\ :sub:`20` + * - start + 23: + - Cr\ :sub:`30` **Color Sample Location..** @@ -143,71 +83,33 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - 1 - - - - - 2 - - - 3 - - - .. row 2 - - - 0 - - - Y - - - Y - - - C - - - Y - - - Y - - - .. row 3 - - - 1 - - - Y - - - Y - - - C - - - Y - - - Y - - - .. row 4 - - - 2 - - - Y - - - Y - - - C - - - Y - - - Y - - - .. row 5 - - - 3 - - - Y - - - Y - - - C - - - Y - - - Y + * - + - 0 + - 1 + - + - 2 + - 3 + * - 0 + - Y + - Y + - C + - Y + - Y + * - 1 + - Y + - Y + - C + - Y + - Y + * - 2 + - Y + - Y + - C + - Y + - Y + * - 3 + - Y + - Y + - C + - Y + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv420.rst b/Documentation/media/uapi/v4l/pixfmt-yuv420.rst index a7f17e40b59e..fd98904058ed 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv420.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv420.rst @@ -42,86 +42,38 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - start + 16: - - - Cr\ :sub:`00` - - - Cr\ :sub:`01` - - - .. row 6 - - - start + 18: - - - Cr\ :sub:`10` - - - Cr\ :sub:`11` - - - .. row 7 - - - start + 20: - - - Cb\ :sub:`00` - - - Cb\ :sub:`01` - - - .. row 8 - - - start + 22: - - - Cb\ :sub:`10` - - - Cb\ :sub:`11` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 16: + - Cr\ :sub:`00` + - Cr\ :sub:`01` + * - start + 18: + - Cr\ :sub:`10` + - Cr\ :sub:`11` + * - start + 20: + - Cb\ :sub:`00` + - Cb\ :sub:`01` + * - start + 22: + - Cb\ :sub:`10` + - Cb\ :sub:`11` **Color Sample Location..** @@ -132,107 +84,60 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 3 - - - - - - - C - - - - - - - - - C - - - - - - .. row 4 - - - 1 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 5 - - - - - - .. row 6 - - - 2 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 7 - - - - - - - C - - - - - - - - - C - - - - - - .. row 8 - - - 3 - - - Y - - - - - Y - - - - - Y - - - - - Y + * - + - 0 + - + - 1 + - + - 2 + - + - 3 + * - 0 + - Y + - + - Y + - + - Y + - + - Y + * - + - + - C + - + - + - + - C + - + * - 1 + - Y + - + - Y + - + - Y + - + - Y + * - + * - 2 + - Y + - + - Y + - + - Y + - + - Y + * - + - + - C + - + - + - + - C + - + * - 3 + - Y + - + - Y + - + - Y + - + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst index 588784512944..cce8c477fdfc 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv420m.rst @@ -49,94 +49,40 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start0 + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start0 + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start0 + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start0 + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - - - - .. row 6 - - - start1 + 0: - - - Cb\ :sub:`00` - - - Cb\ :sub:`01` - - - .. row 7 - - - start1 + 2: - - - Cb\ :sub:`10` - - - Cb\ :sub:`11` - - - .. row 8 - - - - - - .. row 9 - - - start2 + 0: - - - Cr\ :sub:`00` - - - Cr\ :sub:`01` - - - .. row 10 - - - start2 + 2: - - - Cr\ :sub:`10` - - - Cr\ :sub:`11` + * - start0 + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start0 + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start0 + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start0 + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - + * - start1 + 0: + - Cb\ :sub:`00` + - Cb\ :sub:`01` + * - start1 + 2: + - Cb\ :sub:`10` + - Cb\ :sub:`11` + * - + * - start2 + 0: + - Cr\ :sub:`00` + - Cr\ :sub:`01` + * - start2 + 2: + - Cr\ :sub:`10` + - Cr\ :sub:`11` **Color Sample Location..** @@ -147,107 +93,60 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 3 - - - - - - - C - - - - - - - - - C - - - - - - .. row 4 - - - 1 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 5 - - - - - - .. row 6 - - - 2 - - - Y - - - - - Y - - - - - Y - - - - - Y - - - .. row 7 - - - - - - - C - - - - - - - - - C - - - - - - .. row 8 - - - 3 - - - Y - - - - - Y - - - - - Y - - - - - Y + * - + - 0 + - + - 1 + - + - 2 + - + - 3 + * - 0 + - Y + - + - Y + - + - Y + - + - Y + * - + - + - C + - + - + - + - C + - + * - 1 + - Y + - + - Y + - + - Y + - + - Y + * - + * - 2 + - Y + - + - Y + - + - Y + - + - Y + * - + - + - C + - + - + - + - C + - + * - 3 + - Y + - + - Y + - + - Y + - + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst index 0c0a462c4dde..d986393aa934 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv422m.rst @@ -48,126 +48,52 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start0 + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start0 + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start0 + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start0 + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - - - - .. row 6 - - - start1 + 0: - - - Cb\ :sub:`00` - - - Cb\ :sub:`01` - - - .. row 7 - - - start1 + 2: - - - Cb\ :sub:`10` - - - Cb\ :sub:`11` - - - .. row 8 - - - start1 + 4: - - - Cb\ :sub:`20` - - - Cb\ :sub:`21` - - - .. row 9 - - - start1 + 6: - - - Cb\ :sub:`30` - - - Cb\ :sub:`31` - - - .. row 10 - - - - - - .. row 11 - - - start2 + 0: - - - Cr\ :sub:`00` - - - Cr\ :sub:`01` - - - .. row 12 - - - start2 + 2: - - - Cr\ :sub:`10` - - - Cr\ :sub:`11` - - - .. row 13 - - - start2 + 4: - - - Cr\ :sub:`20` - - - Cr\ :sub:`21` - - - .. row 14 - - - start2 + 6: - - - Cr\ :sub:`30` - - - Cr\ :sub:`31` + * - start0 + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start0 + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start0 + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start0 + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - + * - start1 + 0: + - Cb\ :sub:`00` + - Cb\ :sub:`01` + * - start1 + 2: + - Cb\ :sub:`10` + - Cb\ :sub:`11` + * - start1 + 4: + - Cb\ :sub:`20` + - Cb\ :sub:`21` + * - start1 + 6: + - Cb\ :sub:`30` + - Cb\ :sub:`31` + * - + * - start2 + 0: + - Cr\ :sub:`00` + - Cr\ :sub:`01` + * - start2 + 2: + - Cr\ :sub:`10` + - Cr\ :sub:`11` + * - start2 + 4: + - Cr\ :sub:`20` + - Cr\ :sub:`21` + * - start2 + 6: + - Cr\ :sub:`30` + - Cr\ :sub:`31` **Color Sample Location..** @@ -178,80 +104,38 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 3 - - - 1 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 4 - - - 2 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 5 - - - 3 - - - Y - - - C - - - Y - - - Y - - - C - - - Y + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - C + - Y + - Y + - C + - Y + * - 1 + - Y + - C + - Y + - Y + - C + - Y + * - 2 + - Y + - C + - Y + - Y + - C + - Y + * - 3 + - Y + - C + - Y + - Y + - C + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst b/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst index 9618f0d24265..e6f5de546dba 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv422p.rst @@ -38,118 +38,50 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - start + 16: - - - Cb\ :sub:`00` - - - Cb\ :sub:`01` - - - .. row 6 - - - start + 18: - - - Cb\ :sub:`10` - - - Cb\ :sub:`11` - - - .. row 7 - - - start + 20: - - - Cb\ :sub:`20` - - - Cb\ :sub:`21` - - - .. row 8 - - - start + 22: - - - Cb\ :sub:`30` - - - Cb\ :sub:`31` - - - .. row 9 - - - start + 24: - - - Cr\ :sub:`00` - - - Cr\ :sub:`01` - - - .. row 10 - - - start + 26: - - - Cr\ :sub:`10` - - - Cr\ :sub:`11` - - - .. row 11 - - - start + 28: - - - Cr\ :sub:`20` - - - Cr\ :sub:`21` - - - .. row 12 - - - start + 30: - - - Cr\ :sub:`30` - - - Cr\ :sub:`31` + * - start + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - start + 16: + - Cb\ :sub:`00` + - Cb\ :sub:`01` + * - start + 18: + - Cb\ :sub:`10` + - Cb\ :sub:`11` + * - start + 20: + - Cb\ :sub:`20` + - Cb\ :sub:`21` + * - start + 22: + - Cb\ :sub:`30` + - Cb\ :sub:`31` + * - start + 24: + - Cr\ :sub:`00` + - Cr\ :sub:`01` + * - start + 26: + - Cr\ :sub:`10` + - Cr\ :sub:`11` + * - start + 28: + - Cr\ :sub:`20` + - Cr\ :sub:`21` + * - start + 30: + - Cr\ :sub:`30` + - Cr\ :sub:`31` **Color Sample Location..** @@ -160,80 +92,38 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 3 - - - 1 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 4 - - - 2 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 5 - - - 3 - - - Y - - - C - - - Y - - - Y - - - C - - - Y + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - C + - Y + - Y + - C + - Y + * - 1 + - Y + - C + - Y + - Y + - C + - Y + * - 2 + - Y + - C + - Y + - Y + - C + - Y + * - 3 + - Y + - C + - Y + - Y + - C + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst b/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst index 5985d45efb2c..830fbf6fcd1d 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuv444m.rst @@ -42,158 +42,68 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start0 + 0: - - - Y'\ :sub:`00` - - - Y'\ :sub:`01` - - - Y'\ :sub:`02` - - - Y'\ :sub:`03` - - - .. row 2 - - - start0 + 4: - - - Y'\ :sub:`10` - - - Y'\ :sub:`11` - - - Y'\ :sub:`12` - - - Y'\ :sub:`13` - - - .. row 3 - - - start0 + 8: - - - Y'\ :sub:`20` - - - Y'\ :sub:`21` - - - Y'\ :sub:`22` - - - Y'\ :sub:`23` - - - .. row 4 - - - start0 + 12: - - - Y'\ :sub:`30` - - - Y'\ :sub:`31` - - - Y'\ :sub:`32` - - - Y'\ :sub:`33` - - - .. row 5 - - - - - - .. row 6 - - - start1 + 0: - - - Cb\ :sub:`00` - - - Cb\ :sub:`01` - - - Cb\ :sub:`02` - - - Cb\ :sub:`03` - - - .. row 7 - - - start1 + 4: - - - Cb\ :sub:`10` - - - Cb\ :sub:`11` - - - Cb\ :sub:`12` - - - Cb\ :sub:`13` - - - .. row 8 - - - start1 + 8: - - - Cb\ :sub:`20` - - - Cb\ :sub:`21` - - - Cb\ :sub:`22` - - - Cb\ :sub:`23` - - - .. row 9 - - - start1 + 12: - - - Cb\ :sub:`20` - - - Cb\ :sub:`21` - - - Cb\ :sub:`32` - - - Cb\ :sub:`33` - - - .. row 10 - - - - - - .. row 11 - - - start2 + 0: - - - Cr\ :sub:`00` - - - Cr\ :sub:`01` - - - Cr\ :sub:`02` - - - Cr\ :sub:`03` - - - .. row 12 - - - start2 + 4: - - - Cr\ :sub:`10` - - - Cr\ :sub:`11` - - - Cr\ :sub:`12` - - - Cr\ :sub:`13` - - - .. row 13 - - - start2 + 8: - - - Cr\ :sub:`20` - - - Cr\ :sub:`21` - - - Cr\ :sub:`22` - - - Cr\ :sub:`23` - - - .. row 14 - - - start2 + 12: - - - Cr\ :sub:`30` - - - Cr\ :sub:`31` - - - Cr\ :sub:`32` - - - Cr\ :sub:`33` + * - start0 + 0: + - Y'\ :sub:`00` + - Y'\ :sub:`01` + - Y'\ :sub:`02` + - Y'\ :sub:`03` + * - start0 + 4: + - Y'\ :sub:`10` + - Y'\ :sub:`11` + - Y'\ :sub:`12` + - Y'\ :sub:`13` + * - start0 + 8: + - Y'\ :sub:`20` + - Y'\ :sub:`21` + - Y'\ :sub:`22` + - Y'\ :sub:`23` + * - start0 + 12: + - Y'\ :sub:`30` + - Y'\ :sub:`31` + - Y'\ :sub:`32` + - Y'\ :sub:`33` + * - + * - start1 + 0: + - Cb\ :sub:`00` + - Cb\ :sub:`01` + - Cb\ :sub:`02` + - Cb\ :sub:`03` + * - start1 + 4: + - Cb\ :sub:`10` + - Cb\ :sub:`11` + - Cb\ :sub:`12` + - Cb\ :sub:`13` + * - start1 + 8: + - Cb\ :sub:`20` + - Cb\ :sub:`21` + - Cb\ :sub:`22` + - Cb\ :sub:`23` + * - start1 + 12: + - Cb\ :sub:`20` + - Cb\ :sub:`21` + - Cb\ :sub:`32` + - Cb\ :sub:`33` + * - + * - start2 + 0: + - Cr\ :sub:`00` + - Cr\ :sub:`01` + - Cr\ :sub:`02` + - Cr\ :sub:`03` + * - start2 + 4: + - Cr\ :sub:`10` + - Cr\ :sub:`11` + - Cr\ :sub:`12` + - Cr\ :sub:`13` + * - start2 + 8: + - Cr\ :sub:`20` + - Cr\ :sub:`21` + - Cr\ :sub:`22` + - Cr\ :sub:`23` + * - start2 + 12: + - Cr\ :sub:`30` + - Cr\ :sub:`31` + - Cr\ :sub:`32` + - Cr\ :sub:`33` **Color Sample Location..** @@ -204,62 +114,28 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - 1 - - - 2 - - - 3 - - - .. row 2 - - - 0 - - - YC - - - YC - - - YC - - - YC - - - .. row 3 - - - 1 - - - YC - - - YC - - - YC - - - YC - - - .. row 4 - - - 2 - - - YC - - - YC - - - YC - - - YC - - - .. row 5 - - - 3 - - - YC - - - YC - - - YC - - - YC + * - + - 0 + - 1 + - 2 + - 3 + * - 0 + - YC + - YC + - YC + - YC + * - 1 + - YC + - YC + - YC + - YC + * - 2 + - YC + - YC + - YC + - YC + * - 3 + - YC + - YC + - YC + - YC diff --git a/Documentation/media/uapi/v4l/pixfmt-yuyv.rst b/Documentation/media/uapi/v4l/pixfmt-yuyv.rst index 10deab080d51..e1bdd6b1aefc 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yuyv.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yuyv.rst @@ -30,86 +30,42 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Cb\ :sub:`00` - - - Y'\ :sub:`01` - - - Cr\ :sub:`00` - - - Y'\ :sub:`02` - - - Cb\ :sub:`01` - - - Y'\ :sub:`03` - - - Cr\ :sub:`01` - - - .. row 2 - - - start + 8: - - - Y'\ :sub:`10` - - - Cb\ :sub:`10` - - - Y'\ :sub:`11` - - - Cr\ :sub:`10` - - - Y'\ :sub:`12` - - - Cb\ :sub:`11` - - - Y'\ :sub:`13` - - - Cr\ :sub:`11` - - - .. row 3 - - - start + 16: - - - Y'\ :sub:`20` - - - Cb\ :sub:`20` - - - Y'\ :sub:`21` - - - Cr\ :sub:`20` - - - Y'\ :sub:`22` - - - Cb\ :sub:`21` - - - Y'\ :sub:`23` - - - Cr\ :sub:`21` - - - .. row 4 - - - start + 24: - - - Y'\ :sub:`30` - - - Cb\ :sub:`30` - - - Y'\ :sub:`31` - - - Cr\ :sub:`30` - - - Y'\ :sub:`32` - - - Cb\ :sub:`31` - - - Y'\ :sub:`33` - - - Cr\ :sub:`31` + * - start + 0: + - Y'\ :sub:`00` + - Cb\ :sub:`00` + - Y'\ :sub:`01` + - Cr\ :sub:`00` + - Y'\ :sub:`02` + - Cb\ :sub:`01` + - Y'\ :sub:`03` + - Cr\ :sub:`01` + * - start + 8: + - Y'\ :sub:`10` + - Cb\ :sub:`10` + - Y'\ :sub:`11` + - Cr\ :sub:`10` + - Y'\ :sub:`12` + - Cb\ :sub:`11` + - Y'\ :sub:`13` + - Cr\ :sub:`11` + * - start + 16: + - Y'\ :sub:`20` + - Cb\ :sub:`20` + - Y'\ :sub:`21` + - Cr\ :sub:`20` + - Y'\ :sub:`22` + - Cb\ :sub:`21` + - Y'\ :sub:`23` + - Cr\ :sub:`21` + * - start + 24: + - Y'\ :sub:`30` + - Cb\ :sub:`30` + - Y'\ :sub:`31` + - Cr\ :sub:`30` + - Y'\ :sub:`32` + - Cb\ :sub:`31` + - Y'\ :sub:`33` + - Cr\ :sub:`31` **Color Sample Location..** @@ -120,85 +76,43 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - C - - - Y - - - - - Y - - - C - - - Y - - - .. row 3 - - - 1 - - - Y - - - C - - - Y - - - - - Y - - - C - - - Y - - - .. row 4 - - - 2 - - - Y - - - C - - - Y - - - - - Y - - - C - - - Y - - - .. row 5 - - - 3 - - - Y - - - C - - - Y - - - - - Y - - - C - - - Y + * - + - 0 + - + - 1 + - + - 2 + - + - 3 + * - 0 + - Y + - C + - Y + - + - Y + - C + - Y + * - 1 + - Y + - C + - Y + - + - Y + - C + - Y + * - 2 + - Y + - C + - Y + - + - Y + - C + - Y + * - 3 + - Y + - C + - Y + - + - Y + - C + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-yvyu.rst b/Documentation/media/uapi/v4l/pixfmt-yvyu.rst index d126f08c1adc..0244ce6741a6 100644 --- a/Documentation/media/uapi/v4l/pixfmt-yvyu.rst +++ b/Documentation/media/uapi/v4l/pixfmt-yvyu.rst @@ -27,86 +27,42 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Y'\ :sub:`00` - - - Cr\ :sub:`00` - - - Y'\ :sub:`01` - - - Cb\ :sub:`00` - - - Y'\ :sub:`02` - - - Cr\ :sub:`01` - - - Y'\ :sub:`03` - - - Cb\ :sub:`01` - - - .. row 2 - - - start + 8: - - - Y'\ :sub:`10` - - - Cr\ :sub:`10` - - - Y'\ :sub:`11` - - - Cb\ :sub:`10` - - - Y'\ :sub:`12` - - - Cr\ :sub:`11` - - - Y'\ :sub:`13` - - - Cb\ :sub:`11` - - - .. row 3 - - - start + 16: - - - Y'\ :sub:`20` - - - Cr\ :sub:`20` - - - Y'\ :sub:`21` - - - Cb\ :sub:`20` - - - Y'\ :sub:`22` - - - Cr\ :sub:`21` - - - Y'\ :sub:`23` - - - Cb\ :sub:`21` - - - .. row 4 - - - start + 24: - - - Y'\ :sub:`30` - - - Cr\ :sub:`30` - - - Y'\ :sub:`31` - - - Cb\ :sub:`30` - - - Y'\ :sub:`32` - - - Cr\ :sub:`31` - - - Y'\ :sub:`33` - - - Cb\ :sub:`31` + * - start + 0: + - Y'\ :sub:`00` + - Cr\ :sub:`00` + - Y'\ :sub:`01` + - Cb\ :sub:`00` + - Y'\ :sub:`02` + - Cr\ :sub:`01` + - Y'\ :sub:`03` + - Cb\ :sub:`01` + * - start + 8: + - Y'\ :sub:`10` + - Cr\ :sub:`10` + - Y'\ :sub:`11` + - Cb\ :sub:`10` + - Y'\ :sub:`12` + - Cr\ :sub:`11` + - Y'\ :sub:`13` + - Cb\ :sub:`11` + * - start + 16: + - Y'\ :sub:`20` + - Cr\ :sub:`20` + - Y'\ :sub:`21` + - Cb\ :sub:`20` + - Y'\ :sub:`22` + - Cr\ :sub:`21` + - Y'\ :sub:`23` + - Cb\ :sub:`21` + * - start + 24: + - Y'\ :sub:`30` + - Cr\ :sub:`30` + - Y'\ :sub:`31` + - Cb\ :sub:`30` + - Y'\ :sub:`32` + - Cr\ :sub:`31` + - Y'\ :sub:`33` + - Cb\ :sub:`31` **Color Sample Location..** @@ -115,80 +71,38 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - - - 0 - - - - - 1 - - - 2 - - - - - 3 - - - .. row 2 - - - 0 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 3 - - - 1 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 4 - - - 2 - - - Y - - - C - - - Y - - - Y - - - C - - - Y - - - .. row 5 - - - 3 - - - Y - - - C - - - Y - - - Y - - - C - - - Y + * - + - 0 + - + - 1 + - 2 + - + - 3 + * - 0 + - Y + - C + - Y + - Y + - C + - Y + * - 1 + - Y + - C + - Y + - Y + - C + - Y + * - 2 + - Y + - C + - Y + - Y + - C + - Y + * - 3 + - Y + - C + - Y + - Y + - C + - Y diff --git a/Documentation/media/uapi/v4l/pixfmt-z16.rst b/Documentation/media/uapi/v4l/pixfmt-z16.rst index 97fe1483a481..eb713a9bccae 100644 --- a/Documentation/media/uapi/v4l/pixfmt-z16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-z16.rst @@ -28,83 +28,39 @@ Each cell is one byte. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - start + 0: - - - Z\ :sub:`00low` - - - Z\ :sub:`00high` - - - Z\ :sub:`01low` - - - Z\ :sub:`01high` - - - Z\ :sub:`02low` - - - Z\ :sub:`02high` - - - Z\ :sub:`03low` - - - Z\ :sub:`03high` - - - .. row 2 - - - start + 8: - - - Z\ :sub:`10low` - - - Z\ :sub:`10high` - - - Z\ :sub:`11low` - - - Z\ :sub:`11high` - - - Z\ :sub:`12low` - - - Z\ :sub:`12high` - - - Z\ :sub:`13low` - - - Z\ :sub:`13high` - - - .. row 3 - - - start + 16: - - - Z\ :sub:`20low` - - - Z\ :sub:`20high` - - - Z\ :sub:`21low` - - - Z\ :sub:`21high` - - - Z\ :sub:`22low` - - - Z\ :sub:`22high` - - - Z\ :sub:`23low` - - - Z\ :sub:`23high` - - - .. row 4 - - - start + 24: - - - Z\ :sub:`30low` - - - Z\ :sub:`30high` - - - Z\ :sub:`31low` - - - Z\ :sub:`31high` - - - Z\ :sub:`32low` - - - Z\ :sub:`32high` - - - Z\ :sub:`33low` - - - Z\ :sub:`33high` + * - start + 0: + - Z\ :sub:`00low` + - Z\ :sub:`00high` + - Z\ :sub:`01low` + - Z\ :sub:`01high` + - Z\ :sub:`02low` + - Z\ :sub:`02high` + - Z\ :sub:`03low` + - Z\ :sub:`03high` + * - start + 8: + - Z\ :sub:`10low` + - Z\ :sub:`10high` + - Z\ :sub:`11low` + - Z\ :sub:`11high` + - Z\ :sub:`12low` + - Z\ :sub:`12high` + - Z\ :sub:`13low` + - Z\ :sub:`13high` + * - start + 16: + - Z\ :sub:`20low` + - Z\ :sub:`20high` + - Z\ :sub:`21low` + - Z\ :sub:`21high` + - Z\ :sub:`22low` + - Z\ :sub:`22high` + - Z\ :sub:`23low` + - Z\ :sub:`23high` + * - start + 24: + - Z\ :sub:`30low` + - Z\ :sub:`30high` + - Z\ :sub:`31low` + - Z\ :sub:`31high` + - Z\ :sub:`32low` + - Z\ :sub:`32high` + - Z\ :sub:`33low` + - Z\ :sub:`33high` diff --git a/Documentation/media/uapi/v4l/subdev-formats.rst b/Documentation/media/uapi/v4l/subdev-formats.rst index 08d6532b0a26..e144370f62a0 100644 --- a/Documentation/media/uapi/v4l/subdev-formats.rst +++ b/Documentation/media/uapi/v4l/subdev-formats.rst @@ -14,89 +14,44 @@ Media Bus Formats :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``width`` - - - Image width, in pixels. - - - .. row 2 - - - __u32 - - - ``height`` - - - Image height, in pixels. - - - .. row 3 - - - __u32 - - - ``code`` - - - Format code, from enum - :ref:`v4l2_mbus_pixelcode `. - - - .. row 4 - - - __u32 - - - ``field`` - - - Field order, from enum :c:type:`v4l2_field`. See - :ref:`field-order` for details. - - - .. row 5 - - - __u32 - - - ``colorspace`` - - - Image colorspace, from enum - :c:type:`v4l2_colorspace`. See - :ref:`colorspaces` for details. - - - .. row 6 - - - enum :c:type:`v4l2_ycbcr_encoding` - - - ``ycbcr_enc`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. - - - .. row 7 - - - enum :c:type:`v4l2_quantization` - - - ``quantization`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. - - - .. row 8 - - - enum :c:type:`v4l2_xfer_func` - - - ``xfer_func`` - - - This information supplements the ``colorspace`` and must be set by - the driver for capture streams and by the application for output - streams, see :ref:`colorspaces`. - - - .. row 9 - - - __u16 - - - ``reserved``\ [11] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + * - __u32 + - ``width`` + - Image width, in pixels. + * - __u32 + - ``height`` + - Image height, in pixels. + * - __u32 + - ``code`` + - Format code, from enum + :ref:`v4l2_mbus_pixelcode `. + * - __u32 + - ``field`` + - Field order, from enum :c:type:`v4l2_field`. See + :ref:`field-order` for details. + * - __u32 + - ``colorspace`` + - Image colorspace, from enum + :c:type:`v4l2_colorspace`. See + :ref:`colorspaces` for details. + * - enum :c:type:`v4l2_ycbcr_encoding` + - ``ycbcr_enc`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. + * - enum :c:type:`v4l2_quantization` + - ``quantization`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. + * - enum :c:type:`v4l2_xfer_func` + - ``xfer_func`` + - This information supplements the ``colorspace`` and must be set by + the driver for capture streams and by the application for output + streams, see :ref:`colorspaces`. + * - __u16 + - ``reserved``\ [11] + - Reserved for future extensions. Applications and drivers must set + the array to zero. @@ -174,2194 +129,1135 @@ The following tables list existing packed RGB formats. :stub-columns: 0 :widths: 36 7 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 - - .. row 1 - - - Identifier - - - Code - - - - - :cspan:`31` Data organization - - - .. row 2 - - - - - - - Bit - - - 31 - - - 30 - - - 29 - - - 28 - - - 27 - - - 26 - - - 25 - - - 24 - - - 23 - - - 22 - - - 21 - - - 20 - - - 19 - - - 18 - - - 17 - - - 16 - - - 15 - - - 14 - - - 13 - - - 12 - - - 11 - - - 10 - - - 9 - - - 8 - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _MEDIA-BUS-FMT-RGB444-1X12: - - - MEDIA_BUS_FMT_RGB444_1X12 - - - 0x1016 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB444-2X8-PADHI-BE: - - - MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE - - - 0x1001 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. row 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB444-2X8-PADHI-LE: - - - MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE - - - 0x1002 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. row 7 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB555-2X8-PADHI-BE: - - - MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE - - - 0x1003 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. row 9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB555-2X8-PADHI-LE: - - - MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE - - - 0x1004 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. row 11 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. _MEDIA-BUS-FMT-RGB565-1X16: - - - MEDIA_BUS_FMT_RGB565_1X16 - - - 0x1017 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-BGR565-2X8-BE: - - - MEDIA_BUS_FMT_BGR565_2X8_BE - - - 0x1005 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. row 14 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-BGR565-2X8-LE: - - - MEDIA_BUS_FMT_BGR565_2X8_LE - - - 0x1006 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. row 16 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. _MEDIA-BUS-FMT-RGB565-2X8-BE: - - - MEDIA_BUS_FMT_RGB565_2X8_BE - - - 0x1007 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. row 18 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB565-2X8-LE: - - - MEDIA_BUS_FMT_RGB565_2X8_LE - - - 0x1008 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. row 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - .. _MEDIA-BUS-FMT-RGB666-1X18: - - - MEDIA_BUS_FMT_RGB666_1X18 - - - 0x1009 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RBG888-1X24: - - - MEDIA_BUS_FMT_RBG888_1X24 - - - 0x100e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB666-1X24_CPADHI: - - - MEDIA_BUS_FMT_RGB666_1X24_CPADHI - - - 0x1015 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - 0 - - - 0 - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - 0 - - - 0 - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-BGR888-1X24: - - - MEDIA_BUS_FMT_BGR888_1X24 - - - 0x1013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-GBR888-1X24: - - - MEDIA_BUS_FMT_GBR888_1X24 - - - 0x1014 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB888-1X24: - - - MEDIA_BUS_FMT_RGB888_1X24 - - - 0x100a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB888-2X12-BE: - - - MEDIA_BUS_FMT_RGB888_2X12_BE - - - 0x100b - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - .. row 28 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB888-2X12-LE: - - - MEDIA_BUS_FMT_RGB888_2X12_LE - - - 0x100c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. row 30 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - .. _MEDIA-BUS-FMT-ARGB888-1X32: - - - MEDIA_BUS_FMT_ARGB888_1X32 - - - 0x100d - - - - - a\ :sub:`7` - - - a\ :sub:`6` - - - a\ :sub:`5` - - - a\ :sub:`4` - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB888-1X32-PADHI: - - - MEDIA_BUS_FMT_RGB888_1X32_PADHI - - - 0x100f - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` + * - Identifier + - Code + - + - :cspan:`31` Data organization + * - + - + - Bit + - 31 + - 30 + - 29 + - 28 + - 27 + - 26 + - 25 + - 24 + - 23 + - 22 + - 21 + - 20 + - 19 + - 18 + - 17 + - 16 + - 15 + - 14 + - 13 + - 12 + - 11 + - 10 + - 9 + - 8 + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * .. _MEDIA-BUS-FMT-RGB444-1X12: + + - MEDIA_BUS_FMT_RGB444_1X12 + - 0x1016 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB444-2X8-PADHI-BE: + + - MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE + - 0x1001 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - 0 + - 0 + - 0 + - 0 + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB444-2X8-PADHI-LE: + + - MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE + - 0x1002 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - 0 + - 0 + - 0 + - 0 + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB555-2X8-PADHI-BE: + + - MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE + - 0x1003 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - 0 + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`4` + - g\ :sub:`3` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB555-2X8-PADHI-LE: + + - MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE + - 0x1004 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - 0 + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`4` + - g\ :sub:`3` + * .. _MEDIA-BUS-FMT-RGB565-1X16: + + - MEDIA_BUS_FMT_RGB565_1X16 + - 0x1017 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-BGR565-2X8-BE: + + - MEDIA_BUS_FMT_BGR565_2X8_BE + - 0x1005 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-BGR565-2X8-LE: + + - MEDIA_BUS_FMT_BGR565_2X8_LE + - 0x1006 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + * .. _MEDIA-BUS-FMT-RGB565-2X8-BE: + + - MEDIA_BUS_FMT_RGB565_2X8_BE + - 0x1007 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB565-2X8-LE: + + - MEDIA_BUS_FMT_RGB565_2X8_LE + - 0x1008 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + * .. _MEDIA-BUS-FMT-RGB666-1X18: + + - MEDIA_BUS_FMT_RGB666_1X18 + - 0x1009 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RBG888-1X24: + + - MEDIA_BUS_FMT_RBG888_1X24 + - 0x100e + - + - + - + - + - + - + - + - + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB666-1X24_CPADHI: + + - MEDIA_BUS_FMT_RGB666_1X24_CPADHI + - 0x1015 + - + - + - + - + - + - + - + - + - + - 0 + - 0 + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - 0 + - 0 + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - 0 + - 0 + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-BGR888-1X24: + + - MEDIA_BUS_FMT_BGR888_1X24 + - 0x1013 + - + - + - + - + - + - + - + - + - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-GBR888-1X24: + + - MEDIA_BUS_FMT_GBR888_1X24 + - 0x1014 + - + - + - + - + - + - + - + - + - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB888-1X24: + + - MEDIA_BUS_FMT_RGB888_1X24 + - 0x100a + - + - + - + - + - + - + - + - + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB888-2X12-BE: + + - MEDIA_BUS_FMT_RGB888_2X12_BE + - 0x100b + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB888-2X12-LE: + + - MEDIA_BUS_FMT_RGB888_2X12_LE + - 0x100c + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + * .. _MEDIA-BUS-FMT-ARGB888-1X32: + + - MEDIA_BUS_FMT_ARGB888_1X32 + - 0x100d + - + - a\ :sub:`7` + - a\ :sub:`6` + - a\ :sub:`5` + - a\ :sub:`4` + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB888-1X32-PADHI: + + - MEDIA_BUS_FMT_RGB888_1X32_PADHI + - 0x100f + - + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` .. raw:: latex @@ -2385,353 +1281,193 @@ JEIDA defined bit mapping will be named :header-rows: 2 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Code - - - - - - - :cspan:`3` Data organization - - - .. row 2 - - - - - - - Timeslot - - - Lane - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _MEDIA-BUS-FMT-RGB666-1X7X3-SPWG: - - - MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - - - 0x1010 - - - 0 - - - - - - - - d - - - b\ :sub:`1` - - - g\ :sub:`0` - - - .. row 4 - - - - - - - 1 - - - - - - - - d - - - b\ :sub:`0` - - - r\ :sub:`5` - - - .. row 5 - - - - - - - 2 - - - - - - - - d - - - g\ :sub:`5` - - - r\ :sub:`4` - - - .. row 6 - - - - - - - 3 - - - - - - - - b\ :sub:`5` - - - g\ :sub:`4` - - - r\ :sub:`3` - - - .. row 7 - - - - - - - 4 - - - - - - - - b\ :sub:`4` - - - g\ :sub:`3` - - - r\ :sub:`2` - - - .. row 8 - - - - - - - 5 - - - - - - - - b\ :sub:`3` - - - g\ :sub:`2` - - - r\ :sub:`1` - - - .. row 9 - - - - - - - 6 - - - - - - - - b\ :sub:`2` - - - g\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB888-1X7X4-SPWG: - - - MEDIA_BUS_FMT_RGB888_1X7X4_SPWG - - - 0x1011 - - - 0 - - - - - d - - - d - - - b\ :sub:`1` - - - g\ :sub:`0` - - - .. row 11 - - - - - - - 1 - - - - - b\ :sub:`7` - - - d - - - b\ :sub:`0` - - - r\ :sub:`5` - - - .. row 12 - - - - - - - 2 - - - - - b\ :sub:`6` - - - d - - - g\ :sub:`5` - - - r\ :sub:`4` - - - .. row 13 - - - - - - - 3 - - - - - g\ :sub:`7` - - - b\ :sub:`5` - - - g\ :sub:`4` - - - r\ :sub:`3` - - - .. row 14 - - - - - - - 4 - - - - - g\ :sub:`6` - - - b\ :sub:`4` - - - g\ :sub:`3` - - - r\ :sub:`2` - - - .. row 15 - - - - - - - 5 - - - - - r\ :sub:`7` - - - b\ :sub:`3` - - - g\ :sub:`2` - - - r\ :sub:`1` - - - .. row 16 - - - - - - - 6 - - - - - r\ :sub:`6` - - - b\ :sub:`2` - - - g\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-RGB888-1X7X4-JEIDA: - - - MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA - - - 0x1012 - - - 0 - - - - - d - - - d - - - b\ :sub:`3` - - - g\ :sub:`2` - - - .. row 18 - - - - - - - 1 - - - - - b\ :sub:`1` - - - d - - - b\ :sub:`2` - - - r\ :sub:`7` - - - .. row 19 - - - - - - - 2 - - - - - b\ :sub:`0` - - - d - - - g\ :sub:`7` - - - r\ :sub:`6` - - - .. row 20 - - - - - - - 3 - - - - - g\ :sub:`1` - - - b\ :sub:`7` - - - g\ :sub:`6` - - - r\ :sub:`5` - - - .. row 21 - - - - - - - 4 - - - - - g\ :sub:`0` - - - b\ :sub:`6` - - - g\ :sub:`5` - - - r\ :sub:`4` - - - .. row 22 - - - - - - - 5 - - - - - r\ :sub:`1` - - - b\ :sub:`5` - - - g\ :sub:`4` - - - r\ :sub:`3` - - - .. row 23 - - - - - - - 6 - - - - - r\ :sub:`0` - - - b\ :sub:`4` - - - g\ :sub:`3` - - - r\ :sub:`2` + * - Identifier + - Code + - + - + - :cspan:`3` Data organization + * - + - + - Timeslot + - Lane + - 3 + - 2 + - 1 + - 0 + * .. _MEDIA-BUS-FMT-RGB666-1X7X3-SPWG: + + - MEDIA_BUS_FMT_RGB666_1X7X3_SPWG + - 0x1010 + - 0 + - + - + - d + - b\ :sub:`1` + - g\ :sub:`0` + * - + - + - 1 + - + - + - d + - b\ :sub:`0` + - r\ :sub:`5` + * - + - + - 2 + - + - + - d + - g\ :sub:`5` + - r\ :sub:`4` + * - + - + - 3 + - + - + - b\ :sub:`5` + - g\ :sub:`4` + - r\ :sub:`3` + * - + - + - 4 + - + - + - b\ :sub:`4` + - g\ :sub:`3` + - r\ :sub:`2` + * - + - + - 5 + - + - + - b\ :sub:`3` + - g\ :sub:`2` + - r\ :sub:`1` + * - + - + - 6 + - + - + - b\ :sub:`2` + - g\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB888-1X7X4-SPWG: + + - MEDIA_BUS_FMT_RGB888_1X7X4_SPWG + - 0x1011 + - 0 + - + - d + - d + - b\ :sub:`1` + - g\ :sub:`0` + * - + - + - 1 + - + - b\ :sub:`7` + - d + - b\ :sub:`0` + - r\ :sub:`5` + * - + - + - 2 + - + - b\ :sub:`6` + - d + - g\ :sub:`5` + - r\ :sub:`4` + * - + - + - 3 + - + - g\ :sub:`7` + - b\ :sub:`5` + - g\ :sub:`4` + - r\ :sub:`3` + * - + - + - 4 + - + - g\ :sub:`6` + - b\ :sub:`4` + - g\ :sub:`3` + - r\ :sub:`2` + * - + - + - 5 + - + - r\ :sub:`7` + - b\ :sub:`3` + - g\ :sub:`2` + - r\ :sub:`1` + * - + - + - 6 + - + - r\ :sub:`6` + - b\ :sub:`2` + - g\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-RGB888-1X7X4-JEIDA: + + - MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA + - 0x1012 + - 0 + - + - d + - d + - b\ :sub:`3` + - g\ :sub:`2` + * - + - + - 1 + - + - b\ :sub:`1` + - d + - b\ :sub:`2` + - r\ :sub:`7` + * - + - + - 2 + - + - b\ :sub:`0` + - d + - g\ :sub:`7` + - r\ :sub:`6` + * - + - + - 3 + - + - g\ :sub:`1` + - b\ :sub:`7` + - g\ :sub:`6` + - r\ :sub:`5` + * - + - + - 4 + - + - g\ :sub:`0` + - b\ :sub:`6` + - g\ :sub:`5` + - r\ :sub:`4` + * - + - + - 5 + - + - r\ :sub:`1` + - b\ :sub:`5` + - g\ :sub:`4` + - r\ :sub:`3` + * - + - + - 6 + - + - r\ :sub:`0` + - b\ :sub:`4` + - g\ :sub:`3` + - r\ :sub:`2` .. raw:: latex @@ -2804,1449 +1540,777 @@ organization is given as an example for the first pixel only. :header-rows: 2 :stub-columns: 0 - - - .. row 1 - - - Identifier - - - Code - - - - - :cspan:`15` Data organization - - - .. row 2 - - - - - - - Bit - - - 15 - - - 14 - - - 13 - - - 12 - - - 11 - - - 10 - - - 9 - - - 8 - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _MEDIA-BUS-FMT-SBGGR8-1X8: - - - MEDIA_BUS_FMT_SBGGR8_1X8 - - - 0x3001 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGBRG8-1X8: - - - MEDIA_BUS_FMT_SGBRG8_1X8 - - - 0x3013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGRBG8-1X8: - - - MEDIA_BUS_FMT_SGRBG8_1X8 - - - 0x3002 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SRGGB8-1X8: - - - MEDIA_BUS_FMT_SRGGB8_1X8 - - - 0x3014 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SBGGR10-ALAW8-1X8: - - - MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8 - - - 0x3015 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGBRG10-ALAW8-1X8: - - - MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8 - - - 0x3016 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGRBG10-ALAW8-1X8: - - - MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8 - - - 0x3017 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SRGGB10-ALAW8-1X8: - - - MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8 - - - 0x3018 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SBGGR10-DPCM8-1X8: - - - MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 - - - 0x300b - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGBRG10-DPCM8-1X8: - - - MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 - - - 0x300c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGRBG10-DPCM8-1X8: - - - MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 - - - 0x3009 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SRGGB10-DPCM8-1X8: - - - MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 - - - 0x300d - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADHI-BE: - - - MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE - - - 0x3003 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - b\ :sub:`9` - - - b\ :sub:`8` - - - .. row 16 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADHI-LE: - - - MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE - - - 0x3004 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. row 18 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - b\ :sub:`9` - - - b\ :sub:`8` - - - .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADLO-BE: - - - MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE - - - 0x3005 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`9` - - - b\ :sub:`8` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - .. row 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`1` - - - b\ :sub:`0` - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADLO-LE: - - - MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE - - - 0x3006 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`1` - - - b\ :sub:`0` - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - .. row 22 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`9` - - - b\ :sub:`8` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - .. _MEDIA-BUS-FMT-SBGGR10-1X10: - - - MEDIA_BUS_FMT_SBGGR10_1X10 - - - 0x3007 - - - - - - - - - - - - - - - - - - - - - - - - - - - b\ :sub:`9` - - - b\ :sub:`8` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGBRG10-1X10: - - - MEDIA_BUS_FMT_SGBRG10_1X10 - - - 0x300e - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`9` - - - g\ :sub:`8` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGRBG10-1X10: - - - MEDIA_BUS_FMT_SGRBG10_1X10 - - - 0x300a - - - - - - - - - - - - - - - - - - - - - - - - - - - g\ :sub:`9` - - - g\ :sub:`8` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SRGGB10-1X10: - - - MEDIA_BUS_FMT_SRGGB10_1X10 - - - 0x300f - - - - - - - - - - - - - - - - - - - - - - - - - - - r\ :sub:`9` - - - r\ :sub:`8` - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SBGGR12-1X12: - - - MEDIA_BUS_FMT_SBGGR12_1X12 - - - 0x3008 - - - - - - - - - - - - - - - - - - - - - b\ :sub:`11` - - - b\ :sub:`10` - - - b\ :sub:`9` - - - b\ :sub:`8` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGBRG12-1X12: - - - MEDIA_BUS_FMT_SGBRG12_1X12 - - - 0x3010 - - - - - - - - - - - - - - - - - - - - - g\ :sub:`11` - - - g\ :sub:`10` - - - g\ :sub:`9` - - - g\ :sub:`8` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGRBG12-1X12: - - - MEDIA_BUS_FMT_SGRBG12_1X12 - - - 0x3011 - - - - - - - - - - - - - - - - - - - - - g\ :sub:`11` - - - g\ :sub:`10` - - - g\ :sub:`9` - - - g\ :sub:`8` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SRGGB12-1X12: - - - MEDIA_BUS_FMT_SRGGB12_1X12 - - - 0x3012 - - - - - - - - - - - - - - - - - - - - - r\ :sub:`11` - - - r\ :sub:`10` - - - r\ :sub:`9` - - - r\ :sub:`8` - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SBGGR14-1X14: - - - MEDIA_BUS_FMT_SBGGR14_1X14 - - - 0x3019 - - - - - - - - - - - - - b\ :sub:`13` - - - b\ :sub:`12` - - - b\ :sub:`11` - - - b\ :sub:`10` - - - b\ :sub:`9` - - - b\ :sub:`8` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGBRG14-1X14: - - - MEDIA_BUS_FMT_SGBRG14_1X14 - - - 0x301a - - - - - - - - - - - - - g\ :sub:`13` - - - g\ :sub:`12` - - - g\ :sub:`11` - - - g\ :sub:`10` - - - g\ :sub:`9` - - - g\ :sub:`8` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGRBG14-1X14: - - - MEDIA_BUS_FMT_SGRBG14_1X14 - - - 0x301b - - - - - - - - - - - - - g\ :sub:`13` - - - g\ :sub:`12` - - - g\ :sub:`11` - - - g\ :sub:`10` - - - g\ :sub:`9` - - - g\ :sub:`8` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SRGGB14-1X14: - - - MEDIA_BUS_FMT_SRGGB14_1X14 - - - 0x301c - - - - - - - - - - - - - r\ :sub:`13` - - - r\ :sub:`12` - - - r\ :sub:`11` - - - r\ :sub:`10` - - - r\ :sub:`9` - - - r\ :sub:`8` - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SBGGR16-1X16: - - - MEDIA_BUS_FMT_SBGGR16_1X16 - - - 0x301d - - - - - b\ :sub:`15` - - - b\ :sub:`14` - - - b\ :sub:`13` - - - b\ :sub:`12` - - - b\ :sub:`11` - - - b\ :sub:`10` - - - b\ :sub:`9` - - - b\ :sub:`8` - - - b\ :sub:`7` - - - b\ :sub:`6` - - - b\ :sub:`5` - - - b\ :sub:`4` - - - b\ :sub:`3` - - - b\ :sub:`2` - - - b\ :sub:`1` - - - b\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGBRG16-1X16: - - - MEDIA_BUS_FMT_SGBRG16_1X16 - - - 0x301e - - - - - g\ :sub:`15` - - - g\ :sub:`14` - - - g\ :sub:`13` - - - g\ :sub:`12` - - - g\ :sub:`11` - - - g\ :sub:`10` - - - g\ :sub:`9` - - - g\ :sub:`8` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SGRBG16-1X16: - - - MEDIA_BUS_FMT_SGRBG16_1X16 - - - 0x301f - - - - - g\ :sub:`15` - - - g\ :sub:`14` - - - g\ :sub:`13` - - - g\ :sub:`12` - - - g\ :sub:`11` - - - g\ :sub:`10` - - - g\ :sub:`9` - - - g\ :sub:`8` - - - g\ :sub:`7` - - - g\ :sub:`6` - - - g\ :sub:`5` - - - g\ :sub:`4` - - - g\ :sub:`3` - - - g\ :sub:`2` - - - g\ :sub:`1` - - - g\ :sub:`0` - - - .. _MEDIA-BUS-FMT-SRGGB16-1X16: - - - MEDIA_BUS_FMT_SRGGB16_1X16 - - - 0x3020 - - - - - r\ :sub:`15` - - - r\ :sub:`14` - - - r\ :sub:`13` - - - r\ :sub:`12` - - - r\ :sub:`11` - - - r\ :sub:`10` - - - r\ :sub:`9` - - - r\ :sub:`8` - - - r\ :sub:`7` - - - r\ :sub:`6` - - - r\ :sub:`5` - - - r\ :sub:`4` - - - r\ :sub:`3` - - - r\ :sub:`2` - - - r\ :sub:`1` - - - r\ :sub:`0` + * - Identifier + - Code + - + - :cspan:`15` Data organization + * - + - + - Bit + - 15 + - 14 + - 13 + - 12 + - 11 + - 10 + - 9 + - 8 + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * .. _MEDIA-BUS-FMT-SBGGR8-1X8: + + - MEDIA_BUS_FMT_SBGGR8_1X8 + - 0x3001 + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGBRG8-1X8: + + - MEDIA_BUS_FMT_SGBRG8_1X8 + - 0x3013 + - + - + - + - + - + - - + - - + - - + - - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGRBG8-1X8: + + - MEDIA_BUS_FMT_SGRBG8_1X8 + - 0x3002 + - + - + - + - + - + - - + - - + - - + - - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SRGGB8-1X8: + + - MEDIA_BUS_FMT_SRGGB8_1X8 + - 0x3014 + - + - + - + - + - + - - + - - + - - + - - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-SBGGR10-ALAW8-1X8: + + - MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8 + - 0x3015 + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGBRG10-ALAW8-1X8: + + - MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8 + - 0x3016 + - + - + - + - + - + - - + - - + - - + - - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGRBG10-ALAW8-1X8: + + - MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8 + - 0x3017 + - + - + - + - + - + - - + - - + - - + - - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SRGGB10-ALAW8-1X8: + + - MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8 + - 0x3018 + - + - + - + - + - + - - + - - + - - + - - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-SBGGR10-DPCM8-1X8: + + - MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 + - 0x300b + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGBRG10-DPCM8-1X8: + + - MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 + - 0x300c + - + - + - + - + - + - - + - - + - - + - - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGRBG10-DPCM8-1X8: + + - MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 + - 0x3009 + - + - + - + - + - + - - + - - + - - + - - + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SRGGB10-DPCM8-1X8: + + - MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 + - 0x300d + - + - + - + - + - + - - + - - + - - + - - + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADHI-BE: + + - MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE + - 0x3003 + - + - + - + - + - + - - + - - + - - + - - + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - b\ :sub:`9` + - b\ :sub:`8` + * - + - + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADHI-LE: + + - MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE + - 0x3004 + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * - + - + - + - + - + - + - + - - + - - + - - + - - + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + - b\ :sub:`9` + - b\ :sub:`8` + * .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADLO-BE: + + - MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE + - 0x3005 + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`9` + - b\ :sub:`8` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + * - + - + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`1` + - b\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + * .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADLO-LE: + + - MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE + - 0x3006 + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`1` + - b\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + * - + - + - + - + - + - + - + - - + - - + - - + - - + - b\ :sub:`9` + - b\ :sub:`8` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + * .. _MEDIA-BUS-FMT-SBGGR10-1X10: + + - MEDIA_BUS_FMT_SBGGR10_1X10 + - 0x3007 + - + - + - + - - + - - + - - + - - + - b\ :sub:`9` + - b\ :sub:`8` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGBRG10-1X10: + + - MEDIA_BUS_FMT_SGBRG10_1X10 + - 0x300e + - + - + - + - - + - - + - - + - - + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGRBG10-1X10: + + - MEDIA_BUS_FMT_SGRBG10_1X10 + - 0x300a + - + - + - + - - + - - + - - + - - + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SRGGB10-1X10: + + - MEDIA_BUS_FMT_SRGGB10_1X10 + - 0x300f + - + - + - + - - + - - + - - + - - + - r\ :sub:`9` + - r\ :sub:`8` + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-SBGGR12-1X12: + + - MEDIA_BUS_FMT_SBGGR12_1X12 + - 0x3008 + - + - - + - - + - - + - - + - b\ :sub:`11` + - b\ :sub:`10` + - b\ :sub:`9` + - b\ :sub:`8` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGBRG12-1X12: + + - MEDIA_BUS_FMT_SGBRG12_1X12 + - 0x3010 + - + - - + - - + - - + - - + - g\ :sub:`11` + - g\ :sub:`10` + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGRBG12-1X12: + + - MEDIA_BUS_FMT_SGRBG12_1X12 + - 0x3011 + - + - - + - - + - - + - - + - g\ :sub:`11` + - g\ :sub:`10` + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SRGGB12-1X12: + + - MEDIA_BUS_FMT_SRGGB12_1X12 + - 0x3012 + - + - - + - - + - - + - - + - r\ :sub:`11` + - r\ :sub:`10` + - r\ :sub:`9` + - r\ :sub:`8` + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-SBGGR14-1X14: + + - MEDIA_BUS_FMT_SBGGR14_1X14 + - 0x3019 + - + - - + - - + - b\ :sub:`13` + - b\ :sub:`12` + - b\ :sub:`11` + - b\ :sub:`10` + - b\ :sub:`9` + - b\ :sub:`8` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGBRG14-1X14: + + - MEDIA_BUS_FMT_SGBRG14_1X14 + - 0x301a + - + - - + - - + - g\ :sub:`13` + - g\ :sub:`12` + - g\ :sub:`11` + - g\ :sub:`10` + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGRBG14-1X14: + + - MEDIA_BUS_FMT_SGRBG14_1X14 + - 0x301b + - + - - + - - + - g\ :sub:`13` + - g\ :sub:`12` + - g\ :sub:`11` + - g\ :sub:`10` + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SRGGB14-1X14: + + - MEDIA_BUS_FMT_SRGGB14_1X14 + - 0x301c + - + - - + - - + - r\ :sub:`13` + - r\ :sub:`12` + - r\ :sub:`11` + - r\ :sub:`10` + - r\ :sub:`9` + - r\ :sub:`8` + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-SBGGR16-1X16: + + - MEDIA_BUS_FMT_SBGGR16_1X16 + - 0x301d + - + - b\ :sub:`15` + - b\ :sub:`14` + - b\ :sub:`13` + - b\ :sub:`12` + - b\ :sub:`11` + - b\ :sub:`10` + - b\ :sub:`9` + - b\ :sub:`8` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGBRG16-1X16: + + - MEDIA_BUS_FMT_SGBRG16_1X16 + - 0x301e + - + - g\ :sub:`15` + - g\ :sub:`14` + - g\ :sub:`13` + - g\ :sub:`12` + - g\ :sub:`11` + - g\ :sub:`10` + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SGRBG16-1X16: + + - MEDIA_BUS_FMT_SGRBG16_1X16 + - 0x301f + - + - g\ :sub:`15` + - g\ :sub:`14` + - g\ :sub:`13` + - g\ :sub:`12` + - g\ :sub:`11` + - g\ :sub:`10` + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + * .. _MEDIA-BUS-FMT-SRGGB16-1X16: + + - MEDIA_BUS_FMT_SRGGB16_1X16 + - 0x3020 + - + - r\ :sub:`15` + - r\ :sub:`14` + - r\ :sub:`13` + - r\ :sub:`12` + - r\ :sub:`11` + - r\ :sub:`10` + - r\ :sub:`9` + - r\ :sub:`8` + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` .. raw:: latex @@ -4327,7679 +2391,3934 @@ the following codes. :stub-columns: 0 :widths: 36 7 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 - - .. row 1 - - - Identifier - - - Code - - - - - :cspan:`31` Data organization - - - .. row 2 - - - - - - - Bit - - - 31 - - - 30 - - - 29 - - - 28 - - - 27 - - - 26 - - - 25 - - - 24 - - - 23 - - - 22 - - - 21 - - - 10 - - - 19 - - - 18 - - - 17 - - - 16 - - - 15 - - - 14 - - - 13 - - - 12 - - - 11 - - - 10 - - - 9 - - - 8 - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _MEDIA-BUS-FMT-Y8-1X8: - - - MEDIA_BUS_FMT_Y8_1X8 - - - 0x2001 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-UV8-1X8: - - - MEDIA_BUS_FMT_UV8_1X8 - - - 0x2015 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-UYVY8-1_5X8: - - - MEDIA_BUS_FMT_UYVY8_1_5X8 - - - 0x2002 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 7 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 11 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-VYUY8-1_5X8: - - - MEDIA_BUS_FMT_VYUY8_1_5X8 - - - 0x2003 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 13 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 14 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 15 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 16 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUYV8-1_5X8: - - - MEDIA_BUS_FMT_YUYV8_1_5X8 - - - 0x2004 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 19 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 21 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 22 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 23 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YVYU8-1_5X8: - - - MEDIA_BUS_FMT_YVYU8_1_5X8 - - - 0x2005 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 25 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 26 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 27 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 28 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 29 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. _MEDIA-BUS-FMT-UYVY8-2X8: - - - MEDIA_BUS_FMT_UYVY8_2X8 - - - 0x2006 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 31 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 33 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-VYUY8-2X8: - - - MEDIA_BUS_FMT_VYUY8_2X8 - - - 0x2007 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 35 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 36 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 37 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUYV8-2X8: - - - MEDIA_BUS_FMT_YUYV8_2X8 - - - 0x2008 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 39 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 40 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 41 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YVYU8-2X8: - - - MEDIA_BUS_FMT_YVYU8_2X8 - - - 0x2009 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 43 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 44 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 45 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. _MEDIA-BUS-FMT-Y10-1X10: - - - MEDIA_BUS_FMT_Y10_1X10 - - - 0x200a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-UYVY10-2X10: - - - MEDIA_BUS_FMT_UYVY10_2X10 - - - 0x2018 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 48 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 49 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 50 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-VYUY10-2X10: - - - MEDIA_BUS_FMT_VYUY10_2X10 - - - 0x2019 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 52 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 53 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 54 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUYV10-2X10: - - - MEDIA_BUS_FMT_YUYV10_2X10 - - - 0x200b - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 56 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 57 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 58 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YVYU10-2X10: - - - MEDIA_BUS_FMT_YVYU10_2X10 - - - 0x200c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 60 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 61 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 62 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. _MEDIA-BUS-FMT-Y12-1X12: - - - MEDIA_BUS_FMT_Y12_1X12 - - - 0x2013 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-UYVY12-2X12: - - - MEDIA_BUS_FMT_UYVY12_2X12 - - - 0x201c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`11` - - - u\ :sub:`10` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 65 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 66 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`11` - - - v\ :sub:`10` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 67 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-VYUY12-2X12: - - - MEDIA_BUS_FMT_VYUY12_2X12 - - - 0x201d - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`11` - - - v\ :sub:`10` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 69 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 70 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`11` - - - u\ :sub:`10` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 71 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUYV12-2X12: - - - MEDIA_BUS_FMT_YUYV12_2X12 - - - 0x201e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 73 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`11` - - - u\ :sub:`10` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 74 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 75 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`11` - - - v\ :sub:`10` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YVYU12-2X12: - - - MEDIA_BUS_FMT_YVYU12_2X12 - - - 0x201f - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 77 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`11` - - - v\ :sub:`10` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 78 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 79 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`11` - - - u\ :sub:`10` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. _MEDIA-BUS-FMT-UYVY8-1X16: - - - MEDIA_BUS_FMT_UYVY8_1X16 - - - 0x200f - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 81 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-VYUY8-1X16: - - - MEDIA_BUS_FMT_VYUY8_1X16 - - - 0x2010 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 83 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUYV8-1X16: - - - MEDIA_BUS_FMT_YUYV8_1X16 - - - 0x2011 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 85 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YVYU8-1X16: - - - MEDIA_BUS_FMT_YVYU8_1X16 - - - 0x2012 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 87 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YDYUYDYV8-1X16: - - - MEDIA_BUS_FMT_YDYUYDYV8_1X16 - - - 0x2014 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - d - - - d - - - d - - - d - - - d - - - d - - - d - - - d - - - .. row 89 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 90 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - d - - - d - - - d - - - d - - - d - - - d - - - d - - - d - - - .. row 91 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-UYVY10-1X20: - - - MEDIA_BUS_FMT_UYVY10_1X20 - - - 0x201a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 93 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-VYUY10-1X20: - - - MEDIA_BUS_FMT_VYUY10_1X20 - - - 0x201b - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 95 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUYV10-1X20: - - - MEDIA_BUS_FMT_YUYV10_1X20 - - - 0x200d - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 97 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YVYU10-1X20: - - - MEDIA_BUS_FMT_YVYU10_1X20 - - - 0x200e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 99 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. _MEDIA-BUS-FMT-VUY8-1X24: - - - MEDIA_BUS_FMT_VUY8_1X24 - - - 0x201a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUV8-1X24: - - - MEDIA_BUS_FMT_YUV8_1X24 - - - 0x2025 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-UYVY12-1X24: - - - MEDIA_BUS_FMT_UYVY12_1X24 - - - 0x2020 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`11` - - - u\ :sub:`10` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 103 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`11` - - - v\ :sub:`10` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-VYUY12-1X24: - - - MEDIA_BUS_FMT_VYUY12_1X24 - - - 0x2021 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - v\ :sub:`11` - - - v\ :sub:`10` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. row 105 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u\ :sub:`11` - - - u\ :sub:`10` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUYV12-1X24: - - - MEDIA_BUS_FMT_YUYV12_1X24 - - - 0x2022 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`11` - - - u\ :sub:`10` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. row 107 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - v\ :sub:`11` - - - v\ :sub:`10` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YVYU12-1X24: - - - MEDIA_BUS_FMT_YVYU12_1X24 - - - 0x2023 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - v\ :sub:`11` - - - v\ :sub:`10` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. row 109 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - y\ :sub:`11` - - - y\ :sub:`10` - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`11` - - - u\ :sub:`10` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - .. _MEDIA-BUS-FMT-YUV10-1X30: - - - MEDIA_BUS_FMT_YUV10_1X30 - - - 0x2016 - - - - - - - - - - - y\ :sub:`9` - - - y\ :sub:`8` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`9` - - - u\ :sub:`8` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - v\ :sub:`9` - - - v\ :sub:`8` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` - - - .. _MEDIA-BUS-FMT-AYUV8-1X32: - - - MEDIA_BUS_FMT_AYUV8_1X32 - - - 0x2017 - - - - - a\ :sub:`7` - - - a\ :sub:`6` - - - a\ :sub:`5` - - - a\ :sub:`4` - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - y\ :sub:`7` - - - y\ :sub:`6` - - - y\ :sub:`5` - - - y\ :sub:`4` - - - y\ :sub:`3` - - - y\ :sub:`2` - - - y\ :sub:`1` - - - y\ :sub:`0` - - - u\ :sub:`7` - - - u\ :sub:`6` - - - u\ :sub:`5` - - - u\ :sub:`4` - - - u\ :sub:`3` - - - u\ :sub:`2` - - - u\ :sub:`1` - - - u\ :sub:`0` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` + * - Identifier + - Code + - + - :cspan:`31` Data organization + * - + - + - Bit + - 31 + - 30 + - 29 + - 28 + - 27 + - 26 + - 25 + - 24 + - 23 + - 22 + - 21 + - 10 + - 19 + - 18 + - 17 + - 16 + - 15 + - 14 + - 13 + - 12 + - 11 + - 10 + - 9 + - 8 + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * .. _MEDIA-BUS-FMT-Y8-1X8: + + - MEDIA_BUS_FMT_Y8_1X8 + - 0x2001 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-UV8-1X8: + + - MEDIA_BUS_FMT_UV8_1X8 + - 0x2015 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-UYVY8-1_5X8: + + - MEDIA_BUS_FMT_UYVY8_1_5X8 + - 0x2002 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-VYUY8-1_5X8: + + - MEDIA_BUS_FMT_VYUY8_1_5X8 + - 0x2003 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUYV8-1_5X8: + + - MEDIA_BUS_FMT_YUYV8_1_5X8 + - 0x2004 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-YVYU8-1_5X8: + + - MEDIA_BUS_FMT_YVYU8_1_5X8 + - 0x2005 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * .. _MEDIA-BUS-FMT-UYVY8-2X8: + + - MEDIA_BUS_FMT_UYVY8_2X8 + - 0x2006 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-VYUY8-2X8: + + - MEDIA_BUS_FMT_VYUY8_2X8 + - 0x2007 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUYV8-2X8: + + - MEDIA_BUS_FMT_YUYV8_2X8 + - 0x2008 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-YVYU8-2X8: + + - MEDIA_BUS_FMT_YVYU8_2X8 + - 0x2009 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * .. _MEDIA-BUS-FMT-Y10-1X10: + + - MEDIA_BUS_FMT_Y10_1X10 + - 0x200a + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-UYVY10-2X10: + + - MEDIA_BUS_FMT_UYVY10_2X10 + - 0x2018 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-VYUY10-2X10: + + - MEDIA_BUS_FMT_VYUY10_2X10 + - 0x2019 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUYV10-2X10: + + - MEDIA_BUS_FMT_YUYV10_2X10 + - 0x200b + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-YVYU10-2X10: + + - MEDIA_BUS_FMT_YVYU10_2X10 + - 0x200c + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * .. _MEDIA-BUS-FMT-Y12-1X12: + + - MEDIA_BUS_FMT_Y12_1X12 + - 0x2013 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-UYVY12-2X12: + + - MEDIA_BUS_FMT_UYVY12_2X12 + - 0x201c + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`11` + - u\ :sub:`10` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`11` + - v\ :sub:`10` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-VYUY12-2X12: + + - MEDIA_BUS_FMT_VYUY12_2X12 + - 0x201d + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`11` + - v\ :sub:`10` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`11` + - u\ :sub:`10` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUYV12-2X12: + + - MEDIA_BUS_FMT_YUYV12_2X12 + - 0x201e + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`11` + - u\ :sub:`10` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`11` + - v\ :sub:`10` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-YVYU12-2X12: + + - MEDIA_BUS_FMT_YVYU12_2X12 + - 0x201f + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`11` + - v\ :sub:`10` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`11` + - u\ :sub:`10` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * .. _MEDIA-BUS-FMT-UYVY8-1X16: + + - MEDIA_BUS_FMT_UYVY8_1X16 + - 0x200f + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-VYUY8-1X16: + + - MEDIA_BUS_FMT_VYUY8_1X16 + - 0x2010 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUYV8-1X16: + + - MEDIA_BUS_FMT_YUYV8_1X16 + - 0x2011 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-YVYU8-1X16: + + - MEDIA_BUS_FMT_YVYU8_1X16 + - 0x2012 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * .. _MEDIA-BUS-FMT-YDYUYDYV8-1X16: + + - MEDIA_BUS_FMT_YDYUYDYV8_1X16 + - 0x2014 + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - d + - d + - d + - d + - d + - d + - d + - d + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - d + - d + - d + - d + - d + - d + - d + - d + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-UYVY10-1X20: + + - MEDIA_BUS_FMT_UYVY10_1X20 + - 0x201a + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-VYUY10-1X20: + + - MEDIA_BUS_FMT_VYUY10_1X20 + - 0x201b + - + - + - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUYV10-1X20: + + - MEDIA_BUS_FMT_YUYV10_1X20 + - 0x200d + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-YVYU10-1X20: + + - MEDIA_BUS_FMT_YVYU10_1X20 + - 0x200e + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * .. _MEDIA-BUS-FMT-VUY8-1X24: + + - MEDIA_BUS_FMT_VUY8_1X24 + - 0x201a + - + - + - + - + - + - + - + - + - + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUV8-1X24: + + - MEDIA_BUS_FMT_YUV8_1X24 + - 0x2025 + - + - + - + - + - + - + - + - + - + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-UYVY12-1X24: + + - MEDIA_BUS_FMT_UYVY12_1X24 + - 0x2020 + - + - + - + - + - + - + - + - + - + - u\ :sub:`11` + - u\ :sub:`10` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - v\ :sub:`11` + - v\ :sub:`10` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-VYUY12-1X24: + + - MEDIA_BUS_FMT_VYUY12_1X24 + - 0x2021 + - + - + - + - + - + - + - + - + - + - v\ :sub:`11` + - v\ :sub:`10` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - u\ :sub:`11` + - u\ :sub:`10` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUYV12-1X24: + + - MEDIA_BUS_FMT_YUYV12_1X24 + - 0x2022 + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`11` + - u\ :sub:`10` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - v\ :sub:`11` + - v\ :sub:`10` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-YVYU12-1X24: + + - MEDIA_BUS_FMT_YVYU12_1X24 + - 0x2023 + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - v\ :sub:`11` + - v\ :sub:`10` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * - + - + - + - + - + - + - + - + - + - + - + - y\ :sub:`11` + - y\ :sub:`10` + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`11` + - u\ :sub:`10` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + * .. _MEDIA-BUS-FMT-YUV10-1X30: + + - MEDIA_BUS_FMT_YUV10_1X30 + - 0x2016 + - + - + - + - y\ :sub:`9` + - y\ :sub:`8` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`9` + - u\ :sub:`8` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - v\ :sub:`9` + - v\ :sub:`8` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` + * .. _MEDIA-BUS-FMT-AYUV8-1X32: + + - MEDIA_BUS_FMT_AYUV8_1X32 + - 0x2017 + - + - a\ :sub:`7` + - a\ :sub:`6` + - a\ :sub:`5` + - a\ :sub:`4` + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - y\ :sub:`7` + - y\ :sub:`6` + - y\ :sub:`5` + - y\ :sub:`4` + - y\ :sub:`3` + - y\ :sub:`2` + - y\ :sub:`1` + - y\ :sub:`0` + - u\ :sub:`7` + - u\ :sub:`6` + - u\ :sub:`5` + - u\ :sub:`4` + - u\ :sub:`3` + - u\ :sub:`2` + - u\ :sub:`1` + - u\ :sub:`0` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` .. raw:: latex @@ -12052,155 +6371,82 @@ The following table lists existing HSV/HSL formats. :stub-columns: 0 :widths: 28 7 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 - - .. row 1 - - - Identifier - - - Code - - - - - :cspan:`31` Data organization - - - .. row 2 - - - - - - - Bit - - - 31 - - - 30 - - - 29 - - - 28 - - - 27 - - - 26 - - - 25 - - - 24 - - - 23 - - - 22 - - - 21 - - - 20 - - - 19 - - - 18 - - - 17 - - - 16 - - - 15 - - - 14 - - - 13 - - - 12 - - - 11 - - - 10 - - - 9 - - - 8 - - - 7 - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - - - .. _MEDIA-BUS-FMT-AHSV8888-1X32: - - - MEDIA_BUS_FMT_AHSV8888_1X32 - - - 0x6001 - - - - - a\ :sub:`7` - - - a\ :sub:`6` - - - a\ :sub:`5` - - - a\ :sub:`4` - - - a\ :sub:`3` - - - a\ :sub:`2` - - - a\ :sub:`1` - - - a\ :sub:`0` - - - h\ :sub:`7` - - - h\ :sub:`6` - - - h\ :sub:`5` - - - h\ :sub:`4` - - - h\ :sub:`3` - - - h\ :sub:`2` - - - h\ :sub:`1` - - - h\ :sub:`0` - - - s\ :sub:`7` - - - s\ :sub:`6` - - - s\ :sub:`5` - - - s\ :sub:`4` - - - s\ :sub:`3` - - - s\ :sub:`2` - - - s\ :sub:`1` - - - s\ :sub:`0` - - - v\ :sub:`7` - - - v\ :sub:`6` - - - v\ :sub:`5` - - - v\ :sub:`4` - - - v\ :sub:`3` - - - v\ :sub:`2` - - - v\ :sub:`1` - - - v\ :sub:`0` + * - Identifier + - Code + - + - :cspan:`31` Data organization + * - + - + - Bit + - 31 + - 30 + - 29 + - 28 + - 27 + - 26 + - 25 + - 24 + - 23 + - 22 + - 21 + - 20 + - 19 + - 18 + - 17 + - 16 + - 15 + - 14 + - 13 + - 12 + - 11 + - 10 + - 9 + - 8 + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * .. _MEDIA-BUS-FMT-AHSV8888-1X32: + + - MEDIA_BUS_FMT_AHSV8888_1X32 + - 0x6001 + - + - a\ :sub:`7` + - a\ :sub:`6` + - a\ :sub:`5` + - a\ :sub:`4` + - a\ :sub:`3` + - a\ :sub:`2` + - a\ :sub:`1` + - a\ :sub:`0` + - h\ :sub:`7` + - h\ :sub:`6` + - h\ :sub:`5` + - h\ :sub:`4` + - h\ :sub:`3` + - h\ :sub:`2` + - h\ :sub:`1` + - h\ :sub:`0` + - s\ :sub:`7` + - s\ :sub:`6` + - s\ :sub:`5` + - s\ :sub:`4` + - s\ :sub:`3` + - s\ :sub:`2` + - s\ :sub:`1` + - s\ :sub:`0` + - v\ :sub:`7` + - v\ :sub:`6` + - v\ :sub:`5` + - v\ :sub:`4` + - v\ :sub:`3` + - v\ :sub:`2` + - v\ :sub:`1` + - v\ :sub:`0` .. raw:: latex @@ -12232,24 +6478,16 @@ The following table lists existing JPEG compressed formats. :header-rows: 1 :stub-columns: 0 + * - Identifier + - Code + - Remarks + * .. _MEDIA-BUS-FMT-JPEG-1X8: - - .. row 1 - - - Identifier - - - Code - - - Remarks - - - .. _MEDIA-BUS-FMT-JPEG-1X8: - - - MEDIA_BUS_FMT_JPEG_1X8 - - - 0x4001 - - - Besides of its usage for the parallel bus this format is - recommended for transmission of JPEG data over MIPI CSI bus using - the User Defined 8-bit Data types. + - MEDIA_BUS_FMT_JPEG_1X8 + - 0x4001 + - Besides of its usage for the parallel bus this format is + recommended for transmission of JPEG data over MIPI CSI bus using + the User Defined 8-bit Data types. @@ -12273,20 +6511,12 @@ formats. :header-rows: 1 :stub-columns: 0 + * - Identifier + - Code + - Comments + * .. _MEDIA-BUS-FMT-S5C-UYVY-JPEG-1X8: - - .. row 1 - - - Identifier - - - Code - - - Comments - - - .. _MEDIA-BUS-FMT-S5C-UYVY-JPEG-1X8: - - - MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 - - - 0x5001 - - - Interleaved raw UYVY and JPEG image format with embedded meta-data - used by Samsung S3C73MX camera sensors. + - MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 + - 0x5001 + - Interleaved raw UYVY and JPEG image format with embedded meta-data + used by Samsung S3C73MX camera sensors. diff --git a/Documentation/media/uapi/v4l/v4l2-selection-flags.rst b/Documentation/media/uapi/v4l/v4l2-selection-flags.rst index 9ef139f8e21d..1f9a03851d0f 100644 --- a/Documentation/media/uapi/v4l/v4l2-selection-flags.rst +++ b/Documentation/media/uapi/v4l/v4l2-selection-flags.rst @@ -14,59 +14,31 @@ Selection flags :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Flag name - - - id - - - Definition - - - Valid for V4L2 - - - Valid for V4L2 subdev - - - .. row 2 - - - ``V4L2_SEL_FLAG_GE`` - - - (1 << 0) - - - Suggest the driver it should choose greater or equal rectangle (in - size) than was requested. Albeit the driver may choose a lesser - size, it will only do so due to hardware limitations. Without this - flag (and ``V4L2_SEL_FLAG_LE``) the behaviour is to choose the - closest possible rectangle. - - - Yes - - - Yes - - - .. row 3 - - - ``V4L2_SEL_FLAG_LE`` - - - (1 << 1) - - - Suggest the driver it should choose lesser or equal rectangle (in - size) than was requested. Albeit the driver may choose a greater - size, it will only do so due to hardware limitations. - - - Yes - - - Yes - - - .. row 4 - - - ``V4L2_SEL_FLAG_KEEP_CONFIG`` - - - (1 << 2) - - - The configuration must not be propagated to any further processing - steps. If this flag is not given, the configuration is propagated - inside the subdevice to all further processing steps. - - - No - - - Yes + * - Flag name + - id + - Definition + - Valid for V4L2 + - Valid for V4L2 subdev + * - ``V4L2_SEL_FLAG_GE`` + - (1 << 0) + - Suggest the driver it should choose greater or equal rectangle (in + size) than was requested. Albeit the driver may choose a lesser + size, it will only do so due to hardware limitations. Without this + flag (and ``V4L2_SEL_FLAG_LE``) the behaviour is to choose the + closest possible rectangle. + - Yes + - Yes + * - ``V4L2_SEL_FLAG_LE`` + - (1 << 1) + - Suggest the driver it should choose lesser or equal rectangle (in + size) than was requested. Albeit the driver may choose a greater + size, it will only do so due to hardware limitations. + - Yes + - Yes + * - ``V4L2_SEL_FLAG_KEEP_CONFIG`` + - (1 << 2) + - The configuration must not be propagated to any further processing + steps. If this flag is not given, the configuration is propagated + inside the subdevice to all further processing steps. + - No + - Yes diff --git a/Documentation/media/uapi/v4l/v4l2-selection-targets.rst b/Documentation/media/uapi/v4l/v4l2-selection-targets.rst index a82b58f5ebcf..cab07de6f4da 100644 --- a/Documentation/media/uapi/v4l/v4l2-selection-targets.rst +++ b/Documentation/media/uapi/v4l/v4l2-selection-targets.rst @@ -18,120 +18,57 @@ of the two interfaces they are used. :header-rows: 1 :stub-columns: 0 - - - .. row 1 - - - Target name - - - id - - - Definition - - - Valid for V4L2 - - - Valid for V4L2 subdev - - - .. row 2 - - - ``V4L2_SEL_TGT_CROP`` - - - 0x0000 - - - Crop rectangle. Defines the cropped area. - - - Yes - - - Yes - - - .. row 3 - - - ``V4L2_SEL_TGT_CROP_DEFAULT`` - - - 0x0001 - - - Suggested cropping rectangle that covers the "whole picture". - - - Yes - - - No - - - .. row 4 - - - ``V4L2_SEL_TGT_CROP_BOUNDS`` - - - 0x0002 - - - Bounds of the crop rectangle. All valid crop rectangles fit inside - the crop bounds rectangle. - - - Yes - - - Yes - - - .. row 5 - - - ``V4L2_SEL_TGT_NATIVE_SIZE`` - - - 0x0003 - - - The native size of the device, e.g. a sensor's pixel array. - ``left`` and ``top`` fields are zero for this target. Setting the - native size will generally only make sense for memory to memory - devices where the software can create a canvas of a given size in - which for example a video frame can be composed. In that case - V4L2_SEL_TGT_NATIVE_SIZE can be used to configure the size of - that canvas. - - - Yes - - - Yes - - - .. row 6 - - - ``V4L2_SEL_TGT_COMPOSE`` - - - 0x0100 - - - Compose rectangle. Used to configure scaling and composition. - - - Yes - - - Yes - - - .. row 7 - - - ``V4L2_SEL_TGT_COMPOSE_DEFAULT`` - - - 0x0101 - - - Suggested composition rectangle that covers the "whole picture". - - - Yes - - - No - - - .. row 8 - - - ``V4L2_SEL_TGT_COMPOSE_BOUNDS`` - - - 0x0102 - - - Bounds of the compose rectangle. All valid compose rectangles fit - inside the compose bounds rectangle. - - - Yes - - - Yes - - - .. row 9 - - - ``V4L2_SEL_TGT_COMPOSE_PADDED`` - - - 0x0103 - - - The active area and all padding pixels that are inserted or - modified by hardware. - - - Yes - - - No + * - Target name + - id + - Definition + - Valid for V4L2 + - Valid for V4L2 subdev + * - ``V4L2_SEL_TGT_CROP`` + - 0x0000 + - Crop rectangle. Defines the cropped area. + - Yes + - Yes + * - ``V4L2_SEL_TGT_CROP_DEFAULT`` + - 0x0001 + - Suggested cropping rectangle that covers the "whole picture". + - Yes + - No + * - ``V4L2_SEL_TGT_CROP_BOUNDS`` + - 0x0002 + - Bounds of the crop rectangle. All valid crop rectangles fit inside + the crop bounds rectangle. + - Yes + - Yes + * - ``V4L2_SEL_TGT_NATIVE_SIZE`` + - 0x0003 + - The native size of the device, e.g. a sensor's pixel array. + ``left`` and ``top`` fields are zero for this target. Setting the + native size will generally only make sense for memory to memory + devices where the software can create a canvas of a given size in + which for example a video frame can be composed. In that case + V4L2_SEL_TGT_NATIVE_SIZE can be used to configure the size of + that canvas. + - Yes + - Yes + * - ``V4L2_SEL_TGT_COMPOSE`` + - 0x0100 + - Compose rectangle. Used to configure scaling and composition. + - Yes + - Yes + * - ``V4L2_SEL_TGT_COMPOSE_DEFAULT`` + - 0x0101 + - Suggested composition rectangle that covers the "whole picture". + - Yes + - No + * - ``V4L2_SEL_TGT_COMPOSE_BOUNDS`` + - 0x0102 + - Bounds of the compose rectangle. All valid compose rectangles fit + inside the compose bounds rectangle. + - Yes + - Yes + * - ``V4L2_SEL_TGT_COMPOSE_PADDED`` + - 0x0103 + - The active area and all padding pixels that are inserted or + modified by hardware. + - Yes + - No diff --git a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst index 810634e47d54..aaca12fca06e 100644 --- a/Documentation/media/uapi/v4l/vidioc-create-bufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-create-bufs.rst @@ -80,55 +80,30 @@ than the number requested. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``index`` - - - The starting buffer index, returned by the driver. - - - .. row 2 - - - __u32 - - - ``count`` - - - The number of buffers requested or granted. If count == 0, then - :ref:`VIDIOC_CREATE_BUFS` will set ``index`` to the current number of - created buffers, and it will check the validity of ``memory`` and - ``format.type``. If those are invalid -1 is returned and errno is - set to ``EINVAL`` error code, otherwise :ref:`VIDIOC_CREATE_BUFS` returns - 0. It will never set errno to ``EBUSY`` error code in this particular - case. - - - .. row 3 - - - __u32 - - - ``memory`` - - - Applications set this field to ``V4L2_MEMORY_MMAP``, - ``V4L2_MEMORY_DMABUF`` or ``V4L2_MEMORY_USERPTR``. See - :c:type:`v4l2_memory` - - - .. row 4 - - - struct :c:type:`v4l2_format` - - - ``format`` - - - Filled in by the application, preserved by the driver. - - - .. row 5 - - - __u32 - - - ``reserved``\ [8] - - - A place holder for future extensions. Drivers and applications - must set the array to zero. + * - __u32 + - ``index`` + - The starting buffer index, returned by the driver. + * - __u32 + - ``count`` + - The number of buffers requested or granted. If count == 0, then + :ref:`VIDIOC_CREATE_BUFS` will set ``index`` to the current number of + created buffers, and it will check the validity of ``memory`` and + ``format.type``. If those are invalid -1 is returned and errno is + set to ``EINVAL`` error code, otherwise :ref:`VIDIOC_CREATE_BUFS` returns + 0. It will never set errno to ``EBUSY`` error code in this particular + case. + * - __u32 + - ``memory`` + - Applications set this field to ``V4L2_MEMORY_MMAP``, + ``V4L2_MEMORY_DMABUF`` or ``V4L2_MEMORY_USERPTR``. See + :c:type:`v4l2_memory` + * - struct :c:type:`v4l2_format` + - ``format`` + - Filled in by the application, preserved by the driver. + * - __u32 + - ``reserved``\ [8] + - A place holder for future extensions. Drivers and applications + must set the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-cropcap.rst b/Documentation/media/uapi/v4l/vidioc-cropcap.rst index f7d448cad4eb..f21a69b554e1 100644 --- a/Documentation/media/uapi/v4l/vidioc-cropcap.rst +++ b/Documentation/media/uapi/v4l/vidioc-cropcap.rst @@ -59,56 +59,36 @@ overlay devices. :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``type`` + - Type of the data stream, set by the application. Only these types + are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, + ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` and + ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. + * - struct :ref:`v4l2_rect ` + - ``bounds`` + - Defines the window within capturing or output is possible, this + may exclude for example the horizontal and vertical blanking + areas. The cropping rectangle cannot exceed these limits. Width + and height are defined in pixels, the driver writer is free to + choose origin and units of the coordinate system in the analog + domain. + * - struct :ref:`v4l2_rect ` + - ``defrect`` + - Default cropping rectangle, it shall cover the "whole picture". + Assuming pixel aspect 1/1 this could be for example a 640 × 480 + rectangle for NTSC, a 768 × 576 rectangle for PAL and SECAM + centered over the active picture area. The same co-ordinate system + as for ``bounds`` is used. + * - struct :c:type:`v4l2_fract` + - ``pixelaspect`` + - This is the pixel aspect (y / x) when no scaling is applied, the + ratio of the actual sampling frequency and the frequency required + to get square pixels. - - .. row 1 - - - __u32 - - - ``type`` - - - Type of the data stream, set by the application. Only these types - are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, - ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` and - ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. - - - .. row 2 - - - struct :ref:`v4l2_rect ` - - - ``bounds`` - - - Defines the window within capturing or output is possible, this - may exclude for example the horizontal and vertical blanking - areas. The cropping rectangle cannot exceed these limits. Width - and height are defined in pixels, the driver writer is free to - choose origin and units of the coordinate system in the analog - domain. - - - .. row 3 - - - struct :ref:`v4l2_rect ` - - - ``defrect`` - - - Default cropping rectangle, it shall cover the "whole picture". - Assuming pixel aspect 1/1 this could be for example a 640 × 480 - rectangle for NTSC, a 768 × 576 rectangle for PAL and SECAM - centered over the active picture area. The same co-ordinate system - as for ``bounds`` is used. - - - .. row 4 - - - struct :c:type:`v4l2_fract` - - - ``pixelaspect`` - - - This is the pixel aspect (y / x) when no scaling is applied, the - ratio of the actual sampling frequency and the frequency required - to get square pixels. - - When cropping coordinates refer to square pixels, the driver sets - ``pixelaspect`` to 1/1. Other common values are 54/59 for PAL and - SECAM, 11/10 for NTSC sampled according to [:ref:`itu601`]. + When cropping coordinates refer to square pixels, the driver sets + ``pixelaspect`` to 1/1. Other common values are 54/59 for PAL and + SECAM, 11/10 for NTSC sampled according to [:ref:`itu601`]. @@ -121,40 +101,20 @@ overlay devices. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __s32 - - - ``left`` - - - Horizontal offset of the top, left corner of the rectangle, in - pixels. - - - .. row 2 - - - __s32 - - - ``top`` - - - Vertical offset of the top, left corner of the rectangle, in - pixels. - - - .. row 3 - - - __u32 - - - ``width`` - - - Width of the rectangle, in pixels. - - - .. row 4 - - - __u32 - - - ``height`` - - - Height of the rectangle, in pixels. + * - __s32 + - ``left`` + - Horizontal offset of the top, left corner of the rectangle, in + pixels. + * - __s32 + - ``top`` + - Vertical offset of the top, left corner of the rectangle, in + pixels. + * - __u32 + - ``width`` + - Width of the rectangle, in pixels. + * - __u32 + - ``height`` + - Height of the rectangle, in pixels. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst index f9d76f3d519d..e1e5507e79ff 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst @@ -85,40 +85,21 @@ instructions. :stub-columns: 0 :widths: 1 1 1 2 - - - .. row 1 - - - __u32 - - - ``type`` - - - See :ref:`name-chip-match-types` for a list of possible types. - - - .. row 2 - - - union - - - (anonymous) - - - .. row 3 - - - - - __u32 - - - ``addr`` - - - Match a chip by this number, interpreted according to the ``type`` - field. - - - .. row 4 - - - - - char - - - ``name[32]`` - - - Match a chip by this name, interpreted according to the ``type`` - field. Currently unused. + * - __u32 + - ``type`` + - See :ref:`name-chip-match-types` for a list of possible types. + * - union + - (anonymous) + * - + - __u32 + - ``addr`` + - Match a chip by this number, interpreted according to the ``type`` + field. + * - + - char + - ``name[32]`` + - Match a chip by this name, interpreted according to the ``type`` + field. Currently unused. @@ -131,41 +112,21 @@ instructions. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - struct v4l2_dbg_match - - - ``match`` - - - How to match the chip, see :ref:`name-v4l2-dbg-match`. - - - .. row 2 - - - char - - - ``name[32]`` - - - The name of the chip. - - - .. row 3 - - - __u32 - - - ``flags`` - - - Set by the driver. If ``V4L2_CHIP_FL_READABLE`` is set, then the - driver supports reading registers from the device. If - ``V4L2_CHIP_FL_WRITABLE`` is set, then it supports writing - registers. - - - .. row 4 - - - __u32 - - - ``reserved[8]`` - - - Reserved fields, both application and driver must set these to 0. + * - struct v4l2_dbg_match + - ``match`` + - How to match the chip, see :ref:`name-v4l2-dbg-match`. + * - char + - ``name[32]`` + - The name of the chip. + * - __u32 + - ``flags`` + - Set by the driver. If ``V4L2_CHIP_FL_READABLE`` is set, then the + driver supports reading registers from the device. If + ``V4L2_CHIP_FL_WRITABLE`` is set, then it supports writing + registers. + * - __u32 + - ``reserved[8]`` + - Reserved fields, both application and driver must set these to 0. @@ -178,23 +139,13 @@ instructions. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_CHIP_MATCH_BRIDGE`` - - - 0 - - - Match the nth chip on the card, zero for the bridge chip. Does not - match sub-devices. - - - .. row 2 - - - ``V4L2_CHIP_MATCH_SUBDEV`` - - - 4 - - - Match the nth sub-device. + * - ``V4L2_CHIP_MATCH_BRIDGE`` + - 0 + - Match the nth chip on the card, zero for the bridge chip. Does not + match sub-devices. + * - ``V4L2_CHIP_MATCH_SUBDEV`` + - 4 + - Match the nth sub-device. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst index b875ee2aece7..5960a6547f41 100644 --- a/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst +++ b/Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst @@ -94,40 +94,21 @@ instructions. :stub-columns: 0 :widths: 1 1 1 2 - - - .. row 1 - - - __u32 - - - ``type`` - - - See :ref:`chip-match-types` for a list of possible types. - - - .. row 2 - - - union - - - (anonymous) - - - .. row 3 - - - - - __u32 - - - ``addr`` - - - Match a chip by this number, interpreted according to the ``type`` - field. - - - .. row 4 - - - - - char - - - ``name[32]`` - - - Match a chip by this name, interpreted according to the ``type`` - field. Currently unused. + * - __u32 + - ``type`` + - See :ref:`chip-match-types` for a list of possible types. + * - union + - (anonymous) + * - + - __u32 + - ``addr`` + - Match a chip by this number, interpreted according to the ``type`` + field. + * - + - char + - ``name[32]`` + - Match a chip by this name, interpreted according to the ``type`` + field. Currently unused. @@ -137,38 +118,18 @@ instructions. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - struct v4l2_dbg_match - - - ``match`` - - - How to match the chip, see :c:type:`v4l2_dbg_match`. - - - .. row 2 - - - __u32 - - - ``size`` - - - The register size in bytes. - - - .. row 3 - - - __u64 - - - ``reg`` - - - A register number. - - - .. row 4 - - - __u64 - - - ``val`` - - - The value read from, or to be written into the register. + * - struct v4l2_dbg_match + - ``match`` + - How to match the chip, see :c:type:`v4l2_dbg_match`. + * - __u32 + - ``size`` + - The register size in bytes. + * - __u64 + - ``reg`` + - A register number. + * - __u64 + - ``val`` + - The value read from, or to be written into the register. @@ -181,23 +142,13 @@ instructions. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_CHIP_MATCH_BRIDGE`` - - - 0 - - - Match the nth chip on the card, zero for the bridge chip. Does not - match sub-devices. - - - .. row 2 - - - ``V4L2_CHIP_MATCH_SUBDEV`` - - - 4 - - - Match the nth sub-device. + * - ``V4L2_CHIP_MATCH_BRIDGE`` + - 0 + - Match the nth chip on the card, zero for the bridge chip. Does not + match sub-devices. + * - ``V4L2_CHIP_MATCH_SUBDEV`` + - 4 + - Match the nth sub-device. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst index cade4603e138..85c916b0ce07 100644 --- a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst @@ -70,125 +70,75 @@ introduced in Linux 3.3. :stub-columns: 0 :widths: 11 24 12 16 106 - - - .. row 1 - - - __u32 - - - ``cmd`` - - - - - - - The decoder command, see :ref:`decoder-cmds`. - - - .. row 2 - - - __u32 - - - ``flags`` - - - - - - - Flags to go with the command. If no flags are defined for this - command, drivers and applications must set this field to zero. - - - .. row 3 - - - union - - - (anonymous) - - - - - - - - - - .. row 4 - - - - - struct - - - ``start`` - - - - - Structure containing additional data for the - ``V4L2_DEC_CMD_START`` command. - - - .. row 5 - - - - - - - __s32 - - - ``speed`` - - - Playback speed and direction. The playback speed is defined as - ``speed``/1000 of the normal speed. So 1000 is normal playback. - Negative numbers denote reverse playback, so -1000 does reverse - playback at normal speed. Speeds -1, 0 and 1 have special - meanings: speed 0 is shorthand for 1000 (normal playback). A speed - of 1 steps just one frame forward, a speed of -1 steps just one - frame back. - - - .. row 6 - - - - - - - __u32 - - - ``format`` - - - Format restrictions. This field is set by the driver, not the - application. Possible values are ``V4L2_DEC_START_FMT_NONE`` if - there are no format restrictions or ``V4L2_DEC_START_FMT_GOP`` if - the decoder operates on full GOPs (*Group Of Pictures*). This is - usually the case for reverse playback: the decoder needs full - GOPs, which it can then play in reverse order. So to implement - reverse playback the application must feed the decoder the last - GOP in the video file, then the GOP before that, etc. etc. - - - .. row 7 - - - - - struct - - - ``stop`` - - - - - Structure containing additional data for the ``V4L2_DEC_CMD_STOP`` - command. - - - .. row 8 - - - - - - - __u64 - - - ``pts`` - - - Stop playback at this ``pts`` or immediately if the playback is - already past that timestamp. Leave to 0 if you want to stop after - the last frame was decoded. - - - .. row 9 - - - - - struct - - - ``raw`` - - - - - - - - .. row 10 - - - - - - - __u32 - - - ``data``\ [16] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + * - __u32 + - ``cmd`` + - + - + - The decoder command, see :ref:`decoder-cmds`. + * - __u32 + - ``flags`` + - + - + - Flags to go with the command. If no flags are defined for this + command, drivers and applications must set this field to zero. + * - union + - (anonymous) + - + - + - + * - + - struct + - ``start`` + - + - Structure containing additional data for the + ``V4L2_DEC_CMD_START`` command. + * - + - + - __s32 + - ``speed`` + - Playback speed and direction. The playback speed is defined as + ``speed``/1000 of the normal speed. So 1000 is normal playback. + Negative numbers denote reverse playback, so -1000 does reverse + playback at normal speed. Speeds -1, 0 and 1 have special + meanings: speed 0 is shorthand for 1000 (normal playback). A speed + of 1 steps just one frame forward, a speed of -1 steps just one + frame back. + * - + - + - __u32 + - ``format`` + - Format restrictions. This field is set by the driver, not the + application. Possible values are ``V4L2_DEC_START_FMT_NONE`` if + there are no format restrictions or ``V4L2_DEC_START_FMT_GOP`` if + the decoder operates on full GOPs (*Group Of Pictures*). This is + usually the case for reverse playback: the decoder needs full + GOPs, which it can then play in reverse order. So to implement + reverse playback the application must feed the decoder the last + GOP in the video file, then the GOP before that, etc. etc. + * - + - struct + - ``stop`` + - + - Structure containing additional data for the ``V4L2_DEC_CMD_STOP`` + command. + * - + - + - __u64 + - ``pts`` + - Stop playback at this ``pts`` or immediately if the playback is + already past that timestamp. Leave to 0 if you want to stop after + the last frame was decoded. + * - + - struct + - ``raw`` + - + - + * - + - + - __u32 + - ``data``\ [16] + - Reserved for future extensions. Drivers and applications must set + the array to zero. @@ -201,68 +151,48 @@ introduced in Linux 3.3. :stub-columns: 0 :widths: 56 6 113 - - - .. row 1 - - - ``V4L2_DEC_CMD_START`` - - - 0 - - - Start the decoder. When the decoder is already running or paused, - this command will just change the playback speed. That means that - calling ``V4L2_DEC_CMD_START`` when the decoder was paused will - *not* resume the decoder. You have to explicitly call - ``V4L2_DEC_CMD_RESUME`` for that. This command has one flag: - ``V4L2_DEC_CMD_START_MUTE_AUDIO``. If set, then audio will be - muted when playing back at a non-standard speed. - - - .. row 2 - - - ``V4L2_DEC_CMD_STOP`` - - - 1 - - - Stop the decoder. When the decoder is already stopped, this - command does nothing. This command has two flags: if - ``V4L2_DEC_CMD_STOP_TO_BLACK`` is set, then the decoder will set - the picture to black after it stopped decoding. Otherwise the last - image will repeat. mem2mem decoders will stop producing new frames - altogether. They will send a ``V4L2_EVENT_EOS`` event when the - last frame has been decoded and all frames are ready to be - dequeued and will set the ``V4L2_BUF_FLAG_LAST`` buffer flag on - the last buffer of the capture queue to indicate there will be no - new buffers produced to dequeue. This buffer may be empty, - indicated by the driver setting the ``bytesused`` field to 0. Once - the ``V4L2_BUF_FLAG_LAST`` flag was set, the - :ref:`VIDIOC_DQBUF ` ioctl will not block anymore, - but return an ``EPIPE`` error code. If - ``V4L2_DEC_CMD_STOP_IMMEDIATELY`` is set, then the decoder stops - immediately (ignoring the ``pts`` value), otherwise it will keep - decoding until timestamp >= pts or until the last of the pending - data from its internal buffers was decoded. - - - .. row 3 - - - ``V4L2_DEC_CMD_PAUSE`` - - - 2 - - - Pause the decoder. When the decoder has not been started yet, the - driver will return an ``EPERM`` error code. When the decoder is - already paused, this command does nothing. This command has one - flag: if ``V4L2_DEC_CMD_PAUSE_TO_BLACK`` is set, then set the - decoder output to black when paused. - - - .. row 4 - - - ``V4L2_DEC_CMD_RESUME`` - - - 3 - - - Resume decoding after a PAUSE command. When the decoder has not - been started yet, the driver will return an ``EPERM`` error code. When - the decoder is already running, this command does nothing. No - flags are defined for this command. + * - ``V4L2_DEC_CMD_START`` + - 0 + - Start the decoder. When the decoder is already running or paused, + this command will just change the playback speed. That means that + calling ``V4L2_DEC_CMD_START`` when the decoder was paused will + *not* resume the decoder. You have to explicitly call + ``V4L2_DEC_CMD_RESUME`` for that. This command has one flag: + ``V4L2_DEC_CMD_START_MUTE_AUDIO``. If set, then audio will be + muted when playing back at a non-standard speed. + * - ``V4L2_DEC_CMD_STOP`` + - 1 + - Stop the decoder. When the decoder is already stopped, this + command does nothing. This command has two flags: if + ``V4L2_DEC_CMD_STOP_TO_BLACK`` is set, then the decoder will set + the picture to black after it stopped decoding. Otherwise the last + image will repeat. mem2mem decoders will stop producing new frames + altogether. They will send a ``V4L2_EVENT_EOS`` event when the + last frame has been decoded and all frames are ready to be + dequeued and will set the ``V4L2_BUF_FLAG_LAST`` buffer flag on + the last buffer of the capture queue to indicate there will be no + new buffers produced to dequeue. This buffer may be empty, + indicated by the driver setting the ``bytesused`` field to 0. Once + the ``V4L2_BUF_FLAG_LAST`` flag was set, the + :ref:`VIDIOC_DQBUF ` ioctl will not block anymore, + but return an ``EPIPE`` error code. If + ``V4L2_DEC_CMD_STOP_IMMEDIATELY`` is set, then the decoder stops + immediately (ignoring the ``pts`` value), otherwise it will keep + decoding until timestamp >= pts or until the last of the pending + data from its internal buffers was decoded. + * - ``V4L2_DEC_CMD_PAUSE`` + - 2 + - Pause the decoder. When the decoder has not been started yet, the + driver will return an ``EPERM`` error code. When the decoder is + already paused, this command does nothing. This command has one + flag: if ``V4L2_DEC_CMD_PAUSE_TO_BLACK`` is set, then set the + decoder output to black when paused. + * - ``V4L2_DEC_CMD_RESUME`` + - 3 + - Resume decoding after a PAUSE command. When the decoder has not + been started yet, the driver will return an ``EPERM`` error code. When + the decoder is already running, this command does nothing. No + flags are defined for this command. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index 6347d2f83a44..8d663a73818e 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -49,131 +49,66 @@ call. :stub-columns: 0 :widths: 1 1 2 1 - - - .. row 1 - - - __u32 - - - ``type`` - - - - - Type of the event, see :ref:`event-type`. - - - .. row 2 - - - union - - - ``u`` - - - - - - - - .. row 3 - - - - - struct :c:type:`v4l2_event_vsync` - - - ``vsync`` - - - Event data for event ``V4L2_EVENT_VSYNC``. - - - .. row 4 - - - - - struct :c:type:`v4l2_event_ctrl` - - - ``ctrl`` - - - Event data for event ``V4L2_EVENT_CTRL``. - - - .. row 5 - - - - - struct :c:type:`v4l2_event_frame_sync` - - - ``frame_sync`` - - - Event data for event ``V4L2_EVENT_FRAME_SYNC``. - - - .. row 6 - - - - - struct :c:type:`v4l2_event_motion_det` - - - ``motion_det`` - - - Event data for event V4L2_EVENT_MOTION_DET. - - - .. row 7 - - - - - struct :c:type:`v4l2_event_src_change` - - - ``src_change`` - - - Event data for event V4L2_EVENT_SOURCE_CHANGE. - - - .. row 8 - - - - - __u8 - - - ``data``\ [64] - - - Event data. Defined by the event type. The union should be used to - define easily accessible type for events. - - - .. row 9 - - - __u32 - - - ``pending`` - - - - - Number of pending events excluding this one. - - - .. row 10 - - - __u32 - - - ``sequence`` - - - - - Event sequence number. The sequence number is incremented for - every subscribed event that takes place. If sequence numbers are - not contiguous it means that events have been lost. - - - .. row 11 - - - struct timespec - - - ``timestamp`` - - - - - Event timestamp. The timestamp has been taken from the - ``CLOCK_MONOTONIC`` clock. To access the same clock outside V4L2, - use :c:func:`clock_gettime`. - - - .. row 12 - - - u32 - - - ``id`` - - - - - The ID associated with the event source. If the event does not - have an associated ID (this depends on the event type), then this - is 0. - - - .. row 13 - - - __u32 - - - ``reserved``\ [8] - - - - - Reserved for future extensions. Drivers must set the array to - zero. + * - __u32 + - ``type`` + - + - Type of the event, see :ref:`event-type`. + * - union + - ``u`` + - + - + * - + - struct :c:type:`v4l2_event_vsync` + - ``vsync`` + - Event data for event ``V4L2_EVENT_VSYNC``. + * - + - struct :c:type:`v4l2_event_ctrl` + - ``ctrl`` + - Event data for event ``V4L2_EVENT_CTRL``. + * - + - struct :c:type:`v4l2_event_frame_sync` + - ``frame_sync`` + - Event data for event ``V4L2_EVENT_FRAME_SYNC``. + * - + - struct :c:type:`v4l2_event_motion_det` + - ``motion_det`` + - Event data for event V4L2_EVENT_MOTION_DET. + * - + - struct :c:type:`v4l2_event_src_change` + - ``src_change`` + - Event data for event V4L2_EVENT_SOURCE_CHANGE. + * - + - __u8 + - ``data``\ [64] + - Event data. Defined by the event type. The union should be used to + define easily accessible type for events. + * - __u32 + - ``pending`` + - + - Number of pending events excluding this one. + * - __u32 + - ``sequence`` + - + - Event sequence number. The sequence number is incremented for + every subscribed event that takes place. If sequence numbers are + not contiguous it means that events have been lost. + * - struct timespec + - ``timestamp`` + - + - Event timestamp. The timestamp has been taken from the + ``CLOCK_MONOTONIC`` clock. To access the same clock outside V4L2, + use :c:func:`clock_gettime`. + * - u32 + - ``id`` + - + - The ID associated with the event source. If the event does not + have an associated ID (this depends on the event type), then this + is 0. + * - __u32 + - ``reserved``\ [8] + - + - Reserved for future extensions. Drivers must set the array to + zero. @@ -188,123 +123,83 @@ call. :stub-columns: 0 :widths: 3 1 4 + * - ``V4L2_EVENT_ALL`` + - 0 + - All events. V4L2_EVENT_ALL is valid only for + VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. + * - ``V4L2_EVENT_VSYNC`` + - 1 + - This event is triggered on the vertical sync. This event has a + struct :c:type:`v4l2_event_vsync` associated + with it. + * - ``V4L2_EVENT_EOS`` + - 2 + - This event is triggered when the end of a stream is reached. This + is typically used with MPEG decoders to report to the application + when the last of the MPEG stream has been decoded. + * - ``V4L2_EVENT_CTRL`` + - 3 + - This event requires that the ``id`` matches the control ID from + which you want to receive events. This event is triggered if the + control's value changes, if a button control is pressed or if the + control's flags change. This event has a struct + :c:type:`v4l2_event_ctrl` associated with it. + This struct contains much of the same information as struct + :ref:`v4l2_queryctrl ` and struct + :c:type:`v4l2_control`. - - .. row 1 + If the event is generated due to a call to + :ref:`VIDIOC_S_CTRL ` or + :ref:`VIDIOC_S_EXT_CTRLS `, then the + event will *not* be sent to the file handle that called the ioctl + function. This prevents nasty feedback loops. If you *do* want to + get the event, then set the ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK`` + flag. - - ``V4L2_EVENT_ALL`` + This event type will ensure that no information is lost when more + events are raised than there is room internally. In that case the + struct :c:type:`v4l2_event_ctrl` of the + second-oldest event is kept, but the ``changes`` field of the + second-oldest event is ORed with the ``changes`` field of the + oldest event. + * - ``V4L2_EVENT_FRAME_SYNC`` + - 4 + - Triggered immediately when the reception of a frame has begun. + This event has a struct + :c:type:`v4l2_event_frame_sync` + associated with it. - - 0 + If the hardware needs to be stopped in the case of a buffer + underrun it might not be able to generate this event. In such + cases the ``frame_sequence`` field in struct + :c:type:`v4l2_event_frame_sync` will not + be incremented. This causes two consecutive frame sequence numbers + to have n times frame interval in between them. + * - ``V4L2_EVENT_SOURCE_CHANGE`` + - 5 + - 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 ``id`` 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. - - All events. V4L2_EVENT_ALL is valid only for - VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. - - - .. row 2 - - - ``V4L2_EVENT_VSYNC`` - - - 1 - - - This event is triggered on the vertical sync. This event has a - struct :c:type:`v4l2_event_vsync` associated - with it. - - - .. row 3 - - - ``V4L2_EVENT_EOS`` - - - 2 - - - This event is triggered when the end of a stream is reached. This - is typically used with MPEG decoders to report to the application - when the last of the MPEG stream has been decoded. - - - .. row 4 - - - ``V4L2_EVENT_CTRL`` - - - 3 - - - This event requires that the ``id`` matches the control ID from - which you want to receive events. This event is triggered if the - control's value changes, if a button control is pressed or if the - control's flags change. This event has a struct - :c:type:`v4l2_event_ctrl` associated with it. - This struct contains much of the same information as struct - :ref:`v4l2_queryctrl ` and struct - :c:type:`v4l2_control`. - - If the event is generated due to a call to - :ref:`VIDIOC_S_CTRL ` or - :ref:`VIDIOC_S_EXT_CTRLS `, then the - event will *not* be sent to the file handle that called the ioctl - function. This prevents nasty feedback loops. If you *do* want to - get the event, then set the ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK`` - flag. - - This event type will ensure that no information is lost when more - events are raised than there is room internally. In that case the - struct :c:type:`v4l2_event_ctrl` of the - second-oldest event is kept, but the ``changes`` field of the - second-oldest event is ORed with the ``changes`` field of the - oldest event. - - - .. row 5 - - - ``V4L2_EVENT_FRAME_SYNC`` - - - 4 - - - Triggered immediately when the reception of a frame has begun. - This event has a struct - :c:type:`v4l2_event_frame_sync` - associated with it. - - If the hardware needs to be stopped in the case of a buffer - underrun it might not be able to generate this event. In such - cases the ``frame_sequence`` field in struct - :c:type:`v4l2_event_frame_sync` will not - be incremented. This causes two consecutive frame sequence numbers - to have n times frame interval in between them. - - - .. row 6 - - - ``V4L2_EVENT_SOURCE_CHANGE`` - - - 5 - - - 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 ``id`` 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. - - This event has a struct - :c:type:`v4l2_event_src_change` - associated with it. The ``changes`` 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. - - - .. row 7 - - - ``V4L2_EVENT_MOTION_DET`` - - - 6 - - - Triggered whenever the motion detection state for one or more of - the regions changes. This event has a struct - :c:type:`v4l2_event_motion_det` - associated with it. - - - .. row 8 - - - ``V4L2_EVENT_PRIVATE_START`` - - - 0x08000000 - - - Base event number for driver-private events. + This event has a struct + :c:type:`v4l2_event_src_change` + associated with it. The ``changes`` 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. + * - ``V4L2_EVENT_MOTION_DET`` + - 6 + - Triggered whenever the motion detection state for one or more of + the regions changes. This event has a struct + :c:type:`v4l2_event_motion_det` + associated with it. + * - ``V4L2_EVENT_PRIVATE_START`` + - 0x08000000 + - Base event number for driver-private events. @@ -317,14 +212,9 @@ call. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u8 - - - ``field`` - - - The upcoming field. See enum :c:type:`v4l2_field`. + * - __u8 + - ``field`` + - The upcoming field. See enum :c:type:`v4l2_field`. @@ -337,103 +227,54 @@ call. :stub-columns: 0 :widths: 1 1 2 1 - - - .. row 1 - - - __u32 - - - ``changes`` - - - - - A bitmask that tells what has changed. See - :ref:`ctrl-changes-flags`. - - - .. row 2 - - - __u32 - - - ``type`` - - - - - The type of the control. See enum - :c:type:`v4l2_ctrl_type`. - - - .. row 3 - - - union (anonymous) - - - - - - - - - - .. row 4 - - - - - __s32 - - - ``value`` - - - The 32-bit value of the control for 32-bit control types. This is - 0 for string controls since the value of a string cannot be passed - using :ref:`VIDIOC_DQEVENT`. - - - .. row 5 - - - - - __s64 - - - ``value64`` - - - The 64-bit value of the control for 64-bit control types. - - - .. row 6 - - - __u32 - - - ``flags`` - - - - - The control flags. See :ref:`control-flags`. - - - .. row 7 - - - __s32 - - - ``minimum`` - - - - - The minimum value of the control. See struct - :ref:`v4l2_queryctrl `. - - - .. row 8 - - - __s32 - - - ``maximum`` - - - - - The maximum value of the control. See struct - :ref:`v4l2_queryctrl `. - - - .. row 9 - - - __s32 - - - ``step`` - - - - - The step value of the control. See struct - :ref:`v4l2_queryctrl `. - - - .. row 10 - - - __s32 - - - ``default_value`` - - - - - The default value value of the control. See struct - :ref:`v4l2_queryctrl `. + * - __u32 + - ``changes`` + - + - A bitmask that tells what has changed. See + :ref:`ctrl-changes-flags`. + * - __u32 + - ``type`` + - + - The type of the control. See enum + :c:type:`v4l2_ctrl_type`. + * - union (anonymous) + - + - + - + * - + - __s32 + - ``value`` + - The 32-bit value of the control for 32-bit control types. This is + 0 for string controls since the value of a string cannot be passed + using :ref:`VIDIOC_DQEVENT`. + * - + - __s64 + - ``value64`` + - The 64-bit value of the control for 64-bit control types. + * - __u32 + - ``flags`` + - + - The control flags. See :ref:`control-flags`. + * - __s32 + - ``minimum`` + - + - The minimum value of the control. See struct + :ref:`v4l2_queryctrl `. + * - __s32 + - ``maximum`` + - + - The maximum value of the control. See struct + :ref:`v4l2_queryctrl `. + * - __s32 + - ``step`` + - + - The step value of the control. See struct + :ref:`v4l2_queryctrl `. + * - __s32 + - ``default_value`` + - + - The default value value of the control. See struct + :ref:`v4l2_queryctrl `. @@ -446,14 +287,9 @@ call. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``frame_sequence`` - - - The sequence number of the frame being received. + * - __u32 + - ``frame_sequence`` + - The sequence number of the frame being received. @@ -466,15 +302,10 @@ call. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``changes`` - - - A bitmask that tells what has changed. See - :ref:`src-changes-flags`. + * - __u32 + - ``changes`` + - A bitmask that tells what has changed. See + :ref:`src-changes-flags`. @@ -487,39 +318,24 @@ call. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``flags`` - - - Currently only one flag is available: if - ``V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ`` is set, then the - ``frame_sequence`` field is valid, otherwise that field should be - ignored. - - - .. row 2 - - - __u32 - - - ``frame_sequence`` - - - The sequence number of the frame being received. Only valid if the - ``V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ`` flag was set. - - - .. row 3 - - - __u32 - - - ``region_mask`` - - - The bitmask of the regions that reported motion. There is at least - one region. If this field is 0, then no motion was detected at - all. If there is no ``V4L2_CID_DETECT_MD_REGION_GRID`` control - (see :ref:`detect-controls`) to assign a different region to - each cell in the motion detection grid, then that all cells are - automatically assigned to the default region 0. + * - __u32 + - ``flags`` + - Currently only one flag is available: if + ``V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ`` is set, then the + ``frame_sequence`` field is valid, otherwise that field should be + ignored. + * - __u32 + - ``frame_sequence`` + - The sequence number of the frame being received. Only valid if the + ``V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ`` flag was set. + * - __u32 + - ``region_mask`` + - The bitmask of the regions that reported motion. There is at least + one region. If this field is 0, then no motion was detected at + all. If there is no ``V4L2_CID_DETECT_MD_REGION_GRID`` control + (see :ref:`detect-controls`) to assign a different region to + each cell in the motion detection grid, then that all cells are + automatically assigned to the default region 0. @@ -532,35 +348,20 @@ call. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_EVENT_CTRL_CH_VALUE`` - - - 0x0001 - - - This control event was triggered because the value of the control - changed. Special cases: Volatile controls do no generate this - event; If a control has the ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` - flag set, then this event is sent as well, regardless its value. - - - .. row 2 - - - ``V4L2_EVENT_CTRL_CH_FLAGS`` - - - 0x0002 - - - This control event was triggered because the control flags - changed. - - - .. row 3 - - - ``V4L2_EVENT_CTRL_CH_RANGE`` - - - 0x0004 - - - This control event was triggered because the minimum, maximum, - step or the default value of the control changed. + * - ``V4L2_EVENT_CTRL_CH_VALUE`` + - 0x0001 + - This control event was triggered because the value of the control + changed. Special cases: Volatile controls do no generate this + event; If a control has the ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` + flag set, then this event is sent as well, regardless its value. + * - ``V4L2_EVENT_CTRL_CH_FLAGS`` + - 0x0002 + - This control event was triggered because the control flags + changed. + * - ``V4L2_EVENT_CTRL_CH_RANGE`` + - 0x0004 + - This control event was triggered because the minimum, maximum, + step or the default value of the control changed. @@ -573,16 +374,11 @@ call. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_EVENT_SRC_CH_RESOLUTION`` - - - 0x0001 - - - 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. + * - ``V4L2_EVENT_SRC_CH_RESOLUTION`` + - 0x0001 + - 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. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst index 7cb78a0067ac..424f3a1c7f56 100644 --- a/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst @@ -64,81 +64,36 @@ that doesn't support them will return an ``EINVAL`` error code. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``min_width`` - - - Minimum width of the active video in pixels. - - - .. row 2 - - - __u32 - - - ``max_width`` - - - Maximum width of the active video in pixels. - - - .. row 3 - - - __u32 - - - ``min_height`` - - - Minimum height of the active video in lines. - - - .. row 4 - - - __u32 - - - ``max_height`` - - - Maximum height of the active video in lines. - - - .. row 5 - - - __u64 - - - ``min_pixelclock`` - - - Minimum pixelclock frequency in Hz. - - - .. row 6 - - - __u64 - - - ``max_pixelclock`` - - - Maximum pixelclock frequency in Hz. - - - .. row 7 - - - __u32 - - - ``standards`` - - - The video standard(s) supported by the hardware. See - :ref:`dv-bt-standards` for a list of standards. - - - .. row 8 - - - __u32 - - - ``capabilities`` - - - Several flags giving more information about the capabilities. See - :ref:`dv-bt-cap-capabilities` for a description of the flags. - - - .. row 9 - - - __u32 - - - ``reserved``\ [16] - - - Reserved for future extensions. - Drivers must set the array to zero. + * - __u32 + - ``min_width`` + - Minimum width of the active video in pixels. + * - __u32 + - ``max_width`` + - Maximum width of the active video in pixels. + * - __u32 + - ``min_height`` + - Minimum height of the active video in lines. + * - __u32 + - ``max_height`` + - Maximum height of the active video in lines. + * - __u64 + - ``min_pixelclock`` + - Minimum pixelclock frequency in Hz. + * - __u64 + - ``max_pixelclock`` + - Maximum pixelclock frequency in Hz. + * - __u32 + - ``standards`` + - The video standard(s) supported by the hardware. See + :ref:`dv-bt-standards` for a list of standards. + * - __u32 + - ``capabilities`` + - Several flags giving more information about the capabilities. See + :ref:`dv-bt-cap-capabilities` for a description of the flags. + * - __u32 + - ``reserved``\ [16] + - Reserved for future extensions. + Drivers must set the array to zero. @@ -151,59 +106,30 @@ that doesn't support them will return an ``EINVAL`` error code. :stub-columns: 0 :widths: 1 1 2 1 + * - __u32 + - ``type`` + - Type of DV timings as listed in :ref:`dv-timing-types`. + * - __u32 + - ``pad`` + - 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. + * - __u32 + - ``reserved``\ [2] + - Reserved for future extensions. - - .. row 1 - - - __u32 - - - ``type`` - - - Type of DV timings as listed in :ref:`dv-timing-types`. - - - .. row 2 - - - __u32 - - - ``pad`` - - - 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. - - - .. row 3 - - - __u32 - - - ``reserved``\ [2] - - - Reserved for future extensions. - - Drivers and applications must set the array to zero. - - - .. row 4 - - - union - - - - - - - - .. row 5 - - - - - struct :c:type:`v4l2_bt_timings_cap` - - - ``bt`` - - - BT.656/1120 timings capabilities of the hardware. - - - .. row 6 - - - - - __u32 - - - ``raw_data``\ [32] - - - + Drivers and applications must set the array to zero. + * - union + - + - + * - + - struct :c:type:`v4l2_bt_timings_cap` + - ``bt`` + - BT.656/1120 timings capabilities of the hardware. + * - + - __u32 + - ``raw_data``\ [32] + - .. tabularcolumns:: |p{7.0cm}|p{10.5cm}| @@ -213,43 +139,20 @@ that doesn't support them will return an ``EINVAL`` error code. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - Flag - - - Description - - - .. row 2 - - - - - - - - .. row 3 - - - ``V4L2_DV_BT_CAP_INTERLACED`` - - - Interlaced formats are supported. - - - .. row 4 - - - ``V4L2_DV_BT_CAP_PROGRESSIVE`` - - - Progressive formats are supported. - - - .. row 5 - - - ``V4L2_DV_BT_CAP_REDUCED_BLANKING`` - - - CVT/GTF specific: the timings can make use of reduced blanking - (CVT) or the 'Secondary GTF' curve (GTF). - - - .. row 6 - - - ``V4L2_DV_BT_CAP_CUSTOM`` - - - Can support non-standard timings, i.e. timings not belonging to - the standards set in the ``standards`` field. + * - Flag + - Description + * - + - + * - ``V4L2_DV_BT_CAP_INTERLACED`` + - Interlaced formats are supported. + * - ``V4L2_DV_BT_CAP_PROGRESSIVE`` + - Progressive formats are supported. + * - ``V4L2_DV_BT_CAP_REDUCED_BLANKING`` + - CVT/GTF specific: the timings can make use of reduced blanking + (CVT) or the 'Secondary GTF' curve (GTF). + * - ``V4L2_DV_BT_CAP_CUSTOM`` + - Can support non-standard timings, i.e. timings not belonging to + the standards set in the ``standards`` field. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst index b724ec36a25c..ae20ee573757 100644 --- a/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst +++ b/Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst @@ -74,33 +74,18 @@ introduced in Linux 2.6.21. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``cmd`` - - - The encoder command, see :ref:`encoder-cmds`. - - - .. row 2 - - - __u32 - - - ``flags`` - - - Flags to go with the command, see :ref:`encoder-flags`. If no - flags are defined for this command, drivers and applications must - set this field to zero. - - - .. row 3 - - - __u32 - - - ``data``\ [8] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + * - __u32 + - ``cmd`` + - The encoder command, see :ref:`encoder-cmds`. + * - __u32 + - ``flags`` + - Flags to go with the command, see :ref:`encoder-flags`. If no + flags are defined for this command, drivers and applications must + set this field to zero. + * - __u32 + - ``data``\ [8] + - Reserved for future extensions. Drivers and applications must set + the array to zero. @@ -113,57 +98,37 @@ introduced in Linux 2.6.21. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_ENC_CMD_START`` - - - 0 - - - Start the encoder. When the encoder is already running or paused, - this command does nothing. No flags are defined for this command. - - - .. row 2 - - - ``V4L2_ENC_CMD_STOP`` - - - 1 - - - Stop the encoder. When the ``V4L2_ENC_CMD_STOP_AT_GOP_END`` flag - is set, encoding will continue until the end of the current *Group - Of Pictures*, otherwise encoding will stop immediately. When the - encoder is already stopped, this command does nothing. mem2mem - encoders will send a ``V4L2_EVENT_EOS`` event when the last frame - has been encoded and all frames are ready to be dequeued and will - set the ``V4L2_BUF_FLAG_LAST`` buffer flag on the last buffer of - the capture queue to indicate there will be no new buffers - produced to dequeue. This buffer may be empty, indicated by the - driver setting the ``bytesused`` field to 0. Once the - ``V4L2_BUF_FLAG_LAST`` flag was set, the - :ref:`VIDIOC_DQBUF ` ioctl will not block anymore, - but return an ``EPIPE`` error code. - - - .. row 3 - - - ``V4L2_ENC_CMD_PAUSE`` - - - 2 - - - Pause the encoder. When the encoder has not been started yet, the - driver will return an ``EPERM`` error code. When the encoder is - already paused, this command does nothing. No flags are defined - for this command. - - - .. row 4 - - - ``V4L2_ENC_CMD_RESUME`` - - - 3 - - - Resume encoding after a PAUSE command. When the encoder has not - been started yet, the driver will return an ``EPERM`` error code. When - the encoder is already running, this command does nothing. No - flags are defined for this command. + * - ``V4L2_ENC_CMD_START`` + - 0 + - Start the encoder. When the encoder is already running or paused, + this command does nothing. No flags are defined for this command. + * - ``V4L2_ENC_CMD_STOP`` + - 1 + - Stop the encoder. When the ``V4L2_ENC_CMD_STOP_AT_GOP_END`` flag + is set, encoding will continue until the end of the current *Group + Of Pictures*, otherwise encoding will stop immediately. When the + encoder is already stopped, this command does nothing. mem2mem + encoders will send a ``V4L2_EVENT_EOS`` event when the last frame + has been encoded and all frames are ready to be dequeued and will + set the ``V4L2_BUF_FLAG_LAST`` buffer flag on the last buffer of + the capture queue to indicate there will be no new buffers + produced to dequeue. This buffer may be empty, indicated by the + driver setting the ``bytesused`` field to 0. Once the + ``V4L2_BUF_FLAG_LAST`` flag was set, the + :ref:`VIDIOC_DQBUF ` ioctl will not block anymore, + but return an ``EPIPE`` error code. + * - ``V4L2_ENC_CMD_PAUSE`` + - 2 + - Pause the encoder. When the encoder has not been started yet, the + driver will return an ``EPERM`` error code. When the encoder is + already paused, this command does nothing. No flags are defined + for this command. + * - ``V4L2_ENC_CMD_RESUME`` + - 3 + - Resume encoding after a PAUSE command. When the encoder has not + been started yet, the driver will return an ``EPERM`` error code. When + the encoder is already running, this command does nothing. No + flags are defined for this command. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| @@ -175,15 +140,10 @@ introduced in Linux 2.6.21. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_ENC_CMD_STOP_AT_GOP_END`` - - - 0x0001 - - - Stop encoding at the end of the current *Group Of Pictures*, - rather than immediately. + * - ``V4L2_ENC_CMD_STOP_AT_GOP_END`` + - 0x0001 + - Stop encoding at the end of the current *Group Of Pictures*, + rather than immediately. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst index dfe4d737b0aa..3e9d0f69cc73 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst @@ -74,41 +74,21 @@ return an ``EINVAL`` error code. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``index`` - - - Number of the DV timings, set by the application. - - - .. row 2 - - - __u32 - - - ``pad`` - - - 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. - - - .. row 3 - - - __u32 - - - ``reserved``\ [2] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. - - - .. row 4 - - - struct :c:type:`v4l2_dv_timings` - - - ``timings`` - - - The timings. + * - __u32 + - ``index`` + - Number of the DV timings, set by the application. + * - __u32 + - ``pad`` + - 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. + * - __u32 + - ``reserved``\ [2] + - Reserved for future extensions. Drivers and applications must set + the array to zero. + * - struct :c:type:`v4l2_dv_timings` + - ``timings`` + - The timings. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst index 91fbc4ba209c..a2adaa4bd4dd 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst @@ -53,80 +53,48 @@ one until ``EINVAL`` is returned. :stub-columns: 0 :widths: 1 1 2 - - .. row 1 + * - __u32 + - ``index`` + - Number of the format in the enumeration, set by the application. + This is in no way related to the ``pixelformat`` field. + * - __u32 + - ``type`` + - Type of the data stream, set by the application. Only these types + are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, + ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``, + ``V4L2_BUF_TYPE_VIDEO_OUTPUT``, + ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and + ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. + * - __u32 + - ``flags`` + - See :ref:`fmtdesc-flags` + * - __u8 + - ``description``\ [32] + - Description of the format, a NUL-terminated ASCII string. This + information is intended for the user, for example: "YUV 4:2:2". + * - __u32 + - ``pixelformat`` + - The image format identifier. This is a four character code as + computed by the v4l2_fourcc() macro: + * - :cspan:`2` - - __u32 + .. _v4l2-fourcc: - - ``index`` + ``#define v4l2_fourcc(a,b,c,d)`` - - Number of the format in the enumeration, set by the application. - This is in no way related to the ``pixelformat`` field. + ``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))`` - - .. row 2 + Several image formats are already defined by this specification in + :ref:`pixfmt`. - - __u32 + .. attention:: - - ``type`` - - - Type of the data stream, set by the application. Only these types - are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, - ``V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE``, - ``V4L2_BUF_TYPE_VIDEO_OUTPUT``, - ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE`` and - ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. - - - .. row 3 - - - __u32 - - - ``flags`` - - - See :ref:`fmtdesc-flags` - - - .. row 4 - - - __u8 - - - ``description``\ [32] - - - Description of the format, a NUL-terminated ASCII string. This - information is intended for the user, for example: "YUV 4:2:2". - - - .. row 5 - - - __u32 - - - ``pixelformat`` - - - The image format identifier. This is a four character code as - computed by the v4l2_fourcc() macro: - - - .. row 6 - - - :cspan:`2` - - .. _v4l2-fourcc: - - ``#define v4l2_fourcc(a,b,c,d)`` - - ``(((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24))`` - - Several image formats are already defined by this specification in - :ref:`pixfmt`. - - .. attention:: - - These codes are not the same as those used - in the Windows world. - - - .. row 7 - - - __u32 - - - ``reserved``\ [4] - - - Reserved for future extensions. Drivers must set the array to - zero. + These codes are not the same as those used + in the Windows world. + * - __u32 + - ``reserved``\ [4] + - Reserved for future extensions. Drivers must set the array to + zero. @@ -139,24 +107,14 @@ one until ``EINVAL`` is returned. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_FMT_FLAG_COMPRESSED`` - - - 0x0001 - - - This is a compressed format. - - - .. row 2 - - - ``V4L2_FMT_FLAG_EMULATED`` - - - 0x0002 - - - This format is not native to the device but emulated through - software (usually libv4l2), where possible try to use a native - format instead for better performance. + * - ``V4L2_FMT_FLAG_COMPRESSED`` + - 0x0001 + - This is a compressed format. + * - ``V4L2_FMT_FLAG_EMULATED`` + - 0x0002 + - This format is not native to the device but emulated through + software (usually libv4l2), where possible try to use a native + format instead for better performance. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst index 83f641f9f231..39492453f02d 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst @@ -110,30 +110,15 @@ application should zero out all members except for the *IN* fields. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - struct :c:type:`v4l2_fract` - - - ``min`` - - - Minimum frame interval [s]. - - - .. row 2 - - - struct :c:type:`v4l2_fract` - - - ``max`` - - - Maximum frame interval [s]. - - - .. row 3 - - - struct :c:type:`v4l2_fract` - - - ``step`` - - - Frame interval step size [s]. + * - struct :c:type:`v4l2_fract` + - ``min`` + - Minimum frame interval [s]. + * - struct :c:type:`v4l2_fract` + - ``max`` + - Maximum frame interval [s]. + * - struct :c:type:`v4l2_fract` + - ``step`` + - Frame interval step size [s]. @@ -143,87 +128,43 @@ application should zero out all members except for the *IN* fields. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - __u32 - - - ``index`` - - - - - IN: Index of the given frame interval in the enumeration. - - - .. row 2 - - - __u32 - - - ``pixel_format`` - - - - - IN: Pixel format for which the frame intervals are enumerated. - - - .. row 3 - - - __u32 - - - ``width`` - - - - - IN: Frame width for which the frame intervals are enumerated. - - - .. row 4 - - - __u32 - - - ``height`` - - - - - IN: Frame height for which the frame intervals are enumerated. - - - .. row 5 - - - __u32 - - - ``type`` - - - - - OUT: Frame interval type the device supports. - - - .. row 6 - - - union - - - - - - - OUT: Frame interval with the given index. - - - .. row 7 - - - - - struct :c:type:`v4l2_fract` - - - ``discrete`` - - - Frame interval [s]. - - - .. row 8 - - - - - struct :c:type:`v4l2_frmival_stepwise` - - - ``stepwise`` - - - - - - .. row 9 - - - __u32 - - - ``reserved[2]`` - - - - - Reserved space for future use. Must be zeroed by drivers and - applications. + * - __u32 + - ``index`` + - + - IN: Index of the given frame interval in the enumeration. + * - __u32 + - ``pixel_format`` + - + - IN: Pixel format for which the frame intervals are enumerated. + * - __u32 + - ``width`` + - + - IN: Frame width for which the frame intervals are enumerated. + * - __u32 + - ``height`` + - + - IN: Frame height for which the frame intervals are enumerated. + * - __u32 + - ``type`` + - + - OUT: Frame interval type the device supports. + * - union + - + - + - OUT: Frame interval with the given index. + * - + - struct :c:type:`v4l2_fract` + - ``discrete`` + - Frame interval [s]. + * - + - struct :c:type:`v4l2_frmival_stepwise` + - ``stepwise`` + - + * - __u32 + - ``reserved[2]`` + - + - Reserved space for future use. Must be zeroed by drivers and + applications. @@ -240,30 +181,15 @@ Enums :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_FRMIVAL_TYPE_DISCRETE`` - - - 1 - - - Discrete frame interval. - - - .. row 2 - - - ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` - - - 2 - - - Continuous frame interval. - - - .. row 3 - - - ``V4L2_FRMIVAL_TYPE_STEPWISE`` - - - 3 - - - Step-wise defined frame interval. + * - ``V4L2_FRMIVAL_TYPE_DISCRETE`` + - 1 + - Discrete frame interval. + * - ``V4L2_FRMIVAL_TYPE_CONTINUOUS`` + - 2 + - Continuous frame interval. + * - ``V4L2_FRMIVAL_TYPE_STEPWISE`` + - 3 + - Step-wise defined frame interval. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst index 9a9571d11f7d..628f1aa66338 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst @@ -99,22 +99,12 @@ application should zero out all members except for the *IN* fields. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``width`` - - - Width of the frame [pixel]. - - - .. row 2 - - - __u32 - - - ``height`` - - - Height of the frame [pixel]. + * - __u32 + - ``width`` + - Width of the frame [pixel]. + * - __u32 + - ``height`` + - Height of the frame [pixel]. @@ -127,54 +117,24 @@ application should zero out all members except for the *IN* fields. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``min_width`` - - - Minimum frame width [pixel]. - - - .. row 2 - - - __u32 - - - ``max_width`` - - - Maximum frame width [pixel]. - - - .. row 3 - - - __u32 - - - ``step_width`` - - - Frame width step size [pixel]. - - - .. row 4 - - - __u32 - - - ``min_height`` - - - Minimum frame height [pixel]. - - - .. row 5 - - - __u32 - - - ``max_height`` - - - Maximum frame height [pixel]. - - - .. row 6 - - - __u32 - - - ``step_height`` - - - Frame height step size [pixel]. + * - __u32 + - ``min_width`` + - Minimum frame width [pixel]. + * - __u32 + - ``max_width`` + - Maximum frame width [pixel]. + * - __u32 + - ``step_width`` + - Frame width step size [pixel]. + * - __u32 + - ``min_height`` + - Minimum frame height [pixel]. + * - __u32 + - ``max_height`` + - Maximum frame height [pixel]. + * - __u32 + - ``step_height`` + - Frame height step size [pixel]. @@ -184,69 +144,35 @@ application should zero out all members except for the *IN* fields. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - __u32 - - - ``index`` - - - - - IN: Index of the given frame size in the enumeration. - - - .. row 2 - - - __u32 - - - ``pixel_format`` - - - - - IN: Pixel format for which the frame sizes are enumerated. - - - .. row 3 - - - __u32 - - - ``type`` - - - - - OUT: Frame size type the device supports. - - - .. row 4 - - - union - - - - - - - OUT: Frame size with the given index. - - - .. row 5 - - - - - struct :c:type:`v4l2_frmsize_discrete` - - - ``discrete`` - - - - - - .. row 6 - - - - - struct :c:type:`v4l2_frmsize_stepwise` - - - ``stepwise`` - - - - - - .. row 7 - - - __u32 - - - ``reserved[2]`` - - - - - Reserved space for future use. Must be zeroed by drivers and - applications. + * - __u32 + - ``index`` + - + - IN: Index of the given frame size in the enumeration. + * - __u32 + - ``pixel_format`` + - + - IN: Pixel format for which the frame sizes are enumerated. + * - __u32 + - ``type`` + - + - OUT: Frame size type the device supports. + * - union + - + - + - OUT: Frame size with the given index. + * - + - struct :c:type:`v4l2_frmsize_discrete` + - ``discrete`` + - + * - + - struct :c:type:`v4l2_frmsize_stepwise` + - ``stepwise`` + - + * - __u32 + - ``reserved[2]`` + - + - Reserved space for future use. Must be zeroed by drivers and + applications. @@ -263,30 +189,15 @@ Enums :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_FRMSIZE_TYPE_DISCRETE`` - - - 1 - - - Discrete frame size. - - - .. row 2 - - - ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` - - - 2 - - - Continuous frame size. - - - .. row 3 - - - ``V4L2_FRMSIZE_TYPE_STEPWISE`` - - - 3 - - - Step-wise defined frame size. + * - ``V4L2_FRMSIZE_TYPE_DISCRETE`` + - 1 + - Discrete frame size. + * - ``V4L2_FRMSIZE_TYPE_CONTINUOUS`` + - 2 + - Continuous frame size. + * - ``V4L2_FRMSIZE_TYPE_STEPWISE`` + - 3 + - Step-wise defined frame size. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst index cc27ad4e2fa7..4e5f5e5bf632 100644 --- a/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst +++ b/Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst @@ -50,103 +50,63 @@ of the corresponding tuner/modulator is set. :stub-columns: 0 :widths: 1 1 2 1 1 + * - __u32 + - ``tuner`` + - The tuner or modulator index number. This is the same value as in + the struct :c:type:`v4l2_input` ``tuner`` field and + the struct :c:type:`v4l2_tuner` ``index`` field, or + the struct :c:type:`v4l2_output` ``modulator`` field + and the struct :c:type:`v4l2_modulator` ``index`` + field. + * - __u32 + - ``type`` + - The tuner type. This is the same value as in the struct + :c:type:`v4l2_tuner` ``type`` field. The type must be + set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and + to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to + ``V4L2_TUNER_RADIO`` for modulators (currently only radio + modulators are supported). See :c:type:`v4l2_tuner_type` + * - __u32 + - ``index`` + - Identifies the frequency band, set by the application. + * - __u32 + - ``capability`` + - :cspan:`2` The tuner/modulator capability flags for this + frequency band, see :ref:`tuner-capability`. The + ``V4L2_TUNER_CAP_LOW`` or ``V4L2_TUNER_CAP_1HZ`` 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. + * - __u32 + - ``rangelow`` + - :cspan:`2` The lowest tunable frequency in units of 62.5 kHz, or + if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units + of 62.5 Hz, for this frequency band. A 1 Hz unit is used when the + ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. + * - __u32 + - ``rangehigh`` + - :cspan:`2` The highest tunable frequency in units of 62.5 kHz, + or if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in + units of 62.5 Hz, for this frequency band. A 1 Hz unit is used + when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. + * - __u32 + - ``modulation`` + - :cspan:`2` The supported modulation systems of this frequency + band. See :ref:`band-modulation`. - - .. row 1 + .. note:: - - __u32 + Currently only one modulation system per frequency band + is supported. More work will need to be done if multiple + modulation systems are possible. Contact the linux-media + mailing list + (`https://linuxtv.org/lists.php `__) + if you need such functionality. + * - __u32 + - ``reserved``\ [9] + - Reserved for future extensions. - - ``tuner`` - - - The tuner or modulator index number. This is the same value as in - the struct :c:type:`v4l2_input` ``tuner`` field and - the struct :c:type:`v4l2_tuner` ``index`` field, or - the struct :c:type:`v4l2_output` ``modulator`` field - and the struct :c:type:`v4l2_modulator` ``index`` - field. - - - .. row 2 - - - __u32 - - - ``type`` - - - The tuner type. This is the same value as in the struct - :c:type:`v4l2_tuner` ``type`` field. The type must be - set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and - to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to - ``V4L2_TUNER_RADIO`` for modulators (currently only radio - modulators are supported). See :c:type:`v4l2_tuner_type` - - - .. row 3 - - - __u32 - - - ``index`` - - - Identifies the frequency band, set by the application. - - - .. row 4 - - - __u32 - - - ``capability`` - - - :cspan:`2` The tuner/modulator capability flags for this - frequency band, see :ref:`tuner-capability`. The - ``V4L2_TUNER_CAP_LOW`` or ``V4L2_TUNER_CAP_1HZ`` 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. - - - .. row 5 - - - __u32 - - - ``rangelow`` - - - :cspan:`2` The lowest tunable frequency in units of 62.5 kHz, or - if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units - of 62.5 Hz, for this frequency band. A 1 Hz unit is used when the - ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. - - - .. row 6 - - - __u32 - - - ``rangehigh`` - - - :cspan:`2` The highest tunable frequency in units of 62.5 kHz, - or if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in - units of 62.5 Hz, for this frequency band. A 1 Hz unit is used - when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. - - - .. row 7 - - - __u32 - - - ``modulation`` - - - :cspan:`2` The supported modulation systems of this frequency - band. See :ref:`band-modulation`. - - .. note:: - - Currently only one modulation system per frequency band - is supported. More work will need to be done if multiple - modulation systems are possible. Contact the linux-media - mailing list - (`https://linuxtv.org/lists.php `__) - if you need such functionality. - - - .. row 8 - - - __u32 - - - ``reserved``\ [9] - - - Reserved for future extensions. - - Applications and drivers must set the array to zero. + Applications and drivers must set the array to zero. @@ -159,30 +119,15 @@ of the corresponding tuner/modulator is set. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_BAND_MODULATION_VSB`` - - - 0x02 - - - Vestigial Sideband modulation, used for analog TV. - - - .. row 2 - - - ``V4L2_BAND_MODULATION_FM`` - - - 0x04 - - - Frequency Modulation, commonly used for analog radio. - - - .. row 3 - - - ``V4L2_BAND_MODULATION_AM`` - - - 0x08 - - - Amplitude Modulation, commonly used for analog radio. + * - ``V4L2_BAND_MODULATION_VSB`` + - 0x02 + - Vestigial Sideband modulation, used for analog TV. + * - ``V4L2_BAND_MODULATION_FM`` + - 0x04 + - Frequency Modulation, commonly used for analog radio. + * - ``V4L2_BAND_MODULATION_AM`` + - 0x08 + - Amplitude Modulation, commonly used for analog radio. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst b/Documentation/media/uapi/v4l/vidioc-enuminput.rst index c38bde400dc1..17aaaf939757 100644 --- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst @@ -48,103 +48,58 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``index`` + - Identifies the input, set by the application. + * - __u8 + - ``name``\ [32] + - Name of the video input, a NUL-terminated ASCII string, for + example: "Vin (Composite 2)". This information is intended for the + user, preferably the connector label on the device itself. + * - __u32 + - ``type`` + - Type of the input, see :ref:`input-type`. + * - __u32 + - ``audioset`` + - Drivers can enumerate up to 32 video and audio inputs. This field + shows which audio inputs were selectable as audio source if this + was the currently selected video input. It is a bit mask. The LSB + corresponds to audio input 0, the MSB to input 31. Any number of + bits can be set, or none. - - .. row 1 + When the driver does not enumerate audio inputs no bits must be + set. Applications shall not interpret this as lack of audio + support. Some drivers automatically select audio sources and do + not enumerate them since there is no choice anyway. - - __u32 - - - ``index`` - - - Identifies the input, set by the application. - - - .. row 2 - - - __u8 - - - ``name``\ [32] - - - Name of the video input, a NUL-terminated ASCII string, for - example: "Vin (Composite 2)". This information is intended for the - user, preferably the connector label on the device itself. - - - .. row 3 - - - __u32 - - - ``type`` - - - Type of the input, see :ref:`input-type`. - - - .. row 4 - - - __u32 - - - ``audioset`` - - - Drivers can enumerate up to 32 video and audio inputs. This field - shows which audio inputs were selectable as audio source if this - was the currently selected video input. It is a bit mask. The LSB - corresponds to audio input 0, the MSB to input 31. Any number of - bits can be set, or none. - - When the driver does not enumerate audio inputs no bits must be - set. Applications shall not interpret this as lack of audio - support. Some drivers automatically select audio sources and do - not enumerate them since there is no choice anyway. - - For details on audio inputs and how to select the current input - see :ref:`audio`. - - - .. row 5 - - - __u32 - - - ``tuner`` - - - Capture devices can have zero or more tuners (RF demodulators). - When the ``type`` is set to ``V4L2_INPUT_TYPE_TUNER`` this is an - RF connector and this field identifies the tuner. It corresponds - to struct :c:type:`v4l2_tuner` field ``index``. For - details on tuners see :ref:`tuner`. - - - .. row 6 - - - :ref:`v4l2_std_id ` - - - ``std`` - - - Every video input supports one or more different video standards. - This field is a set of all supported standards. For details on - video standards and how to switch see :ref:`standard`. - - - .. row 7 - - - __u32 - - - ``status`` - - - This field provides status information about the input. See - :ref:`input-status` for flags. With the exception of the sensor - orientation bits ``status`` is only valid when this is the current - input. - - - .. row 8 - - - __u32 - - - ``capabilities`` - - - This field provides capabilities for the input. See - :ref:`input-capabilities` for flags. - - - .. row 9 - - - __u32 - - - ``reserved``\ [3] - - - Reserved for future extensions. Drivers must set the array to - zero. + For details on audio inputs and how to select the current input + see :ref:`audio`. + * - __u32 + - ``tuner`` + - Capture devices can have zero or more tuners (RF demodulators). + When the ``type`` is set to ``V4L2_INPUT_TYPE_TUNER`` this is an + RF connector and this field identifies the tuner. It corresponds + to struct :c:type:`v4l2_tuner` field ``index``. For + details on tuners see :ref:`tuner`. + * - :ref:`v4l2_std_id ` + - ``std`` + - Every video input supports one or more different video standards. + This field is a set of all supported standards. For details on + video standards and how to switch see :ref:`standard`. + * - __u32 + - ``status`` + - This field provides status information about the input. See + :ref:`input-status` for flags. With the exception of the sensor + orientation bits ``status`` is only valid when this is the current + input. + * - __u32 + - ``capabilities`` + - This field provides capabilities for the input. See + :ref:`input-capabilities` for flags. + * - __u32 + - ``reserved``\ [3] + - Reserved for future extensions. Drivers must set the array to + zero. @@ -157,31 +112,16 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_INPUT_TYPE_TUNER`` - - - 1 - - - This input uses a tuner (RF demodulator). - - - .. row 2 - - - ``V4L2_INPUT_TYPE_CAMERA`` - - - 2 - - - Analog baseband input, for example CVBS / Composite Video, - S-Video, RGB. - - - .. row 3 - - - ``V4L2_INPUT_TYPE_TOUCH`` - - - 3 - - - This input is a touch device for capturing raw touch data. + * - ``V4L2_INPUT_TYPE_TUNER`` + - 1 + - This input uses a tuner (RF demodulator). + * - ``V4L2_INPUT_TYPE_CAMERA`` + - 2 + - Analog baseband input, for example CVBS / Composite Video, + S-Video, RGB. + * - ``V4L2_INPUT_TYPE_TOUCH`` + - 3 + - This input is a touch device for capturing raw touch data. @@ -193,157 +133,67 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - :cspan:`2` General - - - .. row 2 - - - ``V4L2_IN_ST_NO_POWER`` - - - 0x00000001 - - - Attached device is off. - - - .. row 3 - - - ``V4L2_IN_ST_NO_SIGNAL`` - - - 0x00000002 - - - - - - .. row 4 - - - ``V4L2_IN_ST_NO_COLOR`` - - - 0x00000004 - - - The hardware supports color decoding, but does not detect color - modulation in the signal. - - - .. row 5 - - - :cspan:`2` Sensor Orientation - - - .. row 6 - - - ``V4L2_IN_ST_HFLIP`` - - - 0x00000010 - - - The input is connected to a device that produces a signal that is - flipped horizontally and does not correct this before passing the - signal to userspace. - - - .. row 7 - - - ``V4L2_IN_ST_VFLIP`` - - - 0x00000020 - - - The input is connected to a device that produces a signal that is - flipped vertically and does not correct this before passing the - signal to userspace. - .. note:: A 180 degree rotation is the same as HFLIP | VFLIP - - - .. row 8 - - - :cspan:`2` Analog Video - - - .. row 9 - - - ``V4L2_IN_ST_NO_H_LOCK`` - - - 0x00000100 - - - No horizontal sync lock. - - - .. row 10 - - - ``V4L2_IN_ST_COLOR_KILL`` - - - 0x00000200 - - - A color killer circuit automatically disables color decoding when - it detects no color modulation. When this flag is set the color - killer is enabled *and* has shut off color decoding. - - - .. row 11 - - - ``V4L2_IN_ST_NO_V_LOCK`` - - - 0x00000400 - - - No vertical sync lock. - - - .. row 12 - - - ``V4L2_IN_ST_NO_STD_LOCK`` - - - 0x00000800 - - - No standard format lock in case of auto-detection format - by the component. - - - .. row 13 - - - :cspan:`2` Digital Video - - - .. row 14 - - - ``V4L2_IN_ST_NO_SYNC`` - - - 0x00010000 - - - No synchronization lock. - - - .. row 15 - - - ``V4L2_IN_ST_NO_EQU`` - - - 0x00020000 - - - No equalizer lock. - - - .. row 16 - - - ``V4L2_IN_ST_NO_CARRIER`` - - - 0x00040000 - - - Carrier recovery failed. - - - .. row 17 - - - :cspan:`2` VCR and Set-Top Box - - - .. row 18 - - - ``V4L2_IN_ST_MACROVISION`` - - - 0x01000000 - - - Macrovision is an analog copy prevention system mangling the video - signal to confuse video recorders. When this flag is set - Macrovision has been detected. - - - .. row 19 - - - ``V4L2_IN_ST_NO_ACCESS`` - - - 0x02000000 - - - Conditional access denied. - - - .. row 20 - - - ``V4L2_IN_ST_VTR`` - - - 0x04000000 - - - VTR time constant. [?] + * - :cspan:`2` General + * - ``V4L2_IN_ST_NO_POWER`` + - 0x00000001 + - Attached device is off. + * - ``V4L2_IN_ST_NO_SIGNAL`` + - 0x00000002 + - + * - ``V4L2_IN_ST_NO_COLOR`` + - 0x00000004 + - The hardware supports color decoding, but does not detect color + modulation in the signal. + * - :cspan:`2` Sensor Orientation + * - ``V4L2_IN_ST_HFLIP`` + - 0x00000010 + - The input is connected to a device that produces a signal that is + flipped horizontally and does not correct this before passing the + signal to userspace. + * - ``V4L2_IN_ST_VFLIP`` + - 0x00000020 + - The input is connected to a device that produces a signal that is + flipped vertically and does not correct this before passing the + signal to userspace. + .. note:: A 180 degree rotation is the same as HFLIP | VFLIP + * - :cspan:`2` Analog Video + * - ``V4L2_IN_ST_NO_H_LOCK`` + - 0x00000100 + - No horizontal sync lock. + * - ``V4L2_IN_ST_COLOR_KILL`` + - 0x00000200 + - A color killer circuit automatically disables color decoding when + it detects no color modulation. When this flag is set the color + killer is enabled *and* has shut off color decoding. + * - ``V4L2_IN_ST_NO_V_LOCK`` + - 0x00000400 + - No vertical sync lock. + * - ``V4L2_IN_ST_NO_STD_LOCK`` + - 0x00000800 + - No standard format lock in case of auto-detection format + by the component. + * - :cspan:`2` Digital Video + * - ``V4L2_IN_ST_NO_SYNC`` + - 0x00010000 + - No synchronization lock. + * - ``V4L2_IN_ST_NO_EQU`` + - 0x00020000 + - No equalizer lock. + * - ``V4L2_IN_ST_NO_CARRIER`` + - 0x00040000 + - Carrier recovery failed. + * - :cspan:`2` VCR and Set-Top Box + * - ``V4L2_IN_ST_MACROVISION`` + - 0x01000000 + - Macrovision is an analog copy prevention system mangling the video + signal to confuse video recorders. When this flag is set + Macrovision has been detected. + * - ``V4L2_IN_ST_NO_ACCESS`` + - 0x02000000 + - Conditional access denied. + * - ``V4L2_IN_ST_VTR`` + - 0x04000000 + - VTR time constant. [?] @@ -356,34 +206,19 @@ at index zero, incrementing by one until the driver returns ``EINVAL``. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_IN_CAP_DV_TIMINGS`` - - - 0x00000002 - - - This input supports setting video timings by using - VIDIOC_S_DV_TIMINGS. - - - .. row 2 - - - ``V4L2_IN_CAP_STD`` - - - 0x00000004 - - - This input supports setting the TV standard by using - VIDIOC_S_STD. - - - .. row 3 - - - ``V4L2_IN_CAP_NATIVE_SIZE`` - - - 0x00000008 - - - This input supports setting the native size using the - ``V4L2_SEL_TGT_NATIVE_SIZE`` selection target, see - :ref:`v4l2-selections-common`. + * - ``V4L2_IN_CAP_DV_TIMINGS`` + - 0x00000002 + - This input supports setting video timings by using + VIDIOC_S_DV_TIMINGS. + * - ``V4L2_IN_CAP_STD`` + - 0x00000004 + - This input supports setting the TV standard by using + VIDIOC_S_STD. + * - ``V4L2_IN_CAP_NATIVE_SIZE`` + - 0x00000008 + - This input supports setting the native size using the + ``V4L2_SEL_TGT_NATIVE_SIZE`` selection target, see + :ref:`v4l2-selections-common`. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst index 763066ab99b6..d7dd2742475a 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumoutput.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumoutput.rst @@ -49,92 +49,52 @@ EINVAL. :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``index`` + - Identifies the output, set by the application. + * - __u8 + - ``name``\ [32] + - Name of the video output, a NUL-terminated ASCII string, for + example: "Vout". This information is intended for the user, + preferably the connector label on the device itself. + * - __u32 + - ``type`` + - Type of the output, see :ref:`output-type`. + * - __u32 + - ``audioset`` + - Drivers can enumerate up to 32 video and audio outputs. This field + shows which audio outputs were selectable as the current output if + this was the currently selected video output. It is a bit mask. + The LSB corresponds to audio output 0, the MSB to output 31. Any + number of bits can be set, or none. - - .. row 1 + When the driver does not enumerate audio outputs no bits must be + set. Applications shall not interpret this as lack of audio + support. Drivers may automatically select audio outputs without + enumerating them. - - __u32 - - - ``index`` - - - Identifies the output, set by the application. - - - .. row 2 - - - __u8 - - - ``name``\ [32] - - - Name of the video output, a NUL-terminated ASCII string, for - example: "Vout". This information is intended for the user, - preferably the connector label on the device itself. - - - .. row 3 - - - __u32 - - - ``type`` - - - Type of the output, see :ref:`output-type`. - - - .. row 4 - - - __u32 - - - ``audioset`` - - - Drivers can enumerate up to 32 video and audio outputs. This field - shows which audio outputs were selectable as the current output if - this was the currently selected video output. It is a bit mask. - The LSB corresponds to audio output 0, the MSB to output 31. Any - number of bits can be set, or none. - - When the driver does not enumerate audio outputs no bits must be - set. Applications shall not interpret this as lack of audio - support. Drivers may automatically select audio outputs without - enumerating them. - - For details on audio outputs and how to select the current output - see :ref:`audio`. - - - .. row 5 - - - __u32 - - - ``modulator`` - - - Output devices can have zero or more RF modulators. When the - ``type`` is ``V4L2_OUTPUT_TYPE_MODULATOR`` this is an RF connector - and this field identifies the modulator. It corresponds to struct - :c:type:`v4l2_modulator` field ``index``. For - details on modulators see :ref:`tuner`. - - - .. row 6 - - - :ref:`v4l2_std_id ` - - - ``std`` - - - Every video output supports one or more different video standards. - This field is a set of all supported standards. For details on - video standards and how to switch see :ref:`standard`. - - - .. row 7 - - - __u32 - - - ``capabilities`` - - - This field provides capabilities for the output. See - :ref:`output-capabilities` for flags. - - - .. row 8 - - - __u32 - - - ``reserved``\ [3] - - - Reserved for future extensions. Drivers must set the array to - zero. + For details on audio outputs and how to select the current output + see :ref:`audio`. + * - __u32 + - ``modulator`` + - Output devices can have zero or more RF modulators. When the + ``type`` is ``V4L2_OUTPUT_TYPE_MODULATOR`` this is an RF connector + and this field identifies the modulator. It corresponds to struct + :c:type:`v4l2_modulator` field ``index``. For + details on modulators see :ref:`tuner`. + * - :ref:`v4l2_std_id ` + - ``std`` + - Every video output supports one or more different video standards. + This field is a set of all supported standards. For details on + video standards and how to switch see :ref:`standard`. + * - __u32 + - ``capabilities`` + - This field provides capabilities for the output. See + :ref:`output-capabilities` for flags. + * - __u32 + - ``reserved``\ [3] + - Reserved for future extensions. Drivers must set the array to + zero. @@ -147,31 +107,16 @@ EINVAL. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_OUTPUT_TYPE_MODULATOR`` - - - 1 - - - This output is an analog TV modulator. - - - .. row 2 - - - ``V4L2_OUTPUT_TYPE_ANALOG`` - - - 2 - - - Analog baseband output, for example Composite / CVBS, S-Video, - RGB. - - - .. row 3 - - - ``V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY`` - - - 3 - - - [?] + * - ``V4L2_OUTPUT_TYPE_MODULATOR`` + - 1 + - This output is an analog TV modulator. + * - ``V4L2_OUTPUT_TYPE_ANALOG`` + - 2 + - Analog baseband output, for example Composite / CVBS, S-Video, + RGB. + * - ``V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY`` + - 3 + - [?] @@ -184,34 +129,19 @@ EINVAL. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_OUT_CAP_DV_TIMINGS`` - - - 0x00000002 - - - This output supports setting video timings by using - VIDIOC_S_DV_TIMINGS. - - - .. row 2 - - - ``V4L2_OUT_CAP_STD`` - - - 0x00000004 - - - This output supports setting the TV standard by using - VIDIOC_S_STD. - - - .. row 3 - - - ``V4L2_OUT_CAP_NATIVE_SIZE`` - - - 0x00000008 - - - This output supports setting the native size using the - ``V4L2_SEL_TGT_NATIVE_SIZE`` selection target, see - :ref:`v4l2-selections-common`. + * - ``V4L2_OUT_CAP_DV_TIMINGS`` + - 0x00000002 + - This output supports setting video timings by using + VIDIOC_S_DV_TIMINGS. + * - ``V4L2_OUT_CAP_STD`` + - 0x00000004 + - This output supports setting the TV standard by using + VIDIOC_S_STD. + * - ``V4L2_OUT_CAP_NATIVE_SIZE`` + - 0x00000008 + - This output supports setting the native size using the + ``V4L2_SEL_TGT_NATIVE_SIZE`` selection target, see + :ref:`v4l2-selections-common`. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-enumstd.rst b/Documentation/media/uapi/v4l/vidioc-enumstd.rst index 7a882cd8f944..f2bdd45cfa0d 100644 --- a/Documentation/media/uapi/v4l/vidioc-enumstd.rst +++ b/Documentation/media/uapi/v4l/vidioc-enumstd.rst @@ -51,64 +51,34 @@ or output. [#f1]_ :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``index`` - - - Number of the video standard, set by the application. - - - .. row 2 - - - :ref:`v4l2_std_id ` - - - ``id`` - - - The bits in this field identify the standard as one of the common - standards listed in :ref:`v4l2-std-id`, or if bits 32 to 63 are - set as custom standards. Multiple bits can be set if the hardware - does not distinguish between these standards, however separate - indices do not indicate the opposite. The ``id`` must be unique. - No other enumerated struct :c:type:`v4l2_standard` structure, - for this input or output anyway, can contain the same set of bits. - - - .. row 3 - - - __u8 - - - ``name``\ [24] - - - Name of the standard, a NUL-terminated ASCII string, for example: - "PAL-B/G", "NTSC Japan". This information is intended for the - user. - - - .. row 4 - - - struct :c:type:`v4l2_fract` - - - ``frameperiod`` - - - The frame period (not field period) is numerator / denominator. - For example M/NTSC has a frame period of 1001 / 30000 seconds. - - - .. row 5 - - - __u32 - - - ``framelines`` - - - Total lines per frame including blanking, e. g. 625 for B/PAL. - - - .. row 6 - - - __u32 - - - ``reserved``\ [4] - - - Reserved for future extensions. Drivers must set the array to - zero. + * - __u32 + - ``index`` + - Number of the video standard, set by the application. + * - :ref:`v4l2_std_id ` + - ``id`` + - The bits in this field identify the standard as one of the common + standards listed in :ref:`v4l2-std-id`, or if bits 32 to 63 are + set as custom standards. Multiple bits can be set if the hardware + does not distinguish between these standards, however separate + indices do not indicate the opposite. The ``id`` must be unique. + No other enumerated struct :c:type:`v4l2_standard` structure, + for this input or output anyway, can contain the same set of bits. + * - __u8 + - ``name``\ [24] + - Name of the standard, a NUL-terminated ASCII string, for example: + "PAL-B/G", "NTSC Japan". This information is intended for the + user. + * - struct :c:type:`v4l2_fract` + - ``frameperiod`` + - The frame period (not field period) is numerator / denominator. + For example M/NTSC has a frame period of 1001 / 30000 seconds. + * - __u32 + - ``framelines`` + - Total lines per frame including blanking, e. g. 625 for B/PAL. + * - __u32 + - ``reserved``\ [4] + - Reserved for future extensions. Drivers must set the array to + zero. @@ -121,22 +91,12 @@ or output. [#f1]_ :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``numerator`` - - - - - - .. row 2 - - - __u32 - - - ``denominator`` - - - + * - __u32 + - ``numerator`` + - + * - __u32 + - ``denominator`` + - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -148,17 +108,12 @@ or output. [#f1]_ :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u64 - - - ``v4l2_std_id`` - - - This type is a set, each bit representing another video standard - as listed below and in :ref:`video-standards`. The 32 most - significant bits are reserved for custom (driver defined) video - standards. + * - __u64 + - ``v4l2_std_id`` + - This type is a set, each bit representing another video standard + as listed below and in :ref:`video-standards`. The 32 most + significant bits are reserved for custom (driver defined) video + standards. @@ -282,120 +237,59 @@ support digital TV. See also the Linux DVB API at :header-rows: 1 :stub-columns: 0 + * - Characteristics + - M/NTSC [#f2]_ + - M/PAL + - N/PAL [#f3]_ + - B, B1, G/PAL + - D, D1, K/PAL + - H/PAL + - I/PAL + - B, G/SECAM + - D, K/SECAM + - K1/SECAM + - L/SECAM + * - Frame lines + - :cspan:`1` 525 + - :cspan:`8` 625 + * - Frame period (s) + - :cspan:`1` 1001/30000 + - :cspan:`8` 1/25 + * - Chrominance sub-carrier frequency (Hz) + - 3579545 ± 10 + - 3579611.49 ± 10 + - 4433618.75 ± 5 - - .. row 1 + (3582056.25 ± 5) + - :cspan:`3` 4433618.75 ± 5 + - 4433618.75 ± 1 + - :cspan:`2` f\ :sub:`OR` = 4406250 ± 2000, - - Characteristics - - - M/NTSC [#f2]_ - - - M/PAL - - - N/PAL [#f3]_ - - - B, B1, G/PAL - - - D, D1, K/PAL - - - H/PAL - - - I/PAL - - - B, G/SECAM - - - D, K/SECAM - - - K1/SECAM - - - L/SECAM - - - .. row 2 - - - Frame lines - - - :cspan:`1` 525 - - - :cspan:`8` 625 - - - .. row 3 - - - Frame period (s) - - - :cspan:`1` 1001/30000 - - - :cspan:`8` 1/25 - - - .. row 4 - - - Chrominance sub-carrier frequency (Hz) - - - 3579545 ± 10 - - - 3579611.49 ± 10 - - - 4433618.75 ± 5 - - (3582056.25 ± 5) - - - :cspan:`3` 4433618.75 ± 5 - - - 4433618.75 ± 1 - - - :cspan:`2` f\ :sub:`OR` = 4406250 ± 2000, - - f\ :sub:`OB` = 4250000 ± 2000 - - - .. row 5 - - - Nominal radio-frequency channel bandwidth (MHz) - - - 6 - - - 6 - - - 6 - - - B: 7; B1, G: 8 - - - 8 - - - 8 - - - 8 - - - 8 - - - 8 - - - 8 - - - 8 - - - .. row 6 - - - Sound carrier relative to vision carrier (MHz) - - - 4.5 - - - 4.5 - - - 4.5 - - - 5.5 ± 0.001 [#f4]_ [#f5]_ [#f6]_ [#f7]_ - - - 6.5 ± 0.001 - - - 5.5 - - - 5.9996 ± 0.0005 - - - 5.5 ± 0.001 - - - 6.5 ± 0.001 - - - 6.5 - - - 6.5 [#f8]_ + f\ :sub:`OB` = 4250000 ± 2000 + * - Nominal radio-frequency channel bandwidth (MHz) + - 6 + - 6 + - 6 + - B: 7; B1, G: 8 + - 8 + - 8 + - 8 + - 8 + - 8 + - 8 + - 8 + * - Sound carrier relative to vision carrier (MHz) + - 4.5 + - 4.5 + - 4.5 + - 5.5 ± 0.001 [#f4]_ [#f5]_ [#f6]_ [#f7]_ + - 6.5 ± 0.001 + - 5.5 + - 5.9996 ± 0.0005 + - 5.5 ± 0.001 + - 6.5 ± 0.001 + - 6.5 + - 6.5 [#f8]_ .. raw:: latex diff --git a/Documentation/media/uapi/v4l/vidioc-expbuf.rst b/Documentation/media/uapi/v4l/vidioc-expbuf.rst index 2ae2f5483351..246e48028d40 100644 --- a/Documentation/media/uapi/v4l/vidioc-expbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-expbuf.rst @@ -123,66 +123,36 @@ Examples :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``type`` - - - Type of the buffer, same as struct - :c:type:`v4l2_format` ``type`` or struct - :c:type:`v4l2_requestbuffers` ``type``, set - by the application. See :c:type:`v4l2_buf_type` - - - .. row 2 - - - __u32 - - - ``index`` - - - Number of the buffer, set by the application. This field is only - used for :ref:`memory mapping ` I/O and can range from - zero to the number of buffers allocated with the - :ref:`VIDIOC_REQBUFS` and/or - :ref:`VIDIOC_CREATE_BUFS` ioctls. - - - .. row 3 - - - __u32 - - - ``plane`` - - - Index of the plane to be exported when using the multi-planar API. - Otherwise this value must be set to zero. - - - .. row 4 - - - __u32 - - - ``flags`` - - - Flags for the newly created file, currently only ``O_CLOEXEC``, - ``O_RDONLY``, ``O_WRONLY``, and ``O_RDWR`` are supported, refer to - the manual of open() for more details. - - - .. row 5 - - - __s32 - - - ``fd`` - - - The DMABUF file descriptor associated with a buffer. Set by the - driver. - - - .. row 6 - - - __u32 - - - ``reserved[11]`` - - - Reserved field for future use. Drivers and applications must set - the array to zero. + * - __u32 + - ``type`` + - Type of the buffer, same as struct + :c:type:`v4l2_format` ``type`` or struct + :c:type:`v4l2_requestbuffers` ``type``, set + by the application. See :c:type:`v4l2_buf_type` + * - __u32 + - ``index`` + - Number of the buffer, set by the application. This field is only + used for :ref:`memory mapping ` I/O and can range from + zero to the number of buffers allocated with the + :ref:`VIDIOC_REQBUFS` and/or + :ref:`VIDIOC_CREATE_BUFS` ioctls. + * - __u32 + - ``plane`` + - Index of the plane to be exported when using the multi-planar API. + Otherwise this value must be set to zero. + * - __u32 + - ``flags`` + - Flags for the newly created file, currently only ``O_CLOEXEC``, + ``O_RDONLY``, ``O_WRONLY``, and ``O_RDWR`` are supported, refer to + the manual of open() for more details. + * - __s32 + - ``fd`` + - The DMABUF file descriptor associated with a buffer. Set by the + driver. + * - __u32 + - ``reserved[11]`` + - Reserved field for future use. Drivers and applications must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-audio.rst b/Documentation/media/uapi/v4l/vidioc-g-audio.rst index 60520318cb4a..5b67e81a0db6 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audio.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audio.rst @@ -58,50 +58,25 @@ return the actual new audio mode. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``index`` - - - Identifies the audio input, set by the driver or application. - - - .. row 2 - - - __u8 - - - ``name``\ [32] - - - Name of the audio input, a NUL-terminated ASCII string, for - example: "Line In". This information is intended for the user, - preferably the connector label on the device itself. - - - .. row 3 - - - __u32 - - - ``capability`` - - - Audio capability flags, see :ref:`audio-capability`. - - - .. row 4 - - - __u32 - - - ``mode`` - - - Audio mode flags set by drivers and applications (on - :ref:`VIDIOC_S_AUDIO ` ioctl), see :ref:`audio-mode`. - - - .. row 5 - - - __u32 - - - ``reserved``\ [2] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + * - __u32 + - ``index`` + - Identifies the audio input, set by the driver or application. + * - __u8 + - ``name``\ [32] + - Name of the audio input, a NUL-terminated ASCII string, for + example: "Line In". This information is intended for the user, + preferably the connector label on the device itself. + * - __u32 + - ``capability`` + - Audio capability flags, see :ref:`audio-capability`. + * - __u32 + - ``mode`` + - Audio mode flags set by drivers and applications (on + :ref:`VIDIOC_S_AUDIO ` ioctl), see :ref:`audio-mode`. + * - __u32 + - ``reserved``\ [2] + - Reserved for future extensions. Drivers and applications must set + the array to zero. @@ -114,25 +89,15 @@ return the actual new audio mode. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_AUDCAP_STEREO`` - - - 0x00001 - - - This is a stereo input. The flag is intended to automatically - disable stereo recording etc. when the signal is always monaural. - The API provides no means to detect if stereo is *received*, - unless the audio input belongs to a tuner. - - - .. row 2 - - - ``V4L2_AUDCAP_AVL`` - - - 0x00002 - - - Automatic Volume Level mode is supported. + * - ``V4L2_AUDCAP_STEREO`` + - 0x00001 + - This is a stereo input. The flag is intended to automatically + disable stereo recording etc. when the signal is always monaural. + The API provides no means to detect if stereo is *received*, + unless the audio input belongs to a tuner. + * - ``V4L2_AUDCAP_AVL`` + - 0x00002 + - Automatic Volume Level mode is supported. @@ -145,14 +110,9 @@ return the actual new audio mode. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_AUDMODE_AVL`` - - - 0x00001 - - - AVL mode is on. + * - ``V4L2_AUDMODE_AVL`` + - 0x00001 + - AVL mode is on. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst index e9d264590788..d16ecbaddc59 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-audioout.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-audioout.rst @@ -65,51 +65,26 @@ as ``VIDIOC_G_AUDOUT`` does. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``index`` - - - Identifies the audio output, set by the driver or application. - - - .. row 2 - - - __u8 - - - ``name``\ [32] - - - Name of the audio output, a NUL-terminated ASCII string, for - example: "Line Out". This information is intended for the user, - preferably the connector label on the device itself. - - - .. row 3 - - - __u32 - - - ``capability`` - - - Audio capability flags, none defined yet. Drivers must set this - field to zero. - - - .. row 4 - - - __u32 - - - ``mode`` - - - Audio mode, none defined yet. Drivers and applications (on - ``VIDIOC_S_AUDOUT``) must set this field to zero. - - - .. row 5 - - - __u32 - - - ``reserved``\ [2] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + * - __u32 + - ``index`` + - Identifies the audio output, set by the driver or application. + * - __u8 + - ``name``\ [32] + - Name of the audio output, a NUL-terminated ASCII string, for + example: "Line Out". This information is intended for the user, + preferably the connector label on the device itself. + * - __u32 + - ``capability`` + - Audio capability flags, none defined yet. Drivers must set this + field to zero. + * - __u32 + - ``mode`` + - Audio mode, none defined yet. Drivers and applications (on + ``VIDIOC_S_AUDOUT``) must set this field to zero. + * - __u32 + - ``reserved``\ [2] + - Reserved for future extensions. Drivers and applications must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-g-crop.rst index 9b24ca591ea4..56a36340f565 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-crop.rst @@ -84,26 +84,16 @@ When cropping is not supported then no parameters are changed and :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``type`` - - - Type of the data stream, set by the application. Only these types - are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, - ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` and - ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. - - - .. row 2 - - - struct :c:type:`v4l2_rect` - - - ``c`` - - - Cropping rectangle. The same co-ordinate system as for struct - :c:type:`v4l2_cropcap` ``bounds`` is used. + * - __u32 + - ``type`` + - Type of the data stream, set by the application. Only these types + are valid here: ``V4L2_BUF_TYPE_VIDEO_CAPTURE``, + ``V4L2_BUF_TYPE_VIDEO_OUTPUT`` and + ``V4L2_BUF_TYPE_VIDEO_OVERLAY``. See :c:type:`v4l2_buf_type`. + * - struct :c:type:`v4l2_rect` + - ``c`` + - Cropping rectangle. The same co-ordinate system as for struct + :c:type:`v4l2_cropcap` ``bounds`` is used. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst index 78c191a89360..d8a379182a34 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ctrl.rst @@ -64,22 +64,12 @@ These ioctls work only with user controls. For other control classes the :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``id`` - - - Identifies the control, set by the application. - - - .. row 2 - - - __s32 - - - ``value`` - - - New value or current value. + * - __u32 + - ``id`` + - Identifies the control, set by the application. + * - __s32 + - ``value`` + - New value or current value. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst index f1afed7a5958..7dd943ff14cd 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst @@ -83,158 +83,73 @@ EBUSY :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``width`` - - - Width of the active video in pixels. - - - .. row 2 - - - __u32 - - - ``height`` - - - Height of the active video frame in lines. So for interlaced - formats the height of the active video in each field is - ``height``/2. - - - .. row 3 - - - __u32 - - - ``interlaced`` - - - Progressive (``V4L2_DV_PROGRESSIVE``) or interlaced (``V4L2_DV_INTERLACED``). - - - .. row 4 - - - __u32 - - - ``polarities`` - - - This is a bit mask that defines polarities of sync signals. bit 0 - (``V4L2_DV_VSYNC_POS_POL``) is for vertical sync polarity and bit - 1 (``V4L2_DV_HSYNC_POS_POL``) is for horizontal sync polarity. If - the bit is set (1) it is positive polarity and if is cleared (0), - it is negative polarity. - - - .. row 5 - - - __u64 - - - ``pixelclock`` - - - Pixel clock in Hz. Ex. 74.25MHz->74250000 - - - .. row 6 - - - __u32 - - - ``hfrontporch`` - - - Horizontal front porch in pixels - - - .. row 7 - - - __u32 - - - ``hsync`` - - - Horizontal sync length in pixels - - - .. row 8 - - - __u32 - - - ``hbackporch`` - - - Horizontal back porch in pixels - - - .. row 9 - - - __u32 - - - ``vfrontporch`` - - - Vertical front porch in lines. For interlaced formats this refers - to the odd field (aka field 1). - - - .. row 10 - - - __u32 - - - ``vsync`` - - - Vertical sync length in lines. For interlaced formats this refers - to the odd field (aka field 1). - - - .. row 11 - - - __u32 - - - ``vbackporch`` - - - Vertical back porch in lines. For interlaced formats this refers - to the odd field (aka field 1). - - - .. row 12 - - - __u32 - - - ``il_vfrontporch`` - - - Vertical front porch in lines for the even field (aka field 2) of - interlaced field formats. Must be 0 for progressive formats. - - - .. row 13 - - - __u32 - - - ``il_vsync`` - - - Vertical sync length in lines for the even field (aka field 2) of - interlaced field formats. Must be 0 for progressive formats. - - - .. row 14 - - - __u32 - - - ``il_vbackporch`` - - - Vertical back porch in lines for the even field (aka field 2) of - interlaced field formats. Must be 0 for progressive formats. - - - .. row 15 - - - __u32 - - - ``standards`` - - - The video standard(s) this format belongs to. This will be filled - in by the driver. Applications must set this to 0. See - :ref:`dv-bt-standards` for a list of standards. - - - .. row 16 - - - __u32 - - - ``flags`` - - - Several flags giving more information about the format. See - :ref:`dv-bt-flags` for a description of the flags. - - - .. row 17 - - - __u32 - - - ``reserved[14]`` - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + * - __u32 + - ``width`` + - Width of the active video in pixels. + * - __u32 + - ``height`` + - Height of the active video frame in lines. So for interlaced + formats the height of the active video in each field is + ``height``/2. + * - __u32 + - ``interlaced`` + - Progressive (``V4L2_DV_PROGRESSIVE``) or interlaced (``V4L2_DV_INTERLACED``). + * - __u32 + - ``polarities`` + - This is a bit mask that defines polarities of sync signals. bit 0 + (``V4L2_DV_VSYNC_POS_POL``) is for vertical sync polarity and bit + 1 (``V4L2_DV_HSYNC_POS_POL``) is for horizontal sync polarity. If + the bit is set (1) it is positive polarity and if is cleared (0), + it is negative polarity. + * - __u64 + - ``pixelclock`` + - Pixel clock in Hz. Ex. 74.25MHz->74250000 + * - __u32 + - ``hfrontporch`` + - Horizontal front porch in pixels + * - __u32 + - ``hsync`` + - Horizontal sync length in pixels + * - __u32 + - ``hbackporch`` + - Horizontal back porch in pixels + * - __u32 + - ``vfrontporch`` + - Vertical front porch in lines. For interlaced formats this refers + to the odd field (aka field 1). + * - __u32 + - ``vsync`` + - Vertical sync length in lines. For interlaced formats this refers + to the odd field (aka field 1). + * - __u32 + - ``vbackporch`` + - Vertical back porch in lines. For interlaced formats this refers + to the odd field (aka field 1). + * - __u32 + - ``il_vfrontporch`` + - Vertical front porch in lines for the even field (aka field 2) of + interlaced field formats. Must be 0 for progressive formats. + * - __u32 + - ``il_vsync`` + - Vertical sync length in lines for the even field (aka field 2) of + interlaced field formats. Must be 0 for progressive formats. + * - __u32 + - ``il_vbackporch`` + - Vertical back porch in lines for the even field (aka field 2) of + interlaced field formats. Must be 0 for progressive formats. + * - __u32 + - ``standards`` + - The video standard(s) this format belongs to. This will be filled + in by the driver. Applications must set this to 0. See + :ref:`dv-bt-standards` for a list of standards. + * - __u32 + - ``flags`` + - Several flags giving more information about the format. See + :ref:`dv-bt-flags` for a description of the flags. + * - __u32 + - ``reserved[14]`` + - Reserved for future extensions. Drivers and applications must set + the array to zero. .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| @@ -246,40 +161,21 @@ EBUSY :stub-columns: 0 :widths: 1 1 2 1 - - - .. row 1 - - - __u32 - - - ``type`` - - - - - Type of DV timings as listed in :ref:`dv-timing-types`. - - - .. row 2 - - - union - - - - - - - - .. row 3 - - - - - struct :c:type:`v4l2_bt_timings` - - - ``bt`` - - - Timings defined by BT.656/1120 specifications - - - .. row 4 - - - - - __u32 - - - ``reserved``\ [32] - - - + * - __u32 + - ``type`` + - + - Type of DV timings as listed in :ref:`dv-timing-types`. + * - union + - + - + * - + - struct :c:type:`v4l2_bt_timings` + - ``bt`` + - Timings defined by BT.656/1120 specifications + * - + - __u32 + - ``reserved``\ [32] + - .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| @@ -290,28 +186,15 @@ EBUSY :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - Timing type - - - value - - - Description - - - .. row 2 - - - - - - - - - - .. row 3 - - - ``V4L2_DV_BT_656_1120`` - - - 0 - - - BT.656/1120 timings + * - Timing type + - value + - Description + * - + - + - + * - ``V4L2_DV_BT_656_1120`` + - 0 + - BT.656/1120 timings @@ -321,44 +204,20 @@ EBUSY :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - Timing standard - - - Description - - - .. row 3 - - - ``V4L2_DV_BT_STD_CEA861`` - - - The timings follow the CEA-861 Digital TV Profile standard - - - .. row 4 - - - ``V4L2_DV_BT_STD_DMT`` - - - The timings follow the VESA Discrete Monitor Timings standard - - - .. row 5 - - - ``V4L2_DV_BT_STD_CVT`` - - - The timings follow the VESA Coordinated Video Timings standard - - - .. row 6 - - - ``V4L2_DV_BT_STD_GTF`` - - - The timings follow the VESA Generalized Timings Formula standard - - - .. row 7 - - - ``V4L2_DV_BT_STD_SDI`` - - - The timings follow the SDI Timings standard. - There are no horizontal syncs/porches at all in this format. - Total blanking timings must be set in hsync or vsync fields only. + * - Timing standard + - Description + * - ``V4L2_DV_BT_STD_CEA861`` + - The timings follow the CEA-861 Digital TV Profile standard + * - ``V4L2_DV_BT_STD_DMT`` + - The timings follow the VESA Discrete Monitor Timings standard + * - ``V4L2_DV_BT_STD_CVT`` + - The timings follow the VESA Coordinated Video Timings standard + * - ``V4L2_DV_BT_STD_GTF`` + - The timings follow the VESA Generalized Timings Formula standard + * - ``V4L2_DV_BT_STD_SDI`` + - The timings follow the SDI Timings standard. + There are no horizontal syncs/porches at all in this format. + Total blanking timings must be set in hsync or vsync fields only. .. tabularcolumns:: |p{6.0cm}|p{11.5cm}| @@ -368,74 +227,46 @@ EBUSY :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - Flag - - - Description - - - .. row 3 - - - ``V4L2_DV_FL_REDUCED_BLANKING`` - - - CVT/GTF specific: the timings use reduced blanking (CVT) or the - 'Secondary GTF' curve (GTF). In both cases the horizontal and/or - vertical blanking intervals are reduced, allowing a higher - resolution over the same bandwidth. This is a read-only flag, - applications must not set this. - - - .. row 4 - - - ``V4L2_DV_FL_CAN_REDUCE_FPS`` - - - CEA-861 specific: set for CEA-861 formats with a framerate that is - a multiple of six. These formats can be optionally played at 1 / - 1.001 speed to be compatible with 60 Hz based standards such as - NTSC and PAL-M that use a framerate of 29.97 frames per second. If - the transmitter can't generate such frequencies, then the flag - will also be cleared. This is a read-only flag, applications must - not set this. - - - .. row 5 - - - ``V4L2_DV_FL_REDUCED_FPS`` - - - CEA-861 specific: only valid for video transmitters, the flag is - cleared by receivers. It is also only valid for formats with the - ``V4L2_DV_FL_CAN_REDUCE_FPS`` flag set, for other formats the - flag will be cleared by the driver. If the application sets this - flag, then the pixelclock used to set up the transmitter is - divided by 1.001 to make it compatible with NTSC framerates. If - the transmitter can't generate such frequencies, then the flag - will also be cleared. - - - .. row 6 - - - ``V4L2_DV_FL_HALF_LINE`` - - - Specific to interlaced formats: if set, then the vertical - frontporch of field 1 (aka the odd field) is really one half-line - longer and the vertical backporch of field 2 (aka the even field) - is really one half-line shorter, so each field has exactly the - same number of half-lines. Whether half-lines can be detected or - used depends on the hardware. - - - .. row 7 - - - ``V4L2_DV_FL_IS_CE_VIDEO`` - - - If set, then this is a Consumer Electronics (CE) video format. - Such formats differ from other formats (commonly called IT - formats) in that if R'G'B' encoding is used then by default the - R'G'B' values use limited range (i.e. 16-235) as opposed to full - range (i.e. 0-255). All formats defined in CEA-861 except for the - 640x480p59.94 format are CE formats. - - - .. row 8 - - - ``V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE`` - - - Some formats like SMPTE-125M have an interlaced signal with a odd - total height. For these formats, if this flag is set, the first - field has the extra line. Else, it is the second field. + * - Flag + - Description + * - ``V4L2_DV_FL_REDUCED_BLANKING`` + - CVT/GTF specific: the timings use reduced blanking (CVT) or the + 'Secondary GTF' curve (GTF). In both cases the horizontal and/or + vertical blanking intervals are reduced, allowing a higher + resolution over the same bandwidth. This is a read-only flag, + applications must not set this. + * - ``V4L2_DV_FL_CAN_REDUCE_FPS`` + - CEA-861 specific: set for CEA-861 formats with a framerate that is + a multiple of six. These formats can be optionally played at 1 / + 1.001 speed to be compatible with 60 Hz based standards such as + NTSC and PAL-M that use a framerate of 29.97 frames per second. If + the transmitter can't generate such frequencies, then the flag + will also be cleared. This is a read-only flag, applications must + not set this. + * - ``V4L2_DV_FL_REDUCED_FPS`` + - CEA-861 specific: only valid for video transmitters, the flag is + cleared by receivers. It is also only valid for formats with the + ``V4L2_DV_FL_CAN_REDUCE_FPS`` flag set, for other formats the + flag will be cleared by the driver. If the application sets this + flag, then the pixelclock used to set up the transmitter is + divided by 1.001 to make it compatible with NTSC framerates. If + the transmitter can't generate such frequencies, then the flag + will also be cleared. + * - ``V4L2_DV_FL_HALF_LINE`` + - Specific to interlaced formats: if set, then the vertical + frontporch of field 1 (aka the odd field) is really one half-line + longer and the vertical backporch of field 2 (aka the even field) + is really one half-line shorter, so each field has exactly the + same number of half-lines. Whether half-lines can be detected or + used depends on the hardware. + * - ``V4L2_DV_FL_IS_CE_VIDEO`` + - If set, then this is a Consumer Electronics (CE) video format. + Such formats differ from other formats (commonly called IT + formats) in that if R'G'B' encoding is used then by default the + R'G'B' values use limited range (i.e. 16-235) as opposed to full + range (i.e. 0-255). All formats defined in CEA-861 except for the + 640x480p59.94 format are CE formats. + * - ``V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE`` + - Some formats like SMPTE-125M have an interlaced signal with a odd + total height. For these formats, if this flag is set, the first + field has the extra line. Else, it is the second field. diff --git a/Documentation/media/uapi/v4l/vidioc-g-edid.rst b/Documentation/media/uapi/v4l/vidioc-g-edid.rst index 1fffca7cc38f..a16a193a1cbf 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-edid.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-edid.rst @@ -106,55 +106,30 @@ EDID is no longer available. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``pad`` - - - 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 :ref:`VIDIOC_ENUMINPUT` and - :ref:`VIDIOC_ENUMOUTPUT` respectively. - - - .. row 2 - - - __u32 - - - ``start_block`` - - - Read the EDID from starting with this block. Must be 0 when - setting the EDID. - - - .. row 3 - - - __u32 - - - ``blocks`` - - - The number of blocks to get or set. Must be less or equal to 256 - (the maximum number of blocks as defined by the standard). When - you set the EDID and ``blocks`` is 0, then the EDID is disabled or - erased. - - - .. row 4 - - - __u32 - - - ``reserved``\ [5] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. - - - .. row 5 - - - __u8 * - - - ``edid`` - - - Pointer to memory that contains the EDID. The minimum size is - ``blocks`` * 128. + * - __u32 + - ``pad`` + - 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 :ref:`VIDIOC_ENUMINPUT` and + :ref:`VIDIOC_ENUMOUTPUT` respectively. + * - __u32 + - ``start_block`` + - Read the EDID from starting with this block. Must be 0 when + setting the EDID. + * - __u32 + - ``blocks`` + - The number of blocks to get or set. Must be less or equal to 256 + (the maximum number of blocks as defined by the standard). When + you set the EDID and ``blocks`` is 0, then the EDID is disabled or + erased. + * - __u32 + - ``reserved``\ [5] + - Reserved for future extensions. Applications and drivers must set + the array to zero. + * - __u8 * + - ``edid`` + - Pointer to memory that contains the EDID. The minimum size is + ``blocks`` * 128. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst index 6b5727439db2..418e886fd44b 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-enc-index.rst @@ -64,42 +64,22 @@ video elementary streams. :stub-columns: 0 :widths: 1 3 8 - - - .. row 1 - - - __u32 - - - ``entries`` - - - The number of entries the driver stored in the ``entry`` array. - - - .. row 2 - - - __u32 - - - ``entries_cap`` - - - The number of entries the driver can buffer. Must be greater than - zero. - - - .. row 3 - - - __u32 - - - ``reserved``\ [4] - - - Reserved for future extensions. Drivers must set the - array to zero. - - - .. row 4 - - - struct :c:type:`v4l2_enc_idx_entry` - - - ``entry``\ [``V4L2_ENC_IDX_ENTRIES``] - - - Meta data about a compressed video stream. Each element of the - array corresponds to one picture, sorted in ascending order by - their ``offset``. + * - __u32 + - ``entries`` + - The number of entries the driver stored in the ``entry`` array. + * - __u32 + - ``entries_cap`` + - The number of entries the driver can buffer. Must be greater than + zero. + * - __u32 + - ``reserved``\ [4] + - Reserved for future extensions. Drivers must set the + array to zero. + * - struct :c:type:`v4l2_enc_idx_entry` + - ``entry``\ [``V4L2_ENC_IDX_ENTRIES``] + - Meta data about a compressed video stream. Each element of the + array corresponds to one picture, sorted in ascending order by + their ``offset``. @@ -112,53 +92,28 @@ video elementary streams. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u64 - - - ``offset`` - - - The offset in bytes from the beginning of the compressed video - stream to the beginning of this picture, that is a *PES packet - header* as defined in :ref:`mpeg2part1` or a *picture header* as - defined in :ref:`mpeg2part2`. When the encoder is stopped, the - driver resets the offset to zero. - - - .. row 2 - - - __u64 - - - ``pts`` - - - The 33 bit *Presentation Time Stamp* of this picture as defined in - :ref:`mpeg2part1`. - - - .. row 3 - - - __u32 - - - ``length`` - - - The length of this picture in bytes. - - - .. row 4 - - - __u32 - - - ``flags`` - - - Flags containing the coding type of this picture, see - :ref:`enc-idx-flags`. - - - .. row 5 - - - __u32 - - - ``reserved``\ [2] - - - Reserved for future extensions. Drivers must set the array to - zero. + * - __u64 + - ``offset`` + - The offset in bytes from the beginning of the compressed video + stream to the beginning of this picture, that is a *PES packet + header* as defined in :ref:`mpeg2part1` or a *picture header* as + defined in :ref:`mpeg2part2`. When the encoder is stopped, the + driver resets the offset to zero. + * - __u64 + - ``pts`` + - The 33 bit *Presentation Time Stamp* of this picture as defined in + :ref:`mpeg2part1`. + * - __u32 + - ``length`` + - The length of this picture in bytes. + * - __u32 + - ``flags`` + - Flags containing the coding type of this picture, see + :ref:`enc-idx-flags`. + * - __u32 + - ``reserved``\ [2] + - Reserved for future extensions. Drivers must set the array to + zero. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| @@ -170,39 +125,19 @@ video elementary streams. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_ENC_IDX_FRAME_I`` - - - 0x00 - - - This is an Intra-coded picture. - - - .. row 2 - - - ``V4L2_ENC_IDX_FRAME_P`` - - - 0x01 - - - This is a Predictive-coded picture. - - - .. row 3 - - - ``V4L2_ENC_IDX_FRAME_B`` - - - 0x02 - - - This is a Bidirectionally predictive-coded picture. - - - .. row 4 - - - ``V4L2_ENC_IDX_FRAME_MASK`` - - - 0x0F - - - *AND* the flags field with this mask to obtain the picture coding - type. + * - ``V4L2_ENC_IDX_FRAME_I`` + - 0x00 + - This is an Intra-coded picture. + * - ``V4L2_ENC_IDX_FRAME_P`` + - 0x01 + - This is a Predictive-coded picture. + * - ``V4L2_ENC_IDX_FRAME_B`` + - 0x02 + - This is a Bidirectionally predictive-coded picture. + * - ``V4L2_ENC_IDX_FRAME_MASK`` + - 0x0F + - *AND* the flags field with this mask to obtain the picture coding + type. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst index 01561ddfe73b..5ab8d2ac27b9 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst @@ -111,127 +111,73 @@ still cause this situation. :stub-columns: 0 :widths: 1 1 1 2 + * - __u32 + - ``id`` + - + - Identifies the control, set by the application. + * - __u32 + - ``size`` + - + - The total size in bytes of the payload of this control. This is + normally 0, but for pointer controls this should be set to the + size of the memory containing the payload, or that will receive + the payload. If :ref:`VIDIOC_G_EXT_CTRLS ` finds that this value is + less than is required to store the payload result, then it is set + to a value large enough to store the payload result and ``ENOSPC`` is + returned. - - .. row 1 + .. note:: - - __u32 - - - ``id`` - - - - - Identifies the control, set by the application. - - - .. row 2 - - - __u32 - - - ``size`` - - - - - The total size in bytes of the payload of this control. This is - normally 0, but for pointer controls this should be set to the - size of the memory containing the payload, or that will receive - the payload. If :ref:`VIDIOC_G_EXT_CTRLS ` finds that this value is - less than is required to store the payload result, then it is set - to a value large enough to store the payload result and ``ENOSPC`` is - returned. - - .. note:: - - For string controls, this ``size`` field should - not be confused with the length of the string. This field refers - to the size of the memory that contains the string. The actual - *length* of the string may well be much smaller. - - - .. row 3 - - - __u32 - - - ``reserved2``\ [1] - - - - - Reserved for future extensions. Drivers and applications must set - the array to zero. - - - .. row 4 - - - union - - - (anonymous) - - - .. row 5 - - - - - __s32 - - - ``value`` - - - New value or current value. Valid if this control is not of type - ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is - not set. - - - .. row 6 - - - - - __s64 - - - ``value64`` - - - New value or current value. Valid if this control is of type - ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is - not set. - - - .. row 7 - - - - - char * - - - ``string`` - - - A pointer to a string. Valid if this control is of type - ``V4L2_CTRL_TYPE_STRING``. - - - .. row 8 - - - - - __u8 * - - - ``p_u8`` - - - A pointer to a matrix control of unsigned 8-bit values. Valid if - this control is of type ``V4L2_CTRL_TYPE_U8``. - - - .. row 9 - - - - - __u16 * - - - ``p_u16`` - - - A pointer to a matrix control of unsigned 16-bit values. Valid if - this control is of type ``V4L2_CTRL_TYPE_U16``. - - - .. row 10 - - - - - __u32 * - - - ``p_u32`` - - - A pointer to a matrix control of unsigned 32-bit values. Valid if - this control is of type ``V4L2_CTRL_TYPE_U32``. - - - .. row 11 - - - - - void * - - - ``ptr`` - - - A pointer to a compound type which can be an N-dimensional array - and/or a compound type (the control's type is >= - ``V4L2_CTRL_COMPOUND_TYPES``). Valid if - ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control. + For string controls, this ``size`` field should + not be confused with the length of the string. This field refers + to the size of the memory that contains the string. The actual + *length* of the string may well be much smaller. + * - __u32 + - ``reserved2``\ [1] + - + - Reserved for future extensions. Drivers and applications must set + the array to zero. + * - union + - (anonymous) + * - + - __s32 + - ``value`` + - New value or current value. Valid if this control is not of type + ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is + not set. + * - + - __s64 + - ``value64`` + - New value or current value. Valid if this control is of type + ``V4L2_CTRL_TYPE_INTEGER64`` and ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is + not set. + * - + - char * + - ``string`` + - A pointer to a string. Valid if this control is of type + ``V4L2_CTRL_TYPE_STRING``. + * - + - __u8 * + - ``p_u8`` + - A pointer to a matrix control of unsigned 8-bit values. Valid if + this control is of type ``V4L2_CTRL_TYPE_U8``. + * - + - __u16 * + - ``p_u16`` + - A pointer to a matrix control of unsigned 16-bit values. Valid if + this control is of type ``V4L2_CTRL_TYPE_U16``. + * - + - __u32 * + - ``p_u32`` + - A pointer to a matrix control of unsigned 32-bit values. Valid if + this control is of type ``V4L2_CTRL_TYPE_U32``. + * - + - void * + - ``ptr`` + - A pointer to a compound type which can be an N-dimensional array + and/or a compound type (the control's type is >= + ``V4L2_CTRL_COMPOUND_TYPES``). Valid if + ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` is set for this control. .. tabularcolumns:: |p{4.0cm}|p{2.0cm}|p{2.0cm}|p{8.5cm}| @@ -245,130 +191,96 @@ still cause this situation. :stub-columns: 0 :widths: 1 1 2 1 + * - union + - (anonymous) + * - + - __u32 + - ``ctrl_class`` + - The control class to which all controls belong, see + :ref:`ctrl-class`. Drivers that use a kernel framework for + handling controls will also accept a value of 0 here, meaning that + the controls can belong to any control class. Whether drivers + support this can be tested by setting ``ctrl_class`` to 0 and + calling :ref:`VIDIOC_TRY_EXT_CTRLS ` with a ``count`` of 0. If that + succeeds, then the driver supports this feature. + * - + - __u32 + - ``which`` + - Which value of the control to get/set/try. + ``V4L2_CTRL_WHICH_CUR_VAL`` will return the current value of the + control and ``V4L2_CTRL_WHICH_DEF_VAL`` will return the default + value of the control. - - .. row 1 + .. note:: - - union + You can only get the default value of the control, + you cannot set or try it. - - (anonymous) + For backwards compatibility you can also use a control class here + (see :ref:`ctrl-class`). In that case all controls have to + belong to that control class. This usage is deprecated, instead + just use ``V4L2_CTRL_WHICH_CUR_VAL``. There are some very old + drivers that do not yet support ``V4L2_CTRL_WHICH_CUR_VAL`` and + that require a control class here. You can test for such drivers + by setting ctrl_class to ``V4L2_CTRL_WHICH_CUR_VAL`` and calling + VIDIOC_TRY_EXT_CTRLS with a count of 0. If that fails, then the + driver does not support ``V4L2_CTRL_WHICH_CUR_VAL``. + * - __u32 + - ``count`` + - The number of controls in the controls array. May also be zero. + * - __u32 + - ``error_idx`` + - Set by the driver in case of an error. If the error is associated + with a particular control, then ``error_idx`` is set to the index + of that control. If the error is not related to a specific + control, or the validation step failed (see below), then + ``error_idx`` is set to ``count``. The value is undefined if the + ioctl returned 0 (success). - - .. row 2 + Before controls are read from/written to hardware a validation + step takes place: this checks if all controls in the list are + valid controls, if no attempt is made to write to a read-only + control or read from a write-only control, and any other up-front + checks that can be done without accessing the hardware. The exact + validations done during this step are driver dependent since some + checks might require hardware access for some devices, thus making + it impossible to do those checks up-front. However, drivers should + make a best-effort to do as many up-front checks as possible. - - - - __u32 + This check is done to avoid leaving the hardware in an + inconsistent state due to easy-to-avoid problems. But it leads to + another problem: the application needs to know whether an error + came from the validation step (meaning that the hardware was not + touched) or from an error during the actual reading from/writing + to hardware. - - ``ctrl_class`` + The, in hindsight quite poor, solution for that is to set + ``error_idx`` to ``count`` if the validation failed. This has the + unfortunate side-effect that it is not possible to see which + control failed the validation. If the validation was successful + and the error happened while accessing the hardware, then + ``error_idx`` is less than ``count`` and only the controls up to + ``error_idx-1`` were read or written correctly, and the state of + the remaining controls is undefined. - - The control class to which all controls belong, see - :ref:`ctrl-class`. Drivers that use a kernel framework for - handling controls will also accept a value of 0 here, meaning that - the controls can belong to any control class. Whether drivers - support this can be tested by setting ``ctrl_class`` to 0 and - calling :ref:`VIDIOC_TRY_EXT_CTRLS ` with a ``count`` of 0. If that - succeeds, then the driver supports this feature. + Since :ref:`VIDIOC_TRY_EXT_CTRLS ` does not access hardware there is + also no need to handle the validation step in this special way, so + ``error_idx`` will just be set to the control that failed the + validation step instead of to ``count``. This means that if + :ref:`VIDIOC_S_EXT_CTRLS ` fails with ``error_idx`` set to ``count``, + then you can call :ref:`VIDIOC_TRY_EXT_CTRLS ` to try to discover the + actual control that failed the validation step. Unfortunately, + there is no ``TRY`` equivalent for :ref:`VIDIOC_G_EXT_CTRLS `. + * - __u32 + - ``reserved``\ [2] + - Reserved for future extensions. - - .. row 3 + Drivers and applications must set the array to zero. + * - struct :c:type:`v4l2_ext_control` * + - ``controls`` + - Pointer to an array of ``count`` v4l2_ext_control structures. - - - - __u32 - - - ``which`` - - - Which value of the control to get/set/try. - ``V4L2_CTRL_WHICH_CUR_VAL`` will return the current value of the - control and ``V4L2_CTRL_WHICH_DEF_VAL`` will return the default - value of the control. - - .. note:: - - You can only get the default value of the control, - you cannot set or try it. - - For backwards compatibility you can also use a control class here - (see :ref:`ctrl-class`). In that case all controls have to - belong to that control class. This usage is deprecated, instead - just use ``V4L2_CTRL_WHICH_CUR_VAL``. There are some very old - drivers that do not yet support ``V4L2_CTRL_WHICH_CUR_VAL`` and - that require a control class here. You can test for such drivers - by setting ctrl_class to ``V4L2_CTRL_WHICH_CUR_VAL`` and calling - VIDIOC_TRY_EXT_CTRLS with a count of 0. If that fails, then the - driver does not support ``V4L2_CTRL_WHICH_CUR_VAL``. - - - .. row 4 - - - __u32 - - - ``count`` - - - The number of controls in the controls array. May also be zero. - - - .. row 5 - - - __u32 - - - ``error_idx`` - - - Set by the driver in case of an error. If the error is associated - with a particular control, then ``error_idx`` is set to the index - of that control. If the error is not related to a specific - control, or the validation step failed (see below), then - ``error_idx`` is set to ``count``. The value is undefined if the - ioctl returned 0 (success). - - Before controls are read from/written to hardware a validation - step takes place: this checks if all controls in the list are - valid controls, if no attempt is made to write to a read-only - control or read from a write-only control, and any other up-front - checks that can be done without accessing the hardware. The exact - validations done during this step are driver dependent since some - checks might require hardware access for some devices, thus making - it impossible to do those checks up-front. However, drivers should - make a best-effort to do as many up-front checks as possible. - - This check is done to avoid leaving the hardware in an - inconsistent state due to easy-to-avoid problems. But it leads to - another problem: the application needs to know whether an error - came from the validation step (meaning that the hardware was not - touched) or from an error during the actual reading from/writing - to hardware. - - The, in hindsight quite poor, solution for that is to set - ``error_idx`` to ``count`` if the validation failed. This has the - unfortunate side-effect that it is not possible to see which - control failed the validation. If the validation was successful - and the error happened while accessing the hardware, then - ``error_idx`` is less than ``count`` and only the controls up to - ``error_idx-1`` were read or written correctly, and the state of - the remaining controls is undefined. - - Since :ref:`VIDIOC_TRY_EXT_CTRLS ` does not access hardware there is - also no need to handle the validation step in this special way, so - ``error_idx`` will just be set to the control that failed the - validation step instead of to ``count``. This means that if - :ref:`VIDIOC_S_EXT_CTRLS ` fails with ``error_idx`` set to ``count``, - then you can call :ref:`VIDIOC_TRY_EXT_CTRLS ` to try to discover the - actual control that failed the validation step. Unfortunately, - there is no ``TRY`` equivalent for :ref:`VIDIOC_G_EXT_CTRLS `. - - - .. row 6 - - - __u32 - - - ``reserved``\ [2] - - - Reserved for future extensions. - - Drivers and applications must set the array to zero. - - - .. row 7 - - - struct :c:type:`v4l2_ext_control` * - - - ``controls`` - - - Pointer to an array of ``count`` v4l2_ext_control structures. - - Ignored if ``count`` equals zero. + Ignored if ``count`` equals zero. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| @@ -380,99 +292,49 @@ still cause this situation. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_CTRL_CLASS_USER`` - - - 0x980000 - - - The class containing user controls. These controls are described - in :ref:`control`. All controls that can be set using the - :ref:`VIDIOC_S_CTRL ` and - :ref:`VIDIOC_G_CTRL ` ioctl belong to this - class. - - - .. row 2 - - - ``V4L2_CTRL_CLASS_MPEG`` - - - 0x990000 - - - The class containing MPEG compression controls. These controls are - described in :ref:`mpeg-controls`. - - - .. row 3 - - - ``V4L2_CTRL_CLASS_CAMERA`` - - - 0x9a0000 - - - The class containing camera controls. These controls are described - in :ref:`camera-controls`. - - - .. row 4 - - - ``V4L2_CTRL_CLASS_FM_TX`` - - - 0x9b0000 - - - The class containing FM Transmitter (FM TX) controls. These - controls are described in :ref:`fm-tx-controls`. - - - .. row 5 - - - ``V4L2_CTRL_CLASS_FLASH`` - - - 0x9c0000 - - - The class containing flash device controls. These controls are - described in :ref:`flash-controls`. - - - .. row 6 - - - ``V4L2_CTRL_CLASS_JPEG`` - - - 0x9d0000 - - - The class containing JPEG compression controls. These controls are - described in :ref:`jpeg-controls`. - - - .. row 7 - - - ``V4L2_CTRL_CLASS_IMAGE_SOURCE`` - - - 0x9e0000 - - - The class containing image source controls. These controls are - described in :ref:`image-source-controls`. - - - .. row 8 - - - ``V4L2_CTRL_CLASS_IMAGE_PROC`` - - - 0x9f0000 - - - The class containing image processing controls. These controls are - described in :ref:`image-process-controls`. - - - .. row 9 - - - ``V4L2_CTRL_CLASS_FM_RX`` - - - 0xa10000 - - - The class containing FM Receiver (FM RX) controls. These controls - are described in :ref:`fm-rx-controls`. - - - .. row 10 - - - ``V4L2_CTRL_CLASS_RF_TUNER`` - - - 0xa20000 - - - The class containing RF tuner controls. These controls are - described in :ref:`rf-tuner-controls`. + * - ``V4L2_CTRL_CLASS_USER`` + - 0x980000 + - The class containing user controls. These controls are described + in :ref:`control`. All controls that can be set using the + :ref:`VIDIOC_S_CTRL ` and + :ref:`VIDIOC_G_CTRL ` ioctl belong to this + class. + * - ``V4L2_CTRL_CLASS_MPEG`` + - 0x990000 + - The class containing MPEG compression controls. These controls are + described in :ref:`mpeg-controls`. + * - ``V4L2_CTRL_CLASS_CAMERA`` + - 0x9a0000 + - The class containing camera controls. These controls are described + in :ref:`camera-controls`. + * - ``V4L2_CTRL_CLASS_FM_TX`` + - 0x9b0000 + - The class containing FM Transmitter (FM TX) controls. These + controls are described in :ref:`fm-tx-controls`. + * - ``V4L2_CTRL_CLASS_FLASH`` + - 0x9c0000 + - The class containing flash device controls. These controls are + described in :ref:`flash-controls`. + * - ``V4L2_CTRL_CLASS_JPEG`` + - 0x9d0000 + - The class containing JPEG compression controls. These controls are + described in :ref:`jpeg-controls`. + * - ``V4L2_CTRL_CLASS_IMAGE_SOURCE`` + - 0x9e0000 + - The class containing image source controls. These controls are + described in :ref:`image-source-controls`. + * - ``V4L2_CTRL_CLASS_IMAGE_PROC`` + - 0x9f0000 + - The class containing image processing controls. These controls are + described in :ref:`image-process-controls`. + * - ``V4L2_CTRL_CLASS_FM_RX`` + - 0xa10000 + - The class containing FM Receiver (FM RX) controls. These controls + are described in :ref:`fm-rx-controls`. + * - ``V4L2_CTRL_CLASS_RF_TUNER`` + - 0xa20000 + - The class containing RF tuner controls. These controls are + described in :ref:`rf-tuner-controls`. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst index 1ad40a9dd743..4a6a03d158ca 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fbuf.rst @@ -86,201 +86,126 @@ destructive video overlay. :stub-columns: 0 :widths: 1 1 1 2 + * - __u32 + - ``capability`` + - + - Overlay capability flags set by the driver, see + :ref:`framebuffer-cap`. + * - __u32 + - ``flags`` + - + - Overlay control flags set by application and driver, see + :ref:`framebuffer-flags` + * - void * + - ``base`` + - + - Physical base address of the framebuffer, that is the address of + the pixel in the top left corner of the framebuffer. [#f1]_ + * - + - + - + - This field is irrelevant to *non-destructive Video Overlays*. For + *destructive Video Overlays* applications must provide a base + address. The driver may accept only base addresses which are a + multiple of two, four or eight bytes. For *Video Output Overlays* + the driver must return a valid base address, so applications can + find the corresponding Linux framebuffer device (see + :ref:`osd`). + * - struct + - ``fmt`` + - + - Layout of the frame buffer. + * - + - __u32 + - ``width`` + - Width of the frame buffer in pixels. + * - + - __u32 + - ``height`` + - Height of the frame buffer in pixels. + * - + - __u32 + - ``pixelformat`` + - The pixel format of the framebuffer. + * - + - + - + - For *non-destructive Video Overlays* this field only defines a + format for the struct :c:type:`v4l2_window` + ``chromakey`` field. + * - + - + - + - For *destructive Video Overlays* applications must initialize this + field. For *Video Output Overlays* the driver must return a valid + format. + * - + - + - + - Usually this is an RGB format (for example + :ref:`V4L2_PIX_FMT_RGB565 `) but YUV + formats (only packed YUV formats when chroma keying is used, not + including ``V4L2_PIX_FMT_YUYV`` and ``V4L2_PIX_FMT_UYVY``) and the + ``V4L2_PIX_FMT_PAL8`` format are also permitted. The behavior of + the driver when an application requests a compressed format is + undefined. See :ref:`pixfmt` for information on pixel formats. + * - + - enum :c:type:`v4l2_field` + - ``field`` + - Drivers and applications shall ignore this field. If applicable, + the field order is selected with the + :ref:`VIDIOC_S_FMT ` ioctl, using the ``field`` + field of struct :c:type:`v4l2_window`. + * - + - __u32 + - ``bytesperline`` + - Distance in bytes between the leftmost pixels in two adjacent + lines. + * - :cspan:`3` - - .. row 1 + This field is irrelevant to *non-destructive Video Overlays*. - - __u32 + For *destructive Video Overlays* both applications and drivers can + set this field to request padding bytes at the end of each line. + Drivers however may ignore the requested value, returning + ``width`` times bytes-per-pixel or a larger value required by the + hardware. That implies applications can just set this field to + zero to get a reasonable default. - - ``capability`` + For *Video Output Overlays* the driver must return a valid value. - - - - Overlay capability flags set by the driver, see - :ref:`framebuffer-cap`. + Video hardware may access padding bytes, therefore they must + reside in accessible memory. Consider for example the case where + padding bytes after the last line of an image cross a system page + boundary. Capture devices may write padding bytes, the value is + undefined. Output devices ignore the contents of padding bytes. - - .. row 2 + When the image format is planar the ``bytesperline`` value applies + to the first plane and is divided by the same factor as the + ``width`` field for the other planes. For 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 ``bytesperline`` value rounded up to a multiple of + the scale factor. + * - + - __u32 + - ``sizeimage`` + - This field is irrelevant to *non-destructive Video Overlays*. For + *destructive Video Overlays* applications must initialize this + field. For *Video Output Overlays* the driver must return a valid + format. - - __u32 - - - ``flags`` - - - - - Overlay control flags set by application and driver, see - :ref:`framebuffer-flags` - - - .. row 3 - - - void * - - - ``base`` - - - - - Physical base address of the framebuffer, that is the address of - the pixel in the top left corner of the framebuffer. [#f1]_ - - - .. row 4 - - - - - - - - - This field is irrelevant to *non-destructive Video Overlays*. For - *destructive Video Overlays* applications must provide a base - address. The driver may accept only base addresses which are a - multiple of two, four or eight bytes. For *Video Output Overlays* - the driver must return a valid base address, so applications can - find the corresponding Linux framebuffer device (see - :ref:`osd`). - - - .. row 5 - - - struct - - - ``fmt`` - - - - - Layout of the frame buffer. - - - .. row 6 - - - - - __u32 - - - ``width`` - - - Width of the frame buffer in pixels. - - - .. row 7 - - - - - __u32 - - - ``height`` - - - Height of the frame buffer in pixels. - - - .. row 8 - - - - - __u32 - - - ``pixelformat`` - - - The pixel format of the framebuffer. - - - .. row 9 - - - - - - - - - For *non-destructive Video Overlays* this field only defines a - format for the struct :c:type:`v4l2_window` - ``chromakey`` field. - - - .. row 10 - - - - - - - - - For *destructive Video Overlays* applications must initialize this - field. For *Video Output Overlays* the driver must return a valid - format. - - - .. row 11 - - - - - - - - - Usually this is an RGB format (for example - :ref:`V4L2_PIX_FMT_RGB565 `) but YUV - formats (only packed YUV formats when chroma keying is used, not - including ``V4L2_PIX_FMT_YUYV`` and ``V4L2_PIX_FMT_UYVY``) and the - ``V4L2_PIX_FMT_PAL8`` format are also permitted. The behavior of - the driver when an application requests a compressed format is - undefined. See :ref:`pixfmt` for information on pixel formats. - - - .. row 12 - - - - - enum :c:type:`v4l2_field` - - - ``field`` - - - Drivers and applications shall ignore this field. If applicable, - the field order is selected with the - :ref:`VIDIOC_S_FMT ` ioctl, using the ``field`` - field of struct :c:type:`v4l2_window`. - - - .. row 13 - - - - - __u32 - - - ``bytesperline`` - - - Distance in bytes between the leftmost pixels in two adjacent - lines. - - - .. row 14 - - - :cspan:`3` - - This field is irrelevant to *non-destructive Video Overlays*. - - For *destructive Video Overlays* both applications and drivers can - set this field to request padding bytes at the end of each line. - Drivers however may ignore the requested value, returning - ``width`` times bytes-per-pixel or a larger value required by the - hardware. That implies applications can just set this field to - zero to get a reasonable default. - - For *Video Output Overlays* the driver must return a valid value. - - Video hardware may access padding bytes, therefore they must - reside in accessible memory. Consider for example the case where - padding bytes after the last line of an image cross a system page - boundary. Capture devices may write padding bytes, the value is - undefined. Output devices ignore the contents of padding bytes. - - When the image format is planar the ``bytesperline`` value applies - to the first plane and is divided by the same factor as the - ``width`` field for the other planes. For 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 ``bytesperline`` value rounded up to a multiple of - the scale factor. - - - .. row 15 - - - - - __u32 - - - ``sizeimage`` - - - This field is irrelevant to *non-destructive Video Overlays*. For - *destructive Video Overlays* applications must initialize this - field. For *Video Output Overlays* the driver must return a valid - format. - - Together with ``base`` it defines the framebuffer memory - accessible by the driver. - - - .. row 16 - - - - - enum :c:type:`v4l2_colorspace` - - - ``colorspace`` - - - This information supplements the ``pixelformat`` and must be set - by the driver, see :ref:`colorspaces`. - - - .. row 17 - - - - - __u32 - - - ``priv`` - - - Reserved. Drivers and applications must set this field to zero. + Together with ``base`` it defines the framebuffer memory + accessible by the driver. + * - + - enum :c:type:`v4l2_colorspace` + - ``colorspace`` + - This information supplements the ``pixelformat`` and must be set + by the driver, see :ref:`colorspaces`. + * - + - __u32 + - ``priv`` + - Reserved. Drivers and applications must set this field to zero. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| @@ -292,84 +217,44 @@ destructive video overlay. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_FBUF_CAP_EXTERNOVERLAY`` - - - 0x0001 - - - The device is capable of non-destructive overlays. When the driver - clears this flag, only destructive overlays are supported. There - are no drivers yet which support both destructive and - non-destructive overlays. Video Output Overlays are in practice - always non-destructive. - - - .. row 2 - - - ``V4L2_FBUF_CAP_CHROMAKEY`` - - - 0x0002 - - - The device supports clipping by chroma-keying the images. That is, - image pixels replace pixels in the VGA or video signal only where - the latter assume a certain color. Chroma-keying makes no sense - for destructive overlays. - - - .. row 3 - - - ``V4L2_FBUF_CAP_LIST_CLIPPING`` - - - 0x0004 - - - The device supports clipping using a list of clip rectangles. - - - .. row 4 - - - ``V4L2_FBUF_CAP_BITMAP_CLIPPING`` - - - 0x0008 - - - The device supports clipping using a bit mask. - - - .. row 5 - - - ``V4L2_FBUF_CAP_LOCAL_ALPHA`` - - - 0x0010 - - - The device supports clipping/blending using the alpha channel of - the framebuffer or VGA signal. Alpha blending makes no sense for - destructive overlays. - - - .. row 6 - - - ``V4L2_FBUF_CAP_GLOBAL_ALPHA`` - - - 0x0020 - - - The device supports alpha blending using a global alpha value. - Alpha blending makes no sense for destructive overlays. - - - .. row 7 - - - ``V4L2_FBUF_CAP_LOCAL_INV_ALPHA`` - - - 0x0040 - - - The device supports clipping/blending using the inverted alpha - channel of the framebuffer or VGA signal. Alpha blending makes no - sense for destructive overlays. - - - .. row 8 - - - ``V4L2_FBUF_CAP_SRC_CHROMAKEY`` - - - 0x0080 - - - The device supports Source Chroma-keying. Video pixels with the - chroma-key colors are replaced by framebuffer pixels, which is - exactly opposite of ``V4L2_FBUF_CAP_CHROMAKEY`` + * - ``V4L2_FBUF_CAP_EXTERNOVERLAY`` + - 0x0001 + - The device is capable of non-destructive overlays. When the driver + clears this flag, only destructive overlays are supported. There + are no drivers yet which support both destructive and + non-destructive overlays. Video Output Overlays are in practice + always non-destructive. + * - ``V4L2_FBUF_CAP_CHROMAKEY`` + - 0x0002 + - The device supports clipping by chroma-keying the images. That is, + image pixels replace pixels in the VGA or video signal only where + the latter assume a certain color. Chroma-keying makes no sense + for destructive overlays. + * - ``V4L2_FBUF_CAP_LIST_CLIPPING`` + - 0x0004 + - The device supports clipping using a list of clip rectangles. + * - ``V4L2_FBUF_CAP_BITMAP_CLIPPING`` + - 0x0008 + - The device supports clipping using a bit mask. + * - ``V4L2_FBUF_CAP_LOCAL_ALPHA`` + - 0x0010 + - The device supports clipping/blending using the alpha channel of + the framebuffer or VGA signal. Alpha blending makes no sense for + destructive overlays. + * - ``V4L2_FBUF_CAP_GLOBAL_ALPHA`` + - 0x0020 + - The device supports alpha blending using a global alpha value. + Alpha blending makes no sense for destructive overlays. + * - ``V4L2_FBUF_CAP_LOCAL_INV_ALPHA`` + - 0x0040 + - The device supports clipping/blending using the inverted alpha + channel of the framebuffer or VGA signal. Alpha blending makes no + sense for destructive overlays. + * - ``V4L2_FBUF_CAP_SRC_CHROMAKEY`` + - 0x0080 + - The device supports Source Chroma-keying. Video pixels with the + chroma-key colors are replaced by framebuffer pixels, which is + exactly opposite of ``V4L2_FBUF_CAP_CHROMAKEY`` .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| @@ -383,106 +268,68 @@ destructive video overlay. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_FBUF_FLAG_PRIMARY`` - - - 0x0001 - - - The framebuffer is the primary graphics surface. In other words, - the overlay is destructive. This flag is typically set by any - driver that doesn't have the ``V4L2_FBUF_CAP_EXTERNOVERLAY`` - capability and it is cleared otherwise. - - - .. row 2 - - - ``V4L2_FBUF_FLAG_OVERLAY`` - - - 0x0002 - - - If this flag is set for a video capture device, then the driver - will set the initial overlay size to cover the full framebuffer - size, otherwise the existing overlay size (as set by - :ref:`VIDIOC_S_FMT `) will be used. Only one - video capture driver (bttv) supports this flag. The use of this - flag for capture devices is deprecated. There is no way to detect - which drivers support this flag, so the only reliable method of - setting the overlay size is through - :ref:`VIDIOC_S_FMT `. If this flag is set for a - video output device, then the video output overlay window is - relative to the top-left corner of the framebuffer and restricted - to the size of the framebuffer. If it is cleared, then the video - output overlay window is relative to the video output display. - - - .. row 3 - - - ``V4L2_FBUF_FLAG_CHROMAKEY`` - - - 0x0004 - - - Use chroma-keying. The chroma-key color is determined by the - ``chromakey`` field of struct :c:type:`v4l2_window` - and negotiated with the :ref:`VIDIOC_S_FMT ` - ioctl, see :ref:`overlay` and :ref:`osd`. - - - .. row 4 - - - :cspan:`2` There are no flags to enable clipping using a list of - clip rectangles or a bitmap. These methods are negotiated with the - :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` - and :ref:`osd`. - - - .. row 5 - - - ``V4L2_FBUF_FLAG_LOCAL_ALPHA`` - - - 0x0008 - - - Use the alpha channel of the framebuffer to clip or blend - framebuffer pixels with video images. The blend function is: - output = framebuffer pixel * alpha + video pixel * (1 - alpha). - The actual alpha depth depends on the framebuffer pixel format. - - - .. row 6 - - - ``V4L2_FBUF_FLAG_GLOBAL_ALPHA`` - - - 0x0010 - - - Use a global alpha value to blend the framebuffer with video - images. The blend function is: output = (framebuffer pixel * alpha - + video pixel * (255 - alpha)) / 255. The alpha value is - determined by the ``global_alpha`` field of struct - :c:type:`v4l2_window` and negotiated with the - :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` - and :ref:`osd`. - - - .. row 7 - - - ``V4L2_FBUF_FLAG_LOCAL_INV_ALPHA`` - - - 0x0020 - - - Like ``V4L2_FBUF_FLAG_LOCAL_ALPHA``, use the alpha channel of the - framebuffer to clip or blend framebuffer pixels with video images, - but with an inverted alpha value. The blend function is: output = - framebuffer pixel * (1 - alpha) + video pixel * alpha. The actual - alpha depth depends on the framebuffer pixel format. - - - .. row 8 - - - ``V4L2_FBUF_FLAG_SRC_CHROMAKEY`` - - - 0x0040 - - - Use source chroma-keying. The source chroma-key color is - determined by the ``chromakey`` field of struct - :c:type:`v4l2_window` and negotiated with the - :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` - and :ref:`osd`. Both chroma-keying are mutual exclusive to each - other, so same ``chromakey`` field of struct - :c:type:`v4l2_window` is being used. + * - ``V4L2_FBUF_FLAG_PRIMARY`` + - 0x0001 + - The framebuffer is the primary graphics surface. In other words, + the overlay is destructive. This flag is typically set by any + driver that doesn't have the ``V4L2_FBUF_CAP_EXTERNOVERLAY`` + capability and it is cleared otherwise. + * - ``V4L2_FBUF_FLAG_OVERLAY`` + - 0x0002 + - If this flag is set for a video capture device, then the driver + will set the initial overlay size to cover the full framebuffer + size, otherwise the existing overlay size (as set by + :ref:`VIDIOC_S_FMT `) will be used. Only one + video capture driver (bttv) supports this flag. The use of this + flag for capture devices is deprecated. There is no way to detect + which drivers support this flag, so the only reliable method of + setting the overlay size is through + :ref:`VIDIOC_S_FMT `. If this flag is set for a + video output device, then the video output overlay window is + relative to the top-left corner of the framebuffer and restricted + to the size of the framebuffer. If it is cleared, then the video + output overlay window is relative to the video output display. + * - ``V4L2_FBUF_FLAG_CHROMAKEY`` + - 0x0004 + - Use chroma-keying. The chroma-key color is determined by the + ``chromakey`` field of struct :c:type:`v4l2_window` + and negotiated with the :ref:`VIDIOC_S_FMT ` + ioctl, see :ref:`overlay` and :ref:`osd`. + * - :cspan:`2` There are no flags to enable clipping using a list of + clip rectangles or a bitmap. These methods are negotiated with the + :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` + and :ref:`osd`. + * - ``V4L2_FBUF_FLAG_LOCAL_ALPHA`` + - 0x0008 + - Use the alpha channel of the framebuffer to clip or blend + framebuffer pixels with video images. The blend function is: + output = framebuffer pixel * alpha + video pixel * (1 - alpha). + The actual alpha depth depends on the framebuffer pixel format. + * - ``V4L2_FBUF_FLAG_GLOBAL_ALPHA`` + - 0x0010 + - Use a global alpha value to blend the framebuffer with video + images. The blend function is: output = (framebuffer pixel * alpha + + video pixel * (255 - alpha)) / 255. The alpha value is + determined by the ``global_alpha`` field of struct + :c:type:`v4l2_window` and negotiated with the + :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` + and :ref:`osd`. + * - ``V4L2_FBUF_FLAG_LOCAL_INV_ALPHA`` + - 0x0020 + - Like ``V4L2_FBUF_FLAG_LOCAL_ALPHA``, use the alpha channel of the + framebuffer to clip or blend framebuffer pixels with video images, + but with an inverted alpha value. The blend function is: output = + framebuffer pixel * (1 - alpha) + video pixel * alpha. The actual + alpha depth depends on the framebuffer pixel format. + * - ``V4L2_FBUF_FLAG_SRC_CHROMAKEY`` + - 0x0040 + - Use source chroma-keying. The source chroma-key color is + determined by the ``chromakey`` field of struct + :c:type:`v4l2_window` and negotiated with the + :ref:`VIDIOC_S_FMT ` ioctl, see :ref:`overlay` + and :ref:`osd`. Both chroma-keying are mutual exclusive to each + other, so same ``chromakey`` field of struct + :c:type:`v4l2_window` is being used. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst index f11dce6dc543..b853e48312e2 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-fmt.rst @@ -93,92 +93,48 @@ The format as returned by :ref:`VIDIOC_TRY_FMT ` must be identical :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - __u32 - - - ``type`` - - - - - Type of the data stream, see :c:type:`v4l2_buf_type`. - - - .. row 2 - - - union - - - ``fmt`` - - - .. row 3 - - - - - struct :c:type:`v4l2_pix_format` - - - ``pix`` - - - Definition of an image format, see :ref:`pixfmt`, used by video - capture and output devices. - - - .. row 4 - - - - - struct :c:type:`v4l2_pix_format_mplane` - - - ``pix_mp`` - - - Definition of an image format, see :ref:`pixfmt`, used by video - capture and output devices that support the - :ref:`multi-planar version of the API `. - - - .. row 5 - - - - - struct :c:type:`v4l2_window` - - - ``win`` - - - Definition of an overlaid image, see :ref:`overlay`, used by - video overlay devices. - - - .. row 6 - - - - - struct :c:type:`v4l2_vbi_format` - - - ``vbi`` - - - Raw VBI capture or output parameters. This is discussed in more - detail in :ref:`raw-vbi`. Used by raw VBI capture and output - devices. - - - .. row 7 - - - - - struct :c:type:`v4l2_sliced_vbi_format` - - - ``sliced`` - - - Sliced VBI capture or output parameters. See :ref:`sliced` for - details. Used by sliced VBI capture and output devices. - - - .. row 8 - - - - - struct :c:type:`v4l2_sdr_format` - - - ``sdr`` - - - Definition of a data format, see :ref:`pixfmt`, used by SDR - capture and output devices. - - - .. row 9 - - - - - __u8 - - - ``raw_data``\ [200] - - - Place holder for future extensions. + * - __u32 + - ``type`` + - + - Type of the data stream, see :c:type:`v4l2_buf_type`. + * - union + - ``fmt`` + * - + - struct :c:type:`v4l2_pix_format` + - ``pix`` + - Definition of an image format, see :ref:`pixfmt`, used by video + capture and output devices. + * - + - struct :c:type:`v4l2_pix_format_mplane` + - ``pix_mp`` + - Definition of an image format, see :ref:`pixfmt`, used by video + capture and output devices that support the + :ref:`multi-planar version of the API `. + * - + - struct :c:type:`v4l2_window` + - ``win`` + - Definition of an overlaid image, see :ref:`overlay`, used by + video overlay devices. + * - + - struct :c:type:`v4l2_vbi_format` + - ``vbi`` + - Raw VBI capture or output parameters. This is discussed in more + detail in :ref:`raw-vbi`. Used by raw VBI capture and output + devices. + * - + - struct :c:type:`v4l2_sliced_vbi_format` + - ``sliced`` + - Sliced VBI capture or output parameters. See :ref:`sliced` for + details. Used by sliced VBI capture and output devices. + * - + - struct :c:type:`v4l2_sdr_format` + - ``sdr`` + - Definition of a data format, see :ref:`pixfmt`, used by SDR + capture and output devices. + * - + - __u8 + - ``raw_data``\ [200] + - Place holder for future extensions. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst index 37ac69acf113..46ab276f412b 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-frequency.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-frequency.rst @@ -60,53 +60,33 @@ write-only ioctl, it does not return the actual new frequency. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``tuner`` - - - The tuner or modulator index number. This is the same value as in - the struct :c:type:`v4l2_input` ``tuner`` field and - the struct :c:type:`v4l2_tuner` ``index`` field, or - the struct :c:type:`v4l2_output` ``modulator`` field - and the struct :c:type:`v4l2_modulator` ``index`` - field. - - - .. row 2 - - - __u32 - - - ``type`` - - - The tuner type. This is the same value as in the struct - :c:type:`v4l2_tuner` ``type`` field. The type must be - set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and - to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to - ``V4L2_TUNER_RADIO`` for modulators (currently only radio - modulators are supported). See :c:type:`v4l2_tuner_type` - - - .. row 3 - - - __u32 - - - ``frequency`` - - - Tuning frequency in units of 62.5 kHz, or if the struct - :c:type:`v4l2_tuner` or struct - :c:type:`v4l2_modulator` ``capability`` flag - ``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is - used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. - - - .. row 4 - - - __u32 - - - ``reserved``\ [8] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + * - __u32 + - ``tuner`` + - The tuner or modulator index number. This is the same value as in + the struct :c:type:`v4l2_input` ``tuner`` field and + the struct :c:type:`v4l2_tuner` ``index`` field, or + the struct :c:type:`v4l2_output` ``modulator`` field + and the struct :c:type:`v4l2_modulator` ``index`` + field. + * - __u32 + - ``type`` + - The tuner type. This is the same value as in the struct + :c:type:`v4l2_tuner` ``type`` field. The type must be + set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and + to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to + ``V4L2_TUNER_RADIO`` for modulators (currently only radio + modulators are supported). See :c:type:`v4l2_tuner_type` + * - __u32 + - ``frequency`` + - Tuning frequency in units of 62.5 kHz, or if the struct + :c:type:`v4l2_tuner` or struct + :c:type:`v4l2_modulator` ``capability`` flag + ``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is + used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. + * - __u32 + - ``reserved``\ [8] + - Reserved for future extensions. Drivers and applications must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst index c56c5bc7beb5..8ba353067b33 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst @@ -63,68 +63,33 @@ encoding. You usually do want to add them. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - int - - - ``quality`` - - - Deprecated. If - :ref:`V4L2_CID_JPEG_COMPRESSION_QUALITY ` - control is exposed by a driver applications should use it instead - and ignore this field. - - - .. row 2 - - - int - - - ``APPn`` - - - - - - .. row 3 - - - int - - - ``APP_len`` - - - - - - .. row 4 - - - char - - - ``APP_data``\ [60] - - - - - - .. row 5 - - - int - - - ``COM_len`` - - - - - - .. row 6 - - - char - - - ``COM_data``\ [60] - - - - - - .. row 7 - - - __u32 - - - ``jpeg_markers`` - - - See :ref:`jpeg-markers`. Deprecated. If - :ref:`V4L2_CID_JPEG_ACTIVE_MARKER ` - control is exposed by a driver applications should use it instead - and ignore this field. + * - int + - ``quality`` + - Deprecated. If + :ref:`V4L2_CID_JPEG_COMPRESSION_QUALITY ` + control is exposed by a driver applications should use it instead + and ignore this field. + * - int + - ``APPn`` + - + * - int + - ``APP_len`` + - + * - char + - ``APP_data``\ [60] + - + * - int + - ``COM_len`` + - + * - char + - ``COM_data``\ [60] + - + * - __u32 + - ``jpeg_markers`` + - See :ref:`jpeg-markers`. Deprecated. If + :ref:`V4L2_CID_JPEG_ACTIVE_MARKER ` + control is exposed by a driver applications should use it instead + and ignore this field. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| @@ -136,46 +101,21 @@ encoding. You usually do want to add them. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_JPEG_MARKER_DHT`` - - - (1<<3) - - - Define Huffman Tables - - - .. row 2 - - - ``V4L2_JPEG_MARKER_DQT`` - - - (1<<4) - - - Define Quantization Tables - - - .. row 3 - - - ``V4L2_JPEG_MARKER_DRI`` - - - (1<<5) - - - Define Restart Interval - - - .. row 4 - - - ``V4L2_JPEG_MARKER_COM`` - - - (1<<6) - - - Comment segment - - - .. row 5 - - - ``V4L2_JPEG_MARKER_APP`` - - - (1<<7) - - - App segment, driver will always use APP0 + * - ``V4L2_JPEG_MARKER_DHT`` + - (1<<3) + - Define Huffman Tables + * - ``V4L2_JPEG_MARKER_DQT`` + - (1<<4) + - Define Quantization Tables + * - ``V4L2_JPEG_MARKER_DRI`` + - (1<<5) + - Define Restart Interval + * - ``V4L2_JPEG_MARKER_COM`` + - (1<<6) + - Comment segment + * - ``V4L2_JPEG_MARKER_APP`` + - (1<<7) + - App segment, driver will always use APP0 Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst index a8a542dc8a40..77d017eb3fcc 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-modulator.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-modulator.rst @@ -69,95 +69,55 @@ To change the radio frequency the :stub-columns: 0 :widths: 1 1 2 1 1 + * - __u32 + - ``index`` + - Identifies the modulator, set by the application. + * - __u8 + - ``name``\ [32] + - Name of the modulator, a NUL-terminated ASCII string. - - .. row 1 + This information is intended for the user. + * - __u32 + - ``capability`` + - Modulator capability flags. No flags are defined for this field, + the tuner flags in struct :c:type:`v4l2_tuner` are + used accordingly. The audio flags indicate the ability to encode + audio subprograms. They will *not* change for example with the + current video standard. + * - __u32 + - ``rangelow`` + - The lowest tunable frequency in units of 62.5 KHz, or if the + ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of + 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is + set, in units of 1 Hz. + * - __u32 + - ``rangehigh`` + - The highest tunable frequency in units of 62.5 KHz, or if the + ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of + 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is + set, in units of 1 Hz. + * - __u32 + - ``txsubchans`` + - With this field applications can determine how audio sub-carriers + shall be modulated. It contains a set of flags as defined in + :ref:`modulator-txsubchans`. - - __u32 + .. note:: - - ``index`` + The tuner ``rxsubchans`` flags are reused, but the + semantics are different. Video output devices + are assumed to have an analog or PCM audio input with 1-3 + channels. The ``txsubchans`` flags select one or more channels + for modulation, together with some audio subprogram indicator, + for example, a stereo pilot tone. + * - __u32 + - ``type`` + - :cspan:`2` Type of the modulator, see :c:type:`v4l2_tuner_type`. + * - __u32 + - ``reserved``\ [3] + - Reserved for future extensions. - - Identifies the modulator, set by the application. - - - .. row 2 - - - __u8 - - - ``name``\ [32] - - - Name of the modulator, a NUL-terminated ASCII string. - - This information is intended for the user. - - - .. row 3 - - - __u32 - - - ``capability`` - - - Modulator capability flags. No flags are defined for this field, - the tuner flags in struct :c:type:`v4l2_tuner` are - used accordingly. The audio flags indicate the ability to encode - audio subprograms. They will *not* change for example with the - current video standard. - - - .. row 4 - - - __u32 - - - ``rangelow`` - - - The lowest tunable frequency in units of 62.5 KHz, or if the - ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of - 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is - set, in units of 1 Hz. - - - .. row 5 - - - __u32 - - - ``rangehigh`` - - - The highest tunable frequency in units of 62.5 KHz, or if the - ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of - 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is - set, in units of 1 Hz. - - - .. row 6 - - - __u32 - - - ``txsubchans`` - - - With this field applications can determine how audio sub-carriers - shall be modulated. It contains a set of flags as defined in - :ref:`modulator-txsubchans`. - - .. note:: - - The tuner ``rxsubchans`` flags are reused, but the - semantics are different. Video output devices - are assumed to have an analog or PCM audio input with 1-3 - channels. The ``txsubchans`` flags select one or more channels - for modulation, together with some audio subprogram indicator, - for example, a stereo pilot tone. - - - .. row 7 - - - __u32 - - - ``type`` - - - :cspan:`2` Type of the modulator, see :c:type:`v4l2_tuner_type`. - - - .. row 8 - - - __u32 - - - ``reserved``\ [3] - - - Reserved for future extensions. - - Drivers and applications must set the array to zero. + Drivers and applications must set the array to zero. @@ -170,86 +130,56 @@ To change the radio frequency the :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_TUNER_SUB_MONO`` - - - 0x0001 - - - Modulate channel 1 as mono audio, when the input has more - channels, a down-mix of channel 1 and 2. This flag does not - combine with ``V4L2_TUNER_SUB_STEREO`` or - ``V4L2_TUNER_SUB_LANG1``. - - - .. row 2 - - - ``V4L2_TUNER_SUB_STEREO`` - - - 0x0002 - - - Modulate channel 1 and 2 as left and right channel of a stereo - audio signal. When the input has only one channel or two channels - and ``V4L2_TUNER_SUB_SAP`` is also set, channel 1 is encoded as - left and right channel. This flag does not combine with - ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_LANG1``. When the - driver does not support stereo audio it shall fall back to mono. - - - .. row 3 - - - ``V4L2_TUNER_SUB_LANG1`` - - - 0x0008 - - - Modulate channel 1 and 2 as primary and secondary language of a - bilingual audio signal. When the input has only one channel it is - used for both languages. It is not possible to encode the primary - or secondary language only. This flag does not combine with - ``V4L2_TUNER_SUB_MONO``, ``V4L2_TUNER_SUB_STEREO`` or - ``V4L2_TUNER_SUB_SAP``. If the hardware does not support the - respective audio matrix, or the current video standard does not - permit bilingual audio the :ref:`VIDIOC_S_MODULATOR ` ioctl shall - return an ``EINVAL`` error code and the driver shall fall back to mono - or stereo mode. - - - .. row 4 - - - ``V4L2_TUNER_SUB_LANG2`` - - - 0x0004 - - - Same effect as ``V4L2_TUNER_SUB_SAP``. - - - .. row 5 - - - ``V4L2_TUNER_SUB_SAP`` - - - 0x0004 - - - When combined with ``V4L2_TUNER_SUB_MONO`` the first channel is - encoded as mono audio, the last channel as Second Audio Program. - When the input has only one channel it is used for both audio - tracks. When the input has three channels the mono track is a - down-mix of channel 1 and 2. When combined with - ``V4L2_TUNER_SUB_STEREO`` channel 1 and 2 are encoded as left and - right stereo audio, channel 3 as Second Audio Program. When the - input has only two channels, the first is encoded as left and - right channel and the second as SAP. When the input has only one - channel it is used for all audio tracks. It is not possible to - encode a Second Audio Program only. This flag must combine with - ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_STEREO``. If the - hardware does not support the respective audio matrix, or the - current video standard does not permit SAP the - :ref:`VIDIOC_S_MODULATOR ` ioctl shall return an ``EINVAL`` error code and - driver shall fall back to mono or stereo mode. - - - .. row 6 - - - ``V4L2_TUNER_SUB_RDS`` - - - 0x0010 - - - Enable the RDS encoder for a radio FM transmitter. + * - ``V4L2_TUNER_SUB_MONO`` + - 0x0001 + - Modulate channel 1 as mono audio, when the input has more + channels, a down-mix of channel 1 and 2. This flag does not + combine with ``V4L2_TUNER_SUB_STEREO`` or + ``V4L2_TUNER_SUB_LANG1``. + * - ``V4L2_TUNER_SUB_STEREO`` + - 0x0002 + - Modulate channel 1 and 2 as left and right channel of a stereo + audio signal. When the input has only one channel or two channels + and ``V4L2_TUNER_SUB_SAP`` is also set, channel 1 is encoded as + left and right channel. This flag does not combine with + ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_LANG1``. When the + driver does not support stereo audio it shall fall back to mono. + * - ``V4L2_TUNER_SUB_LANG1`` + - 0x0008 + - Modulate channel 1 and 2 as primary and secondary language of a + bilingual audio signal. When the input has only one channel it is + used for both languages. It is not possible to encode the primary + or secondary language only. This flag does not combine with + ``V4L2_TUNER_SUB_MONO``, ``V4L2_TUNER_SUB_STEREO`` or + ``V4L2_TUNER_SUB_SAP``. If the hardware does not support the + respective audio matrix, or the current video standard does not + permit bilingual audio the :ref:`VIDIOC_S_MODULATOR ` ioctl shall + return an ``EINVAL`` error code and the driver shall fall back to mono + or stereo mode. + * - ``V4L2_TUNER_SUB_LANG2`` + - 0x0004 + - Same effect as ``V4L2_TUNER_SUB_SAP``. + * - ``V4L2_TUNER_SUB_SAP`` + - 0x0004 + - When combined with ``V4L2_TUNER_SUB_MONO`` the first channel is + encoded as mono audio, the last channel as Second Audio Program. + When the input has only one channel it is used for both audio + tracks. When the input has three channels the mono track is a + down-mix of channel 1 and 2. When combined with + ``V4L2_TUNER_SUB_STEREO`` channel 1 and 2 are encoded as left and + right stereo audio, channel 3 as Second Audio Program. When the + input has only two channels, the first is encoded as left and + right channel and the second as SAP. When the input has only one + channel it is used for all audio tracks. It is not possible to + encode a Second Audio Program only. This flag must combine with + ``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_STEREO``. If the + hardware does not support the respective audio matrix, or the + current video standard does not permit SAP the + :ref:`VIDIOC_S_MODULATOR ` ioctl shall return an ``EINVAL`` error code and + driver shall fall back to mono or stereo mode. + * - ``V4L2_TUNER_SUB_RDS`` + - 0x0010 + - Enable the RDS encoder for a radio FM transmitter. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-parm.rst b/Documentation/media/uapi/v4l/vidioc-g-parm.rst index eb68c34bb9ac..3b2e6e59a334 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-parm.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-parm.rst @@ -60,55 +60,30 @@ union holding separate parameters for input and output devices. :stub-columns: 0 :widths: 1 1 1 2 - - - .. row 1 - - - __u32 - - - ``type`` - - - - - The buffer (stream) type, same as struct - :c:type:`v4l2_format` ``type``, set by the - application. See :c:type:`v4l2_buf_type` - - - .. row 2 - - - union - - - ``parm`` - - - - - - - - .. row 3 - - - - - struct :c:type:`v4l2_captureparm` - - - ``capture`` - - - Parameters for capture devices, used when ``type`` is - ``V4L2_BUF_TYPE_VIDEO_CAPTURE``. - - - .. row 4 - - - - - struct :c:type:`v4l2_outputparm` - - - ``output`` - - - Parameters for output devices, used when ``type`` is - ``V4L2_BUF_TYPE_VIDEO_OUTPUT``. - - - .. row 5 - - - - - __u8 - - - ``raw_data``\ [200] - - - A place holder for future extensions. + * - __u32 + - ``type`` + - + - The buffer (stream) type, same as struct + :c:type:`v4l2_format` ``type``, set by the + application. See :c:type:`v4l2_buf_type` + * - union + - ``parm`` + - + - + * - + - struct :c:type:`v4l2_captureparm` + - ``capture`` + - Parameters for capture devices, used when ``type`` is + ``V4L2_BUF_TYPE_VIDEO_CAPTURE``. + * - + - struct :c:type:`v4l2_outputparm` + - ``output`` + - Parameters for output devices, used when ``type`` is + ``V4L2_BUF_TYPE_VIDEO_OUTPUT``. + * - + - __u8 + - ``raw_data``\ [200] + - A place holder for future extensions. @@ -121,77 +96,47 @@ union holding separate parameters for input and output devices. :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``capability`` + - See :ref:`parm-caps`. + * - __u32 + - ``capturemode`` + - Set by drivers and applications, see :ref:`parm-flags`. + * - struct :c:type:`v4l2_fract` + - ``timeperframe`` + - This is the desired period between successive frames captured by + the driver, in seconds. The field is intended to skip frames on + the driver side, saving I/O bandwidth. - - .. row 1 + Applications store here the desired frame period, drivers return + the actual frame period, which must be greater or equal to the + nominal frame period determined by the current video standard + (struct :c:type:`v4l2_standard` ``frameperiod`` + field). Changing the video standard (also implicitly by switching + the video input) may reset this parameter to the nominal frame + period. To reset manually applications can just set this field to + zero. - - __u32 - - - ``capability`` - - - See :ref:`parm-caps`. - - - .. row 2 - - - __u32 - - - ``capturemode`` - - - Set by drivers and applications, see :ref:`parm-flags`. - - - .. row 3 - - - struct :c:type:`v4l2_fract` - - - ``timeperframe`` - - - This is the desired period between successive frames captured by - the driver, in seconds. The field is intended to skip frames on - the driver side, saving I/O bandwidth. - - Applications store here the desired frame period, drivers return - the actual frame period, which must be greater or equal to the - nominal frame period determined by the current video standard - (struct :c:type:`v4l2_standard` ``frameperiod`` - field). Changing the video standard (also implicitly by switching - the video input) may reset this parameter to the nominal frame - period. To reset manually applications can just set this field to - zero. - - Drivers support this function only when they set the - ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field. - - - .. row 4 - - - __u32 - - - ``extendedmode`` - - - Custom (driver specific) streaming parameters. When unused, - applications and drivers must set this field to zero. Applications - using this field should check the driver name and version, see - :ref:`querycap`. - - - .. row 5 - - - __u32 - - - ``readbuffers`` - - - Applications set this field to the desired number of buffers used - internally by the driver in :ref:`read() ` mode. - Drivers return the actual number of buffers. When an application - requests zero buffers, drivers should just return the current - setting rather than the minimum or an error code. For details see - :ref:`rw`. - - - .. row 6 - - - __u32 - - - ``reserved``\ [4] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + Drivers support this function only when they set the + ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field. + * - __u32 + - ``extendedmode`` + - Custom (driver specific) streaming parameters. When unused, + applications and drivers must set this field to zero. Applications + using this field should check the driver name and version, see + :ref:`querycap`. + * - __u32 + - ``readbuffers`` + - Applications set this field to the desired number of buffers used + internally by the driver in :ref:`read() ` mode. + Drivers return the actual number of buffers. When an application + requests zero buffers, drivers should just return the current + setting rather than the minimum or an error code. For details see + :ref:`rw`. + * - __u32 + - ``reserved``\ [4] + - Reserved for future extensions. Drivers and applications must set + the array to zero. @@ -204,84 +149,51 @@ union holding separate parameters for input and output devices. :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``capability`` + - See :ref:`parm-caps`. + * - __u32 + - ``outputmode`` + - Set by drivers and applications, see :ref:`parm-flags`. + * - struct :c:type:`v4l2_fract` + - ``timeperframe`` + - This is the desired period between successive frames output by the + driver, in seconds. + * - :cspan:`2` - - .. row 1 + The field is intended to repeat frames on the driver side in + :ref:`write() ` mode (in streaming mode timestamps + can be used to throttle the output), saving I/O bandwidth. - - __u32 + Applications store here the desired frame period, drivers return + the actual frame period, which must be greater or equal to the + nominal frame period determined by the current video standard + (struct :c:type:`v4l2_standard` ``frameperiod`` + field). Changing the video standard (also implicitly by switching + the video output) may reset this parameter to the nominal frame + period. To reset manually applications can just set this field to + zero. - - ``capability`` - - - See :ref:`parm-caps`. - - - .. row 2 - - - __u32 - - - ``outputmode`` - - - Set by drivers and applications, see :ref:`parm-flags`. - - - .. row 3 - - - struct :c:type:`v4l2_fract` - - - ``timeperframe`` - - - This is the desired period between successive frames output by the - driver, in seconds. - - - .. row 4 - - - :cspan:`2` - - The field is intended to repeat frames on the driver side in - :ref:`write() ` mode (in streaming mode timestamps - can be used to throttle the output), saving I/O bandwidth. - - Applications store here the desired frame period, drivers return - the actual frame period, which must be greater or equal to the - nominal frame period determined by the current video standard - (struct :c:type:`v4l2_standard` ``frameperiod`` - field). Changing the video standard (also implicitly by switching - the video output) may reset this parameter to the nominal frame - period. To reset manually applications can just set this field to - zero. - - Drivers support this function only when they set the - ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field. - - - .. row 5 - - - __u32 - - - ``extendedmode`` - - - Custom (driver specific) streaming parameters. When unused, - applications and drivers must set this field to zero. Applications - using this field should check the driver name and version, see - :ref:`querycap`. - - - .. row 6 - - - __u32 - - - ``writebuffers`` - - - Applications set this field to the desired number of buffers used - internally by the driver in :ref:`write() ` mode. Drivers - return the actual number of buffers. When an application requests - zero buffers, drivers should just return the current setting - rather than the minimum or an error code. For details see - :ref:`rw`. - - - .. row 7 - - - __u32 - - - ``reserved``\ [4] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + Drivers support this function only when they set the + ``V4L2_CAP_TIMEPERFRAME`` flag in the ``capability`` field. + * - __u32 + - ``extendedmode`` + - Custom (driver specific) streaming parameters. When unused, + applications and drivers must set this field to zero. Applications + using this field should check the driver name and version, see + :ref:`querycap`. + * - __u32 + - ``writebuffers`` + - Applications set this field to the desired number of buffers used + internally by the driver in :ref:`write() ` mode. Drivers + return the actual number of buffers. When an application requests + zero buffers, drivers should just return the current setting + rather than the minimum or an error code. For details see + :ref:`rw`. + * - __u32 + - ``reserved``\ [4] + - Reserved for future extensions. Drivers and applications must set + the array to zero. @@ -294,15 +206,10 @@ union holding separate parameters for input and output devices. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_CAP_TIMEPERFRAME`` - - - 0x1000 - - - The frame skipping/repeating controlled by the ``timeperframe`` - field is supported. + * - ``V4L2_CAP_TIMEPERFRAME`` + - 0x1000 + - The frame skipping/repeating controlled by the ``timeperframe`` + field is supported. @@ -315,41 +222,36 @@ union holding separate parameters for input and output devices. :stub-columns: 0 :widths: 3 1 4 + * - ``V4L2_MODE_HIGHQUALITY`` + - 0x0001 + - High quality imaging mode. High quality mode is intended for still + imaging applications. The idea is to get the best possible image + quality that the hardware can deliver. It is not defined how the + driver writer may achieve that; it will depend on the hardware and + the ingenuity of the driver writer. High quality mode is a + different mode from the regular motion video capture modes. In + high quality mode: - - .. row 1 + - The driver may be able to capture higher resolutions than for + motion capture. - - ``V4L2_MODE_HIGHQUALITY`` + - The driver may support fewer pixel formats than motion capture + (eg; true color). - - 0x0001 + - The driver may capture and arithmetically combine multiple + successive fields or frames to remove color edge artifacts and + reduce the noise in the video data. - - High quality imaging mode. High quality mode is intended for still - imaging applications. The idea is to get the best possible image - quality that the hardware can deliver. It is not defined how the - driver writer may achieve that; it will depend on the hardware and - the ingenuity of the driver writer. High quality mode is a - different mode from the regular motion video capture modes. In - high quality mode: + - The driver may capture images in slices like a scanner in order + to handle larger format images than would otherwise be + possible. - - The driver may be able to capture higher resolutions than for - motion capture. + - An image capture operation may be significantly slower than + motion capture. - - The driver may support fewer pixel formats than motion capture - (eg; true color). + - Moving objects in the image might have excessive motion blur. - - The driver may capture and arithmetically combine multiple - successive fields or frames to remove color edge artifacts and - reduce the noise in the video data. - - - The driver may capture images in slices like a scanner in order - to handle larger format images than would otherwise be - possible. - - - An image capture operation may be significantly slower than - motion capture. - - - Moving objects in the image might have excessive motion blur. - - - Capture might only work through the :ref:`read() ` call. + - Capture might only work through the :ref:`read() ` call. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-priority.rst b/Documentation/media/uapi/v4l/vidioc-g-priority.rst index cbd2a3cbb18e..a763988f64e4 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-priority.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-priority.rst @@ -53,55 +53,30 @@ with a pointer to this variable. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - ``V4L2_PRIORITY_UNSET`` - - - 0 - - - - - - .. row 2 - - - ``V4L2_PRIORITY_BACKGROUND`` - - - 1 - - - Lowest priority, usually applications running in background, for - example monitoring VBI transmissions. A proxy application running - in user space will be necessary if multiple applications want to - read from a device at this priority. - - - .. row 3 - - - ``V4L2_PRIORITY_INTERACTIVE`` - - - 2 - - - - - - .. row 4 - - - ``V4L2_PRIORITY_DEFAULT`` - - - 2 - - - Medium priority, usually applications started and interactively - controlled by the user. For example TV viewers, Teletext browsers, - or just "panel" applications to change the channel or video - controls. This is the default priority unless an application - requests another. - - - .. row 5 - - - ``V4L2_PRIORITY_RECORD`` - - - 3 - - - Highest priority. Only one file descriptor can have this priority, - it blocks any other fd from changing device properties. Usually - applications which must not be interrupted, like video recording. + * - ``V4L2_PRIORITY_UNSET`` + - 0 + - + * - ``V4L2_PRIORITY_BACKGROUND`` + - 1 + - Lowest priority, usually applications running in background, for + example monitoring VBI transmissions. A proxy application running + in user space will be necessary if multiple applications want to + read from a device at this priority. + * - ``V4L2_PRIORITY_INTERACTIVE`` + - 2 + - + * - ``V4L2_PRIORITY_DEFAULT`` + - 2 + - Medium priority, usually applications started and interactively + controlled by the user. For example TV viewers, Teletext browsers, + or just "panel" applications to change the channel or video + controls. This is the default priority unless an application + requests another. + * - ``V4L2_PRIORITY_RECORD`` + - 3 + - Highest priority. Only one file descriptor can have this priority, + it blocks any other fd from changing device properties. Usually + applications which must not be interrupted, like video recording. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-g-selection.rst index a687e236d0f1..3145a9166bad 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-selection.rst @@ -149,50 +149,25 @@ Selection targets and flags are documented in :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``type`` - - - Type of the buffer (from enum - :c:type:`v4l2_buf_type`). - - - .. row 2 - - - __u32 - - - ``target`` - - - Used to select between - :ref:`cropping and composing rectangles `. - - - .. row 3 - - - __u32 - - - ``flags`` - - - Flags controlling the selection rectangle adjustments, refer to - :ref:`selection flags `. - - - .. row 4 - - - struct :c:type:`v4l2_rect` - - - ``r`` - - - The selection rectangle. - - - .. row 5 - - - __u32 - - - ``reserved[9]`` - - - Reserved fields for future use. Drivers and applications must zero - this array. + * - __u32 + - ``type`` + - Type of the buffer (from enum + :c:type:`v4l2_buf_type`). + * - __u32 + - ``target`` + - Used to select between + :ref:`cropping and composing rectangles `. + * - __u32 + - ``flags`` + - Flags controlling the selection rectangle adjustments, refer to + :ref:`selection flags `. + * - struct :c:type:`v4l2_rect` + - ``r`` + - The selection rectangle. + * - __u32 + - ``reserved[9]`` + - Reserved fields for future use. Drivers and applications must zero + this array. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst index 04fae524850a..d7e2b2fa8b88 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst @@ -53,124 +53,67 @@ the sliced VBI API is unsupported or ``type`` is invalid. :stub-columns: 0 :widths: 3 3 2 2 2 + * - __u16 + - ``service_set`` + - :cspan:`2` A set of all data services supported by the driver. - - .. row 1 + Equal to the union of all elements of the ``service_lines`` array. + * - __u16 + - ``service_lines``\ [2][24] + - :cspan:`2` Each element of this array contains a set of data + services the hardware can look for or insert into a particular + scan line. Data services are defined in :ref:`vbi-services`. + Array indices map to ITU-R line numbers\ [#f1]_ as follows: + * - + - + - Element + - 525 line systems + - 625 line systems + * - + - + - ``service_lines``\ [0][1] + - 1 + - 1 + * - + - + - ``service_lines``\ [0][23] + - 23 + - 23 + * - + - + - ``service_lines``\ [1][1] + - 264 + - 314 + * - + - + - ``service_lines``\ [1][23] + - 286 + - 336 + * - + * - + - + - :cspan:`2` The number of VBI lines the hardware can capture or + output per frame, or the number of services it can identify on a + given line may be limited. For example on PAL line 16 the hardware + may be able to look for a VPS or Teletext signal, but not both at + the same time. Applications can learn about these limits using the + :ref:`VIDIOC_S_FMT ` ioctl as described in + :ref:`sliced`. + * - + * - + - + - :cspan:`2` Drivers must set ``service_lines`` [0][0] and + ``service_lines``\ [1][0] to zero. + * - __u32 + - ``type`` + - Type of the data stream, see :c:type:`v4l2_buf_type`. Should be + ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE`` or + ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT``. + * - __u32 + - ``reserved``\ [3] + - :cspan:`2` This array is reserved for future extensions. - - __u16 - - - ``service_set`` - - - :cspan:`2` A set of all data services supported by the driver. - - Equal to the union of all elements of the ``service_lines`` array. - - - .. row 2 - - - __u16 - - - ``service_lines``\ [2][24] - - - :cspan:`2` Each element of this array contains a set of data - services the hardware can look for or insert into a particular - scan line. Data services are defined in :ref:`vbi-services`. - Array indices map to ITU-R line numbers\ [#f1]_ as follows: - - - .. row 3 - - - - - - - Element - - - 525 line systems - - - 625 line systems - - - .. row 4 - - - - - - - ``service_lines``\ [0][1] - - - 1 - - - 1 - - - .. row 5 - - - - - - - ``service_lines``\ [0][23] - - - 23 - - - 23 - - - .. row 6 - - - - - - - ``service_lines``\ [1][1] - - - 264 - - - 314 - - - .. row 7 - - - - - - - ``service_lines``\ [1][23] - - - 286 - - - 336 - - - .. row 8 - - - - - - .. row 9 - - - - - - - :cspan:`2` The number of VBI lines the hardware can capture or - output per frame, or the number of services it can identify on a - given line may be limited. For example on PAL line 16 the hardware - may be able to look for a VPS or Teletext signal, but not both at - the same time. Applications can learn about these limits using the - :ref:`VIDIOC_S_FMT ` ioctl as described in - :ref:`sliced`. - - - .. row 10 - - - - - - .. row 11 - - - - - - - :cspan:`2` Drivers must set ``service_lines`` [0][0] and - ``service_lines``\ [1][0] to zero. - - - .. row 12 - - - __u32 - - - ``type`` - - - Type of the data stream, see :c:type:`v4l2_buf_type`. Should be - ``V4L2_BUF_TYPE_SLICED_VBI_CAPTURE`` or - ``V4L2_BUF_TYPE_SLICED_VBI_OUTPUT``. - - - .. row 13 - - - __u32 - - - ``reserved``\ [3] - - - :cspan:`2` This array is reserved for future extensions. - - Applications and drivers must set it to zero. + Applications and drivers must set it to zero. .. [#f1] @@ -190,95 +133,50 @@ the sliced VBI API is unsupported or ``type`` is invalid. :stub-columns: 0 :widths: 2 1 1 2 2 + * - Symbol + - Value + - Reference + - Lines, usually + - Payload + * - ``V4L2_SLICED_TELETEXT_B`` (Teletext System B) + - 0x0001 + - :ref:`ets300706`, - - .. row 1 + :ref:`itu653` + - PAL/SECAM line 7-22, 320-335 (second field 7-22) + - Last 42 of the 45 byte Teletext packet, that is without clock + run-in and framing code, lsb first transmitted. + * - ``V4L2_SLICED_VPS`` + - 0x0400 + - :ref:`ets300231` + - PAL line 16 + - Byte number 3 to 15 according to Figure 9 of ETS 300 231, lsb + first transmitted. + * - ``V4L2_SLICED_CAPTION_525`` + - 0x1000 + - :ref:`cea608` + - NTSC line 21, 284 (second field 21) + - Two bytes in transmission order, including parity bit, lsb first + transmitted. + * - ``V4L2_SLICED_WSS_625`` + - 0x4000 + - :ref:`en300294`, - - Symbol + :ref:`itu1119` + - PAL/SECAM line 23 + - - - Value + :: - - Reference - - - Lines, usually - - - Payload - - - .. row 2 - - - ``V4L2_SLICED_TELETEXT_B`` (Teletext System B) - - - 0x0001 - - - :ref:`ets300706`, - - :ref:`itu653` - - - PAL/SECAM line 7-22, 320-335 (second field 7-22) - - - Last 42 of the 45 byte Teletext packet, that is without clock - run-in and framing code, lsb first transmitted. - - - .. row 3 - - - ``V4L2_SLICED_VPS`` - - - 0x0400 - - - :ref:`ets300231` - - - PAL line 16 - - - Byte number 3 to 15 according to Figure 9 of ETS 300 231, lsb - first transmitted. - - - .. row 4 - - - ``V4L2_SLICED_CAPTION_525`` - - - 0x1000 - - - :ref:`cea608` - - - NTSC line 21, 284 (second field 21) - - - Two bytes in transmission order, including parity bit, lsb first - transmitted. - - - .. row 5 - - - ``V4L2_SLICED_WSS_625`` - - - 0x4000 - - - :ref:`en300294`, - - :ref:`itu1119` - - - PAL/SECAM line 23 - - - - - :: - - Byte 0 1 - msb lsb msb lsb - Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 - - - .. row 6 - - - ``V4L2_SLICED_VBI_525`` - - - 0x1000 - - - :cspan:`2` Set of services applicable to 525 line systems. - - - .. row 7 - - - ``V4L2_SLICED_VBI_625`` - - - 0x4401 - - - :cspan:`2` Set of services applicable to 625 line systems. + Byte 0 1 + msb lsb msb lsb + Bit 7 6 5 4 3 2 1 0 x x 13 12 11 10 9 + * - ``V4L2_SLICED_VBI_525`` + - 0x1000 + - :cspan:`2` Set of services applicable to 525 line systems. + * - ``V4L2_SLICED_VBI_625`` + - 0x4401 + - :cspan:`2` Set of services applicable to 625 line systems. .. raw:: latex diff --git a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst index d0251a1b6303..e8aa8cd7065f 100644 --- a/Documentation/media/uapi/v4l/vidioc-g-tuner.rst +++ b/Documentation/media/uapi/v4l/vidioc-g-tuner.rst @@ -69,195 +69,117 @@ To change the radio frequency the :header-rows: 0 :stub-columns: 0 - - - .. row 1 - - - __u32 - - - ``index`` - - - :cspan:`1` Identifies the tuner, set by the application. - - - .. row 2 - - - __u8 - - - ``name``\ [32] - - - :cspan:`1` - - Name of the tuner, a NUL-terminated ASCII string. - - This information is intended for the user. - - - .. row 3 - - - __u32 - - - ``type`` - - - :cspan:`1` Type of the tuner, see :c:type:`v4l2_tuner_type`. - - - .. row 4 - - - __u32 - - - ``capability`` - - - :cspan:`1` - - Tuner capability flags, see :ref:`tuner-capability`. Audio flags - indicate the ability to decode audio subprograms. They will *not* - change, for example with the current video standard. - - When the structure refers to a radio tuner the - ``V4L2_TUNER_CAP_LANG1``, ``V4L2_TUNER_CAP_LANG2`` and - ``V4L2_TUNER_CAP_NORM`` flags can't be used. - - If multiple frequency bands are supported, then ``capability`` is - the union of all ``capability`` fields of each struct - :c:type:`v4l2_frequency_band`. - - - .. row 5 - - - __u32 - - - ``rangelow`` - - - :cspan:`1` The lowest tunable frequency in units of 62.5 kHz, or - if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units - of 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` - is set, in units of 1 Hz. If multiple frequency bands are - supported, then ``rangelow`` is the lowest frequency of all the - frequency bands. - - - .. row 6 - - - __u32 - - - ``rangehigh`` - - - :cspan:`1` The highest tunable frequency in units of 62.5 kHz, - or if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in - units of 62.5 Hz, or if the ``capability`` flag - ``V4L2_TUNER_CAP_1HZ`` is set, in units of 1 Hz. If multiple - frequency bands are supported, then ``rangehigh`` is the highest - frequency of all the frequency bands. - - - .. row 7 - - - __u32 - - - ``rxsubchans`` - - - :cspan:`1` - - Some tuners or audio decoders can determine the received audio - subprograms by analyzing audio carriers, pilot tones or other - indicators. To pass this information drivers set flags defined in - :ref:`tuner-rxsubchans` in this field. For example: - - - .. row 8 - - - - - - - ``V4L2_TUNER_SUB_MONO`` - - - receiving mono audio - - - .. row 9 - - - - - - - ``STEREO | SAP`` - - - receiving stereo audio and a secondary audio program - - - .. row 10 - - - - - - - ``MONO | STEREO`` - - - receiving mono or stereo audio, the hardware cannot distinguish - - - .. row 11 - - - - - - - ``LANG1 | LANG2`` - - - receiving bilingual audio - - - .. row 12 - - - - - - - ``MONO | STEREO | LANG1 | LANG2`` - - - receiving mono, stereo or bilingual audio - - - .. row 13 - - - - - - - :cspan:`1` - - When the ``V4L2_TUNER_CAP_STEREO``, ``_LANG1``, ``_LANG2`` or - ``_SAP`` flag is cleared in the ``capability`` field, the - corresponding ``V4L2_TUNER_SUB_`` flag must not be set here. - - This field is valid only if this is the tuner of the current video - input, or when the structure refers to a radio tuner. - - - .. row 14 - - - __u32 - - - ``audmode`` - - - :cspan:`1` - - The selected audio mode, see :ref:`tuner-audmode` for valid - values. The audio mode does not affect audio subprogram detection, - and like a :ref:`control` it does not automatically - change unless the requested mode is invalid or unsupported. See - :ref:`tuner-matrix` for possible results when the selected and - received audio programs do not match. - - Currently this is the only field of struct - struct :c:type:`v4l2_tuner` applications can change. - - - .. row 15 - - - __u32 - - - ``signal`` - - - :cspan:`1` The signal strength if known. - - Ranging from 0 to 65535. Higher values indicate a better signal. - - - .. row 16 - - - __s32 - - - ``afc`` - - - :cspan:`1` Automatic frequency control. - - When the ``afc`` value is negative, the frequency is too - low, when positive too high. - - - .. row 17 - - - __u32 - - - ``reserved``\ [4] - - - :cspan:`1` Reserved for future extensions. - - Drivers and applications must set the array to zero. + * - __u32 + - ``index`` + - :cspan:`1` Identifies the tuner, set by the application. + * - __u8 + - ``name``\ [32] + - :cspan:`1` + + Name of the tuner, a NUL-terminated ASCII string. + + This information is intended for the user. + * - __u32 + - ``type`` + - :cspan:`1` Type of the tuner, see :c:type:`v4l2_tuner_type`. + * - __u32 + - ``capability`` + - :cspan:`1` + + Tuner capability flags, see :ref:`tuner-capability`. Audio flags + indicate the ability to decode audio subprograms. They will *not* + change, for example with the current video standard. + + When the structure refers to a radio tuner the + ``V4L2_TUNER_CAP_LANG1``, ``V4L2_TUNER_CAP_LANG2`` and + ``V4L2_TUNER_CAP_NORM`` flags can't be used. + + If multiple frequency bands are supported, then ``capability`` is + the union of all ``capability`` fields of each struct + :c:type:`v4l2_frequency_band`. + * - __u32 + - ``rangelow`` + - :cspan:`1` The lowest tunable frequency in units of 62.5 kHz, or + if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units + of 62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` + is set, in units of 1 Hz. If multiple frequency bands are + supported, then ``rangelow`` is the lowest frequency of all the + frequency bands. + * - __u32 + - ``rangehigh`` + - :cspan:`1` The highest tunable frequency in units of 62.5 kHz, + or if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in + units of 62.5 Hz, or if the ``capability`` flag + ``V4L2_TUNER_CAP_1HZ`` is set, in units of 1 Hz. If multiple + frequency bands are supported, then ``rangehigh`` is the highest + frequency of all the frequency bands. + * - __u32 + - ``rxsubchans`` + - :cspan:`1` + + Some tuners or audio decoders can determine the received audio + subprograms by analyzing audio carriers, pilot tones or other + indicators. To pass this information drivers set flags defined in + :ref:`tuner-rxsubchans` in this field. For example: + * - + - + - ``V4L2_TUNER_SUB_MONO`` + - receiving mono audio + * - + - + - ``STEREO | SAP`` + - receiving stereo audio and a secondary audio program + * - + - + - ``MONO | STEREO`` + - receiving mono or stereo audio, the hardware cannot distinguish + * - + - + - ``LANG1 | LANG2`` + - receiving bilingual audio + * - + - + - ``MONO | STEREO | LANG1 | LANG2`` + - receiving mono, stereo or bilingual audio + * - + - + - :cspan:`1` + + When the ``V4L2_TUNER_CAP_STEREO``, ``_LANG1``, ``_LANG2`` or + ``_SAP`` flag is cleared in the ``capability`` field, the + corresponding ``V4L2_TUNER_SUB_`` flag must not be set here. + + This field is valid only if this is the tuner of the current video + input, or when the structure refers to a radio tuner. + * - __u32 + - ``audmode`` + - :cspan:`1` + + The selected audio mode, see :ref:`tuner-audmode` for valid + values. The audio mode does not affect audio subprogram detection, + and like a :ref:`control` it does not automatically + change unless the requested mode is invalid or unsupported. See + :ref:`tuner-matrix` for possible results when the selected and + received audio programs do not match. + + Currently this is the only field of struct + struct :c:type:`v4l2_tuner` applications can change. + * - __u32 + - ``signal`` + - :cspan:`1` The signal strength if known. + + Ranging from 0 to 65535. Higher values indicate a better signal. + * - __s32 + - ``afc`` + - :cspan:`1` Automatic frequency control. + + When the ``afc`` value is negative, the frequency is too + low, when positive too high. + * - __u32 + - ``reserved``\ [4] + - :cspan:`1` Reserved for future extensions. + + Drivers and applications must set the array to zero. @@ -270,39 +192,19 @@ To change the radio frequency the :stub-columns: 0 :widths: 3 1 6 - - - .. row 1 - - - ``V4L2_TUNER_RADIO`` - - - 1 - - - Tuner supports radio - - - .. row 2 - - - ``V4L2_TUNER_ANALOG_TV`` - - - 2 - - - Tuner supports analog TV - - - .. row 3 - - - ``V4L2_TUNER_SDR`` - - - 4 - - - Tuner controls the A/D and/or D/A block of a - Sofware Digital Radio (SDR) - - - .. row 4 - - - ``V4L2_TUNER_RF`` - - - 5 - - - Tuner controls the RF part of a Sofware Digital Radio (SDR) + * - ``V4L2_TUNER_RADIO`` + - 1 + - Tuner supports radio + * - ``V4L2_TUNER_ANALOG_TV`` + - 2 + - Tuner supports analog TV + * - ``V4L2_TUNER_SDR`` + - 4 + - Tuner controls the A/D and/or D/A block of a + Sofware Digital Radio (SDR) + * - ``V4L2_TUNER_RF`` + - 5 + - Tuner controls the RF part of a Sofware Digital Radio (SDR) .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| @@ -316,154 +218,84 @@ To change the radio frequency the :stub-columns: 0 :widths: 3 1 4 + * - ``V4L2_TUNER_CAP_LOW`` + - 0x0001 + - When set, tuning frequencies are expressed in units of 62.5 Hz + instead of 62.5 kHz. + * - ``V4L2_TUNER_CAP_NORM`` + - 0x0002 + - This is a multi-standard tuner; the video standard can or must be + switched. (B/G PAL tuners for example are typically not considered + multi-standard because the video standard is automatically + determined from the frequency band.) The set of supported video + standards is available from the struct + :c:type:`v4l2_input` pointing to this tuner, see the + description of ioctl :ref:`VIDIOC_ENUMINPUT` + for details. Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this + capability. + * - ``V4L2_TUNER_CAP_HWSEEK_BOUNDED`` + - 0x0004 + - If set, then this tuner supports the hardware seek functionality + where the seek stops when it reaches the end of the frequency + range. + * - ``V4L2_TUNER_CAP_HWSEEK_WRAP`` + - 0x0008 + - If set, then this tuner supports the hardware seek functionality + where the seek wraps around when it reaches the end of the + frequency range. + * - ``V4L2_TUNER_CAP_STEREO`` + - 0x0010 + - Stereo audio reception is supported. + * - ``V4L2_TUNER_CAP_LANG1`` + - 0x0040 + - Reception of the primary language of a bilingual audio program is + supported. Bilingual audio is a feature of two-channel systems, + transmitting the primary language monaural on the main audio + carrier and a secondary language monaural on a second carrier. + Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this capability. + * - ``V4L2_TUNER_CAP_LANG2`` + - 0x0020 + - Reception of the secondary language of a bilingual audio program + is supported. Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this + capability. + * - ``V4L2_TUNER_CAP_SAP`` + - 0x0020 + - Reception of a secondary audio program is supported. This is a + feature of the BTSC system which accompanies the NTSC video + standard. Two audio carriers are available for mono or stereo + transmissions of a primary language, and an independent third + carrier for a monaural secondary language. Only + ``V4L2_TUNER_ANALOG_TV`` tuners can have this capability. - - .. row 1 + .. note:: - - ``V4L2_TUNER_CAP_LOW`` - - - 0x0001 - - - When set, tuning frequencies are expressed in units of 62.5 Hz - instead of 62.5 kHz. - - - .. row 2 - - - ``V4L2_TUNER_CAP_NORM`` - - - 0x0002 - - - This is a multi-standard tuner; the video standard can or must be - switched. (B/G PAL tuners for example are typically not considered - multi-standard because the video standard is automatically - determined from the frequency band.) The set of supported video - standards is available from the struct - :c:type:`v4l2_input` pointing to this tuner, see the - description of ioctl :ref:`VIDIOC_ENUMINPUT` - for details. Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this - capability. - - - .. row 3 - - - ``V4L2_TUNER_CAP_HWSEEK_BOUNDED`` - - - 0x0004 - - - If set, then this tuner supports the hardware seek functionality - where the seek stops when it reaches the end of the frequency - range. - - - .. row 4 - - - ``V4L2_TUNER_CAP_HWSEEK_WRAP`` - - - 0x0008 - - - If set, then this tuner supports the hardware seek functionality - where the seek wraps around when it reaches the end of the - frequency range. - - - .. row 5 - - - ``V4L2_TUNER_CAP_STEREO`` - - - 0x0010 - - - Stereo audio reception is supported. - - - .. row 6 - - - ``V4L2_TUNER_CAP_LANG1`` - - - 0x0040 - - - Reception of the primary language of a bilingual audio program is - supported. Bilingual audio is a feature of two-channel systems, - transmitting the primary language monaural on the main audio - carrier and a secondary language monaural on a second carrier. - Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this capability. - - - .. row 7 - - - ``V4L2_TUNER_CAP_LANG2`` - - - 0x0020 - - - Reception of the secondary language of a bilingual audio program - is supported. Only ``V4L2_TUNER_ANALOG_TV`` tuners can have this - capability. - - - .. row 8 - - - ``V4L2_TUNER_CAP_SAP`` - - - 0x0020 - - - Reception of a secondary audio program is supported. This is a - feature of the BTSC system which accompanies the NTSC video - standard. Two audio carriers are available for mono or stereo - transmissions of a primary language, and an independent third - carrier for a monaural secondary language. Only - ``V4L2_TUNER_ANALOG_TV`` tuners can have this capability. - - .. note:: - - The ``V4L2_TUNER_CAP_LANG2`` and ``V4L2_TUNER_CAP_SAP`` - flags are synonyms. ``V4L2_TUNER_CAP_SAP`` applies when the tuner - supports the ``V4L2_STD_NTSC_M`` video standard. - - - .. row 9 - - - ``V4L2_TUNER_CAP_RDS`` - - - 0x0080 - - - RDS capture is supported. This capability is only valid for radio - tuners. - - - .. row 10 - - - ``V4L2_TUNER_CAP_RDS_BLOCK_IO`` - - - 0x0100 - - - The RDS data is passed as unparsed RDS blocks. - - - .. row 11 - - - ``V4L2_TUNER_CAP_RDS_CONTROLS`` - - - 0x0200 - - - The RDS data is parsed by the hardware and set via controls. - - - .. row 12 - - - ``V4L2_TUNER_CAP_FREQ_BANDS`` - - - 0x0400 - - - The :ref:`VIDIOC_ENUM_FREQ_BANDS` - ioctl can be used to enumerate the available frequency bands. - - - .. row 13 - - - ``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` - - - 0x0800 - - - The range to search when using the hardware seek functionality is - programmable, see - :ref:`VIDIOC_S_HW_FREQ_SEEK` for - details. - - - .. row 14 - - - ``V4L2_TUNER_CAP_1HZ`` - - - 0x1000 - - - When set, tuning frequencies are expressed in units of 1 Hz - instead of 62.5 kHz. + The ``V4L2_TUNER_CAP_LANG2`` and ``V4L2_TUNER_CAP_SAP`` + flags are synonyms. ``V4L2_TUNER_CAP_SAP`` applies when the tuner + supports the ``V4L2_STD_NTSC_M`` video standard. + * - ``V4L2_TUNER_CAP_RDS`` + - 0x0080 + - RDS capture is supported. This capability is only valid for radio + tuners. + * - ``V4L2_TUNER_CAP_RDS_BLOCK_IO`` + - 0x0100 + - The RDS data is passed as unparsed RDS blocks. + * - ``V4L2_TUNER_CAP_RDS_CONTROLS`` + - 0x0200 + - The RDS data is parsed by the hardware and set via controls. + * - ``V4L2_TUNER_CAP_FREQ_BANDS`` + - 0x0400 + - The :ref:`VIDIOC_ENUM_FREQ_BANDS` + ioctl can be used to enumerate the available frequency bands. + * - ``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` + - 0x0800 + - The range to search when using the hardware seek functionality is + programmable, see + :ref:`VIDIOC_S_HW_FREQ_SEEK` for + details. + * - ``V4L2_TUNER_CAP_1HZ`` + - 0x1000 + - When set, tuning frequencies are expressed in units of 1 Hz + instead of 62.5 kHz. @@ -476,63 +308,33 @@ To change the radio frequency the :stub-columns: 0 :widths: 3 1 4 + * - ``V4L2_TUNER_SUB_MONO`` + - 0x0001 + - The tuner receives a mono audio signal. + * - ``V4L2_TUNER_SUB_STEREO`` + - 0x0002 + - The tuner receives a stereo audio signal. + * - ``V4L2_TUNER_SUB_LANG1`` + - 0x0008 + - The tuner receives the primary language of a bilingual audio + signal. Drivers must clear this flag when the current video + standard is ``V4L2_STD_NTSC_M``. + * - ``V4L2_TUNER_SUB_LANG2`` + - 0x0004 + - The tuner receives the secondary language of a bilingual audio + signal (or a second audio program). + * - ``V4L2_TUNER_SUB_SAP`` + - 0x0004 + - The tuner receives a Second Audio Program. - - .. row 1 + .. note:: - - ``V4L2_TUNER_SUB_MONO`` - - - 0x0001 - - - The tuner receives a mono audio signal. - - - .. row 2 - - - ``V4L2_TUNER_SUB_STEREO`` - - - 0x0002 - - - The tuner receives a stereo audio signal. - - - .. row 3 - - - ``V4L2_TUNER_SUB_LANG1`` - - - 0x0008 - - - The tuner receives the primary language of a bilingual audio - signal. Drivers must clear this flag when the current video - standard is ``V4L2_STD_NTSC_M``. - - - .. row 4 - - - ``V4L2_TUNER_SUB_LANG2`` - - - 0x0004 - - - The tuner receives the secondary language of a bilingual audio - signal (or a second audio program). - - - .. row 5 - - - ``V4L2_TUNER_SUB_SAP`` - - - 0x0004 - - - The tuner receives a Second Audio Program. - - .. note:: - - The ``V4L2_TUNER_SUB_LANG2`` and ``V4L2_TUNER_SUB_SAP`` - flags are synonyms. The ``V4L2_TUNER_SUB_SAP`` flag applies - when the current video standard is ``V4L2_STD_NTSC_M``. - - - .. row 6 - - - ``V4L2_TUNER_SUB_RDS`` - - - 0x0010 - - - The tuner receives an RDS channel. + The ``V4L2_TUNER_SUB_LANG2`` and ``V4L2_TUNER_SUB_SAP`` + flags are synonyms. The ``V4L2_TUNER_SUB_SAP`` flag applies + when the current video standard is ``V4L2_STD_NTSC_M``. + * - ``V4L2_TUNER_SUB_RDS`` + - 0x0010 + - The tuner receives an RDS channel. @@ -545,78 +347,48 @@ To change the radio frequency the :stub-columns: 0 :widths: 3 1 4 + * - ``V4L2_TUNER_MODE_MONO`` + - 0 + - Play mono audio. When the tuner receives a stereo signal this a + down-mix of the left and right channel. When the tuner receives a + bilingual or SAP signal this mode selects the primary language. + * - ``V4L2_TUNER_MODE_STEREO`` + - 1 + - Play stereo audio. When the tuner receives bilingual audio it may + play different languages on the left and right channel or the + primary language is played on both channels. - - .. row 1 + Playing different languages in this mode is deprecated. New + drivers should do this only in ``MODE_LANG1_LANG2``. - - ``V4L2_TUNER_MODE_MONO`` + When the tuner receives no stereo signal or does not support + stereo reception the driver shall fall back to ``MODE_MONO``. + * - ``V4L2_TUNER_MODE_LANG1`` + - 3 + - Play the primary language, mono or stereo. Only + ``V4L2_TUNER_ANALOG_TV`` tuners support this mode. + * - ``V4L2_TUNER_MODE_LANG2`` + - 2 + - Play the secondary language, mono. When the tuner receives no + bilingual audio or SAP, or their reception is not supported the + driver shall fall back to mono or stereo mode. Only + ``V4L2_TUNER_ANALOG_TV`` tuners support this mode. + * - ``V4L2_TUNER_MODE_SAP`` + - 2 + - Play the Second Audio Program. When the tuner receives no + bilingual audio or SAP, or their reception is not supported the + driver shall fall back to mono or stereo mode. Only + ``V4L2_TUNER_ANALOG_TV`` tuners support this mode. - - 0 - - - Play mono audio. When the tuner receives a stereo signal this a - down-mix of the left and right channel. When the tuner receives a - bilingual or SAP signal this mode selects the primary language. - - - .. row 2 - - - ``V4L2_TUNER_MODE_STEREO`` - - - 1 - - - Play stereo audio. When the tuner receives bilingual audio it may - play different languages on the left and right channel or the - primary language is played on both channels. - - Playing different languages in this mode is deprecated. New - drivers should do this only in ``MODE_LANG1_LANG2``. - - When the tuner receives no stereo signal or does not support - stereo reception the driver shall fall back to ``MODE_MONO``. - - - .. row 3 - - - ``V4L2_TUNER_MODE_LANG1`` - - - 3 - - - Play the primary language, mono or stereo. Only - ``V4L2_TUNER_ANALOG_TV`` tuners support this mode. - - - .. row 4 - - - ``V4L2_TUNER_MODE_LANG2`` - - - 2 - - - Play the secondary language, mono. When the tuner receives no - bilingual audio or SAP, or their reception is not supported the - driver shall fall back to mono or stereo mode. Only - ``V4L2_TUNER_ANALOG_TV`` tuners support this mode. - - - .. row 5 - - - ``V4L2_TUNER_MODE_SAP`` - - - 2 - - - Play the Second Audio Program. When the tuner receives no - bilingual audio or SAP, or their reception is not supported the - driver shall fall back to mono or stereo mode. Only - ``V4L2_TUNER_ANALOG_TV`` tuners support this mode. - - .. note:: The ``V4L2_TUNER_MODE_LANG2`` and ``V4L2_TUNER_MODE_SAP`` - are synonyms. - - - .. row 6 - - - ``V4L2_TUNER_MODE_LANG1_LANG2`` - - - 4 - - - Play the primary language on the left channel, the secondary - language on the right channel. When the tuner receives no - bilingual audio or SAP, it shall fall back to ``MODE_LANG1`` or - ``MODE_MONO``. Only ``V4L2_TUNER_ANALOG_TV`` tuners support this - mode. + .. note:: The ``V4L2_TUNER_MODE_LANG2`` and ``V4L2_TUNER_MODE_SAP`` + are synonyms. + * - ``V4L2_TUNER_MODE_LANG1_LANG2`` + - 4 + - Play the primary language on the left channel, the secondary + language on the right channel. When the tuner receives no + bilingual audio or SAP, it shall fall back to ``MODE_LANG1`` or + ``MODE_MONO``. Only ``V4L2_TUNER_ANALOG_TV`` tuners support this + mode. .. raw:: latex @@ -628,95 +400,44 @@ To change the radio frequency the :header-rows: 2 :stub-columns: 0 - - - .. row 1 - - - - - :cspan:`5` Selected ``V4L2_TUNER_MODE_`` - - - .. row 2 - - - Received ``V4L2_TUNER_SUB_`` - - - ``MONO`` - - - ``STEREO`` - - - ``LANG1`` - - - ``LANG2 = SAP`` - - - ``LANG1_LANG2``\ [#f1]_ - - - .. row 3 - - - ``MONO`` - - - Mono - - - Mono/Mono - - - Mono - - - Mono - - - Mono/Mono - - - .. row 4 - - - ``MONO | SAP`` - - - Mono - - - Mono/Mono - - - Mono - - - SAP - - - Mono/SAP (preferred) or Mono/Mono - - - .. row 5 - - - ``STEREO`` - - - L+R - - - L/R - - - Stereo L/R (preferred) or Mono L+R - - - Stereo L/R (preferred) or Mono L+R - - - L/R (preferred) or L+R/L+R - - - .. row 6 - - - ``STEREO | SAP`` - - - L+R - - - L/R - - - Stereo L/R (preferred) or Mono L+R - - - SAP - - - L+R/SAP (preferred) or L/R or L+R/L+R - - - .. row 7 - - - ``LANG1 | LANG2`` - - - Language 1 - - - Lang1/Lang2 (deprecated [#f2]_) or Lang1/Lang1 - - - Language 1 - - - Language 2 - - - Lang1/Lang2 (preferred) or Lang1/Lang1 + * - + - :cspan:`5` Selected ``V4L2_TUNER_MODE_`` + * - Received ``V4L2_TUNER_SUB_`` + - ``MONO`` + - ``STEREO`` + - ``LANG1`` + - ``LANG2 = SAP`` + - ``LANG1_LANG2``\ [#f1]_ + * - ``MONO`` + - Mono + - Mono/Mono + - Mono + - Mono + - Mono/Mono + * - ``MONO | SAP`` + - Mono + - Mono/Mono + - Mono + - SAP + - Mono/SAP (preferred) or Mono/Mono + * - ``STEREO`` + - L+R + - L/R + - Stereo L/R (preferred) or Mono L+R + - Stereo L/R (preferred) or Mono L+R + - L/R (preferred) or L+R/L+R + * - ``STEREO | SAP`` + - L+R + - L/R + - Stereo L/R (preferred) or Mono L+R + - SAP + - L+R/SAP (preferred) or L/R or L+R/L+R + * - ``LANG1 | LANG2`` + - Language 1 + - Lang1/Lang2 (deprecated [#f2]_) or Lang1/Lang1 + - Language 1 + - Language 2 + - Lang1/Lang2 (preferred) or Lang1/Lang1 .. raw:: latex diff --git a/Documentation/media/uapi/v4l/vidioc-querycap.rst b/Documentation/media/uapi/v4l/vidioc-querycap.rst index f2785cad2e57..165d8314327e 100644 --- a/Documentation/media/uapi/v4l/vidioc-querycap.rst +++ b/Documentation/media/uapi/v4l/vidioc-querycap.rst @@ -48,123 +48,86 @@ specification the ioctl returns an ``EINVAL`` error code. :stub-columns: 0 :widths: 3 4 20 - - .. row 1 + * - __u8 + - ``driver``\ [16] + - Name of the driver, a unique NUL-terminated ASCII string. For + example: "bttv". Driver specific applications can use this + information to verify the driver identity. It is also useful to + work around known bugs, or to identify drivers in error reports. - - __u8 + Storing strings in fixed sized arrays is bad practice but + unavoidable here. Drivers and applications should take precautions + to never read or write beyond the end of the array and to make + sure the strings are properly NUL-terminated. + * - __u8 + - ``card``\ [32] + - Name of the device, a NUL-terminated UTF-8 string. For example: + "Yoyodyne TV/FM". One driver may support different brands or + models of video hardware. This information is intended for users, + for example in a menu of available devices. Since multiple TV + cards of the same brand may be installed which are supported by + the same driver, this name should be combined with the character + device file name (e. g. ``/dev/video2``) or the ``bus_info`` + string to avoid ambiguities. + * - __u8 + - ``bus_info``\ [32] + - Location of the device in the system, a NUL-terminated ASCII + string. For example: "PCI:0000:05:06.0". This information is + intended for users, to distinguish multiple identical devices. If + no such information is available the field must simply count the + devices controlled by the driver ("platform:vivi-000"). The + bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI + Express boards, "usb-" for USB devices, "I2C:" for i2c devices, + "ISA:" for ISA devices, "parport" for parallel port devices and + "platform:" for platform devices. + * - __u32 + - ``version`` + - Version number of the driver. - - ``driver``\ [16] + Starting with kernel 3.1, the version reported is provided by the + V4L2 subsystem following the kernel numbering scheme. However, it + may not always return the same version as the kernel if, for + example, a stable or distribution-modified kernel uses the V4L2 + stack from a newer kernel. - - Name of the driver, a unique NUL-terminated ASCII string. For - example: "bttv". Driver specific applications can use this - information to verify the driver identity. It is also useful to - work around known bugs, or to identify drivers in error reports. + The version number is formatted using the ``KERNEL_VERSION()`` + macro: + * - :cspan:`2` - Storing strings in fixed sized arrays is bad practice but - unavoidable here. Drivers and applications should take precautions - to never read or write beyond the end of the array and to make - sure the strings are properly NUL-terminated. + ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))`` - - .. row 2 + ``__u32 version = KERNEL_VERSION(0, 8, 1);`` - - __u8 + ``printf ("Version: %u.%u.%u\\n",`` - - ``card``\ [32] - - - Name of the device, a NUL-terminated UTF-8 string. For example: - "Yoyodyne TV/FM". One driver may support different brands or - models of video hardware. This information is intended for users, - for example in a menu of available devices. Since multiple TV - cards of the same brand may be installed which are supported by - the same driver, this name should be combined with the character - device file name (e. g. ``/dev/video2``) or the ``bus_info`` - string to avoid ambiguities. - - - .. row 3 - - - __u8 - - - ``bus_info``\ [32] - - - Location of the device in the system, a NUL-terminated ASCII - string. For example: "PCI:0000:05:06.0". This information is - intended for users, to distinguish multiple identical devices. If - no such information is available the field must simply count the - devices controlled by the driver ("platform:vivi-000"). The - bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI - Express boards, "usb-" for USB devices, "I2C:" for i2c devices, - "ISA:" for ISA devices, "parport" for parallel port devices and - "platform:" for platform devices. - - - .. row 4 - - - __u32 - - - ``version`` - - - Version number of the driver. - - Starting with kernel 3.1, the version reported is provided by the - V4L2 subsystem following the kernel numbering scheme. However, it - may not always return the same version as the kernel if, for - example, a stable or distribution-modified kernel uses the V4L2 - stack from a newer kernel. - - The version number is formatted using the ``KERNEL_VERSION()`` - macro: - - - .. row 5 - - - :cspan:`2` - - ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))`` - - ``__u32 version = KERNEL_VERSION(0, 8, 1);`` - - ``printf ("Version: %u.%u.%u\\n",`` - - ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);`` - - - .. row 6 - - - __u32 - - - ``capabilities`` - - - Available capabilities of the physical device as a whole, see - :ref:`device-capabilities`. The same physical device can export - multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and - /dev/radioZ). The ``capabilities`` field should contain a union of - all capabilities available around the several V4L2 devices - exported to userspace. For all those devices the ``capabilities`` - field returns the same set of capabilities. This allows - applications to open just one of the devices (typically the video - device) and discover whether video, vbi and/or radio are also - supported. - - - .. row 7 - - - __u32 - - - ``device_caps`` - - - Device capabilities of the opened device, see - :ref:`device-capabilities`. Should contain the available - capabilities of that specific device node. So, for example, - ``device_caps`` of a radio device will only contain radio related - capabilities and no video or vbi capabilities. This field is only - set if the ``capabilities`` field contains the - ``V4L2_CAP_DEVICE_CAPS`` capability. Only the ``capabilities`` - field can have the ``V4L2_CAP_DEVICE_CAPS`` capability, - ``device_caps`` will never set ``V4L2_CAP_DEVICE_CAPS``. - - - .. row 8 - - - __u32 - - - ``reserved``\ [3] - - - Reserved for future extensions. Drivers must set this array to - zero. + ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);`` + * - __u32 + - ``capabilities`` + - Available capabilities of the physical device as a whole, see + :ref:`device-capabilities`. The same physical device can export + multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and + /dev/radioZ). The ``capabilities`` field should contain a union of + all capabilities available around the several V4L2 devices + exported to userspace. For all those devices the ``capabilities`` + field returns the same set of capabilities. This allows + applications to open just one of the devices (typically the video + device) and discover whether video, vbi and/or radio are also + supported. + * - __u32 + - ``device_caps`` + - Device capabilities of the opened device, see + :ref:`device-capabilities`. Should contain the available + capabilities of that specific device node. So, for example, + ``device_caps`` of a radio device will only contain radio related + capabilities and no video or vbi capabilities. This field is only + set if the ``capabilities`` field contains the + ``V4L2_CAP_DEVICE_CAPS`` capability. Only the ``capabilities`` + field can have the ``V4L2_CAP_DEVICE_CAPS`` capability, + ``device_caps`` will never set ``V4L2_CAP_DEVICE_CAPS``. + * - __u32 + - ``reserved``\ [3] + - Reserved for future extensions. Drivers must set this array to + zero. @@ -179,252 +142,118 @@ specification the ioctl returns an ``EINVAL`` error code. :stub-columns: 0 :widths: 3 1 4 - - .. row 1 - - - ``V4L2_CAP_VIDEO_CAPTURE`` - - - 0x00000001 - - - The device supports the single-planar API through the - :ref:`Video Capture ` interface. - - - .. row 2 - - - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE`` - - - 0x00001000 - - - The device supports the :ref:`multi-planar API ` - through the :ref:`Video Capture ` interface. - - - .. row 3 - - - ``V4L2_CAP_VIDEO_OUTPUT`` - - - 0x00000002 - - - The device supports the single-planar API through the - :ref:`Video Output ` interface. - - - .. row 4 - - - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE`` - - - 0x00002000 - - - The device supports the :ref:`multi-planar API ` - through the :ref:`Video Output ` interface. - - - .. row 5 - - - ``V4L2_CAP_VIDEO_M2M`` - - - 0x00004000 - - - The device supports the single-planar API through the Video - Memory-To-Memory interface. - - - .. row 6 - - - ``V4L2_CAP_VIDEO_M2M_MPLANE`` - - - 0x00008000 - - - The device supports the :ref:`multi-planar API ` - through the Video Memory-To-Memory interface. - - - .. row 7 - - - ``V4L2_CAP_VIDEO_OVERLAY`` - - - 0x00000004 - - - The device supports the :ref:`Video Overlay ` - interface. A video overlay device typically stores captured images - directly in the video memory of a graphics card, with hardware - clipping and scaling. - - - .. row 8 - - - ``V4L2_CAP_VBI_CAPTURE`` - - - 0x00000010 - - - The device supports the :ref:`Raw VBI Capture ` - interface, providing Teletext and Closed Caption data. - - - .. row 9 - - - ``V4L2_CAP_VBI_OUTPUT`` - - - 0x00000020 - - - The device supports the :ref:`Raw VBI Output ` - interface. - - - .. row 10 - - - ``V4L2_CAP_SLICED_VBI_CAPTURE`` - - - 0x00000040 - - - The device supports the :ref:`Sliced VBI Capture ` - interface. - - - .. row 11 - - - ``V4L2_CAP_SLICED_VBI_OUTPUT`` - - - 0x00000080 - - - The device supports the :ref:`Sliced VBI Output ` - interface. - - - .. row 12 - - - ``V4L2_CAP_RDS_CAPTURE`` - - - 0x00000100 - - - The device supports the :ref:`RDS ` capture interface. - - - .. row 13 - - - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY`` - - - 0x00000200 - - - The device supports the :ref:`Video Output Overlay ` (OSD) - interface. Unlike the *Video Overlay* interface, this is a - secondary function of video output devices and overlays an image - onto an outgoing video signal. When the driver sets this flag, it - must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice - versa. [#f1]_ - - - .. row 14 - - - ``V4L2_CAP_HW_FREQ_SEEK`` - - - 0x00000400 - - - The device supports the - :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl - for hardware frequency seeking. - - - .. row 15 - - - ``V4L2_CAP_RDS_OUTPUT`` - - - 0x00000800 - - - The device supports the :ref:`RDS ` output interface. - - - .. row 16 - - - ``V4L2_CAP_TUNER`` - - - 0x00010000 - - - The device has some sort of tuner to receive RF-modulated video - signals. For more information about tuner programming see - :ref:`tuner`. - - - .. row 17 - - - ``V4L2_CAP_AUDIO`` - - - 0x00020000 - - - The device has audio inputs or outputs. It may or may not support - audio recording or playback, in PCM or compressed formats. PCM - audio support must be implemented as ALSA or OSS interface. For - more information on audio inputs and outputs see :ref:`audio`. - - - .. row 18 - - - ``V4L2_CAP_RADIO`` - - - 0x00040000 - - - This is a radio receiver. - - - .. row 19 - - - ``V4L2_CAP_MODULATOR`` - - - 0x00080000 - - - The device has some sort of modulator to emit RF-modulated - video/audio signals. For more information about modulator - programming see :ref:`tuner`. - - - .. row 20 - - - ``V4L2_CAP_SDR_CAPTURE`` - - - 0x00100000 - - - The device supports the :ref:`SDR Capture ` interface. - - - .. row 21 - - - ``V4L2_CAP_EXT_PIX_FORMAT`` - - - 0x00200000 - - - The device supports the struct - :c:type:`v4l2_pix_format` extended fields. - - - .. row 22 - - - ``V4L2_CAP_SDR_OUTPUT`` - - - 0x00400000 - - - The device supports the :ref:`SDR Output ` interface. - - - .. row 23 - - - ``V4L2_CAP_READWRITE`` - - - 0x01000000 - - - The device supports the :ref:`read() ` and/or - :ref:`write() ` I/O methods. - - - .. row 24 - - - ``V4L2_CAP_ASYNCIO`` - - - 0x02000000 - - - The device supports the :ref:`asynchronous ` I/O methods. - - - .. row 25 - - - ``V4L2_CAP_STREAMING`` - - - 0x04000000 - - - The device supports the :ref:`streaming ` I/O method. - - - .. row 26 - - - ``V4L2_CAP_TOUCH`` - - - 0x10000000 - - - This is a touch device. - - - .. row 27 - - - ``V4L2_CAP_DEVICE_CAPS`` - - - 0x80000000 - - - The driver fills the ``device_caps`` field. This capability can - only appear in the ``capabilities`` field and never in the - ``device_caps`` field. + * - ``V4L2_CAP_VIDEO_CAPTURE`` + - 0x00000001 + - The device supports the single-planar API through the + :ref:`Video Capture ` interface. + * - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE`` + - 0x00001000 + - The device supports the :ref:`multi-planar API ` + through the :ref:`Video Capture ` interface. + * - ``V4L2_CAP_VIDEO_OUTPUT`` + - 0x00000002 + - The device supports the single-planar API through the + :ref:`Video Output ` interface. + * - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE`` + - 0x00002000 + - The device supports the :ref:`multi-planar API ` + through the :ref:`Video Output ` interface. + * - ``V4L2_CAP_VIDEO_M2M`` + - 0x00004000 + - The device supports the single-planar API through the Video + Memory-To-Memory interface. + * - ``V4L2_CAP_VIDEO_M2M_MPLANE`` + - 0x00008000 + - The device supports the :ref:`multi-planar API ` + through the Video Memory-To-Memory interface. + * - ``V4L2_CAP_VIDEO_OVERLAY`` + - 0x00000004 + - The device supports the :ref:`Video Overlay ` + interface. A video overlay device typically stores captured images + directly in the video memory of a graphics card, with hardware + clipping and scaling. + * - ``V4L2_CAP_VBI_CAPTURE`` + - 0x00000010 + - The device supports the :ref:`Raw VBI Capture ` + interface, providing Teletext and Closed Caption data. + * - ``V4L2_CAP_VBI_OUTPUT`` + - 0x00000020 + - The device supports the :ref:`Raw VBI Output ` + interface. + * - ``V4L2_CAP_SLICED_VBI_CAPTURE`` + - 0x00000040 + - The device supports the :ref:`Sliced VBI Capture ` + interface. + * - ``V4L2_CAP_SLICED_VBI_OUTPUT`` + - 0x00000080 + - The device supports the :ref:`Sliced VBI Output ` + interface. + * - ``V4L2_CAP_RDS_CAPTURE`` + - 0x00000100 + - The device supports the :ref:`RDS ` capture interface. + * - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY`` + - 0x00000200 + - The device supports the :ref:`Video Output Overlay ` (OSD) + interface. Unlike the *Video Overlay* interface, this is a + secondary function of video output devices and overlays an image + onto an outgoing video signal. When the driver sets this flag, it + must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice + versa. [#f1]_ + * - ``V4L2_CAP_HW_FREQ_SEEK`` + - 0x00000400 + - The device supports the + :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl + for hardware frequency seeking. + * - ``V4L2_CAP_RDS_OUTPUT`` + - 0x00000800 + - The device supports the :ref:`RDS ` output interface. + * - ``V4L2_CAP_TUNER`` + - 0x00010000 + - The device has some sort of tuner to receive RF-modulated video + signals. For more information about tuner programming see + :ref:`tuner`. + * - ``V4L2_CAP_AUDIO`` + - 0x00020000 + - The device has audio inputs or outputs. It may or may not support + audio recording or playback, in PCM or compressed formats. PCM + audio support must be implemented as ALSA or OSS interface. For + more information on audio inputs and outputs see :ref:`audio`. + * - ``V4L2_CAP_RADIO`` + - 0x00040000 + - This is a radio receiver. + * - ``V4L2_CAP_MODULATOR`` + - 0x00080000 + - The device has some sort of modulator to emit RF-modulated + video/audio signals. For more information about modulator + programming see :ref:`tuner`. + * - ``V4L2_CAP_SDR_CAPTURE`` + - 0x00100000 + - The device supports the :ref:`SDR Capture ` interface. + * - ``V4L2_CAP_EXT_PIX_FORMAT`` + - 0x00200000 + - The device supports the struct + :c:type:`v4l2_pix_format` extended fields. + * - ``V4L2_CAP_SDR_OUTPUT`` + - 0x00400000 + - The device supports the :ref:`SDR Output ` interface. + * - ``V4L2_CAP_READWRITE`` + - 0x01000000 + - The device supports the :ref:`read() ` and/or + :ref:`write() ` I/O methods. + * - ``V4L2_CAP_ASYNCIO`` + - 0x02000000 + - The device supports the :ref:`asynchronous ` I/O methods. + * - ``V4L2_CAP_STREAMING`` + - 0x04000000 + - The device supports the :ref:`streaming ` I/O method. + * - ``V4L2_CAP_TOUCH`` + - 0x10000000 + - This is a touch device. + * - ``V4L2_CAP_DEVICE_CAPS`` + - 0x80000000 + - The driver fills the ``device_caps`` field. This capability can + only appear in the ``capabilities`` field and never in the + ``device_caps`` field. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst index f3ce0ab53bae..82769de801b1 100644 --- a/Documentation/media/uapi/v4l/vidioc-queryctrl.rst +++ b/Documentation/media/uapi/v4l/vidioc-queryctrl.rst @@ -105,116 +105,71 @@ See also the examples in :ref:`control`. :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``id`` + - Identifies the control, set by the application. See + :ref:`control-id` for predefined IDs. When the ID is ORed with + V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and + returns the first control with a higher ID. Drivers which do not + support this flag yet always return an ``EINVAL`` error code. + * - __u32 + - ``type`` + - Type of control, see :c:type:`v4l2_ctrl_type`. + * - __u8 + - ``name``\ [32] + - Name of the control, a NUL-terminated ASCII string. This + information is intended for the user. + * - __s32 + - ``minimum`` + - Minimum value, inclusive. This field gives a lower bound for the + control. See enum :c:type:`v4l2_ctrl_type` how + the minimum value is to be used for each possible control type. + Note that this a signed 32-bit value. + * - __s32 + - ``maximum`` + - Maximum value, inclusive. This field gives an upper bound for the + control. See enum :c:type:`v4l2_ctrl_type` how + the maximum value is to be used for each possible control type. + Note that this a signed 32-bit value. + * - __s32 + - ``step`` + - This field gives a step size for the control. See enum + :c:type:`v4l2_ctrl_type` how the step value is + to be used for each possible control type. Note that this an + unsigned 32-bit value. - - .. row 1 + Generally drivers should not scale hardware control values. It may + be necessary for example when the ``name`` or ``id`` imply a + particular unit and the hardware actually accepts only multiples + of said unit. If so, drivers must take care values are properly + rounded when scaling, such that errors will not accumulate on + repeated read-write cycles. - - __u32 + This field gives the smallest change of an integer control + actually affecting hardware. Often the information is needed when + the user can change controls by keyboard or GUI buttons, rather + than a slider. When for example a hardware register accepts values + 0-511 and the driver reports 0-65535, step should be 128. - - ``id`` + Note that although signed, the step value is supposed to be always + positive. + * - __s32 + - ``default_value`` + - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_BOOLEAN``, + ``_BITMASK``, ``_MENU`` or ``_INTEGER_MENU`` control. Not valid + for other types of controls. - - Identifies the control, set by the application. See - :ref:`control-id` for predefined IDs. When the ID is ORed with - V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and - returns the first control with a higher ID. Drivers which do not - support this flag yet always return an ``EINVAL`` error code. + .. note:: - - .. row 2 - - - __u32 - - - ``type`` - - - Type of control, see :c:type:`v4l2_ctrl_type`. - - - .. row 3 - - - __u8 - - - ``name``\ [32] - - - Name of the control, a NUL-terminated ASCII string. This - information is intended for the user. - - - .. row 4 - - - __s32 - - - ``minimum`` - - - Minimum value, inclusive. This field gives a lower bound for the - control. See enum :c:type:`v4l2_ctrl_type` how - the minimum value is to be used for each possible control type. - Note that this a signed 32-bit value. - - - .. row 5 - - - __s32 - - - ``maximum`` - - - Maximum value, inclusive. This field gives an upper bound for the - control. See enum :c:type:`v4l2_ctrl_type` how - the maximum value is to be used for each possible control type. - Note that this a signed 32-bit value. - - - .. row 6 - - - __s32 - - - ``step`` - - - This field gives a step size for the control. See enum - :c:type:`v4l2_ctrl_type` how the step value is - to be used for each possible control type. Note that this an - unsigned 32-bit value. - - Generally drivers should not scale hardware control values. It may - be necessary for example when the ``name`` or ``id`` imply a - particular unit and the hardware actually accepts only multiples - of said unit. If so, drivers must take care values are properly - rounded when scaling, such that errors will not accumulate on - repeated read-write cycles. - - This field gives the smallest change of an integer control - actually affecting hardware. Often the information is needed when - the user can change controls by keyboard or GUI buttons, rather - than a slider. When for example a hardware register accepts values - 0-511 and the driver reports 0-65535, step should be 128. - - Note that although signed, the step value is supposed to be always - positive. - - - .. row 7 - - - __s32 - - - ``default_value`` - - - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_BOOLEAN``, - ``_BITMASK``, ``_MENU`` or ``_INTEGER_MENU`` control. Not valid - for other types of controls. - - .. note:: - - Drivers reset controls to their default value only when - the driver is first loaded, never afterwards. - - - .. row 8 - - - __u32 - - - ``flags`` - - - Control flags, see :ref:`control-flags`. - - - .. row 9 - - - __u32 - - - ``reserved``\ [2] - - - Reserved for future extensions. Drivers must set the array to - zero. + Drivers reset controls to their default value only when + the driver is first loaded, never afterwards. + * - __u32 + - ``flags`` + - Control flags, see :ref:`control-flags`. + * - __u32 + - ``reserved``\ [2] + - Reserved for future extensions. Drivers must set the array to + zero. @@ -229,158 +184,93 @@ See also the examples in :ref:`control`. :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``id`` + - Identifies the control, set by the application. See + :ref:`control-id` for predefined IDs. When the ID is ORed with + ``V4L2_CTRL_FLAG_NEXT_CTRL`` the driver clears the flag and + returns the first non-compound control with a higher ID. When the + ID is ORed with ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` the driver clears + the flag and returns the first compound control with a higher ID. + Set both to get the first control (compound or not) with a higher + ID. + * - __u32 + - ``type`` + - Type of control, see :c:type:`v4l2_ctrl_type`. + * - char + - ``name``\ [32] + - Name of the control, a NUL-terminated ASCII string. This + information is intended for the user. + * - __s64 + - ``minimum`` + - Minimum value, inclusive. This field gives a lower bound for the + control. See enum :c:type:`v4l2_ctrl_type` how + the minimum value is to be used for each possible control type. + Note that this a signed 64-bit value. + * - __s64 + - ``maximum`` + - Maximum value, inclusive. This field gives an upper bound for the + control. See enum :c:type:`v4l2_ctrl_type` how + the maximum value is to be used for each possible control type. + Note that this a signed 64-bit value. + * - __u64 + - ``step`` + - This field gives a step size for the control. See enum + :c:type:`v4l2_ctrl_type` how the step value is + to be used for each possible control type. Note that this an + unsigned 64-bit value. - - .. row 1 + Generally drivers should not scale hardware control values. It may + be necessary for example when the ``name`` or ``id`` imply a + particular unit and the hardware actually accepts only multiples + of said unit. If so, drivers must take care values are properly + rounded when scaling, such that errors will not accumulate on + repeated read-write cycles. - - __u32 + This field gives the smallest change of an integer control + actually affecting hardware. Often the information is needed when + the user can change controls by keyboard or GUI buttons, rather + than a slider. When for example a hardware register accepts values + 0-511 and the driver reports 0-65535, step should be 128. + * - __s64 + - ``default_value`` + - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_INTEGER64``, + ``_BOOLEAN``, ``_BITMASK``, ``_MENU``, ``_INTEGER_MENU``, ``_U8`` + or ``_U16`` control. Not valid for other types of controls. - - ``id`` + .. note:: - - Identifies the control, set by the application. See - :ref:`control-id` for predefined IDs. When the ID is ORed with - ``V4L2_CTRL_FLAG_NEXT_CTRL`` the driver clears the flag and - returns the first non-compound control with a higher ID. When the - ID is ORed with ``V4L2_CTRL_FLAG_NEXT_COMPOUND`` the driver clears - the flag and returns the first compound control with a higher ID. - Set both to get the first control (compound or not) with a higher - ID. - - - .. row 2 - - - __u32 - - - ``type`` - - - Type of control, see :c:type:`v4l2_ctrl_type`. - - - .. row 3 - - - char - - - ``name``\ [32] - - - Name of the control, a NUL-terminated ASCII string. This - information is intended for the user. - - - .. row 4 - - - __s64 - - - ``minimum`` - - - Minimum value, inclusive. This field gives a lower bound for the - control. See enum :c:type:`v4l2_ctrl_type` how - the minimum value is to be used for each possible control type. - Note that this a signed 64-bit value. - - - .. row 5 - - - __s64 - - - ``maximum`` - - - Maximum value, inclusive. This field gives an upper bound for the - control. See enum :c:type:`v4l2_ctrl_type` how - the maximum value is to be used for each possible control type. - Note that this a signed 64-bit value. - - - .. row 6 - - - __u64 - - - ``step`` - - - This field gives a step size for the control. See enum - :c:type:`v4l2_ctrl_type` how the step value is - to be used for each possible control type. Note that this an - unsigned 64-bit value. - - Generally drivers should not scale hardware control values. It may - be necessary for example when the ``name`` or ``id`` imply a - particular unit and the hardware actually accepts only multiples - of said unit. If so, drivers must take care values are properly - rounded when scaling, such that errors will not accumulate on - repeated read-write cycles. - - This field gives the smallest change of an integer control - actually affecting hardware. Often the information is needed when - the user can change controls by keyboard or GUI buttons, rather - than a slider. When for example a hardware register accepts values - 0-511 and the driver reports 0-65535, step should be 128. - - - .. row 7 - - - __s64 - - - ``default_value`` - - - The default value of a ``V4L2_CTRL_TYPE_INTEGER``, ``_INTEGER64``, - ``_BOOLEAN``, ``_BITMASK``, ``_MENU``, ``_INTEGER_MENU``, ``_U8`` - or ``_U16`` control. Not valid for other types of controls. - - .. note:: - - Drivers reset controls to their default value only when - the driver is first loaded, never afterwards. - - - .. row 8 - - - __u32 - - - ``flags`` - - - Control flags, see :ref:`control-flags`. - - - .. row 9 - - - __u32 - - - ``elem_size`` - - - The size in bytes of a single element of the array. Given a char - pointer ``p`` to a 3-dimensional array you can find the position - of cell ``(z, y, x)`` as follows: - ``p + ((z * dims[1] + y) * dims[0] + x) * elem_size``. - ``elem_size`` is always valid, also when the control isn't an - array. For string controls ``elem_size`` is equal to - ``maximum + 1``. - - - .. row 10 - - - __u32 - - - ``elems`` - - - The number of elements in the N-dimensional array. If this control - is not an array, then ``elems`` is 1. The ``elems`` field can - never be 0. - - - .. row 11 - - - __u32 - - - ``nr_of_dims`` - - - The number of dimension in the N-dimensional array. If this - control is not an array, then this field is 0. - - - .. row 12 - - - __u32 - - - ``dims[V4L2_CTRL_MAX_DIMS]`` - - - The size of each dimension. The first ``nr_of_dims`` elements of - this array must be non-zero, all remaining elements must be zero. - - - .. row 13 - - - __u32 - - - ``reserved``\ [32] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + Drivers reset controls to their default value only when + the driver is first loaded, never afterwards. + * - __u32 + - ``flags`` + - Control flags, see :ref:`control-flags`. + * - __u32 + - ``elem_size`` + - The size in bytes of a single element of the array. Given a char + pointer ``p`` to a 3-dimensional array you can find the position + of cell ``(z, y, x)`` as follows: + ``p + ((z * dims[1] + y) * dims[0] + x) * elem_size``. + ``elem_size`` is always valid, also when the control isn't an + array. For string controls ``elem_size`` is equal to + ``maximum + 1``. + * - __u32 + - ``elems`` + - The number of elements in the N-dimensional array. If this control + is not an array, then ``elems`` is 1. The ``elems`` field can + never be 0. + * - __u32 + - ``nr_of_dims`` + - The number of dimension in the N-dimensional array. If this + control is not an array, then this field is 0. + * - __u32 + - ``dims[V4L2_CTRL_MAX_DIMS]`` + - The size of each dimension. The first ``nr_of_dims`` elements of + this array must be non-zero, all remaining elements must be zero. + * - __u32 + - ``reserved``\ [32] + - Reserved for future extensions. Applications and drivers must set + the array to zero. @@ -393,64 +283,35 @@ See also the examples in :ref:`control`. :stub-columns: 0 :widths: 1 1 2 1 - - - .. row 1 - - - __u32 - - - - - ``id`` - - - Identifies the control, set by the application from the respective - struct :ref:`v4l2_queryctrl ` ``id``. - - - .. row 2 - - - __u32 - - - - - ``index`` - - - Index of the menu item, starting at zero, set by the application. - - - .. row 3 - - - union - - - - - - - - - - .. row 4 - - - - - __u8 - - - ``name``\ [32] - - - Name of the menu item, a NUL-terminated ASCII string. This - information is intended for the user. This field is valid for - ``V4L2_CTRL_FLAG_MENU`` type controls. - - - .. row 5 - - - - - __s64 - - - ``value`` - - - Value of the integer menu item. This field is valid for - ``V4L2_CTRL_FLAG_INTEGER_MENU`` type controls. - - - .. row 6 - - - __u32 - - - - - ``reserved`` - - - Reserved for future extensions. Drivers must set the array to - zero. + * - __u32 + - + - ``id`` + - Identifies the control, set by the application from the respective + struct :ref:`v4l2_queryctrl ` ``id``. + * - __u32 + - + - ``index`` + - Index of the menu item, starting at zero, set by the application. + * - union + - + - + - + * - + - __u8 + - ``name``\ [32] + - Name of the menu item, a NUL-terminated ASCII string. This + information is intended for the user. This field is valid for + ``V4L2_CTRL_FLAG_MENU`` type controls. + * - + - __s64 + - ``value`` + - Value of the integer menu item. This field is valid for + ``V4L2_CTRL_FLAG_INTEGER_MENU`` type controls. + * - __u32 + - + - ``reserved`` + - Reserved for future extensions. Drivers must set the array to + zero. @@ -465,193 +326,102 @@ See also the examples in :ref:`control`. :stub-columns: 0 :widths: 30 5 5 5 55 - - - .. row 1 - - - Type - - - ``minimum`` - - - ``step`` - - - ``maximum`` - - - Description - - - .. row 2 - - - ``V4L2_CTRL_TYPE_INTEGER`` - - - any - - - any - - - any - - - An integer-valued control ranging from minimum to maximum - inclusive. The step value indicates the increment between values. - - - .. row 3 - - - ``V4L2_CTRL_TYPE_BOOLEAN`` - - - 0 - - - 1 - - - 1 - - - A boolean-valued control. Zero corresponds to "disabled", and one - means "enabled". - - - .. row 4 - - - ``V4L2_CTRL_TYPE_MENU`` - - - ≥ 0 - - - 1 - - - N-1 - - - The control has a menu of N choices. The names of the menu items - can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. - - - .. row 5 - - - ``V4L2_CTRL_TYPE_INTEGER_MENU`` - - - ≥ 0 - - - 1 - - - N-1 - - - The control has a menu of N choices. The values of the menu items - can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. This is - similar to ``V4L2_CTRL_TYPE_MENU`` except that instead of strings, - the menu items are signed 64-bit integers. - - - .. row 6 - - - ``V4L2_CTRL_TYPE_BITMASK`` - - - 0 - - - n/a - - - any - - - A bitmask field. The maximum value is the set of bits that can be - used, all other bits are to be 0. The maximum value is interpreted - as a __u32, allowing the use of bit 31 in the bitmask. - - - .. row 7 - - - ``V4L2_CTRL_TYPE_BUTTON`` - - - 0 - - - 0 - - - 0 - - - A control which performs an action when set. Drivers must ignore - the value passed with ``VIDIOC_S_CTRL`` and return an ``EINVAL`` error - code on a ``VIDIOC_G_CTRL`` attempt. - - - .. row 8 - - - ``V4L2_CTRL_TYPE_INTEGER64`` - - - any - - - any - - - any - - - A 64-bit integer valued control. Minimum, maximum and step size - cannot be queried using ``VIDIOC_QUERYCTRL``. Only - ``VIDIOC_QUERY_EXT_CTRL`` can retrieve the 64-bit min/max/step - values, they should be interpreted as n/a when using - ``VIDIOC_QUERYCTRL``. - - - .. row 9 - - - ``V4L2_CTRL_TYPE_STRING`` - - - ≥ 0 - - - ≥ 1 - - - ≥ 0 - - - The minimum and maximum string lengths. The step size means that - the string must be (minimum + N * step) characters long for N ≥ 0. - These lengths do not include the terminating zero, so in order to - pass a string of length 8 to - :ref:`VIDIOC_S_EXT_CTRLS ` you need to - set the ``size`` field of struct - :c:type:`v4l2_ext_control` to 9. For - :ref:`VIDIOC_G_EXT_CTRLS ` you can set - the ``size`` field to ``maximum`` + 1. Which character encoding is - used will depend on the string control itself and should be part - of the control documentation. - - - .. row 10 - - - ``V4L2_CTRL_TYPE_CTRL_CLASS`` - - - n/a - - - n/a - - - n/a - - - This is not a control. When ``VIDIOC_QUERYCTRL`` is called with a - control ID equal to a control class code (see :ref:`ctrl-class`) - + 1, the ioctl returns the name of the control class and this - control type. Older drivers which do not support this feature - return an ``EINVAL`` error code. - - - .. row 11 - - - ``V4L2_CTRL_TYPE_U8`` - - - any - - - any - - - any - - - An unsigned 8-bit valued control ranging from minimum to maximum - inclusive. The step value indicates the increment between values. - - - .. row 12 - - - ``V4L2_CTRL_TYPE_U16`` - - - any - - - any - - - any - - - An unsigned 16-bit valued control ranging from minimum to maximum - inclusive. The step value indicates the increment between values. - - - .. row 13 - - - ``V4L2_CTRL_TYPE_U32`` - - - any - - - any - - - any - - - An unsigned 32-bit valued control ranging from minimum to maximum - inclusive. The step value indicates the increment between values. + * - Type + - ``minimum`` + - ``step`` + - ``maximum`` + - Description + * - ``V4L2_CTRL_TYPE_INTEGER`` + - any + - any + - any + - An integer-valued control ranging from minimum to maximum + inclusive. The step value indicates the increment between values. + * - ``V4L2_CTRL_TYPE_BOOLEAN`` + - 0 + - 1 + - 1 + - A boolean-valued control. Zero corresponds to "disabled", and one + means "enabled". + * - ``V4L2_CTRL_TYPE_MENU`` + - ≥ 0 + - 1 + - N-1 + - The control has a menu of N choices. The names of the menu items + can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. + * - ``V4L2_CTRL_TYPE_INTEGER_MENU`` + - ≥ 0 + - 1 + - N-1 + - The control has a menu of N choices. The values of the menu items + can be enumerated with the ``VIDIOC_QUERYMENU`` ioctl. This is + similar to ``V4L2_CTRL_TYPE_MENU`` except that instead of strings, + the menu items are signed 64-bit integers. + * - ``V4L2_CTRL_TYPE_BITMASK`` + - 0 + - n/a + - any + - A bitmask field. The maximum value is the set of bits that can be + used, all other bits are to be 0. The maximum value is interpreted + as a __u32, allowing the use of bit 31 in the bitmask. + * - ``V4L2_CTRL_TYPE_BUTTON`` + - 0 + - 0 + - 0 + - A control which performs an action when set. Drivers must ignore + the value passed with ``VIDIOC_S_CTRL`` and return an ``EINVAL`` error + code on a ``VIDIOC_G_CTRL`` attempt. + * - ``V4L2_CTRL_TYPE_INTEGER64`` + - any + - any + - any + - A 64-bit integer valued control. Minimum, maximum and step size + cannot be queried using ``VIDIOC_QUERYCTRL``. Only + ``VIDIOC_QUERY_EXT_CTRL`` can retrieve the 64-bit min/max/step + values, they should be interpreted as n/a when using + ``VIDIOC_QUERYCTRL``. + * - ``V4L2_CTRL_TYPE_STRING`` + - ≥ 0 + - ≥ 1 + - ≥ 0 + - The minimum and maximum string lengths. The step size means that + the string must be (minimum + N * step) characters long for N ≥ 0. + These lengths do not include the terminating zero, so in order to + pass a string of length 8 to + :ref:`VIDIOC_S_EXT_CTRLS ` you need to + set the ``size`` field of struct + :c:type:`v4l2_ext_control` to 9. For + :ref:`VIDIOC_G_EXT_CTRLS ` you can set + the ``size`` field to ``maximum`` + 1. Which character encoding is + used will depend on the string control itself and should be part + of the control documentation. + * - ``V4L2_CTRL_TYPE_CTRL_CLASS`` + - n/a + - n/a + - n/a + - This is not a control. When ``VIDIOC_QUERYCTRL`` is called with a + control ID equal to a control class code (see :ref:`ctrl-class`) + + 1, the ioctl returns the name of the control class and this + control type. Older drivers which do not support this feature + return an ``EINVAL`` error code. + * - ``V4L2_CTRL_TYPE_U8`` + - any + - any + - any + - An unsigned 8-bit valued control ranging from minimum to maximum + inclusive. The step value indicates the increment between values. + * - ``V4L2_CTRL_TYPE_U16`` + - any + - any + - any + - An unsigned 16-bit valued control ranging from minimum to maximum + inclusive. The step value indicates the increment between values. + * - ``V4L2_CTRL_TYPE_U32`` + - any + - any + - any + - An unsigned 32-bit valued control ranging from minimum to maximum + inclusive. The step value indicates the increment between values. @@ -666,126 +436,77 @@ See also the examples in :ref:`control`. :stub-columns: 0 :widths: 3 1 4 + * - ``V4L2_CTRL_FLAG_DISABLED`` + - 0x0001 + - This control is permanently disabled and should be ignored by the + application. Any attempt to change the control will result in an + ``EINVAL`` error code. + * - ``V4L2_CTRL_FLAG_GRABBED`` + - 0x0002 + - This control is temporarily unchangeable, for example because + another application took over control of the respective resource. + Such controls may be displayed specially in a user interface. + Attempts to change the control may result in an ``EBUSY`` error code. + * - ``V4L2_CTRL_FLAG_READ_ONLY`` + - 0x0004 + - This control is permanently readable only. Any attempt to change + the control will result in an ``EINVAL`` error code. + * - ``V4L2_CTRL_FLAG_UPDATE`` + - 0x0008 + - A hint that changing this control may affect the value of other + controls within the same control class. Applications should update + their user interface accordingly. + * - ``V4L2_CTRL_FLAG_INACTIVE`` + - 0x0010 + - This control is not applicable to the current configuration and + should be displayed accordingly in a user interface. For example + the flag may be set on a MPEG audio level 2 bitrate control when + MPEG audio encoding level 1 was selected with another control. + * - ``V4L2_CTRL_FLAG_SLIDER`` + - 0x0020 + - A hint that this control is best represented as a slider-like + element in a user interface. + * - ``V4L2_CTRL_FLAG_WRITE_ONLY`` + - 0x0040 + - This control is permanently writable only. Any attempt to read the + control will result in an ``EACCES`` error code error code. This flag + is typically present for relative controls or action controls + where writing a value will cause the device to carry out a given + action (e. g. motor control) but no meaningful value can be + returned. + * - ``V4L2_CTRL_FLAG_VOLATILE`` + - 0x0080 + - This control is volatile, which means that the value of the + control changes continuously. A typical example would be the + current gain value if the device is in auto-gain mode. In such a + case the hardware calculates the gain value based on the lighting + conditions which can change over time. - - .. row 1 + .. note:: - - ``V4L2_CTRL_FLAG_DISABLED`` + Setting a new value for a volatile control will be ignored + unless + :ref:`V4L2_CTRL_FLAG_EXECUTE_ON_WRITE ` + is also set. + Setting a new value for a volatile control will *never* trigger a + :ref:`V4L2_EVENT_CTRL_CH_VALUE ` event. + * - ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` + - 0x0100 + - This control has a pointer type, so its value has to be accessed + using one of the pointer fields of struct + :c:type:`v4l2_ext_control`. This flag is set + for controls that are an array, string, or have a compound type. + In all cases you have to set a pointer to memory containing the + payload of the control. + * .. _FLAG_EXECUTE_ON_WRITE: - - 0x0001 - - - This control is permanently disabled and should be ignored by the - application. Any attempt to change the control will result in an - ``EINVAL`` error code. - - - .. row 2 - - - ``V4L2_CTRL_FLAG_GRABBED`` - - - 0x0002 - - - This control is temporarily unchangeable, for example because - another application took over control of the respective resource. - Such controls may be displayed specially in a user interface. - Attempts to change the control may result in an ``EBUSY`` error code. - - - .. row 3 - - - ``V4L2_CTRL_FLAG_READ_ONLY`` - - - 0x0004 - - - This control is permanently readable only. Any attempt to change - the control will result in an ``EINVAL`` error code. - - - .. row 4 - - - ``V4L2_CTRL_FLAG_UPDATE`` - - - 0x0008 - - - A hint that changing this control may affect the value of other - controls within the same control class. Applications should update - their user interface accordingly. - - - .. row 5 - - - ``V4L2_CTRL_FLAG_INACTIVE`` - - - 0x0010 - - - This control is not applicable to the current configuration and - should be displayed accordingly in a user interface. For example - the flag may be set on a MPEG audio level 2 bitrate control when - MPEG audio encoding level 1 was selected with another control. - - - .. row 6 - - - ``V4L2_CTRL_FLAG_SLIDER`` - - - 0x0020 - - - A hint that this control is best represented as a slider-like - element in a user interface. - - - .. row 7 - - - ``V4L2_CTRL_FLAG_WRITE_ONLY`` - - - 0x0040 - - - This control is permanently writable only. Any attempt to read the - control will result in an ``EACCES`` error code error code. This flag - is typically present for relative controls or action controls - where writing a value will cause the device to carry out a given - action (e. g. motor control) but no meaningful value can be - returned. - - - .. row 8 - - - ``V4L2_CTRL_FLAG_VOLATILE`` - - - 0x0080 - - - This control is volatile, which means that the value of the - control changes continuously. A typical example would be the - current gain value if the device is in auto-gain mode. In such a - case the hardware calculates the gain value based on the lighting - conditions which can change over time. - - .. note:: - - Setting a new value for a volatile control will be ignored - unless - :ref:`V4L2_CTRL_FLAG_EXECUTE_ON_WRITE ` - is also set. - Setting a new value for a volatile control will *never* trigger a - :ref:`V4L2_EVENT_CTRL_CH_VALUE ` event. - - - .. row 9 - - - ``V4L2_CTRL_FLAG_HAS_PAYLOAD`` - - - 0x0100 - - - This control has a pointer type, so its value has to be accessed - using one of the pointer fields of struct - :c:type:`v4l2_ext_control`. This flag is set - for controls that are an array, string, or have a compound type. - In all cases you have to set a pointer to memory containing the - payload of the control. - - - .. row 10 - .. _FLAG_EXECUTE_ON_WRITE: - - - ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` - - - 0x0200 - - - The value provided to the control will be propagated to the driver - even if it remains constant. This is required when the control - represents an action on the hardware. For example: clearing an - error flag or triggering the flash. All the controls of the type - ``V4L2_CTRL_TYPE_BUTTON`` have this flag set. + - ``V4L2_CTRL_FLAG_EXECUTE_ON_WRITE`` + - 0x0200 + - The value provided to the control will be propagated to the driver + even if it remains constant. This is required when the control + represents an action on the hardware. For example: clearing an + error flag or triggering the flash. All the controls of the type + ``V4L2_CTRL_TYPE_BUTTON`` have this flag set. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst index 2c5291b42592..a4180d576ee5 100644 --- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst +++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst @@ -74,43 +74,23 @@ any DMA in progress, an implicit :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``count`` - - - The number of buffers requested or granted. - - - .. row 2 - - - __u32 - - - ``type`` - - - Type of the stream or buffers, this is the same as the struct - :c:type:`v4l2_format` ``type`` field. See - :c:type:`v4l2_buf_type` for valid values. - - - .. row 3 - - - __u32 - - - ``memory`` - - - Applications set this field to ``V4L2_MEMORY_MMAP``, - ``V4L2_MEMORY_DMABUF`` or ``V4L2_MEMORY_USERPTR``. See - :c:type:`v4l2_memory`. - - - .. row 4 - - - __u32 - - - ``reserved``\ [2] - - - A place holder for future extensions. Drivers and applications - must set the array to zero. + * - __u32 + - ``count`` + - The number of buffers requested or granted. + * - __u32 + - ``type`` + - Type of the stream or buffers, this is the same as the struct + :c:type:`v4l2_format` ``type`` field. See + :c:type:`v4l2_buf_type` for valid values. + * - __u32 + - ``memory`` + - Applications set this field to ``V4L2_MEMORY_MMAP``, + ``V4L2_MEMORY_DMABUF`` or ``V4L2_MEMORY_USERPTR``. See + :c:type:`v4l2_memory`. + * - __u32 + - ``reserved``\ [2] + - A place holder for future extensions. Drivers and applications + must set the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst index fc5e31c63b95..5672ca48d2bd 100644 --- a/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst +++ b/Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst @@ -68,92 +68,52 @@ error code is returned and no seek takes place. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``tuner`` - - - The tuner index number. This is the same value as in the struct - :c:type:`v4l2_input` ``tuner`` field and the struct - :c:type:`v4l2_tuner` ``index`` field. - - - .. row 2 - - - __u32 - - - ``type`` - - - The tuner type. This is the same value as in the struct - :c:type:`v4l2_tuner` ``type`` field. See - :c:type:`v4l2_tuner_type` - - - .. row 3 - - - __u32 - - - ``seek_upward`` - - - If non-zero, seek upward from the current frequency, else seek - downward. - - - .. row 4 - - - __u32 - - - ``wrap_around`` - - - If non-zero, wrap around when at the end of the frequency range, - else stop seeking. The struct :c:type:`v4l2_tuner` - ``capability`` field will tell you what the hardware supports. - - - .. row 5 - - - __u32 - - - ``spacing`` - - - If non-zero, defines the hardware seek resolution in Hz. The - driver selects the nearest value that is supported by the device. - If spacing is zero a reasonable default value is used. - - - .. row 6 - - - __u32 - - - ``rangelow`` - - - If non-zero, the lowest tunable frequency of the band to search in - units of 62.5 kHz, or if the struct - :c:type:`v4l2_tuner` ``capability`` field has the - ``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the - struct :c:type:`v4l2_tuner` ``capability`` field has - the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If - ``rangelow`` is zero a reasonable default value is used. - - - .. row 7 - - - __u32 - - - ``rangehigh`` - - - If non-zero, the highest tunable frequency of the band to search - in units of 62.5 kHz, or if the struct - :c:type:`v4l2_tuner` ``capability`` field has the - ``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the - struct :c:type:`v4l2_tuner` ``capability`` field has - the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If - ``rangehigh`` is zero a reasonable default value is used. - - - .. row 8 - - - __u32 - - - ``reserved``\ [5] - - - Reserved for future extensions. Applications must set the array to - zero. + * - __u32 + - ``tuner`` + - The tuner index number. This is the same value as in the struct + :c:type:`v4l2_input` ``tuner`` field and the struct + :c:type:`v4l2_tuner` ``index`` field. + * - __u32 + - ``type`` + - The tuner type. This is the same value as in the struct + :c:type:`v4l2_tuner` ``type`` field. See + :c:type:`v4l2_tuner_type` + * - __u32 + - ``seek_upward`` + - If non-zero, seek upward from the current frequency, else seek + downward. + * - __u32 + - ``wrap_around`` + - If non-zero, wrap around when at the end of the frequency range, + else stop seeking. The struct :c:type:`v4l2_tuner` + ``capability`` field will tell you what the hardware supports. + * - __u32 + - ``spacing`` + - If non-zero, defines the hardware seek resolution in Hz. The + driver selects the nearest value that is supported by the device. + If spacing is zero a reasonable default value is used. + * - __u32 + - ``rangelow`` + - If non-zero, the lowest tunable frequency of the band to search in + units of 62.5 kHz, or if the struct + :c:type:`v4l2_tuner` ``capability`` field has the + ``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the + struct :c:type:`v4l2_tuner` ``capability`` field has + the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If + ``rangelow`` is zero a reasonable default value is used. + * - __u32 + - ``rangehigh`` + - If non-zero, the highest tunable frequency of the band to search + in units of 62.5 kHz, or if the struct + :c:type:`v4l2_tuner` ``capability`` field has the + ``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the + struct :c:type:`v4l2_tuner` ``capability`` field has + the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If + ``rangehigh`` is zero a reasonable default value is used. + * - __u32 + - ``reserved``\ [5] + - Reserved for future extensions. Applications must set the array to + zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst index 16f2945b73dc..1a02c935c8b5 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst @@ -68,73 +68,33 @@ multiple pads of the same sub-device is not defined. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``index`` - - - Number of the format in the enumeration, set by the application. - - - .. row 2 - - - __u32 - - - ``pad`` - - - Pad number as reported by the media controller API. - - - .. row 3 - - - __u32 - - - ``code`` - - - The media bus format code, as defined in - :ref:`v4l2-mbus-format`. - - - .. row 4 - - - __u32 - - - ``width`` - - - Frame width, in pixels. - - - .. row 5 - - - __u32 - - - ``height`` - - - Frame height, in pixels. - - - .. row 6 - - - struct :c:type:`v4l2_fract` - - - ``interval`` - - - Period, in seconds, between consecutive video frames. - - - .. row 7 - - - __u32 - - - ``which`` - - - Frame intervals to be enumerated, from enum - :ref:`v4l2_subdev_format_whence `. - - - .. row 8 - - - __u32 - - - ``reserved``\ [8] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + * - __u32 + - ``index`` + - Number of the format in the enumeration, set by the application. + * - __u32 + - ``pad`` + - Pad number as reported by the media controller API. + * - __u32 + - ``code`` + - The media bus format code, as defined in + :ref:`v4l2-mbus-format`. + * - __u32 + - ``width`` + - Frame width, in pixels. + * - __u32 + - ``height`` + - Frame height, in pixels. + * - struct :c:type:`v4l2_fract` + - ``interval`` + - Period, in seconds, between consecutive video frames. + * - __u32 + - ``which`` + - Frame intervals to be enumerated, from enum + :ref:`v4l2_subdev_format_whence `. + * - __u32 + - ``reserved``\ [8] + - Reserved for future extensions. Applications and drivers must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst index 972df0f74eae..746c24ed97a0 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst @@ -71,81 +71,36 @@ information about try formats. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``index`` - - - Number of the format in the enumeration, set by the application. - - - .. row 2 - - - __u32 - - - ``pad`` - - - Pad number as reported by the media controller API. - - - .. row 3 - - - __u32 - - - ``code`` - - - The media bus format code, as defined in - :ref:`v4l2-mbus-format`. - - - .. row 4 - - - __u32 - - - ``min_width`` - - - Minimum frame width, in pixels. - - - .. row 5 - - - __u32 - - - ``max_width`` - - - Maximum frame width, in pixels. - - - .. row 6 - - - __u32 - - - ``min_height`` - - - Minimum frame height, in pixels. - - - .. row 7 - - - __u32 - - - ``max_height`` - - - Maximum frame height, in pixels. - - - .. row 8 - - - __u32 - - - ``which`` - - - Frame sizes to be enumerated, from enum - :ref:`v4l2_subdev_format_whence `. - - - .. row 9 - - - __u32 - - - ``reserved``\ [8] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + * - __u32 + - ``index`` + - Number of the format in the enumeration, set by the application. + * - __u32 + - ``pad`` + - Pad number as reported by the media controller API. + * - __u32 + - ``code`` + - The media bus format code, as defined in + :ref:`v4l2-mbus-format`. + * - __u32 + - ``min_width`` + - Minimum frame width, in pixels. + * - __u32 + - ``max_width`` + - Maximum frame width, in pixels. + * - __u32 + - ``min_height`` + - Minimum frame height, in pixels. + * - __u32 + - ``max_height`` + - Maximum frame height, in pixels. + * - __u32 + - ``which`` + - Frame sizes to be enumerated, from enum + :ref:`v4l2_subdev_format_whence `. + * - __u32 + - ``reserved``\ [8] + - Reserved for future extensions. Applications and drivers must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst index b10da0e81268..0dfee3829ee2 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst @@ -56,49 +56,24 @@ information about the try formats. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``pad`` - - - Pad number as reported by the media controller API. - - - .. row 2 - - - __u32 - - - ``index`` - - - Number of the format in the enumeration, set by the application. - - - .. row 3 - - - __u32 - - - ``code`` - - - The media bus format code, as defined in - :ref:`v4l2-mbus-format`. - - - .. row 4 - - - __u32 - - - ``which`` - - - Media bus format codes to be enumerated, from enum - :ref:`v4l2_subdev_format_whence `. - - - .. row 5 - - - __u32 - - - ``reserved``\ [8] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + * - __u32 + - ``pad`` + - Pad number as reported by the media controller API. + * - __u32 + - ``index`` + - Number of the format in the enumeration, set by the application. + * - __u32 + - ``code`` + - The media bus format code, as defined in + :ref:`v4l2-mbus-format`. + * - __u32 + - ``which`` + - Media bus format codes to be enumerated, from enum + :ref:`v4l2_subdev_format_whence `. + * - __u32 + - ``reserved``\ [8] + - Reserved for future extensions. Applications and drivers must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst index b5fa4ae25415..000e8fcd3f25 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst @@ -80,40 +80,20 @@ modified format should be as close as possible to the original request. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``pad`` - - - Pad number as reported by the media framework. - - - .. row 2 - - - __u32 - - - ``which`` - - - Crop rectangle to get or set, from enum - :ref:`v4l2_subdev_format_whence `. - - - .. row 3 - - - struct :c:type:`v4l2_rect` - - - ``rect`` - - - Crop rectangle boundaries, in pixels. - - - .. row 4 - - - __u32 - - - ``reserved``\ [8] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + * - __u32 + - ``pad`` + - Pad number as reported by the media framework. + * - __u32 + - ``which`` + - Crop rectangle to get or set, from enum + :ref:`v4l2_subdev_format_whence `. + * - struct :c:type:`v4l2_rect` + - ``rect`` + - Crop rectangle boundaries, in pixels. + * - __u32 + - ``reserved``\ [8] + - Reserved for future extensions. Applications and drivers must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst index 2f7ea274c4c2..b352456dfe2c 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst @@ -85,41 +85,21 @@ should be as close as possible to the original request. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``pad`` - - - Pad number as reported by the media controller API. - - - .. row 2 - - - __u32 - - - ``which`` - - - Format to modified, from enum - :ref:`v4l2_subdev_format_whence `. - - - .. row 3 - - - struct :c:type:`v4l2_mbus_framefmt` - - - ``format`` - - - Definition of an image format, see :c:type:`v4l2_mbus_framefmt` for - details. - - - .. row 4 - - - __u32 - - - ``reserved``\ [8] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + * - __u32 + - ``pad`` + - Pad number as reported by the media controller API. + * - __u32 + - ``which`` + - Format to modified, from enum + :ref:`v4l2_subdev_format_whence `. + * - struct :c:type:`v4l2_mbus_framefmt` + - ``format`` + - Definition of an image format, see :c:type:`v4l2_mbus_framefmt` for + details. + * - __u32 + - ``reserved``\ [8] + - Reserved for future extensions. Applications and drivers must set + the array to zero. @@ -132,22 +112,12 @@ should be as close as possible to the original request. :stub-columns: 0 :widths: 3 1 4 - - - .. row 1 - - - V4L2_SUBDEV_FORMAT_TRY - - - 0 - - - Try formats, used for querying device capabilities. - - - .. row 2 - - - V4L2_SUBDEV_FORMAT_ACTIVE - - - 1 - - - Active formats, applied to the hardware. + * - V4L2_SUBDEV_FORMAT_TRY + - 0 + - Try formats, used for querying device capabilities. + * - V4L2_SUBDEV_FORMAT_ACTIVE + - 1 + - Active formats, applied to the hardware. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst index 4b150cc82555..46159dcfce30 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst @@ -76,31 +76,16 @@ the same sub-device is not defined. :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``pad`` - - - Pad number as reported by the media controller API. - - - .. row 2 - - - struct :c:type:`v4l2_fract` - - - ``interval`` - - - Period, in seconds, between consecutive video frames. - - - .. row 3 - - - __u32 - - - ``reserved``\ [9] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + * - __u32 + - ``pad`` + - Pad number as reported by the media controller API. + * - struct :c:type:`v4l2_fract` + - ``interval`` + - Period, in seconds, between consecutive video frames. + * - __u32 + - ``reserved``\ [9] + - Reserved for future extensions. Applications and drivers must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst index 94789f8f74e3..071d9c033db6 100644 --- a/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst +++ b/Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst @@ -74,56 +74,26 @@ Selection targets and flags are documented in :stub-columns: 0 :widths: 1 1 2 - - - .. row 1 - - - __u32 - - - ``which`` - - - Active or try selection, from enum - :ref:`v4l2_subdev_format_whence `. - - - .. row 2 - - - __u32 - - - ``pad`` - - - Pad number as reported by the media framework. - - - .. row 3 - - - __u32 - - - ``target`` - - - Target selection rectangle. See :ref:`v4l2-selections-common`. - - - .. row 4 - - - __u32 - - - ``flags`` - - - Flags. See :ref:`v4l2-selection-flags`. - - - .. row 5 - - - struct :c:type:`v4l2_rect` - - - ``r`` - - - Selection rectangle, in pixels. - - - .. row 6 - - - __u32 - - - ``reserved``\ [8] - - - Reserved for future extensions. Applications and drivers must set - the array to zero. + * - __u32 + - ``which`` + - Active or try selection, from enum + :ref:`v4l2_subdev_format_whence `. + * - __u32 + - ``pad`` + - Pad number as reported by the media framework. + * - __u32 + - ``target`` + - Target selection rectangle. See :ref:`v4l2-selections-common`. + * - __u32 + - ``flags`` + - Flags. See :ref:`v4l2-selection-flags`. + * - struct :c:type:`v4l2_rect` + - ``r`` + - Selection rectangle, in pixels. + * - __u32 + - ``reserved``\ [8] + - Reserved for future extensions. Applications and drivers must set + the array to zero. Return Value diff --git a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst index 0202a78cbeb0..e4a51431032c 100644 --- a/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst +++ b/Documentation/media/uapi/v4l/vidioc-subscribe-event.rst @@ -48,47 +48,27 @@ using the :ref:`VIDIOC_DQEVENT` ioctl. :stub-columns: 0 :widths: 1 1 2 + * - __u32 + - ``type`` + - Type of the event, see :ref:`event-type`. - - .. row 1 + .. note:: - - __u32 - - - ``type`` - - - Type of the event, see :ref:`event-type`. - - .. note:: - - ``V4L2_EVENT_ALL`` can be used with - :ref:`VIDIOC_UNSUBSCRIBE_EVENT ` for - unsubscribing all events at once. - - - .. row 2 - - - __u32 - - - ``id`` - - - ID of the event source. If there is no ID associated with the - event source, then set this to 0. Whether or not an event needs an - ID depends on the event type. - - - .. row 3 - - - __u32 - - - ``flags`` - - - Event flags, see :ref:`event-flags`. - - - .. row 4 - - - __u32 - - - ``reserved``\ [5] - - - Reserved for future extensions. Drivers and applications must set - the array to zero. + ``V4L2_EVENT_ALL`` can be used with + :ref:`VIDIOC_UNSUBSCRIBE_EVENT ` for + unsubscribing all events at once. + * - __u32 + - ``id`` + - ID of the event source. If there is no ID associated with the + event source, then set this to 0. Whether or not an event needs an + ID depends on the event type. + * - __u32 + - ``flags`` + - Event flags, see :ref:`event-flags`. + * - __u32 + - ``reserved``\ [5] + - Reserved for future extensions. Drivers and applications must set + the array to zero. @@ -101,40 +81,30 @@ using the :ref:`VIDIOC_DQEVENT` ioctl. :stub-columns: 0 :widths: 3 1 4 + * - ``V4L2_EVENT_SUB_FL_SEND_INITIAL`` + - 0x0001 + - When this event is subscribed an initial event will be sent + containing the current status. This only makes sense for events + that are triggered by a status change such as ``V4L2_EVENT_CTRL``. + Other events will ignore this flag. + * - ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK`` + - 0x0002 + - If set, then events directly caused by an ioctl will also be sent + to the filehandle that called that ioctl. For example, changing a + control using :ref:`VIDIOC_S_CTRL ` will cause + a V4L2_EVENT_CTRL to be sent back to that same filehandle. + Normally such events are suppressed to prevent feedback loops + where an application changes a control to a one value and then + another, and then receives an event telling it that that control + has changed to the first value. - - .. row 1 + Since it can't tell whether that event was caused by another + application or by the :ref:`VIDIOC_S_CTRL ` + call it is hard to decide whether to set the control to the value + in the event, or ignore it. - - ``V4L2_EVENT_SUB_FL_SEND_INITIAL`` - - - 0x0001 - - - When this event is subscribed an initial event will be sent - containing the current status. This only makes sense for events - that are triggered by a status change such as ``V4L2_EVENT_CTRL``. - Other events will ignore this flag. - - - .. row 2 - - - ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK`` - - - 0x0002 - - - If set, then events directly caused by an ioctl will also be sent - to the filehandle that called that ioctl. For example, changing a - control using :ref:`VIDIOC_S_CTRL ` will cause - a V4L2_EVENT_CTRL to be sent back to that same filehandle. - Normally such events are suppressed to prevent feedback loops - where an application changes a control to a one value and then - another, and then receives an event telling it that that control - has changed to the first value. - - Since it can't tell whether that event was caused by another - application or by the :ref:`VIDIOC_S_CTRL ` - call it is hard to decide whether to set the control to the value - in the event, or ignore it. - - Think carefully when you set this flag so you won't get into - situations like that. + Think carefully when you set this flag so you won't get into + situations like that. Return Value From e383ce0736f5ce74bbc0e989c6d044e29fefb9dc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 22 Sep 2016 07:59:03 -0300 Subject: [PATCH 480/591] [media] get rid of a number of problems at the cross references As warned by linuxdoc[1] tool, using: $ for i in $(git grep kernel-doc Documentation/media/kapi/|cut -d: -f4); do kernel-lintdoc --sloppy $i; done include/media/v4l2-dev.h:118 :WARN: function name from comment differs: v4l2_prio_close <--> v4l2_prio_check include/media/v4l2-mc.h:56 [kernel-doc WARN] : enum name from comment differs: if_vid_dec_index <--> if_vid_dec_pad_index include/media/v4l2-mc.h:71 [kernel-doc WARN] : enum name from comment differs: if_aud_dec_index <--> if_aud_dec_pad_index include/media/v4l2-mem2mem.h:396 [kernel-doc WARN] : function name from comment differs: v4l2_m2m_num_src_bufs_ready <--> v4l2_m2m_num_dst_bufs_ready drivers/media/dvb-core/dvb_math.h:28 [kernel-doc WARN] : function name from comment differs: cintlog2 <--> intlog2 include/media/v4l2-subdev.h:215 [kernel-doc WARN] : struct name from comment differs: s_radio <--> v4l2_subdev_tuner_ops include/media/v4l2-subdev.h:890 [kernel-doc WARN] : function name from comment differs: v4l2_set_subdevdata <--> v4l2_set_subdev_hostdata include/media/v4l2-subdev.h:901 [kernel-doc WARN] : function name from comment differs: v4l2_get_subdevdata <--> v4l2_get_subdev_hostdata drivers/media/dvb-core/dvb_ringbuffer.h:196 [kernel-doc WARN] : function name from comment differs: dvb_ringbuffer_writeuser <--> dvb_ringbuffer_write_user include/media/videobuf2-core.h:399 [kernel-doc WARN] : struct name from comment differs: vb2_ops <--> vb2_buf_ops include/media/media-entity.h:132 [kernel-doc ERROR] : duplicate parameter definition 'source' include/media/media-entity.h:477 [kernel-doc WARN] : function name from comment differs: media_entity_enum_test <--> media_entity_enum_test_and_set include/media/media-entity.h:535 [kernel-doc WARN] : function name from comment differs: gobj_to_entity <--> gobj_to_pad include/media/media-entity.h:544 [kernel-doc WARN] : function name from comment differs: gobj_to_entity <--> gobj_to_link include/media/media-entity.h:553 [kernel-doc WARN] : function name from comment differs: gobj_to_entity <--> gobj_to_intf include/media/media-entity.h:562 [kernel-doc WARN] : function name from comment differs: gobj_to_entity <--> intf_to_devnode include/media/rc-core.h:234 [kernel-doc WARN] : function name from comment differs: rc_open <--> rc_close include/media/v4l2-ctrls.h:397 [kernel-doc WARN] : missing initial short description of 'v4l2_ctrl_handler_init' include/media/v4l2-dev.h:118 [kernel-doc WARN] : function name from comment differs: v4l2_prio_close <--> v4l2_prio_check include/media/v4l2-event.h:225 [kernel-doc WARN] : missing initial short description of 'v4l2_src_change_event_subscribe' [1] https://return42.github.io/linuxdoc/linux.html The above are real issues at the documentation. On several cases, caused by cut-and-paste. Fix them. Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/v4l2-dev.rst | 2 +- drivers/media/dvb-core/dvb_math.h | 2 +- drivers/media/dvb-core/dvb_ringbuffer.h | 2 +- include/media/media-entity.h | 13 +++++++------ include/media/rc-core.h | 2 +- include/media/v4l2-ctrls.h | 3 ++- include/media/v4l2-dev.h | 2 +- include/media/v4l2-event.h | 3 ++- include/media/v4l2-mc.h | 4 ++-- include/media/v4l2-mem2mem.h | 2 +- include/media/v4l2-subdev.h | 7 ++++--- include/media/videobuf2-core.h | 2 +- 12 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Documentation/media/kapi/v4l2-dev.rst b/Documentation/media/kapi/v4l2-dev.rst index 0a3b4503a89f..b29aa616c267 100644 --- a/Documentation/media/kapi/v4l2-dev.rst +++ b/Documentation/media/kapi/v4l2-dev.rst @@ -173,7 +173,7 @@ The implementation of a hotplug disconnect should also take the lock from using :c:type:`video_device`->queue->lock, then you have to first lock :c:type:`video_device`->queue->lock followed by :c:type:`video_device`->lock. That way you can be sure no ioctl is running when you call -:c:type:`v4l2_device_disconnect`. +:c:func:`v4l2_device_disconnect`. Video device registration ------------------------- diff --git a/drivers/media/dvb-core/dvb_math.h b/drivers/media/dvb-core/dvb_math.h index 2f0326674ca6..4d11d3529c14 100644 --- a/drivers/media/dvb-core/dvb_math.h +++ b/drivers/media/dvb-core/dvb_math.h @@ -25,7 +25,7 @@ #include /** - * cintlog2 - computes log2 of a value; the result is shifted left by 24 bits + * intlog2 - computes log2 of a value; the result is shifted left by 24 bits * * @value: The value (must be != 0) * diff --git a/drivers/media/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb-core/dvb_ringbuffer.h index eae3f091b6a0..bbe94873d44d 100644 --- a/drivers/media/dvb-core/dvb_ringbuffer.h +++ b/drivers/media/dvb-core/dvb_ringbuffer.h @@ -193,7 +193,7 @@ extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len); /** - * dvb_ringbuffer_writeuser - Writes a buffer received via an user pointer + * dvb_ringbuffer_write_user - Writes a buffer received via an user pointer * * @rbuf: pointer to struct dvb_ringbuffer * @buf: pointer to the buffer where the data will be read diff --git a/include/media/media-entity.h b/include/media/media-entity.h index e21958c7c5d9..b2203ee7a4c1 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -129,7 +129,7 @@ struct media_pipeline { * an interface. * @gobj1: Part of a union. Used to get the pointer for the second * graph_object of the link. - * @source: Part of a union. Used only if the second object (gobj1) is + * @sink: Part of a union. Used only if the second object (gobj1) is * a pad. In that case, it represents the sink pad. * @entity: Part of a union. Used only if the second object (gobj1) is * an entity. @@ -474,7 +474,8 @@ static inline bool media_entity_enum_test(struct media_entity_enum *ent_enum, } /** - * media_entity_enum_test - Test whether the entity is marked, and mark it + * media_entity_enum_test_and_set - Test whether the entity is marked, + * and mark it * * @ent_enum: Entity enumeration * @entity: Entity to be tested @@ -532,7 +533,7 @@ static inline bool media_entity_enum_intersects( container_of(gobj, struct media_entity, graph_obj) /** - * gobj_to_entity - returns the struct &media_pad pointer from the + * gobj_to_pad - returns the struct &media_pad pointer from the * @gobj contained on it. * * @gobj: Pointer to the struct &media_gobj graph object @@ -541,7 +542,7 @@ static inline bool media_entity_enum_intersects( container_of(gobj, struct media_pad, graph_obj) /** - * gobj_to_entity - returns the struct &media_link pointer from the + * gobj_to_link - returns the struct &media_link pointer from the * @gobj contained on it. * * @gobj: Pointer to the struct &media_gobj graph object @@ -550,7 +551,7 @@ static inline bool media_entity_enum_intersects( container_of(gobj, struct media_link, graph_obj) /** - * gobj_to_entity - returns the struct &media_interface pointer from the + * gobj_to_intf - returns the struct &media_interface pointer from the * @gobj contained on it. * * @gobj: Pointer to the struct &media_gobj graph object @@ -559,7 +560,7 @@ static inline bool media_entity_enum_intersects( container_of(gobj, struct media_interface, graph_obj) /** - * gobj_to_entity - returns the struct media_intf_devnode pointer from the + * intf_to_devnode - returns the struct media_intf_devnode pointer from the * @intf contained on it. * * @intf: Pointer to struct &media_intf_devnode diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 10908e356b23..40188d362486 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -231,7 +231,7 @@ void rc_unregister_device(struct rc_dev *dev); int rc_open(struct rc_dev *rdev); /** - * rc_open - Closes a RC device + * rc_close - Closes a RC device * * @rdev: pointer to struct rc_dev. */ diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index beea0a2c0894..e1006b391cdc 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -394,7 +394,8 @@ int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, #ifdef CONFIG_LOCKDEP /** - * v4l2_ctrl_handler_init - + * v4l2_ctrl_handler_init - helper function to create a static struct + * &lock_class_key and calls v4l2_ctrl_handler_init_class() * * @hdl: The control handler. * @nr_of_controls_hint: A hint of how many controls this handler is diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 477e90d89a04..e657614521e3 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -115,7 +115,7 @@ void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local); enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); /** - * v4l2_prio_close - Implements the priority logic for a file handler close + * v4l2_prio_check - Implements the priority logic for a file handler close * * @global: pointer to the &struct v4l2_prio_state of the device node. * @local: desired priority, as defined by enum &v4l2_priority local diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h index ca854203b8b9..a700285c64a9 100644 --- a/include/media/v4l2-event.h +++ b/include/media/v4l2-event.h @@ -222,7 +222,8 @@ int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, struct v4l2_fh *fh, struct v4l2_event_subscription *sub); /** - * v4l2_src_change_event_subscribe - + * v4l2_src_change_event_subscribe - helper function that calls + * v4l2_event_subscribe() if the event is %V4L2_EVENT_SOURCE_CHANGE. * * @fh: pointer to struct v4l2_fh * @sub: pointer to &struct v4l2_event_subscription diff --git a/include/media/v4l2-mc.h b/include/media/v4l2-mc.h index 28c3f9d9c209..2634d9dc9916 100644 --- a/include/media/v4l2-mc.h +++ b/include/media/v4l2-mc.h @@ -53,7 +53,7 @@ enum tuner_pad_index { }; /** - * enum if_vid_dec_index - video IF-PLL pad index for + * enum if_vid_dec_pad_index - video IF-PLL pad index for * MEDIA_ENT_F_IF_VID_DECODER * * @IF_VID_DEC_PAD_IF_INPUT: video Intermediate Frequency (IF) sink pad @@ -68,7 +68,7 @@ enum if_vid_dec_pad_index { }; /** - * enum if_aud_dec_index - audio/sound IF-PLL pad index for + * enum if_aud_dec_pad_index - audio/sound IF-PLL pad index for * MEDIA_ENT_F_IF_AUD_DECODER * * @IF_AUD_DEC_PAD_IF_INPUT: audio Intermediate Frequency (IF) sink pad diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index 498c99baf8ac..1b355344c804 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h @@ -393,7 +393,7 @@ unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) } /** - * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers + * v4l2_m2m_num_dst_bufs_ready() - return the number of destination buffers * ready for use * * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 863f92600607..cf778c5dca18 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -212,7 +212,8 @@ struct v4l2_subdev_core_ops { }; /** - * struct s_radio - Callbacks used when v4l device was opened in radio mode. + * struct v4l2_subdev_tuner_ops - Callbacks used when v4l device was opened + * in radio mode. * * @s_radio: callback for %VIDIOC_S_RADIO ioctl handler code. * @@ -887,7 +888,7 @@ static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd) } /** - * v4l2_set_subdevdata - Sets V4L2 dev private host data + * v4l2_set_subdev_hostdata - Sets V4L2 dev private host data * * @sd: pointer to &struct v4l2_subdev * @p: pointer to the private data to be stored. @@ -898,7 +899,7 @@ static inline void v4l2_set_subdev_hostdata(struct v4l2_subdev *sd, void *p) } /** - * v4l2_get_subdevdata - Gets V4L2 dev private data + * v4l2_get_subdev_hostdata - Gets V4L2 dev private data * * @sd: pointer to &struct v4l2_subdev * diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 9a144f2d9083..ac5898a55fd9 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -396,7 +396,7 @@ struct vb2_ops { }; /** - * struct vb2_ops - driver-specific callbacks + * struct vb2_buf_ops - driver-specific callbacks * * @verify_planes_array: Verify that a given user space structure contains * enough planes for the buffer. This is called From 3b92fed5e3d6ee7508ca4a3dac10a95a386a3fa5 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Wed, 31 Aug 2016 09:55:59 -0300 Subject: [PATCH 481/591] [media] s5p-jpeg: fix system and runtime PM integration Use generic helpers instead of open-coding usage of runtime PM for system sleep PM, which was potentially broken for some corner cases. Signed-off-by: Marek Szyprowski Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index d5e7762b7059..52dc7941db65 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -3003,26 +3003,9 @@ static int s5p_jpeg_runtime_resume(struct device *dev) } #endif /* CONFIG_PM */ -#ifdef CONFIG_PM_SLEEP -static int s5p_jpeg_suspend(struct device *dev) -{ - if (pm_runtime_suspended(dev)) - return 0; - - return s5p_jpeg_runtime_suspend(dev); -} - -static int s5p_jpeg_resume(struct device *dev) -{ - if (pm_runtime_suspended(dev)) - return 0; - - return s5p_jpeg_runtime_resume(dev); -} -#endif - static const struct dev_pm_ops s5p_jpeg_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(s5p_jpeg_suspend, s5p_jpeg_resume) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) SET_RUNTIME_PM_OPS(s5p_jpeg_runtime_suspend, s5p_jpeg_runtime_resume, NULL) }; From 57b978ada073106d8fc12614f504cb92366a7ce1 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Wed, 31 Aug 2016 09:55:58 -0300 Subject: [PATCH 482/591] [media] s5p-cec: fix system and runtime PM integration Use generic helpers instead of open-coding usage of runtime PM for system sleep PM, which was potentially broken for some corner cases. Signed-off-by: Marek Szyprowski Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/s5p-cec/s5p_cec.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/s5p-cec/s5p_cec.c b/drivers/staging/media/s5p-cec/s5p_cec.c index 78333273c4e5..77d9887801b8 100644 --- a/drivers/staging/media/s5p-cec/s5p_cec.c +++ b/drivers/staging/media/s5p-cec/s5p_cec.c @@ -250,22 +250,9 @@ static int s5p_cec_runtime_resume(struct device *dev) return 0; } -static int __maybe_unused s5p_cec_suspend(struct device *dev) -{ - if (pm_runtime_suspended(dev)) - return 0; - return s5p_cec_runtime_suspend(dev); -} - -static int __maybe_unused s5p_cec_resume(struct device *dev) -{ - if (pm_runtime_suspended(dev)) - return 0; - return s5p_cec_runtime_resume(dev); -} - static const struct dev_pm_ops s5p_cec_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(s5p_cec_suspend, s5p_cec_resume) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) SET_RUNTIME_PM_OPS(s5p_cec_runtime_suspend, s5p_cec_runtime_resume, NULL) }; From 6e7122a3c83ad468037e7f22f324feccb6252bf4 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Wed, 31 Aug 2016 10:45:04 -0300 Subject: [PATCH 483/591] [media] s5p-cec: Fix memory allocation failure check It is likely that checking the result of the memory allocation just above is expected here. Signed-off-by: Christophe JAILLET Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/s5p-cec/s5p_cec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/s5p-cec/s5p_cec.c b/drivers/staging/media/s5p-cec/s5p_cec.c index 77d9887801b8..1780a08b73c9 100644 --- a/drivers/staging/media/s5p-cec/s5p_cec.c +++ b/drivers/staging/media/s5p-cec/s5p_cec.c @@ -173,7 +173,7 @@ static int s5p_cec_probe(struct platform_device *pdev) int ret; cec = devm_kzalloc(&pdev->dev, sizeof(*cec), GFP_KERNEL); - if (!dev) + if (!cec) return -ENOMEM; cec->dev = dev; From 438236e7c151ec797d433fd4c3e770f55cdc5d04 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Wed, 31 Aug 2016 10:25:16 -0300 Subject: [PATCH 484/591] [media] exynos4-is: Add support for all required clocks This patch adds 3 more clocks to Exynos4 ISP driver. Enabling them is needed to make the hardware operational. Till now it worked only because those clocks were registered with IGNORE_UNUSED flag and were enabled by default after SoC reset. Signed-off-by: Marek Szyprowski Acked-by: Krzysztof Kozlowski Signed-off-by: Mauro Carvalho Chehab --- .../devicetree/bindings/media/exynos4-fimc-is.txt | 7 ++++--- drivers/media/platform/exynos4-is/fimc-is.c | 3 +++ drivers/media/platform/exynos4-is/fimc-is.h | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/media/exynos4-fimc-is.txt b/Documentation/devicetree/bindings/media/exynos4-fimc-is.txt index 55c9ad6f9599..32ced99d4244 100644 --- a/Documentation/devicetree/bindings/media/exynos4-fimc-is.txt +++ b/Documentation/devicetree/bindings/media/exynos4-fimc-is.txt @@ -16,9 +16,10 @@ Required properties: - clocks : list of clock specifiers, corresponding to entries in clock-names property; - clock-names : must contain "ppmuispx", "ppmuispx", "lite0", "lite1" - "mpll", "sysreg", "isp", "drc", "fd", "mcuisp", "uart", - "ispdiv0", "ispdiv1", "mcuispdiv0", "mcuispdiv1", "aclk200", - "div_aclk200", "aclk400mcuisp", "div_aclk400mcuisp" entries, + "mpll", "sysreg", "isp", "drc", "fd", "mcuisp", "gicisp", + "pwm_isp", "mcuctl_isp", "uart", "ispdiv0", "ispdiv1", + "mcuispdiv0", "mcuispdiv1", "aclk200", "div_aclk200", + "aclk400mcuisp", "div_aclk400mcuisp" entries, matching entries in the clocks property. pmu subnode ----------- diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 13c779de79fd..313ab10dbb94 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -52,6 +52,9 @@ static char *fimc_is_clocks[ISS_CLKS_MAX] = { [ISS_CLK_DRC] = "drc", [ISS_CLK_FD] = "fd", [ISS_CLK_MCUISP] = "mcuisp", + [ISS_CLK_GICISP] = "gicisp", + [ISS_CLK_PWM_ISP] = "pwm_isp", + [ISS_CLK_MCUCTL_ISP] = "mcuctl_isp", [ISS_CLK_UART] = "uart", [ISS_CLK_ISP_DIV0] = "ispdiv0", [ISS_CLK_ISP_DIV1] = "ispdiv1", diff --git a/drivers/media/platform/exynos4-is/fimc-is.h b/drivers/media/platform/exynos4-is/fimc-is.h index 3a82c6a214c7..ee05da034aa1 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.h +++ b/drivers/media/platform/exynos4-is/fimc-is.h @@ -77,6 +77,9 @@ enum { ISS_CLK_DRC, ISS_CLK_FD, ISS_CLK_MCUISP, + ISS_CLK_GICISP, + ISS_CLK_PWM_ISP, + ISS_CLK_MCUCTL_ISP, ISS_CLK_UART, ISS_GATE_CLKS_MAX, ISS_CLK_ISP_DIV0 = ISS_GATE_CLKS_MAX, From 5f6d636f91da5e9f44f2eac070688817f3acc34c Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Wed, 31 Aug 2016 10:25:17 -0300 Subject: [PATCH 485/591] [media] exynos4-is: Improve clock management There is no need to keep all clocks prepared all the time. Call to clk_prepare/unprepare can be done on demand from runtime pm callbacks (it is allowed to call sleeping functions from that context). Signed-off-by: Marek Szyprowski Acked-by: Krzysztof Kozlowski Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos4-is/fimc-lite.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index a0f149fb88e1..fd16605dd1d4 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -1454,25 +1454,17 @@ static void fimc_lite_clk_put(struct fimc_lite *fimc) if (IS_ERR(fimc->clock)) return; - clk_unprepare(fimc->clock); clk_put(fimc->clock); fimc->clock = ERR_PTR(-EINVAL); } static int fimc_lite_clk_get(struct fimc_lite *fimc) { - int ret; - fimc->clock = clk_get(&fimc->pdev->dev, FLITE_CLK_NAME); if (IS_ERR(fimc->clock)) return PTR_ERR(fimc->clock); - ret = clk_prepare(fimc->clock); - if (ret < 0) { - clk_put(fimc->clock); - fimc->clock = ERR_PTR(-EINVAL); - } - return ret; + return 0; } static const struct of_device_id flite_of_match[]; @@ -1543,7 +1535,7 @@ static int fimc_lite_probe(struct platform_device *pdev) pm_runtime_enable(dev); if (!pm_runtime_enabled(dev)) { - ret = clk_enable(fimc->clock); + ret = clk_prepare_enable(fimc->clock); if (ret < 0) goto err_sd; } @@ -1568,7 +1560,7 @@ static int fimc_lite_runtime_resume(struct device *dev) { struct fimc_lite *fimc = dev_get_drvdata(dev); - clk_enable(fimc->clock); + clk_prepare_enable(fimc->clock); return 0; } @@ -1576,7 +1568,7 @@ static int fimc_lite_runtime_suspend(struct device *dev) { struct fimc_lite *fimc = dev_get_drvdata(dev); - clk_disable(fimc->clock); + clk_disable_unprepare(fimc->clock); return 0; } #endif From bae4500399c4243d6ce8933817ca7c7005886727 Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Thu, 1 Sep 2016 08:47:05 -0300 Subject: [PATCH 486/591] [media] exynos4-is: Add missing entity function initialization Suppresses following warnings: s5p-fimc-md camera: Entity type for entity FIMC.0 was not initialized! s5p-fimc-md camera: Entity type for entity FIMC.1 was not initialized! s5p-fimc-md camera: Entity type for entity s5p-mipi-csis.0 was not initialized! s5p-fimc-md camera: Entity type for entity s5p-mipi-csis.1 was not initialized! s5p-fimc-md camera: Entity type for entity FIMC-LITE.0 was not initialized! s5p-fimc-md camera: Entity type for entity FIMC-LITE.1 was not initialized! s5p-fimc-md camera: Entity type for entity FIMC-IS-ISP was not initialized! Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos4-is/fimc-capture.c | 1 + drivers/media/platform/exynos4-is/fimc-isp.c | 1 + drivers/media/platform/exynos4-is/fimc-lite.c | 1 + drivers/media/platform/exynos4-is/mipi-csis.c | 1 + 4 files changed, 4 insertions(+) diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c index 344028ea7d55..964f4a681934 100644 --- a/drivers/media/platform/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/exynos4-is/fimc-capture.c @@ -1796,6 +1796,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, vid_cap->wb_fmt.code = fmt->mbus_code; vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; + vfd->entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER; ret = media_entity_pads_init(&vfd->entity, 1, &vid_cap->vd_pad); if (ret) goto err_free_ctx; diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c index 293b807020c4..8efe9160ab34 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp.c +++ b/drivers/media/platform/exynos4-is/fimc-isp.c @@ -705,6 +705,7 @@ int fimc_isp_subdev_create(struct fimc_isp *isp) sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; snprintf(sd->name, sizeof(sd->name), "FIMC-IS-ISP"); + sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; isp->subdev_pads[FIMC_ISP_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK; isp->subdev_pads[FIMC_ISP_SD_PAD_SRC_FIFO].flags = MEDIA_PAD_FL_SOURCE; isp->subdev_pads[FIMC_ISP_SD_PAD_SRC_DMA].flags = MEDIA_PAD_FL_SOURCE; diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index fd16605dd1d4..b91abf1c4d43 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -1432,6 +1432,7 @@ static int fimc_lite_create_capture_subdev(struct fimc_lite *fimc) sd->ctrl_handler = handler; sd->internal_ops = &fimc_lite_subdev_internal_ops; + sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER; sd->entity.ops = &fimc_lite_subdev_media_ops; sd->owner = THIS_MODULE; v4l2_set_subdevdata(sd, fimc); diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c index 86e681daa89d..befd9fc0adc4 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c @@ -853,6 +853,7 @@ static int s5pcsis_probe(struct platform_device *pdev) state->format.width = S5PCSIS_DEF_PIX_WIDTH; state->format.height = S5PCSIS_DEF_PIX_HEIGHT; + state->sd.entity.function = MEDIA_ENT_F_IO_V4L; state->pads[CSIS_PAD_SINK].flags = MEDIA_PAD_FL_SINK; state->pads[CSIS_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_pads_init(&state->sd.entity, From 654fa103920d92f01dac6ae2290ed9261b2b7866 Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Thu, 1 Sep 2016 08:47:06 -0300 Subject: [PATCH 487/591] [media] s5k6a3: Add missing entity function initialization Suppresses warning like: s5p-fimc-md camera: Entity type for entity S5K6A3 13-0010 was not initialized! Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/s5k6a3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/s5k6a3.c b/drivers/media/i2c/s5k6a3.c index b1ecb44f9f14..769964057881 100644 --- a/drivers/media/i2c/s5k6a3.c +++ b/drivers/media/i2c/s5k6a3.c @@ -331,6 +331,7 @@ static int s5k6a3_probe(struct i2c_client *client, sensor->format.width = S5K6A3_DEFAULT_WIDTH; sensor->format.height = S5K6A3_DEFAULT_HEIGHT; + sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; sensor->pad.flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_pads_init(&sd->entity, 1, &sensor->pad); if (ret < 0) From cb47b415fd5cda7c9ef8f9d158e59f8af5bcb094 Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Thu, 1 Sep 2016 08:47:07 -0300 Subject: [PATCH 488/591] [media] s5c73m3: Fix entity function assignment for the OIF subdev Suppresses warnings like: s5p-fimc-md camera: Entity type for entity S5C73M3-OIF was not initialized! Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c index 08af58fb8e7d..3844853ab0a0 100644 --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c @@ -1706,7 +1706,7 @@ static int s5c73m3_probe(struct i2c_client *client, state->oif_pads[OIF_ISP_PAD].flags = MEDIA_PAD_FL_SINK; state->oif_pads[OIF_JPEG_PAD].flags = MEDIA_PAD_FL_SINK; state->oif_pads[OIF_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE; - oif_sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; + oif_sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER; ret = media_entity_pads_init(&oif_sd->entity, OIF_NUM_PADS, state->oif_pads); From 056c61eb0da4d7181fc7072567dc1931cb0e1cbb Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Tue, 13 Sep 2016 11:39:33 -0300 Subject: [PATCH 489/591] [media] exynos4-is: Clear isp-i2c adapter power.ignore_children flag Since commit 04f59143b571161d25315dd52d7a2ecc022cb71a ("i2c: let I2C masters ignore their children for PM") the power.ignore_children flag is set when registering an I2C adapter. Since I2C transfers are not managed by the fimc-isp-i2c driver its clients use pm_runtime_* calls directly to communicate required power state of the bus controller. However, when the power.ignore_children flag is set that doesn't work, so clear that flag back after registering the adapter. While at it drop pm_runtime_enable() call on the i2c_adapter as it is already done by the I2C subsystem when registering I2C adapter. This patch is meant as a minimal change to fix the regression, eventually the I2C_ISPx clock handling will be moved to the top level fimc-is driver and whole runtime PM code is going to be dropped from the fimc-is-i2c module. Cc: # 4.7+ Reported-by: Marek Szyprowski Signed-off-by: Sylwester Nawrocki Reviewed-by: Bartlomiej Zolnierkiewicz Signed-off-by: Mauro Carvalho Chehab --- .../media/platform/exynos4-is/fimc-is-i2c.c | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is-i2c.c b/drivers/media/platform/exynos4-is/fimc-is-i2c.c index fd888ef447a9..6bba4ca022be 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-i2c.c +++ b/drivers/media/platform/exynos4-is/fimc-is-i2c.c @@ -55,23 +55,33 @@ static int fimc_is_i2c_probe(struct platform_device *pdev) i2c_adap->algo = &fimc_is_i2c_algorithm; i2c_adap->class = I2C_CLASS_SPD; + platform_set_drvdata(pdev, isp_i2c); + pm_runtime_enable(&pdev->dev); + ret = i2c_add_adapter(i2c_adap); if (ret < 0) - return ret; - - platform_set_drvdata(pdev, isp_i2c); - - pm_runtime_enable(&pdev->dev); - pm_runtime_enable(&i2c_adap->dev); - + goto err_pm_dis; + /* + * Client drivers of this adapter don't do any I2C transfers as that + * is handled by the ISP firmware. But we rely on the runtime PM + * state propagation from the clients up to the adapter driver so + * clear the ignore_children flags here. PM rutnime calls are not + * used in probe() handler of clients of this adapter so there is + * no issues with clearing the flag right after registering the I2C + * adapter. + */ + pm_suspend_ignore_children(&i2c_adap->dev, false); return 0; + +err_pm_dis: + pm_runtime_disable(&pdev->dev); + return ret; } static int fimc_is_i2c_remove(struct platform_device *pdev) { struct fimc_is_i2c *isp_i2c = platform_get_drvdata(pdev); - pm_runtime_disable(&isp_i2c->adapter.dev); pm_runtime_disable(&pdev->dev); i2c_del_adapter(&isp_i2c->adapter); From 2950da489520ed66da0934d04ebeb32054263e12 Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Tue, 13 Sep 2016 08:59:49 -0300 Subject: [PATCH 490/591] [media] exynos4-is: add of_platform_populate() call for FIMC-IS child devices Instead of relying on the "simple-bus" compatible and the driver core populating FIMC-IS child devices make the fimc-is driver populating its child devices. This prevents issues related to accessing ISP_I2C clock registers with corresponding power domain switched off, which popped out after applying some pending IOMMU driver patches. Now the I2C_ISP child devices will be instantiated only when required parent device drivers are initialized and ready. Signed-off-by: Marek Szyprowski Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos4-is/fimc-is.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 313ab10dbb94..518ad34f80d7 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -852,13 +852,18 @@ static int fimc_is_probe(struct platform_device *pdev) goto err_pm; vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); + + ret = of_platform_populate(dev->of_node, NULL, NULL, dev); + if (ret < 0) + goto err_pm; + /* * Register FIMC-IS V4L2 subdevs to this driver. The video nodes * will be created within the subdev's registered() callback. */ ret = fimc_is_register_subdevs(is); if (ret < 0) - goto err_pm; + goto err_of_dep; ret = fimc_is_debugfs_create(is); if (ret < 0) @@ -877,6 +882,8 @@ err_dfs: fimc_is_debugfs_remove(is); err_sd: fimc_is_unregister_subdevs(is); +err_of_dep: + of_platform_depopulate(dev); err_pm: if (!pm_runtime_enabled(dev)) fimc_is_runtime_suspend(dev); @@ -936,6 +943,7 @@ static int fimc_is_remove(struct platform_device *pdev) if (!pm_runtime_status_suspended(dev)) fimc_is_runtime_suspend(dev); free_irq(is->irq, is); + of_platform_depopulate(dev); fimc_is_unregister_subdevs(is); vb2_dma_contig_clear_max_seg_size(dev); fimc_is_put_clocks(is); From cf439d5f4d609b296cabf9a896fcf571b57e260b Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Wed, 27 Apr 2016 09:39:17 -0300 Subject: [PATCH 491/591] [media] media: Determine early whether an IOCTL is supported Preparation for refactoring media IOCTL handling to unify common parts. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/media-device.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 1795abeda658..f3212640858b 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -419,6 +419,22 @@ static long media_device_get_topology(struct media_device *mdev, return 0; } +#define MEDIA_IOC(__cmd) \ + [_IOC_NR(MEDIA_IOC_##__cmd)] = { .cmd = MEDIA_IOC_##__cmd } + +/* the table is indexed by _IOC_NR(cmd) */ +struct media_ioctl_info { + unsigned int cmd; +}; + +static const struct media_ioctl_info ioctl_info[] = { + MEDIA_IOC(DEVICE_INFO), + MEDIA_IOC(ENUM_ENTITIES), + MEDIA_IOC(ENUM_LINKS), + MEDIA_IOC(SETUP_LINK), + MEDIA_IOC(G_TOPOLOGY), +}; + static long media_device_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { @@ -426,6 +442,10 @@ static long media_device_ioctl(struct file *filp, unsigned int cmd, struct media_device *dev = devnode->media_dev; long ret; + if (_IOC_NR(cmd) >= ARRAY_SIZE(ioctl_info) + || ioctl_info[_IOC_NR(cmd)].cmd != cmd) + return -ENOIOCTLCMD; + mutex_lock(&dev->graph_mutex); switch (cmd) { case MEDIA_IOC_DEVICE_INFO: From 6975264c4c6c00c88099b8927bac52838507cea9 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Tue, 3 May 2016 18:35:12 -0300 Subject: [PATCH 492/591] [media] media: Unify IOCTL handler calling Each IOCTL handler can be listed in an array instead of using a large and cumbersome switch. Do that. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/media-device.c | 51 +++++++++++------------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index f3212640858b..4ac912b60f85 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -419,20 +419,24 @@ static long media_device_get_topology(struct media_device *mdev, return 0; } -#define MEDIA_IOC(__cmd) \ - [_IOC_NR(MEDIA_IOC_##__cmd)] = { .cmd = MEDIA_IOC_##__cmd } +#define MEDIA_IOC(__cmd, func) \ + [_IOC_NR(MEDIA_IOC_##__cmd)] = { \ + .cmd = MEDIA_IOC_##__cmd, \ + .fn = (long (*)(struct media_device *, void __user *))func, \ + } /* the table is indexed by _IOC_NR(cmd) */ struct media_ioctl_info { unsigned int cmd; + long (*fn)(struct media_device *dev, void __user *arg); }; static const struct media_ioctl_info ioctl_info[] = { - MEDIA_IOC(DEVICE_INFO), - MEDIA_IOC(ENUM_ENTITIES), - MEDIA_IOC(ENUM_LINKS), - MEDIA_IOC(SETUP_LINK), - MEDIA_IOC(G_TOPOLOGY), + MEDIA_IOC(DEVICE_INFO, media_device_get_info), + MEDIA_IOC(ENUM_ENTITIES, media_device_enum_entities), + MEDIA_IOC(ENUM_LINKS, media_device_enum_links), + MEDIA_IOC(SETUP_LINK, media_device_setup_link), + MEDIA_IOC(G_TOPOLOGY, media_device_get_topology), }; static long media_device_ioctl(struct file *filp, unsigned int cmd, @@ -440,42 +444,17 @@ static long media_device_ioctl(struct file *filp, unsigned int cmd, { struct media_devnode *devnode = media_devnode_data(filp); struct media_device *dev = devnode->media_dev; + const struct media_ioctl_info *info; long ret; if (_IOC_NR(cmd) >= ARRAY_SIZE(ioctl_info) || ioctl_info[_IOC_NR(cmd)].cmd != cmd) return -ENOIOCTLCMD; + info = &ioctl_info[_IOC_NR(cmd)]; + mutex_lock(&dev->graph_mutex); - switch (cmd) { - case MEDIA_IOC_DEVICE_INFO: - ret = media_device_get_info(dev, - (struct media_device_info __user *)arg); - break; - - case MEDIA_IOC_ENUM_ENTITIES: - ret = media_device_enum_entities(dev, - (struct media_entity_desc __user *)arg); - break; - - case MEDIA_IOC_ENUM_LINKS: - ret = media_device_enum_links(dev, - (struct media_links_enum __user *)arg); - break; - - case MEDIA_IOC_SETUP_LINK: - ret = media_device_setup_link(dev, - (struct media_link_desc __user *)arg); - break; - - case MEDIA_IOC_G_TOPOLOGY: - ret = media_device_get_topology(dev, - (struct media_v2_topology __user *)arg); - break; - - default: - ret = -ENOIOCTLCMD; - } + ret = info->fn(dev, (void __user *)arg); mutex_unlock(&dev->graph_mutex); return ret; From bcd5081b05367d108c1380369c698a4601c41cfc Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Tue, 3 May 2016 18:42:13 -0300 Subject: [PATCH 493/591] [media] media: Refactor copying IOCTL arguments from and to user space Refactor copying the IOCTL argument structs from the user space and back, in order to reduce code copied around and make the implementation more robust. As a result, the copying is done while not holding the graph mutex. Signed-off-by: Sakari Ailus Acked-by: Hans Verkuil Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/media-device.c | 182 +++++++++++++++++------------------ 1 file changed, 86 insertions(+), 96 deletions(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 4ac912b60f85..c44406ed1bb1 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -59,27 +59,24 @@ static int media_device_close(struct file *filp) } static int media_device_get_info(struct media_device *dev, - struct media_device_info __user *__info) + struct media_device_info *info) { - struct media_device_info info; - - memset(&info, 0, sizeof(info)); + memset(info, 0, sizeof(*info)); if (dev->driver_name[0]) - strlcpy(info.driver, dev->driver_name, sizeof(info.driver)); + strlcpy(info->driver, dev->driver_name, sizeof(info->driver)); else - strlcpy(info.driver, dev->dev->driver->name, sizeof(info.driver)); + strlcpy(info->driver, dev->dev->driver->name, + sizeof(info->driver)); - strlcpy(info.model, dev->model, sizeof(info.model)); - strlcpy(info.serial, dev->serial, sizeof(info.serial)); - strlcpy(info.bus_info, dev->bus_info, sizeof(info.bus_info)); + strlcpy(info->model, dev->model, sizeof(info->model)); + strlcpy(info->serial, dev->serial, sizeof(info->serial)); + strlcpy(info->bus_info, dev->bus_info, sizeof(info->bus_info)); - info.media_version = MEDIA_API_VERSION; - info.hw_revision = dev->hw_revision; - info.driver_version = dev->driver_version; + info->media_version = MEDIA_API_VERSION; + info->hw_revision = dev->hw_revision; + info->driver_version = dev->driver_version; - if (copy_to_user(__info, &info, sizeof(*__info))) - return -EFAULT; return 0; } @@ -101,29 +98,25 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id) } static long media_device_enum_entities(struct media_device *mdev, - struct media_entity_desc __user *uent) + struct media_entity_desc *entd) { struct media_entity *ent; - struct media_entity_desc u_ent; - - memset(&u_ent, 0, sizeof(u_ent)); - if (copy_from_user(&u_ent.id, &uent->id, sizeof(u_ent.id))) - return -EFAULT; - - ent = find_entity(mdev, u_ent.id); + ent = find_entity(mdev, entd->id); if (ent == NULL) return -EINVAL; - u_ent.id = media_entity_id(ent); + memset(entd, 0, sizeof(*entd)); + + entd->id = media_entity_id(ent); if (ent->name) - strlcpy(u_ent.name, ent->name, sizeof(u_ent.name)); - u_ent.type = ent->function; - u_ent.revision = 0; /* Unused */ - u_ent.flags = ent->flags; - u_ent.group_id = 0; /* Unused */ - u_ent.pads = ent->num_pads; - u_ent.links = ent->num_links - ent->num_backlinks; + strlcpy(entd->name, ent->name, sizeof(entd->name)); + entd->type = ent->function; + entd->revision = 0; /* Unused */ + entd->flags = ent->flags; + entd->group_id = 0; /* Unused */ + entd->pads = ent->num_pads; + entd->links = ent->num_links - ent->num_backlinks; /* * Workaround for a bug at media-ctl <= v1.10 that makes it to @@ -139,14 +132,13 @@ static long media_device_enum_entities(struct media_device *mdev, if (ent->function < MEDIA_ENT_F_OLD_BASE || ent->function > MEDIA_ENT_T_DEVNODE_UNKNOWN) { if (is_media_entity_v4l2_subdev(ent)) - u_ent.type = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; + entd->type = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; else if (ent->function != MEDIA_ENT_F_IO_V4L) - u_ent.type = MEDIA_ENT_T_DEVNODE_UNKNOWN; + entd->type = MEDIA_ENT_T_DEVNODE_UNKNOWN; } - memcpy(&u_ent.raw, &ent->info, sizeof(ent->info)); - if (copy_to_user(uent, &u_ent, sizeof(u_ent))) - return -EFAULT; + memcpy(&entd->raw, &ent->info, sizeof(ent->info)); + return 0; } @@ -158,8 +150,8 @@ static void media_device_kpad_to_upad(const struct media_pad *kpad, upad->flags = kpad->flags; } -static long __media_device_enum_links(struct media_device *mdev, - struct media_links_enum *links) +static long media_device_enum_links(struct media_device *mdev, + struct media_links_enum *links) { struct media_entity *entity; @@ -206,64 +198,35 @@ static long __media_device_enum_links(struct media_device *mdev, return 0; } -static long media_device_enum_links(struct media_device *mdev, - struct media_links_enum __user *ulinks) -{ - struct media_links_enum links; - int rval; - - if (copy_from_user(&links, ulinks, sizeof(links))) - return -EFAULT; - - rval = __media_device_enum_links(mdev, &links); - if (rval < 0) - return rval; - - if (copy_to_user(ulinks, &links, sizeof(*ulinks))) - return -EFAULT; - - return 0; -} - static long media_device_setup_link(struct media_device *mdev, - struct media_link_desc __user *_ulink) + struct media_link_desc *linkd) { struct media_link *link = NULL; - struct media_link_desc ulink; struct media_entity *source; struct media_entity *sink; - int ret; - - if (copy_from_user(&ulink, _ulink, sizeof(ulink))) - return -EFAULT; /* Find the source and sink entities and link. */ - source = find_entity(mdev, ulink.source.entity); - sink = find_entity(mdev, ulink.sink.entity); + source = find_entity(mdev, linkd->source.entity); + sink = find_entity(mdev, linkd->sink.entity); if (source == NULL || sink == NULL) return -EINVAL; - if (ulink.source.index >= source->num_pads || - ulink.sink.index >= sink->num_pads) + if (linkd->source.index >= source->num_pads || + linkd->sink.index >= sink->num_pads) return -EINVAL; - link = media_entity_find_link(&source->pads[ulink.source.index], - &sink->pads[ulink.sink.index]); + link = media_entity_find_link(&source->pads[linkd->source.index], + &sink->pads[linkd->sink.index]); if (link == NULL) return -EINVAL; /* Setup the link on both entities. */ - ret = __media_entity_setup_link(link, ulink.flags); - - if (copy_to_user(_ulink, &ulink, sizeof(ulink))) - return -EFAULT; - - return ret; + return __media_entity_setup_link(link, linkd->flags); } -static long __media_device_get_topology(struct media_device *mdev, +static long media_device_get_topology(struct media_device *mdev, struct media_v2_topology *topo) { struct media_entity *entity; @@ -400,35 +363,41 @@ static long __media_device_get_topology(struct media_device *mdev, return ret; } -static long media_device_get_topology(struct media_device *mdev, - struct media_v2_topology __user *utopo) +static long copy_arg_from_user(void *karg, void __user *uarg, unsigned int cmd) { - struct media_v2_topology ktopo; - int ret; - - if (copy_from_user(&ktopo, utopo, sizeof(ktopo))) - return -EFAULT; - - ret = __media_device_get_topology(mdev, &ktopo); - if (ret < 0) - return ret; - - if (copy_to_user(utopo, &ktopo, sizeof(*utopo))) + /* All media IOCTLs are _IOWR() */ + if (copy_from_user(karg, uarg, _IOC_SIZE(cmd))) return -EFAULT; return 0; } -#define MEDIA_IOC(__cmd, func) \ - [_IOC_NR(MEDIA_IOC_##__cmd)] = { \ - .cmd = MEDIA_IOC_##__cmd, \ - .fn = (long (*)(struct media_device *, void __user *))func, \ +static long copy_arg_to_user(void __user *uarg, void *karg, unsigned int cmd) +{ + /* All media IOCTLs are _IOWR() */ + if (copy_to_user(uarg, karg, _IOC_SIZE(cmd))) + return -EFAULT; + + return 0; +} + +#define MEDIA_IOC_ARG(__cmd, func, from_user, to_user) \ + [_IOC_NR(MEDIA_IOC_##__cmd)] = { \ + .cmd = MEDIA_IOC_##__cmd, \ + .fn = (long (*)(struct media_device *, void *))func, \ + .arg_from_user = from_user, \ + .arg_to_user = to_user, \ } +#define MEDIA_IOC(__cmd, func) \ + MEDIA_IOC_ARG(__cmd, func, copy_arg_from_user, copy_arg_to_user) + /* the table is indexed by _IOC_NR(cmd) */ struct media_ioctl_info { unsigned int cmd; - long (*fn)(struct media_device *dev, void __user *arg); + long (*fn)(struct media_device *dev, void *arg); + long (*arg_from_user)(void *karg, void __user *uarg, unsigned int cmd); + long (*arg_to_user)(void __user *uarg, void *karg, unsigned int cmd); }; static const struct media_ioctl_info ioctl_info[] = { @@ -440,11 +409,13 @@ static const struct media_ioctl_info ioctl_info[] = { }; static long media_device_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) + unsigned long __arg) { struct media_devnode *devnode = media_devnode_data(filp); struct media_device *dev = devnode->media_dev; const struct media_ioctl_info *info; + void __user *arg = (void __user *)__arg; + char __karg[256], *karg = __karg; long ret; if (_IOC_NR(cmd) >= ARRAY_SIZE(ioctl_info) @@ -453,10 +424,29 @@ static long media_device_ioctl(struct file *filp, unsigned int cmd, info = &ioctl_info[_IOC_NR(cmd)]; + if (_IOC_SIZE(info->cmd) > sizeof(__karg)) { + karg = kmalloc(_IOC_SIZE(info->cmd), GFP_KERNEL); + if (!karg) + return -ENOMEM; + } + + if (info->arg_from_user) { + ret = info->arg_from_user(karg, arg, cmd); + if (ret) + goto out_free; + } + mutex_lock(&dev->graph_mutex); - ret = info->fn(dev, (void __user *)arg); + ret = info->fn(dev, karg); mutex_unlock(&dev->graph_mutex); + if (!ret && info->arg_to_user) + ret = info->arg_to_user(arg, karg, cmd); + +out_free: + if (karg != __karg) + kfree(karg); + return ret; } @@ -485,7 +475,7 @@ static long media_device_enum_links32(struct media_device *mdev, links.pads = compat_ptr(pads_ptr); links.links = compat_ptr(links_ptr); - return __media_device_enum_links(mdev, &links); + return media_device_enum_links(mdev, &links); } #define MEDIA_IOC_ENUM_LINKS32 _IOWR('|', 0x02, struct media_links_enum32) From 7d4b64028c4bc8db01047b852777dbded4635de6 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Wed, 27 Apr 2016 10:15:52 -0300 Subject: [PATCH 494/591] [media] media: Add flags to tell whether to take graph mutex for an IOCTL New IOCTLs (especially for the request API) do not necessarily need the graph mutex acquired. Leave this up to the drivers. Signed-off-by: Sakari Ailus Reviewed-by: Laurent Pinchart Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/media-device.c | 37 ++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index c44406ed1bb1..2783531f9fc0 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -381,31 +381,36 @@ static long copy_arg_to_user(void __user *uarg, void *karg, unsigned int cmd) return 0; } -#define MEDIA_IOC_ARG(__cmd, func, from_user, to_user) \ - [_IOC_NR(MEDIA_IOC_##__cmd)] = { \ - .cmd = MEDIA_IOC_##__cmd, \ +/* Do acquire the graph mutex */ +#define MEDIA_IOC_FL_GRAPH_MUTEX BIT(0) + +#define MEDIA_IOC_ARG(__cmd, func, fl, from_user, to_user) \ + [_IOC_NR(MEDIA_IOC_##__cmd)] = { \ + .cmd = MEDIA_IOC_##__cmd, \ .fn = (long (*)(struct media_device *, void *))func, \ - .arg_from_user = from_user, \ - .arg_to_user = to_user, \ + .flags = fl, \ + .arg_from_user = from_user, \ + .arg_to_user = to_user, \ } -#define MEDIA_IOC(__cmd, func) \ - MEDIA_IOC_ARG(__cmd, func, copy_arg_from_user, copy_arg_to_user) +#define MEDIA_IOC(__cmd, func, fl) \ + MEDIA_IOC_ARG(__cmd, func, fl, copy_arg_from_user, copy_arg_to_user) /* the table is indexed by _IOC_NR(cmd) */ struct media_ioctl_info { unsigned int cmd; + unsigned short flags; long (*fn)(struct media_device *dev, void *arg); long (*arg_from_user)(void *karg, void __user *uarg, unsigned int cmd); long (*arg_to_user)(void __user *uarg, void *karg, unsigned int cmd); }; static const struct media_ioctl_info ioctl_info[] = { - MEDIA_IOC(DEVICE_INFO, media_device_get_info), - MEDIA_IOC(ENUM_ENTITIES, media_device_enum_entities), - MEDIA_IOC(ENUM_LINKS, media_device_enum_links), - MEDIA_IOC(SETUP_LINK, media_device_setup_link), - MEDIA_IOC(G_TOPOLOGY, media_device_get_topology), + MEDIA_IOC(DEVICE_INFO, media_device_get_info, MEDIA_IOC_FL_GRAPH_MUTEX), + MEDIA_IOC(ENUM_ENTITIES, media_device_enum_entities, MEDIA_IOC_FL_GRAPH_MUTEX), + MEDIA_IOC(ENUM_LINKS, media_device_enum_links, MEDIA_IOC_FL_GRAPH_MUTEX), + MEDIA_IOC(SETUP_LINK, media_device_setup_link, MEDIA_IOC_FL_GRAPH_MUTEX), + MEDIA_IOC(G_TOPOLOGY, media_device_get_topology, MEDIA_IOC_FL_GRAPH_MUTEX), }; static long media_device_ioctl(struct file *filp, unsigned int cmd, @@ -436,9 +441,13 @@ static long media_device_ioctl(struct file *filp, unsigned int cmd, goto out_free; } - mutex_lock(&dev->graph_mutex); + if (info->flags & MEDIA_IOC_FL_GRAPH_MUTEX) + mutex_lock(&dev->graph_mutex); + ret = info->fn(dev, karg); - mutex_unlock(&dev->graph_mutex); + + if (info->flags & MEDIA_IOC_FL_GRAPH_MUTEX) + mutex_unlock(&dev->graph_mutex); if (!ret && info->arg_to_user) ret = info->arg_to_user(arg, karg, cmd); From fcd09f6592cc1d55dea1571297ad88b9024de80c Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 8 Aug 2016 15:54:10 -0300 Subject: [PATCH 495/591] [media] cxd2820r: improve IF frequency setting Use 64-bit calculation. Return error if tuner does not provide get_if_frequency() callback. All currently used tuners has it. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2820r_c.c | 26 ++++++++-------- drivers/media/dvb-frontends/cxd2820r_priv.h | 2 ++ drivers/media/dvb-frontends/cxd2820r_t.c | 27 ++++++++--------- drivers/media/dvb-frontends/cxd2820r_t2.c | 33 ++++++++++----------- 4 files changed, 43 insertions(+), 45 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c index a674a6312c38..957ec94c7243 100644 --- a/drivers/media/dvb-frontends/cxd2820r_c.c +++ b/drivers/media/dvb-frontends/cxd2820r_c.c @@ -26,10 +26,9 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) struct cxd2820r_priv *priv = fe->demodulator_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret, i; + unsigned int utmp; u8 buf[2]; - u32 if_freq; - u16 if_ctl; - u64 num; + u32 if_frequency; struct reg_val_mask tab[] = { { 0x00080, 0x01, 0xff }, { 0x00081, 0x05, 0xff }, @@ -69,20 +68,19 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) /* program IF frequency */ if (fe->ops.tuner_ops.get_if_frequency) { - ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_freq); + ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); if (ret) goto error; - } else - if_freq = 0; - - dev_dbg(&priv->i2c->dev, "%s: if_freq=%d\n", __func__, if_freq); - - num = if_freq / 1000; /* Hz => kHz */ - num *= 0x4000; - if_ctl = 0x4000 - DIV_ROUND_CLOSEST_ULL(num, 41000); - buf[0] = (if_ctl >> 8) & 0x3f; - buf[1] = (if_ctl >> 0) & 0xff; + dev_dbg(&priv->i2c->dev, "%s: if_frequency=%u\n", __func__, + if_frequency); + } else { + ret = -EINVAL; + goto error; + } + utmp = 0x4000 - DIV_ROUND_CLOSEST_ULL((u64)if_frequency * 0x4000, CXD2820R_CLK); + buf[0] = (utmp >> 8) & 0xff; + buf[1] = (utmp >> 0) & 0xff; ret = cxd2820r_wr_regs(priv, 0x10042, buf, 2); if (ret) goto error; diff --git a/drivers/media/dvb-frontends/cxd2820r_priv.h b/drivers/media/dvb-frontends/cxd2820r_priv.h index e31c48e53097..acfae17991e3 100644 --- a/drivers/media/dvb-frontends/cxd2820r_priv.h +++ b/drivers/media/dvb-frontends/cxd2820r_priv.h @@ -34,6 +34,8 @@ struct reg_val_mask { u8 mask; }; +#define CXD2820R_CLK 41000000 + struct cxd2820r_priv { struct i2c_adapter *i2c; struct dvb_frontend fe; diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c index 75ce7d8ded00..67cc33bc3c35 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t.c +++ b/drivers/media/dvb-frontends/cxd2820r_t.c @@ -26,8 +26,8 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) struct cxd2820r_priv *priv = fe->demodulator_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret, i, bw_i; - u32 if_freq, if_ctl; - u64 num; + unsigned int utmp; + u32 if_frequency; u8 buf[3], bw_param; u8 bw_params1[][5] = { { 0x17, 0xea, 0xaa, 0xaa, 0xaa }, /* 6 MHz */ @@ -93,21 +93,20 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) /* program IF frequency */ if (fe->ops.tuner_ops.get_if_frequency) { - ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_freq); + ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); if (ret) goto error; - } else - if_freq = 0; - - dev_dbg(&priv->i2c->dev, "%s: if_freq=%d\n", __func__, if_freq); - - num = if_freq / 1000; /* Hz => kHz */ - num *= 0x1000000; - if_ctl = DIV_ROUND_CLOSEST_ULL(num, 41000); - buf[0] = ((if_ctl >> 16) & 0xff); - buf[1] = ((if_ctl >> 8) & 0xff); - buf[2] = ((if_ctl >> 0) & 0xff); + dev_dbg(&priv->i2c->dev, "%s: if_frequency=%u\n", __func__, + if_frequency); + } else { + ret = -EINVAL; + goto error; + } + utmp = DIV_ROUND_CLOSEST_ULL((u64)if_frequency * 0x1000000, CXD2820R_CLK); + buf[0] = (utmp >> 16) & 0xff; + buf[1] = (utmp >> 8) & 0xff; + buf[2] = (utmp >> 0) & 0xff; ret = cxd2820r_wr_regs(priv, 0x000b6, buf, 3); if (ret) goto error; diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c index 704475676234..14c9a26502ed 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t2.c +++ b/drivers/media/dvb-frontends/cxd2820r_t2.c @@ -26,8 +26,8 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct cxd2820r_priv *priv = fe->demodulator_priv; int ret, i, bw_i; - u32 if_freq, if_ctl; - u64 num; + unsigned int utmp; + u32 if_frequency; u8 buf[3], bw_param; u8 bw_params1[][5] = { { 0x1c, 0xb3, 0x33, 0x33, 0x33 }, /* 5 MHz */ @@ -110,20 +110,23 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) /* program IF frequency */ if (fe->ops.tuner_ops.get_if_frequency) { - ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_freq); + ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); if (ret) goto error; - } else - if_freq = 0; + dev_dbg(&priv->i2c->dev, "%s: if_frequency=%u\n", __func__, + if_frequency); + } else { + ret = -EINVAL; + goto error; + } - dev_dbg(&priv->i2c->dev, "%s: if_freq=%d\n", __func__, if_freq); - - num = if_freq / 1000; /* Hz => kHz */ - num *= 0x1000000; - if_ctl = DIV_ROUND_CLOSEST_ULL(num, 41000); - buf[0] = ((if_ctl >> 16) & 0xff); - buf[1] = ((if_ctl >> 8) & 0xff); - buf[2] = ((if_ctl >> 0) & 0xff); + utmp = DIV_ROUND_CLOSEST_ULL((u64)if_frequency * 0x1000000, CXD2820R_CLK); + buf[0] = (utmp >> 16) & 0xff; + buf[1] = (utmp >> 8) & 0xff; + buf[2] = (utmp >> 0) & 0xff; + ret = cxd2820r_wr_regs(priv, 0x020b6, buf, 3); + if (ret) + goto error; /* PLP filtering */ if (c->stream_id > 255) { @@ -142,10 +145,6 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) goto error; } - ret = cxd2820r_wr_regs(priv, 0x020b6, buf, 3); - if (ret) - goto error; - ret = cxd2820r_wr_regs(priv, 0x0209f, bw_params1[bw_i], 5); if (ret) goto error; From 2832fd3177d7d988348fc1bd8031daeea89396c9 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 8 Aug 2016 20:13:45 -0300 Subject: [PATCH 496/591] [media] cxd2820r: dvbv5 statistics for DVB-T Implement dvbv5 statistics for DVB-T. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2820r_priv.h | 2 + drivers/media/dvb-frontends/cxd2820r_t.c | 88 +++++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/drivers/media/dvb-frontends/cxd2820r_priv.h b/drivers/media/dvb-frontends/cxd2820r_priv.h index acfae17991e3..a97570b7fa1d 100644 --- a/drivers/media/dvb-frontends/cxd2820r_priv.h +++ b/drivers/media/dvb-frontends/cxd2820r_priv.h @@ -27,6 +27,7 @@ #include "dvb_math.h" #include "cxd2820r.h" #include +#include struct reg_val_mask { u32 reg; @@ -40,6 +41,7 @@ struct cxd2820r_priv { struct i2c_adapter *i2c; struct dvb_frontend fe; struct cxd2820r_config cfg; + u64 post_bit_error; bool ber_running; diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c index 67cc33bc3c35..d402ab68368b 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t.c +++ b/drivers/media/dvb-frontends/cxd2820r_t.c @@ -351,7 +351,9 @@ int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks) int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; + unsigned int utmp; u8 buf[4]; *status = 0; @@ -388,6 +390,92 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) dev_dbg(&priv->i2c->dev, "%s: lock=%*ph\n", __func__, 4, buf); + /* Signal strength */ + if (*status & FE_HAS_SIGNAL) { + unsigned int strength; + + ret = cxd2820r_rd_regs(priv, 0x00026, buf, 2); + if (ret) + goto error; + + utmp = buf[0] << 8 | buf[1] << 0; + utmp = ~utmp & 0x0fff; + /* Scale value to 0x0000-0xffff */ + strength = utmp << 4 | utmp >> 8; + + c->strength.len = 1; + c->strength.stat[0].scale = FE_SCALE_RELATIVE; + c->strength.stat[0].uvalue = strength; + } else { + c->strength.len = 1; + c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* CNR */ + if (*status & FE_HAS_VITERBI) { + unsigned int cnr; + + ret = cxd2820r_rd_regs(priv, 0x0002c, buf, 2); + if (ret) + goto error; + + utmp = buf[0] << 8 | buf[1] << 0; + if (utmp) + cnr = div_u64((u64)(intlog10(utmp) + - intlog10(32000 - utmp) + 55532585) + * 10000, (1 << 24)); + else + cnr = 0; + + c->cnr.len = 1; + c->cnr.stat[0].scale = FE_SCALE_DECIBEL; + c->cnr.stat[0].svalue = cnr; + } else { + c->cnr.len = 1; + c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* BER */ + if (*status & FE_HAS_SYNC) { + unsigned int post_bit_error; + bool start_ber; + + if (priv->ber_running) { + ret = cxd2820r_rd_regs(priv, 0x00076, buf, 3); + if (ret) + goto error; + + if ((buf[2] >> 7) & 0x01) { + post_bit_error = buf[2] << 16 | buf[1] << 8 | + buf[0] << 0; + post_bit_error &= 0x0fffff; + start_ber = true; + } else { + post_bit_error = 0; + start_ber = false; + } + } else { + post_bit_error = 0; + start_ber = true; + } + + if (start_ber) { + ret = cxd2820r_wr_reg(priv, 0x00079, 0x01); + if (ret) + goto error; + priv->ber_running = true; + } + + priv->post_bit_error += post_bit_error; + + c->post_bit_error.len = 1; + c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; + c->post_bit_error.stat[0].uvalue = priv->post_bit_error; + } else { + c->post_bit_error.len = 1; + c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + return ret; error: dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); From 91171fb63e1b09fea18465248a748c48b0d33451 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 8 Aug 2016 21:12:00 -0300 Subject: [PATCH 497/591] [media] cxd2820r: dvbv5 statistics for DVB-T2 Implement dvbv5 statistics for DVB-T2. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2820r_t2.c | 77 ++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c index 14c9a26502ed..e2875f2655bd 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t2.c +++ b/drivers/media/dvb-frontends/cxd2820r_t2.c @@ -286,8 +286,10 @@ error: int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - u8 buf[1]; + unsigned int utmp; + u8 buf[4]; *status = 0; ret = cxd2820r_rd_reg(priv, 0x02010 , &buf[0]); @@ -306,6 +308,79 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) dev_dbg(&priv->i2c->dev, "%s: lock=%02x\n", __func__, buf[0]); + /* Signal strength */ + if (*status & FE_HAS_SIGNAL) { + unsigned int strength; + + ret = cxd2820r_rd_regs(priv, 0x02026, buf, 2); + if (ret) + goto error; + + utmp = buf[0] << 8 | buf[1] << 0; + utmp = ~utmp & 0x0fff; + /* Scale value to 0x0000-0xffff */ + strength = utmp << 4 | utmp >> 8; + + c->strength.len = 1; + c->strength.stat[0].scale = FE_SCALE_RELATIVE; + c->strength.stat[0].uvalue = strength; + } else { + c->strength.len = 1; + c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* CNR */ + if (*status & FE_HAS_VITERBI) { + unsigned int cnr; + + ret = cxd2820r_rd_regs(priv, 0x02028, buf, 2); + if (ret) + goto error; + + utmp = buf[0] << 8 | buf[1] << 0; + utmp = utmp & 0x0fff; + #define CXD2820R_LOG10_8_24 15151336 /* log10(8) << 24 */ + if (utmp) + cnr = div_u64((u64)(intlog10(utmp) + - CXD2820R_LOG10_8_24) * 10000, + (1 << 24)); + else + cnr = 0; + + c->cnr.len = 1; + c->cnr.stat[0].scale = FE_SCALE_DECIBEL; + c->cnr.stat[0].svalue = cnr; + } else { + c->cnr.len = 1; + c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* BER */ + if (*status & FE_HAS_SYNC) { + unsigned int post_bit_error; + + ret = cxd2820r_rd_regs(priv, 0x02039, buf, 4); + if (ret) + goto error; + + if ((buf[0] >> 4) & 0x01) { + post_bit_error = buf[0] << 24 | buf[1] << 16 | + buf[2] << 8 | buf[3] << 0; + post_bit_error &= 0x0fffffff; + } else { + post_bit_error = 0; + } + + priv->post_bit_error += post_bit_error; + + c->post_bit_error.len = 1; + c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; + c->post_bit_error.stat[0].uvalue = priv->post_bit_error; + } else { + c->post_bit_error.len = 1; + c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + return ret; error: dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); From 90d5d2e3f047164748e67ae7cf4d5a7bb6a8d0b3 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 8 Aug 2016 23:03:32 -0300 Subject: [PATCH 498/591] [media] cxd2820r: dvbv5 statistics for DVB-C Implement dvbv5 statistics for DVB-C. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2820r_c.c | 104 ++++++++++++++++++++++- 1 file changed, 102 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c index 957ec94c7243..7cdcd5535d06 100644 --- a/drivers/media/dvb-frontends/cxd2820r_c.c +++ b/drivers/media/dvb-frontends/cxd2820r_c.c @@ -260,11 +260,13 @@ int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks) int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - u8 buf[2]; + unsigned int utmp; + u8 buf[3]; *status = 0; - ret = cxd2820r_rd_regs(priv, 0x10088, buf, sizeof(buf)); + ret = cxd2820r_rd_regs(priv, 0x10088, buf, 2); if (ret) goto error; @@ -281,6 +283,104 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) dev_dbg(&priv->i2c->dev, "%s: lock=%02x %02x\n", __func__, buf[0], buf[1]); + /* Signal strength */ + if (*status & FE_HAS_SIGNAL) { + unsigned int strength; + + ret = cxd2820r_rd_regs(priv, 0x10049, buf, 2); + if (ret) + goto error; + + utmp = buf[0] << 8 | buf[1] << 0; + utmp = 511 - sign_extend32(utmp, 9); + /* Scale value to 0x0000-0xffff */ + strength = utmp << 6 | utmp >> 4; + + c->strength.len = 1; + c->strength.stat[0].scale = FE_SCALE_RELATIVE; + c->strength.stat[0].uvalue = strength; + } else { + c->strength.len = 1; + c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* CNR */ + if (*status & FE_HAS_VITERBI) { + unsigned int cnr, const_a, const_b; + + ret = cxd2820r_rd_reg(priv, 0x10019, &buf[0]); + if (ret) + goto error; + + if (((buf[0] >> 0) & 0x03) % 2) { + const_a = 8750; + const_b = 650; + } else { + const_a = 9500; + const_b = 760; + } + + ret = cxd2820r_rd_reg(priv, 0x1004d, &buf[0]); + if (ret) + goto error; + + utmp = buf[0] << 0; + #define CXD2820R_LOG2_E_24 24204406 /* log2(e) << 24 */ + if (utmp) + cnr = div_u64((u64)(intlog2(const_b) - intlog2(utmp)) + * const_a, CXD2820R_LOG2_E_24); + else + cnr = 0; + + c->cnr.len = 1; + c->cnr.stat[0].scale = FE_SCALE_DECIBEL; + c->cnr.stat[0].svalue = cnr; + } else { + c->cnr.len = 1; + c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* BER */ + if (*status & FE_HAS_SYNC) { + unsigned int post_bit_error; + bool start_ber; + + if (priv->ber_running) { + ret = cxd2820r_rd_regs(priv, 0x10076, buf, 3); + if (ret) + goto error; + + if ((buf[2] >> 7) & 0x01) { + post_bit_error = buf[2] << 16 | buf[1] << 8 | + buf[0] << 0; + post_bit_error &= 0x0fffff; + start_ber = true; + } else { + post_bit_error = 0; + start_ber = false; + } + } else { + post_bit_error = 0; + start_ber = true; + } + + if (start_ber) { + ret = cxd2820r_wr_reg(priv, 0x10079, 0x01); + if (ret) + goto error; + priv->ber_running = true; + } + + priv->post_bit_error += post_bit_error; + + c->post_bit_error.len = 1; + c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; + c->post_bit_error.stat[0].uvalue = priv->post_bit_error; + } else { + c->post_bit_error.len = 1; + c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + return ret; error: dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); From 4aa4fd86bca5769c9884838501454ef4c486936d Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Tue, 9 Aug 2016 14:58:21 -0300 Subject: [PATCH 499/591] [media] cxd2820r: wrap legacy DVBv3 statistics via DVBv5 statistics Return DVBv5 statistics via legacy DVBv3 API. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2820r_c.c | 108 -------------------- drivers/media/dvb-frontends/cxd2820r_core.c | 85 ++++----------- drivers/media/dvb-frontends/cxd2820r_priv.h | 25 +---- drivers/media/dvb-frontends/cxd2820r_t.c | 94 ----------------- drivers/media/dvb-frontends/cxd2820r_t2.c | 87 ---------------- 5 files changed, 22 insertions(+), 377 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c index 7cdcd5535d06..82df94413aeb 100644 --- a/drivers/media/dvb-frontends/cxd2820r_c.c +++ b/drivers/media/dvb-frontends/cxd2820r_c.c @@ -149,114 +149,6 @@ error: return ret; } -int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 buf[3], start_ber = 0; - *ber = 0; - - if (priv->ber_running) { - ret = cxd2820r_rd_regs(priv, 0x10076, buf, sizeof(buf)); - if (ret) - goto error; - - if ((buf[2] >> 7) & 0x01 || (buf[2] >> 4) & 0x01) { - *ber = (buf[2] & 0x0f) << 16 | buf[1] << 8 | buf[0]; - start_ber = 1; - } - } else { - priv->ber_running = true; - start_ber = 1; - } - - if (start_ber) { - /* (re)start BER */ - ret = cxd2820r_wr_reg(priv, 0x10079, 0x01); - if (ret) - goto error; - } - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, - u16 *strength) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 buf[2]; - u16 tmp; - - ret = cxd2820r_rd_regs(priv, 0x10049, buf, sizeof(buf)); - if (ret) - goto error; - - tmp = (buf[0] & 0x03) << 8 | buf[1]; - tmp = (~tmp & 0x03ff); - - if (tmp == 512) - /* ~no signal */ - tmp = 0; - else if (tmp > 350) - tmp = 350; - - /* scale value to 0x0000-0xffff */ - *strength = tmp * 0xffff / (350-0); - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 tmp; - unsigned int A, B; - /* report SNR in dB * 10 */ - - ret = cxd2820r_rd_reg(priv, 0x10019, &tmp); - if (ret) - goto error; - - if (((tmp >> 0) & 0x03) % 2) { - A = 875; - B = 650; - } else { - A = 950; - B = 760; - } - - ret = cxd2820r_rd_reg(priv, 0x1004d, &tmp); - if (ret) - goto error; - - #define CXD2820R_LOG2_E_24 24204406 /* log2(e) << 24 */ - if (tmp) - *snr = A * (intlog2(B / tmp) >> 5) / (CXD2820R_LOG2_E_24 >> 5) - / 10; - else - *snr = 0; - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks) -{ - *ucblocks = 0; - /* no way to read ? */ - return 0; -} - int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c index 314d3b8c1080..66da8212cb60 100644 --- a/drivers/media/dvb-frontends/cxd2820r_core.c +++ b/drivers/media/dvb-frontends/cxd2820r_core.c @@ -345,101 +345,58 @@ static int cxd2820r_get_frontend(struct dvb_frontend *fe, static int cxd2820r_read_ber(struct dvb_frontend *fe, u32 *ber) { struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, fe->dtv_property_cache.delivery_system); - switch (fe->dtv_property_cache.delivery_system) { - case SYS_DVBT: - ret = cxd2820r_read_ber_t(fe, ber); - break; - case SYS_DVBT2: - ret = cxd2820r_read_ber_t2(fe, ber); - break; - case SYS_DVBC_ANNEX_A: - ret = cxd2820r_read_ber_c(fe, ber); - break; - default: - ret = -EINVAL; - break; - } - return ret; + *ber = (priv->post_bit_error - priv->post_bit_error_prev_dvbv3); + priv->post_bit_error_prev_dvbv3 = priv->post_bit_error; + + return 0; } static int cxd2820r_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, fe->dtv_property_cache.delivery_system); - switch (fe->dtv_property_cache.delivery_system) { - case SYS_DVBT: - ret = cxd2820r_read_signal_strength_t(fe, strength); - break; - case SYS_DVBT2: - ret = cxd2820r_read_signal_strength_t2(fe, strength); - break; - case SYS_DVBC_ANNEX_A: - ret = cxd2820r_read_signal_strength_c(fe, strength); - break; - default: - ret = -EINVAL; - break; - } - return ret; + if (c->strength.stat[0].scale == FE_SCALE_RELATIVE) + *strength = c->strength.stat[0].uvalue; + else + *strength = 0; + + return 0; } static int cxd2820r_read_snr(struct dvb_frontend *fe, u16 *snr) { struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, fe->dtv_property_cache.delivery_system); - switch (fe->dtv_property_cache.delivery_system) { - case SYS_DVBT: - ret = cxd2820r_read_snr_t(fe, snr); - break; - case SYS_DVBT2: - ret = cxd2820r_read_snr_t2(fe, snr); - break; - case SYS_DVBC_ANNEX_A: - ret = cxd2820r_read_snr_c(fe, snr); - break; - default: - ret = -EINVAL; - break; - } - return ret; + if (c->cnr.stat[0].scale == FE_SCALE_DECIBEL) + *snr = div_s64(c->cnr.stat[0].svalue, 100); + else + *snr = 0; + + return 0; } static int cxd2820r_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, fe->dtv_property_cache.delivery_system); - switch (fe->dtv_property_cache.delivery_system) { - case SYS_DVBT: - ret = cxd2820r_read_ucblocks_t(fe, ucblocks); - break; - case SYS_DVBT2: - ret = cxd2820r_read_ucblocks_t2(fe, ucblocks); - break; - case SYS_DVBC_ANNEX_A: - ret = cxd2820r_read_ucblocks_c(fe, ucblocks); - break; - default: - ret = -EINVAL; - break; - } - return ret; + *ucblocks = 0; + + return 0; } static int cxd2820r_init(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/cxd2820r_priv.h b/drivers/media/dvb-frontends/cxd2820r_priv.h index a97570b7fa1d..66b19dd1f186 100644 --- a/drivers/media/dvb-frontends/cxd2820r_priv.h +++ b/drivers/media/dvb-frontends/cxd2820r_priv.h @@ -41,6 +41,7 @@ struct cxd2820r_priv { struct i2c_adapter *i2c; struct dvb_frontend fe; struct cxd2820r_config cfg; + u64 post_bit_error_prev_dvbv3; u64 post_bit_error; bool ber_running; @@ -87,14 +88,6 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe); int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status); -int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber); - -int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, u16 *strength); - -int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr); - -int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks); - int cxd2820r_init_c(struct dvb_frontend *fe); int cxd2820r_sleep_c(struct dvb_frontend *fe); @@ -111,14 +104,6 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe); int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status); -int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber); - -int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, u16 *strength); - -int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr); - -int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks); - int cxd2820r_init_t(struct dvb_frontend *fe); int cxd2820r_sleep_t(struct dvb_frontend *fe); @@ -135,14 +120,6 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe); int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status); -int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber); - -int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, u16 *strength); - -int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr); - -int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks); - int cxd2820r_init_t2(struct dvb_frontend *fe); int cxd2820r_sleep_t2(struct dvb_frontend *fe); diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c index d402ab68368b..ddd8e46511a9 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t.c +++ b/drivers/media/dvb-frontends/cxd2820r_t.c @@ -254,100 +254,6 @@ error: return ret; } -int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 buf[3], start_ber = 0; - *ber = 0; - - if (priv->ber_running) { - ret = cxd2820r_rd_regs(priv, 0x00076, buf, sizeof(buf)); - if (ret) - goto error; - - if ((buf[2] >> 7) & 0x01 || (buf[2] >> 4) & 0x01) { - *ber = (buf[2] & 0x0f) << 16 | buf[1] << 8 | buf[0]; - start_ber = 1; - } - } else { - priv->ber_running = true; - start_ber = 1; - } - - if (start_ber) { - /* (re)start BER */ - ret = cxd2820r_wr_reg(priv, 0x00079, 0x01); - if (ret) - goto error; - } - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, - u16 *strength) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 buf[2]; - u16 tmp; - - ret = cxd2820r_rd_regs(priv, 0x00026, buf, sizeof(buf)); - if (ret) - goto error; - - tmp = (buf[0] & 0x0f) << 8 | buf[1]; - tmp = ~tmp & 0x0fff; - - /* scale value to 0x0000-0xffff from 0x0000-0x0fff */ - *strength = tmp * 0xffff / 0x0fff; - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 buf[2]; - u16 tmp; - /* report SNR in dB * 10 */ - - ret = cxd2820r_rd_regs(priv, 0x00028, buf, sizeof(buf)); - if (ret) - goto error; - - tmp = (buf[0] & 0x1f) << 8 | buf[1]; - #define CXD2820R_LOG10_8_24 15151336 /* log10(8) << 24 */ - if (tmp) - *snr = (intlog10(tmp) - CXD2820R_LOG10_8_24) / ((1 << 24) - / 100); - else - *snr = 0; - - dev_dbg(&priv->i2c->dev, "%s: dBx10=%d val=%04x\n", __func__, *snr, - tmp); - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks) -{ - *ucblocks = 0; - /* no way to read ? */ - return 0; -} - int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c index e2875f2655bd..e09f1527ef0c 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t2.c +++ b/drivers/media/dvb-frontends/cxd2820r_t2.c @@ -387,93 +387,6 @@ error: return ret; } -int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 buf[4]; - unsigned int errbits; - *ber = 0; - /* FIXME: correct calculation */ - - ret = cxd2820r_rd_regs(priv, 0x02039, buf, sizeof(buf)); - if (ret) - goto error; - - if ((buf[0] >> 4) & 0x01) { - errbits = (buf[0] & 0x0f) << 24 | buf[1] << 16 | - buf[2] << 8 | buf[3]; - - if (errbits) - *ber = errbits * 64 / 16588800; - } - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, - u16 *strength) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 buf[2]; - u16 tmp; - - ret = cxd2820r_rd_regs(priv, 0x02026, buf, sizeof(buf)); - if (ret) - goto error; - - tmp = (buf[0] & 0x0f) << 8 | buf[1]; - tmp = ~tmp & 0x0fff; - - /* scale value to 0x0000-0xffff from 0x0000-0x0fff */ - *strength = tmp * 0xffff / 0x0fff; - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr) -{ - struct cxd2820r_priv *priv = fe->demodulator_priv; - int ret; - u8 buf[2]; - u16 tmp; - /* report SNR in dB * 10 */ - - ret = cxd2820r_rd_regs(priv, 0x02028, buf, sizeof(buf)); - if (ret) - goto error; - - tmp = (buf[0] & 0x0f) << 8 | buf[1]; - #define CXD2820R_LOG10_8_24 15151336 /* log10(8) << 24 */ - if (tmp) - *snr = (intlog10(tmp) - CXD2820R_LOG10_8_24) / ((1 << 24) - / 100); - else - *snr = 0; - - dev_dbg(&priv->i2c->dev, "%s: dBx10=%d val=%04x\n", __func__, *snr, - tmp); - - return ret; -error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); - return ret; -} - -int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks) -{ - *ucblocks = 0; - /* no way to read ? */ - return 0; -} - int cxd2820r_sleep_t2(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; From 07fdf7d9f19fb601a0cc75c47ecd55aa26019eed Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Tue, 9 Aug 2016 20:49:09 -0300 Subject: [PATCH 500/591] [media] cxd2820r: add I2C driver bindings Add I2C driver bindings in order to support proper I2C driver registration with driver core. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2820r.h | 26 +++ drivers/media/dvb-frontends/cxd2820r_c.c | 6 +- drivers/media/dvb-frontends/cxd2820r_core.c | 192 +++++++++++++++----- drivers/media/dvb-frontends/cxd2820r_priv.h | 7 +- drivers/media/dvb-frontends/cxd2820r_t.c | 6 +- drivers/media/dvb-frontends/cxd2820r_t2.c | 8 +- 6 files changed, 192 insertions(+), 53 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2820r.h b/drivers/media/dvb-frontends/cxd2820r.h index 56d42760263d..d77afe0b8a9e 100644 --- a/drivers/media/dvb-frontends/cxd2820r.h +++ b/drivers/media/dvb-frontends/cxd2820r.h @@ -37,6 +37,32 @@ #define CXD2820R_TS_PARALLEL 0x30 #define CXD2820R_TS_PARALLEL_MSB 0x70 +/* + * I2C address: 0x6c, 0x6d + */ + +/** + * struct cxd2820r_platform_data - Platform data for the cxd2820r driver + * @ts_mode: TS mode. + * @ts_clk_inv: TS clock inverted. + * @if_agc_polarity: IF AGC polarity. + * @spec_inv: Input spectrum inverted. + * @gpio_chip_base: GPIO. + * @get_dvb_frontend: Get DVB frontend. + */ + +struct cxd2820r_platform_data { + u8 ts_mode; + bool ts_clk_inv; + bool if_agc_polarity; + bool spec_inv; + int **gpio_chip_base; + + struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *); +/* private: For legacy media attach wrapper. Do not set value. */ + bool attach_in_use; +}; + struct cxd2820r_config { /* Demodulator I2C address. * Driver determines DVB-C slave I2C address automatically from master diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c index 82df94413aeb..0d036e1a43e2 100644 --- a/drivers/media/dvb-frontends/cxd2820r_c.c +++ b/drivers/media/dvb-frontends/cxd2820r_c.c @@ -42,9 +42,9 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) { 0x10059, 0x50, 0xff }, { 0x10087, 0x0c, 0x3c }, { 0x1008b, 0x07, 0xff }, - { 0x1001f, priv->cfg.if_agc_polarity << 7, 0x80 }, - { 0x10070, priv->cfg.ts_mode, 0xff }, - { 0x10071, !priv->cfg.ts_clock_inv << 4, 0x10 }, + { 0x1001f, priv->if_agc_polarity << 7, 0x80 }, + { 0x10070, priv->ts_mode, 0xff }, + { 0x10071, !priv->ts_clk_inv << 4, 0x10 }, }; dev_dbg(&priv->i2c->dev, "%s: frequency=%d symbol_rate=%d\n", __func__, diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c index 66da8212cb60..cf5eed477c44 100644 --- a/drivers/media/dvb-frontends/cxd2820r_core.c +++ b/drivers/media/dvb-frontends/cxd2820r_core.c @@ -49,7 +49,7 @@ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, buf[0] = reg; memcpy(&buf[1], val, len); - ret = i2c_transfer(priv->i2c, msg, 1); + ret = i2c_transfer(priv->client[0]->adapter, msg, 1); if (ret == 1) { ret = 0; } else { @@ -87,7 +87,7 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, return -EINVAL; } - ret = i2c_transfer(priv->i2c, msg, 2); + ret = i2c_transfer(priv->client[0]->adapter, msg, 2); if (ret == 2) { memcpy(val, buf, len); ret = 0; @@ -112,9 +112,9 @@ int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, /* select I2C */ if (i2c) - i2c_addr = priv->cfg.i2c_address | (1 << 1); /* DVB-C */ + i2c_addr = priv->client[1]->addr; /* DVB-C */ else - i2c_addr = priv->cfg.i2c_address; /* DVB-T/T2 */ + i2c_addr = priv->client[0]->addr; /* DVB-T/T2 */ /* switch bank if needed */ if (bank != priv->bank[i2c]) { @@ -138,9 +138,9 @@ int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, /* select I2C */ if (i2c) - i2c_addr = priv->cfg.i2c_address | (1 << 1); /* DVB-C */ + i2c_addr = priv->client[1]->addr; /* DVB-C */ else - i2c_addr = priv->cfg.i2c_address; /* DVB-T/T2 */ + i2c_addr = priv->client[0]->addr; /* DVB-T/T2 */ /* switch bank if needed */ if (bank != priv->bank[i2c]) { @@ -537,16 +537,12 @@ static int cxd2820r_get_frontend_algo(struct dvb_frontend *fe) static void cxd2820r_release(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; dev_dbg(&priv->i2c->dev, "%s\n", __func__); -#ifdef CONFIG_GPIOLIB - /* remove GPIOs */ - if (priv->gpio_chip.label) - gpiochip_remove(&priv->gpio_chip); + i2c_unregister_device(client); -#endif - kfree(priv); return; } @@ -646,49 +642,113 @@ static const struct dvb_frontend_ops cxd2820r_ops = { .read_signal_strength = cxd2820r_read_signal_strength, }; -struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *cfg, - struct i2c_adapter *i2c, int *gpio_chip_base -) +/* + * XXX: That is wrapper to cxd2820r_probe() via driver core in order to provide + * proper I2C client for legacy media attach binding. + * New users must use I2C client binding directly! + */ +struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *config, + struct i2c_adapter *adapter, + int *gpio_chip_base) { - struct cxd2820r_priv *priv; - int ret; - u8 tmp; + struct i2c_client *client; + struct i2c_board_info board_info; + struct cxd2820r_platform_data pdata; - priv = kzalloc(sizeof(struct cxd2820r_priv), GFP_KERNEL); + pdata.ts_mode = config->ts_mode; + pdata.ts_clk_inv = config->ts_clock_inv; + pdata.if_agc_polarity = config->if_agc_polarity; + pdata.spec_inv = config->spec_inv; + pdata.gpio_chip_base = &gpio_chip_base; + pdata.attach_in_use = true; + + memset(&board_info, 0, sizeof(board_info)); + strlcpy(board_info.type, "cxd2820r", I2C_NAME_SIZE); + board_info.addr = config->i2c_address; + board_info.platform_data = &pdata; + client = i2c_new_device(adapter, &board_info); + if (!client || !client->dev.driver) + return NULL; + + return pdata.get_dvb_frontend(client); +} +EXPORT_SYMBOL(cxd2820r_attach); + +static struct dvb_frontend *cxd2820r_get_dvb_frontend(struct i2c_client *client) +{ + struct cxd2820r_priv *priv = i2c_get_clientdata(client); + + dev_dbg(&client->dev, "\n"); + + return &priv->fe; +} + +static int cxd2820r_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct cxd2820r_platform_data *pdata = client->dev.platform_data; + struct cxd2820r_priv *priv; + int ret, *gpio_chip_base; + u8 u8tmp; + + dev_dbg(&client->dev, "\n"); + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) { ret = -ENOMEM; - dev_err(&i2c->dev, "%s: kzalloc() failed\n", - KBUILD_MODNAME); - goto error; + goto err; } - priv->i2c = i2c; - memcpy(&priv->cfg, cfg, sizeof(struct cxd2820r_config)); - memcpy(&priv->fe.ops, &cxd2820r_ops, sizeof(struct dvb_frontend_ops)); - priv->fe.demodulator_priv = priv; + priv->client[0] = client; + priv->i2c = client->adapter; + priv->ts_mode = pdata->ts_mode; + priv->ts_clk_inv = pdata->ts_clk_inv; + priv->if_agc_polarity = pdata->if_agc_polarity; + priv->spec_inv = pdata->spec_inv; + priv->bank[0] = 0xff; + priv->bank[1] = 0xff; + gpio_chip_base = *pdata->gpio_chip_base; - priv->bank[0] = priv->bank[1] = 0xff; - ret = cxd2820r_rd_reg(priv, 0x000fd, &tmp); - dev_dbg(&priv->i2c->dev, "%s: chip id=%02x\n", __func__, tmp); - if (ret || tmp != 0xe1) - goto error; + /* Check demod answers with correct chip id */ + ret = cxd2820r_rd_reg(priv, 0x000fd, &u8tmp); + if (ret) + goto err_kfree; + + dev_dbg(&client->dev, "chip_id=%02x\n", u8tmp); + + if (u8tmp != 0xe1) { + ret = -ENODEV; + goto err_kfree; + } + + /* + * Chip has two I2C addresses for different register banks. We register + * one dummy I2C client in in order to get own I2C client for each + * register bank. + */ + priv->client[1] = i2c_new_dummy(client->adapter, client->addr | (1 << 1)); + if (!priv->client[1]) { + ret = -ENODEV; + dev_err(&client->dev, "I2C registration failed\n"); + if (ret) + goto err_kfree; + } if (gpio_chip_base) { #ifdef CONFIG_GPIOLIB - /* add GPIOs */ + /* Add GPIOs */ priv->gpio_chip.label = KBUILD_MODNAME; priv->gpio_chip.parent = &priv->i2c->dev; priv->gpio_chip.owner = THIS_MODULE; - priv->gpio_chip.direction_output = - cxd2820r_gpio_direction_output; + priv->gpio_chip.direction_output = cxd2820r_gpio_direction_output; priv->gpio_chip.set = cxd2820r_gpio_set; priv->gpio_chip.get = cxd2820r_gpio_get; - priv->gpio_chip.base = -1; /* dynamic allocation */ + priv->gpio_chip.base = -1; /* Dynamic allocation */ priv->gpio_chip.ngpio = GPIO_COUNT; priv->gpio_chip.can_sleep = 1; ret = gpiochip_add_data(&priv->gpio_chip, priv); if (ret) - goto error; + goto err_client_1_i2c_unregister_device; dev_dbg(&priv->i2c->dev, "%s: gpio_chip.base=%d\n", __func__, priv->gpio_chip.base); @@ -705,17 +765,65 @@ struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *cfg, gpio[2] = 0; ret = cxd2820r_gpio(&priv->fe, gpio); if (ret) - goto error; + goto err_client_1_i2c_unregister_device; #endif } - return &priv->fe; -error: - dev_dbg(&i2c->dev, "%s: failed=%d\n", __func__, ret); + /* Create dvb frontend */ + memcpy(&priv->fe.ops, &cxd2820r_ops, sizeof(priv->fe.ops)); + if (!pdata->attach_in_use) + priv->fe.ops.release = NULL; + priv->fe.demodulator_priv = priv; + i2c_set_clientdata(client, priv); + + /* Setup callbacks */ + pdata->get_dvb_frontend = cxd2820r_get_dvb_frontend; + + dev_info(&client->dev, "Sony CXD2820R successfully identified\n"); + + return 0; +err_client_1_i2c_unregister_device: + i2c_unregister_device(priv->client[1]); +err_kfree: kfree(priv); - return NULL; +err: + dev_dbg(&client->dev, "failed=%d\n", ret); + return ret; } -EXPORT_SYMBOL(cxd2820r_attach); + +static int cxd2820r_remove(struct i2c_client *client) +{ + struct cxd2820r_priv *priv = i2c_get_clientdata(client); + + dev_dbg(&client->dev, "\n"); + +#ifdef CONFIG_GPIOLIB + if (priv->gpio_chip.label) + gpiochip_remove(&priv->gpio_chip); +#endif + i2c_unregister_device(priv->client[1]); + kfree(priv); + + return 0; +} + +static const struct i2c_device_id cxd2820r_id_table[] = { + {"cxd2820r", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, cxd2820r_id_table); + +static struct i2c_driver cxd2820r_driver = { + .driver = { + .name = "cxd2820r", + .suppress_bind_attrs = true, + }, + .probe = cxd2820r_probe, + .remove = cxd2820r_remove, + .id_table = cxd2820r_id_table, +}; + +module_i2c_driver(cxd2820r_driver); MODULE_AUTHOR("Antti Palosaari "); MODULE_DESCRIPTION("Sony CXD2820R demodulator driver"); diff --git a/drivers/media/dvb-frontends/cxd2820r_priv.h b/drivers/media/dvb-frontends/cxd2820r_priv.h index 66b19dd1f186..f711fbd6e7e7 100644 --- a/drivers/media/dvb-frontends/cxd2820r_priv.h +++ b/drivers/media/dvb-frontends/cxd2820r_priv.h @@ -38,9 +38,14 @@ struct reg_val_mask { #define CXD2820R_CLK 41000000 struct cxd2820r_priv { + struct i2c_client *client[2]; struct i2c_adapter *i2c; struct dvb_frontend fe; - struct cxd2820r_config cfg; + u8 ts_mode; + bool ts_clk_inv; + bool if_agc_polarity; + bool spec_inv; + u64 post_bit_error_prev_dvbv3; u64 post_bit_error; diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c index ddd8e46511a9..e328fe2f7bf9 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t.c +++ b/drivers/media/dvb-frontends/cxd2820r_t.c @@ -45,9 +45,9 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) { 0x00085, 0x07, 0xff }, { 0x00088, 0x01, 0xff }, - { 0x00070, priv->cfg.ts_mode, 0xff }, - { 0x00071, !priv->cfg.ts_clock_inv << 4, 0x10 }, - { 0x000cb, priv->cfg.if_agc_polarity << 6, 0x40 }, + { 0x00070, priv->ts_mode, 0xff }, + { 0x00071, !priv->ts_clk_inv << 4, 0x10 }, + { 0x000cb, priv->if_agc_polarity << 6, 0x40 }, { 0x000a5, 0x00, 0x01 }, { 0x00082, 0x20, 0x60 }, { 0x000c2, 0xc3, 0xff }, diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c index e09f1527ef0c..3a2c198153a3 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t2.c +++ b/drivers/media/dvb-frontends/cxd2820r_t2.c @@ -45,10 +45,10 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) { 0x0207f, 0x2a, 0xff }, { 0x02082, 0x0a, 0xff }, { 0x02083, 0x0a, 0xff }, - { 0x020cb, priv->cfg.if_agc_polarity << 6, 0x40 }, - { 0x02070, priv->cfg.ts_mode, 0xff }, - { 0x02071, !priv->cfg.ts_clock_inv << 6, 0x40 }, - { 0x020b5, priv->cfg.spec_inv << 4, 0x10 }, + { 0x020cb, priv->if_agc_polarity << 6, 0x40 }, + { 0x02070, priv->ts_mode, 0xff }, + { 0x02071, !priv->ts_clk_inv << 6, 0x40 }, + { 0x020b5, priv->spec_inv << 4, 0x10 }, { 0x02567, 0x07, 0x0f }, { 0x02569, 0x03, 0x03 }, { 0x02595, 0x1a, 0xff }, From c98975f92c1d488b273f10edfc6c48bab1c6e046 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Tue, 9 Aug 2016 22:00:37 -0300 Subject: [PATCH 501/591] [media] cxd2820r: correct logging Use correct device for logging functions as we now have it due to proper I2C client bindings. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2820r_c.c | 33 ++++-- drivers/media/dvb-frontends/cxd2820r_core.c | 115 +++++++++++--------- drivers/media/dvb-frontends/cxd2820r_t.c | 32 ++++-- drivers/media/dvb-frontends/cxd2820r_t2.c | 34 +++--- 4 files changed, 123 insertions(+), 91 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c index 0d036e1a43e2..beb46a620160 100644 --- a/drivers/media/dvb-frontends/cxd2820r_c.c +++ b/drivers/media/dvb-frontends/cxd2820r_c.c @@ -24,6 +24,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret, i; unsigned int utmp; @@ -47,8 +48,10 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) { 0x10071, !priv->ts_clk_inv << 4, 0x10 }, }; - dev_dbg(&priv->i2c->dev, "%s: frequency=%d symbol_rate=%d\n", __func__, - c->frequency, c->symbol_rate); + dev_dbg(&client->dev, + "delivery_system=%d modulation=%d frequency=%u symbol_rate=%u inversion=%d\n", + c->delivery_system, c->modulation, c->frequency, + c->symbol_rate, c->inversion); /* program tuner */ if (fe->ops.tuner_ops.set_params) @@ -71,8 +74,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); if (ret) goto error; - dev_dbg(&priv->i2c->dev, "%s: if_frequency=%u\n", __func__, - if_frequency); + dev_dbg(&client->dev, "if_frequency=%u\n", if_frequency); } else { ret = -EINVAL; goto error; @@ -95,7 +97,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } @@ -103,9 +105,12 @@ int cxd2820r_get_frontend_c(struct dvb_frontend *fe, struct dtv_frontend_properties *c) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; int ret; u8 buf[2]; + dev_dbg(&client->dev, "\n"); + ret = cxd2820r_rd_regs(priv, 0x1001a, buf, 2); if (ret) goto error; @@ -145,13 +150,14 @@ int cxd2820r_get_frontend_c(struct dvb_frontend *fe, return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; unsigned int utmp; @@ -172,8 +178,7 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) } } - dev_dbg(&priv->i2c->dev, "%s: lock=%02x %02x\n", __func__, buf[0], - buf[1]); + dev_dbg(&client->dev, "lock=%*ph\n", 2, buf); /* Signal strength */ if (*status & FE_HAS_SIGNAL) { @@ -275,28 +280,32 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } int cxd2820r_init_c(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; int ret; + dev_dbg(&client->dev, "\n"); + ret = cxd2820r_wr_reg(priv, 0x00085, 0x07); if (ret) goto error; return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } int cxd2820r_sleep_c(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; int ret, i; struct reg_val_mask tab[] = { { 0x000ff, 0x1f, 0xff }, @@ -306,7 +315,7 @@ int cxd2820r_sleep_c(struct dvb_frontend *fe) { 0x00080, 0x00, 0xff }, }; - dev_dbg(&priv->i2c->dev, "%s\n", __func__); + dev_dbg(&client->dev, "\n"); priv->delivery_system = SYS_UNDEFINED; @@ -319,7 +328,7 @@ int cxd2820r_sleep_c(struct dvb_frontend *fe) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c index cf5eed477c44..e222217458ca 100644 --- a/drivers/media/dvb-frontends/cxd2820r_core.c +++ b/drivers/media/dvb-frontends/cxd2820r_core.c @@ -28,6 +28,7 @@ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, u8 *val, int len) { + struct i2c_client *client = priv->client[0]; int ret; u8 buf[MAX_XFER_SIZE]; struct i2c_msg msg[1] = { @@ -40,9 +41,8 @@ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, }; if (1 + len > sizeof(buf)) { - dev_warn(&priv->i2c->dev, - "%s: i2c wr reg=%04x: len=%d is too big!\n", - KBUILD_MODNAME, reg, len); + dev_warn(&client->dev, "i2c wr reg=%04x: len=%d is too big!\n", + reg, len); return -EINVAL; } @@ -53,8 +53,8 @@ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, if (ret == 1) { ret = 0; } else { - dev_warn(&priv->i2c->dev, "%s: i2c wr failed=%d reg=%02x " \ - "len=%d\n", KBUILD_MODNAME, ret, reg, len); + dev_warn(&client->dev, "i2c wr failed=%d reg=%02x len=%d\n", + ret, reg, len); ret = -EREMOTEIO; } return ret; @@ -64,6 +64,7 @@ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, u8 *val, int len) { + struct i2c_client *client = priv->client[0]; int ret; u8 buf[MAX_XFER_SIZE]; struct i2c_msg msg[2] = { @@ -81,9 +82,8 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, }; if (len > sizeof(buf)) { - dev_warn(&priv->i2c->dev, - "%s: i2c wr reg=%04x: len=%d is too big!\n", - KBUILD_MODNAME, reg, len); + dev_warn(&client->dev, "i2c wr reg=%04x: len=%d is too big!\n", + reg, len); return -EINVAL; } @@ -92,8 +92,8 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, memcpy(val, buf, len); ret = 0; } else { - dev_warn(&priv->i2c->dev, "%s: i2c rd failed=%d reg=%02x " \ - "len=%d\n", KBUILD_MODNAME, ret, reg, len); + dev_warn(&client->dev, "i2c rd failed=%d reg=%02x len=%d\n", + ret, reg, len); ret = -EREMOTEIO; } @@ -188,11 +188,12 @@ int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret, i; u8 tmp0, tmp1; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); /* update GPIOs only when needed */ if (!memcmp(gpio, priv->gpio, sizeof(priv->gpio))) @@ -219,12 +220,10 @@ int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio) else tmp1 |= (0 << (0 + i)); - dev_dbg(&priv->i2c->dev, "%s: gpio i=%d %02x %02x\n", __func__, - i, tmp0, tmp1); + dev_dbg(&client->dev, "gpio i=%d %02x %02x\n", i, tmp0, tmp1); } - dev_dbg(&priv->i2c->dev, "%s: wr gpio=%02x %02x\n", __func__, tmp0, - tmp1); + dev_dbg(&client->dev, "wr gpio=%02x %02x\n", tmp0, tmp1); /* write bits [7:2] */ ret = cxd2820r_wr_reg_mask(priv, 0x00089, tmp0, 0xfc); @@ -240,18 +239,18 @@ int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } static int cxd2820r_set_frontend(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); switch (c->delivery_system) { case SYS_DVBT: @@ -279,8 +278,7 @@ static int cxd2820r_set_frontend(struct dvb_frontend *fe) goto err; break; default: - dev_dbg(&priv->i2c->dev, "%s: error state=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "invalid delivery_system\n"); ret = -EINVAL; break; } @@ -291,12 +289,13 @@ err: static int cxd2820r_read_status(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); - switch (fe->dtv_property_cache.delivery_system) { + switch (c->delivery_system) { case SYS_DVBT: ret = cxd2820r_read_status_t(fe, status); break; @@ -317,15 +316,16 @@ static int cxd2820r_get_frontend(struct dvb_frontend *fe, struct dtv_frontend_properties *p) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); if (priv->delivery_system == SYS_UNDEFINED) return 0; - switch (fe->dtv_property_cache.delivery_system) { + switch (c->delivery_system) { case SYS_DVBT: ret = cxd2820r_get_frontend_t(fe, p); break; @@ -345,9 +345,10 @@ static int cxd2820r_get_frontend(struct dvb_frontend *fe, static int cxd2820r_read_ber(struct dvb_frontend *fe, u32 *ber) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); *ber = (priv->post_bit_error - priv->post_bit_error_prev_dvbv3); priv->post_bit_error_prev_dvbv3 = priv->post_bit_error; @@ -358,10 +359,10 @@ static int cxd2820r_read_ber(struct dvb_frontend *fe, u32 *ber) static int cxd2820r_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); if (c->strength.stat[0].scale == FE_SCALE_RELATIVE) *strength = c->strength.stat[0].uvalue; @@ -374,10 +375,10 @@ static int cxd2820r_read_signal_strength(struct dvb_frontend *fe, u16 *strength) static int cxd2820r_read_snr(struct dvb_frontend *fe, u16 *snr) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); if (c->cnr.stat[0].scale == FE_SCALE_DECIBEL) *snr = div_s64(c->cnr.stat[0].svalue, 100); @@ -390,9 +391,10 @@ static int cxd2820r_read_snr(struct dvb_frontend *fe, u16 *snr) static int cxd2820r_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); *ucblocks = 0; @@ -407,12 +409,13 @@ static int cxd2820r_init(struct dvb_frontend *fe) static int cxd2820r_sleep(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); - switch (fe->dtv_property_cache.delivery_system) { + switch (c->delivery_system) { case SYS_DVBT: ret = cxd2820r_sleep_t(fe); break; @@ -433,12 +436,13 @@ static int cxd2820r_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *s) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); - switch (fe->dtv_property_cache.delivery_system) { + switch (c->delivery_system) { case SYS_DVBT: ret = cxd2820r_get_tune_settings_t(fe, s); break; @@ -458,12 +462,12 @@ static int cxd2820r_get_tune_settings(struct dvb_frontend *fe, static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret, i; enum fe_status status = 0; - dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__, - fe->dtv_property_cache.delivery_system); + dev_dbg(&client->dev, "delivery_system=%d\n", c->delivery_system); /* switch between DVB-T and DVB-T2 when tune fails */ if (priv->last_tune_failed) { @@ -487,7 +491,6 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe) if (ret) goto error; - /* frontend lock wait loop count */ switch (priv->delivery_system) { case SYS_DVBT: @@ -505,7 +508,7 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe) /* wait frontend lock */ for (; i > 0; i--) { - dev_dbg(&priv->i2c->dev, "%s: loop=%d\n", __func__, i); + dev_dbg(&client->dev, "loop=%d\n", i); msleep(50); ret = cxd2820r_read_status(fe, &status); if (ret) @@ -525,7 +528,7 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe) } error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return DVBFE_ALGO_SEARCH_ERROR; } @@ -539,7 +542,7 @@ static void cxd2820r_release(struct dvb_frontend *fe) struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; - dev_dbg(&priv->i2c->dev, "%s\n", __func__); + dev_dbg(&client->dev, "\n"); i2c_unregister_device(client); @@ -549,8 +552,9 @@ static void cxd2820r_release(struct dvb_frontend *fe) static int cxd2820r_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; - dev_dbg(&priv->i2c->dev, "%s: %d\n", __func__, enable); + dev_dbg_ratelimited(&client->dev, "enable=%d\n", enable); /* Bit 0 of reg 0xdb in bank 0x00 controls I2C repeater */ return cxd2820r_wr_reg_mask(priv, 0xdb, enable ? 1 : 0, 0x1); @@ -561,9 +565,10 @@ static int cxd2820r_gpio_direction_output(struct gpio_chip *chip, unsigned nr, int val) { struct cxd2820r_priv *priv = gpiochip_get_data(chip); + struct i2c_client *client = priv->client[0]; u8 gpio[GPIO_COUNT]; - dev_dbg(&priv->i2c->dev, "%s: nr=%d val=%d\n", __func__, nr, val); + dev_dbg(&client->dev, "nr=%u val=%d\n", nr, val); memcpy(gpio, priv->gpio, sizeof(gpio)); gpio[nr] = CXD2820R_GPIO_E | CXD2820R_GPIO_O | (val << 2); @@ -574,9 +579,10 @@ static int cxd2820r_gpio_direction_output(struct gpio_chip *chip, unsigned nr, static void cxd2820r_gpio_set(struct gpio_chip *chip, unsigned nr, int val) { struct cxd2820r_priv *priv = gpiochip_get_data(chip); + struct i2c_client *client = priv->client[0]; u8 gpio[GPIO_COUNT]; - dev_dbg(&priv->i2c->dev, "%s: nr=%d val=%d\n", __func__, nr, val); + dev_dbg(&client->dev, "nr=%u val=%d\n", nr, val); memcpy(gpio, priv->gpio, sizeof(gpio)); gpio[nr] = CXD2820R_GPIO_E | CXD2820R_GPIO_O | (val << 2); @@ -589,8 +595,9 @@ static void cxd2820r_gpio_set(struct gpio_chip *chip, unsigned nr, int val) static int cxd2820r_gpio_get(struct gpio_chip *chip, unsigned nr) { struct cxd2820r_priv *priv = gpiochip_get_data(chip); + struct i2c_client *client = priv->client[0]; - dev_dbg(&priv->i2c->dev, "%s: nr=%d\n", __func__, nr); + dev_dbg(&client->dev, "nr=%u\n", nr); return (priv->gpio[nr] >> 2) & 0x01; } @@ -738,7 +745,7 @@ static int cxd2820r_probe(struct i2c_client *client, #ifdef CONFIG_GPIOLIB /* Add GPIOs */ priv->gpio_chip.label = KBUILD_MODNAME; - priv->gpio_chip.parent = &priv->i2c->dev; + priv->gpio_chip.parent = &client->dev; priv->gpio_chip.owner = THIS_MODULE; priv->gpio_chip.direction_output = cxd2820r_gpio_direction_output; priv->gpio_chip.set = cxd2820r_gpio_set; @@ -750,8 +757,8 @@ static int cxd2820r_probe(struct i2c_client *client, if (ret) goto err_client_1_i2c_unregister_device; - dev_dbg(&priv->i2c->dev, "%s: gpio_chip.base=%d\n", __func__, - priv->gpio_chip.base); + dev_dbg(&client->dev, "gpio_chip.base=%d\n", + priv->gpio_chip.base); *gpio_chip_base = priv->gpio_chip.base; #else diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c index e328fe2f7bf9..174d916d1aaa 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t.c +++ b/drivers/media/dvb-frontends/cxd2820r_t.c @@ -24,6 +24,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret, i, bw_i; unsigned int utmp; @@ -55,8 +56,10 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) { 0x00427, 0x41, 0xff }, }; - dev_dbg(&priv->i2c->dev, "%s: frequency=%d bandwidth_hz=%d\n", __func__, - c->frequency, c->bandwidth_hz); + dev_dbg(&client->dev, + "delivery_system=%d modulation=%d frequency=%u bandwidth_hz=%u inversion=%d\n", + c->delivery_system, c->modulation, c->frequency, + c->bandwidth_hz, c->inversion); switch (c->bandwidth_hz) { case 6000000: @@ -96,8 +99,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); if (ret) goto error; - dev_dbg(&priv->i2c->dev, "%s: if_frequency=%u\n", __func__, - if_frequency); + dev_dbg(&client->dev, "if_frequency=%u\n", if_frequency); } else { ret = -EINVAL; goto error; @@ -133,7 +135,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } @@ -141,9 +143,12 @@ int cxd2820r_get_frontend_t(struct dvb_frontend *fe, struct dtv_frontend_properties *c) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; int ret; u8 buf[2]; + dev_dbg(&client->dev, "\n"); + ret = cxd2820r_rd_regs(priv, 0x0002f, buf, sizeof(buf)); if (ret) goto error; @@ -250,13 +255,14 @@ int cxd2820r_get_frontend_t(struct dvb_frontend *fe, return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; unsigned int utmp; @@ -294,7 +300,7 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) } } - dev_dbg(&priv->i2c->dev, "%s: lock=%*ph\n", __func__, 4, buf); + dev_dbg(&client->dev, "lock=%*ph\n", 4, buf); /* Signal strength */ if (*status & FE_HAS_SIGNAL) { @@ -384,28 +390,32 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } int cxd2820r_init_t(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; int ret; + dev_dbg(&client->dev, "\n"); + ret = cxd2820r_wr_reg(priv, 0x00085, 0x07); if (ret) goto error; return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } int cxd2820r_sleep_t(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; int ret, i; struct reg_val_mask tab[] = { { 0x000ff, 0x1f, 0xff }, @@ -415,7 +425,7 @@ int cxd2820r_sleep_t(struct dvb_frontend *fe) { 0x00080, 0x00, 0xff }, }; - dev_dbg(&priv->i2c->dev, "%s\n", __func__); + dev_dbg(&client->dev, "\n"); priv->delivery_system = SYS_UNDEFINED; @@ -428,7 +438,7 @@ int cxd2820r_sleep_t(struct dvb_frontend *fe) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c index 3a2c198153a3..939a68d808f8 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t2.c +++ b/drivers/media/dvb-frontends/cxd2820r_t2.c @@ -23,8 +23,9 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) { - struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret, i, bw_i; unsigned int utmp; u32 if_frequency; @@ -69,8 +70,10 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) { 0x027ef, 0x10, 0x18 }, }; - dev_dbg(&priv->i2c->dev, "%s: frequency=%d bandwidth_hz=%d\n", __func__, - c->frequency, c->bandwidth_hz); + dev_dbg(&client->dev, + "delivery_system=%d modulation=%d frequency=%u bandwidth_hz=%u inversion=%d stream_id=%u\n", + c->delivery_system, c->modulation, c->frequency, + c->bandwidth_hz, c->inversion, c->stream_id); switch (c->bandwidth_hz) { case 5000000: @@ -113,8 +116,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency); if (ret) goto error; - dev_dbg(&priv->i2c->dev, "%s: if_frequency=%u\n", __func__, - if_frequency); + dev_dbg(&client->dev, "if_frequency=%u\n", if_frequency); } else { ret = -EINVAL; goto error; @@ -130,13 +132,12 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) /* PLP filtering */ if (c->stream_id > 255) { - dev_dbg(&priv->i2c->dev, "%s: Disable PLP filtering\n", __func__); + dev_dbg(&client->dev, "disable PLP filtering\n"); ret = cxd2820r_wr_reg(priv, 0x023ad , 0); if (ret) goto error; } else { - dev_dbg(&priv->i2c->dev, "%s: Enable PLP filtering = %d\n", __func__, - c->stream_id); + dev_dbg(&client->dev, "enable PLP filtering\n"); ret = cxd2820r_wr_reg(priv, 0x023af , c->stream_id & 0xFF); if (ret) goto error; @@ -163,7 +164,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } @@ -172,9 +173,12 @@ int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, struct dtv_frontend_properties *c) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; int ret; u8 buf[2]; + dev_dbg(&client->dev, "\n"); + ret = cxd2820r_rd_regs(priv, 0x0205c, buf, 2); if (ret) goto error; @@ -279,7 +283,7 @@ int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } @@ -287,6 +291,7 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) { struct cxd2820r_priv *priv = fe->demodulator_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; + struct i2c_client *client = priv->client[0]; int ret; unsigned int utmp; u8 buf[4]; @@ -306,7 +311,7 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) } } - dev_dbg(&priv->i2c->dev, "%s: lock=%02x\n", __func__, buf[0]); + dev_dbg(&client->dev, "lock=%*ph\n", 1, buf); /* Signal strength */ if (*status & FE_HAS_SIGNAL) { @@ -383,13 +388,14 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } int cxd2820r_sleep_t2(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; + struct i2c_client *client = priv->client[0]; int ret, i; struct reg_val_mask tab[] = { { 0x000ff, 0x1f, 0xff }, @@ -400,7 +406,7 @@ int cxd2820r_sleep_t2(struct dvb_frontend *fe) { 0x00080, 0x00, 0xff }, }; - dev_dbg(&priv->i2c->dev, "%s\n", __func__); + dev_dbg(&client->dev, "\n"); for (i = 0; i < ARRAY_SIZE(tab); i++) { ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, tab[i].val, @@ -413,7 +419,7 @@ int cxd2820r_sleep_t2(struct dvb_frontend *fe) return ret; error: - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } From d51dc917616c6c52daeeea3f93418f48f484ade5 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Fri, 12 Aug 2016 16:58:05 -0300 Subject: [PATCH 502/591] [media] cxd2820r: improve lock detection Check demod and ts locks and report lock status according to those. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2820r_c.c | 29 +++++++++------ drivers/media/dvb-frontends/cxd2820r_t.c | 44 +++++++++-------------- drivers/media/dvb-frontends/cxd2820r_t2.c | 26 ++++++++------ 3 files changed, 50 insertions(+), 49 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c index beb46a620160..0f96add3e69a 100644 --- a/drivers/media/dvb-frontends/cxd2820r_c.c +++ b/drivers/media/dvb-frontends/cxd2820r_c.c @@ -160,25 +160,32 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - unsigned int utmp; + unsigned int utmp, utmp1, utmp2; u8 buf[3]; - *status = 0; - ret = cxd2820r_rd_regs(priv, 0x10088, buf, 2); + /* Lock detection */ + ret = cxd2820r_rd_reg(priv, 0x10088, &buf[0]); + if (ret) + goto error; + ret = cxd2820r_rd_reg(priv, 0x10073, &buf[1]); if (ret) goto error; - if (((buf[0] >> 0) & 0x01) == 1) { - *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | - FE_HAS_VITERBI | FE_HAS_SYNC; + utmp1 = (buf[0] >> 0) & 0x01; + utmp2 = (buf[1] >> 3) & 0x01; - if (((buf[1] >> 3) & 0x01) == 1) { - *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | - FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; - } + if (utmp1 == 1 && utmp2 == 1) { + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | + FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; + } else if (utmp1 == 1 || utmp2 == 1) { + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | + FE_HAS_VITERBI | FE_HAS_SYNC; + } else { + *status = 0; } - dev_dbg(&client->dev, "lock=%*ph\n", 2, buf); + dev_dbg(&client->dev, "status=%02x raw=%*ph sync=%u ts=%u\n", + *status, 2, buf, utmp1, utmp2); /* Signal strength */ if (*status & FE_HAS_SIGNAL) { diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c index 174d916d1aaa..19f72cd2d01b 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t.c +++ b/drivers/media/dvb-frontends/cxd2820r_t.c @@ -265,42 +265,32 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - unsigned int utmp; - u8 buf[4]; - *status = 0; + unsigned int utmp, utmp1, utmp2; + u8 buf[3]; + /* Lock detection */ ret = cxd2820r_rd_reg(priv, 0x00010, &buf[0]); + if (ret) + goto error; + ret = cxd2820r_rd_reg(priv, 0x00073, &buf[1]); if (ret) goto error; - if ((buf[0] & 0x07) == 6) { - ret = cxd2820r_rd_reg(priv, 0x00073, &buf[1]); - if (ret) - goto error; + utmp1 = (buf[0] >> 0) & 0x07; + utmp2 = (buf[1] >> 3) & 0x01; - if (((buf[1] >> 3) & 0x01) == 1) { - *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | - FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; - } else { - *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | - FE_HAS_VITERBI | FE_HAS_SYNC; - } + if (utmp1 == 6 && utmp2 == 1) { + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | + FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; + } else if (utmp1 == 6 || utmp2 == 1) { + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | + FE_HAS_VITERBI | FE_HAS_SYNC; } else { - ret = cxd2820r_rd_reg(priv, 0x00014, &buf[2]); - if (ret) - goto error; - - if ((buf[2] & 0x0f) >= 4) { - ret = cxd2820r_rd_reg(priv, 0x00a14, &buf[3]); - if (ret) - goto error; - - if (((buf[3] >> 4) & 0x01) == 1) - *status |= FE_HAS_SIGNAL; - } + *status = 0; } - dev_dbg(&client->dev, "lock=%*ph\n", 4, buf); + dev_dbg(&client->dev, "status=%02x raw=%*ph sync=%u ts=%u\n", + *status, 2, buf, utmp1, utmp2); /* Signal strength */ if (*status & FE_HAS_SIGNAL) { diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c index 939a68d808f8..4a6fbf8d242b 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t2.c +++ b/drivers/media/dvb-frontends/cxd2820r_t2.c @@ -293,25 +293,29 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct i2c_client *client = priv->client[0]; int ret; - unsigned int utmp; + unsigned int utmp, utmp1, utmp2; u8 buf[4]; - *status = 0; + /* Lock detection */ ret = cxd2820r_rd_reg(priv, 0x02010 , &buf[0]); if (ret) goto error; - if ((buf[0] & 0x07) == 6) { - if (((buf[0] >> 5) & 0x01) == 1) { - *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | - FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; - } else { - *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | - FE_HAS_VITERBI | FE_HAS_SYNC; - } + utmp1 = (buf[0] >> 0) & 0x07; + utmp2 = (buf[0] >> 5) & 0x01; + + if (utmp1 == 6 && utmp2 == 1) { + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | + FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; + } else if (utmp1 == 6 || utmp2 == 1) { + *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | + FE_HAS_VITERBI | FE_HAS_SYNC; + } else { + *status = 0; } - dev_dbg(&client->dev, "lock=%*ph\n", 1, buf); + dev_dbg(&client->dev, "status=%02x raw=%*ph sync=%u ts=%u\n", + *status, 1, buf, utmp1, utmp2); /* Signal strength */ if (*status & FE_HAS_SIGNAL) { From 43e2ea63eb9781bc980cbcb954d26fec8ad108e6 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Sat, 13 Aug 2016 13:19:05 -0300 Subject: [PATCH 503/591] [media] cxd2820r: convert to regmap api Use regmap for I2C register access. Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/Kconfig | 1 + drivers/media/dvb-frontends/cxd2820r_c.c | 56 ++--- drivers/media/dvb-frontends/cxd2820r_core.c | 265 +++++++------------- drivers/media/dvb-frontends/cxd2820r_priv.h | 6 +- drivers/media/dvb-frontends/cxd2820r_t.c | 55 ++-- drivers/media/dvb-frontends/cxd2820r_t2.c | 55 ++-- 6 files changed, 176 insertions(+), 262 deletions(-) diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index c645aa81f423..c4b67f71d979 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig @@ -463,6 +463,7 @@ config DVB_STV0367 config DVB_CXD2820R tristate "Sony CXD2820R" depends on DVB_CORE && I2C + select REGMAP_I2C default m if !MEDIA_SUBDRV_AUTOSELECT help Say Y when you want to support this frontend. diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c index 0f96add3e69a..d75b0776d5b5 100644 --- a/drivers/media/dvb-frontends/cxd2820r_c.c +++ b/drivers/media/dvb-frontends/cxd2820r_c.c @@ -26,7 +26,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int ret, i; + int ret; unsigned int utmp; u8 buf[2]; u32 if_frequency; @@ -58,12 +58,9 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) fe->ops.tuner_ops.set_params(fe); if (priv->delivery_system != SYS_DVBC_ANNEX_A) { - for (i = 0; i < ARRAY_SIZE(tab); i++) { - ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, - tab[i].val, tab[i].mask); - if (ret) - goto error; - } + ret = cxd2820r_wr_reg_val_mask_tab(priv, tab, ARRAY_SIZE(tab)); + if (ret) + goto error; } priv->delivery_system = SYS_DVBC_ANNEX_A; @@ -83,15 +80,15 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) utmp = 0x4000 - DIV_ROUND_CLOSEST_ULL((u64)if_frequency * 0x4000, CXD2820R_CLK); buf[0] = (utmp >> 8) & 0xff; buf[1] = (utmp >> 0) & 0xff; - ret = cxd2820r_wr_regs(priv, 0x10042, buf, 2); + ret = regmap_bulk_write(priv->regmap[1], 0x0042, buf, 2); if (ret) goto error; - ret = cxd2820r_wr_reg(priv, 0x000ff, 0x08); + ret = regmap_write(priv->regmap[0], 0x00ff, 0x08); if (ret) goto error; - ret = cxd2820r_wr_reg(priv, 0x000fe, 0x01); + ret = regmap_write(priv->regmap[0], 0x00fe, 0x01); if (ret) goto error; @@ -107,21 +104,22 @@ int cxd2820r_get_frontend_c(struct dvb_frontend *fe, struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; int ret; + unsigned int utmp; u8 buf[2]; dev_dbg(&client->dev, "\n"); - ret = cxd2820r_rd_regs(priv, 0x1001a, buf, 2); + ret = regmap_bulk_read(priv->regmap[1], 0x001a, buf, 2); if (ret) goto error; c->symbol_rate = 2500 * ((buf[0] & 0x0f) << 8 | buf[1]); - ret = cxd2820r_rd_reg(priv, 0x10019, &buf[0]); + ret = regmap_read(priv->regmap[1], 0x0019, &utmp); if (ret) goto error; - switch ((buf[0] >> 0) & 0x07) { + switch ((utmp >> 0) & 0x07) { case 0: c->modulation = QAM_16; break; @@ -139,7 +137,7 @@ int cxd2820r_get_frontend_c(struct dvb_frontend *fe, break; } - switch ((buf[0] >> 7) & 0x01) { + switch ((utmp >> 7) & 0x01) { case 0: c->inversion = INVERSION_OFF; break; @@ -164,10 +162,10 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) u8 buf[3]; /* Lock detection */ - ret = cxd2820r_rd_reg(priv, 0x10088, &buf[0]); + ret = regmap_bulk_read(priv->regmap[1], 0x0088, &buf[0], 1); if (ret) goto error; - ret = cxd2820r_rd_reg(priv, 0x10073, &buf[1]); + ret = regmap_bulk_read(priv->regmap[1], 0x0073, &buf[1], 1); if (ret) goto error; @@ -191,7 +189,7 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) if (*status & FE_HAS_SIGNAL) { unsigned int strength; - ret = cxd2820r_rd_regs(priv, 0x10049, buf, 2); + ret = regmap_bulk_read(priv->regmap[1], 0x0049, buf, 2); if (ret) goto error; @@ -212,11 +210,11 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) if (*status & FE_HAS_VITERBI) { unsigned int cnr, const_a, const_b; - ret = cxd2820r_rd_reg(priv, 0x10019, &buf[0]); + ret = regmap_read(priv->regmap[1], 0x0019, &utmp); if (ret) goto error; - if (((buf[0] >> 0) & 0x03) % 2) { + if (((utmp >> 0) & 0x03) % 2) { const_a = 8750; const_b = 650; } else { @@ -224,11 +222,10 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) const_b = 760; } - ret = cxd2820r_rd_reg(priv, 0x1004d, &buf[0]); + ret = regmap_read(priv->regmap[1], 0x004d, &utmp); if (ret) goto error; - utmp = buf[0] << 0; #define CXD2820R_LOG2_E_24 24204406 /* log2(e) << 24 */ if (utmp) cnr = div_u64((u64)(intlog2(const_b) - intlog2(utmp)) @@ -250,7 +247,7 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) bool start_ber; if (priv->ber_running) { - ret = cxd2820r_rd_regs(priv, 0x10076, buf, 3); + ret = regmap_bulk_read(priv->regmap[1], 0x0076, buf, 3); if (ret) goto error; @@ -269,7 +266,7 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status) } if (start_ber) { - ret = cxd2820r_wr_reg(priv, 0x10079, 0x01); + ret = regmap_write(priv->regmap[1], 0x0079, 0x01); if (ret) goto error; priv->ber_running = true; @@ -299,7 +296,7 @@ int cxd2820r_init_c(struct dvb_frontend *fe) dev_dbg(&client->dev, "\n"); - ret = cxd2820r_wr_reg(priv, 0x00085, 0x07); + ret = regmap_write(priv->regmap[0], 0x0085, 0x07); if (ret) goto error; @@ -313,7 +310,7 @@ int cxd2820r_sleep_c(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; - int ret, i; + int ret; struct reg_val_mask tab[] = { { 0x000ff, 0x1f, 0xff }, { 0x00085, 0x00, 0xff }, @@ -326,12 +323,9 @@ int cxd2820r_sleep_c(struct dvb_frontend *fe) priv->delivery_system = SYS_UNDEFINED; - for (i = 0; i < ARRAY_SIZE(tab); i++) { - ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, tab[i].val, - tab[i].mask); - if (ret) - goto error; - } + ret = cxd2820r_wr_reg_val_mask_tab(priv, tab, ARRAY_SIZE(tab)); + if (ret) + goto error; return ret; error: diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c index e222217458ca..95267c6edb3a 100644 --- a/drivers/media/dvb-frontends/cxd2820r_core.c +++ b/drivers/media/dvb-frontends/cxd2820r_core.c @@ -21,170 +21,41 @@ #include "cxd2820r_priv.h" -/* Max transfer size done by I2C transfer functions */ -#define MAX_XFER_SIZE 64 - -/* write multiple registers */ -static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, - u8 *val, int len) +/* Write register table */ +int cxd2820r_wr_reg_val_mask_tab(struct cxd2820r_priv *priv, + const struct reg_val_mask *tab, int tab_len) { struct i2c_client *client = priv->client[0]; int ret; - u8 buf[MAX_XFER_SIZE]; - struct i2c_msg msg[1] = { - { - .addr = i2c, - .flags = 0, - .len = len + 1, - .buf = buf, - } - }; + unsigned int i, reg, mask, val; + struct regmap *regmap; - if (1 + len > sizeof(buf)) { - dev_warn(&client->dev, "i2c wr reg=%04x: len=%d is too big!\n", - reg, len); - return -EINVAL; + dev_dbg(&client->dev, "tab_len=%d\n", tab_len); + + for (i = 0; i < tab_len; i++) { + if ((tab[i].reg >> 16) & 0x1) + regmap = priv->regmap[1]; + else + regmap = priv->regmap[0]; + + reg = (tab[i].reg >> 0) & 0xffff; + val = tab[i].val; + mask = tab[i].mask; + + if (mask == 0xff) + ret = regmap_write(regmap, reg, val); + else + ret = regmap_write_bits(regmap, reg, mask, val); + if (ret) + goto error; } - buf[0] = reg; - memcpy(&buf[1], val, len); - - ret = i2c_transfer(priv->client[0]->adapter, msg, 1); - if (ret == 1) { - ret = 0; - } else { - dev_warn(&client->dev, "i2c wr failed=%d reg=%02x len=%d\n", - ret, reg, len); - ret = -EREMOTEIO; - } + return 0; +error: + dev_dbg(&client->dev, "failed=%d\n", ret); return ret; } -/* read multiple registers */ -static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, - u8 *val, int len) -{ - struct i2c_client *client = priv->client[0]; - int ret; - u8 buf[MAX_XFER_SIZE]; - struct i2c_msg msg[2] = { - { - .addr = i2c, - .flags = 0, - .len = 1, - .buf = ®, - }, { - .addr = i2c, - .flags = I2C_M_RD, - .len = len, - .buf = buf, - } - }; - - if (len > sizeof(buf)) { - dev_warn(&client->dev, "i2c wr reg=%04x: len=%d is too big!\n", - reg, len); - return -EINVAL; - } - - ret = i2c_transfer(priv->client[0]->adapter, msg, 2); - if (ret == 2) { - memcpy(val, buf, len); - ret = 0; - } else { - dev_warn(&client->dev, "i2c rd failed=%d reg=%02x len=%d\n", - ret, reg, len); - ret = -EREMOTEIO; - } - - return ret; -} - -/* write multiple registers */ -int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, - int len) -{ - int ret; - u8 i2c_addr; - u8 reg = (reginfo >> 0) & 0xff; - u8 bank = (reginfo >> 8) & 0xff; - u8 i2c = (reginfo >> 16) & 0x01; - - /* select I2C */ - if (i2c) - i2c_addr = priv->client[1]->addr; /* DVB-C */ - else - i2c_addr = priv->client[0]->addr; /* DVB-T/T2 */ - - /* switch bank if needed */ - if (bank != priv->bank[i2c]) { - ret = cxd2820r_wr_regs_i2c(priv, i2c_addr, 0x00, &bank, 1); - if (ret) - return ret; - priv->bank[i2c] = bank; - } - return cxd2820r_wr_regs_i2c(priv, i2c_addr, reg, val, len); -} - -/* read multiple registers */ -int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, - int len) -{ - int ret; - u8 i2c_addr; - u8 reg = (reginfo >> 0) & 0xff; - u8 bank = (reginfo >> 8) & 0xff; - u8 i2c = (reginfo >> 16) & 0x01; - - /* select I2C */ - if (i2c) - i2c_addr = priv->client[1]->addr; /* DVB-C */ - else - i2c_addr = priv->client[0]->addr; /* DVB-T/T2 */ - - /* switch bank if needed */ - if (bank != priv->bank[i2c]) { - ret = cxd2820r_wr_regs_i2c(priv, i2c_addr, 0x00, &bank, 1); - if (ret) - return ret; - priv->bank[i2c] = bank; - } - return cxd2820r_rd_regs_i2c(priv, i2c_addr, reg, val, len); -} - -/* write single register */ -int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val) -{ - return cxd2820r_wr_regs(priv, reg, &val, 1); -} - -/* read single register */ -int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val) -{ - return cxd2820r_rd_regs(priv, reg, val, 1); -} - -/* write single register with mask */ -int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, - u8 mask) -{ - int ret; - u8 tmp; - - /* no need for read if whole reg is written */ - if (mask != 0xff) { - ret = cxd2820r_rd_reg(priv, reg, &tmp); - if (ret) - return ret; - - val &= mask; - tmp &= ~mask; - val |= tmp; - } - - return cxd2820r_wr_reg(priv, reg, val); -} - int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio) { struct cxd2820r_priv *priv = fe->demodulator_priv; @@ -226,12 +97,12 @@ int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio) dev_dbg(&client->dev, "wr gpio=%02x %02x\n", tmp0, tmp1); /* write bits [7:2] */ - ret = cxd2820r_wr_reg_mask(priv, 0x00089, tmp0, 0xfc); + ret = regmap_update_bits(priv->regmap[0], 0x0089, 0xfc, tmp0); if (ret) goto error; /* write bits [5:0] */ - ret = cxd2820r_wr_reg_mask(priv, 0x0008e, tmp1, 0x3f); + ret = regmap_update_bits(priv->regmap[0], 0x008e, 0x3f, tmp1); if (ret) goto error; @@ -556,8 +427,7 @@ static int cxd2820r_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) dev_dbg_ratelimited(&client->dev, "enable=%d\n", enable); - /* Bit 0 of reg 0xdb in bank 0x00 controls I2C repeater */ - return cxd2820r_wr_reg_mask(priv, 0xdb, enable ? 1 : 0, 0x1); + return regmap_update_bits(priv->regmap[0], 0x00db, 0x01, enable ? 1 : 0); } #ifdef CONFIG_GPIOLIB @@ -696,7 +566,45 @@ static int cxd2820r_probe(struct i2c_client *client, struct cxd2820r_platform_data *pdata = client->dev.platform_data; struct cxd2820r_priv *priv; int ret, *gpio_chip_base; - u8 u8tmp; + unsigned int utmp; + static const struct regmap_range_cfg regmap_range_cfg0[] = { + { + .range_min = 0x0000, + .range_max = 0x3fff, + .selector_reg = 0x00, + .selector_mask = 0xff, + .selector_shift = 0, + .window_start = 0x00, + .window_len = 0x100, + }, + }; + static const struct regmap_range_cfg regmap_range_cfg1[] = { + { + .range_min = 0x0000, + .range_max = 0x01ff, + .selector_reg = 0x00, + .selector_mask = 0xff, + .selector_shift = 0, + .window_start = 0x00, + .window_len = 0x100, + }, + }; + static const struct regmap_config regmap_config0 = { + .reg_bits = 8, + .val_bits = 8, + .max_register = 0x3fff, + .ranges = regmap_range_cfg0, + .num_ranges = ARRAY_SIZE(regmap_range_cfg0), + .cache_type = REGCACHE_NONE, + }; + static const struct regmap_config regmap_config1 = { + .reg_bits = 8, + .val_bits = 8, + .max_register = 0x01ff, + .ranges = regmap_range_cfg1, + .num_ranges = ARRAY_SIZE(regmap_range_cfg1), + .cache_type = REGCACHE_NONE, + }; dev_dbg(&client->dev, "\n"); @@ -712,20 +620,23 @@ static int cxd2820r_probe(struct i2c_client *client, priv->ts_clk_inv = pdata->ts_clk_inv; priv->if_agc_polarity = pdata->if_agc_polarity; priv->spec_inv = pdata->spec_inv; - priv->bank[0] = 0xff; - priv->bank[1] = 0xff; gpio_chip_base = *pdata->gpio_chip_base; + priv->regmap[0] = regmap_init_i2c(priv->client[0], ®map_config0); + if (IS_ERR(priv->regmap[0])) { + ret = PTR_ERR(priv->regmap[0]); + goto err_kfree; + } /* Check demod answers with correct chip id */ - ret = cxd2820r_rd_reg(priv, 0x000fd, &u8tmp); + ret = regmap_read(priv->regmap[0], 0x00fd, &utmp); if (ret) - goto err_kfree; + goto err_regmap_0_regmap_exit; - dev_dbg(&client->dev, "chip_id=%02x\n", u8tmp); + dev_dbg(&client->dev, "chip_id=%02x\n", utmp); - if (u8tmp != 0xe1) { + if (utmp != 0xe1) { ret = -ENODEV; - goto err_kfree; + goto err_regmap_0_regmap_exit; } /* @@ -738,7 +649,13 @@ static int cxd2820r_probe(struct i2c_client *client, ret = -ENODEV; dev_err(&client->dev, "I2C registration failed\n"); if (ret) - goto err_kfree; + goto err_regmap_0_regmap_exit; + } + + priv->regmap[1] = regmap_init_i2c(priv->client[1], ®map_config1); + if (IS_ERR(priv->regmap[1])) { + ret = PTR_ERR(priv->regmap[1]); + goto err_client_1_i2c_unregister_device; } if (gpio_chip_base) { @@ -755,7 +672,7 @@ static int cxd2820r_probe(struct i2c_client *client, priv->gpio_chip.can_sleep = 1; ret = gpiochip_add_data(&priv->gpio_chip, priv); if (ret) - goto err_client_1_i2c_unregister_device; + goto err_regmap_1_regmap_exit; dev_dbg(&client->dev, "gpio_chip.base=%d\n", priv->gpio_chip.base); @@ -772,7 +689,7 @@ static int cxd2820r_probe(struct i2c_client *client, gpio[2] = 0; ret = cxd2820r_gpio(&priv->fe, gpio); if (ret) - goto err_client_1_i2c_unregister_device; + goto err_regmap_1_regmap_exit; #endif } @@ -789,8 +706,12 @@ static int cxd2820r_probe(struct i2c_client *client, dev_info(&client->dev, "Sony CXD2820R successfully identified\n"); return 0; +err_regmap_1_regmap_exit: + regmap_exit(priv->regmap[1]); err_client_1_i2c_unregister_device: i2c_unregister_device(priv->client[1]); +err_regmap_0_regmap_exit: + regmap_exit(priv->regmap[0]); err_kfree: kfree(priv); err: @@ -808,7 +729,11 @@ static int cxd2820r_remove(struct i2c_client *client) if (priv->gpio_chip.label) gpiochip_remove(&priv->gpio_chip); #endif + regmap_exit(priv->regmap[1]); i2c_unregister_device(priv->client[1]); + + regmap_exit(priv->regmap[0]); + kfree(priv); return 0; diff --git a/drivers/media/dvb-frontends/cxd2820r_priv.h b/drivers/media/dvb-frontends/cxd2820r_priv.h index f711fbd6e7e7..0d096206ac66 100644 --- a/drivers/media/dvb-frontends/cxd2820r_priv.h +++ b/drivers/media/dvb-frontends/cxd2820r_priv.h @@ -28,6 +28,7 @@ #include "cxd2820r.h" #include #include +#include struct reg_val_mask { u32 reg; @@ -39,6 +40,7 @@ struct reg_val_mask { struct cxd2820r_priv { struct i2c_client *client[2]; + struct regmap *regmap[2]; struct i2c_adapter *i2c; struct dvb_frontend fe; u8 ts_mode; @@ -51,7 +53,6 @@ struct cxd2820r_priv { bool ber_running; - u8 bank[2]; #define GPIO_COUNT 3 u8 gpio[GPIO_COUNT]; #ifdef CONFIG_GPIOLIB @@ -68,6 +69,9 @@ extern int cxd2820r_debug; int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio); +int cxd2820r_wr_reg_val_mask_tab(struct cxd2820r_priv *priv, + const struct reg_val_mask *tab, int tab_len); + int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, u8 mask); diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c index 19f72cd2d01b..c2e7caf9b010 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t.c +++ b/drivers/media/dvb-frontends/cxd2820r_t.c @@ -26,7 +26,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int ret, i, bw_i; + int ret, bw_i; unsigned int utmp; u32 if_frequency; u8 buf[3], bw_param; @@ -83,12 +83,9 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) fe->ops.tuner_ops.set_params(fe); if (priv->delivery_system != SYS_DVBT) { - for (i = 0; i < ARRAY_SIZE(tab); i++) { - ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, - tab[i].val, tab[i].mask); - if (ret) - goto error; - } + ret = cxd2820r_wr_reg_val_mask_tab(priv, tab, ARRAY_SIZE(tab)); + if (ret) + goto error; } priv->delivery_system = SYS_DVBT; @@ -109,27 +106,27 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) buf[0] = (utmp >> 16) & 0xff; buf[1] = (utmp >> 8) & 0xff; buf[2] = (utmp >> 0) & 0xff; - ret = cxd2820r_wr_regs(priv, 0x000b6, buf, 3); + ret = regmap_bulk_write(priv->regmap[0], 0x00b6, buf, 3); if (ret) goto error; - ret = cxd2820r_wr_regs(priv, 0x0009f, bw_params1[bw_i], 5); + ret = regmap_bulk_write(priv->regmap[0], 0x009f, bw_params1[bw_i], 5); if (ret) goto error; - ret = cxd2820r_wr_reg_mask(priv, 0x000d7, bw_param << 6, 0xc0); + ret = regmap_update_bits(priv->regmap[0], 0x00d7, 0xc0, bw_param << 6); if (ret) goto error; - ret = cxd2820r_wr_regs(priv, 0x000d9, bw_params2[bw_i], 2); + ret = regmap_bulk_write(priv->regmap[0], 0x00d9, bw_params2[bw_i], 2); if (ret) goto error; - ret = cxd2820r_wr_reg(priv, 0x000ff, 0x08); + ret = regmap_write(priv->regmap[0], 0x00ff, 0x08); if (ret) goto error; - ret = cxd2820r_wr_reg(priv, 0x000fe, 0x01); + ret = regmap_write(priv->regmap[0], 0x00fe, 0x01); if (ret) goto error; @@ -145,11 +142,12 @@ int cxd2820r_get_frontend_t(struct dvb_frontend *fe, struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; int ret; + unsigned int utmp; u8 buf[2]; dev_dbg(&client->dev, "\n"); - ret = cxd2820r_rd_regs(priv, 0x0002f, buf, sizeof(buf)); + ret = regmap_bulk_read(priv->regmap[0], 0x002f, buf, sizeof(buf)); if (ret) goto error; @@ -240,11 +238,11 @@ int cxd2820r_get_frontend_t(struct dvb_frontend *fe, break; } - ret = cxd2820r_rd_reg(priv, 0x007c6, &buf[0]); + ret = regmap_read(priv->regmap[0], 0x07c6, &utmp); if (ret) goto error; - switch ((buf[0] >> 0) & 0x01) { + switch ((utmp >> 0) & 0x01) { case 0: c->inversion = INVERSION_OFF; break; @@ -269,10 +267,10 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) u8 buf[3]; /* Lock detection */ - ret = cxd2820r_rd_reg(priv, 0x00010, &buf[0]); + ret = regmap_bulk_read(priv->regmap[0], 0x0010, &buf[0], 1); if (ret) goto error; - ret = cxd2820r_rd_reg(priv, 0x00073, &buf[1]); + ret = regmap_bulk_read(priv->regmap[0], 0x0073, &buf[1], 1); if (ret) goto error; @@ -296,7 +294,7 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) if (*status & FE_HAS_SIGNAL) { unsigned int strength; - ret = cxd2820r_rd_regs(priv, 0x00026, buf, 2); + ret = regmap_bulk_read(priv->regmap[0], 0x0026, buf, 2); if (ret) goto error; @@ -317,7 +315,7 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) if (*status & FE_HAS_VITERBI) { unsigned int cnr; - ret = cxd2820r_rd_regs(priv, 0x0002c, buf, 2); + ret = regmap_bulk_read(priv->regmap[0], 0x002c, buf, 2); if (ret) goto error; @@ -343,7 +341,7 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) bool start_ber; if (priv->ber_running) { - ret = cxd2820r_rd_regs(priv, 0x00076, buf, 3); + ret = regmap_bulk_read(priv->regmap[0], 0x0076, buf, 3); if (ret) goto error; @@ -362,7 +360,7 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status) } if (start_ber) { - ret = cxd2820r_wr_reg(priv, 0x00079, 0x01); + ret = regmap_write(priv->regmap[0], 0x0079, 0x01); if (ret) goto error; priv->ber_running = true; @@ -392,7 +390,7 @@ int cxd2820r_init_t(struct dvb_frontend *fe) dev_dbg(&client->dev, "\n"); - ret = cxd2820r_wr_reg(priv, 0x00085, 0x07); + ret = regmap_write(priv->regmap[0], 0x0085, 0x07); if (ret) goto error; @@ -406,7 +404,7 @@ int cxd2820r_sleep_t(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; - int ret, i; + int ret; struct reg_val_mask tab[] = { { 0x000ff, 0x1f, 0xff }, { 0x00085, 0x00, 0xff }, @@ -419,12 +417,9 @@ int cxd2820r_sleep_t(struct dvb_frontend *fe) priv->delivery_system = SYS_UNDEFINED; - for (i = 0; i < ARRAY_SIZE(tab); i++) { - ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, tab[i].val, - tab[i].mask); - if (ret) - goto error; - } + ret = cxd2820r_wr_reg_val_mask_tab(priv, tab, ARRAY_SIZE(tab)); + if (ret) + goto error; return ret; error: diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c index 4a6fbf8d242b..e641fde75379 100644 --- a/drivers/media/dvb-frontends/cxd2820r_t2.c +++ b/drivers/media/dvb-frontends/cxd2820r_t2.c @@ -26,7 +26,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int ret, i, bw_i; + int ret, bw_i; unsigned int utmp; u32 if_frequency; u8 buf[3], bw_param; @@ -101,12 +101,9 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) fe->ops.tuner_ops.set_params(fe); if (priv->delivery_system != SYS_DVBT2) { - for (i = 0; i < ARRAY_SIZE(tab); i++) { - ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, - tab[i].val, tab[i].mask); - if (ret) - goto error; - } + ret = cxd2820r_wr_reg_val_mask_tab(priv, tab, ARRAY_SIZE(tab)); + if (ret) + goto error; } priv->delivery_system = SYS_DVBT2; @@ -126,39 +123,39 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) buf[0] = (utmp >> 16) & 0xff; buf[1] = (utmp >> 8) & 0xff; buf[2] = (utmp >> 0) & 0xff; - ret = cxd2820r_wr_regs(priv, 0x020b6, buf, 3); + ret = regmap_bulk_write(priv->regmap[0], 0x20b6, buf, 3); if (ret) goto error; /* PLP filtering */ if (c->stream_id > 255) { dev_dbg(&client->dev, "disable PLP filtering\n"); - ret = cxd2820r_wr_reg(priv, 0x023ad , 0); + ret = regmap_write(priv->regmap[0], 0x23ad, 0x00); if (ret) goto error; } else { dev_dbg(&client->dev, "enable PLP filtering\n"); - ret = cxd2820r_wr_reg(priv, 0x023af , c->stream_id & 0xFF); + ret = regmap_write(priv->regmap[0], 0x23af, c->stream_id & 0xff); if (ret) goto error; - ret = cxd2820r_wr_reg(priv, 0x023ad , 1); + ret = regmap_write(priv->regmap[0], 0x23ad, 0x01); if (ret) goto error; } - ret = cxd2820r_wr_regs(priv, 0x0209f, bw_params1[bw_i], 5); + ret = regmap_bulk_write(priv->regmap[0], 0x209f, bw_params1[bw_i], 5); if (ret) goto error; - ret = cxd2820r_wr_reg_mask(priv, 0x020d7, bw_param << 6, 0xc0); + ret = regmap_update_bits(priv->regmap[0], 0x20d7, 0xc0, bw_param << 6); if (ret) goto error; - ret = cxd2820r_wr_reg(priv, 0x000ff, 0x08); + ret = regmap_write(priv->regmap[0], 0x00ff, 0x08); if (ret) goto error; - ret = cxd2820r_wr_reg(priv, 0x000fe, 0x01); + ret = regmap_write(priv->regmap[0], 0x00fe, 0x01); if (ret) goto error; @@ -175,11 +172,12 @@ int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; int ret; + unsigned int utmp; u8 buf[2]; dev_dbg(&client->dev, "\n"); - ret = cxd2820r_rd_regs(priv, 0x0205c, buf, 2); + ret = regmap_bulk_read(priv->regmap[0], 0x205c, buf, 2); if (ret) goto error; @@ -228,7 +226,7 @@ int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, break; } - ret = cxd2820r_rd_regs(priv, 0x0225b, buf, 2); + ret = regmap_bulk_read(priv->regmap[0], 0x225b, buf, 2); if (ret) goto error; @@ -268,11 +266,11 @@ int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, break; } - ret = cxd2820r_rd_reg(priv, 0x020b5, &buf[0]); + ret = regmap_read(priv->regmap[0], 0x20b5, &utmp); if (ret) goto error; - switch ((buf[0] >> 4) & 0x01) { + switch ((utmp >> 4) & 0x01) { case 0: c->inversion = INVERSION_OFF; break; @@ -297,7 +295,7 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) u8 buf[4]; /* Lock detection */ - ret = cxd2820r_rd_reg(priv, 0x02010 , &buf[0]); + ret = regmap_bulk_read(priv->regmap[0], 0x2010, &buf[0], 1); if (ret) goto error; @@ -321,7 +319,7 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) if (*status & FE_HAS_SIGNAL) { unsigned int strength; - ret = cxd2820r_rd_regs(priv, 0x02026, buf, 2); + ret = regmap_bulk_read(priv->regmap[0], 0x2026, buf, 2); if (ret) goto error; @@ -342,7 +340,7 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) if (*status & FE_HAS_VITERBI) { unsigned int cnr; - ret = cxd2820r_rd_regs(priv, 0x02028, buf, 2); + ret = regmap_bulk_read(priv->regmap[0], 0x2028, buf, 2); if (ret) goto error; @@ -368,7 +366,7 @@ int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status) if (*status & FE_HAS_SYNC) { unsigned int post_bit_error; - ret = cxd2820r_rd_regs(priv, 0x02039, buf, 4); + ret = regmap_bulk_read(priv->regmap[0], 0x2039, buf, 4); if (ret) goto error; @@ -400,7 +398,7 @@ int cxd2820r_sleep_t2(struct dvb_frontend *fe) { struct cxd2820r_priv *priv = fe->demodulator_priv; struct i2c_client *client = priv->client[0]; - int ret, i; + int ret; struct reg_val_mask tab[] = { { 0x000ff, 0x1f, 0xff }, { 0x00085, 0x00, 0xff }, @@ -412,12 +410,9 @@ int cxd2820r_sleep_t2(struct dvb_frontend *fe) dev_dbg(&client->dev, "\n"); - for (i = 0; i < ARRAY_SIZE(tab); i++) { - ret = cxd2820r_wr_reg_mask(priv, tab[i].reg, tab[i].val, - tab[i].mask); - if (ret) - goto error; - } + ret = cxd2820r_wr_reg_val_mask_tab(priv, tab, ARRAY_SIZE(tab)); + if (ret) + goto error; priv->delivery_system = SYS_UNDEFINED; From 552001e67693487ce339ee6b72a3eeecb03b14e7 Mon Sep 17 00:00:00 2001 From: Ole Ernst Date: Sat, 30 Jul 2016 10:19:27 -0300 Subject: [PATCH 504/591] [media] Partly revert "[media] rc-core: allow calling rc_open with device not initialized" This partly reverts commit 078600f514a12fd763ac84c86af68ef5b5267563. Due to the relocation of input_register_device() call, holding down a button on an IR remote no longer resulted in repeated key down events. Signed-off-by: Ole Ernst Tested-by: Matthias Reichl Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/rc-main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 8e7f2929fa6f..26fd63bdf8e8 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1460,6 +1460,10 @@ int rc_register_device(struct rc_dev *dev) dev->input_dev->phys = dev->input_phys; dev->input_dev->name = dev->input_name; + rc = input_register_device(dev->input_dev); + if (rc) + goto out_table; + /* * Default delay of 250ms is too short for some protocols, especially * since the timeout is currently set to 250ms. Increase it to 500ms, @@ -1475,11 +1479,6 @@ int rc_register_device(struct rc_dev *dev) */ dev->input_dev->rep[REP_PERIOD] = 125; - /* rc_open will be called here */ - rc = input_register_device(dev->input_dev); - if (rc) - goto out_table; - path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL); dev_info(&dev->dev, "%s as %s\n", dev->input_name ?: "Unspecified device", path ?: "N/A"); From 033919e0f8debfc2e5cfb13edf8fbdeff5b47b7d Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sun, 31 Jul 2016 08:56:15 -0300 Subject: [PATCH 505/591] [media] media: rc: fix deadlock when module ir_lirc_codec is removed When removing module ir_lirc_codec I got this deadlock warning. Fix this by introducing a separate mutex to protect access to available_protocols instead of using ir_raw_handler_lock for this purpose. ====================================================== [ INFO: possible circular locking dependency detected ] 4.7.0-next-20160729 #1 Not tainted ------------------------------------------------------- rmmod/2542 is trying to acquire lock: (&dev->lock){+.+.+.}, at: [] ir_raw_handler_unregister+0x77/0xd0 [rc_core] but task is already holding lock: (ir_raw_handler_lock){+.+.+.}, at: [] ir_raw_handler_unregister+0x22/0xd0 [rc_core] which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (ir_raw_handler_lock){+.+.+.}: [] lock_acquire+0xb2/0x1e0 [] mutex_lock_nested+0x5f/0x360 [] ir_raw_get_allowed_protocols+0x13/0x30 [rc_core] [] store_protocols+0x2fa/0x480 [rc_core] [] dev_attr_store+0x13/0x20 [] sysfs_kf_write+0x40/0x50 [] kernfs_fop_write+0x150/0x1e0 [] __vfs_write+0x23/0x120 [] vfs_write+0xb0/0x190 [] SyS_write+0x44/0xa0 [] entry_SYSCALL_64_fastpath+0x18/0xa8 -> #0 (&dev->lock){+.+.+.}: [] __lock_acquire+0x10fc/0x1270 [] lock_acquire+0xb2/0x1e0 [] mutex_lock_nested+0x5f/0x360 [] ir_raw_handler_unregister+0x77/0xd0 [rc_core] [] ir_lirc_codec_exit+0x10/0x12 [ir_lirc_codec] [] SyS_delete_module+0x168/0x220 [] entry_SYSCALL_64_fastpath+0x18/0xa8 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ir_raw_handler_lock); lock(&dev->lock); lock(ir_raw_handler_lock); lock(&dev->lock); *** DEADLOCK *** 1 lock held by rmmod/2542: #0: (ir_raw_handler_lock){+.+.+.}, at: [] ir_raw_handler_unregister+0x22/0xd0 [rc_core] stack backtrace: CPU: 0 PID: 2542 Comm: rmmod Not tainted 4.7.0-next-20160729 #1 Hardware name: ZOTAC ZBOX-CI321NANO/ZBOX-CI321NANO, BIOS B246P105 06/01/2015 0000000000000000 ffff88006e607cc0 ffffffff812715f5 ffffffff8232b230 ffffffff8232b230 ffff88006e607d00 ffffffff810a846e 00000000790107f0 ffff880079010818 ffff8800790107f0 1efeb9f4f0dd2e6f ffff880079010000 Call Trace: [] dump_stack+0x68/0x93 [] print_circular_bug+0x1be/0x210 [] __lock_acquire+0x10fc/0x1270 [] ? debug_lockdep_rcu_enabled+0x1d/0x20 [] lock_acquire+0xb2/0x1e0 [] ? ir_raw_handler_unregister+0x77/0xd0 [rc_core] [] mutex_lock_nested+0x5f/0x360 [] ? ir_raw_handler_unregister+0x77/0xd0 [rc_core] [] ? trace_hardirqs_on_caller+0xee/0x1b0 [] ir_raw_handler_unregister+0x77/0xd0 [rc_core] [] ir_lirc_codec_exit+0x10/0x12 [ir_lirc_codec] [] SyS_delete_module+0x168/0x220 [] entry_SYSCALL_64_fastpath+0x18/0xa8 Signed-off-by: Heiner Kallweit Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/rc-ir-raw.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c index 144304c94606..205ecc602e34 100644 --- a/drivers/media/rc/rc-ir-raw.c +++ b/drivers/media/rc/rc-ir-raw.c @@ -26,6 +26,7 @@ static LIST_HEAD(ir_raw_client_list); /* Used to handle IR raw handler extensions */ static DEFINE_MUTEX(ir_raw_handler_lock); static LIST_HEAD(ir_raw_handler_list); +static DEFINE_MUTEX(available_protocols_lock); static u64 available_protocols; static int ir_raw_event_thread(void *data) @@ -234,9 +235,9 @@ u64 ir_raw_get_allowed_protocols(void) { u64 protocols; - mutex_lock(&ir_raw_handler_lock); + mutex_lock(&available_protocols_lock); protocols = available_protocols; - mutex_unlock(&ir_raw_handler_lock); + mutex_unlock(&available_protocols_lock); return protocols; } @@ -330,7 +331,9 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler) if (ir_raw_handler->raw_register) list_for_each_entry(raw, &ir_raw_client_list, list) ir_raw_handler->raw_register(raw->dev); + mutex_lock(&available_protocols_lock); available_protocols |= ir_raw_handler->protocols; + mutex_unlock(&available_protocols_lock); mutex_unlock(&ir_raw_handler_lock); return 0; @@ -349,7 +352,9 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) if (ir_raw_handler->raw_unregister) ir_raw_handler->raw_unregister(raw->dev); } + mutex_lock(&available_protocols_lock); available_protocols &= ~protocols; + mutex_unlock(&available_protocols_lock); mutex_unlock(&ir_raw_handler_lock); } EXPORT_SYMBOL(ir_raw_handler_unregister); From d14f291b6280a675b7bf129aa9a2d7a077554a31 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Sun, 31 Jul 2016 10:42:55 -0300 Subject: [PATCH 506/591] [media] media: rc: nuvoton: ignore spurious interrupt when logical device is being disabled When removing module nuvoton-cir I get a fifo overrun warning. It turned out to be caused by a spurious interrupt when the logical CIR device is being disabled (although no interrupt source bit being set). Reading the interrupt status register returns 0xff, therefore the fifo overrun bit is mistakenly interpreted as being set. Fix this by ignoring interrupts when interrupt source and status register reads return 0xff. Signed-off-by: Heiner Kallweit Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/nuvoton-cir.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 00215f343819..0c69536ea813 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -886,6 +886,15 @@ static irqreturn_t nvt_cir_isr(int irq, void *data) status = nvt_cir_reg_read(nvt, CIR_IRSTS); iren = nvt_cir_reg_read(nvt, CIR_IREN); + /* At least NCT6779D creates a spurious interrupt when the + * logical device is being disabled. + */ + if (status == 0xff && iren == 0xff) { + spin_unlock_irqrestore(&nvt->nvt_lock, flags); + nvt_dbg_verbose("Spurious interrupt detected"); + return IRQ_HANDLED; + } + /* IRQ may be shared with CIR WAKE, therefore check for each * status bit whether the related interrupt source is enabled */ From bacf8351f23cfdccb0cd252e3df0f82871896f9a Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Tue, 2 Aug 2016 02:44:44 -0300 Subject: [PATCH 507/591] [media] media: rc: nuvoton: remove usage of b_idx in nvt_get_rx_ir_data The call to nvt_get_rx_ir_data and nvt_process_rx_ir_data from the ISR is protected with spinlock nvt->lock. Therefore it's guaranteed that nvt->pkts is 0 when entering nvt_get_rx_ir_data (as nvt->pkts is set to 0 at the end of nvt_process_rx_ir_data). Having said that we can remove b_idx. Signed-off-by: Heiner Kallweit Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/nuvoton-cir.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 0c69536ea813..e4158a962c7a 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -802,7 +802,6 @@ static void nvt_handle_rx_fifo_overrun(struct nvt_dev *nvt) static void nvt_get_rx_ir_data(struct nvt_dev *nvt) { u8 fifocount, val; - unsigned int b_idx; int i; /* Get count of how many bytes to read from RX FIFO */ @@ -810,21 +809,13 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt) nvt_dbg("attempting to fetch %u bytes from hw rx fifo", fifocount); - b_idx = nvt->pkts; - - /* This should never happen, but lets check anyway... */ - if (b_idx + fifocount > RX_BUF_LEN) { - nvt_process_rx_ir_data(nvt); - b_idx = 0; - } - /* Read fifocount bytes from CIR Sample RX FIFO register */ for (i = 0; i < fifocount; i++) { val = nvt_cir_reg_read(nvt, CIR_SRXFIFO); - nvt->buf[b_idx + i] = val; + nvt->buf[i] = val; } - nvt->pkts += fifocount; + nvt->pkts = fifocount; nvt_dbg("%s: pkts now %d", __func__, nvt->pkts); nvt_process_rx_ir_data(nvt); From a2006ca43266d5e069e9020f8dde2846631db9ea Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Tue, 2 Aug 2016 02:45:30 -0300 Subject: [PATCH 508/591] [media] media: rc: nuvoton: remove unneeded call to ir_raw_event_handle ir_raw_event_handle is called anyway after the hw fifo content stored in nvt->buf[] has been written to the kfifo. There is not really a benefit in the potential additional call to ir_raw_event_handle whilst nvt->buf[] is being processed. Getting rid of this additional call allows to simplify the code. Signed-off-by: Heiner Kallweit Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/nuvoton-cir.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index e4158a962c7a..fc462f6bd6bd 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -769,21 +769,11 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) rawir.pulse ? "pulse" : "space", rawir.duration); ir_raw_event_store_with_filter(nvt->rdev, &rawir); - - /* - * BUF_PULSE_BIT indicates end of IR data, BUF_REPEAT_BYTE - * indicates end of IR signal, but new data incoming. In both - * cases, it means we're ready to call ir_raw_event_handle - */ - if ((sample == BUF_PULSE_BIT) && (i + 1 < nvt->pkts)) { - nvt_dbg("Calling ir_raw_event_handle (signal end)\n"); - ir_raw_event_handle(nvt->rdev); - } } nvt->pkts = 0; - nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n"); + nvt_dbg("Calling ir_raw_event_handle\n"); ir_raw_event_handle(nvt->rdev); nvt_dbg_verbose("%s done", __func__); From 6db0168821fa4edc3156d36933da0016740a5e03 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Tue, 2 Aug 2016 02:45:51 -0300 Subject: [PATCH 509/591] [media] media: rc: nuvoton: simplify nvt_get_rx_ir_data a little Simplify the code a little. Signed-off-by: Heiner Kallweit Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/nuvoton-cir.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index fc462f6bd6bd..04fedaa75612 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -791,7 +791,7 @@ static void nvt_handle_rx_fifo_overrun(struct nvt_dev *nvt) /* copy data from hardware rx fifo into driver buffer */ static void nvt_get_rx_ir_data(struct nvt_dev *nvt) { - u8 fifocount, val; + u8 fifocount; int i; /* Get count of how many bytes to read from RX FIFO */ @@ -800,10 +800,8 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt) nvt_dbg("attempting to fetch %u bytes from hw rx fifo", fifocount); /* Read fifocount bytes from CIR Sample RX FIFO register */ - for (i = 0; i < fifocount; i++) { - val = nvt_cir_reg_read(nvt, CIR_SRXFIFO); - nvt->buf[i] = val; - } + for (i = 0; i < fifocount; i++) + nvt->buf[i] = nvt_cir_reg_read(nvt, CIR_SRXFIFO); nvt->pkts = fifocount; nvt_dbg("%s: pkts now %d", __func__, nvt->pkts); From e998c92d6c70851cdc931a0ab5b6d4b554015955 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Mon, 19 Sep 2016 19:21:22 -0300 Subject: [PATCH 510/591] [media] rc: rc6 decoder should report protocol correctly When reporting decoded protocol use the enum rather than the bitmap. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/ir-rc6-decoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index e0e2edefa651..5cc54c967a80 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c @@ -248,7 +248,7 @@ again: toggle = 0; break; case 24: - protocol = RC_BIT_RC6_6A_24; + protocol = RC_TYPE_RC6_6A_24; toggle = 0; break; case 32: @@ -257,7 +257,7 @@ again: toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); scancode &= ~RC6_6A_MCE_TOGGLE_MASK; } else { - protocol = RC_BIT_RC6_6A_32; + protocol = RC_TYPE_RC6_6A_32; toggle = 0; } break; From 00bb820755ed8ee996f076f193d2eadbfba50a2e Mon Sep 17 00:00:00 2001 From: Sean Young Date: Mon, 19 Sep 2016 19:21:23 -0300 Subject: [PATCH 511/591] [media] rc: Hauppauge z8f0811 can decode RC6 The hardware does not decode the 16, 20 or 24 bit variety. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ir-kbd-i2c.c | 90 +++++++++++++------- drivers/media/pci/cx18/cx18-i2c.c | 3 +- drivers/media/pci/cx88/cx88-input.c | 3 +- drivers/media/pci/ivtv/ivtv-i2c.c | 3 +- drivers/media/usb/hdpvr/hdpvr-i2c.c | 2 +- drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | 3 +- 6 files changed, 69 insertions(+), 35 deletions(-) diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index bf82726fd3f4..f95a6bc839d5 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c @@ -35,6 +35,7 @@ * */ +#include #include #include #include @@ -63,51 +64,80 @@ module_param(debug, int, 0644); /* debug level (0,1,2) */ /* ----------------------------------------------------------------------- */ static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol, - u32 *scancode, u8 *ptoggle, int size, int offset) + u32 *scancode, u8 *ptoggle, int size) { unsigned char buf[6]; - int start, range, toggle, dev, code, ircode; + int start, range, toggle, dev, code, ircode, vendor; /* poll IR chip */ if (size != i2c_master_recv(ir->c, buf, size)) return -EIO; - /* split rc5 data block ... */ - start = (buf[offset] >> 7) & 1; - range = (buf[offset] >> 6) & 1; - toggle = (buf[offset] >> 5) & 1; - dev = buf[offset] & 0x1f; - code = (buf[offset+1] >> 2) & 0x3f; + if (buf[0] & 0x80) { + int offset = (size == 6) ? 3 : 0; - /* rc5 has two start bits - * the first bit must be one - * the second bit defines the command range (1 = 0-63, 0 = 64 - 127) - */ - if (!start) - /* no key pressed */ - return 0; + /* split rc5 data block ... */ + start = (buf[offset] >> 7) & 1; + range = (buf[offset] >> 6) & 1; + toggle = (buf[offset] >> 5) & 1; + dev = buf[offset] & 0x1f; + code = (buf[offset+1] >> 2) & 0x3f; - /* filter out invalid key presses */ - ircode = (start << 12) | (toggle << 11) | (dev << 6) | code; - if ((ircode & 0x1fff) == 0x1fff) - return 0; + /* rc5 has two start bits + * the first bit must be one + * the second bit defines the command range: + * 1 = 0-63, 0 = 64 - 127 + */ + if (!start) + /* no key pressed */ + return 0; - if (!range) - code += 64; + /* filter out invalid key presses */ + ircode = (start << 12) | (toggle << 11) | (dev << 6) | code; + if ((ircode & 0x1fff) == 0x1fff) + return 0; - dprintk(1,"ir hauppauge (rc5): s%d r%d t%d dev=%d code=%d\n", - start, range, toggle, dev, code); + if (!range) + code += 64; - *protocol = RC_TYPE_RC5; - *scancode = RC_SCANCODE_RC5(dev, code); - *ptoggle = toggle; - return 1; + dprintk(1, "ir hauppauge (rc5): s%d r%d t%d dev=%d code=%d\n", + start, range, toggle, dev, code); + + *protocol = RC_TYPE_RC5; + *scancode = RC_SCANCODE_RC5(dev, code); + *ptoggle = toggle; + + return 1; + } else if (size == 6 && (buf[0] & 0x40)) { + code = buf[4]; + dev = buf[3]; + vendor = get_unaligned_be16(buf + 1); + + if (vendor == 0x800f) { + *ptoggle = (dev & 0x80) != 0; + *protocol = RC_TYPE_RC6_MCE; + dev &= 0x7f; + dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n", + toggle, vendor, dev, code); + } else { + *ptoggle = 0; + *protocol = RC_TYPE_RC6_6A_32; + dprintk(1, "ir hauppauge (rc6-6a-32): vendor=%d dev=%d code=%d\n", + vendor, dev, code); + } + + *scancode = RC_SCANCODE_RC6_6A(vendor, dev, code); + + return 1; + } + + return 0; } static int get_key_haup(struct IR_i2c *ir, enum rc_type *protocol, u32 *scancode, u8 *toggle) { - return get_key_haup_common (ir, protocol, scancode, toggle, 3, 0); + return get_key_haup_common(ir, protocol, scancode, toggle, 3); } static int get_key_haup_xvr(struct IR_i2c *ir, enum rc_type *protocol, @@ -126,7 +156,7 @@ static int get_key_haup_xvr(struct IR_i2c *ir, enum rc_type *protocol, if (ret != 1) return (ret < 0) ? ret : -EINVAL; - return get_key_haup_common(ir, protocol, scancode, toggle, 6, 3); + return get_key_haup_common(ir, protocol, scancode, toggle, 6); } static int get_key_pixelview(struct IR_i2c *ir, enum rc_type *protocol, @@ -347,7 +377,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) case 0x71: name = "Hauppauge/Zilog Z8"; ir->get_key = get_key_haup_xvr; - rc_type = RC_BIT_RC5; + rc_type = RC_BIT_RC5 | RC_BIT_RC6_MCE | RC_BIT_RC6_6A_32; ir_codes = RC_MAP_HAUPPAUGE; break; } diff --git a/drivers/media/pci/cx18/cx18-i2c.c b/drivers/media/pci/cx18/cx18-i2c.c index 4af8cd6df95d..c9329371a3f8 100644 --- a/drivers/media/pci/cx18/cx18-i2c.c +++ b/drivers/media/pci/cx18/cx18-i2c.c @@ -98,7 +98,8 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, case CX18_HW_Z8F0811_IR_RX_HAUP: init_data->ir_codes = RC_MAP_HAUPPAUGE; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; - init_data->type = RC_BIT_RC5; + init_data->type = RC_BIT_RC5 | RC_BIT_RC6_MCE | + RC_BIT_RC6_6A_32; init_data->name = cx->card_name; info.platform_data = init_data; break; diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c index 3f1342c98b46..21d029b2bbb3 100644 --- a/drivers/media/pci/cx88/cx88-input.c +++ b/drivers/media/pci/cx88/cx88-input.c @@ -631,7 +631,8 @@ void cx88_i2c_init_ir(struct cx88_core *core) /* Hauppauge XVR */ core->init_data.name = "cx88 Hauppauge XVR remote"; core->init_data.ir_codes = RC_MAP_HAUPPAUGE; - core->init_data.type = RC_BIT_RC5; + core->init_data.type = RC_BIT_RC5 | RC_BIT_RC6_MCE | + RC_BIT_RC6_6A_32; core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; info.platform_data = &core->init_data; diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c index dd57442cf086..dea80efd5836 100644 --- a/drivers/media/pci/ivtv/ivtv-i2c.c +++ b/drivers/media/pci/ivtv/ivtv-i2c.c @@ -215,7 +215,8 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) /* Default to grey remote */ init_data->ir_codes = RC_MAP_HAUPPAUGE; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; - init_data->type = RC_BIT_RC5; + init_data->type = RC_BIT_RC5 | RC_BIT_RC6_MCE | + RC_BIT_RC6_6A_32; init_data->name = itv->card_name; break; case IVTV_HW_I2C_IR_RX_ADAPTEC: diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c index 608ae96dc0e5..9b641c4d4431 100644 --- a/drivers/media/usb/hdpvr/hdpvr-i2c.c +++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c @@ -55,7 +55,7 @@ struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev) /* Our default information for ir-kbd-i2c.c to use */ init_data->ir_codes = RC_MAP_HAUPPAUGE; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; - init_data->type = RC_BIT_RC5; + init_data->type = RC_BIT_RC5 | RC_BIT_RC6_MCE | RC_BIT_RC6_6A_32; init_data->name = "HD-PVR"; init_data->polling_interval = 405; /* ms, duplicated from Windows */ hdpvr_ir_rx_i2c_board_info.platform_data = init_data; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c index 14321d0a1833..6da5fb544817 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c @@ -596,7 +596,8 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ init_data->ir_codes = RC_MAP_HAUPPAUGE; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; - init_data->type = RC_BIT_RC5; + init_data->type = RC_BIT_RC5 | RC_BIT_RC6_MCE | + RC_BIT_RC6_6A_32; init_data->name = hdw->hdw_desc->description; /* IR Receiver */ info.addr = 0x71; From 2ceeca0499d745213306ecd785af17adb2321b6a Mon Sep 17 00:00:00 2001 From: Sean Young Date: Wed, 21 Sep 2016 06:54:19 -0300 Subject: [PATCH 512/591] [media] rc: split nec protocol into its three variants Currently we do not know what variant (bit length) of the nec protocol is used, other than from guessing from the length of the scancode. Now nec will be handled the same way as the sony protocol or the rc6 protocol; one variant per bit length. In the future we might want to expose the rc protocol type to userspace and we don't want to be introducing this world of pain into userspace too. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-input.c | 2 +- drivers/media/pci/cx88/cx88-input.c | 5 ++-- drivers/media/pci/saa7134/saa7134-input.c | 4 +-- drivers/media/rc/igorplugusb.c | 3 ++- drivers/media/rc/img-ir/img-ir-nec.c | 6 +++-- drivers/media/rc/ir-nec-decoder.c | 8 ++++-- drivers/media/rc/rc-main.c | 4 ++- drivers/media/usb/au0828/au0828-input.c | 3 ++- drivers/media/usb/dvb-usb-v2/af9015.c | 8 ++++-- drivers/media/usb/dvb-usb-v2/af9035.c | 9 +++++-- drivers/media/usb/dvb-usb-v2/az6007.c | 13 +++++++--- drivers/media/usb/dvb-usb-v2/lmedm04.c | 5 ++-- drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 9 +++++-- drivers/media/usb/dvb-usb/dib0700_core.c | 4 ++- drivers/media/usb/dvb-usb/dtt200u.c | 5 +++- include/media/rc-map.h | 31 ++++++++++++++--------- 16 files changed, 81 insertions(+), 38 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c index 64328d08ac2f..410c3141c163 100644 --- a/drivers/media/pci/cx23885/cx23885-input.c +++ b/drivers/media/pci/cx23885/cx23885-input.c @@ -293,7 +293,7 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: /* Integrated CX23885 IR controller */ driver_type = RC_DRIVER_IR_RAW; - allowed_protos = RC_BIT_NEC; + allowed_protos = RC_BIT_ALL; /* The grey Terratec remote with orange buttons */ rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS; break; diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c index 21d029b2bbb3..cd7687183381 100644 --- a/drivers/media/pci/cx88/cx88-input.c +++ b/drivers/media/pci/cx88/cx88-input.c @@ -144,7 +144,8 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) scancode = RC_SCANCODE_NECX(addr, cmd); if (0 == (gpio & ir->mask_keyup)) - rc_keydown_notimeout(ir->dev, RC_TYPE_NEC, scancode, 0); + rc_keydown_notimeout(ir->dev, RC_TYPE_NECX, scancode, + 0); else rc_keyup(ir->dev); @@ -345,7 +346,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) * 002-T mini RC, provided with newer PV hardware */ ir_codes = RC_MAP_PIXELVIEW_MK12; - rc_type = RC_BIT_NEC; + rc_type = RC_BIT_NECX; ir->gpio_addr = MO_GP1_IO; ir->mask_keyup = 0x80; ir->polling = 10; /* ms */ diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c index c8042c3888cd..eff52bbbfd66 100644 --- a/drivers/media/pci/saa7134/saa7134-input.c +++ b/drivers/media/pci/saa7134/saa7134-input.c @@ -345,7 +345,7 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, enum rc_type *protocol, if (data[9] != (unsigned char)(~data[8])) return 0; - *protocol = RC_TYPE_NEC; + *protocol = RC_TYPE_NECX; *scancode = RC_SCANCODE_NECX(data[11] << 8 | data[10], data[9]); *toggle = 0; return 1; @@ -1035,7 +1035,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) dev->init_data.name = "BeholdTV"; dev->init_data.get_key = get_key_beholdm6xx; dev->init_data.ir_codes = RC_MAP_BEHOLD; - dev->init_data.type = RC_BIT_NEC; + dev->init_data.type = RC_BIT_NECX; info.addr = 0x2d; break; case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c index e0c531fa01da..5cf983be07a2 100644 --- a/drivers/media/rc/igorplugusb.c +++ b/drivers/media/rc/igorplugusb.c @@ -203,7 +203,8 @@ static int igorplugusb_probe(struct usb_interface *intf, * This device can only store 36 pulses + spaces, which is not enough * for the NEC protocol and many others. */ - rc->allowed_protocols = RC_BIT_ALL & ~(RC_BIT_NEC | RC_BIT_RC6_6A_20 | + rc->allowed_protocols = RC_BIT_ALL & ~(RC_BIT_NEC | RC_BIT_NECX | + RC_BIT_NEC32 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SONY20 | RC_BIT_MCE_KBD | RC_BIT_SANYO); diff --git a/drivers/media/rc/img-ir/img-ir-nec.c b/drivers/media/rc/img-ir/img-ir-nec.c index 27a7ea8f1260..09314933ea08 100644 --- a/drivers/media/rc/img-ir/img-ir-nec.c +++ b/drivers/media/rc/img-ir/img-ir-nec.c @@ -34,19 +34,21 @@ static int img_ir_nec_scancode(int len, u64 raw, u64 enabled_protocols, bitrev8(addr_inv) << 16 | bitrev8(data) << 8 | bitrev8(data_inv); + request->protocol = RC_TYPE_NEC32; } else if ((addr_inv ^ addr) != 0xff) { /* Extended NEC */ /* scan encoding: AAaaDD */ request->scancode = addr << 16 | addr_inv << 8 | data; + request->protocol = RC_TYPE_NECX; } else { /* Normal NEC */ /* scan encoding: AADD */ request->scancode = addr << 8 | data; + request->protocol = RC_TYPE_NEC; } - request->protocol = RC_TYPE_NEC; return IMG_IR_SCANCODE; } @@ -109,7 +111,7 @@ static int img_ir_nec_filter(const struct rc_scancode_filter *in, * http://wiki.altium.com/display/ADOH/NEC+Infrared+Transmission+Protocol */ struct img_ir_decoder img_ir_nec = { - .type = RC_BIT_NEC, + .type = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32, .control = { .decoden = 1, .code_type = IMG_IR_CODETYPE_PULSEDIST, diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index bea0d1eedee0..2a9d155548ab 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c @@ -49,6 +49,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) { struct nec_dec *data = &dev->raw->nec; u32 scancode; + enum rc_type rc_type; u8 address, not_address, command, not_command; bool send_32bits = false; @@ -171,22 +172,25 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) * least Apple and TiVo remotes */ scancode = data->bits; IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode); + rc_type = RC_TYPE_NEC32; } else if ((address ^ not_address) != 0xff) { /* Extended NEC */ scancode = address << 16 | not_address << 8 | command; IR_dprintk(1, "NEC (Ext) scancode 0x%06x\n", scancode); + rc_type = RC_TYPE_NECX; } else { /* Normal NEC */ scancode = address << 8 | command; IR_dprintk(1, "NEC scancode 0x%04x\n", scancode); + rc_type = RC_TYPE_NEC; } if (data->is_nec_x) data->necx_repeat = true; - rc_keydown(dev, RC_TYPE_NEC, scancode, 0); + rc_keydown(dev, rc_type, scancode, 0); data->state = STATE_INACTIVE; return 0; } @@ -198,7 +202,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) } static struct ir_raw_handler nec_handler = { - .protocols = RC_BIT_NEC, + .protocols = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32, .decode = ir_nec_decode, }; diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 26fd63bdf8e8..d9c1f2ff7119 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -795,7 +795,9 @@ static const struct { { RC_BIT_UNKNOWN, "unknown", NULL }, { RC_BIT_RC5 | RC_BIT_RC5X, "rc-5", "ir-rc5-decoder" }, - { RC_BIT_NEC, "nec", "ir-nec-decoder" }, + { RC_BIT_NEC | + RC_BIT_NECX | + RC_BIT_NEC32, "nec", "ir-nec-decoder" }, { RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c index 3d6687f0407d..1e66e7828d8f 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -344,7 +344,8 @@ int au0828_rc_register(struct au0828_dev *dev) rc->dev.parent = &dev->usbdev->dev; rc->driver_name = "au0828-input"; rc->driver_type = RC_DRIVER_IR_RAW; - rc->allowed_protocols = RC_BIT_NEC | RC_BIT_RC5; + rc->allowed_protocols = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | + RC_BIT_RC5; /* all done */ err = rc_register_device(rc); diff --git a/drivers/media/usb/dvb-usb-v2/af9015.c b/drivers/media/usb/dvb-usb-v2/af9015.c index 09e0f58f6bb7..941ceff9b268 100644 --- a/drivers/media/usb/dvb-usb-v2/af9015.c +++ b/drivers/media/usb/dvb-usb-v2/af9015.c @@ -1222,6 +1222,7 @@ static int af9015_rc_query(struct dvb_usb_device *d) /* Only process key if canary killed */ if (buf[16] != 0xff && buf[0] != 0x01) { + enum rc_type proto; dev_dbg(&d->udev->dev, "%s: key pressed %*ph\n", __func__, 4, buf + 12); @@ -1237,11 +1238,13 @@ static int af9015_rc_query(struct dvb_usb_device *d) /* NEC */ state->rc_keycode = RC_SCANCODE_NEC(buf[12], buf[14]); + proto = RC_TYPE_NEC; } else { /* NEC extended*/ state->rc_keycode = RC_SCANCODE_NECX(buf[12] << 8 | buf[13], buf[14]); + proto = RC_TYPE_NECX; } } else { /* 32 bit NEC */ @@ -1249,8 +1252,9 @@ static int af9015_rc_query(struct dvb_usb_device *d) buf[13] << 16 | buf[14] << 8 | buf[15]); + proto = RC_TYPE_NEC32; } - rc_keydown(d->rc_dev, RC_TYPE_NEC, state->rc_keycode, 0); + rc_keydown(d->rc_dev, proto, state->rc_keycode, 0); } else { dev_dbg(&d->udev->dev, "%s: no key press\n", __func__); /* Invalidate last keypress */ @@ -1317,7 +1321,7 @@ static int af9015_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) if (!rc->map_name) rc->map_name = RC_MAP_EMPTY; - rc->allowed_protos = RC_BIT_NEC; + rc->allowed_protos = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32; rc->query = af9015_rc_query; rc->interval = 500; diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index ca018cd3fcd4..8961dd732522 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1828,6 +1828,7 @@ static int af9035_rc_query(struct dvb_usb_device *d) { struct usb_interface *intf = d->intf; int ret; + enum rc_type proto; u32 key; u8 buf[4]; struct usb_req req = { CMD_IR_GET, 0, 0, NULL, 4, buf }; @@ -1842,19 +1843,22 @@ static int af9035_rc_query(struct dvb_usb_device *d) if ((buf[0] + buf[1]) == 0xff) { /* NEC standard 16bit */ key = RC_SCANCODE_NEC(buf[0], buf[2]); + proto = RC_TYPE_NEC; } else { /* NEC extended 24bit */ key = RC_SCANCODE_NECX(buf[0] << 8 | buf[1], buf[2]); + proto = RC_TYPE_NECX; } } else { /* NEC full code 32bit */ key = RC_SCANCODE_NEC32(buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]); + proto = RC_TYPE_NEC32; } dev_dbg(&intf->dev, "%*ph\n", 4, buf); - rc_keydown(d->rc_dev, RC_TYPE_NEC, key, 0); + rc_keydown(d->rc_dev, proto, key, 0); return 0; @@ -1889,7 +1893,8 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) switch (tmp) { case 0: /* NEC */ default: - rc->allowed_protos = RC_BIT_NEC; + rc->allowed_protos = RC_BIT_NEC | RC_BIT_NECX | + RC_BIT_NEC32; break; case 1: /* RC6 */ rc->allowed_protos = RC_BIT_RC6_MCE; diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c index 935dbaa80ef0..50c07fe7dacb 100644 --- a/drivers/media/usb/dvb-usb-v2/az6007.c +++ b/drivers/media/usb/dvb-usb-v2/az6007.c @@ -208,6 +208,7 @@ static int az6007_rc_query(struct dvb_usb_device *d) { struct az6007_device_state *st = d_to_priv(d); unsigned code; + enum rc_type proto; az6007_read(d, AZ6007_READ_IR, 0, 0, st->data, 10); @@ -215,19 +216,23 @@ static int az6007_rc_query(struct dvb_usb_device *d) return 0; if ((st->data[3] ^ st->data[4]) == 0xff) { - if ((st->data[1] ^ st->data[2]) == 0xff) + if ((st->data[1] ^ st->data[2]) == 0xff) { code = RC_SCANCODE_NEC(st->data[1], st->data[3]); - else + proto = RC_TYPE_NEC; + } else { code = RC_SCANCODE_NECX(st->data[1] << 8 | st->data[2], st->data[3]); + proto = RC_TYPE_NECX; + } } else { code = RC_SCANCODE_NEC32(st->data[1] << 24 | st->data[2] << 16 | st->data[3] << 8 | st->data[4]); + proto = RC_TYPE_NEC32; } - rc_keydown(d->rc_dev, RC_TYPE_NEC, code, st->data[5]); + rc_keydown(d->rc_dev, proto, code, st->data[5]); return 0; } @@ -236,7 +241,7 @@ static int az6007_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) { pr_debug("Getting az6007 Remote Control properties\n"); - rc->allowed_protos = RC_BIT_NEC; + rc->allowed_protos = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32; rc->query = az6007_rc_query; rc->interval = 400; diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 3721ee63b8fb..0e8fb89896c4 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -357,7 +357,8 @@ static void lme2510_int_response(struct urb *lme_urb) ibuf[5]); deb_info(1, "INT Key = 0x%08x", key); - rc_keydown(adap_to_d(adap)->rc_dev, RC_TYPE_NEC, key, 0); + rc_keydown(adap_to_d(adap)->rc_dev, RC_TYPE_NEC32, key, + 0); break; case 0xbb: switch (st->tuner_config) { @@ -1242,7 +1243,7 @@ static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type, static int lme2510_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) { - rc->allowed_protos = RC_BIT_NEC; + rc->allowed_protos = RC_BIT_NEC32; return 0; } diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index 6643762a9ff7..c583c638e468 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c @@ -1631,22 +1631,27 @@ static int rtl2831u_rc_query(struct dvb_usb_device *d) goto err; if (buf[4] & 0x01) { + enum rc_type proto; + if (buf[2] == (u8) ~buf[3]) { if (buf[0] == (u8) ~buf[1]) { /* NEC standard (16 bit) */ rc_code = RC_SCANCODE_NEC(buf[0], buf[2]); + proto = RC_TYPE_NEC; } else { /* NEC extended (24 bit) */ rc_code = RC_SCANCODE_NECX(buf[0] << 8 | buf[1], buf[2]); + proto = RC_TYPE_NECX; } } else { /* NEC full (32 bit) */ rc_code = RC_SCANCODE_NEC32(buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]); + proto = RC_TYPE_NEC32; } - rc_keydown(d->rc_dev, RC_TYPE_NEC, rc_code, 0); + rc_keydown(d->rc_dev, proto, rc_code, 0); ret = rtl28xxu_wr_reg(d, SYS_IRRC_SR, 1); if (ret) @@ -1668,7 +1673,7 @@ static int rtl2831u_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) { rc->map_name = RC_MAP_EMPTY; - rc->allowed_protos = RC_BIT_NEC; + rc->allowed_protos = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32; rc->query = rtl2831u_rc_query; rc->interval = 400; diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index 26797979ebce..f3196658fb70 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -710,7 +710,6 @@ static void dib0700_rc_urb_completion(struct urb *purb) switch (d->props.rc.core.protocol) { case RC_BIT_NEC: - protocol = RC_TYPE_NEC; toggle = 0; /* NEC protocol sends repeat code as 0 0 0 FF */ @@ -728,16 +727,19 @@ static void dib0700_rc_urb_completion(struct urb *purb) poll_reply->nec.not_system << 16 | poll_reply->nec.data << 8 | poll_reply->nec.not_data); + protocol = RC_TYPE_NEC32; } else if ((poll_reply->nec.system ^ poll_reply->nec.not_system) != 0xff) { deb_data("NEC extended protocol\n"); keycode = RC_SCANCODE_NECX(poll_reply->nec.system << 8 | poll_reply->nec.not_system, poll_reply->nec.data); + protocol = RC_TYPE_NECX; } else { deb_data("NEC normal protocol\n"); keycode = RC_SCANCODE_NEC(poll_reply->nec.system, poll_reply->nec.data); + protocol = RC_TYPE_NEC; } break; diff --git a/drivers/media/usb/dvb-usb/dtt200u.c b/drivers/media/usb/dvb-usb/dtt200u.c index be633ece4194..d2a01b50af0d 100644 --- a/drivers/media/usb/dvb-usb/dtt200u.c +++ b/drivers/media/usb/dvb-usb/dtt200u.c @@ -62,18 +62,21 @@ static int dtt200u_rc_query(struct dvb_usb_device *d) dvb_usb_generic_rw(d,&cmd,1,key,5,0); if (key[0] == 1) { + enum rc_type proto = RC_TYPE_NEC; + scancode = key[1]; if ((u8) ~key[1] != key[2]) { /* Extended NEC */ scancode = scancode << 8; scancode |= key[2]; + proto = RC_TYPE_NECX; } scancode = scancode << 8; scancode |= key[3]; /* Check command checksum is ok */ if ((u8) ~key[3] == key[4]) - rc_keydown(d->rc_dev, RC_TYPE_NEC, scancode, 0); + rc_keydown(d->rc_dev, proto, scancode, 0); else rc_keyup(d->rc_dev); } else if (key[0] == 2) { diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 3c8edb34f84a..e1cc14cba391 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -24,6 +24,8 @@ * @RC_TYPE_SONY15: Sony 15 bit protocol * @RC_TYPE_SONY20: Sony 20 bit protocol * @RC_TYPE_NEC: NEC protocol + * @RC_TYPE_NECX: Extended NEC protocol + * @RC_TYPE_NEC32: NEC 32 bit protocol * @RC_TYPE_SANYO: Sanyo protocol * @RC_TYPE_MCE_KBD: RC6-ish MCE keyboard/mouse * @RC_TYPE_RC6_0: Philips RC6-0-16 protocol @@ -46,16 +48,18 @@ enum rc_type { RC_TYPE_SONY15 = 7, RC_TYPE_SONY20 = 8, RC_TYPE_NEC = 9, - RC_TYPE_SANYO = 10, - RC_TYPE_MCE_KBD = 11, - RC_TYPE_RC6_0 = 12, - RC_TYPE_RC6_6A_20 = 13, - RC_TYPE_RC6_6A_24 = 14, - RC_TYPE_RC6_6A_32 = 15, - RC_TYPE_RC6_MCE = 16, - RC_TYPE_SHARP = 17, - RC_TYPE_XMP = 18, - RC_TYPE_CEC = 19, + RC_TYPE_NECX = 10, + RC_TYPE_NEC32 = 11, + RC_TYPE_SANYO = 12, + RC_TYPE_MCE_KBD = 13, + RC_TYPE_RC6_0 = 14, + RC_TYPE_RC6_6A_20 = 15, + RC_TYPE_RC6_6A_24 = 16, + RC_TYPE_RC6_6A_32 = 17, + RC_TYPE_RC6_MCE = 18, + RC_TYPE_SHARP = 19, + RC_TYPE_XMP = 20, + RC_TYPE_CEC = 21, }; #define RC_BIT_NONE 0ULL @@ -69,6 +73,8 @@ enum rc_type { #define RC_BIT_SONY15 (1ULL << RC_TYPE_SONY15) #define RC_BIT_SONY20 (1ULL << RC_TYPE_SONY20) #define RC_BIT_NEC (1ULL << RC_TYPE_NEC) +#define RC_BIT_NECX (1ULL << RC_TYPE_NECX) +#define RC_BIT_NEC32 (1ULL << RC_TYPE_NEC32) #define RC_BIT_SANYO (1ULL << RC_TYPE_SANYO) #define RC_BIT_MCE_KBD (1ULL << RC_TYPE_MCE_KBD) #define RC_BIT_RC6_0 (1ULL << RC_TYPE_RC6_0) @@ -84,8 +90,9 @@ enum rc_type { RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ RC_BIT_JVC | \ RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ - RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \ - RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ + RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | \ + RC_BIT_SANYO | RC_BIT_MCE_KBD | RC_BIT_RC6_0 | \ + RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \ RC_BIT_XMP | RC_BIT_CEC) From 4a86bc1008e7202b49ccb59f52d7a6be9311ef7d Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Tue, 19 Jul 2016 00:10:20 -0300 Subject: [PATCH 513/591] [media] cxd2841er: freeze/unfreeze registers when reading stats ensure multiple separate register reads are from the same snapshot Signed-off-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2841er.c | 52 +++++++++++++++++++------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index ffe88bc6b813..0a2cd133ad9a 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -1570,6 +1570,25 @@ static int cxd2841er_read_ber_t(struct cxd2841er_priv *priv, return 0; } +static int cxd2841er_freeze_regs(struct cxd2841er_priv *priv) +{ + /* + * Freeze registers: ensure multiple separate register reads + * are from the same snapshot + */ + cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x01); + return 0; +} + +static int cxd2841er_unfreeze_regs(struct cxd2841er_priv *priv) +{ + /* + * un-freeze registers + */ + cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x00); + return 0; +} + static u32 cxd2841er_dvbs_read_snr(struct cxd2841er_priv *priv, u8 delsys, u32 *snr) { @@ -1578,6 +1597,7 @@ static u32 cxd2841er_dvbs_read_snr(struct cxd2841er_priv *priv, int min_index, max_index, index; static const struct cxd2841er_cnr_data *cn_data; + cxd2841er_freeze_regs(priv); /* Set SLV-T Bank : 0xA1 */ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa1); /* @@ -1629,9 +1649,11 @@ static u32 cxd2841er_dvbs_read_snr(struct cxd2841er_priv *priv, } else { dev_dbg(&priv->i2c->dev, "%s(): no data available\n", __func__); + cxd2841er_unfreeze_regs(priv); return -EINVAL; } done: + cxd2841er_unfreeze_regs(priv); *snr = res; return 0; } @@ -1655,12 +1677,7 @@ static int cxd2841er_read_snr_c(struct cxd2841er_priv *priv, u32 *snr) return -EINVAL; } - /* - * Freeze registers: ensure multiple separate register reads - * are from the same snapshot - */ - cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x01); - + cxd2841er_freeze_regs(priv); cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); cxd2841er_read_regs(priv, I2C_SLVT, 0x19, data, 1); qam = (enum sony_dvbc_constellation_t) (data[0] & 0x07); @@ -1670,6 +1687,7 @@ static int cxd2841er_read_snr_c(struct cxd2841er_priv *priv, u32 *snr) if (reg == 0) { dev_dbg(&priv->i2c->dev, "%s(): reg value out of range\n", __func__); + cxd2841er_unfreeze_regs(priv); return 0; } @@ -1690,9 +1708,11 @@ static int cxd2841er_read_snr_c(struct cxd2841er_priv *priv, u32 *snr) *snr = -88 * (int32_t)sony_log(reg) + 86999; break; default: + cxd2841er_unfreeze_regs(priv); return -EINVAL; } + cxd2841er_unfreeze_regs(priv); return 0; } @@ -1707,17 +1727,21 @@ static int cxd2841er_read_snr_t(struct cxd2841er_priv *priv, u32 *snr) "%s(): invalid state %d\n", __func__, priv->state); return -EINVAL; } + + cxd2841er_freeze_regs(priv); cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); reg = ((u32)data[0] << 8) | (u32)data[1]; if (reg == 0) { dev_dbg(&priv->i2c->dev, "%s(): reg value out of range\n", __func__); + cxd2841er_unfreeze_regs(priv); return 0; } if (reg > 4996) reg = 4996; *snr = 10000 * ((intlog10(reg) - intlog10(5350 - reg)) >> 24) + 28500; + cxd2841er_unfreeze_regs(priv); return 0; } @@ -1732,18 +1756,22 @@ static int cxd2841er_read_snr_t2(struct cxd2841er_priv *priv, u32 *snr) "%s(): invalid state %d\n", __func__, priv->state); return -EINVAL; } + + cxd2841er_freeze_regs(priv); cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); reg = ((u32)data[0] << 8) | (u32)data[1]; if (reg == 0) { dev_dbg(&priv->i2c->dev, "%s(): reg value out of range\n", __func__); + cxd2841er_unfreeze_regs(priv); return 0; } if (reg > 10876) reg = 10876; *snr = 10000 * ((intlog10(reg) - intlog10(12600 - reg)) >> 24) + 32000; + cxd2841er_unfreeze_regs(priv); return 0; } @@ -1760,21 +1788,20 @@ static int cxd2841er_read_snr_i(struct cxd2841er_priv *priv, u32 *snr) return -EINVAL; } - /* Freeze all registers */ - cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x01); - - + cxd2841er_freeze_regs(priv); cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); reg = ((u32)data[0] << 8) | (u32)data[1]; if (reg == 0) { dev_dbg(&priv->i2c->dev, "%s(): reg value out of range\n", __func__); + cxd2841er_unfreeze_regs(priv); return 0; } if (reg > 4996) reg = 4996; *snr = 100 * intlog10(reg) - 9031; + cxd2841er_unfreeze_regs(priv); return 0; } @@ -1977,7 +2004,7 @@ static void cxd2841er_read_ucblocks(struct dvb_frontend *fe) { struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct cxd2841er_priv *priv = fe->demodulator_priv; - u32 ucblocks; + u32 ucblocks = 0; dev_dbg(&priv->i2c->dev, "%s()\n", __func__); switch (p->delivery_system) { @@ -1999,7 +2026,7 @@ static void cxd2841er_read_ucblocks(struct dvb_frontend *fe) p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; return; } - dev_dbg(&priv->i2c->dev, "%s()\n", __func__); + dev_dbg(&priv->i2c->dev, "%s() ucblocks=%u\n", __func__, ucblocks); p->block_error.stat[0].scale = FE_SCALE_COUNTER; p->block_error.stat[0].uvalue = ucblocks; @@ -3076,6 +3103,7 @@ static int cxd2841er_sleep_tc_to_active_c(struct cxd2841er_priv *priv, /* Enable demod clock */ cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); /* Disable RF level monitor */ + cxd2841er_write_reg(priv, I2C_SLVT, 0x59, 0x00); cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); /* Enable ADC clock */ cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); From 0ea92c50ad0d3c20db5ad4ee71bc6588baf1dfa9 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Tue, 19 Jul 2016 08:24:42 -0300 Subject: [PATCH 514/591] [media] staging: lirc: add missing platform_device_del() on error Add the missing platform_device_del() before return from lirc_parallel_init() in the error handling case. Signed-off-by: Wei Yongjun --- drivers/staging/media/lirc/lirc_parallel.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c index 3906ac6e686d..878fdea6b111 100644 --- a/drivers/staging/media/lirc/lirc_parallel.c +++ b/drivers/staging/media/lirc/lirc_parallel.c @@ -650,7 +650,7 @@ static int __init lirc_parallel_init(void) if (!pport) { pr_notice("no port at %x found\n", io); result = -ENXIO; - goto exit_device_put; + goto exit_device_del; } ppdevice = parport_register_device(pport, LIRC_DRIVER_NAME, pf, kf, lirc_lirc_irq_handler, 0, @@ -659,7 +659,7 @@ static int __init lirc_parallel_init(void) if (!ppdevice) { pr_notice("parport_register_device() failed\n"); result = -ENXIO; - goto exit_device_put; + goto exit_device_del; } if (parport_claim(ppdevice) != 0) goto skip_init; @@ -678,7 +678,7 @@ static int __init lirc_parallel_init(void) parport_release(pport); parport_unregister_device(ppdevice); result = -EIO; - goto exit_device_put; + goto exit_device_del; } #endif @@ -695,11 +695,13 @@ static int __init lirc_parallel_init(void) pr_notice("register_chrdev() failed\n"); parport_unregister_device(ppdevice); result = -EIO; - goto exit_device_put; + goto exit_device_del; } pr_info("installed using port 0x%04x irq %d\n", io, irq); return 0; +exit_device_del: + platform_device_del(lirc_parallel_dev); exit_device_put: platform_device_put(lirc_parallel_dev); exit_driver_unregister: From e91455a1495ada59e90ae26bc3e68be3b7656570 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 19 Jul 2016 12:14:34 -0300 Subject: [PATCH 515/591] [media] dvb-usb: split out common parts of dibusb Tha ARM randconfig builds came up with another rare build failure for the dib3000mc driver, when dvb-usb-dibusb-mb is built-in and dib3000mc is a loadable module: ERROR: "dibusb_dib3000mc_frontend_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined! ERROR: "dibusb_dib3000mc_tuner_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined! Apparently this used to be a valid configuration (build-time, not run-time), but broke as part of a cleanup. I tried reverting the cleanup, but saw that the code was still wrong then. This tries to fix the code properly, by moving the problematic functions into a new file that now is built as a loadable module or built-in, whichever is correct for a particular configuration. It fixes the regression as well as the runtime problem that already existed. The new module dependency chain is now: dvb-usb-{dibusb_mc,a800,dib0700,umt-010,gp8psk} dvb-usb-dibusb-mb | | | | dvb-usb-dibusb-mc-common | ___________| | | | | | | dib3000mc (frontend) | | | dib3000mb (frontend) | | | | | | dvb-usb-dibusb-common I have also checked the two other files that were changed in the original cleanup, and found them to be correct in either version, so I do not touch that part. As this is a rather obscure bug, there is no need for backports. Fixes: 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED") Signed-off-by: Arnd Bergmann Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/Kconfig | 20 ++- drivers/media/usb/dvb-usb/Makefile | 11 +- drivers/media/usb/dvb-usb/dibusb-common.c | 158 ----------------- drivers/media/usb/dvb-usb/dibusb-mc-common.c | 168 +++++++++++++++++++ 4 files changed, 190 insertions(+), 167 deletions(-) create mode 100644 drivers/media/usb/dvb-usb/dibusb-mc-common.c diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig index f03b0b70c901..8c911119faa6 100644 --- a/drivers/media/usb/dvb-usb/Kconfig +++ b/drivers/media/usb/dvb-usb/Kconfig @@ -20,10 +20,20 @@ config DVB_USB_DEBUG Say Y if you want to enable debugging. See modinfo dvb-usb (and the appropriate drivers) for debug levels. +config DVB_USB_DIB3000MC + tristate + depends on DVB_USB + select DVB_DIB3000MC + help + This is a module with helper functions for accessing the + DIB3000MC from USB DVB devices. It must be a separate module + in case DVB_USB is built-in and DVB_DIB3000MC is a module, + and gets selected automatically when needed. + config DVB_USB_A800 tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)" depends on DVB_USB - select DVB_DIB3000MC + select DVB_USB_DIB3000MC select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT help @@ -54,7 +64,7 @@ config DVB_USB_DIBUSB_MB_FAULTY config DVB_USB_DIBUSB_MC tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)" depends on DVB_USB - select DVB_DIB3000MC + select DVB_USB_DIB3000MC select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT help Support for USB2.0 DVB-T receivers based on reference designs made by @@ -72,7 +82,7 @@ config DVB_USB_DIB0700 select DVB_DIB7000P if MEDIA_SUBDRV_AUTOSELECT select DVB_DIB7000M if MEDIA_SUBDRV_AUTOSELECT select DVB_DIB8000 if MEDIA_SUBDRV_AUTOSELECT - select DVB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT + select DVB_USB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT @@ -99,7 +109,7 @@ config DVB_USB_UMT_010 tristate "HanfTek UMT-010 DVB-T USB2.0 support" depends on DVB_USB select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT - select DVB_DIB3000MC + select DVB_USB_DIB3000MC select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT select DVB_MT352 if MEDIA_SUBDRV_AUTOSELECT help @@ -192,7 +202,7 @@ config DVB_USB_GP8PSK config DVB_USB_NOVA_T_USB2 tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" depends on DVB_USB - select DVB_DIB3000MC + select DVB_USB_DIB3000MC select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT help diff --git a/drivers/media/usb/dvb-usb/Makefile b/drivers/media/usb/dvb-usb/Makefile index acdd1efd4e74..2a7b5a963acf 100644 --- a/drivers/media/usb/dvb-usb/Makefile +++ b/drivers/media/usb/dvb-usb/Makefile @@ -16,20 +16,23 @@ obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o dvb-usb-dibusb-common-objs := dibusb-common.o +dvb-usb-dibusb-mc-common-objs := dibusb-mc-common.o +obj-$(CONFIG_DVB_USB_DIB3000MC) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mc-common.o + dvb-usb-a800-objs := a800.o -obj-$(CONFIG_DVB_USB_A800) += dvb-usb-dibusb-common.o dvb-usb-a800.o +obj-$(CONFIG_DVB_USB_A800) += dvb-usb-a800.o dvb-usb-dibusb-mb-objs := dibusb-mb.o obj-$(CONFIG_DVB_USB_DIBUSB_MB) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mb.o dvb-usb-dibusb-mc-objs := dibusb-mc.o -obj-$(CONFIG_DVB_USB_DIBUSB_MC) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mc.o +obj-$(CONFIG_DVB_USB_DIBUSB_MC) += dvb-usb-dibusb-mc.o dvb-usb-nova-t-usb2-objs := nova-t-usb2.o -obj-$(CONFIG_DVB_USB_NOVA_T_USB2) += dvb-usb-dibusb-common.o dvb-usb-nova-t-usb2.o +obj-$(CONFIG_DVB_USB_NOVA_T_USB2) += dvb-usb-nova-t-usb2.o dvb-usb-umt-010-objs := umt-010.o -obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-dibusb-common.o dvb-usb-umt-010.o +obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-umt-010.o dvb-usb-m920x-objs := m920x.o obj-$(CONFIG_DVB_USB_M920X) += dvb-usb-m920x.o diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c index 6eea4e68891d..4b08c2a47ae2 100644 --- a/drivers/media/usb/dvb-usb/dibusb-common.c +++ b/drivers/media/usb/dvb-usb/dibusb-common.c @@ -184,164 +184,6 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) } EXPORT_SYMBOL(dibusb_read_eeprom_byte); -#if IS_ENABLED(CONFIG_DVB_DIB3000MC) - -/* 3000MC/P stuff */ -// Config Adjacent channels Perf -cal22 -static struct dibx000_agc_config dib3000p_mt2060_agc_config = { - .band_caps = BAND_VHF | BAND_UHF, - .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0), - - .agc1_max = 48497, - .agc1_min = 23593, - .agc2_max = 46531, - .agc2_min = 24904, - - .agc1_pt1 = 0x65, - .agc1_pt2 = 0x69, - - .agc1_slope1 = 0x51, - .agc1_slope2 = 0x27, - - .agc2_pt1 = 0, - .agc2_pt2 = 0x33, - - .agc2_slope1 = 0x35, - .agc2_slope2 = 0x37, -}; - -static struct dib3000mc_config stk3000p_dib3000p_config = { - &dib3000p_mt2060_agc_config, - - .max_time = 0x196, - .ln_adc_level = 0x1cc7, - - .output_mpeg2_in_188_bytes = 1, - - .agc_command1 = 1, - .agc_command2 = 1, -}; - -static struct dibx000_agc_config dib3000p_panasonic_agc_config = { - .band_caps = BAND_VHF | BAND_UHF, - .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0), - - .agc1_max = 56361, - .agc1_min = 22282, - .agc2_max = 47841, - .agc2_min = 36045, - - .agc1_pt1 = 0x3b, - .agc1_pt2 = 0x6b, - - .agc1_slope1 = 0x55, - .agc1_slope2 = 0x1d, - - .agc2_pt1 = 0, - .agc2_pt2 = 0x0a, - - .agc2_slope1 = 0x95, - .agc2_slope2 = 0x1e, -}; - -static struct dib3000mc_config mod3000p_dib3000p_config = { - &dib3000p_panasonic_agc_config, - - .max_time = 0x51, - .ln_adc_level = 0x1cc7, - - .output_mpeg2_in_188_bytes = 1, - - .agc_command1 = 1, - .agc_command2 = 1, -}; - -int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap) -{ - if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON && - le16_to_cpu(adap->dev->udev->descriptor.idProduct) == - USB_PID_LITEON_DVB_T_WARM) { - msleep(1000); - } - - adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, - &adap->dev->i2c_adap, - DEFAULT_DIB3000P_I2C_ADDRESS, - &mod3000p_dib3000p_config); - if ((adap->fe_adap[0].fe) == NULL) - adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, - &adap->dev->i2c_adap, - DEFAULT_DIB3000MC_I2C_ADDRESS, - &mod3000p_dib3000p_config); - if ((adap->fe_adap[0].fe) != NULL) { - if (adap->priv != NULL) { - struct dibusb_state *st = adap->priv; - st->ops.pid_parse = dib3000mc_pid_parse; - st->ops.pid_ctrl = dib3000mc_pid_control; - } - return 0; - } - return -ENODEV; -} -EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach); - -static struct mt2060_config stk3000p_mt2060_config = { - 0x60 -}; - -int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap) -{ - struct dibusb_state *st = adap->priv; - u8 a,b; - u16 if1 = 1220; - struct i2c_adapter *tun_i2c; - - // First IF calibration for Liteon Sticks - if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON && - le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_LITEON_DVB_T_WARM) { - - dibusb_read_eeprom_byte(adap->dev,0x7E,&a); - dibusb_read_eeprom_byte(adap->dev,0x7F,&b); - - if (a == 0x00) - if1 += b; - else if (a == 0x80) - if1 -= b; - else - warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b); - - } else if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_DIBCOM && - le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_DIBCOM_MOD3001_WARM) { - u8 desc; - dibusb_read_eeprom_byte(adap->dev, 7, &desc); - if (desc == 2) { - a = 127; - do { - dibusb_read_eeprom_byte(adap->dev, a, &desc); - a--; - } while (a > 7 && (desc == 0xff || desc == 0x00)); - if (desc & 0x80) - if1 -= (0xff - desc); - else - if1 += desc; - } - } - - tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1); - if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) { - /* not found - use panasonic pll parameters */ - if (dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, tun_i2c, DVB_PLL_ENV57H1XD5) == NULL) - return -ENOMEM; - } else { - st->mt2060_present = 1; - /* set the correct parameters for the dib3000p */ - dib3000mc_set_config(adap->fe_adap[0].fe, &stk3000p_dib3000p_config); - } - return 0; -} -EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); -#endif - /* * common remote control stuff */ diff --git a/drivers/media/usb/dvb-usb/dibusb-mc-common.c b/drivers/media/usb/dvb-usb/dibusb-mc-common.c new file mode 100644 index 000000000000..d66f56cc46a5 --- /dev/null +++ b/drivers/media/usb/dvb-usb/dibusb-mc-common.c @@ -0,0 +1,168 @@ +/* Common methods for dibusb-based-receivers. + * + * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, version 2. + * + * see Documentation/dvb/README.dvb-usb for more information + */ + +#include +#include "dibusb.h" + +/* 3000MC/P stuff */ +// Config Adjacent channels Perf -cal22 +static struct dibx000_agc_config dib3000p_mt2060_agc_config = { + .band_caps = BAND_VHF | BAND_UHF, + .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0), + + .agc1_max = 48497, + .agc1_min = 23593, + .agc2_max = 46531, + .agc2_min = 24904, + + .agc1_pt1 = 0x65, + .agc1_pt2 = 0x69, + + .agc1_slope1 = 0x51, + .agc1_slope2 = 0x27, + + .agc2_pt1 = 0, + .agc2_pt2 = 0x33, + + .agc2_slope1 = 0x35, + .agc2_slope2 = 0x37, +}; + +static struct dib3000mc_config stk3000p_dib3000p_config = { + &dib3000p_mt2060_agc_config, + + .max_time = 0x196, + .ln_adc_level = 0x1cc7, + + .output_mpeg2_in_188_bytes = 1, + + .agc_command1 = 1, + .agc_command2 = 1, +}; + +static struct dibx000_agc_config dib3000p_panasonic_agc_config = { + .band_caps = BAND_VHF | BAND_UHF, + .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0), + + .agc1_max = 56361, + .agc1_min = 22282, + .agc2_max = 47841, + .agc2_min = 36045, + + .agc1_pt1 = 0x3b, + .agc1_pt2 = 0x6b, + + .agc1_slope1 = 0x55, + .agc1_slope2 = 0x1d, + + .agc2_pt1 = 0, + .agc2_pt2 = 0x0a, + + .agc2_slope1 = 0x95, + .agc2_slope2 = 0x1e, +}; + +static struct dib3000mc_config mod3000p_dib3000p_config = { + &dib3000p_panasonic_agc_config, + + .max_time = 0x51, + .ln_adc_level = 0x1cc7, + + .output_mpeg2_in_188_bytes = 1, + + .agc_command1 = 1, + .agc_command2 = 1, +}; + +int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap) +{ + if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON && + le16_to_cpu(adap->dev->udev->descriptor.idProduct) == + USB_PID_LITEON_DVB_T_WARM) { + msleep(1000); + } + + adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, + &adap->dev->i2c_adap, + DEFAULT_DIB3000P_I2C_ADDRESS, + &mod3000p_dib3000p_config); + if ((adap->fe_adap[0].fe) == NULL) + adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, + &adap->dev->i2c_adap, + DEFAULT_DIB3000MC_I2C_ADDRESS, + &mod3000p_dib3000p_config); + if ((adap->fe_adap[0].fe) != NULL) { + if (adap->priv != NULL) { + struct dibusb_state *st = adap->priv; + st->ops.pid_parse = dib3000mc_pid_parse; + st->ops.pid_ctrl = dib3000mc_pid_control; + } + return 0; + } + return -ENODEV; +} +EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach); + +static struct mt2060_config stk3000p_mt2060_config = { + 0x60 +}; + +int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap) +{ + struct dibusb_state *st = adap->priv; + u8 a,b; + u16 if1 = 1220; + struct i2c_adapter *tun_i2c; + + // First IF calibration for Liteon Sticks + if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON && + le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_LITEON_DVB_T_WARM) { + + dibusb_read_eeprom_byte(adap->dev,0x7E,&a); + dibusb_read_eeprom_byte(adap->dev,0x7F,&b); + + if (a == 0x00) + if1 += b; + else if (a == 0x80) + if1 -= b; + else + warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b); + + } else if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_DIBCOM && + le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_DIBCOM_MOD3001_WARM) { + u8 desc; + dibusb_read_eeprom_byte(adap->dev, 7, &desc); + if (desc == 2) { + a = 127; + do { + dibusb_read_eeprom_byte(adap->dev, a, &desc); + a--; + } while (a > 7 && (desc == 0xff || desc == 0x00)); + if (desc & 0x80) + if1 -= (0xff - desc); + else + if1 += desc; + } + } + + tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1); + if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) { + /* not found - use panasonic pll parameters */ + if (dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, tun_i2c, DVB_PLL_ENV57H1XD5) == NULL) + return -ENOMEM; + } else { + st->mt2060_present = 1; + /* set the correct parameters for the dib3000p */ + dib3000mc_set_config(adap->fe_adap[0].fe, &stk3000p_dib3000p_config); + } + return 0; +} +EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); From d0fe85e95f56a01a49e4893aa26263e8aee67eef Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 19 Jul 2016 12:14:35 -0300 Subject: [PATCH 516/591] [media] dvb-usb: avoid link error with dib3000m{b,c| Tha ARM randconfig builds came up with another rare build failure for the dib3000mc driver, when dvb-usb-dibusb-mb is built-in and dib3000mc is a loadable module: ERROR: "dibusb_dib3000mc_frontend_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined! ERROR: "dibusb_dib3000mc_tuner_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined! Apparently this used to be a valid configuration (build-time, not run-time), but broke as part of a cleanup. I tried reverting the cleanup, but saw that the code was still wrong then. This version adds a dependency for dib3000mb, to ensure that dib3000mb does not force the dibusb_dib3000mc_frontend_attach function to be built-in when dib3000mc is a loadable module. I have also checked the two other files that were changed in the original cleanup, and found them to be correct in either version, so I do not touch that part. As this is a rather obscure bug, there is no need for backports. Fixes: 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED") Signed-off-by: Arnd Bergmann Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/usb/dvb-usb/Kconfig b/drivers/media/usb/dvb-usb/Kconfig index 8c911119faa6..959fa09dfd92 100644 --- a/drivers/media/usb/dvb-usb/Kconfig +++ b/drivers/media/usb/dvb-usb/Kconfig @@ -44,6 +44,7 @@ config DVB_USB_DIBUSB_MB depends on DVB_USB select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT select DVB_DIB3000MB + depends on DVB_DIB3000MC || !DVB_DIB3000MC select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT help Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by From 0854df79f4c2cd296f9210a92b9d1bde10a8c5c2 Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Tue, 19 Jul 2016 12:22:03 -0300 Subject: [PATCH 517/591] [media] cxd2841er: BER and SNR reading for ISDB-T Added function to read BER for ISDB-T Also SNR values fixed for ISDB-T Signed-off-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2841er.c | 48 +++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 0a2cd133ad9a..0b64158c306e 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -206,6 +206,9 @@ static const struct cxd2841er_cnr_data s2_cn_data[] = { (u32)(((iffreq)/48.0)*16777216.0 + 0.5) : \ (u32)(((iffreq)/41.0)*16777216.0 + 0.5)) +static int cxd2841er_freeze_regs(struct cxd2841er_priv *priv); +static int cxd2841er_unfreeze_regs(struct cxd2841er_priv *priv); + static void cxd2841er_i2c_debug(struct cxd2841er_priv *priv, u8 addr, u8 reg, u8 write, const u8 *data, u32 len) @@ -1401,6 +1404,41 @@ static int cxd2841er_read_ber_c(struct cxd2841er_priv *priv, return 0; } +static int cxd2841er_read_ber_i(struct cxd2841er_priv *priv, + u32 *bit_error, u32 *bit_count) +{ + u8 data[3]; + u8 pktnum[2]; + + dev_dbg(&priv->i2c->dev, "%s()\n", __func__); + if (priv->state != STATE_ACTIVE_TC) { + dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", + __func__, priv->state); + return -EINVAL; + } + + cxd2841er_freeze_regs(priv); + cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); + cxd2841er_read_regs(priv, I2C_SLVT, 0x5B, pktnum, sizeof(pktnum)); + cxd2841er_read_regs(priv, I2C_SLVT, 0x16, data, sizeof(data)); + + if (!pktnum[0] && !pktnum[1]) { + dev_dbg(&priv->i2c->dev, + "%s(): no valid BER data\n", __func__); + cxd2841er_unfreeze_regs(priv); + return -EINVAL; + } + + *bit_error = ((u32)(data[0] & 0x7F) << 16) | + ((u32)data[1] << 8) | data[2]; + *bit_count = ((((u32)pktnum[0] << 8) | pktnum[1]) * 204 * 8); + dev_dbg(&priv->i2c->dev, "%s(): bit_error=%u bit_count=%u\n", + __func__, *bit_error, *bit_count); + + cxd2841er_unfreeze_regs(priv); + return 0; +} + static int cxd2841er_mon_read_ber_s(struct cxd2841er_priv *priv, u32 *bit_error, u32 *bit_count) { @@ -1798,9 +1836,7 @@ static int cxd2841er_read_snr_i(struct cxd2841er_priv *priv, u32 *snr) cxd2841er_unfreeze_regs(priv); return 0; } - if (reg > 4996) - reg = 4996; - *snr = 100 * intlog10(reg) - 9031; + *snr = 10000 * (intlog10(reg) >> 24) - 9031; cxd2841er_unfreeze_regs(priv); return 0; } @@ -1879,6 +1915,9 @@ static void cxd2841er_read_ber(struct dvb_frontend *fe) case SYS_DVBC_ANNEX_C: ret = cxd2841er_read_ber_c(priv, &bit_error, &bit_count); break; + case SYS_ISDBT: + ret = cxd2841er_read_ber_i(priv, &bit_error, &bit_count); + break; case SYS_DVBS: ret = cxd2841er_mon_read_ber_s(priv, &bit_error, &bit_count); break; @@ -1992,6 +2031,9 @@ static void cxd2841er_read_snr(struct dvb_frontend *fe) return; } + dev_dbg(&priv->i2c->dev, "%s(): snr=%d\n", + __func__, (int32_t)tmp); + if (!ret) { p->cnr.stat[0].scale = FE_SCALE_DECIBEL; p->cnr.stat[0].svalue = tmp; From c7470ff210521e4ca2f4c5217b0d3405528a9b40 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Wed, 20 Jul 2016 14:03:49 -0300 Subject: [PATCH 518/591] [media] redrat3: remove hw_timeout member This is a duplicate of the timeout in rc_dev. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/redrat3.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 8d7df6dfcb20..f4fae0934eca 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -188,9 +188,6 @@ struct redrat3_dev { /* usb dma */ dma_addr_t dma_in; - /* rx signal timeout */ - u32 hw_timeout; - /* Is the device currently transmitting?*/ bool transmitting; @@ -372,7 +369,7 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) /* add a trailing space */ rawir.pulse = false; rawir.timeout = true; - rawir.duration = US_TO_NS(rr3->hw_timeout); + rawir.duration = rr3->rc->timeout; dev_dbg(dev, "storing trailing timeout with duration %d\n", rawir.duration); ir_raw_event_store_with_filter(rr3->rc, &rawir); @@ -495,10 +492,9 @@ static int redrat3_set_timeout(struct rc_dev *rc_dev, unsigned int timeoutns) dev_dbg(dev, "set ir parm timeout %d ret 0x%02x\n", be32_to_cpu(*timeout), ret); - if (ret == sizeof(*timeout)) { - rr3->hw_timeout = timeoutns / 1000; + if (ret == sizeof(*timeout)) ret = 0; - } else if (ret >= 0) + else if (ret >= 0) ret = -EIO; kfree(timeout); @@ -889,7 +885,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3) rc->allowed_protocols = RC_BIT_ALL; rc->min_timeout = MS_TO_NS(RR3_RX_MIN_TIMEOUT); rc->max_timeout = MS_TO_NS(RR3_RX_MAX_TIMEOUT); - rc->timeout = US_TO_NS(rr3->hw_timeout); + rc->timeout = US_TO_NS(redrat3_get_timeout(rr3)); rc->s_timeout = redrat3_set_timeout; rc->tx_ir = redrat3_transmit_ir; rc->s_tx_carrier = redrat3_set_tx_carrier; @@ -998,9 +994,6 @@ static int redrat3_dev_probe(struct usb_interface *intf, if (retval < 0) goto error; - /* store current hardware timeout, in µs */ - rr3->hw_timeout = redrat3_get_timeout(rr3); - /* default.. will get overridden by any sends with a freq defined */ rr3->carrier = 38000; From d6ae162bd13998a6511e5efbc7c19ab542ba1555 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Wed, 20 Jul 2016 14:03:50 -0300 Subject: [PATCH 519/591] [media] redrat3: hardware-specific parameters Add these options as module parameters for now; should other drivers need similar options we could add it to the LIRC api. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/redrat3.c | 50 +++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index f4fae0934eca..05ba47bc0b61 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -124,6 +124,41 @@ #define USB_RR3USB_PRODUCT_ID 0x0001 #define USB_RR3IIUSB_PRODUCT_ID 0x0005 + +/* + * The redrat3 encodes an IR signal as set of different lengths and a set + * of indices into those lengths. This sets how much two lengths must + * differ before they are considered distinct, the value is specified + * in microseconds. + * Default 5, value 0 to 127. + */ +static int length_fuzz = 5; +module_param(length_fuzz, uint, 0644); +MODULE_PARM_DESC(length_fuzz, "Length Fuzz (0-127)"); + +/* + * When receiving a continuous ir stream (for example when a user is + * holding a button down on a remote), this specifies the minimum size + * of a space when the redrat3 sends a irdata packet to the host. Specified + * in miliseconds. Default value 18ms. + * The value can be between 2 and 30 inclusive. + */ +static int minimum_pause = 18; +module_param(minimum_pause, uint, 0644); +MODULE_PARM_DESC(minimum_pause, "Minimum Pause in ms (2-30)"); + +/* + * The carrier frequency is measured during the first pulse of the IR + * signal. The larger the number of periods used To measure, the more + * accurate the result is likely to be, however some signals have short + * initial pulses, so in some case it may be necessary to reduce this value. + * Default 8, value 1 to 255. + */ +static int periods_measure_carrier = 8; +module_param(periods_measure_carrier, uint, 0644); +MODULE_PARM_DESC(periods_measure_carrier, "Number of Periods to Measure Carrier (1-255)"); + + struct redrat3_header { __be16 length; __be16 transfer_type; @@ -525,12 +560,25 @@ static void redrat3_reset(struct redrat3_dev *rr3) RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); dev_dbg(dev, "reset returned 0x%02x\n", rc); - *val = 5; + *val = length_fuzz; rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); + *val = (65536 - (minimum_pause * 2000)) / 256; + rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, + RR3_IR_IO_MIN_PAUSE, 0, val, len, HZ * 25); + dev_dbg(dev, "set ir parm min pause %d rc 0x%02x\n", *val, rc); + + *val = periods_measure_carrier; + rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, + RR3_IR_IO_PERIODS_MF, 0, val, len, HZ * 25); + dev_dbg(dev, "set ir parm periods measure carrier %d rc 0x%02x", *val, + rc); + *val = RR3_DRIVER_MAXLENS; rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, From af4cc4629f2fc17cfeaafebb703acbbcff2c8b21 Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Thu, 21 Jul 2016 10:56:25 -0300 Subject: [PATCH 520/591] [media] cxd2841er: force 8MHz bandwidth for DVB-C if specified bw not supported if specified DVB-C bandwidth not supported then force 8MHz. Should work for most cases. Signed-off-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/cxd2841er.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 0b64158c306e..5afb9c508f65 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -2763,6 +2763,14 @@ static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv, u8 b10_b6[3]; u32 iffreq; + if (bandwidth != 6000000 && + bandwidth != 7000000 && + bandwidth != 8000000) { + dev_info(&priv->i2c->dev, "%s(): unsupported bandwidth %d. Forcing 8Mhz!\n", + __func__, bandwidth); + bandwidth = 8000000; + } + dev_dbg(&priv->i2c->dev, "%s() bw=%d\n", __func__, bandwidth); cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); switch (bandwidth) { From 534e1f3c4f35e198f1ffca2a2372ebe811b6d9f1 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Mon, 25 Jul 2016 11:55:22 -0300 Subject: [PATCH 521/591] [media] cx25821: Drop Freeing of Workqueue Workqueues shouldn't be freed. destroy_workqueue should be used instead. destroy_workqueue safely destroys a workqueue and ensures that all pending work items are done before destroying the workqueue. Signed-off-by: Bhaktipriya Shridhar Acked-by: Tejun Heo Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx25821/cx25821-audio-upstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/cx25821/cx25821-audio-upstream.c b/drivers/media/pci/cx25821/cx25821-audio-upstream.c index 68dbc2dbc982..05bd957a59d0 100644 --- a/drivers/media/pci/cx25821/cx25821-audio-upstream.c +++ b/drivers/media/pci/cx25821/cx25821-audio-upstream.c @@ -242,7 +242,7 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev) dev->_audioframe_count = 0; dev->_audiofile_status = END_OF_FILE; - kfree(dev->_irq_audio_queues); + destroy_workqueue(dev->_irq_audio_queues); dev->_irq_audio_queues = NULL; kfree(dev->_audiofilename); From 072973ba67ecfc842d9d73cc003095267158fc73 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Mon, 25 Jul 2016 12:05:53 -0300 Subject: [PATCH 522/591] [media] cx25821: Remove deprecated create_singlethread_workqueue The workqueue "_irq_audio_queues" runs the audio upstream handler. It has a single work item(&dev->_audio_work_entry) and hence doesn't require ordering. Also, it is not being used on a memory reclaim path. Hence, the singlethreaded workqueue has been replaced with the use of system_wq. System workqueues have been able to handle high level of concurrency for a long time now and hence it's not required to have a singlethreaded workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue created with create_singlethread_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantee unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. The work item has been flushed in cx25821_stop_upstream_audio() to ensure that nothing is pending when the driver is disconnected. Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx25821/cx25821-audio-upstream.c | 14 ++------------ drivers/media/pci/cx25821/cx25821.h | 1 - 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/media/pci/cx25821/cx25821-audio-upstream.c b/drivers/media/pci/cx25821/cx25821-audio-upstream.c index 05bd957a59d0..7c8edb6181ec 100644 --- a/drivers/media/pci/cx25821/cx25821-audio-upstream.c +++ b/drivers/media/pci/cx25821/cx25821-audio-upstream.c @@ -242,8 +242,7 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev) dev->_audioframe_count = 0; dev->_audiofile_status = END_OF_FILE; - destroy_workqueue(dev->_irq_audio_queues); - dev->_irq_audio_queues = NULL; + flush_work(&dev->_audio_work_entry); kfree(dev->_audiofilename); } @@ -446,8 +445,7 @@ static int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, dev->_audioframe_index = dev->_last_index_irq; - queue_work(dev->_irq_audio_queues, - &dev->_audio_work_entry); + schedule_work(&dev->_audio_work_entry); } if (dev->_is_first_audio_frame) { @@ -639,14 +637,6 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) /* Work queue */ INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler); - dev->_irq_audio_queues = - create_singlethread_workqueue("cx25821_audioworkqueue"); - - if (!dev->_irq_audio_queues) { - printk(KERN_DEBUG - pr_fmt("ERROR: create_singlethread_workqueue() for Audio FAILED!\n")); - return -ENOMEM; - } dev->_last_index_irq = 0; dev->_audio_is_running = 0; diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h index 35c7375e4617..ef61dea982e8 100644 --- a/drivers/media/pci/cx25821/cx25821.h +++ b/drivers/media/pci/cx25821/cx25821.h @@ -293,7 +293,6 @@ struct cx25821_dev { u32 audio_upstream_riscbuf_size; u32 audio_upstream_databuf_size; int _audioframe_index; - struct workqueue_struct *_irq_audio_queues; struct work_struct _audio_work_entry; char *input_audiofilename; From dd14523a8e5cf618862dcfa6635297c65f0e26ee Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Mon, 25 Jul 2016 15:38:59 -0300 Subject: [PATCH 523/591] [media] lgdt3306a: remove 20*50 msec unnecessary timeout inside lgdt3306a_search we reading demod status 20 times with 50 msec sleep after each read. This gives us more than 1 sec of delay. Removing this delay should not affect demod functionality. Signed-off-by: Abylay Ospan Acked-by: Michael Ira Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/lgdt3306a.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c index afb9d731e60e..0ca4e810e9d8 100644 --- a/drivers/media/dvb-frontends/lgdt3306a.c +++ b/drivers/media/dvb-frontends/lgdt3306a.c @@ -1737,24 +1737,16 @@ static int lgdt3306a_get_tune_settings(struct dvb_frontend *fe, static int lgdt3306a_search(struct dvb_frontend *fe) { enum fe_status status = 0; - int i, ret; + int ret; /* set frontend */ ret = lgdt3306a_set_parameters(fe); if (ret) goto error; - /* wait frontend lock */ - for (i = 20; i > 0; i--) { - dbg_info(": loop=%d\n", i); - msleep(50); - ret = lgdt3306a_read_status(fe, &status); - if (ret) - goto error; - - if (status & FE_HAS_LOCK) - break; - } + ret = lgdt3306a_read_status(fe, &status); + if (ret) + goto error; /* check if we have a valid signal */ if (status & FE_HAS_LOCK) From c0bf09d047e18e9948a431f7662b20777e540d80 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Mon, 25 Jul 2016 16:19:33 -0300 Subject: [PATCH 524/591] [media] rcar-vin: add R-Car gen2 fallback compatibility string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Such fallback string is present in the 'soc_camera' version of the R-Car VIN driver, so need to add it here as well... Signed-off-by: Sergei Shtylyov Acked-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 6219cbaea940..098a0b1cc10a 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -231,6 +231,7 @@ static const struct of_device_id rvin_of_id_table[] = { { .compatible = "renesas,vin-r8a7790", .data = (void *)RCAR_GEN2 }, { .compatible = "renesas,vin-r8a7779", .data = (void *)RCAR_H1 }, { .compatible = "renesas,vin-r8a7778", .data = (void *)RCAR_M1 }, + { .compatible = "renesas,rcar-gen2-vin", .data = (void *)RCAR_GEN2 }, { }, }; MODULE_DEVICE_TABLE(of, rvin_of_id_table); From 2df9dda07f56c285564ce97ca76a94e70a50df5e Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 26 Jul 2016 03:53:40 -0300 Subject: [PATCH 525/591] [media] si2165: avoid division by zero When si2165_init fails, the clk values in state are still at zero. But the dvb-core ignores the return value of init will call tune afterwards. This will trigger a division by zero when tuning. At least check for the variables to be non-zero before dividing. This happened for a system with WinTV HVR-4400 PCIe-card after suspend-to-disk. Do suspend-to-disk without accessing the DVB device before. After wakeup try to tune. si2165_init fails at checking the chip_mode and aborts. Then si2165_set_if_freq_shift will fail with div-by-zero. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/si2165.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 8bf716a8ea58..849c3c421262 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -751,6 +751,9 @@ static int si2165_set_oversamp(struct si2165_state *state, u32 dvb_rate) u64 oversamp; u32 reg_value; + if (!dvb_rate) + return -EINVAL; + oversamp = si2165_get_fe_clk(state); oversamp <<= 23; do_div(oversamp, dvb_rate); @@ -775,6 +778,9 @@ static int si2165_set_if_freq_shift(struct si2165_state *state) return -EINVAL; } + if (!fe_clk) + return -EINVAL; + fe->ops.tuner_ops.get_if_frequency(fe, &IF); if_freq_shift = IF; if_freq_shift <<= 29; From 7cd785adc4ea4a4f19477a10ea8485aa4bc0d0b1 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 26 Jul 2016 04:09:02 -0300 Subject: [PATCH 526/591] [media] si2165: support i2c_client attach Afterwards it is possible to convert attaching in card drivers. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/si2165.c | 149 +++++++++++++++++++++++++++ drivers/media/dvb-frontends/si2165.h | 22 ++++ 2 files changed, 171 insertions(+) diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 849c3c421262..55127d4cb747 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -40,6 +40,8 @@ */ struct si2165_state { + struct i2c_client *client; + struct i2c_adapter *i2c; struct dvb_frontend fe; @@ -1163,6 +1165,153 @@ error: } EXPORT_SYMBOL(si2165_attach); +static int si2165_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct si2165_state *state = NULL; + struct si2165_platform_data *pdata = client->dev.platform_data; + int n; + int ret = 0; + u8 val; + char rev_char; + const char *chip_name; + + /* allocate memory for the internal state */ + state = kzalloc(sizeof(struct si2165_state), GFP_KERNEL); + if (state == NULL) { + ret = -ENOMEM; + goto error; + } + + /* setup the state */ + state->client = client; + state->i2c = client->adapter; + state->config.i2c_addr = client->addr; + state->config.chip_mode = pdata->chip_mode; + state->config.ref_freq_Hz = pdata->ref_freq_Hz; + state->config.inversion = pdata->inversion; + + if (state->config.ref_freq_Hz < 4000000 + || state->config.ref_freq_Hz > 27000000) { + dev_err(&state->i2c->dev, "%s: ref_freq of %d Hz not supported by this driver\n", + KBUILD_MODNAME, state->config.ref_freq_Hz); + ret = -EINVAL; + goto error; + } + + /* create dvb_frontend */ + memcpy(&state->fe.ops, &si2165_ops, + sizeof(struct dvb_frontend_ops)); + state->fe.ops.release = NULL; + state->fe.demodulator_priv = state; + i2c_set_clientdata(client, state); + + /* powerup */ + ret = si2165_writereg8(state, 0x0000, state->config.chip_mode); + if (ret < 0) + goto nodev_error; + + ret = si2165_readreg8(state, 0x0000, &val); + if (ret < 0) + goto nodev_error; + if (val != state->config.chip_mode) + goto nodev_error; + + ret = si2165_readreg8(state, 0x0023, &state->chip_revcode); + if (ret < 0) + goto nodev_error; + + ret = si2165_readreg8(state, 0x0118, &state->chip_type); + if (ret < 0) + goto nodev_error; + + /* powerdown */ + ret = si2165_writereg8(state, 0x0000, SI2165_MODE_OFF); + if (ret < 0) + goto nodev_error; + + if (state->chip_revcode < 26) + rev_char = 'A' + state->chip_revcode; + else + rev_char = '?'; + + switch (state->chip_type) { + case 0x06: + chip_name = "Si2161"; + state->has_dvbt = true; + break; + case 0x07: + chip_name = "Si2165"; + state->has_dvbt = true; + state->has_dvbc = true; + break; + default: + dev_err(&state->i2c->dev, "%s: Unsupported Silicon Labs chip (type %d, rev %d)\n", + KBUILD_MODNAME, state->chip_type, state->chip_revcode); + goto nodev_error; + } + + dev_info(&state->i2c->dev, + "%s: Detected Silicon Labs %s-%c (type %d, rev %d)\n", + KBUILD_MODNAME, chip_name, rev_char, state->chip_type, + state->chip_revcode); + + strlcat(state->fe.ops.info.name, chip_name, + sizeof(state->fe.ops.info.name)); + + n = 0; + if (state->has_dvbt) { + state->fe.ops.delsys[n++] = SYS_DVBT; + strlcat(state->fe.ops.info.name, " DVB-T", + sizeof(state->fe.ops.info.name)); + } + if (state->has_dvbc) { + state->fe.ops.delsys[n++] = SYS_DVBC_ANNEX_A; + strlcat(state->fe.ops.info.name, " DVB-C", + sizeof(state->fe.ops.info.name)); + } + + /* return fe pointer */ + *pdata->fe = &state->fe; + + return 0; + +nodev_error: + ret = -ENODEV; +error: + kfree(state); + dev_dbg(&client->dev, "failed=%d\n", ret); + return ret; +} + +static int si2165_remove(struct i2c_client *client) +{ + struct si2165_state *state = i2c_get_clientdata(client); + + dev_dbg(&client->dev, "\n"); + + kfree(state); + return 0; +} + +static const struct i2c_device_id si2165_id_table[] = { + {"si2165", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, si2165_id_table); + +static struct i2c_driver si2165_driver = { + .driver = { + .owner = THIS_MODULE, + .name = "si2165", + }, + .probe = si2165_probe, + .remove = si2165_remove, + .id_table = si2165_id_table, +}; + +module_i2c_driver(si2165_driver); + module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); diff --git a/drivers/media/dvb-frontends/si2165.h b/drivers/media/dvb-frontends/si2165.h index 8a15d6a9c552..abbebc9edf0c 100644 --- a/drivers/media/dvb-frontends/si2165.h +++ b/drivers/media/dvb-frontends/si2165.h @@ -28,6 +28,28 @@ enum { SI2165_MODE_PLL_XTAL = 0x21 }; +/* I2C addresses + * possible values: 0x64,0x65,0x66,0x67 + */ +struct si2165_platform_data { + /* + * frontend + * returned by driver + */ + struct dvb_frontend **fe; + + /* external clock or XTAL */ + u8 chip_mode; + + /* frequency of external clock or xtal in Hz + * possible values: 4000000, 16000000, 20000000, 240000000, 27000000 + */ + u32 ref_freq_Hz; + + /* invert the spectrum */ + bool inversion; +}; + struct si2165_config { /* i2c addr * possible values: 0x64,0x65,0x66,0x67 */ From 7cb278b009749140110159e12093a3ec4cb98435 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 26 Jul 2016 04:09:03 -0300 Subject: [PATCH 527/591] [media] cx23885: attach si2165 driver via i2c_client Use new style attach. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-dvb.c | 30 +++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 6855d621b82a..828b54afd59e 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -892,12 +892,6 @@ static const struct tda10071_platform_data hauppauge_tda10071_pdata = { .tuner_i2c_addr = 0x54, }; -static const struct si2165_config hauppauge_hvr4400_si2165_config = { - .i2c_addr = 0x64, - .chip_mode = SI2165_MODE_PLL_XTAL, - .ref_freq_Hz = 16000000, -}; - static const struct m88ds3103_config dvbsky_t9580_m88ds3103_config = { .i2c_addr = 0x68, .clock = 27000000, @@ -1207,6 +1201,7 @@ static int dvb_register(struct cx23885_tsport *port) struct cx23885_i2c *i2c_bus = NULL, *i2c_bus2 = NULL; struct vb2_dvb_frontend *fe0, *fe1 = NULL; struct si2168_config si2168_config; + struct si2165_platform_data si2165_pdata; struct si2157_config si2157_config; struct ts2020_config ts2020_config; struct i2c_board_info info; @@ -1864,9 +1859,26 @@ static int dvb_register(struct cx23885_tsport *port) break; /* port c */ case 2: - fe0->dvb.frontend = dvb_attach(si2165_attach, - &hauppauge_hvr4400_si2165_config, - &i2c_bus->i2c_adap); + /* attach frontend */ + memset(&si2165_pdata, 0, sizeof(si2165_pdata)); + si2165_pdata.fe = &fe0->dvb.frontend; + si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL, + si2165_pdata.ref_freq_Hz = 16000000, + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "si2165", I2C_NAME_SIZE); + info.addr = 0x64; + info.platform_data = &si2165_pdata; + request_module(info.type); + client_demod = i2c_new_device(&i2c_bus->i2c_adap, &info); + if (client_demod == NULL || + client_demod->dev.driver == NULL) + goto frontend_detach; + if (!try_module_get(client_demod->dev.driver->owner)) { + i2c_unregister_device(client_demod); + goto frontend_detach; + } + port->i2c_client_demod = client_demod; + if (fe0->dvb.frontend == NULL) break; fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; From d28d7f852ee4028e41932891e55664abe75f00de Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 26 Jul 2016 04:09:04 -0300 Subject: [PATCH 528/591] [media] cx231xx: Prepare for attaching new style i2c_client DVB demod drivers cx231xx does not yet support attaching new-style i2c_client DVB demod drivers. Add necessary code base on tuner support for i2c_client. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-dvb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index ab2fb9fa0cd1..f03034588343 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -65,6 +65,7 @@ struct cx231xx_dvb { struct dmx_frontend fe_hw; struct dmx_frontend fe_mem; struct dvb_net net; + struct i2c_client *i2c_client_demod; struct i2c_client *i2c_client_tuner; }; @@ -586,8 +587,14 @@ static void unregister_dvb(struct cx231xx_dvb *dvb) dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); dvb_dmxdev_release(&dvb->dmxdev); dvb_dmx_release(&dvb->demux); - client = dvb->i2c_client_tuner; /* remove I2C tuner */ + client = dvb->i2c_client_tuner; + if (client) { + module_put(client->dev.driver->owner); + i2c_unregister_device(client); + } + /* remove I2C demod */ + client = dvb->i2c_client_demod; if (client) { module_put(client->dev.driver->owner); i2c_unregister_device(client); From 773028fefcede683f68d138e5ead3d2e96b32387 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 26 Jul 2016 04:09:05 -0300 Subject: [PATCH 529/591] [media] cx231xx: attach si2165 driver via i2c_client Use new style attach. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-dvb.c | 73 ++++++++++++++++--------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index f03034588343..1417515d30eb 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -151,18 +151,6 @@ static struct tda18271_config pv_tda18271_config = { .small_i2c = TDA18271_03_BYTE_CHUNK_INIT, }; -static const struct si2165_config hauppauge_930C_HD_1113xx_si2165_config = { - .i2c_addr = 0x64, - .chip_mode = SI2165_MODE_PLL_XTAL, - .ref_freq_Hz = 16000000, -}; - -static const struct si2165_config pctv_quatro_stick_1114xx_si2165_config = { - .i2c_addr = 0x64, - .chip_mode = SI2165_MODE_PLL_EXT, - .ref_freq_Hz = 24000000, -}; - static struct lgdt3306a_config hauppauge_955q_lgdt3306a_config = { .i2c_addr = 0x59, .qam_if_khz = 4000, @@ -756,19 +744,38 @@ static int dvb_init(struct cx231xx *dev) break; case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx: + { + struct i2c_client *client; + struct i2c_board_info info; + struct si2165_platform_data si2165_pdata; - dev->dvb->frontend = dvb_attach(si2165_attach, - &hauppauge_930C_HD_1113xx_si2165_config, - demod_i2c - ); + /* attach demod */ + memset(&si2165_pdata, 0, sizeof(si2165_pdata)); + si2165_pdata.fe = &dev->dvb->frontend; + si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL, + si2165_pdata.ref_freq_Hz = 16000000, - if (dev->dvb->frontend == NULL) { + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "si2165", I2C_NAME_SIZE); + info.addr = 0x64; + info.platform_data = &si2165_pdata; + request_module(info.type); + client = i2c_new_device(demod_i2c, &info); + if (client == NULL || client->dev.driver == NULL || dev->dvb->frontend == NULL) { dev_err(dev->dev, "Failed to attach SI2165 front end\n"); result = -EINVAL; goto out_free; } + if (!try_module_get(client->dev.driver->owner)) { + i2c_unregister_device(client); + result = -ENODEV; + goto out_free; + } + + dvb->i2c_client_demod = client; + dev->dvb->frontend->ops.i2c_gate_ctrl = NULL; /* define general-purpose callback pointer */ @@ -781,27 +788,43 @@ static int dvb_init(struct cx231xx *dev) dev->cx231xx_reset_analog_tuner = NULL; break; - + } case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: { struct i2c_client *client; struct i2c_board_info info; + struct si2165_platform_data si2165_pdata; struct si2157_config si2157_config; + /* attach demod */ + memset(&si2165_pdata, 0, sizeof(si2165_pdata)); + si2165_pdata.fe = &dev->dvb->frontend; + si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT, + si2165_pdata.ref_freq_Hz = 24000000, + memset(&info, 0, sizeof(struct i2c_board_info)); - - dev->dvb->frontend = dvb_attach(si2165_attach, - &pctv_quatro_stick_1114xx_si2165_config, - demod_i2c - ); - - if (dev->dvb->frontend == NULL) { + strlcpy(info.type, "si2165", I2C_NAME_SIZE); + info.addr = 0x64; + info.platform_data = &si2165_pdata; + request_module(info.type); + client = i2c_new_device(demod_i2c, &info); + if (client == NULL || client->dev.driver == NULL || dev->dvb->frontend == NULL) { dev_err(dev->dev, "Failed to attach SI2165 front end\n"); result = -EINVAL; goto out_free; } + if (!try_module_get(client->dev.driver->owner)) { + i2c_unregister_device(client); + result = -ENODEV; + goto out_free; + } + + dvb->i2c_client_demod = client; + + memset(&info, 0, sizeof(struct i2c_board_info)); + dev->dvb->frontend->ops.i2c_gate_ctrl = NULL; /* define general-purpose callback pointer */ From 81fd533a972a28f43b080fe7fdc473dac3e988c6 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 26 Jul 2016 04:09:06 -0300 Subject: [PATCH 530/591] [media] si2165: Remove legacy attach Now that all users of legacy attach are converted it can be removed. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/si2165.c | 117 ---------------------- drivers/media/dvb-frontends/si2165.h | 31 ------ drivers/media/dvb-frontends/si2165_priv.h | 17 ++++ 3 files changed, 17 insertions(+), 148 deletions(-) diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 55127d4cb747..5f8081c222b9 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -1011,14 +1011,6 @@ static int si2165_set_frontend(struct dvb_frontend *fe) return 0; } -static void si2165_release(struct dvb_frontend *fe) -{ - struct si2165_state *state = fe->demodulator_priv; - - dprintk("%s: called\n", __func__); - kfree(state); -} - static struct dvb_frontend_ops si2165_ops = { .info = { .name = "Silicon Labs ", @@ -1054,117 +1046,8 @@ static struct dvb_frontend_ops si2165_ops = { .set_frontend = si2165_set_frontend, .read_status = si2165_read_status, - - .release = si2165_release, }; -struct dvb_frontend *si2165_attach(const struct si2165_config *config, - struct i2c_adapter *i2c) -{ - struct si2165_state *state = NULL; - int n; - int io_ret; - u8 val; - char rev_char; - const char *chip_name; - - if (config == NULL || i2c == NULL) - goto error; - - /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct si2165_state), GFP_KERNEL); - if (state == NULL) - goto error; - - /* setup the state */ - state->i2c = i2c; - state->config = *config; - - if (state->config.ref_freq_Hz < 4000000 - || state->config.ref_freq_Hz > 27000000) { - dev_err(&state->i2c->dev, "%s: ref_freq of %d Hz not supported by this driver\n", - KBUILD_MODNAME, state->config.ref_freq_Hz); - goto error; - } - - /* create dvb_frontend */ - memcpy(&state->fe.ops, &si2165_ops, - sizeof(struct dvb_frontend_ops)); - state->fe.demodulator_priv = state; - - /* powerup */ - io_ret = si2165_writereg8(state, 0x0000, state->config.chip_mode); - if (io_ret < 0) - goto error; - - io_ret = si2165_readreg8(state, 0x0000, &val); - if (io_ret < 0) - goto error; - if (val != state->config.chip_mode) - goto error; - - io_ret = si2165_readreg8(state, 0x0023, &state->chip_revcode); - if (io_ret < 0) - goto error; - - io_ret = si2165_readreg8(state, 0x0118, &state->chip_type); - if (io_ret < 0) - goto error; - - /* powerdown */ - io_ret = si2165_writereg8(state, 0x0000, SI2165_MODE_OFF); - if (io_ret < 0) - goto error; - - if (state->chip_revcode < 26) - rev_char = 'A' + state->chip_revcode; - else - rev_char = '?'; - - switch (state->chip_type) { - case 0x06: - chip_name = "Si2161"; - state->has_dvbt = true; - break; - case 0x07: - chip_name = "Si2165"; - state->has_dvbt = true; - state->has_dvbc = true; - break; - default: - dev_err(&state->i2c->dev, "%s: Unsupported Silicon Labs chip (type %d, rev %d)\n", - KBUILD_MODNAME, state->chip_type, state->chip_revcode); - goto error; - } - - dev_info(&state->i2c->dev, - "%s: Detected Silicon Labs %s-%c (type %d, rev %d)\n", - KBUILD_MODNAME, chip_name, rev_char, state->chip_type, - state->chip_revcode); - - strlcat(state->fe.ops.info.name, chip_name, - sizeof(state->fe.ops.info.name)); - - n = 0; - if (state->has_dvbt) { - state->fe.ops.delsys[n++] = SYS_DVBT; - strlcat(state->fe.ops.info.name, " DVB-T", - sizeof(state->fe.ops.info.name)); - } - if (state->has_dvbc) { - state->fe.ops.delsys[n++] = SYS_DVBC_ANNEX_A; - strlcat(state->fe.ops.info.name, " DVB-C", - sizeof(state->fe.ops.info.name)); - } - - return &state->fe; - -error: - kfree(state); - return NULL; -} -EXPORT_SYMBOL(si2165_attach); - static int si2165_probe(struct i2c_client *client, const struct i2c_device_id *id) { diff --git a/drivers/media/dvb-frontends/si2165.h b/drivers/media/dvb-frontends/si2165.h index abbebc9edf0c..76c2ca7d7edb 100644 --- a/drivers/media/dvb-frontends/si2165.h +++ b/drivers/media/dvb-frontends/si2165.h @@ -50,35 +50,4 @@ struct si2165_platform_data { bool inversion; }; -struct si2165_config { - /* i2c addr - * possible values: 0x64,0x65,0x66,0x67 */ - u8 i2c_addr; - - /* external clock or XTAL */ - u8 chip_mode; - - /* frequency of external clock or xtal in Hz - * possible values: 4000000, 16000000, 20000000, 240000000, 27000000 - */ - u32 ref_freq_Hz; - - /* invert the spectrum */ - bool inversion; -}; - -#if IS_REACHABLE(CONFIG_DVB_SI2165) -struct dvb_frontend *si2165_attach( - const struct si2165_config *config, - struct i2c_adapter *i2c); -#else -static inline struct dvb_frontend *si2165_attach( - const struct si2165_config *config, - struct i2c_adapter *i2c) -{ - pr_warn("%s: driver disabled by Kconfig\n", __func__); - return NULL; -} -#endif /* CONFIG_DVB_SI2165 */ - #endif /* _DVB_SI2165_H */ diff --git a/drivers/media/dvb-frontends/si2165_priv.h b/drivers/media/dvb-frontends/si2165_priv.h index 2b70cf12cd79..e5932118834b 100644 --- a/drivers/media/dvb-frontends/si2165_priv.h +++ b/drivers/media/dvb-frontends/si2165_priv.h @@ -20,4 +20,21 @@ #define SI2165_FIRMWARE_REV_D "dvb-demod-si2165.fw" +struct si2165_config { + /* i2c addr + * possible values: 0x64,0x65,0x66,0x67 */ + u8 i2c_addr; + + /* external clock or XTAL */ + u8 chip_mode; + + /* frequency of external clock or xtal in Hz + * possible values: 4000000, 16000000, 20000000, 240000000, 27000000 + */ + u32 ref_freq_Hz; + + /* invert the spectrum */ + bool inversion; +}; + #endif /* _DVB_SI2165_PRIV */ From aa15544909918f55299b49bd51042e242e64c425 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 26 Jul 2016 04:09:07 -0300 Subject: [PATCH 531/591] [media] si2165: use i2c_client->dev instead of i2c_adapter->dev for logging Now that there is a i2c_client, use the more specific dev for logging. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/si2165.c | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 5f8081c222b9..78543872d89d 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -114,7 +114,7 @@ static int si2165_write(struct si2165_state *state, const u16 reg, u8 buf[2 + 4]; /* write a maximum of 4 bytes of data */ if (count + 2 > sizeof(buf)) { - dev_warn(&state->i2c->dev, + dev_warn(&state->client->dev, "%s: i2c wr reg=%04x: count=%d is too big!\n", KBUILD_MODNAME, reg, count); return -EINVAL; @@ -134,7 +134,7 @@ static int si2165_write(struct si2165_state *state, const u16 reg, ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) { - dev_err(&state->i2c->dev, "%s: ret == %d\n", __func__, ret); + dev_err(&state->client->dev, "%s: ret == %d\n", __func__, ret); if (ret < 0) return ret; else @@ -159,7 +159,7 @@ static int si2165_read(struct si2165_state *state, ret = i2c_transfer(state->i2c, msg, 2); if (ret != 2) { - dev_err(&state->i2c->dev, "%s: error (addr %02x reg %04x error (ret == %i)\n", + dev_err(&state->client->dev, "%s: error (addr %02x reg %04x error (ret == %i)\n", __func__, state->config.i2c_addr, reg, ret); if (ret < 0) return ret; @@ -347,7 +347,7 @@ static int si2165_wait_init_done(struct si2165_state *state) return 0; usleep_range(1000, 50000); } - dev_err(&state->i2c->dev, "%s: init_done was not set\n", + dev_err(&state->client->dev, "%s: init_done was not set\n", KBUILD_MODNAME); return ret; } @@ -376,14 +376,14 @@ static int si2165_upload_firmware_block(struct si2165_state *state, wordcount = data[offset]; if (wordcount < 1 || data[offset+1] || data[offset+2] || data[offset+3]) { - dev_warn(&state->i2c->dev, + dev_warn(&state->client->dev, "%s: bad fw data[0..3] = %*ph\n", KBUILD_MODNAME, 4, data); return -EINVAL; } if (offset + 8 + wordcount * 4 > len) { - dev_warn(&state->i2c->dev, + dev_warn(&state->client->dev, "%s: len is too small for block len=%d, wordcount=%d\n", KBUILD_MODNAME, len, wordcount); return -EINVAL; @@ -446,15 +446,15 @@ static int si2165_upload_firmware(struct si2165_state *state) fw_file = SI2165_FIRMWARE_REV_D; break; default: - dev_info(&state->i2c->dev, "%s: no firmware file for revision=%d\n", + dev_info(&state->client->dev, "%s: no firmware file for revision=%d\n", KBUILD_MODNAME, state->chip_revcode); return 0; } /* request the firmware, this will block and timeout */ - ret = request_firmware(&fw, fw_file, state->i2c->dev.parent); + ret = request_firmware(&fw, fw_file, &state->client->dev); if (ret) { - dev_warn(&state->i2c->dev, "%s: firmware file '%s' not found\n", + dev_warn(&state->client->dev, "%s: firmware file '%s' not found\n", KBUILD_MODNAME, fw_file); goto error; } @@ -462,11 +462,11 @@ static int si2165_upload_firmware(struct si2165_state *state) data = fw->data; len = fw->size; - dev_info(&state->i2c->dev, "%s: downloading firmware from file '%s' size=%d\n", + dev_info(&state->client->dev, "%s: downloading firmware from file '%s' size=%d\n", KBUILD_MODNAME, fw_file, len); if (len % 4 != 0) { - dev_warn(&state->i2c->dev, "%s: firmware size is not multiple of 4\n", + dev_warn(&state->client->dev, "%s: firmware size is not multiple of 4\n", KBUILD_MODNAME); ret = -EINVAL; goto error; @@ -474,14 +474,14 @@ static int si2165_upload_firmware(struct si2165_state *state) /* check header (8 bytes) */ if (len < 8) { - dev_warn(&state->i2c->dev, "%s: firmware header is missing\n", + dev_warn(&state->client->dev, "%s: firmware header is missing\n", KBUILD_MODNAME); ret = -EINVAL; goto error; } if (data[0] != 1 || data[1] != 0) { - dev_warn(&state->i2c->dev, "%s: firmware file version is wrong\n", + dev_warn(&state->client->dev, "%s: firmware file version is wrong\n", KBUILD_MODNAME); ret = -EINVAL; goto error; @@ -519,7 +519,7 @@ static int si2165_upload_firmware(struct si2165_state *state) /* start right after the header */ offset = 8; - dev_info(&state->i2c->dev, "%s: si2165_upload_firmware extracted patch_version=0x%02x, block_count=0x%02x, crc_expected=0x%04x\n", + dev_info(&state->client->dev, "%s: si2165_upload_firmware extracted patch_version=0x%02x, block_count=0x%02x, crc_expected=0x%04x\n", KBUILD_MODNAME, patch_version, block_count, crc_expected); ret = si2165_upload_firmware_block(state, data, len, &offset, 1); @@ -538,7 +538,7 @@ static int si2165_upload_firmware(struct si2165_state *state) ret = si2165_upload_firmware_block(state, data, len, &offset, block_count); if (ret < 0) { - dev_err(&state->i2c->dev, + dev_err(&state->client->dev, "%s: firmware could not be uploaded\n", KBUILD_MODNAME); goto error; @@ -550,7 +550,7 @@ static int si2165_upload_firmware(struct si2165_state *state) goto error; if (val16 != crc_expected) { - dev_err(&state->i2c->dev, + dev_err(&state->client->dev, "%s: firmware crc mismatch %04x != %04x\n", KBUILD_MODNAME, val16, crc_expected); ret = -EINVAL; @@ -562,7 +562,7 @@ static int si2165_upload_firmware(struct si2165_state *state) goto error; if (len != offset) { - dev_err(&state->i2c->dev, + dev_err(&state->client->dev, "%s: firmware len mismatch %04x != %04x\n", KBUILD_MODNAME, len, offset); ret = -EINVAL; @@ -579,7 +579,7 @@ static int si2165_upload_firmware(struct si2165_state *state) if (ret < 0) goto error; - dev_info(&state->i2c->dev, "%s: fw load finished\n", KBUILD_MODNAME); + dev_info(&state->client->dev, "%s: fw load finished\n", KBUILD_MODNAME); ret = 0; state->firmware_loaded = true; @@ -613,7 +613,7 @@ static int si2165_init(struct dvb_frontend *fe) if (ret < 0) goto error; if (val != state->config.chip_mode) { - dev_err(&state->i2c->dev, "%s: could not set chip_mode\n", + dev_err(&state->client->dev, "%s: could not set chip_mode\n", KBUILD_MODNAME); return -EINVAL; } @@ -774,7 +774,7 @@ static int si2165_set_if_freq_shift(struct si2165_state *state) u32 IF = 0; if (!fe->ops.tuner_ops.get_if_frequency) { - dev_err(&state->i2c->dev, + dev_err(&state->client->dev, "%s: Error: get_if_frequency() not defined at tuner. Can't work without it!\n", KBUILD_MODNAME); return -EINVAL; @@ -1076,7 +1076,7 @@ static int si2165_probe(struct i2c_client *client, if (state->config.ref_freq_Hz < 4000000 || state->config.ref_freq_Hz > 27000000) { - dev_err(&state->i2c->dev, "%s: ref_freq of %d Hz not supported by this driver\n", + dev_err(&state->client->dev, "%s: ref_freq of %d Hz not supported by this driver\n", KBUILD_MODNAME, state->config.ref_freq_Hz); ret = -EINVAL; goto error; @@ -1129,12 +1129,12 @@ static int si2165_probe(struct i2c_client *client, state->has_dvbc = true; break; default: - dev_err(&state->i2c->dev, "%s: Unsupported Silicon Labs chip (type %d, rev %d)\n", + dev_err(&state->client->dev, "%s: Unsupported Silicon Labs chip (type %d, rev %d)\n", KBUILD_MODNAME, state->chip_type, state->chip_revcode); goto nodev_error; } - dev_info(&state->i2c->dev, + dev_info(&state->client->dev, "%s: Detected Silicon Labs %s-%c (type %d, rev %d)\n", KBUILD_MODNAME, chip_name, rev_char, state->chip_type, state->chip_revcode); From e3ea5e94489bc8c711d422dfa311cfa310553a1b Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 26 Jul 2016 04:09:08 -0300 Subject: [PATCH 532/591] [media] si2165: switch to regmap This avoids some low-level operations. It has the benefit that now register values van be read from /sys/kernel/debug/regmap The maximum register value is just a guess - all higher addresses read as zero. Signed-off-by: Matthias Schwarzott Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/Kconfig | 1 + drivers/media/dvb-frontends/si2165.c | 70 ++++++++++------------------ 2 files changed, 25 insertions(+), 46 deletions(-) diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index c4b67f71d979..012225587c25 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig @@ -67,6 +67,7 @@ config DVB_TDA18271C2DD config DVB_SI2165 tristate "Silicon Labs si2165 based" depends on DVB_CORE && I2C + select REGMAP_I2C default m if !MEDIA_SUBDRV_AUTOSELECT help A DVB-C/T demodulator. diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 78543872d89d..78669ea68c61 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "dvb_frontend.h" #include "dvb_math.h" @@ -42,7 +43,7 @@ struct si2165_state { struct i2c_client *client; - struct i2c_adapter *i2c; + struct regmap *regmap; struct dvb_frontend fe; @@ -110,61 +111,27 @@ static int si2165_write(struct si2165_state *state, const u16 reg, const u8 *src, const int count) { int ret; - struct i2c_msg msg; - u8 buf[2 + 4]; /* write a maximum of 4 bytes of data */ - - if (count + 2 > sizeof(buf)) { - dev_warn(&state->client->dev, - "%s: i2c wr reg=%04x: count=%d is too big!\n", - KBUILD_MODNAME, reg, count); - return -EINVAL; - } - buf[0] = reg >> 8; - buf[1] = reg & 0xff; - memcpy(buf + 2, src, count); - - msg.addr = state->config.i2c_addr; - msg.flags = 0; - msg.buf = buf; - msg.len = count + 2; if (debug & DEBUG_I2C_WRITE) deb_i2c_write("reg: 0x%04x, data: %*ph\n", reg, count, src); - ret = i2c_transfer(state->i2c, &msg, 1); + ret = regmap_bulk_write(state->regmap, reg, src, count); - if (ret != 1) { + if (ret) dev_err(&state->client->dev, "%s: ret == %d\n", __func__, ret); - if (ret < 0) - return ret; - else - return -EREMOTEIO; - } - return 0; + return ret; } static int si2165_read(struct si2165_state *state, const u16 reg, u8 *val, const int count) { - int ret; - u8 reg_buf[] = { reg >> 8, reg & 0xff }; - struct i2c_msg msg[] = { - { .addr = state->config.i2c_addr, - .flags = 0, .buf = reg_buf, .len = 2 }, - { .addr = state->config.i2c_addr, - .flags = I2C_M_RD, .buf = val, .len = count }, - }; + int ret = regmap_bulk_read(state->regmap, reg, val, count); - ret = i2c_transfer(state->i2c, msg, 2); - - if (ret != 2) { + if (ret) { dev_err(&state->client->dev, "%s: error (addr %02x reg %04x error (ret == %i)\n", __func__, state->config.i2c_addr, reg, ret); - if (ret < 0) - return ret; - else - return -EREMOTEIO; + return ret; } if (debug & DEBUG_I2C_READ) @@ -176,9 +143,9 @@ static int si2165_read(struct si2165_state *state, static int si2165_readreg8(struct si2165_state *state, const u16 reg, u8 *val) { - int ret; - - ret = si2165_read(state, reg, val, 1); + unsigned int val_tmp; + int ret = regmap_read(state->regmap, reg, &val_tmp); + *val = (u8)val_tmp; deb_readreg("R(0x%04x)=0x%02x\n", reg, *val); return ret; } @@ -196,7 +163,7 @@ static int si2165_readreg16(struct si2165_state *state, static int si2165_writereg8(struct si2165_state *state, const u16 reg, u8 val) { - return si2165_write(state, reg, &val, 1); + return regmap_write(state->regmap, reg, val); } static int si2165_writereg16(struct si2165_state *state, const u16 reg, u16 val) @@ -1058,6 +1025,11 @@ static int si2165_probe(struct i2c_client *client, u8 val; char rev_char; const char *chip_name; + static const struct regmap_config regmap_config = { + .reg_bits = 16, + .val_bits = 8, + .max_register = 0x08ff, + }; /* allocate memory for the internal state */ state = kzalloc(sizeof(struct si2165_state), GFP_KERNEL); @@ -1066,9 +1038,15 @@ static int si2165_probe(struct i2c_client *client, goto error; } + /* create regmap */ + state->regmap = devm_regmap_init_i2c(client, ®map_config); + if (IS_ERR(state->regmap)) { + ret = PTR_ERR(state->regmap); + goto error; + } + /* setup the state */ state->client = client; - state->i2c = client->adapter; state->config.i2c_addr = client->addr; state->config.chip_mode = pdata->chip_mode; state->config.ref_freq_Hz = pdata->ref_freq_Hz; From e837d85c614e8d6e2d93daed972874ea3a8daec7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 22 Sep 2016 13:37:06 -0300 Subject: [PATCH 533/591] [media] cx23885: Fix some smatch warnings Make sure that it won't go past the config buffers drivers/media/pci/cx23885/cx23885-dvb.c:1733 dvb_register() warn: buffer overflow 'netup_xc5000_config' 2 <= s32max drivers/media/pci/cx23885/cx23885-dvb.c:1745 dvb_register() warn: buffer overflow 'netup_stv0367_config' 2 <= s32max drivers/media/pci/cx23885/cx23885-dvb.c:1752 dvb_register() warn: buffer overflow 'netup_xc5000_config' 2 <= s32max Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-dvb.c | 3 +++ drivers/media/pci/cx23885/cx23885.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 828b54afd59e..818f3c2fc98d 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -1720,6 +1720,9 @@ static int dvb_register(struct cx23885_tsport *port) } break; case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: + if (port->nr > 2) + return 0; + i2c_bus = &dev->i2c_bus[0]; mfe_shared = 1;/* MFE */ port->frontends.gate = 0;/* not clear for me yet */ diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index 2ebece93d111..a6735afe2269 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -257,7 +257,7 @@ struct cx23885_dmaqueue { struct cx23885_tsport { struct cx23885_dev *dev; - int nr; + unsigned nr; int sram_chno; struct vb2_dvb_frontends frontends; From 3cc2691227203c00cac1d82d6b0772224d5c87b2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 22 Sep 2016 14:09:18 -0300 Subject: [PATCH 534/591] [media] ttusb_dec: avoid the risk of go past buffer Fixes this smatch warning: drivers/media/usb/ttusb-dec/ttusb_dec.c:243 ttusb_dec_handle_irq() error: buffer overflow 'rc_keys' 26 <= 126 As the RC keys should be enabled previously, via: set_bit(rc_keys[i], input_dev->keybit); It wouldn't go past the buffer in practice. Yet, as bad things may happen when going past buffer, it doesn't hurt adding a check here. While here, fix CodingStyle issues on the routine. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/ttusb-dec/ttusb_dec.c | 30 +++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c index 4e36e24cb3a6..4e7671a3a1e4 100644 --- a/drivers/media/usb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c @@ -206,7 +206,7 @@ static void ttusb_dec_set_model(struct ttusb_dec *dec, static void ttusb_dec_handle_irq( struct urb *urb) { - struct ttusb_dec * dec = urb->context; + struct ttusb_dec *dec = urb->context; char *buffer = dec->irq_buffer; int retval; @@ -227,25 +227,31 @@ static void ttusb_dec_handle_irq( struct urb *urb) goto exit; } - if( (buffer[0] == 0x1) && (buffer[2] == 0x15) ) { - /* IR - Event */ - /* this is an fact a bit too simple implementation; + if ((buffer[0] == 0x1) && (buffer[2] == 0x15)) { + /* + * IR - Event + * + * this is an fact a bit too simple implementation; * the box also reports a keyrepeat signal * (with buffer[3] == 0x40) in an intervall of ~100ms. * But to handle this correctly we had to imlemenent some * kind of timer which signals a 'key up' event if no * keyrepeat signal is received for lets say 200ms. * this should/could be added later ... - * for now lets report each signal as a key down and up*/ - dprintk("%s:rc signal:%d\n", __func__, buffer[4]); - input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); - input_sync(dec->rc_input_dev); - input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); - input_sync(dec->rc_input_dev); + * for now lets report each signal as a key down and up + */ + if (buffer[4] - 1 < ARRAY_SIZE(rc_keys)) { + dprintk("%s:rc signal:%d\n", __func__, buffer[4]); + input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); + input_sync(dec->rc_input_dev); + input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); + input_sync(dec->rc_input_dev); + } } -exit: retval = usb_submit_urb(urb, GFP_ATOMIC); - if(retval) +exit: + retval = usb_submit_urb(urb, GFP_ATOMIC); + if (retval) printk("%s - usb_commit_urb failed with result: %d\n", __func__, retval); } From c58b84ee467bfd08b39fbda56757ba19ac50980a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 5 Oct 2016 06:46:49 -0300 Subject: [PATCH 535/591] [media] af9005: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/af9005.c | 317 ++++++++++++++++------------- 1 file changed, 180 insertions(+), 137 deletions(-) diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c index efa782ed6e2d..b257780fb380 100644 --- a/drivers/media/usb/dvb-usb/af9005.c +++ b/drivers/media/usb/dvb-usb/af9005.c @@ -52,17 +52,16 @@ u8 regmask[8] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; struct af9005_device_state { u8 sequence; int led_state; + unsigned char data[256]; + struct mutex data_mutex; }; static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, int readwrite, int type, u8 * values, int len) { struct af9005_device_state *st = d->priv; - u8 obuf[16] = { 0 }; - u8 ibuf[17] = { 0 }; - u8 command; - int i; - int ret; + u8 command, seq; + int i, ret; if (len < 1) { err("generic read/write, less than 1 byte. Makes no sense."); @@ -73,16 +72,17 @@ static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, return -EINVAL; } - obuf[0] = 14; /* rest of buffer length low */ - obuf[1] = 0; /* rest of buffer length high */ + mutex_lock(&st->data_mutex); + st->data[0] = 14; /* rest of buffer length low */ + st->data[1] = 0; /* rest of buffer length high */ - obuf[2] = AF9005_REGISTER_RW; /* register operation */ - obuf[3] = 12; /* rest of buffer length */ + st->data[2] = AF9005_REGISTER_RW; /* register operation */ + st->data[3] = 12; /* rest of buffer length */ - obuf[4] = st->sequence++; /* sequence number */ + st->data[4] = seq = st->sequence++; /* sequence number */ - obuf[5] = (u8) (reg >> 8); /* register address */ - obuf[6] = (u8) (reg & 0xff); + st->data[5] = (u8) (reg >> 8); /* register address */ + st->data[6] = (u8) (reg & 0xff); if (type == AF9005_OFDM_REG) { command = AF9005_CMD_OFDM_REG; @@ -96,51 +96,52 @@ static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, command |= readwrite; if (readwrite == AF9005_CMD_WRITE) for (i = 0; i < len; i++) - obuf[8 + i] = values[i]; + st->data[8 + i] = values[i]; else if (type == AF9005_TUNER_REG) /* read command for tuner, the first byte contains the i2c address */ - obuf[8] = values[0]; - obuf[7] = command; + st->data[8] = values[0]; + st->data[7] = command; - ret = dvb_usb_generic_rw(d, obuf, 16, ibuf, 17, 0); + ret = dvb_usb_generic_rw(d, st->data, 16, st->data, 17, 0); if (ret) - return ret; + goto ret; /* sanity check */ - if (ibuf[2] != AF9005_REGISTER_RW_ACK) { + if (st->data[2] != AF9005_REGISTER_RW_ACK) { err("generic read/write, wrong reply code."); - return -EIO; + ret = -EIO; + goto ret; } - if (ibuf[3] != 0x0d) { + if (st->data[3] != 0x0d) { err("generic read/write, wrong length in reply."); - return -EIO; + ret = -EIO; + goto ret; } - if (ibuf[4] != obuf[4]) { + if (st->data[4] != seq) { err("generic read/write, wrong sequence in reply."); - return -EIO; + ret = -EIO; + goto ret; } /* - Windows driver doesn't check these fields, in fact sometimes - the register in the reply is different that what has been sent - - if (ibuf[5] != obuf[5] || ibuf[6] != obuf[6]) { - err("generic read/write, wrong register in reply."); - return -EIO; - } - if (ibuf[7] != command) { - err("generic read/write wrong command in reply."); - return -EIO; - } + * In thesis, both input and output buffers should have + * identical values for st->data[5] to st->data[8]. + * However, windows driver doesn't check these fields, in fact + * sometimes the register in the reply is different that what + * has been sent */ - if (ibuf[16] != 0x01) { + if (st->data[16] != 0x01) { err("generic read/write wrong status code in reply."); - return -EIO; + ret = -EIO; + goto ret; } + if (readwrite == AF9005_CMD_READ) for (i = 0; i < len; i++) - values[i] = ibuf[8 + i]; + values[i] = st->data[8 + i]; - return 0; +ret: + mutex_unlock(&st->data_mutex); + return ret; } @@ -464,8 +465,7 @@ int af9005_send_command(struct dvb_usb_device *d, u8 command, u8 * wbuf, struct af9005_device_state *st = d->priv; int ret, i, packet_len; - u8 buf[64]; - u8 ibuf[64]; + u8 seq; if (wlen < 0) { err("send command, wlen less than 0 bytes. Makes no sense."); @@ -480,94 +480,97 @@ int af9005_send_command(struct dvb_usb_device *d, u8 command, u8 * wbuf, return -EINVAL; } packet_len = wlen + 5; - buf[0] = (u8) (packet_len & 0xff); - buf[1] = (u8) ((packet_len & 0xff00) >> 8); - buf[2] = 0x26; /* packet type */ - buf[3] = wlen + 3; - buf[4] = st->sequence++; - buf[5] = command; - buf[6] = wlen; + mutex_lock(&st->data_mutex); + + st->data[0] = (u8) (packet_len & 0xff); + st->data[1] = (u8) ((packet_len & 0xff00) >> 8); + + st->data[2] = 0x26; /* packet type */ + st->data[3] = wlen + 3; + st->data[4] = seq = st->sequence++; + st->data[5] = command; + st->data[6] = wlen; for (i = 0; i < wlen; i++) - buf[7 + i] = wbuf[i]; - ret = dvb_usb_generic_rw(d, buf, wlen + 7, ibuf, rlen + 7, 0); - if (ret) - return ret; - if (ibuf[2] != 0x27) { + st->data[7 + i] = wbuf[i]; + ret = dvb_usb_generic_rw(d, st->data, wlen + 7, st->data, rlen + 7, 0); + if (st->data[2] != 0x27) { err("send command, wrong reply code."); - return -EIO; - } - if (ibuf[4] != buf[4]) { + ret = -EIO; + } else if (st->data[4] != seq) { err("send command, wrong sequence in reply."); - return -EIO; - } - if (ibuf[5] != 0x01) { + ret = -EIO; + } else if (st->data[5] != 0x01) { err("send command, wrong status code in reply."); - return -EIO; - } - if (ibuf[6] != rlen) { + ret = -EIO; + } else if (st->data[6] != rlen) { err("send command, invalid data length in reply."); - return -EIO; + ret = -EIO; } - for (i = 0; i < rlen; i++) - rbuf[i] = ibuf[i + 7]; - return 0; + if (!ret) { + for (i = 0; i < rlen; i++) + rbuf[i] = st->data[i + 7]; + } + + mutex_unlock(&st->data_mutex); + return ret; } int af9005_read_eeprom(struct dvb_usb_device *d, u8 address, u8 * values, int len) { struct af9005_device_state *st = d->priv; - u8 obuf[16], ibuf[14]; + u8 seq; int ret, i; - memset(obuf, 0, sizeof(obuf)); - memset(ibuf, 0, sizeof(ibuf)); + mutex_lock(&st->data_mutex); - obuf[0] = 14; /* length of rest of packet low */ - obuf[1] = 0; /* length of rest of packer high */ + memset(st->data, 0, sizeof(st->data)); - obuf[2] = 0x2a; /* read/write eeprom */ + st->data[0] = 14; /* length of rest of packet low */ + st->data[1] = 0; /* length of rest of packer high */ - obuf[3] = 12; /* size */ + st->data[2] = 0x2a; /* read/write eeprom */ - obuf[4] = st->sequence++; + st->data[3] = 12; /* size */ - obuf[5] = 0; /* read */ + st->data[4] = seq = st->sequence++; - obuf[6] = len; - obuf[7] = address; - ret = dvb_usb_generic_rw(d, obuf, 16, ibuf, 14, 0); - if (ret) - return ret; - if (ibuf[2] != 0x2b) { + st->data[5] = 0; /* read */ + + st->data[6] = len; + st->data[7] = address; + ret = dvb_usb_generic_rw(d, st->data, 16, st->data, 14, 0); + if (st->data[2] != 0x2b) { err("Read eeprom, invalid reply code"); - return -EIO; - } - if (ibuf[3] != 10) { + ret = -EIO; + } else if (st->data[3] != 10) { err("Read eeprom, invalid reply length"); - return -EIO; - } - if (ibuf[4] != obuf[4]) { + ret = -EIO; + } else if (st->data[4] != seq) { err("Read eeprom, wrong sequence in reply "); - return -EIO; - } - if (ibuf[5] != 1) { + ret = -EIO; + } else if (st->data[5] != 1) { err("Read eeprom, wrong status in reply "); - return -EIO; + ret = -EIO; } - for (i = 0; i < len; i++) { - values[i] = ibuf[6 + i]; + + if (!ret) { + for (i = 0; i < len; i++) + values[i] = st->data[6 + i]; } - return 0; + mutex_unlock(&st->data_mutex); + + return ret; } -static int af9005_boot_packet(struct usb_device *udev, int type, u8 * reply) +static int af9005_boot_packet(struct usb_device *udev, int type, u8 *reply, + u8 *buf, int size) { - u8 buf[FW_BULKOUT_SIZE + 2]; u16 checksum; int act_len, i, ret; - memset(buf, 0, sizeof(buf)); + + memset(buf, 0, size); buf[0] = (u8) (FW_BULKOUT_SIZE & 0xff); buf[1] = (u8) ((FW_BULKOUT_SIZE >> 8) & 0xff); switch (type) { @@ -720,15 +723,21 @@ static int af9005_download_firmware(struct usb_device *udev, const struct firmwa { int i, packets, ret, act_len; - u8 buf[FW_BULKOUT_SIZE + 2]; + u8 *buf; u8 reply; - ret = af9005_boot_packet(udev, FW_CONFIG, &reply); + buf = kmalloc(FW_BULKOUT_SIZE + 2, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ret = af9005_boot_packet(udev, FW_CONFIG, &reply, buf, + FW_BULKOUT_SIZE + 2); if (ret) - return ret; + goto err; if (reply != 0x01) { err("before downloading firmware, FW_CONFIG expected 0x01, received 0x%x", reply); - return -EIO; + ret = -EIO; + goto err; } packets = fw->size / FW_BULKOUT_SIZE; buf[0] = (u8) (FW_BULKOUT_SIZE & 0xff); @@ -743,28 +752,35 @@ static int af9005_download_firmware(struct usb_device *udev, const struct firmwa buf, FW_BULKOUT_SIZE + 2, &act_len, 1000); if (ret) { err("firmware download failed at packet %d with code %d", i, ret); - return ret; + goto err; } } - ret = af9005_boot_packet(udev, FW_CONFIRM, &reply); + ret = af9005_boot_packet(udev, FW_CONFIRM, &reply, + buf, FW_BULKOUT_SIZE + 2); if (ret) - return ret; + goto err; if (reply != (u8) (packets & 0xff)) { err("after downloading firmware, FW_CONFIRM expected 0x%x, received 0x%x", packets & 0xff, reply); - return -EIO; + ret = -EIO; + goto err; } - ret = af9005_boot_packet(udev, FW_BOOT, &reply); + ret = af9005_boot_packet(udev, FW_BOOT, &reply, buf, + FW_BULKOUT_SIZE + 2); if (ret) - return ret; - ret = af9005_boot_packet(udev, FW_CONFIG, &reply); + goto err; + ret = af9005_boot_packet(udev, FW_CONFIG, &reply, buf, + FW_BULKOUT_SIZE + 2); if (ret) - return ret; + goto err; if (reply != 0x02) { err("after downloading firmware, FW_CONFIG expected 0x02, received 0x%x", reply); - return -EIO; + ret = -EIO; + goto err; } - return 0; +err: + kfree(buf); + return ret; } @@ -823,53 +839,59 @@ static int af9005_rc_query(struct dvb_usb_device *d, u32 * event, int *state) { struct af9005_device_state *st = d->priv; int ret, len; - - u8 obuf[5]; - u8 ibuf[256]; + u8 seq; *state = REMOTE_NO_KEY_PRESSED; if (rc_decode == NULL) { /* it shouldn't never come here */ return 0; } + + mutex_lock(&st->data_mutex); + /* deb_info("rc_query\n"); */ - obuf[0] = 3; /* rest of packet length low */ - obuf[1] = 0; /* rest of packet lentgh high */ - obuf[2] = 0x40; /* read remote */ - obuf[3] = 1; /* rest of packet length */ - obuf[4] = st->sequence++; /* sequence number */ - ret = dvb_usb_generic_rw(d, obuf, 5, ibuf, 256, 0); + st->data[0] = 3; /* rest of packet length low */ + st->data[1] = 0; /* rest of packet lentgh high */ + st->data[2] = 0x40; /* read remote */ + st->data[3] = 1; /* rest of packet length */ + st->data[4] = seq = st->sequence++; /* sequence number */ + ret = dvb_usb_generic_rw(d, st->data, 5, st->data, 256, 0); if (ret) { err("rc query failed"); - return ret; + goto ret; } - if (ibuf[2] != 0x41) { + if (st->data[2] != 0x41) { err("rc query bad header."); - return -EIO; - } - if (ibuf[4] != obuf[4]) { + ret = -EIO; + goto ret; + } else if (st->data[4] != seq) { err("rc query bad sequence."); - return -EIO; + ret = -EIO; + goto ret; } - len = ibuf[5]; + len = st->data[5]; if (len > 246) { err("rc query invalid length"); - return -EIO; + ret = -EIO; + goto ret; } if (len > 0) { deb_rc("rc data (%d) ", len); - debug_dump((ibuf + 6), len, deb_rc); - ret = rc_decode(d, &ibuf[6], len, event, state); + debug_dump((st->data + 6), len, deb_rc); + ret = rc_decode(d, &st->data[6], len, event, state); if (ret) { err("rc_decode failed"); - return ret; + goto ret; } else { deb_rc("rc_decode state %x event %x\n", *state, *event); if (*state == REMOTE_KEY_REPEAT) *event = d->last_event; } } - return 0; + +ret: + mutex_unlock(&st->data_mutex); + return ret; } static int af9005_power_ctrl(struct dvb_usb_device *d, int onoff) @@ -953,10 +975,16 @@ static int af9005_identify_state(struct usb_device *udev, int *cold) { int ret; - u8 reply; - ret = af9005_boot_packet(udev, FW_CONFIG, &reply); + u8 reply, *buf; + + buf = kmalloc(FW_BULKOUT_SIZE + 2, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ret = af9005_boot_packet(udev, FW_CONFIG, &reply, + buf, FW_BULKOUT_SIZE + 2); if (ret) - return ret; + goto err; deb_info("result of FW_CONFIG in identify state %d\n", reply); if (reply == 0x01) *cold = 1; @@ -965,7 +993,10 @@ static int af9005_identify_state(struct usb_device *udev, else return -EIO; deb_info("Identify state cold = %d\n", *cold); - return 0; + +err: + kfree(buf); + return ret; } static struct dvb_usb_device_properties af9005_properties; @@ -973,8 +1004,20 @@ static struct dvb_usb_device_properties af9005_properties; static int af9005_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { - return dvb_usb_device_init(intf, &af9005_properties, - THIS_MODULE, NULL, adapter_nr); + struct dvb_usb_device *d; + struct af9005_device_state *st; + int ret; + + ret = dvb_usb_device_init(intf, &af9005_properties, + THIS_MODULE, &d, adapter_nr); + + if (ret < 0) + return ret; + + st = d->priv; + mutex_init(&st->data_mutex); + + return 0; } enum af9005_usb_table_entry { From 5ef8ed0e5608f75805e41ef8abbe94a3597e6613 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 5 Oct 2016 06:02:19 -0300 Subject: [PATCH 536/591] [media] cinergyT2-core: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/cinergyT2-core.c | 84 ++++++++++++++++------ 1 file changed, 61 insertions(+), 23 deletions(-) diff --git a/drivers/media/usb/dvb-usb/cinergyT2-core.c b/drivers/media/usb/dvb-usb/cinergyT2-core.c index 9fd1527494eb..d85c0c4d4042 100644 --- a/drivers/media/usb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/usb/dvb-usb/cinergyT2-core.c @@ -41,6 +41,8 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct cinergyt2_state { u8 rc_counter; + unsigned char data[64]; + struct mutex data_mutex; }; /* We are missing a release hook with usb_device data */ @@ -50,33 +52,52 @@ static struct dvb_usb_device_properties cinergyt2_properties; static int cinergyt2_streaming_ctrl(struct dvb_usb_adapter *adap, int enable) { - char buf[] = { CINERGYT2_EP1_CONTROL_STREAM_TRANSFER, enable ? 1 : 0 }; - char result[64]; - return dvb_usb_generic_rw(adap->dev, buf, sizeof(buf), result, - sizeof(result), 0); + struct dvb_usb_device *d = adap->dev; + struct cinergyt2_state *st = d->priv; + int ret; + + mutex_lock(&st->data_mutex); + st->data[0] = CINERGYT2_EP1_CONTROL_STREAM_TRANSFER; + st->data[1] = enable ? 1 : 0; + + ret = dvb_usb_generic_rw(d, st->data, 2, st->data, 64, 0); + mutex_unlock(&st->data_mutex); + + return ret; } static int cinergyt2_power_ctrl(struct dvb_usb_device *d, int enable) { - char buf[] = { CINERGYT2_EP1_SLEEP_MODE, enable ? 0 : 1 }; - char state[3]; - return dvb_usb_generic_rw(d, buf, sizeof(buf), state, sizeof(state), 0); + struct cinergyt2_state *st = d->priv; + int ret; + + mutex_lock(&st->data_mutex); + st->data[0] = CINERGYT2_EP1_SLEEP_MODE; + st->data[1] = enable ? 0 : 1; + + ret = dvb_usb_generic_rw(d, st->data, 2, st->data, 3, 0); + mutex_unlock(&st->data_mutex); + + return ret; } static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) { - char query[] = { CINERGYT2_EP1_GET_FIRMWARE_VERSION }; - char state[3]; + struct dvb_usb_device *d = adap->dev; + struct cinergyt2_state *st = d->priv; int ret; adap->fe_adap[0].fe = cinergyt2_fe_attach(adap->dev); - ret = dvb_usb_generic_rw(adap->dev, query, sizeof(query), state, - sizeof(state), 0); + mutex_lock(&st->data_mutex); + st->data[0] = CINERGYT2_EP1_GET_FIRMWARE_VERSION; + + ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 3, 0); if (ret < 0) { deb_rc("cinergyt2_power_ctrl() Failed to retrieve sleep " "state info\n"); } + mutex_unlock(&st->data_mutex); /* Copy this pointer as we are gonna need it in the release phase */ cinergyt2_usb_device = adap->dev; @@ -141,13 +162,16 @@ static int repeatable_keys[] = { static int cinergyt2_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { struct cinergyt2_state *st = d->priv; - u8 key[5] = {0, 0, 0, 0, 0}, cmd = CINERGYT2_EP1_GET_RC_EVENTS; int i; *state = REMOTE_NO_KEY_PRESSED; - dvb_usb_generic_rw(d, &cmd, 1, key, sizeof(key), 0); - if (key[4] == 0xff) { + mutex_lock(&st->data_mutex); + st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS; + + dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0); + + if (st->data[4] == 0xff) { /* key repeat */ st->rc_counter++; if (st->rc_counter > RC_REPEAT_DELAY) { @@ -157,31 +181,45 @@ static int cinergyt2_rc_query(struct dvb_usb_device *d, u32 *event, int *state) *event = d->last_event; deb_rc("repeat key, event %x\n", *event); - return 0; + goto ret; } } deb_rc("repeated key (non repeatable)\n"); } - return 0; + goto ret; } /* hack to pass checksum on the custom field */ - key[2] = ~key[1]; - dvb_usb_nec_rc_key_to_event(d, key, event, state); - if (key[0] != 0) { + st->data[2] = ~st->data[1]; + dvb_usb_nec_rc_key_to_event(d, st->data, event, state); + if (st->data[0] != 0) { if (*event != d->last_event) st->rc_counter = 0; - deb_rc("key: %*ph\n", 5, key); + deb_rc("key: %*ph\n", 5, st->data); } - return 0; + +ret: + mutex_unlock(&st->data_mutex); + return ret; } static int cinergyt2_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { - return dvb_usb_device_init(intf, &cinergyt2_properties, - THIS_MODULE, NULL, adapter_nr); + struct dvb_usb_device *d; + struct cinergyt2_state *st; + int ret; + + ret = dvb_usb_device_init(intf, &cinergyt2_properties, + THIS_MODULE, &d, adapter_nr); + if (ret < 0) + return ret; + + st = d->priv; + mutex_init(&st->data_mutex); + + return 0; } From 54d577a4c91ba5dfe634ddee26223bc9a39687a7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 13:54:33 -0300 Subject: [PATCH 537/591] [media] cinergyT2-core: handle error code on RC query There's no sense on decoding and generating a RC key code if there was an error on the URB control message. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/cinergyT2-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb/cinergyT2-core.c b/drivers/media/usb/dvb-usb/cinergyT2-core.c index d85c0c4d4042..8ac825413d5a 100644 --- a/drivers/media/usb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/usb/dvb-usb/cinergyT2-core.c @@ -102,7 +102,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) /* Copy this pointer as we are gonna need it in the release phase */ cinergyt2_usb_device = adap->dev; - return 0; + return ret; } static struct rc_map_table rc_map_cinergyt2_table[] = { @@ -162,14 +162,16 @@ static int repeatable_keys[] = { static int cinergyt2_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { struct cinergyt2_state *st = d->priv; - int i; + int i, ret; *state = REMOTE_NO_KEY_PRESSED; mutex_lock(&st->data_mutex); st->data[0] = CINERGYT2_EP1_GET_RC_EVENTS; - dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0); + ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0); + if (ret < 0) + goto ret; if (st->data[4] == 0xff) { /* key repeat */ From c2730eef5fa180eec853f3775bebc4d74e6e6697 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 06:07:36 -0300 Subject: [PATCH 538/591] [media] cinergyT2-fe: cache stats at cinergyt2_fe_read_status() Instead of sending USB commands for every stats call, collect them once, when status is updated. As the frontend kthread will call it on every few seconds, the stats will still be collected. Besides reducing the amount of USB/I2C transfers, this also warrants that all stats will be collected at the same time, and makes easier to convert it to DVBv5 stats in the future. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/cinergyT2-fe.c | 48 ++++-------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/drivers/media/usb/dvb-usb/cinergyT2-fe.c b/drivers/media/usb/dvb-usb/cinergyT2-fe.c index b3ec743a7a2e..fd8edcb56e61 100644 --- a/drivers/media/usb/dvb-usb/cinergyT2-fe.c +++ b/drivers/media/usb/dvb-usb/cinergyT2-fe.c @@ -139,6 +139,7 @@ static uint16_t compute_tps(struct dtv_frontend_properties *op) struct cinergyt2_fe_state { struct dvb_frontend fe; struct dvb_usb_device *d; + struct dvbt_get_status_msg status; }; static int cinergyt2_fe_read_status(struct dvb_frontend *fe, @@ -154,6 +155,8 @@ static int cinergyt2_fe_read_status(struct dvb_frontend *fe, if (ret < 0) return ret; + state->status = result; + *status = 0; if (0xffff - le16_to_cpu(result.gain) > 30) @@ -177,34 +180,16 @@ static int cinergyt2_fe_read_status(struct dvb_frontend *fe, static int cinergyt2_fe_read_ber(struct dvb_frontend *fe, u32 *ber) { struct cinergyt2_fe_state *state = fe->demodulator_priv; - struct dvbt_get_status_msg status; - char cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS }; - int ret; - ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (char *)&status, - sizeof(status), 0); - if (ret < 0) - return ret; - - *ber = le32_to_cpu(status.viterbi_error_rate); + *ber = le32_to_cpu(state->status.viterbi_error_rate); return 0; } static int cinergyt2_fe_read_unc_blocks(struct dvb_frontend *fe, u32 *unc) { struct cinergyt2_fe_state *state = fe->demodulator_priv; - struct dvbt_get_status_msg status; - u8 cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS }; - int ret; - ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (u8 *)&status, - sizeof(status), 0); - if (ret < 0) { - err("cinergyt2_fe_read_unc_blocks() Failed! (Error=%d)\n", - ret); - return ret; - } - *unc = le32_to_cpu(status.uncorrected_block_count); + *unc = le32_to_cpu(state->status.uncorrected_block_count); return 0; } @@ -212,35 +197,16 @@ static int cinergyt2_fe_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct cinergyt2_fe_state *state = fe->demodulator_priv; - struct dvbt_get_status_msg status; - char cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS }; - int ret; - ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (char *)&status, - sizeof(status), 0); - if (ret < 0) { - err("cinergyt2_fe_read_signal_strength() Failed!" - " (Error=%d)\n", ret); - return ret; - } - *strength = (0xffff - le16_to_cpu(status.gain)); + *strength = (0xffff - le16_to_cpu(state->status.gain)); return 0; } static int cinergyt2_fe_read_snr(struct dvb_frontend *fe, u16 *snr) { struct cinergyt2_fe_state *state = fe->demodulator_priv; - struct dvbt_get_status_msg status; - char cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS }; - int ret; - ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (char *)&status, - sizeof(status), 0); - if (ret < 0) { - err("cinergyt2_fe_read_snr() Failed! (Error=%d)\n", ret); - return ret; - } - *snr = (status.snr << 8) | status.snr; + *snr = (state->status.snr << 8) | state->status.snr; return 0; } From 0d43c0ff8b7e0a76136c602625efa5e6919baf9c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 06:16:59 -0300 Subject: [PATCH 539/591] [media] cinergyT2-fe: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/cinergyT2-fe.c | 56 ++++++++++++++---------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/drivers/media/usb/dvb-usb/cinergyT2-fe.c b/drivers/media/usb/dvb-usb/cinergyT2-fe.c index fd8edcb56e61..2d29b4174dba 100644 --- a/drivers/media/usb/dvb-usb/cinergyT2-fe.c +++ b/drivers/media/usb/dvb-usb/cinergyT2-fe.c @@ -139,6 +139,10 @@ static uint16_t compute_tps(struct dtv_frontend_properties *op) struct cinergyt2_fe_state { struct dvb_frontend fe; struct dvb_usb_device *d; + + unsigned char data[64]; + struct mutex data_mutex; + struct dvbt_get_status_msg status; }; @@ -146,28 +150,31 @@ static int cinergyt2_fe_read_status(struct dvb_frontend *fe, enum fe_status *status) { struct cinergyt2_fe_state *state = fe->demodulator_priv; - struct dvbt_get_status_msg result; - u8 cmd[] = { CINERGYT2_EP1_GET_TUNER_STATUS }; int ret; - ret = dvb_usb_generic_rw(state->d, cmd, sizeof(cmd), (u8 *)&result, - sizeof(result), 0); + mutex_lock(&state->data_mutex); + state->data[0] = CINERGYT2_EP1_GET_TUNER_STATUS; + + ret = dvb_usb_generic_rw(state->d, state->data, 1, + state->data, sizeof(state->status), 0); + if (!ret) + memcpy(&state->status, state->data, sizeof(state->status)); + mutex_unlock(&state->data_mutex); + if (ret < 0) return ret; - state->status = result; - *status = 0; - if (0xffff - le16_to_cpu(result.gain) > 30) + if (0xffff - le16_to_cpu(state->status.gain) > 30) *status |= FE_HAS_SIGNAL; - if (result.lock_bits & (1 << 6)) + if (state->status.lock_bits & (1 << 6)) *status |= FE_HAS_LOCK; - if (result.lock_bits & (1 << 5)) + if (state->status.lock_bits & (1 << 5)) *status |= FE_HAS_SYNC; - if (result.lock_bits & (1 << 4)) + if (state->status.lock_bits & (1 << 4)) *status |= FE_HAS_CARRIER; - if (result.lock_bits & (1 << 1)) + if (state->status.lock_bits & (1 << 1)) *status |= FE_HAS_VITERBI; if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) != @@ -232,34 +239,36 @@ static int cinergyt2_fe_set_frontend(struct dvb_frontend *fe) { struct dtv_frontend_properties *fep = &fe->dtv_property_cache; struct cinergyt2_fe_state *state = fe->demodulator_priv; - struct dvbt_set_parameters_msg param; - char result[2]; + struct dvbt_set_parameters_msg *param; int err; - param.cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS; - param.tps = cpu_to_le16(compute_tps(fep)); - param.freq = cpu_to_le32(fep->frequency / 1000); - param.flags = 0; + mutex_lock(&state->data_mutex); + + param = (void *)state->data; + param->cmd = CINERGYT2_EP1_SET_TUNER_PARAMETERS; + param->tps = cpu_to_le16(compute_tps(fep)); + param->freq = cpu_to_le32(fep->frequency / 1000); + param->flags = 0; switch (fep->bandwidth_hz) { default: case 8000000: - param.bandwidth = 8; + param->bandwidth = 8; break; case 7000000: - param.bandwidth = 7; + param->bandwidth = 7; break; case 6000000: - param.bandwidth = 6; + param->bandwidth = 6; break; } - err = dvb_usb_generic_rw(state->d, - (char *)¶m, sizeof(param), - result, sizeof(result), 0); + err = dvb_usb_generic_rw(state->d, state->data, sizeof(*param), + state->data, 2, 0); if (err < 0) err("cinergyt2_fe_set_frontend() Failed! err=%d\n", err); + mutex_unlock(&state->data_mutex); return (err < 0) ? err : 0; } @@ -281,6 +290,7 @@ struct dvb_frontend *cinergyt2_fe_attach(struct dvb_usb_device *d) s->d = d; memcpy(&s->fe.ops, &cinergyt2_fe_ops, sizeof(struct dvb_frontend_ops)); s->fe.demodulator_priv = s; + mutex_init(&s->data_mutex); return &s->fe; } From 17ce039b4e5405c49d8c0d64e6d781cc6f4dc1ac Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 06:30:27 -0300 Subject: [PATCH 540/591] [media] cxusb: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/cxusb.c | 62 +++++++++++++++++-------------- drivers/media/usb/dvb-usb/cxusb.h | 6 +++ 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c index 907ac01ae297..39772812269d 100644 --- a/drivers/media/usb/dvb-usb/cxusb.c +++ b/drivers/media/usb/dvb-usb/cxusb.c @@ -45,9 +45,6 @@ #include "si2168.h" #include "si2157.h" -/* Max transfer size done by I2C transfer functions */ -#define MAX_XFER_SIZE 80 - /* debug */ static int dvb_usb_cxusb_debug; module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); @@ -61,23 +58,27 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); static int cxusb_ctrl_msg(struct dvb_usb_device *d, u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) { - int wo = (rbuf == NULL || rlen == 0); /* write-only */ - u8 sndbuf[MAX_XFER_SIZE]; + struct cxusb_state *st = d->priv; + int ret, wo; - if (1 + wlen > sizeof(sndbuf)) { - warn("i2c wr: len=%d is too big!\n", - wlen); + if (1 + wlen > MAX_XFER_SIZE) { + warn("i2c wr: len=%d is too big!\n", wlen); return -EOPNOTSUPP; } - memset(sndbuf, 0, 1+wlen); + wo = (rbuf == NULL || rlen == 0); /* write-only */ - sndbuf[0] = cmd; - memcpy(&sndbuf[1], wbuf, wlen); + mutex_lock(&st->data_mutex); + st->data[0] = cmd; + memcpy(&st->data[1], wbuf, wlen); if (wo) - return dvb_usb_generic_write(d, sndbuf, 1+wlen); + ret = dvb_usb_generic_write(d, st->data, 1 + wlen); else - return dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0); + ret = dvb_usb_generic_rw(d, st->data, 1 + wlen, + rbuf, rlen, 0); + + mutex_unlock(&st->data_mutex); + return ret; } /* GPIO */ @@ -1460,36 +1461,43 @@ static struct dvb_usb_device_properties cxusb_mygica_t230_properties; static int cxusb_probe(struct usb_interface *intf, const struct usb_device_id *id) { + struct dvb_usb_device *d; + struct cxusb_state *st; + if (0 == dvb_usb_device_init(intf, &cxusb_medion_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgh064f_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dee1601_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_bluebird_lgz201_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dtt7579_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_bluebird_nano2_needsfirmware_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_aver_a868r_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_bluebird_dualdig4_rev2_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_d680_dmb_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_mygica_d689_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties, - THIS_MODULE, NULL, adapter_nr) || - 0) + THIS_MODULE, &d, adapter_nr) || + 0) { + st = d->priv; + mutex_init(&st->data_mutex); + return 0; + } return -EINVAL; } diff --git a/drivers/media/usb/dvb-usb/cxusb.h b/drivers/media/usb/dvb-usb/cxusb.h index 527ff7905e15..9f3ee0e47d5c 100644 --- a/drivers/media/usb/dvb-usb/cxusb.h +++ b/drivers/media/usb/dvb-usb/cxusb.h @@ -28,10 +28,16 @@ #define CMD_ANALOG 0x50 #define CMD_DIGITAL 0x51 +/* Max transfer size done by I2C transfer functions */ +#define MAX_XFER_SIZE 80 + struct cxusb_state { u8 gpio_write_state[3]; struct i2c_client *i2c_client_demod; struct i2c_client *i2c_client_tuner; + + unsigned char data[MAX_XFER_SIZE]; + struct mutex data_mutex; }; #endif From bd1f976cc95b0689f889c8d93434ee61dd09b08b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 06:40:24 -0300 Subject: [PATCH 541/591] [media] dib0700: be sure that dib0700_ctrl_rd() users can do DMA dib0700_ctrl_rd() takes a RX and a TX pointer. Be sure that both will point to a memory allocated via kmalloc(). Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dib0700_core.c | 4 +++- drivers/media/usb/dvb-usb/dib0700_devices.c | 25 +++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index f3196658fb70..515f89dba199 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -292,13 +292,15 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, /* special thing in the current firmware: when length is zero the read-failed */ len = dib0700_ctrl_rd(d, st->buf, msg[i].len + 2, - msg[i+1].buf, msg[i+1].len); + st->buf, msg[i + 1].len); if (len <= 0) { deb_info("I2C read failed on address 0x%02x\n", msg[i].addr); break; } + memcpy(msg[i + 1].buf, st->buf, msg[i + 1].len); + msg[i+1].len = len; i++; diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c index 0857b56e652c..ef1b8ee75c57 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -508,8 +508,6 @@ static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) #define DEFAULT_RC_INTERVAL 50 -static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; - /* * This function is used only when firmware is < 1.20 version. Newer * firmwares use bulk mode, with functions implemented at dib0700_core, @@ -517,7 +515,6 @@ static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; */ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) { - u8 key[4]; enum rc_type protocol; u32 scancode; u8 toggle; @@ -532,39 +529,43 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) return 0; } - i = dib0700_ctrl_rd(d, rc_request, 2, key, 4); + st->buf[0] = REQUEST_POLL_RC; + st->buf[1] = 0; + + i = dib0700_ctrl_rd(d, st->buf, 2, st->buf, 4); if (i <= 0) { err("RC Query Failed"); - return -1; + return -EIO; } /* losing half of KEY_0 events from Philipps rc5 remotes.. */ - if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0) + if (st->buf[0] == 0 && st->buf[1] == 0 + && st->buf[2] == 0 && st->buf[3] == 0) return 0; - /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */ + /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)st->buf[3 - 2],(int)st->buf[3 - 3],(int)st->buf[3 - 1],(int)st->buf[3]); */ dib0700_rc_setup(d, NULL); /* reset ir sensor data to prevent false events */ switch (d->props.rc.core.protocol) { case RC_BIT_NEC: /* NEC protocol sends repeat code as 0 0 0 FF */ - if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && - (key[3] == 0xff)) { + if ((st->buf[3 - 2] == 0x00) && (st->buf[3 - 3] == 0x00) && + (st->buf[3] == 0xff)) { rc_repeat(d->rc_dev); return 0; } protocol = RC_TYPE_NEC; - scancode = RC_SCANCODE_NEC(key[3-2], key[3-3]); + scancode = RC_SCANCODE_NEC(st->buf[3 - 2], st->buf[3 - 3]); toggle = 0; break; default: /* RC-5 protocol changes toggle bit on new keypress */ protocol = RC_TYPE_RC5; - scancode = RC_SCANCODE_RC5(key[3-2], key[3-3]); - toggle = key[3-1]; + scancode = RC_SCANCODE_RC5(st->buf[3 - 2], st->buf[3 - 3]); + toggle = st->buf[3 - 1]; break; } From fa1ecd8dc454fe2d3075a964240f45ceb60cb9e0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 06:53:51 -0300 Subject: [PATCH 542/591] [media] dib0700_core: don't use stack on I2C reads Be sure that I2C reads won't use stack by passing a pointer to the state buffer, that we know it was allocated via kmalloc, instead of relying on the buffer allocated by an I2C client. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dib0700_core.c | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c index 515f89dba199..92d5408684ac 100644 --- a/drivers/media/usb/dvb-usb/dib0700_core.c +++ b/drivers/media/usb/dvb-usb/dib0700_core.c @@ -213,7 +213,7 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, usb_rcvctrlpipe(d->udev, 0), REQUEST_NEW_I2C_READ, USB_TYPE_VENDOR | USB_DIR_IN, - value, index, msg[i].buf, + value, index, st->buf, msg[i].len, USB_CTRL_GET_TIMEOUT); if (result < 0) { @@ -221,6 +221,14 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, break; } + if (msg[i].len > sizeof(st->buf)) { + deb_info("buffer too small to fit %d bytes\n", + msg[i].len); + return -EIO; + } + + memcpy(msg[i].buf, st->buf, msg[i].len); + deb_data("<<< "); debug_dump(msg[i].buf, msg[i].len, deb_data); @@ -238,6 +246,13 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, /* I2C ctrl + FE bus; */ st->buf[3] = ((gen_mode << 6) & 0xC0) | ((bus_mode << 4) & 0x30); + + if (msg[i].len > sizeof(st->buf) - 4) { + deb_info("i2c message to big: %d\n", + msg[i].len); + return -EIO; + } + /* The Actual i2c payload */ memcpy(&st->buf[4], msg[i].buf, msg[i].len); @@ -283,6 +298,11 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, /* fill in the address */ st->buf[1] = msg[i].addr << 1; /* fill the buffer */ + if (msg[i].len > sizeof(st->buf) - 2) { + deb_info("i2c xfer to big: %d\n", + msg[i].len); + return -EIO; + } memcpy(&st->buf[2], msg[i].buf, msg[i].len); /* write/read request */ @@ -299,6 +319,11 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, break; } + if (msg[i + 1].len > sizeof(st->buf)) { + deb_info("i2c xfer buffer to small for %d\n", + msg[i].len); + return -EIO; + } memcpy(msg[i + 1].buf, st->buf, msg[i + 1].len); msg[i+1].len = len; From 426398b15d9f18ce3e7b5c4e657b4c0103dd8389 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 07:34:36 -0300 Subject: [PATCH 543/591] [media] dibusb: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dibusb-common.c | 109 ++++++++++++++++------ drivers/media/usb/dvb-usb/dibusb.h | 3 + 2 files changed, 86 insertions(+), 26 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c index 4b08c2a47ae2..951f3dac9082 100644 --- a/drivers/media/usb/dvb-usb/dibusb-common.c +++ b/drivers/media/usb/dvb-usb/dibusb-common.c @@ -63,72 +63,117 @@ EXPORT_SYMBOL(dibusb_pid_filter_ctrl); int dibusb_power_ctrl(struct dvb_usb_device *d, int onoff) { - u8 b[3]; + u8 *b; int ret; + + b = kmalloc(3, GFP_KERNEL); + if (!b) + return -ENOMEM; + b[0] = DIBUSB_REQ_SET_IOCTL; b[1] = DIBUSB_IOCTL_CMD_POWER_MODE; b[2] = onoff ? DIBUSB_IOCTL_POWER_WAKEUP : DIBUSB_IOCTL_POWER_SLEEP; - ret = dvb_usb_generic_write(d,b,3); + + ret = dvb_usb_generic_write(d, b, 3); + + kfree(b); + msleep(10); + return ret; } EXPORT_SYMBOL(dibusb_power_ctrl); int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) { - u8 b[3] = { 0 }; int ret; + u8 *b; + + b = kmalloc(3, GFP_KERNEL); + if (!b) + return -ENOMEM; if ((ret = dibusb_streaming_ctrl(adap,onoff)) < 0) - return ret; + goto ret; if (onoff) { b[0] = DIBUSB_REQ_SET_STREAMING_MODE; b[1] = 0x00; - if ((ret = dvb_usb_generic_write(adap->dev,b,2)) < 0) - return ret; + ret = dvb_usb_generic_write(adap->dev, b, 2); + if (ret < 0) + goto ret; } b[0] = DIBUSB_REQ_SET_IOCTL; b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM; - return dvb_usb_generic_write(adap->dev,b,3); + ret = dvb_usb_generic_write(adap->dev, b, 3); + +ret: + kfree(b); + return ret; } EXPORT_SYMBOL(dibusb2_0_streaming_ctrl); int dibusb2_0_power_ctrl(struct dvb_usb_device *d, int onoff) { - if (onoff) { - u8 b[3] = { DIBUSB_REQ_SET_IOCTL, DIBUSB_IOCTL_CMD_POWER_MODE, DIBUSB_IOCTL_POWER_WAKEUP }; - return dvb_usb_generic_write(d,b,3); - } else + u8 *b; + int ret; + + if (!onoff) return 0; + + b = kmalloc(3, GFP_KERNEL); + if (!b) + return -ENOMEM; + + b[0] = DIBUSB_REQ_SET_IOCTL; + b[1] = DIBUSB_IOCTL_CMD_POWER_MODE; + b[2] = DIBUSB_IOCTL_POWER_WAKEUP; + + ret = dvb_usb_generic_write(d, b, 3); + + kfree(b); + + return ret; } EXPORT_SYMBOL(dibusb2_0_power_ctrl); static int dibusb_i2c_msg(struct dvb_usb_device *d, u8 addr, u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) { - u8 sndbuf[MAX_XFER_SIZE]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ - /* write only ? */ - int wo = (rbuf == NULL || rlen == 0), - len = 2 + wlen + (wo ? 0 : 2); + u8 *sndbuf; + int ret, wo, len; - if (4 + wlen > sizeof(sndbuf)) { + /* write only ? */ + wo = (rbuf == NULL || rlen == 0); + + len = 2 + wlen + (wo ? 0 : 2); + + sndbuf = kmalloc(MAX_XFER_SIZE, GFP_KERNEL); + if (!sndbuf) + return -ENOMEM; + + if (4 + wlen > MAX_XFER_SIZE) { warn("i2c wr: len=%d is too big!\n", wlen); - return -EOPNOTSUPP; + ret = -EOPNOTSUPP; + goto ret; } sndbuf[0] = wo ? DIBUSB_REQ_I2C_WRITE : DIBUSB_REQ_I2C_READ; sndbuf[1] = (addr << 1) | (wo ? 0 : 1); - memcpy(&sndbuf[2],wbuf,wlen); + memcpy(&sndbuf[2], wbuf, wlen); if (!wo) { - sndbuf[wlen+2] = (rlen >> 8) & 0xff; - sndbuf[wlen+3] = rlen & 0xff; + sndbuf[wlen + 2] = (rlen >> 8) & 0xff; + sndbuf[wlen + 3] = rlen & 0xff; } - return dvb_usb_generic_rw(d,sndbuf,len,rbuf,rlen,0); + ret = dvb_usb_generic_rw(d, sndbuf, len, rbuf, rlen, 0); + +ret: + kfree(sndbuf); + return ret; } /* @@ -320,11 +365,23 @@ EXPORT_SYMBOL(rc_map_dibusb_table); int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { - u8 key[5],cmd = DIBUSB_REQ_POLL_REMOTE; - dvb_usb_generic_rw(d,&cmd,1,key,5,0); - dvb_usb_nec_rc_key_to_event(d,key,event,state); - if (key[0] != 0) - deb_info("key: %*ph\n", 5, key); + u8 *buf; + + buf = kmalloc(5, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + buf[0] = DIBUSB_REQ_POLL_REMOTE; + + dvb_usb_generic_rw(d, buf, 1, buf, 5, 0); + + dvb_usb_nec_rc_key_to_event(d, buf, event, state); + + if (buf[0] != 0) + deb_info("key: %*ph\n", 5, buf); + + kfree(buf); + return 0; } EXPORT_SYMBOL(dibusb_rc_query); diff --git a/drivers/media/usb/dvb-usb/dibusb.h b/drivers/media/usb/dvb-usb/dibusb.h index 3f82163d8ab8..697be2a17ade 100644 --- a/drivers/media/usb/dvb-usb/dibusb.h +++ b/drivers/media/usb/dvb-usb/dibusb.h @@ -96,6 +96,9 @@ #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01 #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02 +/* Max transfer size done by I2C transfer functions */ +#define MAX_XFER_SIZE 64 + struct dibusb_state { struct dib_fe_xfer_ops ops; int mt2060_present; From ff1c123545d706c6e414132c9fc93e345f5141da Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 13:40:48 -0300 Subject: [PATCH 544/591] [media] dibusb: handle error code on RC query There's no sense on decoding and generating a RC key code if there was an error on the URB control message. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dibusb-common.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c index 951f3dac9082..b0fd9a609352 100644 --- a/drivers/media/usb/dvb-usb/dibusb-common.c +++ b/drivers/media/usb/dvb-usb/dibusb-common.c @@ -366,6 +366,7 @@ EXPORT_SYMBOL(rc_map_dibusb_table); int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { u8 *buf; + int ret; buf = kmalloc(5, GFP_KERNEL); if (!buf) @@ -373,7 +374,9 @@ int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) buf[0] = DIBUSB_REQ_POLL_REMOTE; - dvb_usb_generic_rw(d, buf, 1, buf, 5, 0); + ret = dvb_usb_generic_rw(d, buf, 1, buf, 5, 0); + if (ret < 0) + goto ret; dvb_usb_nec_rc_key_to_event(d, buf, event, state); @@ -382,6 +385,7 @@ int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) kfree(buf); - return 0; +ret: + return ret; } EXPORT_SYMBOL(dibusb_rc_query); From f0b0ada7184cca44bb5ae96903eca304cc20eec5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 07:55:38 -0300 Subject: [PATCH 545/591] [media] digitv: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/digitv.c | 20 +++++++++++--------- drivers/media/usb/dvb-usb/digitv.h | 5 ++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c index 63134335c994..09f8c28bd4db 100644 --- a/drivers/media/usb/dvb-usb/digitv.c +++ b/drivers/media/usb/dvb-usb/digitv.c @@ -28,20 +28,22 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); static int digitv_ctrl_msg(struct dvb_usb_device *d, u8 cmd, u8 vv, u8 *wbuf, int wlen, u8 *rbuf, int rlen) { + struct digitv_state *st = d->priv; int wo = (rbuf == NULL || rlen == 0); /* write-only */ - u8 sndbuf[7],rcvbuf[7]; - memset(sndbuf,0,7); memset(rcvbuf,0,7); - sndbuf[0] = cmd; - sndbuf[1] = vv; - sndbuf[2] = wo ? wlen : rlen; + memset(st->sndbuf, 0, 7); + memset(st->rcvbuf, 0, 7); + + st->sndbuf[0] = cmd; + st->sndbuf[1] = vv; + st->sndbuf[2] = wo ? wlen : rlen; if (wo) { - memcpy(&sndbuf[3],wbuf,wlen); - dvb_usb_generic_write(d,sndbuf,7); + memcpy(&st->sndbuf[3], wbuf, wlen); + dvb_usb_generic_write(d, st->sndbuf, 7); } else { - dvb_usb_generic_rw(d,sndbuf,7,rcvbuf,7,10); - memcpy(rbuf,&rcvbuf[3],rlen); + dvb_usb_generic_rw(d, st->sndbuf, 7, st->rcvbuf, 7, 10); + memcpy(rbuf, &st->rcvbuf[3], rlen); } return 0; } diff --git a/drivers/media/usb/dvb-usb/digitv.h b/drivers/media/usb/dvb-usb/digitv.h index 908c09f4966b..581e09c25491 100644 --- a/drivers/media/usb/dvb-usb/digitv.h +++ b/drivers/media/usb/dvb-usb/digitv.h @@ -5,7 +5,10 @@ #include "dvb-usb.h" struct digitv_state { - int is_nxt6000; + int is_nxt6000; + + unsigned char sndbuf[7]; + unsigned char rcvbuf[7]; }; /* protocol (from usblogging and the SDK: From 208d8af509455ebf25f25f974c9907c0eb1a2b0a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 10 Oct 2016 15:34:13 -0300 Subject: [PATCH 546/591] [media] dtt200u-fe: don't keep waiting for lock at set_frontend() It is up to the frontend kthread to wait for lock. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dtt200u-fe.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dtt200u-fe.c b/drivers/media/usb/dvb-usb/dtt200u-fe.c index c09332bd99cb..9bb15f7b48db 100644 --- a/drivers/media/usb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/usb/dvb-usb/dtt200u-fe.c @@ -105,8 +105,6 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend *fe) { struct dtv_frontend_properties *fep = &fe->dtv_property_cache; struct dtt200u_fe_state *state = fe->demodulator_priv; - int i; - enum fe_status st; u16 freq = fep->frequency / 250000; u8 bwbuf[2] = { SET_BANDWIDTH, 0 },freqbuf[3] = { SET_RF_FREQ, 0, 0 }; @@ -130,13 +128,6 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend *fe) freqbuf[2] = (freq >> 8) & 0xff; dvb_usb_generic_write(state->d,freqbuf,3); - for (i = 0; i < 30; i++) { - msleep(20); - dtt200u_fe_read_status(fe, &st); - if (st & FE_TIMEDOUT) - continue; - } - return 0; } From 89919b518863e7dac98d4d6d4b08ed2113d91d27 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 08:06:57 -0300 Subject: [PATCH 547/591] [media] dtt200u-fe: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dtt200u-fe.c | 95 ++++++++++++++++++-------- 1 file changed, 65 insertions(+), 30 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dtt200u-fe.c b/drivers/media/usb/dvb-usb/dtt200u-fe.c index 9bb15f7b48db..7f7f64be6353 100644 --- a/drivers/media/usb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/usb/dvb-usb/dtt200u-fe.c @@ -18,17 +18,22 @@ struct dtt200u_fe_state { struct dtv_frontend_properties fep; struct dvb_frontend frontend; + + unsigned char data[80]; + struct mutex data_mutex; }; static int dtt200u_fe_read_status(struct dvb_frontend *fe, enum fe_status *stat) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 st = GET_TUNE_STATUS, b[3]; - dvb_usb_generic_rw(state->d,&st,1,b,3,0); + mutex_lock(&state->data_mutex); + state->data[0] = GET_TUNE_STATUS; - switch (b[0]) { + dvb_usb_generic_rw(state->d, state->data, 1, state->data, 3, 0); + + switch (state->data[0]) { case 0x01: *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; @@ -41,51 +46,75 @@ static int dtt200u_fe_read_status(struct dvb_frontend *fe, *stat = 0; break; } + mutex_unlock(&state->data_mutex); return 0; } static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 bw = GET_VIT_ERR_CNT,b[3]; - dvb_usb_generic_rw(state->d,&bw,1,b,3,0); - *ber = (b[0] << 16) | (b[1] << 8) | b[2]; + + mutex_lock(&state->data_mutex); + state->data[0] = GET_VIT_ERR_CNT; + + dvb_usb_generic_rw(state->d, state->data, 1, state->data, 3, 0); + *ber = (state->data[0] << 16) | (state->data[1] << 8) | state->data[2]; + + mutex_unlock(&state->data_mutex); return 0; } static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 bw = GET_RS_UNCOR_BLK_CNT,b[2]; - dvb_usb_generic_rw(state->d,&bw,1,b,2,0); - *unc = (b[0] << 8) | b[1]; - return 0; + mutex_lock(&state->data_mutex); + state->data[0] = GET_RS_UNCOR_BLK_CNT; + + dvb_usb_generic_rw(state->d, state->data, 1, state->data, 2, 0); + + mutex_unlock(&state->data_mutex); + return ret; } static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 bw = GET_AGC, b; - dvb_usb_generic_rw(state->d,&bw,1,&b,1,0); - *strength = (b << 8) | b; - return 0; + + mutex_lock(&state->data_mutex); + state->data[0] = GET_AGC; + + dvb_usb_generic_rw(state->d, state->data, 1, state->data, 1, 0); + + mutex_unlock(&state->data_mutex); + return ret; } static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 bw = GET_SNR,br; - dvb_usb_generic_rw(state->d,&bw,1,&br,1,0); - *snr = ~((br << 8) | br); - return 0; + + mutex_lock(&state->data_mutex); + state->data[0] = GET_SNR; + + dvb_usb_generic_rw(state->d, state->data, 1, state->data, 1, 0); + + mutex_unlock(&state->data_mutex); + return ret; } static int dtt200u_fe_init(struct dvb_frontend* fe) { struct dtt200u_fe_state *state = fe->demodulator_priv; - u8 b = SET_INIT; - return dvb_usb_generic_write(state->d,&b,1); + int ret; + + mutex_lock(&state->data_mutex); + state->data[0] = SET_INIT; + + ret = dvb_usb_generic_write(state->d, state->data, 1); + mutex_unlock(&state->data_mutex); + + return ret; } static int dtt200u_fe_sleep(struct dvb_frontend* fe) @@ -106,29 +135,34 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend *fe) struct dtv_frontend_properties *fep = &fe->dtv_property_cache; struct dtt200u_fe_state *state = fe->demodulator_priv; u16 freq = fep->frequency / 250000; - u8 bwbuf[2] = { SET_BANDWIDTH, 0 },freqbuf[3] = { SET_RF_FREQ, 0, 0 }; + mutex_lock(&state->data_mutex); + state->data[0] = SET_BANDWIDTH; switch (fep->bandwidth_hz) { case 8000000: - bwbuf[1] = 8; + state->data[1] = 8; break; case 7000000: - bwbuf[1] = 7; + state->data[1] = 7; break; case 6000000: - bwbuf[1] = 6; + state->data[1] = 6; break; default: - return -EINVAL; + ret = -EINVAL; + goto ret; } - dvb_usb_generic_write(state->d,bwbuf,2); + dvb_usb_generic_write(state->d, state->data, 2); - freqbuf[1] = freq & 0xff; - freqbuf[2] = (freq >> 8) & 0xff; - dvb_usb_generic_write(state->d,freqbuf,3); + state->data[0] = SET_RF_FREQ; + state->data[1] = freq & 0xff; + state->data[2] = (freq >> 8) & 0xff; + dvb_usb_generic_write(state->d, state->data, 3); - return 0; +ret: + mutex_unlock(&state->data_mutex); + return ret; } static int dtt200u_fe_get_frontend(struct dvb_frontend* fe, @@ -160,6 +194,7 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) deb_info("attaching frontend dtt200u\n"); state->d = d; + mutex_init(&state->data_mutex); memcpy(&state->frontend.ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; From ba705a629ceee28f7ee4a5f977da52278b683eb0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 13:44:09 -0300 Subject: [PATCH 548/591] [media] dtt200u-fe: handle errors on USB control messages If something goes wrong, return an error code, instead of assuming that everything went fine. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dtt200u-fe.c | 40 ++++++++++++++++++++------ 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dtt200u-fe.c b/drivers/media/usb/dvb-usb/dtt200u-fe.c index 7f7f64be6353..f5c042baa254 100644 --- a/drivers/media/usb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/usb/dvb-usb/dtt200u-fe.c @@ -27,11 +27,17 @@ static int dtt200u_fe_read_status(struct dvb_frontend *fe, enum fe_status *stat) { struct dtt200u_fe_state *state = fe->demodulator_priv; + int ret; mutex_lock(&state->data_mutex); state->data[0] = GET_TUNE_STATUS; - dvb_usb_generic_rw(state->d, state->data, 1, state->data, 3, 0); + ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 3, 0); + if (ret < 0) { + *stat = 0; + mutex_unlock(&state->data_mutex); + return ret; + } switch (state->data[0]) { case 0x01: @@ -53,25 +59,30 @@ static int dtt200u_fe_read_status(struct dvb_frontend *fe, static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) { struct dtt200u_fe_state *state = fe->demodulator_priv; + int ret; mutex_lock(&state->data_mutex); state->data[0] = GET_VIT_ERR_CNT; - dvb_usb_generic_rw(state->d, state->data, 1, state->data, 3, 0); - *ber = (state->data[0] << 16) | (state->data[1] << 8) | state->data[2]; + ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 3, 0); + if (ret >= 0) + *ber = (state->data[0] << 16) | (state->data[1] << 8) | state->data[2]; mutex_unlock(&state->data_mutex); - return 0; + return ret; } static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) { struct dtt200u_fe_state *state = fe->demodulator_priv; + int ret; mutex_lock(&state->data_mutex); state->data[0] = GET_RS_UNCOR_BLK_CNT; - dvb_usb_generic_rw(state->d, state->data, 1, state->data, 2, 0); + ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 2, 0); + if (ret >= 0) + *unc = (state->data[0] << 8) | state->data[1]; mutex_unlock(&state->data_mutex); return ret; @@ -80,11 +91,14 @@ static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) { struct dtt200u_fe_state *state = fe->demodulator_priv; + int ret; mutex_lock(&state->data_mutex); state->data[0] = GET_AGC; - dvb_usb_generic_rw(state->d, state->data, 1, state->data, 1, 0); + ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 1, 0); + if (ret >= 0) + *strength = (state->data[0] << 8) | state->data[0]; mutex_unlock(&state->data_mutex); return ret; @@ -93,11 +107,14 @@ static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strengt static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr) { struct dtt200u_fe_state *state = fe->demodulator_priv; + int ret; mutex_lock(&state->data_mutex); state->data[0] = GET_SNR; - dvb_usb_generic_rw(state->d, state->data, 1, state->data, 1, 0); + ret = dvb_usb_generic_rw(state->d, state->data, 1, state->data, 1, 0); + if (ret >= 0) + *snr = ~((state->data[0] << 8) | state->data[0]); mutex_unlock(&state->data_mutex); return ret; @@ -134,6 +151,7 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend *fe) { struct dtv_frontend_properties *fep = &fe->dtv_property_cache; struct dtt200u_fe_state *state = fe->demodulator_priv; + int ret; u16 freq = fep->frequency / 250000; mutex_lock(&state->data_mutex); @@ -153,12 +171,16 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend *fe) goto ret; } - dvb_usb_generic_write(state->d, state->data, 2); + ret = dvb_usb_generic_write(state->d, state->data, 2); + if (ret < 0) + goto ret; state->data[0] = SET_RF_FREQ; state->data[1] = freq & 0xff; state->data[2] = (freq >> 8) & 0xff; - dvb_usb_generic_write(state->d, state->data, 3); + ret = dvb_usb_generic_write(state->d, state->data, 3); + if (ret < 0) + goto ret; ret: mutex_unlock(&state->data_mutex); From ab883e2de3fc58c0af6070ea067a607a6310772b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 08:40:43 -0300 Subject: [PATCH 549/591] [media] dtt200u: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dtt200u.c | 104 ++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 29 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dtt200u.c b/drivers/media/usb/dvb-usb/dtt200u.c index d2a01b50af0d..7706938b5167 100644 --- a/drivers/media/usb/dvb-usb/dtt200u.c +++ b/drivers/media/usb/dvb-usb/dtt200u.c @@ -20,74 +20,103 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); +struct dtt200u_state { + unsigned char data[80]; + struct mutex data_mutex; +}; + static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff) { - u8 b = SET_INIT; + struct dtt200u_state *st = d->priv; + + mutex_lock(&st->data_mutex); + + st->data[0] = SET_INIT; if (onoff) - dvb_usb_generic_write(d,&b,2); + dvb_usb_generic_write(d, st->data, 2); + mutex_unlock(&st->data_mutex); return 0; } static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) { - u8 b_streaming[2] = { SET_STREAMING, onoff }; - u8 b_rst_pid = RESET_PID_FILTER; + struct dtt200u_state *st = adap->dev->priv; - dvb_usb_generic_write(adap->dev, b_streaming, 2); + mutex_lock(&st->data_mutex); + st->data[0] = SET_STREAMING; + st->data[1] = onoff; + + dvb_usb_generic_write(adap->dev, st->data, 2); + + if (onoff) + return 0; + + st->data[0] = RESET_PID_FILTER; + dvb_usb_generic_write(adap->dev, st->data, 1); + + mutex_unlock(&st->data_mutex); - if (onoff == 0) - dvb_usb_generic_write(adap->dev, &b_rst_pid, 1); return 0; } static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) { - u8 b_pid[4]; + struct dtt200u_state *st = adap->dev->priv; + int ret; + pid = onoff ? pid : 0; - b_pid[0] = SET_PID_FILTER; - b_pid[1] = index; - b_pid[2] = pid & 0xff; - b_pid[3] = (pid >> 8) & 0x1f; + mutex_lock(&st->data_mutex); + st->data[0] = SET_PID_FILTER; + st->data[1] = index; + st->data[2] = pid & 0xff; + st->data[3] = (pid >> 8) & 0x1f; - return dvb_usb_generic_write(adap->dev, b_pid, 4); + ret = dvb_usb_generic_write(adap->dev, st->data, 4); + mutex_unlock(&st->data_mutex); + + return ret; } static int dtt200u_rc_query(struct dvb_usb_device *d) { - u8 key[5],cmd = GET_RC_CODE; + struct dtt200u_state *st = d->priv; u32 scancode; - dvb_usb_generic_rw(d,&cmd,1,key,5,0); - if (key[0] == 1) { + mutex_lock(&st->data_mutex); + st->data[0] = GET_RC_CODE; + + dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0); + if (st->data[0] == 1) { enum rc_type proto = RC_TYPE_NEC; - scancode = key[1]; - if ((u8) ~key[1] != key[2]) { + scancode = st->data[1]; + if ((u8) ~st->data[1] != st->data[2]) { /* Extended NEC */ scancode = scancode << 8; - scancode |= key[2]; + scancode |= st->data[2]; proto = RC_TYPE_NECX; } scancode = scancode << 8; - scancode |= key[3]; + scancode |= st->data[3]; /* Check command checksum is ok */ - if ((u8) ~key[3] == key[4]) + if ((u8) ~st->data[3] == st->data[4]) rc_keydown(d->rc_dev, proto, scancode, 0); else rc_keyup(d->rc_dev); - } else if (key[0] == 2) { + } else if (st->data[0] == 2) { rc_repeat(d->rc_dev); } else { rc_keyup(d->rc_dev); } - if (key[0] != 0) - deb_info("key: %*ph\n", 5, key); + if (st->data[0] != 0) + deb_info("st->data: %*ph\n", 5, st->data); + mutex_unlock(&st->data_mutex); return 0; } @@ -106,17 +135,24 @@ static struct dvb_usb_device_properties wt220u_miglia_properties; static int dtt200u_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { + struct dvb_usb_device *d; + struct dtt200u_state *st; + if (0 == dvb_usb_device_init(intf, &dtt200u_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &wt220u_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &wt220u_fc_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties, - THIS_MODULE, NULL, adapter_nr) || + THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &wt220u_miglia_properties, - THIS_MODULE, NULL, adapter_nr)) + THIS_MODULE, &d, adapter_nr)) { + st = d->priv; + mutex_init(&st->data_mutex); + return 0; + } return -ENODEV; } @@ -140,6 +176,8 @@ static struct dvb_usb_device_properties dtt200u_properties = { .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-dtt200u-01.fw", + .size_of_priv = sizeof(struct dtt200u_state), + .num_adapters = 1, .adapter = { { @@ -190,6 +228,8 @@ static struct dvb_usb_device_properties wt220u_properties = { .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-wt220u-02.fw", + .size_of_priv = sizeof(struct dtt200u_state), + .num_adapters = 1, .adapter = { { @@ -240,6 +280,8 @@ static struct dvb_usb_device_properties wt220u_fc_properties = { .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-wt220u-fc03.fw", + .size_of_priv = sizeof(struct dtt200u_state), + .num_adapters = 1, .adapter = { { @@ -290,6 +332,8 @@ static struct dvb_usb_device_properties wt220u_zl0353_properties = { .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-wt220u-zl0353-01.fw", + .size_of_priv = sizeof(struct dtt200u_state), + .num_adapters = 1, .adapter = { { @@ -340,6 +384,8 @@ static struct dvb_usb_device_properties wt220u_miglia_properties = { .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-wt220u-miglia-01.fw", + .size_of_priv = sizeof(struct dtt200u_state), + .num_adapters = 1, .generic_bulk_ctrl_endpoint = 0x01, From a3f9f07e06ebf37261171e167e2110b758c2a147 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 13:37:50 -0300 Subject: [PATCH 550/591] [media] dtt200u: handle USB control message errors If something bad happens while an USB control message is transfered, return an error code. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dtt200u.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dtt200u.c b/drivers/media/usb/dvb-usb/dtt200u.c index 7706938b5167..f88572c7ae7c 100644 --- a/drivers/media/usb/dvb-usb/dtt200u.c +++ b/drivers/media/usb/dvb-usb/dtt200u.c @@ -28,37 +28,42 @@ struct dtt200u_state { static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff) { struct dtt200u_state *st = d->priv; + int ret = 0; mutex_lock(&st->data_mutex); st->data[0] = SET_INIT; if (onoff) - dvb_usb_generic_write(d, st->data, 2); + ret = dvb_usb_generic_write(d, st->data, 2); mutex_unlock(&st->data_mutex); - return 0; + return ret; } static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) { struct dtt200u_state *st = adap->dev->priv; + int ret; mutex_lock(&st->data_mutex); st->data[0] = SET_STREAMING; st->data[1] = onoff; - dvb_usb_generic_write(adap->dev, st->data, 2); + ret = dvb_usb_generic_write(adap->dev, st->data, 2); + if (ret < 0) + goto ret; if (onoff) - return 0; + goto ret; st->data[0] = RESET_PID_FILTER; - dvb_usb_generic_write(adap->dev, st->data, 1); + ret = dvb_usb_generic_write(adap->dev, st->data, 1); +ret: mutex_unlock(&st->data_mutex); - return 0; + return ret; } static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) @@ -84,11 +89,15 @@ static int dtt200u_rc_query(struct dvb_usb_device *d) { struct dtt200u_state *st = d->priv; u32 scancode; + int ret; mutex_lock(&st->data_mutex); st->data[0] = GET_RC_CODE; - dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0); + ret = dvb_usb_generic_rw(d, st->data, 1, st->data, 5, 0); + if (ret < 0) + goto ret; + if (st->data[0] == 1) { enum rc_type proto = RC_TYPE_NEC; @@ -116,8 +125,9 @@ static int dtt200u_rc_query(struct dvb_usb_device *d) if (st->data[0] != 0) deb_info("st->data: %*ph\n", 5, st->data); +ret: mutex_unlock(&st->data_mutex); - return 0; + return ret; } static int dtt200u_frontend_attach(struct dvb_usb_adapter *adap) From 8f306145df334e2797ef5aa63225cd5178e569c1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 08:51:23 -0300 Subject: [PATCH 551/591] [media] dtv5100: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dtv5100.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dtv5100.c b/drivers/media/usb/dvb-usb/dtv5100.c index 3d11df41cac0..c60fb54f445f 100644 --- a/drivers/media/usb/dvb-usb/dtv5100.c +++ b/drivers/media/usb/dvb-usb/dtv5100.c @@ -31,9 +31,14 @@ module_param_named(debug, dvb_usb_dtv5100_debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); +struct dtv5100_state { + unsigned char data[80]; +}; + static int dtv5100_i2c_msg(struct dvb_usb_device *d, u8 addr, u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) { + struct dtv5100_state *st = d->priv; u8 request; u8 type; u16 value; @@ -60,9 +65,10 @@ static int dtv5100_i2c_msg(struct dvb_usb_device *d, u8 addr, } index = (addr << 8) + wbuf[0]; + memcpy(st->data, rbuf, rlen); msleep(1); /* avoid I2C errors */ return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), request, - type, value, index, rbuf, rlen, + type, value, index, st->data, rlen, DTV5100_USB_TIMEOUT); } @@ -176,7 +182,7 @@ static struct dvb_usb_device_properties dtv5100_properties = { .caps = DVB_USB_IS_AN_I2C_ADAPTER, .usb_ctrl = DEVICE_SPECIFIC, - .size_of_priv = 0, + .size_of_priv = sizeof(struct dtv5100_state), .num_adapters = 1, .adapter = {{ From fa86c9a1fca5a50563cc63e97aa130a3c54f1d4c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 11:24:21 -0300 Subject: [PATCH 552/591] [media] gp8psk: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/gp8psk.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c index 5d0384dd45b5..807f5628a3bb 100644 --- a/drivers/media/usb/dvb-usb/gp8psk.c +++ b/drivers/media/usb/dvb-usb/gp8psk.c @@ -24,6 +24,10 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DV DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); +struct gp8psk_state { + unsigned char data[80]; +}; + static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers) { return (gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6)); @@ -53,17 +57,19 @@ static void gp8psk_info(struct dvb_usb_device *d) int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) { + struct gp8psk_state *st = d->priv; int ret = 0,try = 0; if ((ret = mutex_lock_interruptible(&d->usb_mutex))) return ret; while (ret >= 0 && ret != blen && try < 3) { + memcpy(st->data, b, blen); ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev,0), req, USB_TYPE_VENDOR | USB_DIR_IN, - value,index,b,blen, + value, index, st->data, blen, 2000); deb_info("reading number %d (ret: %d)\n",try,ret); try++; @@ -86,6 +92,7 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) { + struct gp8psk_state *st = d->priv; int ret; deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index); @@ -94,11 +101,12 @@ int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, if ((ret = mutex_lock_interruptible(&d->usb_mutex))) return ret; + memcpy(st->data, b, blen); if (usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0), req, USB_TYPE_VENDOR | USB_DIR_OUT, - value,index,b,blen, + value, index, st->data, blen, 2000) != blen) { warn("usb out operation failed."); ret = -EIO; @@ -265,6 +273,8 @@ static struct dvb_usb_device_properties gp8psk_properties = { .usb_ctrl = CYPRESS_FX2, .firmware = "dvb-usb-gp8psk-01.fw", + .size_of_priv = sizeof(struct gp8psk_state), + .num_adapters = 1, .adapter = { { From f1a503dddf4d4da2b7bbf6ae4e92527bdc265bb9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 14:12:48 -0300 Subject: [PATCH 553/591] [media] gp8psk: don't go past the buffer size Add checks to avoid going out of the buffer. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/gp8psk.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c index 807f5628a3bb..adfd76491451 100644 --- a/drivers/media/usb/dvb-usb/gp8psk.c +++ b/drivers/media/usb/dvb-usb/gp8psk.c @@ -60,6 +60,9 @@ int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 struct gp8psk_state *st = d->priv; int ret = 0,try = 0; + if (blen > sizeof(st->data)) + return -EIO; + if ((ret = mutex_lock_interruptible(&d->usb_mutex))) return ret; @@ -98,6 +101,9 @@ int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index); debug_dump(b,blen,deb_xfer); + if (blen > sizeof(st->data)) + return -EIO; + if ((ret = mutex_lock_interruptible(&d->usb_mutex))) return ret; @@ -151,6 +157,11 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) err("failed to load bcm4500 firmware."); goto out_free; } + if (buflen > 64) { + err("firmare chunk size bigger than 64 bytes."); + goto out_free; + } + memcpy(buf, ptr, buflen); if (dvb_usb_generic_write(d, buf, buflen)) { err("failed to load bcm4500 firmware."); From c3a66e9f465e7e792dff6ccd571bc657e6504c7b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 11:38:46 -0300 Subject: [PATCH 554/591] [media] nova-t-usb2: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/nova-t-usb2.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/dvb-usb/nova-t-usb2.c b/drivers/media/usb/dvb-usb/nova-t-usb2.c index fc7569e2728d..26d7188a1163 100644 --- a/drivers/media/usb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/usb/dvb-usb/nova-t-usb2.c @@ -74,22 +74,29 @@ static struct rc_map_table rc_map_haupp_table[] = { */ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { - u8 key[5],cmd[2] = { DIBUSB_REQ_POLL_REMOTE, 0x35 }, data,toggle,custom; + u8 *buf, data, toggle, custom; u16 raw; int i; struct dibusb_device_state *st = d->priv; - dvb_usb_generic_rw(d,cmd,2,key,5,0); + buf = kmalloc(5, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + buf[0] = DIBUSB_REQ_POLL_REMOTE; + buf[1] = 0x35; + dvb_usb_generic_rw(d, buf, 2, buf, 5, 0); *state = REMOTE_NO_KEY_PRESSED; - switch (key[0]) { + switch (buf[0]) { case DIBUSB_RC_HAUPPAUGE_KEY_PRESSED: - raw = ((key[1] << 8) | key[2]) >> 3; + raw = ((buf[1] << 8) | buf[2]) >> 3; toggle = !!(raw & 0x800); data = raw & 0x3f; custom = (raw >> 6) & 0x1f; - deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); + deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n", + buf[1], buf[2], buf[3], custom, data, toggle); for (i = 0; i < ARRAY_SIZE(rc_map_haupp_table); i++) { if (rc5_data(&rc_map_haupp_table[i]) == data && @@ -117,6 +124,7 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) break; } + kfree(buf); return 0; } From 73d5c5c864f4094e86708760fd4612fbf1e6e76c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 11:59:44 -0300 Subject: [PATCH 555/591] [media] pctv452e: don't do DMA on stack The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/pctv452e.c | 129 +++++++++++++++------------ 1 file changed, 74 insertions(+), 55 deletions(-) diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c index c05de1b088a4..58b685094904 100644 --- a/drivers/media/usb/dvb-usb/pctv452e.c +++ b/drivers/media/usb/dvb-usb/pctv452e.c @@ -97,13 +97,14 @@ struct pctv452e_state { u8 c; /* transaction counter, wraps around... */ u8 initialized; /* set to 1 if 0x15 has been sent */ u16 last_rc_key; + + unsigned char data[80]; }; static int tt3650_ci_msg(struct dvb_usb_device *d, u8 cmd, u8 *data, unsigned int write_len, unsigned int read_len) { struct pctv452e_state *state = (struct pctv452e_state *)d->priv; - u8 buf[64]; u8 id; unsigned int rlen; int ret; @@ -112,33 +113,36 @@ static int tt3650_ci_msg(struct dvb_usb_device *d, u8 cmd, u8 *data, BUG_ON(write_len > 64 - 4); BUG_ON(read_len > 64 - 4); + mutex_lock(&state->ca_mutex); id = state->c++; - buf[0] = SYNC_BYTE_OUT; - buf[1] = id; - buf[2] = cmd; - buf[3] = write_len; + state->data[0] = SYNC_BYTE_OUT; + state->data[1] = id; + state->data[2] = cmd; + state->data[3] = write_len; - memcpy(buf + 4, data, write_len); + memcpy(state->data + 4, data, write_len); rlen = (read_len > 0) ? 64 : 0; - ret = dvb_usb_generic_rw(d, buf, 4 + write_len, - buf, rlen, /* delay_ms */ 0); + ret = dvb_usb_generic_rw(d, state->data, 4 + write_len, + state->data, rlen, /* delay_ms */ 0); if (0 != ret) goto failed; ret = -EIO; - if (SYNC_BYTE_IN != buf[0] || id != buf[1]) + if (SYNC_BYTE_IN != state->data[0] || id != state->data[1]) goto failed; - memcpy(data, buf + 4, read_len); + memcpy(data, state->data + 4, read_len); + mutex_unlock(&state->ca_mutex); return 0; failed: err("CI error %d; %02X %02X %02X -> %*ph.", - ret, SYNC_BYTE_OUT, id, cmd, 3, buf); + ret, SYNC_BYTE_OUT, id, cmd, 3, state->data); + mutex_unlock(&state->ca_mutex); return ret; } @@ -405,52 +409,53 @@ static int pctv452e_i2c_msg(struct dvb_usb_device *d, u8 addr, u8 *rcv_buf, u8 rcv_len) { struct pctv452e_state *state = (struct pctv452e_state *)d->priv; - u8 buf[64]; u8 id; int ret; + mutex_lock(&state->ca_mutex); id = state->c++; ret = -EINVAL; if (snd_len > 64 - 7 || rcv_len > 64 - 7) goto failed; - buf[0] = SYNC_BYTE_OUT; - buf[1] = id; - buf[2] = PCTV_CMD_I2C; - buf[3] = snd_len + 3; - buf[4] = addr << 1; - buf[5] = snd_len; - buf[6] = rcv_len; + state->data[0] = SYNC_BYTE_OUT; + state->data[1] = id; + state->data[2] = PCTV_CMD_I2C; + state->data[3] = snd_len + 3; + state->data[4] = addr << 1; + state->data[5] = snd_len; + state->data[6] = rcv_len; - memcpy(buf + 7, snd_buf, snd_len); + memcpy(state->data + 7, snd_buf, snd_len); - ret = dvb_usb_generic_rw(d, buf, 7 + snd_len, - buf, /* rcv_len */ 64, + ret = dvb_usb_generic_rw(d, state->data, 7 + snd_len, + state->data, /* rcv_len */ 64, /* delay_ms */ 0); if (ret < 0) goto failed; /* TT USB protocol error. */ ret = -EIO; - if (SYNC_BYTE_IN != buf[0] || id != buf[1]) + if (SYNC_BYTE_IN != state->data[0] || id != state->data[1]) goto failed; /* I2C device didn't respond as expected. */ ret = -EREMOTEIO; - if (buf[5] < snd_len || buf[6] < rcv_len) + if (state->data[5] < snd_len || state->data[6] < rcv_len) goto failed; - memcpy(rcv_buf, buf + 7, rcv_len); + memcpy(rcv_buf, state->data + 7, rcv_len); + mutex_unlock(&state->ca_mutex); return rcv_len; failed: - err("I2C error %d; %02X %02X %02X %02X %02X -> " - "%02X %02X %02X %02X %02X.", + err("I2C error %d; %02X %02X %02X %02X %02X -> %*ph", ret, SYNC_BYTE_OUT, id, addr << 1, snd_len, rcv_len, - buf[0], buf[1], buf[4], buf[5], buf[6]); + 7, state->data); + mutex_unlock(&state->ca_mutex); return ret; } @@ -499,8 +504,7 @@ static u32 pctv452e_i2c_func(struct i2c_adapter *adapter) static int pctv452e_power_ctrl(struct dvb_usb_device *d, int i) { struct pctv452e_state *state = (struct pctv452e_state *)d->priv; - u8 b0[] = { 0xaa, 0, PCTV_CMD_RESET, 1, 0 }; - u8 rx[PCTV_ANSWER_LEN]; + u8 *rx; int ret; info("%s: %d\n", __func__, i); @@ -511,6 +515,11 @@ static int pctv452e_power_ctrl(struct dvb_usb_device *d, int i) if (state->initialized) return 0; + rx = kmalloc(PCTV_ANSWER_LEN, GFP_KERNEL); + if (!rx) + return -ENOMEM; + + mutex_lock(&state->ca_mutex); /* hmm where shoud this should go? */ ret = usb_set_interface(d->udev, 0, ISOC_INTERFACE_ALTERNATIVE); if (ret != 0) @@ -518,65 +527,75 @@ static int pctv452e_power_ctrl(struct dvb_usb_device *d, int i) __func__, ret); /* this is a one-time initialization, dont know where to put */ - b0[1] = state->c++; + state->data[0] = 0xaa; + state->data[1] = state->c++; + state->data[2] = PCTV_CMD_RESET; + state->data[3] = 1; + state->data[4] = 0; /* reset board */ - ret = dvb_usb_generic_rw(d, b0, sizeof(b0), rx, PCTV_ANSWER_LEN, 0); + ret = dvb_usb_generic_rw(d, state->data, 5, rx, PCTV_ANSWER_LEN, 0); if (ret) - return ret; + goto ret; - b0[1] = state->c++; - b0[4] = 1; + state->data[1] = state->c++; + state->data[4] = 1; /* reset board (again?) */ - ret = dvb_usb_generic_rw(d, b0, sizeof(b0), rx, PCTV_ANSWER_LEN, 0); + ret = dvb_usb_generic_rw(d, state->data, 5, rx, PCTV_ANSWER_LEN, 0); if (ret) - return ret; + goto ret; state->initialized = 1; - return 0; +ret: + mutex_unlock(&state->ca_mutex); + kfree(rx); + return ret; } static int pctv452e_rc_query(struct dvb_usb_device *d) { struct pctv452e_state *state = (struct pctv452e_state *)d->priv; - u8 b[CMD_BUFFER_SIZE]; - u8 rx[PCTV_ANSWER_LEN]; int ret, i; - u8 id = state->c++; + u8 id; + + mutex_lock(&state->ca_mutex); + id = state->c++; /* prepare command header */ - b[0] = SYNC_BYTE_OUT; - b[1] = id; - b[2] = PCTV_CMD_IR; - b[3] = 0; + state->data[0] = SYNC_BYTE_OUT; + state->data[1] = id; + state->data[2] = PCTV_CMD_IR; + state->data[3] = 0; /* send ir request */ - ret = dvb_usb_generic_rw(d, b, 4, rx, PCTV_ANSWER_LEN, 0); + ret = dvb_usb_generic_rw(d, state->data, 4, + state->data, PCTV_ANSWER_LEN, 0); if (ret != 0) - return ret; + goto ret; if (debug > 3) { - info("%s: read: %2d: %*ph: ", __func__, ret, 3, rx); - for (i = 0; (i < rx[3]) && ((i+3) < PCTV_ANSWER_LEN); i++) - info(" %02x", rx[i+3]); + info("%s: read: %2d: %*ph: ", __func__, ret, 3, state->data); + for (i = 0; (i < state->data[3]) && ((i + 3) < PCTV_ANSWER_LEN); i++) + info(" %02x", state->data[i + 3]); info("\n"); } - if ((rx[3] == 9) && (rx[12] & 0x01)) { + if ((state->data[3] == 9) && (state->data[12] & 0x01)) { /* got a "press" event */ - state->last_rc_key = RC_SCANCODE_RC5(rx[7], rx[6]); + state->last_rc_key = RC_SCANCODE_RC5(state->data[7], state->data[6]); if (debug > 2) info("%s: cmd=0x%02x sys=0x%02x\n", - __func__, rx[6], rx[7]); + __func__, state->data[6], state->data[7]); rc_keydown(d->rc_dev, RC_TYPE_RC5, state->last_rc_key, 0); } else if (state->last_rc_key) { rc_keyup(d->rc_dev); state->last_rc_key = 0; } - - return 0; +ret: + mutex_unlock(&state->ca_mutex); + return ret; } static int pctv452e_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) From 5dfd2c8f263dfcaf614d24734f0af8c1c18a9ca8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 14:15:53 -0300 Subject: [PATCH 556/591] [media] pctv452e: don't call BUG_ON() on non-fatal error There are some conditions on this driver that are tested with BUG_ON() with are not serious enough to hang a machine. So, just return an error if this happens. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/pctv452e.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c index 58b685094904..7ad0006c5ae0 100644 --- a/drivers/media/usb/dvb-usb/pctv452e.c +++ b/drivers/media/usb/dvb-usb/pctv452e.c @@ -109,9 +109,10 @@ static int tt3650_ci_msg(struct dvb_usb_device *d, u8 cmd, u8 *data, unsigned int rlen; int ret; - BUG_ON(NULL == data && 0 != (write_len | read_len)); - BUG_ON(write_len > 64 - 4); - BUG_ON(read_len > 64 - 4); + if (!data || (write_len > 64 - 4) || (read_len > 64 - 4)) { + err("%s: transfer data invalid", __func__); + return -EIO; + }; mutex_lock(&state->ca_mutex); id = state->c++; From 88ca3619001380a3147246a22cb356f6065ad713 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 12:04:38 -0300 Subject: [PATCH 557/591] [media] technisat-usb2: use DMA buffers for I2C transfers The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. On this driver, most of the transfers are OK, but the I2C one was using stack. Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/technisat-usb2.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c index d9f3262bf071..4706628a3ed5 100644 --- a/drivers/media/usb/dvb-usb/technisat-usb2.c +++ b/drivers/media/usb/dvb-usb/technisat-usb2.c @@ -89,9 +89,13 @@ struct technisat_usb2_state { static int technisat_usb2_i2c_access(struct usb_device *udev, u8 device_addr, u8 *tx, u8 txlen, u8 *rx, u8 rxlen) { - u8 b[64]; + u8 *b; int ret, actual_length; + b = kmalloc(64, GFP_KERNEL); + if (!b) + return -ENOMEM; + deb_i2c("i2c-access: %02x, tx: ", device_addr); debug_dump(tx, txlen, deb_i2c); deb_i2c(" "); @@ -123,7 +127,7 @@ static int technisat_usb2_i2c_access(struct usb_device *udev, if (ret < 0) { err("i2c-error: out failed %02x = %d", device_addr, ret); - return -ENODEV; + goto err; } ret = usb_bulk_msg(udev, @@ -131,7 +135,7 @@ static int technisat_usb2_i2c_access(struct usb_device *udev, b, 64, &actual_length, 1000); if (ret < 0) { err("i2c-error: in failed %02x = %d", device_addr, ret); - return -ENODEV; + goto err; } if (b[0] != I2C_STATUS_OK) { @@ -140,7 +144,7 @@ static int technisat_usb2_i2c_access(struct usb_device *udev, if (!(b[0] == I2C_STATUS_NAK && device_addr == 0x60 /* && device_is_technisat_usb2 */)) - return -ENODEV; + goto err; } deb_i2c("status: %d, ", b[0]); @@ -154,7 +158,9 @@ static int technisat_usb2_i2c_access(struct usb_device *udev, deb_i2c("\n"); - return 0; +err: + kfree(b); + return ret; } static int technisat_usb2_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, From e2296021081584bd6f0e2ea21e8b909c1d4b5a07 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 13:50:21 -0300 Subject: [PATCH 558/591] [media] nova-t-usb2: handle error code on RC query There's no sense on decoding and generating a RC key code if there was an error on the URB control message. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/nova-t-usb2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb/nova-t-usb2.c b/drivers/media/usb/dvb-usb/nova-t-usb2.c index 26d7188a1163..1babd3341910 100644 --- a/drivers/media/usb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/usb/dvb-usb/nova-t-usb2.c @@ -76,7 +76,7 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { u8 *buf, data, toggle, custom; u16 raw; - int i; + int i, ret; struct dibusb_device_state *st = d->priv; buf = kmalloc(5, GFP_KERNEL); @@ -85,7 +85,9 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) buf[0] = DIBUSB_REQ_POLL_REMOTE; buf[1] = 0x35; - dvb_usb_generic_rw(d, buf, 2, buf, 5, 0); + ret = dvb_usb_generic_rw(d, buf, 2, buf, 5, 0); + if (ret < 0) + goto ret; *state = REMOTE_NO_KEY_PRESSED; switch (buf[0]) { @@ -124,8 +126,9 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) break; } +ret: kfree(buf); - return 0; + return ret; } static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6]) From aa9efbc7b64aa1c3bf6682d06e6970b874d55d08 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 13:55:53 -0300 Subject: [PATCH 559/591] [media] dw2102: return error if su3000_power_ctrl() fails Instead of silently ignoring the error, return it. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/dw2102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c index 5fb0c650926e..2c720cb2fb00 100644 --- a/drivers/media/usb/dvb-usb/dw2102.c +++ b/drivers/media/usb/dvb-usb/dw2102.c @@ -852,7 +852,7 @@ static int su3000_power_ctrl(struct dvb_usb_device *d, int i) if (i && !state->initialized) { state->initialized = 1; /* reset board */ - dvb_usb_generic_rw(d, obuf, 2, NULL, 0, 0); + return dvb_usb_generic_rw(d, obuf, 2, NULL, 0, 0); } return 0; From 3dadf91cb830ac3a6992e539d82ec604fffe8671 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Oct 2016 13:52:31 -0300 Subject: [PATCH 560/591] [media] digitv: handle error code on RC query There's no sense on decoding and generating a RC key code if there was an error on the URB control message. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/digitv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c index 09f8c28bd4db..4284f6984dc1 100644 --- a/drivers/media/usb/dvb-usb/digitv.c +++ b/drivers/media/usb/dvb-usb/digitv.c @@ -29,7 +29,9 @@ static int digitv_ctrl_msg(struct dvb_usb_device *d, u8 cmd, u8 vv, u8 *wbuf, int wlen, u8 *rbuf, int rlen) { struct digitv_state *st = d->priv; - int wo = (rbuf == NULL || rlen == 0); /* write-only */ + int ret, wo; + + wo = (rbuf == NULL || rlen == 0); /* write-only */ memset(st->sndbuf, 0, 7); memset(st->rcvbuf, 0, 7); @@ -40,12 +42,12 @@ static int digitv_ctrl_msg(struct dvb_usb_device *d, if (wo) { memcpy(&st->sndbuf[3], wbuf, wlen); - dvb_usb_generic_write(d, st->sndbuf, 7); + ret = dvb_usb_generic_write(d, st->sndbuf, 7); } else { - dvb_usb_generic_rw(d, st->sndbuf, 7, st->rcvbuf, 7, 10); + ret = dvb_usb_generic_rw(d, st->sndbuf, 7, st->rcvbuf, 7, 10); memcpy(rbuf, &st->rcvbuf[3], rlen); } - return 0; + return ret; } /* I2C */ From 45ae4a5220a43ae79dacb69054a2c7928dd91c94 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 10 Oct 2016 08:28:26 -0300 Subject: [PATCH 561/591] [media] cpia2_usb: don't use stack for DMA The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cpia2/cpia2_usb.c | 34 +++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c index 13620cdf0599..e9100a235831 100644 --- a/drivers/media/usb/cpia2/cpia2_usb.c +++ b/drivers/media/usb/cpia2/cpia2_usb.c @@ -545,18 +545,30 @@ static void free_sbufs(struct camera_data *cam) static int write_packet(struct usb_device *udev, u8 request, u8 * registers, u16 start, size_t size) { + unsigned char *buf; + int ret; + if (!registers || size <= 0) return -EINVAL; - return usb_control_msg(udev, + buf = kmalloc(size, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + memcpy(buf, registers, size); + + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, start, /* value */ 0, /* index */ - registers, /* buffer */ + buf, /* buffer */ size, HZ); + + kfree(buf); + return ret; } /**************************************************************************** @@ -567,18 +579,32 @@ static int write_packet(struct usb_device *udev, static int read_packet(struct usb_device *udev, u8 request, u8 * registers, u16 start, size_t size) { + unsigned char *buf; + int ret; + if (!registers || size <= 0) return -EINVAL; - return usb_control_msg(udev, + buf = kmalloc(size, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), request, USB_DIR_IN|USB_TYPE_VENDOR|USB_RECIP_DEVICE, start, /* value */ 0, /* index */ - registers, /* buffer */ + buf, /* buffer */ size, HZ); + + if (ret >= 0) + memcpy(registers, buf, size); + + kfree(buf); + + return ret; } /****************************************************************************** From db65c49e442cf9c9d9dc950f67daf109609f982a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 10 Oct 2016 11:11:13 -0300 Subject: [PATCH 562/591] [media] s2255drv: don't use stack for DMA The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/s2255/s2255drv.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index c3a0e87066eb..f7bb78c1873c 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -1901,19 +1901,30 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request, s32 TransferBufferLength, int bOut) { int r; + unsigned char *buf; + + buf = kmalloc(TransferBufferLength, GFP_KERNEL); + if (!buf) + return -ENOMEM; + if (!bOut) { r = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - Value, Index, TransferBuffer, + Value, Index, buf, TransferBufferLength, HZ * 5); + + if (r >= 0) + memcpy(TransferBuffer, buf, TransferBufferLength); } else { + memcpy(buf, TransferBuffer, TransferBufferLength); r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE, - Value, Index, TransferBuffer, + Value, Index, buf, TransferBufferLength, HZ * 5); } + kfree(buf); return r; } From b5f93cb5133d3ad517afef541502c6c9aecf8e5d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 10 Oct 2016 11:17:15 -0300 Subject: [PATCH 563/591] [media] stk-webcam: don't use stack for DMA The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/stkwebcam/stk-webcam.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index db200c9d796d..22a9aae16291 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -147,20 +147,26 @@ int stk_camera_write_reg(struct stk_camera *dev, u16 index, u8 value) int stk_camera_read_reg(struct stk_camera *dev, u16 index, int *value) { struct usb_device *udev = dev->udev; + unsigned char *buf; int ret; + buf = kmalloc(sizeof(u8), GFP_KERNEL); + if (!buf) + return -ENOMEM; + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x00, index, - (u8 *) value, + buf, sizeof(u8), 500); - if (ret < 0) - return ret; - else - return 0; + if (ret >= 0) + memcpy(value, buf, sizeof(u8)); + + kfree(buf); + return ret; } static int stk_start_stream(struct stk_camera *dev) From b430eaba0be5eb7140d0065df96982fa6b5ccc1d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 10 Oct 2016 07:55:54 -0300 Subject: [PATCH 564/591] [media] flexcop-usb: don't use stack for DMA The USB control messages require DMA to work. We cannot pass a stack-allocated buffer, as it is not warranted that the stack would be into a DMA enabled area. While here, remove a dead function calling usb_control_msg(). Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/b2c2/flexcop-usb.c | 105 +++++++++++++++++---------- drivers/media/usb/b2c2/flexcop-usb.h | 4 + 2 files changed, 72 insertions(+), 37 deletions(-) diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c index d4bdba60b0f7..52bc42da8a4c 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.c +++ b/drivers/media/usb/b2c2/flexcop-usb.c @@ -73,23 +73,34 @@ static int flexcop_usb_readwrite_dw(struct flexcop_device *fc, u16 wRegOffsPCI, u8 request_type = (read ? USB_DIR_IN : USB_DIR_OUT) | USB_TYPE_VENDOR; u8 wAddress = B2C2_FLEX_PCIOFFSET_TO_INTERNALADDR(wRegOffsPCI) | (read ? 0x80 : 0); + int ret; - int len = usb_control_msg(fc_usb->udev, + mutex_lock(&fc_usb->data_mutex); + if (!read) + memcpy(fc_usb->data, val, sizeof(*val)); + + ret = usb_control_msg(fc_usb->udev, read ? B2C2_USB_CTRL_PIPE_IN : B2C2_USB_CTRL_PIPE_OUT, request, request_type, /* 0xc0 read or 0x40 write */ wAddress, 0, - val, + fc_usb->data, sizeof(u32), B2C2_WAIT_FOR_OPERATION_RDW * HZ); - if (len != sizeof(u32)) { + if (ret != sizeof(u32)) { err("error while %s dword from %d (%d).", read ? "reading" : "writing", wAddress, wRegOffsPCI); - return -EIO; + if (ret >= 0) + ret = -EIO; } - return 0; + + if (read && ret >= 0) + memcpy(val, fc_usb->data, sizeof(*val)); + mutex_unlock(&fc_usb->data_mutex); + + return ret; } /* * DKT 010817 - add support for V8 memory read/write and flash update @@ -100,9 +111,14 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb, { u8 request_type = USB_TYPE_VENDOR; u16 wIndex; - int nWaitTime, pipe, len; + int nWaitTime, pipe, ret; wIndex = page << 8; + if (buflen > sizeof(fc_usb->data)) { + err("Buffer size bigger than max URB control message\n"); + return -EIO; + } + switch (req) { case B2C2_USB_READ_V8_MEM: nWaitTime = B2C2_WAIT_FOR_OPERATION_V8READ; @@ -127,17 +143,32 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb, deb_v8("v8mem: %02x %02x %04x %04x, len: %d\n", request_type, req, wAddress, wIndex, buflen); - len = usb_control_msg(fc_usb->udev, pipe, + mutex_lock(&fc_usb->data_mutex); + + if ((request_type & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) + memcpy(fc_usb->data, pbBuffer, buflen); + + ret = usb_control_msg(fc_usb->udev, pipe, req, request_type, wAddress, wIndex, - pbBuffer, + fc_usb->data, buflen, nWaitTime * HZ); + if (ret != buflen) + ret = -EIO; - debug_dump(pbBuffer, len, deb_v8); - return len == buflen ? 0 : -EIO; + if (ret >= 0) { + ret = 0; + if ((request_type & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) + memcpy(pbBuffer, fc_usb->data, buflen); + } + + mutex_unlock(&fc_usb->data_mutex); + + debug_dump(pbBuffer, ret, deb_v8); + return ret; } #define bytes_left_to_read_on_page(paddr,buflen) \ @@ -196,29 +227,6 @@ static int flexcop_usb_get_mac_addr(struct flexcop_device *fc, int extended) fc->dvb_adapter.proposed_mac, 6); } -#if 0 -static int flexcop_usb_utility_req(struct flexcop_usb *fc_usb, int set, - flexcop_usb_utility_function_t func, u8 extra, u16 wIndex, - u16 buflen, u8 *pvBuffer) -{ - u16 wValue; - u8 request_type = (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR; - int nWaitTime = 2, - pipe = set ? B2C2_USB_CTRL_PIPE_OUT : B2C2_USB_CTRL_PIPE_IN, len; - wValue = (func << 8) | extra; - - len = usb_control_msg(fc_usb->udev,pipe, - B2C2_USB_UTILITY, - request_type, - wValue, - wIndex, - pvBuffer, - buflen, - nWaitTime * HZ); - return len == buflen ? 0 : -EIO; -} -#endif - /* usb i2c stuff */ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, flexcop_usb_request_t req, flexcop_usb_i2c_function_t func, @@ -226,9 +234,14 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, { struct flexcop_usb *fc_usb = i2c->fc->bus_specific; u16 wValue, wIndex; - int nWaitTime,pipe,len; + int nWaitTime, pipe, ret; u8 request_type = USB_TYPE_VENDOR; + if (buflen > sizeof(fc_usb->data)) { + err("Buffer size bigger than max URB control message\n"); + return -EIO; + } + switch (func) { case USB_FUNC_I2C_WRITE: case USB_FUNC_I2C_MULTIWRITE: @@ -257,15 +270,32 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, wValue & 0xff, wValue >> 8, wIndex & 0xff, wIndex >> 8); - len = usb_control_msg(fc_usb->udev,pipe, + mutex_lock(&fc_usb->data_mutex); + + if ((request_type & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) + memcpy(fc_usb->data, buf, buflen); + + ret = usb_control_msg(fc_usb->udev, pipe, req, request_type, wValue, wIndex, - buf, + fc_usb->data, buflen, nWaitTime * HZ); - return len == buflen ? 0 : -EREMOTEIO; + + if (ret != buflen) + ret = -EIO; + + if (ret >= 0) { + ret = 0; + if ((request_type & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) + memcpy(buf, fc_usb->data, buflen); + } + + mutex_unlock(&fc_usb->data_mutex); + + return 0; } /* actual bus specific access functions, @@ -516,6 +546,7 @@ static int flexcop_usb_probe(struct usb_interface *intf, /* general flexcop init */ fc_usb = fc->bus_specific; fc_usb->fc_dev = fc; + mutex_init(&fc_usb->data_mutex); fc->read_ibi_reg = flexcop_usb_read_ibi_reg; fc->write_ibi_reg = flexcop_usb_write_ibi_reg; diff --git a/drivers/media/usb/b2c2/flexcop-usb.h b/drivers/media/usb/b2c2/flexcop-usb.h index 92529a9c4475..25ad43166e78 100644 --- a/drivers/media/usb/b2c2/flexcop-usb.h +++ b/drivers/media/usb/b2c2/flexcop-usb.h @@ -29,6 +29,10 @@ struct flexcop_usb { u8 tmp_buffer[1023+190]; int tmp_buffer_length; + + /* for URB control messages */ + u8 data[80]; + struct mutex data_mutex; }; #if 0 From 59dde8e70cfb7afbc1b647d7d3440dfb9a78b431 Mon Sep 17 00:00:00 2001 From: kbuild test robot Date: Tue, 11 Oct 2016 10:22:08 -0300 Subject: [PATCH 565/591] [media] pctv452e: fix semicolon.cocci warnings drivers/media/usb/dvb-usb/pctv452e.c:115:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Signed-off-by: Fengguang Wu Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb/pctv452e.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c index 7ad0006c5ae0..07fa08be9e99 100644 --- a/drivers/media/usb/dvb-usb/pctv452e.c +++ b/drivers/media/usb/dvb-usb/pctv452e.c @@ -112,7 +112,7 @@ static int tt3650_ci_msg(struct dvb_usb_device *d, u8 cmd, u8 *data, if (!data || (write_len > 64 - 4) || (read_len > 64 - 4)) { err("%s: transfer data invalid", __func__); return -EIO; - }; + } mutex_lock(&state->ca_mutex); id = state->c++; From 1aeb5b615cd10db7324d4e4d167c4916dfeca311 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 12 Oct 2016 08:21:43 -0300 Subject: [PATCH 566/591] [media] radio-bcm2048: don't ignore errors Remove this warning: drivers/staging/media/bcm2048/radio-bcm2048.c: In function 'bcm2048_set_rds_no_lock': drivers/staging/media/bcm2048/radio-bcm2048.c:467:6: warning: variable 'err' set but not used [-Wunused-but-set-variable] int err; ^~~ By returning the error code. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/bcm2048/radio-bcm2048.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 8dade197f053..0f088405e186 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -482,6 +482,8 @@ static int bcm2048_set_rds_no_lock(struct bcm2048_device *bdev, u8 rds_on) flags); memset(&bdev->rds_info, 0, sizeof(bdev->rds_info)); } + if (err) + return err; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_SYSTEM, bdev->cache_fm_rds_system); From ad338e8b5c8cdb5142380cd6b058dfe24956ee93 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 7 Nov 2016 17:33:07 -0800 Subject: [PATCH 567/591] Input: synaptics-rmi4 - stop scanning PDT after two empty pages We have encountered some RMI4 firmwares where there are blank pages in between PDT pages which contain functions. This change makes them correctly enumerate all functions on the device. Tested on S7817 (has empty page 2). Signed-off-by: Nick Dyer [Tested successfully on S7817 and S7300 Synaptics touch controllers] Tested-by: Chris Healy Reviewed-by: Andrew Duggan Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_driver.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index c83bce89028b..81e20f1f7ec3 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -423,6 +423,7 @@ static void rmi_driver_copy_pdt_to_fd(const struct pdt_entry *pdt, static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, int page, + int *empty_pages, void *ctx, int (*callback)(struct rmi_device *rmi_dev, void *ctx, @@ -450,7 +451,16 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, return retval; } - return (data->f01_bootloader_mode || addr == pdt_start) ? + /* + * Count number of empty PDT pages. If a gap of two pages + * or more is found, stop scanning. + */ + if (addr == pdt_start) + ++*empty_pages; + else + *empty_pages = 0; + + return (data->f01_bootloader_mode || *empty_pages >= 2) ? RMI_SCAN_DONE : RMI_SCAN_CONTINUE; } @@ -460,10 +470,12 @@ static int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, const struct pdt_entry *entry)) { int page; + int empty_pages = 0; int retval = RMI_SCAN_DONE; for (page = 0; page <= RMI4_MAX_PAGE; page++) { - retval = rmi_scan_pdt_page(rmi_dev, page, ctx, callback); + retval = rmi_scan_pdt_page(rmi_dev, page, &empty_pages, + ctx, callback); if (retval != RMI_SCAN_CONTINUE) break; } From 6bd0dcfacf2875f234483d57acc16b015cd313f3 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 7 Nov 2016 17:35:15 -0800 Subject: [PATCH 568/591] Input: synaptics-rmi4 - factor out functions from probe Signed-off-by: Nick Dyer Signed-off-by: Benjamin Tissoires Tested-by: Chris Healy Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_driver.c | 139 ++++++++++++++++++++------------ 1 file changed, 86 insertions(+), 53 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 81e20f1f7ec3..282522e58286 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -39,6 +39,8 @@ static void rmi_free_function_list(struct rmi_device *rmi_dev) struct rmi_function *fn, *tmp; struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); + rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Freeing function list\n"); + data->f01_container = NULL; /* Doing it in the reverse order so F01 will be removed last */ @@ -855,15 +857,90 @@ static inline int rmi_driver_of_probe(struct device *dev, } #endif +static int rmi_probe_interrupts(struct rmi_driver_data *data) +{ + struct rmi_device *rmi_dev = data->rmi_dev; + struct device *dev = &rmi_dev->dev; + int irq_count; + size_t size; + void *irq_memory; + int retval; + + /* + * We need to count the IRQs and allocate their storage before scanning + * the PDT and creating the function entries, because adding a new + * function can trigger events that result in the IRQ related storage + * being accessed. + */ + rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Counting IRQs.\n", __func__); + irq_count = 0; + retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_count_irqs); + if (retval < 0) { + dev_err(dev, "IRQ counting failed with code %d.\n", retval); + return retval; + } + data->irq_count = irq_count; + data->num_of_irq_regs = (data->irq_count + 7) / 8; + + size = BITS_TO_LONGS(data->irq_count) * sizeof(unsigned long); + irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL); + if (!irq_memory) { + dev_err(dev, "Failed to allocate memory for irq masks.\n"); + return retval; + } + + data->irq_status = irq_memory + size * 0; + data->fn_irq_bits = irq_memory + size * 1; + data->current_irq_mask = irq_memory + size * 2; + data->new_irq_mask = irq_memory + size * 3; + + return retval; +} + +static int rmi_init_functions(struct rmi_driver_data *data) +{ + struct rmi_device *rmi_dev = data->rmi_dev; + struct device *dev = &rmi_dev->dev; + int irq_count; + int retval; + + irq_count = 0; + rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Creating functions.\n", __func__); + retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_create_function); + if (retval < 0) { + dev_err(dev, "Function creation failed with code %d.\n", + retval); + goto err_destroy_functions; + } + + if (!data->f01_container) { + dev_err(dev, "Missing F01 container!\n"); + retval = -EINVAL; + goto err_destroy_functions; + } + + retval = rmi_read_block(rmi_dev, + data->f01_container->fd.control_base_addr + 1, + data->current_irq_mask, data->num_of_irq_regs); + if (retval < 0) { + dev_err(dev, "%s: Failed to read current IRQ mask.\n", + __func__); + goto err_destroy_functions; + } + + return 0; + +err_destroy_functions: + rmi_free_function_list(rmi_dev); + return retval; +} + static int rmi_driver_probe(struct device *dev) { struct rmi_driver *rmi_driver; struct rmi_driver_data *data; struct rmi_device_platform_data *pdata; struct rmi_device *rmi_dev; - size_t size; - void *irq_memory; - int irq_count; int retval; rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Starting probe.\n", @@ -929,35 +1006,11 @@ static int rmi_driver_probe(struct device *dev) PDT_PROPERTIES_LOCATION, retval); } - /* - * We need to count the IRQs and allocate their storage before scanning - * the PDT and creating the function entries, because adding a new - * function can trigger events that result in the IRQ related storage - * being accessed. - */ - rmi_dbg(RMI_DEBUG_CORE, dev, "Counting IRQs.\n"); - irq_count = 0; - retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_count_irqs); - if (retval < 0) { - dev_err(dev, "IRQ counting failed with code %d.\n", retval); - goto err; - } - data->irq_count = irq_count; - data->num_of_irq_regs = (data->irq_count + 7) / 8; - mutex_init(&data->irq_mutex); - size = BITS_TO_LONGS(data->irq_count) * sizeof(unsigned long); - irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL); - if (!irq_memory) { - dev_err(dev, "Failed to allocate memory for irq masks.\n"); + retval = rmi_probe_interrupts(data); + if (retval) goto err; - } - - data->irq_status = irq_memory + size * 0; - data->fn_irq_bits = irq_memory + size * 1; - data->current_irq_mask = irq_memory + size * 2; - data->new_irq_mask = irq_memory + size * 3; if (rmi_dev->xport->input) { /* @@ -974,36 +1027,16 @@ static int rmi_driver_probe(struct device *dev) dev_err(dev, "%s: Failed to allocate input device.\n", __func__); retval = -ENOMEM; - goto err_destroy_functions; + goto err; } rmi_driver_set_input_params(rmi_dev, data->input); data->input->phys = devm_kasprintf(dev, GFP_KERNEL, "%s/input0", dev_name(dev)); } - irq_count = 0; - rmi_dbg(RMI_DEBUG_CORE, dev, "Creating functions."); - retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_create_function); - if (retval < 0) { - dev_err(dev, "Function creation failed with code %d.\n", - retval); - goto err_destroy_functions; - } - - if (!data->f01_container) { - dev_err(dev, "Missing F01 container!\n"); - retval = -EINVAL; - goto err_destroy_functions; - } - - retval = rmi_read_block(rmi_dev, - data->f01_container->fd.control_base_addr + 1, - data->current_irq_mask, data->num_of_irq_regs); - if (retval < 0) { - dev_err(dev, "%s: Failed to read current IRQ mask.\n", - __func__); - goto err_destroy_functions; - } + retval = rmi_init_functions(data); + if (retval) + goto err; if (data->input) { rmi_driver_set_input_name(rmi_dev, data->input); From 8029a283c4ac100dc4492993633d4c87a7da55d6 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Mon, 7 Nov 2016 17:36:57 -0800 Subject: [PATCH 569/591] Input: synaptics-rmi4 - add a couple of debug lines Signed-off-by: Nick Dyer Tested-by: Chris Healy Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_bus.c | 3 +++ drivers/input/rmi4/rmi_driver.c | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index 09c769c6e91f..84b321262d74 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -231,6 +231,9 @@ err_put_device: void rmi_unregister_function(struct rmi_function *fn) { + rmi_dbg(RMI_DEBUG_CORE, &fn->dev, "Unregistering F%02X.\n", + fn->fd.function_number); + device_del(&fn->dev); of_node_put(fn->dev.of_node); put_device(&fn->dev); diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 282522e58286..06feede3ce17 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -735,6 +735,7 @@ static int rmi_initial_reset(struct rmi_device *rmi_dev, return RMI_SCAN_DONE; } + rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Sending reset\n"); error = rmi_write_block(rmi_dev, cmd_addr, &cmd_buf, 1); if (error) { dev_err(&rmi_dev->dev, From 3aeed5b573f97b4525841cc07c1e948227af389f Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Tue, 8 Nov 2016 16:34:57 -0800 Subject: [PATCH 570/591] Input: synaptics-rmi4 - move IRQ handling to rmi_driver The attn IRQ is related to the chip, rather than the transport, so move all handling of interrupts to the core driver. This also makes sure that there are no races between interrupts and availability of the resources used by the core driver. Signed-off-by: Bjorn Andersson Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_driver.c | 73 ++++++++++++++++++++++++++++++-- drivers/input/rmi4/rmi_i2c.c | 74 +++------------------------------ drivers/input/rmi4/rmi_spi.c | 72 +++----------------------------- include/linux/rmi.h | 7 ++-- 4 files changed, 83 insertions(+), 143 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 06feede3ce17..4f8d19794b01 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -136,7 +137,7 @@ static void process_one_interrupt(struct rmi_driver_data *data, } } -int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) +static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) { struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); struct device *dev = &rmi_dev->dev; @@ -181,7 +182,42 @@ int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) return 0; } -EXPORT_SYMBOL_GPL(rmi_process_interrupt_requests); + +static irqreturn_t rmi_irq_fn(int irq, void *dev_id) +{ + struct rmi_device *rmi_dev = dev_id; + int ret; + + ret = rmi_process_interrupt_requests(rmi_dev); + if (ret) + rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, + "Failed to process interrupt request: %d\n", ret); + + return IRQ_HANDLED; +} + +static int rmi_irq_init(struct rmi_device *rmi_dev) +{ + struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); + int irq_flags = irq_get_trigger_type(pdata->irq); + int ret; + + if (!irq_flags) + irq_flags = IRQF_TRIGGER_LOW; + + ret = devm_request_threaded_irq(&rmi_dev->dev, pdata->irq, NULL, + rmi_irq_fn, irq_flags | IRQF_ONESHOT, + dev_name(rmi_dev->xport->dev), + rmi_dev); + if (ret < 0) { + dev_err(&rmi_dev->dev, "Failed to register interrupt %d\n", + pdata->irq); + + return ret; + } + + return 0; +} static int suspend_one_function(struct rmi_function *fn) { @@ -802,8 +838,10 @@ err_put_fn: return error; } -int rmi_driver_suspend(struct rmi_device *rmi_dev) +int rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake) { + struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); + int irq = pdata->irq; int retval = 0; retval = rmi_suspend_functions(rmi_dev); @@ -811,14 +849,33 @@ int rmi_driver_suspend(struct rmi_device *rmi_dev) dev_warn(&rmi_dev->dev, "Failed to suspend functions: %d\n", retval); + disable_irq(irq); + if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) { + retval = enable_irq_wake(irq); + if (!retval) + dev_warn(&rmi_dev->dev, + "Failed to enable irq for wake: %d\n", + retval); + } return retval; } EXPORT_SYMBOL_GPL(rmi_driver_suspend); -int rmi_driver_resume(struct rmi_device *rmi_dev) +int rmi_driver_resume(struct rmi_device *rmi_dev, bool clear_wake) { + struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); + int irq = pdata->irq; int retval; + enable_irq(irq); + if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) { + retval = disable_irq_wake(irq); + if (!retval) + dev_warn(&rmi_dev->dev, + "Failed to disable irq for wake: %d\n", + retval); + } + retval = rmi_resume_functions(rmi_dev); if (retval) dev_warn(&rmi_dev->dev, "Failed to suspend functions: %d\n", @@ -831,6 +888,10 @@ EXPORT_SYMBOL_GPL(rmi_driver_resume); static int rmi_driver_remove(struct device *dev) { struct rmi_device *rmi_dev = to_rmi_device(dev); + struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); + int irq = pdata->irq; + + disable_irq(irq); rmi_free_function_list(rmi_dev); @@ -1050,6 +1111,10 @@ static int rmi_driver_probe(struct device *dev) } } + retval = rmi_irq_init(rmi_dev); + if (retval < 0) + goto err_destroy_functions; + if (data->f01_container->dev.driver) /* Driver already bound, so enable ATTN now. */ return enable_sensor(rmi_dev); diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c index 6f2e0e4f0296..64a548822da4 100644 --- a/drivers/input/rmi4/rmi_i2c.c +++ b/drivers/input/rmi4/rmi_i2c.c @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -35,8 +34,6 @@ struct rmi_i2c_xport { struct mutex page_mutex; int page; - int irq; - u8 *tx_buf; size_t tx_buf_size; @@ -177,42 +174,6 @@ static const struct rmi_transport_ops rmi_i2c_ops = { .read_block = rmi_i2c_read_block, }; -static irqreturn_t rmi_i2c_irq(int irq, void *dev_id) -{ - struct rmi_i2c_xport *rmi_i2c = dev_id; - struct rmi_device *rmi_dev = rmi_i2c->xport.rmi_dev; - int ret; - - ret = rmi_process_interrupt_requests(rmi_dev); - if (ret) - rmi_dbg(RMI_DEBUG_XPORT, &rmi_dev->dev, - "Failed to process interrupt request: %d\n", ret); - - return IRQ_HANDLED; -} - -static int rmi_i2c_init_irq(struct i2c_client *client) -{ - struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); - int irq_flags = irqd_get_trigger_type(irq_get_irq_data(rmi_i2c->irq)); - int ret; - - if (!irq_flags) - irq_flags = IRQF_TRIGGER_LOW; - - ret = devm_request_threaded_irq(&client->dev, rmi_i2c->irq, NULL, - rmi_i2c_irq, irq_flags | IRQF_ONESHOT, client->name, - rmi_i2c); - if (ret < 0) { - dev_warn(&client->dev, "Failed to register interrupt %d\n", - rmi_i2c->irq); - - return ret; - } - - return 0; -} - #ifdef CONFIG_OF static const struct of_device_id rmi_i2c_of_match[] = { { .compatible = "syna,rmi4-i2c" }, @@ -240,8 +201,7 @@ static int rmi_i2c_probe(struct i2c_client *client, if (!client->dev.of_node && client_pdata) *pdata = *client_pdata; - if (client->irq > 0) - rmi_i2c->irq = client->irq; + pdata->irq = client->irq; rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Probing %s.\n", dev_name(&client->dev)); @@ -295,10 +255,6 @@ static int rmi_i2c_probe(struct i2c_client *client, return retval; } - retval = rmi_i2c_init_irq(client); - if (retval < 0) - return retval; - dev_info(&client->dev, "registered rmi i2c driver at %#04x.\n", client->addr); return 0; @@ -322,18 +278,10 @@ static int rmi_i2c_suspend(struct device *dev) struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); int ret; - ret = rmi_driver_suspend(rmi_i2c->xport.rmi_dev); + ret = rmi_driver_suspend(rmi_i2c->xport.rmi_dev, true); if (ret) dev_warn(dev, "Failed to resume device: %d\n", ret); - disable_irq(rmi_i2c->irq); - if (device_may_wakeup(&client->dev)) { - ret = enable_irq_wake(rmi_i2c->irq); - if (!ret) - dev_warn(dev, "Failed to enable irq for wake: %d\n", - ret); - } - regulator_bulk_disable(ARRAY_SIZE(rmi_i2c->supplies), rmi_i2c->supplies); @@ -353,15 +301,7 @@ static int rmi_i2c_resume(struct device *dev) msleep(rmi_i2c->startup_delay); - enable_irq(rmi_i2c->irq); - if (device_may_wakeup(&client->dev)) { - ret = disable_irq_wake(rmi_i2c->irq); - if (!ret) - dev_warn(dev, "Failed to disable irq for wake: %d\n", - ret); - } - - ret = rmi_driver_resume(rmi_i2c->xport.rmi_dev); + ret = rmi_driver_resume(rmi_i2c->xport.rmi_dev, true); if (ret) dev_warn(dev, "Failed to resume device: %d\n", ret); @@ -376,12 +316,10 @@ static int rmi_i2c_runtime_suspend(struct device *dev) struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); int ret; - ret = rmi_driver_suspend(rmi_i2c->xport.rmi_dev); + ret = rmi_driver_suspend(rmi_i2c->xport.rmi_dev, false); if (ret) dev_warn(dev, "Failed to resume device: %d\n", ret); - disable_irq(rmi_i2c->irq); - regulator_bulk_disable(ARRAY_SIZE(rmi_i2c->supplies), rmi_i2c->supplies); @@ -401,9 +339,7 @@ static int rmi_i2c_runtime_resume(struct device *dev) msleep(rmi_i2c->startup_delay); - enable_irq(rmi_i2c->irq); - - ret = rmi_driver_resume(rmi_i2c->xport.rmi_dev); + ret = rmi_driver_resume(rmi_i2c->xport.rmi_dev, false); if (ret) dev_warn(dev, "Failed to resume device: %d\n", ret); diff --git a/drivers/input/rmi4/rmi_spi.c b/drivers/input/rmi4/rmi_spi.c index 55bd1b34970c..f3e9e488635c 100644 --- a/drivers/input/rmi4/rmi_spi.c +++ b/drivers/input/rmi4/rmi_spi.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include "rmi_driver.h" @@ -44,8 +43,6 @@ struct rmi_spi_xport { struct mutex page_mutex; int page; - int irq; - u8 *rx_buf; u8 *tx_buf; int xfer_buf_size; @@ -326,41 +323,6 @@ static const struct rmi_transport_ops rmi_spi_ops = { .read_block = rmi_spi_read_block, }; -static irqreturn_t rmi_spi_irq(int irq, void *dev_id) -{ - struct rmi_spi_xport *rmi_spi = dev_id; - struct rmi_device *rmi_dev = rmi_spi->xport.rmi_dev; - int ret; - - ret = rmi_process_interrupt_requests(rmi_dev); - if (ret) - rmi_dbg(RMI_DEBUG_XPORT, &rmi_dev->dev, - "Failed to process interrupt request: %d\n", ret); - - return IRQ_HANDLED; -} - -static int rmi_spi_init_irq(struct spi_device *spi) -{ - struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); - int irq_flags = irqd_get_trigger_type(irq_get_irq_data(rmi_spi->irq)); - int ret; - - if (!irq_flags) - irq_flags = IRQF_TRIGGER_LOW; - - ret = devm_request_threaded_irq(&spi->dev, rmi_spi->irq, NULL, - rmi_spi_irq, irq_flags | IRQF_ONESHOT, - dev_name(&spi->dev), rmi_spi); - if (ret < 0) { - dev_warn(&spi->dev, "Failed to register interrupt %d\n", - rmi_spi->irq); - return ret; - } - - return 0; -} - #ifdef CONFIG_OF static int rmi_spi_of_probe(struct spi_device *spi, struct rmi_device_platform_data *pdata) @@ -433,8 +395,7 @@ static int rmi_spi_probe(struct spi_device *spi) return retval; } - if (spi->irq > 0) - rmi_spi->irq = spi->irq; + pdata->irq = spi->irq; rmi_spi->spi = spi; mutex_init(&rmi_spi->page_mutex); @@ -465,10 +426,6 @@ static int rmi_spi_probe(struct spi_device *spi) return retval; } - retval = rmi_spi_init_irq(spi); - if (retval < 0) - return retval; - dev_info(&spi->dev, "registered RMI SPI driver\n"); return 0; } @@ -489,17 +446,10 @@ static int rmi_spi_suspend(struct device *dev) struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); int ret; - ret = rmi_driver_suspend(rmi_spi->xport.rmi_dev); + ret = rmi_driver_suspend(rmi_spi->xport.rmi_dev, true); if (ret) dev_warn(dev, "Failed to resume device: %d\n", ret); - disable_irq(rmi_spi->irq); - if (device_may_wakeup(&spi->dev)) { - ret = enable_irq_wake(rmi_spi->irq); - if (!ret) - dev_warn(dev, "Failed to enable irq for wake: %d\n", - ret); - } return ret; } @@ -509,15 +459,7 @@ static int rmi_spi_resume(struct device *dev) struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); int ret; - enable_irq(rmi_spi->irq); - if (device_may_wakeup(&spi->dev)) { - ret = disable_irq_wake(rmi_spi->irq); - if (!ret) - dev_warn(dev, "Failed to disable irq for wake: %d\n", - ret); - } - - ret = rmi_driver_resume(rmi_spi->xport.rmi_dev); + ret = rmi_driver_resume(rmi_spi->xport.rmi_dev, true); if (ret) dev_warn(dev, "Failed to resume device: %d\n", ret); @@ -532,12 +474,10 @@ static int rmi_spi_runtime_suspend(struct device *dev) struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); int ret; - ret = rmi_driver_suspend(rmi_spi->xport.rmi_dev); + ret = rmi_driver_suspend(rmi_spi->xport.rmi_dev, false); if (ret) dev_warn(dev, "Failed to resume device: %d\n", ret); - disable_irq(rmi_spi->irq); - return 0; } @@ -547,9 +487,7 @@ static int rmi_spi_runtime_resume(struct device *dev) struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); int ret; - enable_irq(rmi_spi->irq); - - ret = rmi_driver_resume(rmi_spi->xport.rmi_dev); + ret = rmi_driver_resume(rmi_spi->xport.rmi_dev, false); if (ret) dev_warn(dev, "Failed to resume device: %d\n", ret); diff --git a/include/linux/rmi.h b/include/linux/rmi.h index e0aca1476001..5944e6c2470d 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -204,9 +204,11 @@ struct rmi_device_platform_data_spi { * @reset_delay_ms - after issuing a reset command to the touch sensor, the * driver waits a few milliseconds to give the firmware a chance to * to re-initialize. You can override the default wait period here. + * @irq: irq associated with the attn gpio line, or negative */ struct rmi_device_platform_data { int reset_delay_ms; + int irq; struct rmi_device_platform_data_spi spi_data; @@ -352,8 +354,7 @@ struct rmi_driver_data { int rmi_register_transport_device(struct rmi_transport_dev *xport); void rmi_unregister_transport_device(struct rmi_transport_dev *xport); -int rmi_process_interrupt_requests(struct rmi_device *rmi_dev); -int rmi_driver_suspend(struct rmi_device *rmi_dev); -int rmi_driver_resume(struct rmi_device *rmi_dev); +int rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake); +int rmi_driver_resume(struct rmi_device *rmi_dev, bool clear_wake); #endif From 6d0dbeae71f074c67b081eae45cd58fa39dfda2e Mon Sep 17 00:00:00 2001 From: Andrew Duggan Date: Tue, 8 Nov 2016 16:46:20 -0800 Subject: [PATCH 571/591] Input: synaptics-rmi4 - handle incomplete input data Commit 5b65c2a02966 ("HID: rmi: check sanity of the incoming report") added support for handling incomplete HID reports do to the input data being corrupted in transit. This patch reimplements this functionality in the function drivers so they can handle getting less valid data then they expect. Signed-off-by: Andrew Duggan Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_f11.c | 54 ++++++++++++++++++++++++++---------- drivers/input/rmi4/rmi_f12.c | 23 +++++++++++---- drivers/input/rmi4/rmi_f30.c | 4 +++ 3 files changed, 61 insertions(+), 20 deletions(-) diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c index 20c7134b3d3b..3218742d2d8c 100644 --- a/drivers/input/rmi4/rmi_f11.c +++ b/drivers/input/rmi4/rmi_f11.c @@ -572,31 +572,48 @@ static inline u8 rmi_f11_parse_finger_state(const u8 *f_state, u8 n_finger) static void rmi_f11_finger_handler(struct f11_data *f11, struct rmi_2d_sensor *sensor, - unsigned long *irq_bits, int num_irq_regs) + unsigned long *irq_bits, int num_irq_regs, + int size) { const u8 *f_state = f11->data.f_state; u8 finger_state; u8 i; + int abs_fingers; + int rel_fingers; + int abs_size = sensor->nbr_fingers * RMI_F11_ABS_BYTES; int abs_bits = bitmap_and(f11->result_bits, irq_bits, f11->abs_mask, num_irq_regs * 8); int rel_bits = bitmap_and(f11->result_bits, irq_bits, f11->rel_mask, num_irq_regs * 8); - for (i = 0; i < sensor->nbr_fingers; i++) { - /* Possible of having 4 fingers per f_statet register */ - finger_state = rmi_f11_parse_finger_state(f_state, i); - if (finger_state == F11_RESERVED) { - pr_err("Invalid finger state[%d]: 0x%02x", i, - finger_state); - continue; - } + if (abs_bits) { + if (abs_size > size) + abs_fingers = size / RMI_F11_ABS_BYTES; + else + abs_fingers = sensor->nbr_fingers; + + for (i = 0; i < abs_fingers; i++) { + /* Possible of having 4 fingers per f_state register */ + finger_state = rmi_f11_parse_finger_state(f_state, i); + if (finger_state == F11_RESERVED) { + pr_err("Invalid finger state[%d]: 0x%02x", i, + finger_state); + continue; + } - if (abs_bits) rmi_f11_abs_pos_process(f11, sensor, &sensor->objs[i], finger_state, i); + } + } - if (rel_bits) + if (rel_bits) { + if ((abs_size + sensor->nbr_fingers * RMI_F11_REL_BYTES) > size) + rel_fingers = (size - abs_size) / RMI_F11_REL_BYTES; + else + rel_fingers = sensor->nbr_fingers; + + for (i = 0; i < rel_fingers; i++) rmi_f11_rel_pos_report(f11, i); } @@ -612,7 +629,7 @@ static void rmi_f11_finger_handler(struct f11_data *f11, sensor->nbr_fingers, sensor->dmax); - for (i = 0; i < sensor->nbr_fingers; i++) { + for (i = 0; i < abs_fingers; i++) { finger_state = rmi_f11_parse_finger_state(f_state, i); if (finger_state == F11_RESERVED) /* no need to send twice the error */ @@ -1242,10 +1259,19 @@ static int rmi_f11_attention(struct rmi_function *fn, unsigned long *irq_bits) struct f11_data *f11 = dev_get_drvdata(&fn->dev); u16 data_base_addr = fn->fd.data_base_addr; int error; + int valid_bytes = f11->sensor.pkt_size; if (rmi_dev->xport->attn_data) { + /* + * The valid data in the attention report is less then + * expected. Only process the complete fingers. + */ + if (f11->sensor.attn_size > rmi_dev->xport->attn_size) + valid_bytes = rmi_dev->xport->attn_size; + else + valid_bytes = f11->sensor.attn_size; memcpy(f11->sensor.data_pkt, rmi_dev->xport->attn_data, - f11->sensor.attn_size); + valid_bytes); rmi_dev->xport->attn_data += f11->sensor.attn_size; rmi_dev->xport->attn_size -= f11->sensor.attn_size; } else { @@ -1257,7 +1283,7 @@ static int rmi_f11_attention(struct rmi_function *fn, unsigned long *irq_bits) } rmi_f11_finger_handler(f11, &f11->sensor, irq_bits, - drvdata->num_of_irq_regs); + drvdata->num_of_irq_regs, valid_bytes); return 0; } diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index 332c02f0b107..767ac7920c75 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -26,6 +26,8 @@ enum rmi_f12_object_type { RMI_F12_OBJECT_SMALL_OBJECT = 0x0D, }; +#define F12_DATA1_BYTES_PER_OBJ 8 + struct f12_data { struct rmi_2d_sensor sensor; struct rmi_2d_sensor_platform_data sensor_pdata; @@ -146,12 +148,16 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12) return 0; } -static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1) +static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1, int size) { int i; struct rmi_2d_sensor *sensor = &f12->sensor; + int objects = f12->data1->num_subpackets; - for (i = 0; i < f12->data1->num_subpackets; i++) { + if ((f12->data1->num_subpackets * F12_DATA1_BYTES_PER_OBJ) > size) + objects = size / F12_DATA1_BYTES_PER_OBJ; + + for (i = 0; i < objects; i++) { struct rmi_2d_sensor_abs_object *obj = &sensor->objs[i]; obj->type = RMI_2D_OBJECT_NONE; @@ -182,7 +188,7 @@ static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1) rmi_2d_sensor_abs_process(sensor, obj, i); - data1 += 8; + data1 += F12_DATA1_BYTES_PER_OBJ; } if (sensor->kernel_tracking) @@ -192,7 +198,7 @@ static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1) sensor->nbr_fingers, sensor->dmax); - for (i = 0; i < sensor->nbr_fingers; i++) + for (i = 0; i < objects; i++) rmi_2d_sensor_abs_report(sensor, &sensor->objs[i], i); } @@ -203,10 +209,15 @@ static int rmi_f12_attention(struct rmi_function *fn, struct rmi_device *rmi_dev = fn->rmi_dev; struct f12_data *f12 = dev_get_drvdata(&fn->dev); struct rmi_2d_sensor *sensor = &f12->sensor; + int valid_bytes = sensor->pkt_size; if (rmi_dev->xport->attn_data) { + if (sensor->attn_size > rmi_dev->xport->attn_size) + valid_bytes = rmi_dev->xport->attn_size; + else + valid_bytes = sensor->attn_size; memcpy(sensor->data_pkt, rmi_dev->xport->attn_data, - sensor->attn_size); + valid_bytes); rmi_dev->xport->attn_data += sensor->attn_size; rmi_dev->xport->attn_size -= sensor->attn_size; } else { @@ -221,7 +232,7 @@ static int rmi_f12_attention(struct rmi_function *fn, if (f12->data1) rmi_f12_process_objects(f12, - &sensor->data_pkt[f12->data1_offset]); + &sensor->data_pkt[f12->data1_offset], valid_bytes); input_mt_sync_frame(sensor->input); diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c index 760aff1bc420..485907ff10f4 100644 --- a/drivers/input/rmi4/rmi_f30.c +++ b/drivers/input/rmi4/rmi_f30.c @@ -110,6 +110,10 @@ static int rmi_f30_attention(struct rmi_function *fn, unsigned long *irq_bits) /* Read the gpi led data. */ if (rmi_dev->xport->attn_data) { + if (rmi_dev->xport->attn_size < f30->register_count) { + dev_warn(&fn->dev, "F30 interrupted, but data is missing\n"); + return 0; + } memcpy(f30->data_regs, rmi_dev->xport->attn_data, f30->register_count); rmi_dev->xport->attn_data += f30->register_count; From 2775e523246e11c5ce90b69226c5e67aa43e64a5 Mon Sep 17 00:00:00 2001 From: Andrew Duggan Date: Tue, 8 Nov 2016 16:48:48 -0800 Subject: [PATCH 572/591] Input: synaptics-rmi4 - add parameters for dribble packets and palm detect gesture The rmi_f11 driver currently disables dribble packets and the palm detect gesture for all devices. This patch creates a parameter in the 2d sensor platform data for controlling this functionality on a per device basis. For more information on dribble packets: Commit 05ba999fcabb ("HID: rmi: disable dribble packets on Synaptics touchpads") For more information on the palm detect gesture: Commit f097deef59a6 ("HID: rmi: disable palm detect gesture when present") Signed-off-by: Andrew Duggan Reviewed-by: Benjamin Tissoires Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_2d_sensor.h | 2 ++ drivers/input/rmi4/rmi_f01.c | 6 +++--- drivers/input/rmi4/rmi_f11.c | 32 ++++++++++++++++++++++++++---- include/linux/rmi.h | 21 ++++++++++++-------- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/drivers/input/rmi4/rmi_2d_sensor.h b/drivers/input/rmi4/rmi_2d_sensor.h index 77fcdfef003c..c871bef4dac0 100644 --- a/drivers/input/rmi4/rmi_2d_sensor.h +++ b/drivers/input/rmi4/rmi_2d_sensor.h @@ -67,6 +67,8 @@ struct rmi_2d_sensor { u8 report_rel; u8 x_mm; u8 y_mm; + enum rmi_reg_state dribble; + enum rmi_reg_state palm_detect; }; int rmi_2d_sensor_of_probe(struct device *dev, diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index fac81fc9bcf6..2cfa9f64acfb 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c @@ -327,12 +327,12 @@ static int rmi_f01_probe(struct rmi_function *fn) } switch (pdata->power_management.nosleep) { - case RMI_F01_NOSLEEP_DEFAULT: + case RMI_REG_STATE_DEFAULT: break; - case RMI_F01_NOSLEEP_OFF: + case RMI_REG_STATE_OFF: f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_NOSLEEP_BIT; break; - case RMI_F01_NOSLEEP_ON: + case RMI_REG_STATE_ON: f01->device_control.ctrl0 |= RMI_F01_CTRL0_NOSLEEP_BIT; break; } diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c index 3218742d2d8c..c252d405df4c 100644 --- a/drivers/input/rmi4/rmi_f11.c +++ b/drivers/input/rmi4/rmi_f11.c @@ -1142,6 +1142,8 @@ static int rmi_f11_initialize(struct rmi_function *fn) sensor->topbuttonpad = f11->sensor_pdata.topbuttonpad; sensor->kernel_tracking = f11->sensor_pdata.kernel_tracking; sensor->dmax = f11->sensor_pdata.dmax; + sensor->dribble = f11->sensor_pdata.dribble; + sensor->palm_detect = f11->sensor_pdata.palm_detect; if (f11->sens_query.has_physical_props) { sensor->x_mm = f11->sens_query.x_sensor_size_mm; @@ -1209,11 +1211,33 @@ static int rmi_f11_initialize(struct rmi_function *fn) ctrl->ctrl0_11[RMI_F11_DELTA_Y_THRESHOLD] = sensor->axis_align.delta_y_threshold; - if (f11->sens_query.has_dribble) - ctrl->ctrl0_11[0] = ctrl->ctrl0_11[0] & ~BIT(6); + if (f11->sens_query.has_dribble) { + switch (sensor->dribble) { + case RMI_REG_STATE_OFF: + ctrl->ctrl0_11[0] &= ~BIT(6); + break; + case RMI_REG_STATE_ON: + ctrl->ctrl0_11[0] |= BIT(6); + break; + case RMI_REG_STATE_DEFAULT: + default: + break; + } + } - if (f11->sens_query.has_palm_det) - ctrl->ctrl0_11[11] = ctrl->ctrl0_11[11] & ~BIT(0); + if (f11->sens_query.has_palm_det) { + switch (sensor->palm_detect) { + case RMI_REG_STATE_OFF: + ctrl->ctrl0_11[11] &= ~BIT(0); + break; + case RMI_REG_STATE_ON: + ctrl->ctrl0_11[11] |= BIT(0); + break; + case RMI_REG_STATE_DEFAULT: + default: + break; + } + } rc = f11_write_control_regs(fn, &f11->sens_query, &f11->dev_controls, fn->fd.query_base_addr); diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 5944e6c2470d..ac904bb439a5 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -99,6 +99,8 @@ struct rmi_2d_sensor_platform_data { bool topbuttonpad; bool kernel_tracking; int dmax; + int dribble; + int palm_detect; }; /** @@ -116,14 +118,17 @@ struct rmi_f30_data { bool disable; }; -/** - * struct rmi_f01_power - override default power management settings. - * + +/* + * Set the state of a register + * DEFAULT - use the default value set by the firmware config + * OFF - explicitly disable the register + * ON - explicitly enable the register */ -enum rmi_f01_nosleep { - RMI_F01_NOSLEEP_DEFAULT = 0, - RMI_F01_NOSLEEP_OFF = 1, - RMI_F01_NOSLEEP_ON = 2 +enum rmi_reg_state { + RMI_REG_STATE_DEFAULT = 0, + RMI_REG_STATE_OFF = 1, + RMI_REG_STATE_ON = 2 }; /** @@ -143,7 +148,7 @@ enum rmi_f01_nosleep { * when the touch sensor is in doze mode, in units of 10ms. */ struct rmi_f01_power_management { - enum rmi_f01_nosleep nosleep; + enum rmi_reg_state nosleep; u8 wakeup_threshold; u8 doze_holdoff; u8 doze_interval; From 24f63b1cb05034de74289a684e0938388757085d Mon Sep 17 00:00:00 2001 From: Andrew Duggan Date: Tue, 8 Nov 2016 16:47:58 -0800 Subject: [PATCH 573/591] Input: synaptics-rmi4 - add support for controlling dribble packets in F12 Implements reading and setting the dribble bit in F12's control registers. Signed-off-by: Andrew Duggan Acked-by: Benjamin Tissoires Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_f12.c | 70 +++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index 767ac7920c75..d7255f18306d 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -31,6 +31,7 @@ enum rmi_f12_object_type { struct f12_data { struct rmi_2d_sensor sensor; struct rmi_2d_sensor_platform_data sensor_pdata; + bool has_dribble; u16 data_addr; @@ -239,12 +240,76 @@ static int rmi_f12_attention(struct rmi_function *fn, return 0; } +static int rmi_f12_write_control_regs(struct rmi_function *fn) +{ + int ret; + const struct rmi_register_desc_item *item; + struct rmi_device *rmi_dev = fn->rmi_dev; + struct f12_data *f12 = dev_get_drvdata(&fn->dev); + int control_size; + char buf[3]; + u16 control_offset = 0; + u8 subpacket_offset = 0; + + if (f12->has_dribble + && (f12->sensor.dribble != RMI_REG_STATE_DEFAULT)) { + item = rmi_get_register_desc_item(&f12->control_reg_desc, 20); + if (item) { + control_offset = rmi_register_desc_calc_reg_offset( + &f12->control_reg_desc, 20); + + /* + * The byte containing the EnableDribble bit will be + * in either byte 0 or byte 2 of control 20. Depending + * on the existence of subpacket 0. If control 20 is + * larger then 3 bytes, just read the first 3. + */ + control_size = min(item->reg_size, 3UL); + + ret = rmi_read_block(rmi_dev, fn->fd.control_base_addr + + control_offset, buf, control_size); + if (ret) + return ret; + + if (rmi_register_desc_has_subpacket(item, 0)) + subpacket_offset += 1; + + switch (f12->sensor.dribble) { + case RMI_REG_STATE_OFF: + buf[subpacket_offset] &= ~BIT(2); + break; + case RMI_REG_STATE_ON: + buf[subpacket_offset] |= BIT(2); + break; + case RMI_REG_STATE_DEFAULT: + default: + break; + } + + ret = rmi_write_block(rmi_dev, + fn->fd.control_base_addr + control_offset, + buf, control_size); + if (ret) + return ret; + } + } + + return 0; + +} + static int rmi_f12_config(struct rmi_function *fn) { struct rmi_driver *drv = fn->rmi_dev->driver; + int ret; drv->set_irq_bits(fn->rmi_dev, fn->irq_mask); + ret = rmi_f12_write_control_regs(fn); + if (ret) + dev_warn(&fn->dev, + "Failed to write F12 control registers: %d\n", ret); + return 0; } @@ -271,7 +336,7 @@ static int rmi_f12_probe(struct rmi_function *fn) } ++query_addr; - if (!(buf & 0x1)) { + if (!(buf & BIT(0))) { dev_err(&fn->dev, "Behavior of F12 without register descriptors is undefined.\n"); return -ENODEV; @@ -281,6 +346,8 @@ static int rmi_f12_probe(struct rmi_function *fn) if (!f12) return -ENOMEM; + f12->has_dribble = !!(buf & BIT(3)); + if (fn->dev.of_node) { ret = rmi_2d_sensor_of_probe(&fn->dev, &f12->sensor_pdata); if (ret) @@ -329,6 +396,7 @@ static int rmi_f12_probe(struct rmi_function *fn) sensor->x_mm = f12->sensor_pdata.x_mm; sensor->y_mm = f12->sensor_pdata.y_mm; + sensor->dribble = f12->sensor_pdata.dribble; if (sensor->sensor_type == rmi_sensor_default) sensor->sensor_type = From 332c3988fe9cbecf9d50f19596b66a34b5eda6de Mon Sep 17 00:00:00 2001 From: Andrew Duggan Date: Tue, 8 Nov 2016 17:03:16 -0800 Subject: [PATCH 574/591] Input: synaptics-rmi4 - set the ABS_MT_TOOL_TYPE bit to report tool type The rmi4 2D sensor functions report the tool type via input_mt_report_slot_state(), but the abs parameter bit has not been set so the tool type is not reported to userspace. This patch set the ABS_MT_TOOL_TYPE bit. Signed-off-by: Andrew Duggan Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_2d_sensor.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/input/rmi4/rmi_2d_sensor.c b/drivers/input/rmi4/rmi_2d_sensor.c index e97bd7fabccc..07007ff8e29f 100644 --- a/drivers/input/rmi4/rmi_2d_sensor.c +++ b/drivers/input/rmi4/rmi_2d_sensor.c @@ -177,10 +177,12 @@ static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor) sensor->dmax = DMAX * res_x; } - input_set_abs_params(input, ABS_MT_PRESSURE, 0, 0xff, 0, 0); - input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 0x0f, 0, 0); - input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 0x0f, 0, 0); - input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); + input_set_abs_params(input, ABS_MT_PRESSURE, 0, 0xff, 0, 0); + input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 0x0f, 0, 0); + input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 0x0f, 0, 0); + input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); + input_set_abs_params(input, ABS_MT_TOOL_TYPE, + 0, MT_TOOL_MAX, 0, 0); if (sensor->sensor_type == rmi_sensor_touchpad) input_flags = INPUT_MT_POINTER; From 82264d0cf7aef2247563c031ff2ab96579d5d0cc Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 8 Nov 2016 17:05:58 -0800 Subject: [PATCH 575/591] Input: synaptics-rmi4 - add SMBus support Code obtained from https://raw.githubusercontent.com/mightybigcar/synaptics-rmi4/jf/drivers/input/rmi4/rmi_smbus.c and updated to match upstream. And fixed to make it work. Signed-off-by: Benjamin Tissoires Signed-off-by: Andrew Duggan Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/Kconfig | 12 + drivers/input/rmi4/Makefile | 1 + drivers/input/rmi4/rmi_bus.h | 12 + drivers/input/rmi4/rmi_smbus.c | 447 +++++++++++++++++++++++++++++++++ 4 files changed, 472 insertions(+) create mode 100644 drivers/input/rmi4/rmi_smbus.c diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index 4c8a55857e00..8cbd362ae8a7 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -27,6 +27,18 @@ config RMI4_SPI If unsure, say N. +config RMI4_SMB + tristate "RMI4 SMB Support" + depends on RMI4_CORE && I2C + help + Say Y here if you want to support RMI4 devices connected to an SMB + bus. + + If unsure, say N. + + To compile this driver as a module, choose M here: the module will be + called rmi_smbus. + config RMI4_2D_SENSOR bool depends on RMI4_CORE diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile index 0bafc8502c4b..a6e27527d514 100644 --- a/drivers/input/rmi4/Makefile +++ b/drivers/input/rmi4/Makefile @@ -12,3 +12,4 @@ rmi_core-$(CONFIG_RMI4_F54) += rmi_f54.o # Transports obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o obj-$(CONFIG_RMI4_SPI) += rmi_spi.o +obj-$(CONFIG_RMI4_SMB) += rmi_smbus.o diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h index 899579830536..b7625a9ac66a 100644 --- a/drivers/input/rmi4/rmi_bus.h +++ b/drivers/input/rmi4/rmi_bus.h @@ -104,6 +104,18 @@ rmi_get_platform_data(struct rmi_device *d) bool rmi_is_physical_device(struct device *dev); +/** + * rmi_reset - reset a RMI4 device + * @d: Pointer to an RMI device + * + * Calls for a reset of each function implemented by a specific device. + * Returns 0 on success or a negative error code. + */ +static inline int rmi_reset(struct rmi_device *d) +{ + return d->driver->reset_handler(d); +} + /** * rmi_read - read a single byte * @d: Pointer to an RMI device diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c new file mode 100644 index 000000000000..76752555d809 --- /dev/null +++ b/drivers/input/rmi4/rmi_smbus.c @@ -0,0 +1,447 @@ +/* + * Copyright (c) 2015 - 2016 Red Hat, Inc + * Copyright (c) 2011, 2012 Synaptics Incorporated + * Copyright (c) 2011 Unixphere + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "rmi_driver.h" + +#define SMB_PROTOCOL_VERSION_ADDRESS 0xfd +#define SMB_MAX_COUNT 32 +#define RMI_SMB2_MAP_SIZE 8 /* 8 entry of 4 bytes each */ +#define RMI_SMB2_MAP_FLAGS_WE 0x01 + +struct mapping_table_entry { + __le16 rmiaddr; + u8 readcount; + u8 flags; +}; + +struct rmi_smb_xport { + struct rmi_transport_dev xport; + struct i2c_client *client; + + struct mutex page_mutex; + int page; + u8 table_index; + struct mutex mappingtable_mutex; + struct mapping_table_entry mapping_table[RMI_SMB2_MAP_SIZE]; +}; + +static int rmi_smb_get_version(struct rmi_smb_xport *rmi_smb) +{ + struct i2c_client *client = rmi_smb->client; + int retval; + + /* Check if for SMBus new version device by reading version byte. */ + retval = i2c_smbus_read_byte_data(client, SMB_PROTOCOL_VERSION_ADDRESS); + if (retval < 0) { + dev_err(&client->dev, "failed to get SMBus version number!\n"); + return retval; + } + return retval + 1; +} + +/* SMB block write - wrapper over ic2_smb_write_block */ +static int smb_block_write(struct rmi_transport_dev *xport, + u8 commandcode, const void *buf, size_t len) +{ + struct rmi_smb_xport *rmi_smb = + container_of(xport, struct rmi_smb_xport, xport); + struct i2c_client *client = rmi_smb->client; + int retval; + + retval = i2c_smbus_write_block_data(client, commandcode, len, buf); + + rmi_dbg(RMI_DEBUG_XPORT, &client->dev, + "wrote %zd bytes at %#04x: %d (%*ph)\n", + len, commandcode, retval, (int)len, buf); + + return retval; +} + +/* + * The function to get command code for smbus operations and keeps + * records to the driver mapping table + */ +static int rmi_smb_get_command_code(struct rmi_transport_dev *xport, + u16 rmiaddr, int bytecount, bool isread, u8 *commandcode) +{ + struct rmi_smb_xport *rmi_smb = + container_of(xport, struct rmi_smb_xport, xport); + int i; + int retval; + struct mapping_table_entry mapping_data[1]; + + mutex_lock(&rmi_smb->mappingtable_mutex); + for (i = 0; i < RMI_SMB2_MAP_SIZE; i++) { + if (rmi_smb->mapping_table[i].rmiaddr == rmiaddr) { + if (isread) { + if (rmi_smb->mapping_table[i].readcount + == bytecount) { + *commandcode = i; + retval = 0; + goto exit; + } + } else { + if (rmi_smb->mapping_table[i].flags & + RMI_SMB2_MAP_FLAGS_WE) { + *commandcode = i; + retval = 0; + goto exit; + } + } + } + } + i = rmi_smb->table_index; + rmi_smb->table_index = (i + 1) % RMI_SMB2_MAP_SIZE; + + /* constructs mapping table data entry. 4 bytes each entry */ + memset(mapping_data, 0, sizeof(mapping_data)); + + mapping_data[0].rmiaddr = cpu_to_le16(rmiaddr); + mapping_data[0].readcount = bytecount; + mapping_data[0].flags = !isread ? RMI_SMB2_MAP_FLAGS_WE : 0; + + retval = smb_block_write(xport, i + 0x80, mapping_data, + sizeof(mapping_data)); + + if (retval < 0) { + /* + * if not written to device mapping table + * clear the driver mapping table records + */ + rmi_smb->mapping_table[i].rmiaddr = 0x0000; + rmi_smb->mapping_table[i].readcount = 0; + rmi_smb->mapping_table[i].flags = 0; + goto exit; + } + /* save to the driver level mapping table */ + rmi_smb->mapping_table[i].rmiaddr = rmiaddr; + rmi_smb->mapping_table[i].readcount = bytecount; + rmi_smb->mapping_table[i].flags = !isread ? RMI_SMB2_MAP_FLAGS_WE : 0; + *commandcode = i; + +exit: + mutex_unlock(&rmi_smb->mappingtable_mutex); + + return retval; +} + +static int rmi_smb_write_block(struct rmi_transport_dev *xport, u16 rmiaddr, + const void *databuff, size_t len) +{ + int retval = 0; + u8 commandcode; + struct rmi_smb_xport *rmi_smb = + container_of(xport, struct rmi_smb_xport, xport); + int cur_len = (int)len; + + mutex_lock(&rmi_smb->page_mutex); + + while (cur_len > 0) { + /* + * break into 32 bytes chunks to write get command code + */ + int block_len = min_t(int, len, SMB_MAX_COUNT); + + retval = rmi_smb_get_command_code(xport, rmiaddr, block_len, + false, &commandcode); + if (retval < 0) + goto exit; + + retval = smb_block_write(xport, commandcode, + databuff, block_len); + if (retval < 0) + goto exit; + + /* prepare to write next block of bytes */ + cur_len -= SMB_MAX_COUNT; + databuff += SMB_MAX_COUNT; + rmiaddr += SMB_MAX_COUNT; + } +exit: + mutex_unlock(&rmi_smb->page_mutex); + return retval; +} + +/* SMB block read - wrapper over ic2_smb_read_block */ +static int smb_block_read(struct rmi_transport_dev *xport, + u8 commandcode, void *buf, size_t len) +{ + struct rmi_smb_xport *rmi_smb = + container_of(xport, struct rmi_smb_xport, xport); + struct i2c_client *client = rmi_smb->client; + int retval; + + retval = i2c_smbus_read_block_data(client, commandcode, buf); + if (retval < 0) + return retval; + + return retval; +} + +static int rmi_smb_read_block(struct rmi_transport_dev *xport, u16 rmiaddr, + void *databuff, size_t len) +{ + struct rmi_smb_xport *rmi_smb = + container_of(xport, struct rmi_smb_xport, xport); + int retval; + u8 commandcode; + int cur_len = (int)len; + + mutex_lock(&rmi_smb->page_mutex); + memset(databuff, 0, len); + + while (cur_len > 0) { + /* break into 32 bytes chunks to write get command code */ + int block_len = min_t(int, cur_len, SMB_MAX_COUNT); + + retval = rmi_smb_get_command_code(xport, rmiaddr, block_len, + true, &commandcode); + if (retval < 0) + goto exit; + + retval = smb_block_read(xport, commandcode, + databuff, block_len); + if (retval < 0) + goto exit; + + /* prepare to read next block of bytes */ + cur_len -= SMB_MAX_COUNT; + databuff += SMB_MAX_COUNT; + rmiaddr += SMB_MAX_COUNT; + } + + retval = 0; + +exit: + mutex_unlock(&rmi_smb->page_mutex); + return retval; +} + +static void rmi_smb_clear_state(struct rmi_smb_xport *rmi_smb) +{ + /* the mapping table has been flushed, discard the current one */ + mutex_lock(&rmi_smb->mappingtable_mutex); + memset(rmi_smb->mapping_table, 0, sizeof(rmi_smb->mapping_table)); + mutex_unlock(&rmi_smb->mappingtable_mutex); +} + +static int rmi_smb_enable_smbus_mode(struct rmi_smb_xport *rmi_smb) +{ + int retval; + + /* we need to get the smbus version to activate the touchpad */ + retval = rmi_smb_get_version(rmi_smb); + if (retval < 0) + return retval; + + return 0; +} + +static int rmi_smb_reset(struct rmi_transport_dev *xport, u16 reset_addr) +{ + struct rmi_smb_xport *rmi_smb = + container_of(xport, struct rmi_smb_xport, xport); + + rmi_smb_clear_state(rmi_smb); + + /* + * we do not call the actual reset command, it has to be handled in + * PS/2 or there will be races between PS/2 and SMBus. + * PS/2 should ensure that a psmouse_reset is called before + * intializing the device and after it has been removed to be in a known + * state. + */ + return rmi_smb_enable_smbus_mode(rmi_smb); +} + +static const struct rmi_transport_ops rmi_smb_ops = { + .write_block = rmi_smb_write_block, + .read_block = rmi_smb_read_block, + .reset = rmi_smb_reset, +}; + +static int rmi_smb_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct rmi_device_platform_data *pdata = dev_get_platdata(&client->dev); + struct rmi_smb_xport *rmi_smb; + int retval; + int smbus_version; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BLOCK_DATA | + I2C_FUNC_SMBUS_HOST_NOTIFY)) { + dev_err(&client->dev, + "adapter does not support required functionality.\n"); + return -ENODEV; + } + + if (client->irq <= 0) { + dev_err(&client->dev, "no IRQ provided, giving up.\n"); + return client->irq ? client->irq : -ENODEV; + } + + rmi_smb = devm_kzalloc(&client->dev, sizeof(struct rmi_smb_xport), + GFP_KERNEL); + if (!rmi_smb) + return -ENOMEM; + + if (!pdata) { + dev_err(&client->dev, "no platform data, aborting\n"); + return -ENOMEM; + } + + rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Probing %s.\n", + dev_name(&client->dev)); + + rmi_smb->client = client; + mutex_init(&rmi_smb->page_mutex); + mutex_init(&rmi_smb->mappingtable_mutex); + + rmi_smb->xport.dev = &client->dev; + rmi_smb->xport.pdata = *pdata; + rmi_smb->xport.pdata.irq = client->irq; + rmi_smb->xport.proto_name = "smb2"; + rmi_smb->xport.ops = &rmi_smb_ops; + + retval = rmi_smb_get_version(rmi_smb); + if (retval < 0) + return retval; + + smbus_version = retval; + rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Smbus version is %d", + smbus_version); + + if (smbus_version != 2) { + dev_err(&client->dev, "Unrecognized SMB version %d.\n", + smbus_version); + return -ENODEV; + } + + i2c_set_clientdata(client, rmi_smb); + + retval = rmi_register_transport_device(&rmi_smb->xport); + if (retval) { + dev_err(&client->dev, "Failed to register transport driver at 0x%.2X.\n", + client->addr); + i2c_set_clientdata(client, NULL); + return retval; + } + + dev_info(&client->dev, "registered rmi smb driver at %#04x.\n", + client->addr); + return 0; + +} + +static int rmi_smb_remove(struct i2c_client *client) +{ + struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); + + rmi_unregister_transport_device(&rmi_smb->xport); + + return 0; +} + +static int __maybe_unused rmi_smb_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); + int ret; + + ret = rmi_driver_suspend(rmi_smb->xport.rmi_dev, true); + if (ret) + dev_warn(dev, "Failed to suspend device: %d\n", ret); + + return ret; +} + +static int __maybe_unused rmi_smb_runtime_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); + int ret; + + ret = rmi_driver_suspend(rmi_smb->xport.rmi_dev, false); + if (ret) + dev_warn(dev, "Failed to suspend device: %d\n", ret); + + return ret; +} + +static int __maybe_unused rmi_smb_resume(struct device *dev) +{ + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); + struct rmi_device *rmi_dev = rmi_smb->xport.rmi_dev; + int ret; + + rmi_smb_reset(&rmi_smb->xport, 0); + + rmi_reset(rmi_dev); + + ret = rmi_driver_resume(rmi_smb->xport.rmi_dev, true); + if (ret) + dev_warn(dev, "Failed to resume device: %d\n", ret); + + return 0; +} + +static int __maybe_unused rmi_smb_runtime_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct rmi_smb_xport *rmi_smb = i2c_get_clientdata(client); + int ret; + + ret = rmi_driver_resume(rmi_smb->xport.rmi_dev, false); + if (ret) + dev_warn(dev, "Failed to resume device: %d\n", ret); + + return 0; +} + +static const struct dev_pm_ops rmi_smb_pm = { + SET_SYSTEM_SLEEP_PM_OPS(rmi_smb_suspend, rmi_smb_resume) + SET_RUNTIME_PM_OPS(rmi_smb_runtime_suspend, rmi_smb_runtime_resume, + NULL) +}; + +static const struct i2c_device_id rmi_id[] = { + { "rmi4_smbus", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, rmi_id); + +static struct i2c_driver rmi_smb_driver = { + .driver = { + .name = "rmi4_smbus", + .pm = &rmi_smb_pm, + }, + .id_table = rmi_id, + .probe = rmi_smb_probe, + .remove = rmi_smb_remove, +}; + +module_i2c_driver(rmi_smb_driver); + +MODULE_AUTHOR("Andrew Duggan "); +MODULE_AUTHOR("Benjamin Tissoires "); +MODULE_DESCRIPTION("RMI4 SMBus driver"); +MODULE_LICENSE("GPL"); From 792f497b22afd0563b94dd8fa129a05f762a2c25 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 16 Nov 2016 17:23:22 -0800 Subject: [PATCH 576/591] Input: synaptics-rmi4 - unlock on error We should unlock before returning on this error path. Fixes: 3a762dbd5347 ('[media] Input: synaptics-rmi4 - add support for F54 diagnostics') Signed-off-by: Dan Carpenter Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_f54.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c index cf805b960866..2e934aef3d2a 100644 --- a/drivers/input/rmi4/rmi_f54.c +++ b/drivers/input/rmi4/rmi_f54.c @@ -200,7 +200,7 @@ static int rmi_f54_request_report(struct rmi_function *fn, u8 report_type) error = rmi_write(rmi_dev, fn->fd.command_base_addr, F54_GET_REPORT); if (error < 0) - return error; + goto unlock; init_completion(&f54->cmd_done); @@ -209,9 +209,10 @@ static int rmi_f54_request_report(struct rmi_function *fn, u8 report_type) queue_delayed_work(f54->workqueue, &f54->work, 0); +unlock: mutex_unlock(&f54->data_mutex); - return 0; + return error; } static size_t rmi_f54_get_report_size(struct f54_data *f54) From 29fd0ec2bdbef6734fd4c39c23f61d9f030a66a0 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Tue, 22 Nov 2016 17:44:12 -0800 Subject: [PATCH 577/591] Input: synaptics-rmi4 - add support for F34 device reflash Add support for updating firmware, triggered by a sysfs attribute. This patch has been tested on Synaptics S7300. Signed-off-by: Nick Dyer Tested-by: Chris Healy Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/Kconfig | 11 + drivers/input/rmi4/Makefile | 1 + drivers/input/rmi4/rmi_bus.c | 3 + drivers/input/rmi4/rmi_driver.c | 105 +++++-- drivers/input/rmi4/rmi_driver.h | 24 ++ drivers/input/rmi4/rmi_f01.c | 6 + drivers/input/rmi4/rmi_f34.c | 481 ++++++++++++++++++++++++++++++++ drivers/input/rmi4/rmi_f34.h | 68 +++++ include/linux/rmi.h | 2 + 9 files changed, 670 insertions(+), 31 deletions(-) create mode 100644 drivers/input/rmi4/rmi_f34.c create mode 100644 drivers/input/rmi4/rmi_f34.h diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index 8cbd362ae8a7..9a24867ae7a5 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -74,6 +74,17 @@ config RMI4_F30 Function 30 provides GPIO and LED support for RMI4 devices. This includes support for buttons on TouchPads and ClickPads. +config RMI4_F34 + bool "RMI4 Function 34 (Device reflash)" + depends on RMI4_CORE + select FW_LOADER + help + Say Y here if you want to add support for RMI4 function 34. + + Function 34 provides support for upgrading the firmware on the RMI4 + device via the firmware loader interface. This is triggered using a + sysfs attribute. + config RMI4_F54 bool "RMI4 Function 54 (Analog diagnostics)" depends on RMI4_CORE diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile index a6e27527d514..0250abf38ad9 100644 --- a/drivers/input/rmi4/Makefile +++ b/drivers/input/rmi4/Makefile @@ -7,6 +7,7 @@ rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o +rmi_core-$(CONFIG_RMI4_F34) += rmi_f34.o rmi_core-$(CONFIG_RMI4_F54) += rmi_f54.o # Transports diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index 84b321262d74..ef7a66230d83 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -315,6 +315,9 @@ static struct rmi_function_handler *fn_handlers[] = { #ifdef CONFIG_RMI4_F30 &rmi_f30_handler, #endif +#ifdef CONFIG_RMI4_F34 + &rmi_f34_handler, +#endif #ifdef CONFIG_RMI4_F54 &rmi_f54_handler, #endif diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 4f8d19794b01..2b17d8cb3d10 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -35,14 +35,24 @@ #define RMI_DEVICE_RESET_CMD 0x01 #define DEFAULT_RESET_DELAY_MS 100 -static void rmi_free_function_list(struct rmi_device *rmi_dev) +void rmi_free_function_list(struct rmi_device *rmi_dev) { struct rmi_function *fn, *tmp; struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Freeing function list\n"); + mutex_lock(&data->irq_mutex); + + devm_kfree(&rmi_dev->dev, data->irq_memory); + data->irq_memory = NULL; + data->irq_status = NULL; + data->fn_irq_bits = NULL; + data->current_irq_mask = NULL; + data->new_irq_mask = NULL; + data->f01_container = NULL; + data->f34_container = NULL; /* Doing it in the reverse order so F01 will be removed last */ list_for_each_entry_safe_reverse(fn, tmp, @@ -50,7 +60,10 @@ static void rmi_free_function_list(struct rmi_device *rmi_dev) list_del(&fn->node); rmi_unregister_function(fn); } + + mutex_unlock(&data->irq_mutex); } +EXPORT_SYMBOL_GPL(rmi_free_function_list); static int reset_one_function(struct rmi_function *fn) { @@ -147,24 +160,25 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) if (!data) return 0; + mutex_lock(&data->irq_mutex); + if (!data->irq_status || !data->f01_container) { + mutex_unlock(&data->irq_mutex); + return 0; + } + if (!rmi_dev->xport->attn_data) { error = rmi_read_block(rmi_dev, data->f01_container->fd.data_base_addr + 1, data->irq_status, data->num_of_irq_regs); if (error < 0) { dev_err(dev, "Failed to read irqs, code=%d\n", error); + mutex_unlock(&data->irq_mutex); return error; } } - mutex_lock(&data->irq_mutex); bitmap_and(data->irq_status, data->irq_status, data->current_irq_mask, data->irq_count); - /* - * At this point, irq_status has all bits that are set in the - * interrupt status register and are enabled. - */ - mutex_unlock(&data->irq_mutex); /* * It would be nice to be able to use irq_chip to handle these @@ -180,6 +194,8 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) if (data->input) input_sync(data->input); + mutex_unlock(&data->irq_mutex); + return 0; } @@ -244,12 +260,18 @@ static int rmi_suspend_functions(struct rmi_device *rmi_dev) struct rmi_function *entry; int retval; + mutex_lock(&data->irq_mutex); + list_for_each_entry(entry, &data->function_list, node) { retval = suspend_one_function(entry); - if (retval < 0) + if (retval < 0) { + mutex_unlock(&data->irq_mutex); return retval; + } } + mutex_unlock(&data->irq_mutex); + return 0; } @@ -278,16 +300,22 @@ static int rmi_resume_functions(struct rmi_device *rmi_dev) struct rmi_function *entry; int retval; + mutex_lock(&data->irq_mutex); + list_for_each_entry(entry, &data->function_list, node) { retval = resume_one_function(entry); - if (retval < 0) + if (retval < 0) { + mutex_unlock(&data->irq_mutex); return retval; + } } + mutex_unlock(&data->irq_mutex); + return 0; } -static int enable_sensor(struct rmi_device *rmi_dev) +int rmi_enable_sensor(struct rmi_device *rmi_dev) { int retval = 0; @@ -297,6 +325,7 @@ static int enable_sensor(struct rmi_device *rmi_dev) return rmi_process_interrupt_requests(rmi_dev); } +EXPORT_SYMBOL_GPL(rmi_enable_sensor); /** * rmi_driver_set_input_params - set input device id and other data. @@ -502,10 +531,9 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, RMI_SCAN_DONE : RMI_SCAN_CONTINUE; } -static int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, - int (*callback)(struct rmi_device *rmi_dev, - void *ctx, - const struct pdt_entry *entry)) +int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, + int (*callback)(struct rmi_device *rmi_dev, + void *ctx, const struct pdt_entry *entry)) { int page; int empty_pages = 0; @@ -520,6 +548,7 @@ static int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, return retval < 0 ? retval : 0; } +EXPORT_SYMBOL_GPL(rmi_scan_pdt); int rmi_read_register_desc(struct rmi_device *d, u16 addr, struct rmi_register_descriptor *rdesc) @@ -740,19 +769,15 @@ static int rmi_count_irqs(struct rmi_device *rmi_dev, int *irq_count = ctx; *irq_count += pdt->interrupt_source_count; - if (pdt->function_number == 0x01) { + if (pdt->function_number == 0x01) data->f01_bootloader_mode = rmi_check_bootloader_mode(rmi_dev, pdt); - if (data->f01_bootloader_mode) - dev_warn(&rmi_dev->dev, - "WARNING: RMI4 device is in bootloader mode!\n"); - } return RMI_SCAN_CONTINUE; } -static int rmi_initial_reset(struct rmi_device *rmi_dev, - void *ctx, const struct pdt_entry *pdt) +int rmi_initial_reset(struct rmi_device *rmi_dev, void *ctx, + const struct pdt_entry *pdt) { int error; @@ -787,6 +812,7 @@ static int rmi_initial_reset(struct rmi_device *rmi_dev, /* F01 should always be on page 0. If we don't find it there, fail. */ return pdt->page_start == 0 ? RMI_SCAN_CONTINUE : -ENODEV; } +EXPORT_SYMBOL_GPL(rmi_initial_reset); static int rmi_create_function(struct rmi_device *rmi_dev, void *ctx, const struct pdt_entry *pdt) @@ -828,6 +854,8 @@ static int rmi_create_function(struct rmi_device *rmi_dev, if (pdt->function_number == 0x01) data->f01_container = fn; + else if (pdt->function_number == 0x34) + data->f34_container = fn; list_add_tail(&fn->node, &data->function_list); @@ -893,6 +921,7 @@ static int rmi_driver_remove(struct device *dev) disable_irq(irq); + rmi_f34_remove_sysfs(rmi_dev); rmi_free_function_list(rmi_dev); return 0; @@ -919,13 +948,12 @@ static inline int rmi_driver_of_probe(struct device *dev, } #endif -static int rmi_probe_interrupts(struct rmi_driver_data *data) +int rmi_probe_interrupts(struct rmi_driver_data *data) { struct rmi_device *rmi_dev = data->rmi_dev; struct device *dev = &rmi_dev->dev; int irq_count; size_t size; - void *irq_memory; int retval; /* @@ -941,31 +969,38 @@ static int rmi_probe_interrupts(struct rmi_driver_data *data) dev_err(dev, "IRQ counting failed with code %d.\n", retval); return retval; } + + if (data->f01_bootloader_mode) + dev_warn(&rmi_dev->dev, "Device in bootloader mode.\n"); + data->irq_count = irq_count; data->num_of_irq_regs = (data->irq_count + 7) / 8; size = BITS_TO_LONGS(data->irq_count) * sizeof(unsigned long); - irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL); - if (!irq_memory) { + data->irq_memory = devm_kzalloc(dev, size * 4, GFP_KERNEL); + if (!data->irq_memory) { dev_err(dev, "Failed to allocate memory for irq masks.\n"); return retval; } - data->irq_status = irq_memory + size * 0; - data->fn_irq_bits = irq_memory + size * 1; - data->current_irq_mask = irq_memory + size * 2; - data->new_irq_mask = irq_memory + size * 3; + data->irq_status = data->irq_memory + size * 0; + data->fn_irq_bits = data->irq_memory + size * 1; + data->current_irq_mask = data->irq_memory + size * 2; + data->new_irq_mask = data->irq_memory + size * 3; return retval; } +EXPORT_SYMBOL_GPL(rmi_probe_interrupts); -static int rmi_init_functions(struct rmi_driver_data *data) +int rmi_init_functions(struct rmi_driver_data *data) { struct rmi_device *rmi_dev = data->rmi_dev; struct device *dev = &rmi_dev->dev; int irq_count; int retval; + mutex_lock(&data->irq_mutex); + irq_count = 0; rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Creating functions.\n", __func__); retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_create_function); @@ -990,12 +1025,16 @@ static int rmi_init_functions(struct rmi_driver_data *data) goto err_destroy_functions; } + mutex_unlock(&data->irq_mutex); + return 0; err_destroy_functions: rmi_free_function_list(rmi_dev); + mutex_unlock(&data->irq_mutex); return retval; } +EXPORT_SYMBOL_GPL(rmi_init_functions); static int rmi_driver_probe(struct device *dev) { @@ -1100,6 +1139,10 @@ static int rmi_driver_probe(struct device *dev) if (retval) goto err; + retval = rmi_f34_create_sysfs(rmi_dev); + if (retval) + goto err; + if (data->input) { rmi_driver_set_input_name(rmi_dev, data->input); if (!rmi_dev->xport->input) { @@ -1117,7 +1160,7 @@ static int rmi_driver_probe(struct device *dev) if (data->f01_container->dev.driver) /* Driver already bound, so enable ATTN now. */ - return enable_sensor(rmi_dev); + return rmi_enable_sensor(rmi_dev); return 0; diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index 8dfbebe9bf86..e627a3a8aced 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -95,12 +95,36 @@ bool rmi_register_desc_has_subpacket(const struct rmi_register_desc_item *item, bool rmi_is_physical_driver(struct device_driver *); int rmi_register_physical_driver(void); void rmi_unregister_physical_driver(void); +void rmi_free_function_list(struct rmi_device *rmi_dev); +int rmi_enable_sensor(struct rmi_device *rmi_dev); +int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, + int (*callback)(struct rmi_device *rmi_dev, void *ctx, + const struct pdt_entry *entry)); +int rmi_probe_interrupts(struct rmi_driver_data *data); +int rmi_init_functions(struct rmi_driver_data *data); +int rmi_initial_reset(struct rmi_device *rmi_dev, void *ctx, + const struct pdt_entry *pdt); char *rmi_f01_get_product_ID(struct rmi_function *fn); +#ifdef CONFIG_RMI4_F34 +int rmi_f34_create_sysfs(struct rmi_device *rmi_dev); +void rmi_f34_remove_sysfs(struct rmi_device *rmi_dev); +#else +static inline int rmi_f34_create_sysfs(struct rmi_device *rmi_dev) +{ + return 0; +} + +static inline void rmi_f34_remove_sysfs(struct rmi_device *rmi_dev) +{ +} +#endif /* CONFIG_RMI_F34 */ + extern struct rmi_function_handler rmi_f01_handler; extern struct rmi_function_handler rmi_f11_handler; extern struct rmi_function_handler rmi_f12_handler; extern struct rmi_function_handler rmi_f30_handler; +extern struct rmi_function_handler rmi_f34_handler; extern struct rmi_function_handler rmi_f54_handler; #endif diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index 2cfa9f64acfb..cae35c6cde31 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c @@ -63,6 +63,8 @@ struct f01_basic_properties { #define RMI_F01_STATUS_CODE(status) ((status) & 0x0f) /* The device has lost its configuration for some reason. */ #define RMI_F01_STATUS_UNCONFIGURED(status) (!!((status) & 0x80)) +/* The device is in bootloader mode */ +#define RMI_F01_STATUS_BOOTLOADER(status) ((status) & 0x40) /* Control register bits */ @@ -594,6 +596,10 @@ static int rmi_f01_attention(struct rmi_function *fn, return error; } + if (RMI_F01_STATUS_BOOTLOADER(device_status)) + dev_warn(&fn->dev, + "Device in bootloader mode, please update firmware\n"); + if (RMI_F01_STATUS_UNCONFIGURED(device_status)) { dev_warn(&fn->dev, "Device reset detected.\n"); error = rmi_dev->driver->reset_handler(rmi_dev); diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c new file mode 100644 index 000000000000..03df85ac91a5 --- /dev/null +++ b/drivers/input/rmi4/rmi_f34.c @@ -0,0 +1,481 @@ +/* + * Copyright (c) 2007-2016, Synaptics Incorporated + * Copyright (C) 2016 Zodiac Inflight Innovations + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include + +#include "rmi_driver.h" +#include "rmi_f34.h" + +static int rmi_f34_write_bootloader_id(struct f34_data *f34) +{ + struct rmi_function *fn = f34->fn; + struct rmi_device *rmi_dev = fn->rmi_dev; + u8 bootloader_id[F34_BOOTLOADER_ID_LEN]; + int ret; + + ret = rmi_read_block(rmi_dev, fn->fd.query_base_addr, + bootloader_id, sizeof(bootloader_id)); + if (ret) { + dev_err(&fn->dev, "%s: Reading bootloader ID failed: %d\n", + __func__, ret); + return ret; + } + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: writing bootloader id '%c%c'\n", + __func__, bootloader_id[0], bootloader_id[1]); + + ret = rmi_write_block(rmi_dev, + fn->fd.data_base_addr + F34_BLOCK_DATA_OFFSET, + bootloader_id, sizeof(bootloader_id)); + if (ret) { + dev_err(&fn->dev, "Failed to write bootloader ID: %d\n", ret); + return ret; + } + + return 0; +} + +static int rmi_f34_command(struct f34_data *f34, u8 command, + unsigned int timeout, bool write_bl_id) +{ + struct rmi_function *fn = f34->fn; + struct rmi_device *rmi_dev = fn->rmi_dev; + int ret; + + if (write_bl_id) { + ret = rmi_f34_write_bootloader_id(f34); + if (ret) + return ret; + } + + init_completion(&f34->v5.cmd_done); + + ret = rmi_read(rmi_dev, f34->v5.ctrl_address, &f34->v5.status); + if (ret) { + dev_err(&f34->fn->dev, + "%s: Failed to read cmd register: %d (command %#02x)\n", + __func__, ret, command); + return ret; + } + + f34->v5.status |= command & 0x0f; + + ret = rmi_write(rmi_dev, f34->v5.ctrl_address, f34->v5.status); + if (ret < 0) { + dev_err(&f34->fn->dev, + "Failed to write F34 command %#02x: %d\n", + command, ret); + return ret; + } + + if (!wait_for_completion_timeout(&f34->v5.cmd_done, + msecs_to_jiffies(timeout))) { + + ret = rmi_read(rmi_dev, f34->v5.ctrl_address, &f34->v5.status); + if (ret) { + dev_err(&f34->fn->dev, + "%s: cmd %#02x timed out: %d\n", + __func__, command, ret); + return ret; + } + + if (f34->v5.status & 0x7f) { + dev_err(&f34->fn->dev, + "%s: cmd %#02x timed out, status: %#02x\n", + __func__, command, f34->v5.status); + return -ETIMEDOUT; + } + } + + return 0; +} + +static int rmi_f34_attention(struct rmi_function *fn, unsigned long *irq_bits) +{ + struct f34_data *f34 = dev_get_drvdata(&fn->dev); + int ret; + + ret = rmi_read(f34->fn->rmi_dev, f34->v5.ctrl_address, &f34->v5.status); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: status: %#02x, ret: %d\n", + __func__, f34->v5.status, ret); + + if (!ret && !(f34->v5.status & 0x7f)) + complete(&f34->v5.cmd_done); + + return 0; +} + +static int rmi_f34_write_blocks(struct f34_data *f34, const void *data, + int block_count, u8 command) +{ + struct rmi_function *fn = f34->fn; + struct rmi_device *rmi_dev = fn->rmi_dev; + u16 address = fn->fd.data_base_addr + F34_BLOCK_DATA_OFFSET; + u8 start_address[] = { 0, 0 }; + int i; + int ret; + + ret = rmi_write_block(rmi_dev, fn->fd.data_base_addr, + start_address, sizeof(start_address)); + if (ret) { + dev_err(&fn->dev, "Failed to write initial zeros: %d\n", ret); + return ret; + } + + for (i = 0; i < block_count; i++) { + ret = rmi_write_block(rmi_dev, address, + data, f34->v5.block_size); + if (ret) { + dev_err(&fn->dev, + "failed to write block #%d: %d\n", i, ret); + return ret; + } + + ret = rmi_f34_command(f34, command, F34_IDLE_WAIT_MS, false); + if (ret) { + dev_err(&fn->dev, + "Failed to write command for block #%d: %d\n", + i, ret); + return ret; + } + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "wrote block %d of %d\n", + i + 1, block_count); + + data += f34->v5.block_size; + } + + return 0; +} + +static int rmi_f34_write_firmware(struct f34_data *f34, const void *data) +{ + return rmi_f34_write_blocks(f34, data, f34->v5.fw_blocks, + F34_WRITE_FW_BLOCK); +} + +static int rmi_f34_write_config(struct f34_data *f34, const void *data) +{ + return rmi_f34_write_blocks(f34, data, f34->v5.config_blocks, + F34_WRITE_CONFIG_BLOCK); +} + +int rmi_f34_enable_flash(struct f34_data *f34) +{ + return rmi_f34_command(f34, F34_ENABLE_FLASH_PROG, + F34_ENABLE_WAIT_MS, true); +} + +static int rmi_f34_flash_firmware(struct f34_data *f34, + const struct rmi_f34_firmware *syn_fw) +{ + struct rmi_function *fn = f34->fn; + int ret; + + if (syn_fw->image_size) { + dev_info(&fn->dev, "Erasing firmware...\n"); + ret = rmi_f34_command(f34, F34_ERASE_ALL, + F34_ERASE_WAIT_MS, true); + if (ret) + return ret; + + dev_info(&fn->dev, "Writing firmware (%d bytes)...\n", + syn_fw->image_size); + ret = rmi_f34_write_firmware(f34, syn_fw->data); + if (ret) + return ret; + } + + if (syn_fw->config_size) { + /* + * We only need to erase config if we haven't updated + * firmware. + */ + if (!syn_fw->image_size) { + dev_info(&fn->dev, "Erasing config...\n"); + ret = rmi_f34_command(f34, F34_ERASE_CONFIG, + F34_ERASE_WAIT_MS, true); + if (ret) + return ret; + } + + dev_info(&fn->dev, "Writing config (%d bytes)...\n", + syn_fw->config_size); + ret = rmi_f34_write_config(f34, + &syn_fw->data[syn_fw->image_size]); + if (ret) + return ret; + } + + return 0; +} + +int rmi_f34_update_firmware(struct f34_data *f34, const struct firmware *fw) +{ + const struct rmi_f34_firmware *syn_fw; + int ret; + + syn_fw = (const struct rmi_f34_firmware *)fw->data; + BUILD_BUG_ON(offsetof(struct rmi_f34_firmware, data) != + F34_FW_IMAGE_OFFSET); + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "FW size:%d, checksum:%08x, image_size:%d, config_size:%d\n", + (int)fw->size, + le32_to_cpu(syn_fw->checksum), + le32_to_cpu(syn_fw->image_size), + le32_to_cpu(syn_fw->config_size)); + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "FW bootloader_id:%02x, product_id:%.*s, info: %02x%02x\n", + syn_fw->bootloader_version, + (int)sizeof(syn_fw->product_id), syn_fw->product_id, + syn_fw->product_info[0], syn_fw->product_info[1]); + + if (syn_fw->image_size && + syn_fw->image_size != f34->v5.fw_blocks * f34->v5.block_size) { + dev_err(&f34->fn->dev, + "Bad firmware image: fw size %d, expected %d\n", + syn_fw->image_size, + f34->v5.fw_blocks * f34->v5.block_size); + ret = -EILSEQ; + goto out; + } + + if (syn_fw->config_size && + syn_fw->config_size != f34->v5.config_blocks * f34->v5.block_size) { + dev_err(&f34->fn->dev, + "Bad firmware image: config size %d, expected %d\n", + syn_fw->config_size, + f34->v5.config_blocks * f34->v5.block_size); + ret = -EILSEQ; + goto out; + } + + if (syn_fw->image_size && !syn_fw->config_size) { + dev_err(&f34->fn->dev, "Bad firmware image: no config data\n"); + ret = -EILSEQ; + goto out; + } + + dev_info(&f34->fn->dev, "Firmware image OK\n"); + mutex_lock(&f34->v5.flash_mutex); + + ret = rmi_f34_flash_firmware(f34, syn_fw); + + mutex_unlock(&f34->v5.flash_mutex); + +out: + return ret; +} + +static int rmi_firmware_update(struct rmi_driver_data *data, + const struct firmware *fw) +{ + struct device *dev = &data->rmi_dev->dev; + struct f34_data *f34; + int ret; + + if (!data->f34_container) { + dev_warn(dev, "%s: No F34 present!\n", __func__); + return -EINVAL; + } + + /* Only version 0 currently supported */ + if (data->f34_container->fd.function_version != 0) { + dev_warn(dev, "F34 V%d not supported!\n", + data->f34_container->fd.function_version); + return -ENODEV; + } + + f34 = dev_get_drvdata(&data->f34_container->dev); + + /* Enter flash mode */ + ret = rmi_f34_enable_flash(f34); + if (ret) + return ret; + + /* Tear down functions and re-probe */ + rmi_free_function_list(data->rmi_dev); + + ret = rmi_probe_interrupts(data); + if (ret) + return ret; + + ret = rmi_init_functions(data); + if (ret) + return ret; + + if (!data->f01_bootloader_mode || !data->f34_container) { + dev_warn(dev, "%s: No F34 present or not in bootloader!\n", + __func__); + return -EINVAL; + } + + f34 = dev_get_drvdata(&data->f34_container->dev); + + /* Perform firmware update */ + ret = rmi_f34_update_firmware(f34, fw); + + dev_info(&f34->fn->dev, "Firmware update complete, status:%d\n", ret); + + /* Re-probe */ + rmi_dbg(RMI_DEBUG_FN, dev, "Re-probing device\n"); + rmi_free_function_list(data->rmi_dev); + + ret = rmi_scan_pdt(data->rmi_dev, NULL, rmi_initial_reset); + if (ret < 0) + dev_warn(dev, "RMI reset failed!\n"); + + ret = rmi_probe_interrupts(data); + if (ret) + return ret; + + ret = rmi_init_functions(data); + if (ret) + return ret; + + if (data->f01_container->dev.driver) + /* Driver already bound, so enable ATTN now. */ + return rmi_enable_sensor(data->rmi_dev); + + rmi_dbg(RMI_DEBUG_FN, dev, "%s complete\n", __func__); + + return ret; +} + +static ssize_t rmi_driver_update_fw_store(struct device *dev, + struct device_attribute *dattr, + const char *buf, size_t count) +{ + struct rmi_driver_data *data = dev_get_drvdata(dev); + char fw_name[NAME_MAX]; + const struct firmware *fw; + size_t copy_count = count; + int ret; + + if (count == 0 || count >= NAME_MAX) + return -EINVAL; + + if (buf[count - 1] == '\0' || buf[count - 1] == '\n') + copy_count -= 1; + + strncpy(fw_name, buf, copy_count); + fw_name[copy_count] = '\0'; + + ret = request_firmware(&fw, fw_name, dev); + if (ret) + return ret; + + dev_info(dev, "Flashing %s\n", fw_name); + + ret = rmi_firmware_update(data, fw); + + release_firmware(fw); + + return ret ?: count; +} + +static DEVICE_ATTR(update_fw, 0200, NULL, rmi_driver_update_fw_store); + +static struct attribute *rmi_firmware_attrs[] = { + &dev_attr_update_fw.attr, + NULL +}; + +static struct attribute_group rmi_firmware_attr_group = { + .attrs = rmi_firmware_attrs, +}; + +static int rmi_f34_probe(struct rmi_function *fn) +{ + struct f34_data *f34; + unsigned char f34_queries[9]; + bool has_config_id; + int ret; + + f34 = devm_kzalloc(&fn->dev, sizeof(struct f34_data), GFP_KERNEL); + if (!f34) + return -ENOMEM; + + f34->fn = fn; + dev_set_drvdata(&fn->dev, f34); + + ret = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr, + f34_queries, sizeof(f34_queries)); + if (ret) { + dev_err(&fn->dev, "%s: Failed to query properties\n", + __func__); + return ret; + } + + snprintf(f34->bootloader_id, sizeof(f34->bootloader_id), + "%c%c", f34_queries[0], f34_queries[1]); + + mutex_init(&f34->v5.flash_mutex); + init_completion(&f34->v5.cmd_done); + + f34->v5.block_size = get_unaligned_le16(&f34_queries[3]); + f34->v5.fw_blocks = get_unaligned_le16(&f34_queries[5]); + f34->v5.config_blocks = get_unaligned_le16(&f34_queries[7]); + f34->v5.ctrl_address = fn->fd.data_base_addr + F34_BLOCK_DATA_OFFSET + + f34->v5.block_size; + has_config_id = f34_queries[2] & (1 << 2); + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "Bootloader ID: %s\n", + f34->bootloader_id); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "Block size: %d\n", + f34->v5.block_size); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "FW blocks: %d\n", + f34->v5.fw_blocks); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "CFG blocks: %d\n", + f34->v5.config_blocks); + + if (has_config_id) { + ret = rmi_read_block(fn->rmi_dev, fn->fd.control_base_addr, + f34_queries, sizeof(f34_queries)); + if (ret) { + dev_err(&fn->dev, "Failed to read F34 config ID\n"); + return ret; + } + + snprintf(f34->configuration_id, sizeof(f34->configuration_id), + "%02x%02x%02x%02x", + f34_queries[0], f34_queries[1], + f34_queries[2], f34_queries[3]); + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "Configuration ID: %s\n", + f34->configuration_id); + } + + return 0; +} + +int rmi_f34_create_sysfs(struct rmi_device *rmi_dev) +{ + return sysfs_create_group(&rmi_dev->dev.kobj, &rmi_firmware_attr_group); +} + +void rmi_f34_remove_sysfs(struct rmi_device *rmi_dev) +{ + sysfs_remove_group(&rmi_dev->dev.kobj, &rmi_firmware_attr_group); +} + +struct rmi_function_handler rmi_f34_handler = { + .driver = { + .name = "rmi4_f34", + }, + .func = 0x34, + .probe = rmi_f34_probe, + .attention = rmi_f34_attention, +}; diff --git a/drivers/input/rmi4/rmi_f34.h b/drivers/input/rmi4/rmi_f34.h new file mode 100644 index 000000000000..6cee5282fbb4 --- /dev/null +++ b/drivers/input/rmi4/rmi_f34.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007-2016, Synaptics Incorporated + * Copyright (C) 2016 Zodiac Inflight Innovations + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#ifndef _RMI_F34_H +#define _RMI_F34_H + +/* F34 image file offsets. */ +#define F34_FW_IMAGE_OFFSET 0x100 + +/* F34 register offsets. */ +#define F34_BLOCK_DATA_OFFSET 2 + +/* F34 commands */ +#define F34_WRITE_FW_BLOCK 0x2 +#define F34_ERASE_ALL 0x3 +#define F34_READ_CONFIG_BLOCK 0x5 +#define F34_WRITE_CONFIG_BLOCK 0x6 +#define F34_ERASE_CONFIG 0x7 +#define F34_ENABLE_FLASH_PROG 0xf + +#define F34_STATUS_IN_PROGRESS 0xff +#define F34_STATUS_IDLE 0x80 + +#define F34_IDLE_WAIT_MS 500 +#define F34_ENABLE_WAIT_MS 300 +#define F34_ERASE_WAIT_MS 5000 + +#define F34_BOOTLOADER_ID_LEN 2 + +struct rmi_f34_firmware { + __le32 checksum; + u8 pad1[3]; + u8 bootloader_version; + __le32 image_size; + __le32 config_size; + u8 product_id[10]; + u8 product_info[2]; + u8 pad2[228]; + u8 data[]; +}; + +struct f34v5_data { + u16 block_size; + u16 fw_blocks; + u16 config_blocks; + u16 ctrl_address; + u8 status; + + struct completion cmd_done; + struct mutex flash_mutex; +}; + +struct f34_data { + struct rmi_function *fn; + + unsigned char bootloader_id[5]; + unsigned char configuration_id[9]; + + struct f34v5_data v5; +}; + +#endif /* _RMI_F34_H */ diff --git a/include/linux/rmi.h b/include/linux/rmi.h index ac904bb439a5..4096b0246c23 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -337,11 +337,13 @@ struct rmi_driver_data { struct rmi_device *rmi_dev; struct rmi_function *f01_container; + struct rmi_function *f34_container; bool f01_bootloader_mode; u32 attn_count; int num_of_irq_regs; int irq_count; + void *irq_memory; unsigned long *irq_status; unsigned long *fn_irq_bits; unsigned long *current_irq_mask; From 6adba43fd222ea362c36296d1a6897c2e28fdc8e Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Tue, 22 Nov 2016 17:53:26 -0800 Subject: [PATCH 578/591] Input: synaptics-rmi4 - add support for F55 sensor tuning Sensor tuning support is needed to determine the number of enabled tx and rx electrodes for use in F54 functions. The number of enabled electrodes is not identical to the total number of electrodes as reported with F55:Query0 and F55:Query1. It has to be calculated by analyzing F55:Ctrl1 (sensor receiver assignment) and F55:Ctrl2 (sensor transmitter assignment). Support for additional sensor tuning functions may be added later. Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 ...") Signed-off-by: Guenter Roeck Tested-by: Nick Dyer Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/Kconfig | 9 +++ drivers/input/rmi4/Makefile | 1 + drivers/input/rmi4/rmi_bus.c | 3 + drivers/input/rmi4/rmi_driver.h | 1 + drivers/input/rmi4/rmi_f55.c | 124 ++++++++++++++++++++++++++++++++ 5 files changed, 138 insertions(+) create mode 100644 drivers/input/rmi4/rmi_f55.c diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index 9a24867ae7a5..f4460f3ebac5 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -95,3 +95,12 @@ config RMI4_F54 Function 54 provides access to various diagnostic features in certain RMI4 touch sensors. + +config RMI4_F55 + bool "RMI4 Function 55 (Sensor tuning)" + depends on RMI4_CORE + help + Say Y here if you want to add support for RMI4 function 55 + + Function 55 provides access to the RMI4 touch sensor tuning + mechanism. diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile index 0250abf38ad9..e7f4ca6c0508 100644 --- a/drivers/input/rmi4/Makefile +++ b/drivers/input/rmi4/Makefile @@ -9,6 +9,7 @@ rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o rmi_core-$(CONFIG_RMI4_F34) += rmi_f34.o rmi_core-$(CONFIG_RMI4_F54) += rmi_f54.o +rmi_core-$(CONFIG_RMI4_F55) += rmi_f55.o # Transports obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index ef7a66230d83..2534331ad9dc 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -321,6 +321,9 @@ static struct rmi_function_handler *fn_handlers[] = { #ifdef CONFIG_RMI4_F54 &rmi_f54_handler, #endif +#ifdef CONFIG_RMI4_F55 + &rmi_f55_handler, +#endif }; static void __rmi_unregister_function_handlers(int start_idx) diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index e627a3a8aced..5b201f369505 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -127,4 +127,5 @@ extern struct rmi_function_handler rmi_f12_handler; extern struct rmi_function_handler rmi_f30_handler; extern struct rmi_function_handler rmi_f34_handler; extern struct rmi_function_handler rmi_f54_handler; +extern struct rmi_function_handler rmi_f55_handler; #endif diff --git a/drivers/input/rmi4/rmi_f55.c b/drivers/input/rmi4/rmi_f55.c new file mode 100644 index 000000000000..2d221cc97391 --- /dev/null +++ b/drivers/input/rmi4/rmi_f55.c @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2012-2015 Synaptics Incorporated + * Copyright (C) 2016 Zodiac Inflight Innovations + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include "rmi_driver.h" + +#define F55_NAME "rmi4_f55" + +/* F55 data offsets */ +#define F55_NUM_RX_OFFSET 0 +#define F55_NUM_TX_OFFSET 1 +#define F55_PHYS_CHAR_OFFSET 2 + +/* Only read required query registers */ +#define F55_QUERY_LEN 3 + +/* F55 capabilities */ +#define F55_CAP_SENSOR_ASSIGN BIT(0) + +struct f55_data { + struct rmi_function *fn; + + u8 qry[F55_QUERY_LEN]; + u8 num_rx_electrodes; + u8 cfg_num_rx_electrodes; + u8 num_tx_electrodes; + u8 cfg_num_tx_electrodes; +}; + +static int rmi_f55_detect(struct rmi_function *fn) +{ + struct f55_data *f55; + int error; + + f55 = dev_get_drvdata(&fn->dev); + + error = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr, + &f55->qry, sizeof(f55->qry)); + if (error) { + dev_err(&fn->dev, "%s: Failed to query F55 properties\n", + __func__); + return error; + } + + f55->num_rx_electrodes = f55->qry[F55_NUM_RX_OFFSET]; + f55->num_tx_electrodes = f55->qry[F55_NUM_TX_OFFSET]; + + f55->cfg_num_rx_electrodes = f55->num_rx_electrodes; + f55->cfg_num_tx_electrodes = f55->num_rx_electrodes; + + if (f55->qry[F55_PHYS_CHAR_OFFSET] & F55_CAP_SENSOR_ASSIGN) { + int i, total; + u8 buf[256]; + + /* + * Calculate the number of enabled receive and transmit + * electrodes by reading F55:Ctrl1 (sensor receiver assignment) + * and F55:Ctrl2 (sensor transmitter assignment). The number of + * enabled electrodes is the sum of all field entries with a + * value other than 0xff. + */ + error = rmi_read_block(fn->rmi_dev, + fn->fd.control_base_addr + 1, + buf, f55->num_rx_electrodes); + if (!error) { + total = 0; + for (i = 0; i < f55->num_rx_electrodes; i++) { + if (buf[i] != 0xff) + total++; + } + f55->cfg_num_rx_electrodes = total; + } + + error = rmi_read_block(fn->rmi_dev, + fn->fd.control_base_addr + 2, + buf, f55->num_tx_electrodes); + if (!error) { + total = 0; + for (i = 0; i < f55->num_tx_electrodes; i++) { + if (buf[i] != 0xff) + total++; + } + f55->cfg_num_tx_electrodes = total; + } + } + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F55 num_rx_electrodes: %d (raw %d)\n", + f55->cfg_num_rx_electrodes, f55->num_rx_electrodes); + rmi_dbg(RMI_DEBUG_FN, &fn->dev, "F55 num_tx_electrodes: %d (raw %d)\n", + f55->cfg_num_tx_electrodes, f55->num_tx_electrodes); + + return 0; +} + +static int rmi_f55_probe(struct rmi_function *fn) +{ + struct f55_data *f55; + + f55 = devm_kzalloc(&fn->dev, sizeof(struct f55_data), GFP_KERNEL); + if (!f55) + return -ENOMEM; + + f55->fn = fn; + dev_set_drvdata(&fn->dev, f55); + + return rmi_f55_detect(fn); +} + +struct rmi_function_handler rmi_f55_handler = { + .driver = { + .name = F55_NAME, + }, + .func = 0x55, + .probe = rmi_f55_probe, +}; From c762cc68b6a12eedebefc156ea4838e54804e2eb Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Tue, 22 Nov 2016 17:57:02 -0800 Subject: [PATCH 579/591] Input: synaptics-rmi4 - propagate correct number of rx and tx electrodes to F54 F54 diagnostics report functions provide data based on the number of enabled rx and tx electrodes, which is not identical to the number of electrodes reported with F54:Query0 and F54:Query1. Those values report the number of supported electrodes, not the number of enabled electrodes. The number of enabled electrodes can be determined by analyzing F55:Ctrl1 (sensor receiver assignment) and F55:Ctrl2 (sensor transmitter assignment). Propagate the number of enabled electrodes from F55 to F54 to avoid corrupted output if not all electrodes are enabled. Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 ...") Signed-off-by: Guenter Roeck Tested-by: Nick Dyer Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/Kconfig | 1 + drivers/input/rmi4/rmi_f54.c | 14 ++++++++++---- drivers/input/rmi4/rmi_f55.c | 7 +++++++ include/linux/rmi.h | 3 +++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index f4460f3ebac5..a9c36a5fe708 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -90,6 +90,7 @@ config RMI4_F54 depends on RMI4_CORE depends on VIDEO_V4L2=y || (RMI4_CORE=m && VIDEO_V4L2=m) select VIDEOBUF2_VMALLOC + select RMI4_F55 help Say Y here if you want to add support for RMI4 function 54 diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c index 2e934aef3d2a..dea63e2db3e6 100644 --- a/drivers/input/rmi4/rmi_f54.c +++ b/drivers/input/rmi4/rmi_f54.c @@ -217,8 +217,10 @@ unlock: static size_t rmi_f54_get_report_size(struct f54_data *f54) { - u8 rx = f54->num_rx_electrodes ? : f54->num_rx_electrodes; - u8 tx = f54->num_tx_electrodes ? : f54->num_tx_electrodes; + struct rmi_device *rmi_dev = f54->fn->rmi_dev; + struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev); + u8 rx = drv_data->num_rx_electrodes ? : f54->num_rx_electrodes; + u8 tx = drv_data->num_tx_electrodes ? : f54->num_tx_electrodes; size_t size; switch (rmi_f54_get_reptype(f54, f54->input)) { @@ -402,6 +404,10 @@ static int rmi_f54_vidioc_enum_input(struct file *file, void *priv, static int rmi_f54_set_input(struct f54_data *f54, unsigned int i) { + struct rmi_device *rmi_dev = f54->fn->rmi_dev; + struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev); + u8 rx = drv_data->num_rx_electrodes ? : f54->num_rx_electrodes; + u8 tx = drv_data->num_tx_electrodes ? : f54->num_tx_electrodes; struct v4l2_pix_format *f = &f54->format; enum rmi_f54_report_type reptype; int ret; @@ -416,8 +422,8 @@ static int rmi_f54_set_input(struct f54_data *f54, unsigned int i) f54->input = i; - f->width = f54->num_rx_electrodes; - f->height = f54->num_tx_electrodes; + f->width = rx; + f->height = tx; f->field = V4L2_FIELD_NONE; f->colorspace = V4L2_COLORSPACE_RAW; f->bytesperline = f->width * sizeof(u16); diff --git a/drivers/input/rmi4/rmi_f55.c b/drivers/input/rmi4/rmi_f55.c index 2d221cc97391..37390ca6a924 100644 --- a/drivers/input/rmi4/rmi_f55.c +++ b/drivers/input/rmi4/rmi_f55.c @@ -38,6 +38,8 @@ struct f55_data { static int rmi_f55_detect(struct rmi_function *fn) { + struct rmi_device *rmi_dev = fn->rmi_dev; + struct rmi_driver_data *drv_data = dev_get_drvdata(&rmi_dev->dev); struct f55_data *f55; int error; @@ -57,6 +59,9 @@ static int rmi_f55_detect(struct rmi_function *fn) f55->cfg_num_rx_electrodes = f55->num_rx_electrodes; f55->cfg_num_tx_electrodes = f55->num_rx_electrodes; + drv_data->num_rx_electrodes = f55->cfg_num_rx_electrodes; + drv_data->num_tx_electrodes = f55->cfg_num_rx_electrodes; + if (f55->qry[F55_PHYS_CHAR_OFFSET] & F55_CAP_SENSOR_ASSIGN) { int i, total; u8 buf[256]; @@ -78,6 +83,7 @@ static int rmi_f55_detect(struct rmi_function *fn) total++; } f55->cfg_num_rx_electrodes = total; + drv_data->num_rx_electrodes = total; } error = rmi_read_block(fn->rmi_dev, @@ -90,6 +96,7 @@ static int rmi_f55_detect(struct rmi_function *fn) total++; } f55->cfg_num_tx_electrodes = total; + drv_data->num_tx_electrodes = total; } } diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 4096b0246c23..8499b6aa2221 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -354,6 +354,9 @@ struct rmi_driver_data { u8 pdt_props; u8 bsr; + u8 num_rx_electrodes; + u8 num_tx_electrodes; + bool enabled; void *data; From 9e421b7c60860f150aa29e9f7bc902f003d87e68 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 29 Nov 2016 17:41:50 -0800 Subject: [PATCH 580/591] Input: synaptics-rmi4 - fix documentation of rmi_2d_sensor_platform_data Typos... Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- include/linux/rmi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 8499b6aa2221..27dd9aa4090c 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -108,7 +108,7 @@ struct rmi_2d_sensor_platform_data { * @buttonpad - the touchpad is a buttonpad, so enable only the first actual * button that is found. * @trackstick_buttons - Set when the function 30 is handling the physical - * buttons of the trackstick (as a PD/2 passthrough device. + * buttons of the trackstick (as a PS/2 passthrough device). * @disable - the touchpad incorrectly reports F30 and it should be ignored. * This is a special case which is due to misconfigured firmware. */ From 0d37d63a001202b4932f6b14b05d8d055a0a45b6 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 29 Nov 2016 17:42:01 -0800 Subject: [PATCH 581/591] Input: synaptics-rmi4 - remove unused fields in struct rmi_driver_data These fields are not used anywhere, there is no point in carrying them. Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- include/linux/rmi.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 27dd9aa4090c..0b118ab47b8d 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -340,7 +340,6 @@ struct rmi_driver_data { struct rmi_function *f34_container; bool f01_bootloader_mode; - u32 attn_count; int num_of_irq_regs; int irq_count; void *irq_memory; @@ -352,14 +351,11 @@ struct rmi_driver_data { struct input_dev *input; u8 pdt_props; - u8 bsr; u8 num_rx_electrodes; u8 num_tx_electrodes; bool enabled; - - void *data; }; int rmi_register_transport_device(struct rmi_transport_dev *xport); From a64ea311f1e4bc090c89960650637423e86c35c0 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 29 Nov 2016 17:42:13 -0800 Subject: [PATCH 582/591] Input: synaptics-rmi4 - add rmi_enable/disable_irq Set the .enabled boolean and trigger an event processing when enabling for edge-triggered systems. Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_driver.c | 83 +++++++++++++++++++++++++-------- drivers/input/rmi4/rmi_driver.h | 2 + include/linux/rmi.h | 1 + 3 files changed, 67 insertions(+), 19 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 2b17d8cb3d10..f04fc4152c1f 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -215,6 +215,7 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id) static int rmi_irq_init(struct rmi_device *rmi_dev) { struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); + struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); int irq_flags = irq_get_trigger_type(pdata->irq); int ret; @@ -232,6 +233,8 @@ static int rmi_irq_init(struct rmi_device *rmi_dev) return ret; } + data->enabled = true; + return 0; } @@ -866,17 +869,54 @@ err_put_fn: return error; } -int rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake) +void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake) { struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); + struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); int irq = pdata->irq; - int retval = 0; + int irq_flags; + int retval; - retval = rmi_suspend_functions(rmi_dev); - if (retval) - dev_warn(&rmi_dev->dev, "Failed to suspend functions: %d\n", - retval); + mutex_lock(&data->enabled_mutex); + if (data->enabled) + goto out; + + enable_irq(irq); + data->enabled = true; + if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) { + retval = disable_irq_wake(irq); + if (!retval) + dev_warn(&rmi_dev->dev, + "Failed to disable irq for wake: %d\n", + retval); + } + + /* + * Call rmi_process_interrupt_requests() after enabling irq, + * otherwise we may lose interrupt on edge-triggered systems. + */ + irq_flags = irq_get_trigger_type(pdata->irq); + if (irq_flags & IRQ_TYPE_EDGE_BOTH) + rmi_process_interrupt_requests(rmi_dev); + +out: + mutex_unlock(&data->enabled_mutex); +} + +void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake) +{ + struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); + struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); + int irq = pdata->irq; + int retval; + + mutex_lock(&data->enabled_mutex); + + if (!data->enabled) + goto out; + + data->enabled = false; disable_irq(irq); if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) { retval = enable_irq_wake(irq); @@ -885,24 +925,30 @@ int rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake) "Failed to enable irq for wake: %d\n", retval); } + +out: + mutex_unlock(&data->enabled_mutex); +} + +int rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake) +{ + int retval; + + retval = rmi_suspend_functions(rmi_dev); + if (retval) + dev_warn(&rmi_dev->dev, "Failed to suspend functions: %d\n", + retval); + + rmi_disable_irq(rmi_dev, enable_wake); return retval; } EXPORT_SYMBOL_GPL(rmi_driver_suspend); int rmi_driver_resume(struct rmi_device *rmi_dev, bool clear_wake) { - struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); - int irq = pdata->irq; int retval; - enable_irq(irq); - if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) { - retval = disable_irq_wake(irq); - if (!retval) - dev_warn(&rmi_dev->dev, - "Failed to disable irq for wake: %d\n", - retval); - } + rmi_enable_irq(rmi_dev, clear_wake); retval = rmi_resume_functions(rmi_dev); if (retval) @@ -916,10 +962,8 @@ EXPORT_SYMBOL_GPL(rmi_driver_resume); static int rmi_driver_remove(struct device *dev) { struct rmi_device *rmi_dev = to_rmi_device(dev); - struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); - int irq = pdata->irq; - disable_irq(irq); + rmi_disable_irq(rmi_dev, false); rmi_f34_remove_sysfs(rmi_dev); rmi_free_function_list(rmi_dev); @@ -1108,6 +1152,7 @@ static int rmi_driver_probe(struct device *dev) } mutex_init(&data->irq_mutex); + mutex_init(&data->enabled_mutex); retval = rmi_probe_interrupts(data); if (retval) diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index 5b201f369505..c9fe3d3deef3 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -101,6 +101,8 @@ int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, int (*callback)(struct rmi_device *rmi_dev, void *ctx, const struct pdt_entry *entry)); int rmi_probe_interrupts(struct rmi_driver_data *data); +void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake); +void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake); int rmi_init_functions(struct rmi_driver_data *data); int rmi_initial_reset(struct rmi_device *rmi_dev, void *ctx, const struct pdt_entry *pdt); diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 0b118ab47b8d..621f098f1243 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -356,6 +356,7 @@ struct rmi_driver_data { u8 num_tx_electrodes; bool enabled; + struct mutex enabled_mutex; }; int rmi_register_transport_device(struct rmi_transport_dev *xport); From e155d4ee0b878c857f91deb14d6d7dba55c38648 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Wed, 30 Nov 2016 16:59:30 -0800 Subject: [PATCH 583/591] Input: synaptics-rmi4 - remove mutex calls while updating the firmware This partially reverts commit 29fd0ec2bdbe ("Input: synaptics-rmi4 - add support for F34 device reflash") irq_mutex should be used only to protect data->current_irq_mask, not preventing incoming input to be processed while the upgrade of the firmware is happening. We can simply disable the irqs when we don't want them to interfere with the upgrade process. Tested on S7300 and S7800 (with F34 v7 patch added) Signed-off-by: Benjamin Tissoires Signed-off-by: Nick Dyer Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_driver.c | 40 +++++++-------------------------- drivers/input/rmi4/rmi_f34.c | 19 +++++++++++----- 2 files changed, 22 insertions(+), 37 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index f04fc4152c1f..27c731ab71b8 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -42,8 +42,6 @@ void rmi_free_function_list(struct rmi_device *rmi_dev) rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Freeing function list\n"); - mutex_lock(&data->irq_mutex); - devm_kfree(&rmi_dev->dev, data->irq_memory); data->irq_memory = NULL; data->irq_status = NULL; @@ -60,8 +58,6 @@ void rmi_free_function_list(struct rmi_device *rmi_dev) list_del(&fn->node); rmi_unregister_function(fn); } - - mutex_unlock(&data->irq_mutex); } EXPORT_SYMBOL_GPL(rmi_free_function_list); @@ -160,25 +156,24 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) if (!data) return 0; - mutex_lock(&data->irq_mutex); - if (!data->irq_status || !data->f01_container) { - mutex_unlock(&data->irq_mutex); - return 0; - } - if (!rmi_dev->xport->attn_data) { error = rmi_read_block(rmi_dev, data->f01_container->fd.data_base_addr + 1, data->irq_status, data->num_of_irq_regs); if (error < 0) { dev_err(dev, "Failed to read irqs, code=%d\n", error); - mutex_unlock(&data->irq_mutex); return error; } } + mutex_lock(&data->irq_mutex); bitmap_and(data->irq_status, data->irq_status, data->current_irq_mask, data->irq_count); + /* + * At this point, irq_status has all bits that are set in the + * interrupt status register and are enabled. + */ + mutex_unlock(&data->irq_mutex); /* * It would be nice to be able to use irq_chip to handle these @@ -194,8 +189,6 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) if (data->input) input_sync(data->input); - mutex_unlock(&data->irq_mutex); - return 0; } @@ -263,18 +256,12 @@ static int rmi_suspend_functions(struct rmi_device *rmi_dev) struct rmi_function *entry; int retval; - mutex_lock(&data->irq_mutex); - list_for_each_entry(entry, &data->function_list, node) { retval = suspend_one_function(entry); - if (retval < 0) { - mutex_unlock(&data->irq_mutex); + if (retval < 0) return retval; - } } - mutex_unlock(&data->irq_mutex); - return 0; } @@ -303,18 +290,12 @@ static int rmi_resume_functions(struct rmi_device *rmi_dev) struct rmi_function *entry; int retval; - mutex_lock(&data->irq_mutex); - list_for_each_entry(entry, &data->function_list, node) { retval = resume_one_function(entry); - if (retval < 0) { - mutex_unlock(&data->irq_mutex); + if (retval < 0) return retval; - } } - mutex_unlock(&data->irq_mutex); - return 0; } @@ -1043,8 +1024,6 @@ int rmi_init_functions(struct rmi_driver_data *data) int irq_count; int retval; - mutex_lock(&data->irq_mutex); - irq_count = 0; rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Creating functions.\n", __func__); retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_create_function); @@ -1069,13 +1048,10 @@ int rmi_init_functions(struct rmi_driver_data *data) goto err_destroy_functions; } - mutex_unlock(&data->irq_mutex); - return 0; err_destroy_functions: rmi_free_function_list(rmi_dev); - mutex_unlock(&data->irq_mutex); return retval; } EXPORT_SYMBOL_GPL(rmi_init_functions); diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c index 03df85ac91a5..01936a4a9a6c 100644 --- a/drivers/input/rmi4/rmi_f34.c +++ b/drivers/input/rmi4/rmi_f34.c @@ -282,7 +282,8 @@ out: static int rmi_firmware_update(struct rmi_driver_data *data, const struct firmware *fw) { - struct device *dev = &data->rmi_dev->dev; + struct rmi_device *rmi_dev = data->rmi_dev; + struct device *dev = &rmi_dev->dev; struct f34_data *f34; int ret; @@ -305,8 +306,10 @@ static int rmi_firmware_update(struct rmi_driver_data *data, if (ret) return ret; + rmi_disable_irq(rmi_dev, false); + /* Tear down functions and re-probe */ - rmi_free_function_list(data->rmi_dev); + rmi_free_function_list(rmi_dev); ret = rmi_probe_interrupts(data); if (ret) @@ -322,6 +325,8 @@ static int rmi_firmware_update(struct rmi_driver_data *data, return -EINVAL; } + rmi_enable_irq(rmi_dev, false); + f34 = dev_get_drvdata(&data->f34_container->dev); /* Perform firmware update */ @@ -329,11 +334,13 @@ static int rmi_firmware_update(struct rmi_driver_data *data, dev_info(&f34->fn->dev, "Firmware update complete, status:%d\n", ret); + rmi_disable_irq(rmi_dev, false); + /* Re-probe */ rmi_dbg(RMI_DEBUG_FN, dev, "Re-probing device\n"); - rmi_free_function_list(data->rmi_dev); + rmi_free_function_list(rmi_dev); - ret = rmi_scan_pdt(data->rmi_dev, NULL, rmi_initial_reset); + ret = rmi_scan_pdt(rmi_dev, NULL, rmi_initial_reset); if (ret < 0) dev_warn(dev, "RMI reset failed!\n"); @@ -345,9 +352,11 @@ static int rmi_firmware_update(struct rmi_driver_data *data, if (ret) return ret; + rmi_enable_irq(rmi_dev, false); + if (data->f01_container->dev.driver) /* Driver already bound, so enable ATTN now. */ - return rmi_enable_sensor(data->rmi_dev); + return rmi_enable_sensor(rmi_dev); rmi_dbg(RMI_DEBUG_FN, dev, "%s complete\n", __func__); From e9dade4106e1c1ff4ae91386b9812ee8f51c3775 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Wed, 30 Nov 2016 17:00:28 -0800 Subject: [PATCH 584/591] Input: synaptics-rmi4 - remove EXPORT_SYMBOL_GPL for internal functions those functions should not be used outside of rmi_core.ko. There is no point in exporting them to the world. It looks like rmi_read_pdt_entry() should be static too. Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_driver.c | 15 ++------------- drivers/input/rmi4/rmi_driver.h | 3 --- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 27c731ab71b8..a718e51afb0b 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -59,7 +59,6 @@ void rmi_free_function_list(struct rmi_device *rmi_dev) rmi_unregister_function(fn); } } -EXPORT_SYMBOL_GPL(rmi_free_function_list); static int reset_one_function(struct rmi_function *fn) { @@ -309,7 +308,6 @@ int rmi_enable_sensor(struct rmi_device *rmi_dev) return rmi_process_interrupt_requests(rmi_dev); } -EXPORT_SYMBOL_GPL(rmi_enable_sensor); /** * rmi_driver_set_input_params - set input device id and other data. @@ -431,8 +429,8 @@ static int rmi_driver_reset_handler(struct rmi_device *rmi_dev) return 0; } -int rmi_read_pdt_entry(struct rmi_device *rmi_dev, struct pdt_entry *entry, - u16 pdt_address) +static int rmi_read_pdt_entry(struct rmi_device *rmi_dev, + struct pdt_entry *entry, u16 pdt_address) { u8 buf[RMI_PDT_ENTRY_SIZE]; int error; @@ -455,7 +453,6 @@ int rmi_read_pdt_entry(struct rmi_device *rmi_dev, struct pdt_entry *entry, return 0; } -EXPORT_SYMBOL_GPL(rmi_read_pdt_entry); static void rmi_driver_copy_pdt_to_fd(const struct pdt_entry *pdt, struct rmi_function_descriptor *fd) @@ -532,7 +529,6 @@ int rmi_scan_pdt(struct rmi_device *rmi_dev, void *ctx, return retval < 0 ? retval : 0; } -EXPORT_SYMBOL_GPL(rmi_scan_pdt); int rmi_read_register_desc(struct rmi_device *d, u16 addr, struct rmi_register_descriptor *rdesc) @@ -664,7 +660,6 @@ free_struct_buff: kfree(struct_buf); return ret; } -EXPORT_SYMBOL_GPL(rmi_read_register_desc); const struct rmi_register_desc_item *rmi_get_register_desc_item( struct rmi_register_descriptor *rdesc, u16 reg) @@ -680,7 +675,6 @@ const struct rmi_register_desc_item *rmi_get_register_desc_item( return NULL; } -EXPORT_SYMBOL_GPL(rmi_get_register_desc_item); size_t rmi_register_desc_calc_size(struct rmi_register_descriptor *rdesc) { @@ -694,7 +688,6 @@ size_t rmi_register_desc_calc_size(struct rmi_register_descriptor *rdesc) } return size; } -EXPORT_SYMBOL_GPL(rmi_register_desc_calc_size); /* Compute the register offset relative to the base address */ int rmi_register_desc_calc_reg_offset( @@ -712,7 +705,6 @@ int rmi_register_desc_calc_reg_offset( } return -1; } -EXPORT_SYMBOL_GPL(rmi_register_desc_calc_reg_offset); bool rmi_register_desc_has_subpacket(const struct rmi_register_desc_item *item, u8 subpacket) @@ -796,7 +788,6 @@ int rmi_initial_reset(struct rmi_device *rmi_dev, void *ctx, /* F01 should always be on page 0. If we don't find it there, fail. */ return pdt->page_start == 0 ? RMI_SCAN_CONTINUE : -ENODEV; } -EXPORT_SYMBOL_GPL(rmi_initial_reset); static int rmi_create_function(struct rmi_device *rmi_dev, void *ctx, const struct pdt_entry *pdt) @@ -1015,7 +1006,6 @@ int rmi_probe_interrupts(struct rmi_driver_data *data) return retval; } -EXPORT_SYMBOL_GPL(rmi_probe_interrupts); int rmi_init_functions(struct rmi_driver_data *data) { @@ -1054,7 +1044,6 @@ err_destroy_functions: rmi_free_function_list(rmi_dev); return retval; } -EXPORT_SYMBOL_GPL(rmi_init_functions); static int rmi_driver_probe(struct device *dev) { diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index c9fe3d3deef3..cc9458522279 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -51,9 +51,6 @@ struct pdt_entry { u8 function_number; }; -int rmi_read_pdt_entry(struct rmi_device *rmi_dev, struct pdt_entry *entry, - u16 pdt_address); - #define RMI_REG_DESC_PRESENSE_BITS (32 * BITS_PER_BYTE) #define RMI_REG_DESC_SUBPACKET_BITS (37 * BITS_PER_BYTE) From 0a135b88bceac40d0036e401c19cdbda65b38a8f Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Wed, 30 Nov 2016 17:01:50 -0800 Subject: [PATCH 585/591] Input: synaptics-rmi4 - have only one struct platform data If struct rmi_device_platform_data contains pointers to other struct, it gets difficult to allocate a fixed size struct and copy it over between drivers. Change the pointers into a struct and change the code in rmi4 accordingly. Reviewed-by: Andrew Duggan Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_f11.c | 4 ++-- drivers/input/rmi4/rmi_f12.c | 4 ++-- drivers/input/rmi4/rmi_f30.c | 9 ++++----- include/linux/rmi.h | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c index c252d405df4c..ffcbbc1745de 100644 --- a/drivers/input/rmi4/rmi_f11.c +++ b/drivers/input/rmi4/rmi_f11.c @@ -1080,8 +1080,8 @@ static int rmi_f11_initialize(struct rmi_function *fn) rc = rmi_2d_sensor_of_probe(&fn->dev, &f11->sensor_pdata); if (rc) return rc; - } else if (pdata->sensor_pdata) { - f11->sensor_pdata = *pdata->sensor_pdata; + } else { + f11->sensor_pdata = pdata->sensor_pdata; } f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait; diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index d7255f18306d..82a4964e5eb9 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -352,8 +352,8 @@ static int rmi_f12_probe(struct rmi_function *fn) ret = rmi_2d_sensor_of_probe(&fn->dev, &f12->sensor_pdata); if (ret) return ret; - } else if (pdata->sensor_pdata) { - f12->sensor_pdata = *pdata->sensor_pdata; + } else { + f12->sensor_pdata = pdata->sensor_pdata; } ret = rmi_read_register_desc(rmi_dev, query_addr, diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c index 485907ff10f4..f696137a56f5 100644 --- a/drivers/input/rmi4/rmi_f30.c +++ b/drivers/input/rmi4/rmi_f30.c @@ -196,7 +196,7 @@ static int rmi_f30_config(struct rmi_function *fn) rmi_get_platform_data(fn->rmi_dev); int error; - if (pdata->f30_data && pdata->f30_data->disable) { + if (pdata->f30_data.disable) { drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask); } else { /* Write Control Register values back to device */ @@ -355,7 +355,7 @@ static inline int rmi_f30_initialize(struct rmi_function *fn) f30->gpioled_key_map = (u16 *)map_memory; pdata = rmi_get_platform_data(rmi_dev); - if (pdata && f30->has_gpio) { + if (f30->has_gpio) { button = BTN_LEFT; for (i = 0; i < f30->gpioled_count; i++) { if (rmi_f30_is_valid_button(i, f30->ctrl)) { @@ -366,8 +366,7 @@ static inline int rmi_f30_initialize(struct rmi_function *fn) * f30->has_mech_mouse_btns, but I am * not sure, so use only the pdata info */ - if (pdata->f30_data && - pdata->f30_data->buttonpad) + if (pdata->f30_data.buttonpad) break; } } @@ -382,7 +381,7 @@ static int rmi_f30_probe(struct rmi_function *fn) const struct rmi_device_platform_data *pdata = rmi_get_platform_data(fn->rmi_dev); - if (pdata->f30_data && pdata->f30_data->disable) + if (pdata->f30_data.disable) return 0; rc = rmi_f30_initialize(fn); diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 621f098f1243..7780e40a2573 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -218,9 +218,9 @@ struct rmi_device_platform_data { struct rmi_device_platform_data_spi spi_data; /* function handler pdata */ - struct rmi_2d_sensor_platform_data *sensor_pdata; + struct rmi_2d_sensor_platform_data sensor_pdata; struct rmi_f01_power_management power_management; - struct rmi_f30_data *f30_data; + struct rmi_f30_data f30_data; }; /** From c5e8848fc98e363ea51b68de01392366312d9efa Mon Sep 17 00:00:00 2001 From: Lyude Paul Date: Fri, 2 Dec 2016 16:59:07 -0800 Subject: [PATCH 586/591] Input: synaptics-rmi4 - add support for F03 This adds basic functionality for PS/2 passthrough on Synaptics Touchpads using RMI4 through smbus. Reviewed-by: Andrew Duggan Signed-off-by: Lyude Paul Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/Kconfig | 9 ++ drivers/input/rmi4/Makefile | 1 + drivers/input/rmi4/rmi_bus.c | 3 + drivers/input/rmi4/rmi_driver.h | 1 + drivers/input/rmi4/rmi_f03.c | 232 ++++++++++++++++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 drivers/input/rmi4/rmi_f03.c diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index a9c36a5fe708..30cc627a4f45 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -39,6 +39,15 @@ config RMI4_SMB To compile this driver as a module, choose M here: the module will be called rmi_smbus. +config RMI4_F03 + bool "RMI4 Function 03 (PS2 Guest)" + depends on RMI4_CORE && SERIO + help + Say Y here if you want to add support for RMI4 function 03. + + Function 03 provides PS2 guest support for RMI4 devices. This + includes support for TrackPoints on TouchPads. + config RMI4_2D_SENSOR bool depends on RMI4_CORE diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile index e7f4ca6c0508..a199cbe9c27d 100644 --- a/drivers/input/rmi4/Makefile +++ b/drivers/input/rmi4/Makefile @@ -4,6 +4,7 @@ rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o # Function drivers +rmi_core-$(CONFIG_RMI4_F03) += rmi_f03.o rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index 2534331ad9dc..df97d8679bad 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -306,6 +306,9 @@ struct bus_type rmi_bus_type = { static struct rmi_function_handler *fn_handlers[] = { &rmi_f01_handler, +#ifdef CONFIG_RMI4_F03 + &rmi_f03_handler, +#endif #ifdef CONFIG_RMI4_F11 &rmi_f11_handler, #endif diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h index cc9458522279..24f8f764d171 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -121,6 +121,7 @@ static inline void rmi_f34_remove_sysfs(struct rmi_device *rmi_dev) #endif /* CONFIG_RMI_F34 */ extern struct rmi_function_handler rmi_f01_handler; +extern struct rmi_function_handler rmi_f03_handler; extern struct rmi_function_handler rmi_f11_handler; extern struct rmi_function_handler rmi_f12_handler; extern struct rmi_function_handler rmi_f30_handler; diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c new file mode 100644 index 000000000000..24c7375aa361 --- /dev/null +++ b/drivers/input/rmi4/rmi_f03.c @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2015-2016 Red Hat + * Copyright (C) 2015 Lyude Paul + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include "rmi_driver.h" + +#define RMI_F03_RX_DATA_OFB 0x01 +#define RMI_F03_OB_SIZE 2 + +#define RMI_F03_OB_OFFSET 2 +#define RMI_F03_OB_DATA_OFFSET 1 +#define RMI_F03_OB_FLAG_TIMEOUT BIT(6) +#define RMI_F03_OB_FLAG_PARITY BIT(7) + +#define RMI_F03_DEVICE_COUNT 0x07 +#define RMI_F03_BYTES_PER_DEVICE 0x07 +#define RMI_F03_BYTES_PER_DEVICE_SHIFT 4 +#define RMI_F03_QUEUE_LENGTH 0x0F + +struct f03_data { + struct rmi_function *fn; + + struct serio *serio; + + u8 device_count; + u8 rx_queue_length; +}; + +static int rmi_f03_pt_write(struct serio *id, unsigned char val) +{ + struct f03_data *f03 = id->port_data; + int error; + + rmi_dbg(RMI_DEBUG_FN, &f03->fn->dev, + "%s: Wrote %.2hhx to PS/2 passthrough address", + __func__, val); + + error = rmi_write(f03->fn->rmi_dev, f03->fn->fd.data_base_addr, val); + if (error) { + dev_err(&f03->fn->dev, + "%s: Failed to write to F03 TX register (%d).\n", + __func__, error); + return error; + } + + return 0; +} + +static int rmi_f03_initialize(struct f03_data *f03) +{ + struct rmi_function *fn = f03->fn; + struct device *dev = &fn->dev; + int error; + u8 bytes_per_device; + u8 query1; + u8 query2[RMI_F03_DEVICE_COUNT * RMI_F03_BYTES_PER_DEVICE]; + size_t query2_len; + + error = rmi_read(fn->rmi_dev, fn->fd.query_base_addr, &query1); + if (error) { + dev_err(dev, "Failed to read query register (%d).\n", error); + return error; + } + + f03->device_count = query1 & RMI_F03_DEVICE_COUNT; + bytes_per_device = (query1 >> RMI_F03_BYTES_PER_DEVICE_SHIFT) & + RMI_F03_BYTES_PER_DEVICE; + + query2_len = f03->device_count * bytes_per_device; + + /* + * The first generation of image sensors don't have a second part to + * their f03 query, as such we have to set some of these values manually + */ + if (query2_len < 1) { + f03->device_count = 1; + f03->rx_queue_length = 7; + } else { + error = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr + 1, + query2, query2_len); + if (error) { + dev_err(dev, + "Failed to read second set of query registers (%d).\n", + error); + return error; + } + + f03->rx_queue_length = query2[0] & RMI_F03_QUEUE_LENGTH; + } + + return 0; +} + +static int rmi_f03_register_pt(struct f03_data *f03) +{ + struct serio *serio; + + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); + if (!serio) + return -ENOMEM; + + serio->id.type = SERIO_8042; + serio->write = rmi_f03_pt_write; + serio->port_data = f03; + + strlcpy(serio->name, "Synaptics RMI4 PS/2 pass-through", + sizeof(serio->name)); + strlcpy(serio->phys, "synaptics-rmi4-pt/serio1", + sizeof(serio->phys)); + serio->dev.parent = &f03->fn->dev; + + f03->serio = serio; + + serio_register_port(serio); + + return 0; +} + +static int rmi_f03_probe(struct rmi_function *fn) +{ + struct device *dev = &fn->dev; + struct f03_data *f03; + int error; + + f03 = devm_kzalloc(dev, sizeof(struct f03_data), GFP_KERNEL); + if (!f03) + return -ENOMEM; + + f03->fn = fn; + + error = rmi_f03_initialize(f03); + if (error < 0) + return error; + + if (f03->device_count != 1) + dev_warn(dev, "found %d devices on PS/2 passthrough", + f03->device_count); + + dev_set_drvdata(dev, f03); + + error = rmi_f03_register_pt(f03); + if (error) + return error; + + return 0; +} + +static int rmi_f03_config(struct rmi_function *fn) +{ + fn->rmi_dev->driver->set_irq_bits(fn->rmi_dev, fn->irq_mask); + + return 0; +} + +static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits) +{ + struct f03_data *f03 = dev_get_drvdata(&fn->dev); + u16 data_addr = fn->fd.data_base_addr; + const u8 ob_len = f03->rx_queue_length * RMI_F03_OB_SIZE; + u8 obs[RMI_F03_QUEUE_LENGTH * RMI_F03_OB_SIZE]; + u8 ob_status; + u8 ob_data; + unsigned int serio_flags; + int i; + int error; + + /* Grab all of the data registers, and check them for data */ + error = rmi_read_block(fn->rmi_dev, data_addr + RMI_F03_OB_OFFSET, + &obs, ob_len); + if (error) { + dev_err(&fn->dev, + "%s: Failed to read F03 output buffers: %d\n", + __func__, error); + serio_interrupt(f03->serio, 0, SERIO_TIMEOUT); + return error; + } + + for (i = 0; i < ob_len; i += RMI_F03_OB_SIZE) { + ob_status = obs[i]; + ob_data = obs[i + RMI_F03_OB_DATA_OFFSET]; + serio_flags = 0; + + if (!(ob_status & RMI_F03_RX_DATA_OFB)) + continue; + + if (ob_status & RMI_F03_OB_FLAG_TIMEOUT) + serio_flags |= SERIO_TIMEOUT; + if (ob_status & RMI_F03_OB_FLAG_PARITY) + serio_flags |= SERIO_PARITY; + + rmi_dbg(RMI_DEBUG_FN, &fn->dev, + "%s: Received %.2hhx from PS2 guest T: %c P: %c\n", + __func__, ob_data, + serio_flags & SERIO_TIMEOUT ? 'Y' : 'N', + serio_flags & SERIO_PARITY ? 'Y' : 'N'); + + serio_interrupt(f03->serio, ob_data, serio_flags); + } + + return 0; +} + +static void rmi_f03_remove(struct rmi_function *fn) +{ + struct f03_data *f03 = dev_get_drvdata(&fn->dev); + + serio_unregister_port(f03->serio); +} + +struct rmi_function_handler rmi_f03_handler = { + .driver = { + .name = "rmi4_f03", + }, + .func = 0x03, + .probe = rmi_f03_probe, + .config = rmi_f03_config, + .attention = rmi_f03_attention, + .remove = rmi_f03_remove, +}; + +MODULE_AUTHOR("Lyude Paul "); +MODULE_DESCRIPTION("RMI F03 module"); +MODULE_LICENSE("GPL"); From e621132f934f5922e8a3968edd236f97cdad60cf Mon Sep 17 00:00:00 2001 From: Dennis Wassenberg Date: Fri, 2 Dec 2016 17:45:29 -0800 Subject: [PATCH 587/591] Input: synaptics-rmi4 - f03 - grab data passed by transport device First check if there are data available passed by the transport device. If data available use these data. If there are no data available try to read the rmi block if dsata are passed this way. This is the way the other rmi function handlers will do this. This patch is needed on HID devices because the firmware reads F03 data registers and adds them to the HID attention report. Reading those registers from the driver after the firmware read them will result in invalid data. Reviewed-by: Andrew Duggan Signed-off-by: Dennis Wassenberg Signed-off-by: Benjamin Tissoires Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_f03.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c index 24c7375aa361..7a3ec0ed0c27 100644 --- a/drivers/input/rmi4/rmi_f03.c +++ b/drivers/input/rmi4/rmi_f03.c @@ -163,6 +163,7 @@ static int rmi_f03_config(struct rmi_function *fn) static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits) { + struct rmi_device *rmi_dev = fn->rmi_dev; struct f03_data *f03 = dev_get_drvdata(&fn->dev); u16 data_addr = fn->fd.data_base_addr; const u8 ob_len = f03->rx_queue_length * RMI_F03_OB_SIZE; @@ -173,15 +174,31 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits) int i; int error; - /* Grab all of the data registers, and check them for data */ - error = rmi_read_block(fn->rmi_dev, data_addr + RMI_F03_OB_OFFSET, - &obs, ob_len); - if (error) { - dev_err(&fn->dev, - "%s: Failed to read F03 output buffers: %d\n", - __func__, error); - serio_interrupt(f03->serio, 0, SERIO_TIMEOUT); - return error; + if (!rmi_dev || !rmi_dev->xport) + return -ENODEV; + + if (rmi_dev->xport->attn_data) { + /* First grab the data passed by the transport device */ + if (rmi_dev->xport->attn_size < ob_len) { + dev_warn(&fn->dev, "F03 interrupted, but data is missing!\n"); + return 0; + } + + memcpy(obs, rmi_dev->xport->attn_data, ob_len); + + rmi_dev->xport->attn_data += ob_len; + rmi_dev->xport->attn_size -= ob_len; + } else { + /* Grab all of the data registers, and check them for data */ + error = rmi_read_block(fn->rmi_dev, data_addr + RMI_F03_OB_OFFSET, + &obs, ob_len); + if (error) { + dev_err(&fn->dev, + "%s: Failed to read F03 output buffers: %d\n", + __func__, error); + serio_interrupt(f03->serio, 0, SERIO_TIMEOUT); + return error; + } } for (i = 0; i < ob_len; i += RMI_F03_OB_SIZE) { From b908d3cd812abe3f4a74d7550bbf0a8cbcfbe6ed Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Fri, 2 Dec 2016 17:48:51 -0800 Subject: [PATCH 588/591] Input: synaptics-rmi4 - allow to add attention data The HID implementation of RMI4 provides the data during the interrupt (in the input report). We need to provide a way for this transport driver to provide the attention data while calling an IRQ. We use a fifo in rmi_core to not lose any incoming event. Signed-off-by: Benjamin Tissoires Reviewed-by: Andrew Duggan Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_driver.c | 49 +++++++++++++++++++++++++++++++-- include/linux/rmi.h | 11 ++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index a718e51afb0b..85062e414e73 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -191,16 +191,53 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) return 0; } +void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status, + void *data, size_t size) +{ + struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); + struct rmi4_attn_data attn_data; + void *fifo_data; + + if (!drvdata->enabled) + return; + + fifo_data = kmemdup(data, size, GFP_ATOMIC); + if (!fifo_data) + return; + + attn_data.irq_status = irq_status; + attn_data.size = size; + attn_data.data = fifo_data; + + kfifo_put(&drvdata->attn_fifo, attn_data); +} +EXPORT_SYMBOL_GPL(rmi_set_attn_data); + static irqreturn_t rmi_irq_fn(int irq, void *dev_id) { struct rmi_device *rmi_dev = dev_id; - int ret; + struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); + struct rmi4_attn_data attn_data = {0}; + int ret, count; + + count = kfifo_get(&drvdata->attn_fifo, &attn_data); + if (count) { + *(drvdata->irq_status) = attn_data.irq_status; + rmi_dev->xport->attn_data = attn_data.data; + rmi_dev->xport->attn_size = attn_data.size; + } ret = rmi_process_interrupt_requests(rmi_dev); if (ret) rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Failed to process interrupt request: %d\n", ret); + if (count) + kfree(attn_data.data); + + if (!kfifo_is_empty(&drvdata->attn_fifo)) + return rmi_irq_fn(irq, dev_id); + return IRQ_HANDLED; } @@ -880,8 +917,9 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake) { struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); + struct rmi4_attn_data attn_data = {0}; int irq = pdata->irq; - int retval; + int retval, count; mutex_lock(&data->enabled_mutex); @@ -898,6 +936,13 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake) retval); } + /* make sure the fifo is clean */ + while (!kfifo_is_empty(&data->attn_fifo)) { + count = kfifo_get(&data->attn_fifo, &attn_data); + if (count) + kfree(attn_data.data); + } + out: mutex_unlock(&data->enabled_mutex); } diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 7780e40a2573..1d4865621493 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -331,6 +332,12 @@ struct rmi_device { }; +struct rmi4_attn_data { + unsigned long irq_status; + size_t size; + void *data; +}; + struct rmi_driver_data { struct list_head function_list; @@ -357,11 +364,15 @@ struct rmi_driver_data { bool enabled; struct mutex enabled_mutex; + DECLARE_KFIFO(attn_fifo, struct rmi4_attn_data, 16); }; int rmi_register_transport_device(struct rmi_transport_dev *xport); void rmi_unregister_transport_device(struct rmi_transport_dev *xport); +void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status, + void *data, size_t size); + int rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake); int rmi_driver_resume(struct rmi_device *rmi_dev, bool clear_wake); #endif From ae9979c31007d5366b73640ee7dcbb271357053e Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Fri, 2 Dec 2016 17:49:10 -0800 Subject: [PATCH 589/591] Input: synaptics-rmi4 - store the attn data in the driver Now that we have a proper API to set the attention data, there is no point in keeping it in the transport driver. Signed-off-by: Benjamin Tissoires Reviewed-by: Andrew Duggan Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_driver.c | 5 ++-- drivers/input/rmi4/rmi_f03.c | 13 +++++----- drivers/input/rmi4/rmi_f11.c | 12 ++++----- drivers/input/rmi4/rmi_f12.c | 43 +++++++++++++++++---------------- drivers/input/rmi4/rmi_f30.c | 11 +++++---- include/linux/rmi.h | 5 ++-- 6 files changed, 45 insertions(+), 44 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 85062e414e73..05a3c4bc9778 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -155,7 +155,7 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) if (!data) return 0; - if (!rmi_dev->xport->attn_data) { + if (!data->attn_data.data) { error = rmi_read_block(rmi_dev, data->f01_container->fd.data_base_addr + 1, data->irq_status, data->num_of_irq_regs); @@ -223,8 +223,7 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id) count = kfifo_get(&drvdata->attn_fifo, &attn_data); if (count) { *(drvdata->irq_status) = attn_data.irq_status; - rmi_dev->xport->attn_data = attn_data.data; - rmi_dev->xport->attn_size = attn_data.size; + drvdata->attn_data = attn_data; } ret = rmi_process_interrupt_requests(rmi_dev); diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c index 7a3ec0ed0c27..8a7ca3e2f95e 100644 --- a/drivers/input/rmi4/rmi_f03.c +++ b/drivers/input/rmi4/rmi_f03.c @@ -164,6 +164,7 @@ static int rmi_f03_config(struct rmi_function *fn) static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits) { struct rmi_device *rmi_dev = fn->rmi_dev; + struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); struct f03_data *f03 = dev_get_drvdata(&fn->dev); u16 data_addr = fn->fd.data_base_addr; const u8 ob_len = f03->rx_queue_length * RMI_F03_OB_SIZE; @@ -174,20 +175,20 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits) int i; int error; - if (!rmi_dev || !rmi_dev->xport) + if (!rmi_dev) return -ENODEV; - if (rmi_dev->xport->attn_data) { + if (drvdata->attn_data.data) { /* First grab the data passed by the transport device */ - if (rmi_dev->xport->attn_size < ob_len) { + if (drvdata->attn_data.size < ob_len) { dev_warn(&fn->dev, "F03 interrupted, but data is missing!\n"); return 0; } - memcpy(obs, rmi_dev->xport->attn_data, ob_len); + memcpy(obs, drvdata->attn_data.data, ob_len); - rmi_dev->xport->attn_data += ob_len; - rmi_dev->xport->attn_size -= ob_len; + drvdata->attn_data.data += ob_len; + drvdata->attn_data.size -= ob_len; } else { /* Grab all of the data registers, and check them for data */ error = rmi_read_block(fn->rmi_dev, data_addr + RMI_F03_OB_OFFSET, diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c index ffcbbc1745de..68279f3c5130 100644 --- a/drivers/input/rmi4/rmi_f11.c +++ b/drivers/input/rmi4/rmi_f11.c @@ -1285,19 +1285,19 @@ static int rmi_f11_attention(struct rmi_function *fn, unsigned long *irq_bits) int error; int valid_bytes = f11->sensor.pkt_size; - if (rmi_dev->xport->attn_data) { + if (drvdata->attn_data.data) { /* * The valid data in the attention report is less then * expected. Only process the complete fingers. */ - if (f11->sensor.attn_size > rmi_dev->xport->attn_size) - valid_bytes = rmi_dev->xport->attn_size; + if (f11->sensor.attn_size > drvdata->attn_data.size) + valid_bytes = drvdata->attn_data.size; else valid_bytes = f11->sensor.attn_size; - memcpy(f11->sensor.data_pkt, rmi_dev->xport->attn_data, + memcpy(f11->sensor.data_pkt, drvdata->attn_data.data, valid_bytes); - rmi_dev->xport->attn_data += f11->sensor.attn_size; - rmi_dev->xport->attn_size -= f11->sensor.attn_size; + drvdata->attn_data.data += f11->sensor.attn_size; + drvdata->attn_data.size -= f11->sensor.attn_size; } else { error = rmi_read_block(rmi_dev, data_base_addr, f11->sensor.data_pkt, diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index 82a4964e5eb9..8c5360c25266 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -208,19 +208,20 @@ static int rmi_f12_attention(struct rmi_function *fn, { int retval; struct rmi_device *rmi_dev = fn->rmi_dev; + struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); struct f12_data *f12 = dev_get_drvdata(&fn->dev); struct rmi_2d_sensor *sensor = &f12->sensor; int valid_bytes = sensor->pkt_size; - if (rmi_dev->xport->attn_data) { - if (sensor->attn_size > rmi_dev->xport->attn_size) - valid_bytes = rmi_dev->xport->attn_size; + if (drvdata->attn_data.data) { + if (sensor->attn_size > drvdata->attn_data.size) + valid_bytes = drvdata->attn_data.size; else valid_bytes = sensor->attn_size; - memcpy(sensor->data_pkt, rmi_dev->xport->attn_data, + memcpy(sensor->data_pkt, drvdata->attn_data.data, valid_bytes); - rmi_dev->xport->attn_data += sensor->attn_size; - rmi_dev->xport->attn_size -= sensor->attn_size; + drvdata->attn_data.data += sensor->attn_size; + drvdata->attn_data.size -= sensor->attn_size; } else { retval = rmi_read_block(rmi_dev, f12->data_addr, sensor->data_pkt, sensor->pkt_size); @@ -323,7 +324,7 @@ static int rmi_f12_probe(struct rmi_function *fn) const struct rmi_register_desc_item *item; struct rmi_2d_sensor *sensor; struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev); - struct rmi_transport_dev *xport = rmi_dev->xport; + struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); u16 data_offset = 0; rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s\n", __func__); @@ -422,7 +423,7 @@ static int rmi_f12_probe(struct rmi_function *fn) * HID attention reports. */ item = rmi_get_register_desc_item(&f12->data_reg_desc, 0); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 1); @@ -436,15 +437,15 @@ static int rmi_f12_probe(struct rmi_function *fn) } item = rmi_get_register_desc_item(&f12->data_reg_desc, 2); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 3); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 4); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 5); @@ -456,22 +457,22 @@ static int rmi_f12_probe(struct rmi_function *fn) } item = rmi_get_register_desc_item(&f12->data_reg_desc, 6); - if (item && !xport->attn_data) { + if (item && !drvdata->attn_data.data) { f12->data6 = item; f12->data6_offset = data_offset; data_offset += item->reg_size; } item = rmi_get_register_desc_item(&f12->data_reg_desc, 7); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 8); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 9); - if (item && !xport->attn_data) { + if (item && !drvdata->attn_data.data) { f12->data9 = item; f12->data9_offset = data_offset; data_offset += item->reg_size; @@ -480,27 +481,27 @@ static int rmi_f12_probe(struct rmi_function *fn) } item = rmi_get_register_desc_item(&f12->data_reg_desc, 10); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 11); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 12); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 13); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 14); - if (item && !xport->attn_data) + if (item && !drvdata->attn_data.data) data_offset += item->reg_size; item = rmi_get_register_desc_item(&f12->data_reg_desc, 15); - if (item && !xport->attn_data) { + if (item && !drvdata->attn_data.data) { f12->data15 = item; f12->data15_offset = data_offset; data_offset += item->reg_size; diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c index f696137a56f5..f4b491e3e0fd 100644 --- a/drivers/input/rmi4/rmi_f30.c +++ b/drivers/input/rmi4/rmi_f30.c @@ -99,6 +99,7 @@ static int rmi_f30_attention(struct rmi_function *fn, unsigned long *irq_bits) { struct f30_data *f30 = dev_get_drvdata(&fn->dev); struct rmi_device *rmi_dev = fn->rmi_dev; + struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); int retval; int gpiled = 0; int value = 0; @@ -109,15 +110,15 @@ static int rmi_f30_attention(struct rmi_function *fn, unsigned long *irq_bits) return 0; /* Read the gpi led data. */ - if (rmi_dev->xport->attn_data) { - if (rmi_dev->xport->attn_size < f30->register_count) { + if (drvdata->attn_data.data) { + if (drvdata->attn_data.size < f30->register_count) { dev_warn(&fn->dev, "F30 interrupted, but data is missing\n"); return 0; } - memcpy(f30->data_regs, rmi_dev->xport->attn_data, + memcpy(f30->data_regs, drvdata->attn_data.data, f30->register_count); - rmi_dev->xport->attn_data += f30->register_count; - rmi_dev->xport->attn_size -= f30->register_count; + drvdata->attn_data.data += f30->register_count; + drvdata->attn_data.size -= f30->register_count; } else { retval = rmi_read_block(rmi_dev, fn->fd.data_base_addr, f30->data_regs, f30->register_count); diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 1d4865621493..ac910f730688 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -272,9 +272,6 @@ struct rmi_transport_dev { struct rmi_device_platform_data pdata; struct input_dev *input; - - void *attn_data; - int attn_size; }; /** @@ -364,6 +361,8 @@ struct rmi_driver_data { bool enabled; struct mutex enabled_mutex; + + struct rmi4_attn_data attn_data; DECLARE_KFIFO(attn_fifo, struct rmi4_attn_data, 16); }; From 5d244f7effafeaa5272ca5daa37d8b7bb17967a8 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 7 Dec 2016 17:20:06 -0800 Subject: [PATCH 590/591] Input: synaptics-rmi4 - fix debug for sensor clip The debug would only ever output zero for the clip information. Signed-off-by: Nick Dyer Reviewed-by: Andrew Duggan Tested-by: Chris Healy Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_f12.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c index 8c5360c25266..07aff4356fe0 100644 --- a/drivers/input/rmi4/rmi_f12.c +++ b/drivers/input/rmi4/rmi_f12.c @@ -71,10 +71,6 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12) u8 buf[15]; int pitch_x = 0; int pitch_y = 0; - int clip_x_low = 0; - int clip_x_high = 0; - int clip_y_low = 0; - int clip_y_high = 0; int rx_receivers = 0; int tx_receivers = 0; int sensor_flags = 0; @@ -127,7 +123,9 @@ static int rmi_f12_read_sensor_tuning(struct f12_data *f12) } rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: x low: %d x high: %d y low: %d y high: %d\n", - __func__, clip_x_low, clip_x_high, clip_y_low, clip_y_high); + __func__, + sensor->axis_align.clip_x_low, sensor->axis_align.clip_x_high, + sensor->axis_align.clip_y_low, sensor->axis_align.clip_y_high); if (rmi_register_desc_has_subpacket(item, 3)) { rx_receivers = buf[offset]; From 5191d88acc688743eef56f1c598a4e4cddf6c6cd Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 10 Dec 2016 23:27:32 -0800 Subject: [PATCH 591/591] Input: synaptics-rmi4 - add support for F34 V7 bootloader Port firmware update code from Samsung Galaxy S7 driver into mainline framework. This patch has been tested on Synaptics S7813. Signed-off-by: Nick Dyer Tested-by: Chris Healy Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/Makefile | 2 +- drivers/input/rmi4/rmi_driver.c | 56 +- drivers/input/rmi4/rmi_f34.c | 40 +- drivers/input/rmi4/rmi_f34.h | 250 +++++- drivers/input/rmi4/rmi_f34v7.c | 1372 +++++++++++++++++++++++++++++++ include/linux/rmi.h | 2 +- 6 files changed, 1688 insertions(+), 34 deletions(-) create mode 100644 drivers/input/rmi4/rmi_f34v7.c diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile index a199cbe9c27d..9aaac3dd8613 100644 --- a/drivers/input/rmi4/Makefile +++ b/drivers/input/rmi4/Makefile @@ -8,7 +8,7 @@ rmi_core-$(CONFIG_RMI4_F03) += rmi_f03.o rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o -rmi_core-$(CONFIG_RMI4_F34) += rmi_f34.o +rmi_core-$(CONFIG_RMI4_F34) += rmi_f34.o rmi_f34v7.o rmi_core-$(CONFIG_RMI4_F54) += rmi_f54.o rmi_core-$(CONFIG_RMI4_F55) += rmi_f55.o diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 05a3c4bc9778..cb6efe693302 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -544,7 +544,7 @@ static int rmi_scan_pdt_page(struct rmi_device *rmi_dev, else *empty_pages = 0; - return (data->f01_bootloader_mode || *empty_pages >= 2) ? + return (data->bootloader_mode || *empty_pages >= 2) ? RMI_SCAN_DONE : RMI_SCAN_CONTINUE; } @@ -749,41 +749,49 @@ bool rmi_register_desc_has_subpacket(const struct rmi_register_desc_item *item, subpacket) == subpacket; } -/* Indicates that flash programming is enabled (bootloader mode). */ -#define RMI_F01_STATUS_BOOTLOADER(status) (!!((status) & 0x40)) - -/* - * Given the PDT entry for F01, read the device status register to determine - * if we're stuck in bootloader mode or not. - * - */ static int rmi_check_bootloader_mode(struct rmi_device *rmi_dev, const struct pdt_entry *pdt) { - int error; - u8 device_status; + struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); + int ret; + u8 status; - error = rmi_read(rmi_dev, pdt->data_base_addr + pdt->page_start, - &device_status); - if (error) { - dev_err(&rmi_dev->dev, - "Failed to read device status: %d.\n", error); - return error; + if (pdt->function_number == 0x34 && pdt->function_version > 1) { + ret = rmi_read(rmi_dev, pdt->data_base_addr, &status); + if (ret) { + dev_err(&rmi_dev->dev, + "Failed to read F34 status: %d.\n", ret); + return ret; + } + + if (status & BIT(7)) + data->bootloader_mode = true; + } else if (pdt->function_number == 0x01) { + ret = rmi_read(rmi_dev, pdt->data_base_addr, &status); + if (ret) { + dev_err(&rmi_dev->dev, + "Failed to read F01 status: %d.\n", ret); + return ret; + } + + if (status & BIT(6)) + data->bootloader_mode = true; } - return RMI_F01_STATUS_BOOTLOADER(device_status); + return 0; } static int rmi_count_irqs(struct rmi_device *rmi_dev, void *ctx, const struct pdt_entry *pdt) { - struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); int *irq_count = ctx; + int ret; *irq_count += pdt->interrupt_source_count; - if (pdt->function_number == 0x01) - data->f01_bootloader_mode = - rmi_check_bootloader_mode(rmi_dev, pdt); + + ret = rmi_check_bootloader_mode(rmi_dev, pdt); + if (ret < 0) + return ret; return RMI_SCAN_CONTINUE; } @@ -1024,13 +1032,15 @@ int rmi_probe_interrupts(struct rmi_driver_data *data) */ rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Counting IRQs.\n", __func__); irq_count = 0; + data->bootloader_mode = false; + retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_count_irqs); if (retval < 0) { dev_err(dev, "IRQ counting failed with code %d.\n", retval); return retval; } - if (data->f01_bootloader_mode) + if (data->bootloader_mode) dev_warn(&rmi_dev->dev, "Device in bootloader mode.\n"); data->irq_count = irq_count; diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c index 01936a4a9a6c..9774dfbab9bb 100644 --- a/drivers/input/rmi4/rmi_f34.c +++ b/drivers/input/rmi4/rmi_f34.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "rmi_driver.h" #include "rmi_f34.h" @@ -105,6 +106,9 @@ static int rmi_f34_attention(struct rmi_function *fn, unsigned long *irq_bits) struct f34_data *f34 = dev_get_drvdata(&fn->dev); int ret; + if (f34->bl_version != 5) + return 0; + ret = rmi_read(f34->fn->rmi_dev, f34->v5.ctrl_address, &f34->v5.status); rmi_dbg(RMI_DEBUG_FN, &fn->dev, "%s: status: %#02x, ret: %d\n", __func__, f34->v5.status, ret); @@ -292,17 +296,24 @@ static int rmi_firmware_update(struct rmi_driver_data *data, return -EINVAL; } - /* Only version 0 currently supported */ - if (data->f34_container->fd.function_version != 0) { + f34 = dev_get_drvdata(&data->f34_container->dev); + + if (f34->bl_version == 7) { + if (data->pdt_props & HAS_BSR) { + dev_err(dev, "%s: LTS not supported\n", __func__); + return -ENODEV; + } + } else if (f34->bl_version != 5) { dev_warn(dev, "F34 V%d not supported!\n", data->f34_container->fd.function_version); return -ENODEV; } - f34 = dev_get_drvdata(&data->f34_container->dev); - /* Enter flash mode */ - ret = rmi_f34_enable_flash(f34); + if (f34->bl_version == 7) + ret = rmi_f34v7_start_reflash(f34, fw); + else + ret = rmi_f34_enable_flash(f34); if (ret) return ret; @@ -319,7 +330,7 @@ static int rmi_firmware_update(struct rmi_driver_data *data, if (ret) return ret; - if (!data->f01_bootloader_mode || !data->f34_container) { + if (!data->bootloader_mode || !data->f34_container) { dev_warn(dev, "%s: No F34 present or not in bootloader!\n", __func__); return -EINVAL; @@ -330,7 +341,10 @@ static int rmi_firmware_update(struct rmi_driver_data *data, f34 = dev_get_drvdata(&data->f34_container->dev); /* Perform firmware update */ - ret = rmi_f34_update_firmware(f34, fw); + if (f34->bl_version == 7) + ret = rmi_f34v7_do_reflash(f34, fw); + else + ret = rmi_f34_update_firmware(f34, fw); dev_info(&f34->fn->dev, "Firmware update complete, status:%d\n", ret); @@ -363,6 +377,9 @@ static int rmi_firmware_update(struct rmi_driver_data *data, return ret; } +static int rmi_firmware_update(struct rmi_driver_data *data, + const struct firmware *fw); + static ssize_t rmi_driver_update_fw_store(struct device *dev, struct device_attribute *dattr, const char *buf, size_t count) @@ -411,6 +428,7 @@ static int rmi_f34_probe(struct rmi_function *fn) struct f34_data *f34; unsigned char f34_queries[9]; bool has_config_id; + u8 version = fn->fd.function_version; int ret; f34 = devm_kzalloc(&fn->dev, sizeof(struct f34_data), GFP_KERNEL); @@ -420,6 +438,14 @@ static int rmi_f34_probe(struct rmi_function *fn) f34->fn = fn; dev_set_drvdata(&fn->dev, f34); + /* v5 code only supported version 0, try V7 probe */ + if (version > 0) + return rmi_f34v7_probe(f34); + else if (version != 0) + return -ENODEV; + + f34->bl_version = 5; + ret = rmi_read_block(fn->rmi_dev, fn->fd.query_base_addr, f34_queries, sizeof(f34_queries)); if (ret) { diff --git a/drivers/input/rmi4/rmi_f34.h b/drivers/input/rmi4/rmi_f34.h index 6cee5282fbb4..2c21056dc375 100644 --- a/drivers/input/rmi4/rmi_f34.h +++ b/drivers/input/rmi4/rmi_f34.h @@ -33,6 +33,216 @@ #define F34_BOOTLOADER_ID_LEN 2 +/* F34 V7 defines */ +#define V7_FLASH_STATUS_OFFSET 0 +#define V7_PARTITION_ID_OFFSET 1 +#define V7_BLOCK_NUMBER_OFFSET 2 +#define V7_TRANSFER_LENGTH_OFFSET 3 +#define V7_COMMAND_OFFSET 4 +#define V7_PAYLOAD_OFFSET 5 +#define V7_BOOTLOADER_ID_OFFSET 1 + +#define IMAGE_HEADER_VERSION_10 0x10 + +#define CONFIG_ID_SIZE 32 +#define PRODUCT_ID_SIZE 10 + +#define ENABLE_WAIT_MS (1 * 1000) +#define WRITE_WAIT_MS (3 * 1000) + +#define MIN_SLEEP_TIME_US 50 +#define MAX_SLEEP_TIME_US 100 + +#define HAS_BSR BIT(5) +#define HAS_CONFIG_ID BIT(3) +#define HAS_GUEST_CODE BIT(6) +#define HAS_DISP_CFG BIT(5) + +/* F34 V7 commands */ +#define CMD_V7_IDLE 0 +#define CMD_V7_ENTER_BL 1 +#define CMD_V7_READ 2 +#define CMD_V7_WRITE 3 +#define CMD_V7_ERASE 4 +#define CMD_V7_ERASE_AP 5 +#define CMD_V7_SENSOR_ID 6 + +#define v7_CMD_IDLE 0 +#define v7_CMD_WRITE_FW 1 +#define v7_CMD_WRITE_CONFIG 2 +#define v7_CMD_WRITE_LOCKDOWN 3 +#define v7_CMD_WRITE_GUEST_CODE 4 +#define v7_CMD_READ_CONFIG 5 +#define v7_CMD_ERASE_ALL 6 +#define v7_CMD_ERASE_UI_FIRMWARE 7 +#define v7_CMD_ERASE_UI_CONFIG 8 +#define v7_CMD_ERASE_BL_CONFIG 9 +#define v7_CMD_ERASE_DISP_CONFIG 10 +#define v7_CMD_ERASE_FLASH_CONFIG 11 +#define v7_CMD_ERASE_GUEST_CODE 12 +#define v7_CMD_ENABLE_FLASH_PROG 13 + +#define v7_UI_CONFIG_AREA 0 +#define v7_PM_CONFIG_AREA 1 +#define v7_BL_CONFIG_AREA 2 +#define v7_DP_CONFIG_AREA 3 +#define v7_FLASH_CONFIG_AREA 4 + +/* F34 V7 partition IDs */ +#define BOOTLOADER_PARTITION 1 +#define DEVICE_CONFIG_PARTITION 2 +#define FLASH_CONFIG_PARTITION 3 +#define MANUFACTURING_BLOCK_PARTITION 4 +#define GUEST_SERIALIZATION_PARTITION 5 +#define GLOBAL_PARAMETERS_PARTITION 6 +#define CORE_CODE_PARTITION 7 +#define CORE_CONFIG_PARTITION 8 +#define GUEST_CODE_PARTITION 9 +#define DISPLAY_CONFIG_PARTITION 10 + +/* F34 V7 container IDs */ +#define TOP_LEVEL_CONTAINER 0 +#define UI_CONTAINER 1 +#define UI_CONFIG_CONTAINER 2 +#define BL_CONTAINER 3 +#define BL_IMAGE_CONTAINER 4 +#define BL_CONFIG_CONTAINER 5 +#define BL_LOCKDOWN_INFO_CONTAINER 6 +#define PERMANENT_CONFIG_CONTAINER 7 +#define GUEST_CODE_CONTAINER 8 +#define BL_PROTOCOL_DESCRIPTOR_CONTAINER 9 +#define UI_PROTOCOL_DESCRIPTOR_CONTAINER 10 +#define RMI_SELF_DISCOVERY_CONTAINER 11 +#define RMI_PAGE_CONTENT_CONTAINER 12 +#define GENERAL_INFORMATION_CONTAINER 13 +#define DEVICE_CONFIG_CONTAINER 14 +#define FLASH_CONFIG_CONTAINER 15 +#define GUEST_SERIALIZATION_CONTAINER 16 +#define GLOBAL_PARAMETERS_CONTAINER 17 +#define CORE_CODE_CONTAINER 18 +#define CORE_CONFIG_CONTAINER 19 +#define DISPLAY_CONFIG_CONTAINER 20 + +struct f34v7_query_1_7 { + u8 bl_minor_revision; /* query 1 */ + u8 bl_major_revision; + __le32 bl_fw_id; /* query 2 */ + u8 minimum_write_size; /* query 3 */ + __le16 block_size; + __le16 flash_page_size; + __le16 adjustable_partition_area_size; /* query 4 */ + __le16 flash_config_length; /* query 5 */ + __le16 payload_length; /* query 6 */ + u8 partition_support[4]; /* query 7 */ +} __packed; + +struct f34v7_data_1_5 { + u8 partition_id; + __le16 block_offset; + __le16 transfer_length; + u8 command; + u8 payload[2]; +} __packed; + +struct block_data { + const void *data; + int size; +}; + +struct partition_table { + u8 partition_id; + u8 byte_1_reserved; + __le16 partition_length; + __le16 start_physical_address; + __le16 partition_properties; +} __packed; + +struct physical_address { + u16 ui_firmware; + u16 ui_config; + u16 dp_config; + u16 guest_code; +}; + +struct container_descriptor { + __le32 content_checksum; + __le16 container_id; + u8 minor_version; + u8 major_version; + u8 reserved_08; + u8 reserved_09; + u8 reserved_0a; + u8 reserved_0b; + u8 container_option_flags[4]; + __le32 content_options_length; + __le32 content_options_address; + __le32 content_length; + __le32 content_address; +} __packed; + +struct block_count { + u16 ui_firmware; + u16 ui_config; + u16 dp_config; + u16 fl_config; + u16 pm_config; + u16 bl_config; + u16 lockdown; + u16 guest_code; +}; + +struct image_header_10 { + __le32 checksum; + u8 reserved_04; + u8 reserved_05; + u8 minor_header_version; + u8 major_header_version; + u8 reserved_08; + u8 reserved_09; + u8 reserved_0a; + u8 reserved_0b; + __le32 top_level_container_start_addr; +}; + +struct image_metadata { + bool contains_firmware_id; + bool contains_bootloader; + bool contains_display_cfg; + bool contains_guest_code; + bool contains_flash_config; + unsigned int firmware_id; + unsigned int checksum; + unsigned int bootloader_size; + unsigned int display_cfg_offset; + unsigned char bl_version; + unsigned char product_id[PRODUCT_ID_SIZE + 1]; + unsigned char cstmr_product_id[PRODUCT_ID_SIZE + 1]; + struct block_data bootloader; + struct block_data ui_firmware; + struct block_data ui_config; + struct block_data dp_config; + struct block_data fl_config; + struct block_data bl_config; + struct block_data guest_code; + struct block_data lockdown; + struct block_count blkcount; + struct physical_address phyaddr; +}; + +struct register_offset { + u8 properties; + u8 properties_2; + u8 block_size; + u8 block_count; + u8 gc_block_count; + u8 flash_status; + u8 partition_id; + u8 block_number; + u8 transfer_length; + u8 flash_cmd; + u8 payload; +}; + struct rmi_f34_firmware { __le32 checksum; u8 pad1[3]; @@ -56,13 +266,49 @@ struct f34v5_data { struct mutex flash_mutex; }; +struct f34v7_data { + bool has_display_cfg; + bool has_guest_code; + bool force_update; + bool in_bl_mode; + u8 *read_config_buf; + size_t read_config_buf_size; + u8 command; + u8 flash_status; + u16 block_size; + u16 config_block_count; + u16 config_size; + u16 config_area; + u16 flash_config_length; + u16 payload_length; + u8 partitions; + u16 partition_table_bytes; + bool new_partition_table; + + struct register_offset off; + struct block_count blkcount; + struct physical_address phyaddr; + struct image_metadata img; + + const void *config_data; + const void *image; +}; + struct f34_data { struct rmi_function *fn; + u8 bl_version; unsigned char bootloader_id[5]; - unsigned char configuration_id[9]; + unsigned char configuration_id[CONFIG_ID_SIZE*2 + 1]; - struct f34v5_data v5; + union { + struct f34v5_data v5; + struct f34v7_data v7; + }; }; +int rmi_f34v7_start_reflash(struct f34_data *f34, const struct firmware *fw); +int rmi_f34v7_do_reflash(struct f34_data *f34, const struct firmware *fw); +int rmi_f34v7_probe(struct f34_data *f34); + #endif /* _RMI_F34_H */ diff --git a/drivers/input/rmi4/rmi_f34v7.c b/drivers/input/rmi4/rmi_f34v7.c new file mode 100644 index 000000000000..ca31f9539d9b --- /dev/null +++ b/drivers/input/rmi4/rmi_f34v7.c @@ -0,0 +1,1372 @@ +/* + * Copyright (c) 2016, Zodiac Inflight Innovations + * Copyright (c) 2007-2016, Synaptics Incorporated + * Copyright (C) 2012 Alexandra Chin + * Copyright (C) 2012 Scott Lin + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include + +#include "rmi_driver.h" +#include "rmi_f34.h" + +static int rmi_f34v7_read_flash_status(struct f34_data *f34) +{ + u8 status; + u8 command; + int ret; + + ret = rmi_read_block(f34->fn->rmi_dev, + f34->fn->fd.data_base_addr + f34->v7.off.flash_status, + &status, + sizeof(status)); + if (ret < 0) { + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Failed to read flash status\n", __func__); + return ret; + } + + f34->v7.in_bl_mode = status >> 7; + f34->v7.flash_status = status & 0x1f; + + if (f34->v7.flash_status != 0x00) { + dev_err(&f34->fn->dev, "%s: status=%d, command=0x%02x\n", + __func__, f34->v7.flash_status, f34->v7.command); + } + + ret = rmi_read_block(f34->fn->rmi_dev, + f34->fn->fd.data_base_addr + f34->v7.off.flash_cmd, + &command, + sizeof(command)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to read flash command\n", + __func__); + return ret; + } + + f34->v7.command = command; + + return 0; +} + +static int rmi_f34v7_wait_for_idle(struct f34_data *f34, int timeout_ms) +{ + int count = 0; + int timeout_count = ((timeout_ms * 1000) / MAX_SLEEP_TIME_US) + 1; + + do { + usleep_range(MIN_SLEEP_TIME_US, MAX_SLEEP_TIME_US); + + count++; + + rmi_f34v7_read_flash_status(f34); + + if ((f34->v7.command == v7_CMD_IDLE) + && (f34->v7.flash_status == 0x00)) { + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "Idle status detected\n"); + return 0; + } + } while (count < timeout_count); + + dev_err(&f34->fn->dev, + "%s: Timed out waiting for idle status\n", __func__); + + return -ETIMEDOUT; +} + +static int rmi_f34v7_write_command_single_transaction(struct f34_data *f34, + u8 cmd) +{ + int ret; + u8 base; + struct f34v7_data_1_5 data_1_5; + + base = f34->fn->fd.data_base_addr; + + memset(&data_1_5, 0, sizeof(data_1_5)); + + switch (cmd) { + case v7_CMD_ERASE_ALL: + data_1_5.partition_id = CORE_CODE_PARTITION; + data_1_5.command = CMD_V7_ERASE_AP; + break; + case v7_CMD_ERASE_UI_FIRMWARE: + data_1_5.partition_id = CORE_CODE_PARTITION; + data_1_5.command = CMD_V7_ERASE; + break; + case v7_CMD_ERASE_BL_CONFIG: + data_1_5.partition_id = GLOBAL_PARAMETERS_PARTITION; + data_1_5.command = CMD_V7_ERASE; + break; + case v7_CMD_ERASE_UI_CONFIG: + data_1_5.partition_id = CORE_CONFIG_PARTITION; + data_1_5.command = CMD_V7_ERASE; + break; + case v7_CMD_ERASE_DISP_CONFIG: + data_1_5.partition_id = DISPLAY_CONFIG_PARTITION; + data_1_5.command = CMD_V7_ERASE; + break; + case v7_CMD_ERASE_FLASH_CONFIG: + data_1_5.partition_id = FLASH_CONFIG_PARTITION; + data_1_5.command = CMD_V7_ERASE; + break; + case v7_CMD_ERASE_GUEST_CODE: + data_1_5.partition_id = GUEST_CODE_PARTITION; + data_1_5.command = CMD_V7_ERASE; + break; + case v7_CMD_ENABLE_FLASH_PROG: + data_1_5.partition_id = BOOTLOADER_PARTITION; + data_1_5.command = CMD_V7_ENTER_BL; + break; + } + + data_1_5.payload[0] = f34->bootloader_id[0]; + data_1_5.payload[1] = f34->bootloader_id[1]; + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.partition_id, + &data_1_5, sizeof(data_1_5)); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Failed to write single transaction command\n", + __func__); + return ret; + } + + return 0; +} + +static int rmi_f34v7_write_command(struct f34_data *f34, u8 cmd) +{ + int ret; + u8 base; + u8 command; + + base = f34->fn->fd.data_base_addr; + + switch (cmd) { + case v7_CMD_WRITE_FW: + case v7_CMD_WRITE_CONFIG: + case v7_CMD_WRITE_GUEST_CODE: + command = CMD_V7_WRITE; + break; + case v7_CMD_READ_CONFIG: + command = CMD_V7_READ; + break; + case v7_CMD_ERASE_ALL: + command = CMD_V7_ERASE_AP; + break; + case v7_CMD_ERASE_UI_FIRMWARE: + case v7_CMD_ERASE_BL_CONFIG: + case v7_CMD_ERASE_UI_CONFIG: + case v7_CMD_ERASE_DISP_CONFIG: + case v7_CMD_ERASE_FLASH_CONFIG: + case v7_CMD_ERASE_GUEST_CODE: + command = CMD_V7_ERASE; + break; + case v7_CMD_ENABLE_FLASH_PROG: + command = CMD_V7_ENTER_BL; + break; + default: + dev_err(&f34->fn->dev, "%s: Invalid command 0x%02x\n", + __func__, cmd); + return -EINVAL; + } + + f34->v7.command = command; + + switch (cmd) { + case v7_CMD_ERASE_ALL: + case v7_CMD_ERASE_UI_FIRMWARE: + case v7_CMD_ERASE_BL_CONFIG: + case v7_CMD_ERASE_UI_CONFIG: + case v7_CMD_ERASE_DISP_CONFIG: + case v7_CMD_ERASE_FLASH_CONFIG: + case v7_CMD_ERASE_GUEST_CODE: + case v7_CMD_ENABLE_FLASH_PROG: + ret = rmi_f34v7_write_command_single_transaction(f34, cmd); + if (ret < 0) + return ret; + else + return 0; + default: + break; + } + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: writing cmd %02X\n", + __func__, command); + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.flash_cmd, + &command, sizeof(command)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to write flash command\n", + __func__); + return ret; + } + + return 0; +} + +static int rmi_f34v7_write_partition_id(struct f34_data *f34, u8 cmd) +{ + int ret; + u8 base; + u8 partition; + + base = f34->fn->fd.data_base_addr; + + switch (cmd) { + case v7_CMD_WRITE_FW: + partition = CORE_CODE_PARTITION; + break; + case v7_CMD_WRITE_CONFIG: + case v7_CMD_READ_CONFIG: + if (f34->v7.config_area == v7_UI_CONFIG_AREA) + partition = CORE_CONFIG_PARTITION; + else if (f34->v7.config_area == v7_DP_CONFIG_AREA) + partition = DISPLAY_CONFIG_PARTITION; + else if (f34->v7.config_area == v7_PM_CONFIG_AREA) + partition = GUEST_SERIALIZATION_PARTITION; + else if (f34->v7.config_area == v7_BL_CONFIG_AREA) + partition = GLOBAL_PARAMETERS_PARTITION; + else if (f34->v7.config_area == v7_FLASH_CONFIG_AREA) + partition = FLASH_CONFIG_PARTITION; + break; + case v7_CMD_WRITE_GUEST_CODE: + partition = GUEST_CODE_PARTITION; + break; + case v7_CMD_ERASE_ALL: + partition = CORE_CODE_PARTITION; + break; + case v7_CMD_ERASE_BL_CONFIG: + partition = GLOBAL_PARAMETERS_PARTITION; + break; + case v7_CMD_ERASE_UI_CONFIG: + partition = CORE_CONFIG_PARTITION; + break; + case v7_CMD_ERASE_DISP_CONFIG: + partition = DISPLAY_CONFIG_PARTITION; + break; + case v7_CMD_ERASE_FLASH_CONFIG: + partition = FLASH_CONFIG_PARTITION; + break; + case v7_CMD_ERASE_GUEST_CODE: + partition = GUEST_CODE_PARTITION; + break; + case v7_CMD_ENABLE_FLASH_PROG: + partition = BOOTLOADER_PARTITION; + break; + default: + dev_err(&f34->fn->dev, "%s: Invalid command 0x%02x\n", + __func__, cmd); + return -EINVAL; + } + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.partition_id, + &partition, sizeof(partition)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to write partition ID\n", + __func__); + return ret; + } + + return 0; +} + +static int rmi_f34v7_read_f34v7_partition_table(struct f34_data *f34) +{ + int ret; + u8 base; + __le16 length; + u16 block_number = 0; + + base = f34->fn->fd.data_base_addr; + + f34->v7.config_area = v7_FLASH_CONFIG_AREA; + + ret = rmi_f34v7_write_partition_id(f34, v7_CMD_READ_CONFIG); + if (ret < 0) + return ret; + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.block_number, + &block_number, sizeof(block_number)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to write block number\n", + __func__); + return ret; + } + + put_unaligned_le16(f34->v7.flash_config_length, &length); + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.transfer_length, + &length, sizeof(length)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to write transfer length\n", + __func__); + return ret; + } + + ret = rmi_f34v7_write_command(f34, v7_CMD_READ_CONFIG); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to write command\n", + __func__); + return ret; + } + + ret = rmi_f34v7_wait_for_idle(f34, WRITE_WAIT_MS); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to wait for idle status\n", + __func__); + return ret; + } + + ret = rmi_read_block(f34->fn->rmi_dev, + base + f34->v7.off.payload, + f34->v7.read_config_buf, + f34->v7.partition_table_bytes); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to read block data\n", + __func__); + return ret; + } + + return 0; +} + +static void rmi_f34v7_parse_partition_table(struct f34_data *f34, + const void *partition_table, + struct block_count *blkcount, + struct physical_address *phyaddr) +{ + int i; + int index; + u16 partition_length; + u16 physical_address; + const struct partition_table *ptable; + + for (i = 0; i < f34->v7.partitions; i++) { + index = i * 8 + 2; + ptable = partition_table + index; + partition_length = le16_to_cpu(ptable->partition_length); + physical_address = le16_to_cpu(ptable->start_physical_address); + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Partition entry %d: %*ph\n", + __func__, i, sizeof(struct partition_table), ptable); + switch (ptable->partition_id & 0x1f) { + case CORE_CODE_PARTITION: + blkcount->ui_firmware = partition_length; + phyaddr->ui_firmware = physical_address; + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Core code block count: %d\n", + __func__, blkcount->ui_firmware); + break; + case CORE_CONFIG_PARTITION: + blkcount->ui_config = partition_length; + phyaddr->ui_config = physical_address; + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Core config block count: %d\n", + __func__, blkcount->ui_config); + break; + case DISPLAY_CONFIG_PARTITION: + blkcount->dp_config = partition_length; + phyaddr->dp_config = physical_address; + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Display config block count: %d\n", + __func__, blkcount->dp_config); + break; + case FLASH_CONFIG_PARTITION: + blkcount->fl_config = partition_length; + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Flash config block count: %d\n", + __func__, blkcount->fl_config); + break; + case GUEST_CODE_PARTITION: + blkcount->guest_code = partition_length; + phyaddr->guest_code = physical_address; + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Guest code block count: %d\n", + __func__, blkcount->guest_code); + break; + case GUEST_SERIALIZATION_PARTITION: + blkcount->pm_config = partition_length; + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Guest serialization block count: %d\n", + __func__, blkcount->pm_config); + break; + case GLOBAL_PARAMETERS_PARTITION: + blkcount->bl_config = partition_length; + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Global parameters block count: %d\n", + __func__, blkcount->bl_config); + break; + case DEVICE_CONFIG_PARTITION: + blkcount->lockdown = partition_length; + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Device config block count: %d\n", + __func__, blkcount->lockdown); + break; + } + } +} + +static int rmi_f34v7_read_queries_bl_version(struct f34_data *f34) +{ + int ret; + u8 base; + int offset; + u8 query_0; + struct f34v7_query_1_7 query_1_7; + + base = f34->fn->fd.query_base_addr; + + ret = rmi_read_block(f34->fn->rmi_dev, + base, + &query_0, + sizeof(query_0)); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Failed to read query 0\n", __func__); + return ret; + } + + offset = (query_0 & 0x7) + 1; + + ret = rmi_read_block(f34->fn->rmi_dev, + base + offset, + &query_1_7, + sizeof(query_1_7)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to read queries 1 to 7\n", + __func__); + return ret; + } + + f34->bootloader_id[0] = query_1_7.bl_minor_revision; + f34->bootloader_id[1] = query_1_7.bl_major_revision; + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "Bootloader V%d.%d\n", + f34->bootloader_id[1], f34->bootloader_id[0]); + + return 0; +} + +static int rmi_f34v7_read_queries(struct f34_data *f34) +{ + int ret; + int i, j; + u8 base; + int offset; + u8 *ptable; + u8 query_0; + struct f34v7_query_1_7 query_1_7; + + base = f34->fn->fd.query_base_addr; + + ret = rmi_read_block(f34->fn->rmi_dev, + base, + &query_0, + sizeof(query_0)); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Failed to read query 0\n", __func__); + return ret; + } + + offset = (query_0 & 0x07) + 1; + + ret = rmi_read_block(f34->fn->rmi_dev, + base + offset, + &query_1_7, + sizeof(query_1_7)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to read queries 1 to 7\n", + __func__); + return ret; + } + + f34->bootloader_id[0] = query_1_7.bl_minor_revision; + f34->bootloader_id[1] = query_1_7.bl_major_revision; + + f34->v7.block_size = le16_to_cpu(query_1_7.block_size); + f34->v7.flash_config_length = + le16_to_cpu(query_1_7.flash_config_length); + f34->v7.payload_length = le16_to_cpu(query_1_7.payload_length); + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: f34->v7.block_size = %d\n", + __func__, f34->v7.block_size); + + f34->v7.off.flash_status = V7_FLASH_STATUS_OFFSET; + f34->v7.off.partition_id = V7_PARTITION_ID_OFFSET; + f34->v7.off.block_number = V7_BLOCK_NUMBER_OFFSET; + f34->v7.off.transfer_length = V7_TRANSFER_LENGTH_OFFSET; + f34->v7.off.flash_cmd = V7_COMMAND_OFFSET; + f34->v7.off.payload = V7_PAYLOAD_OFFSET; + + f34->v7.has_display_cfg = query_1_7.partition_support[1] & HAS_DISP_CFG; + f34->v7.has_guest_code = + query_1_7.partition_support[1] & HAS_GUEST_CODE; + + if (query_0 & HAS_CONFIG_ID) { + char f34_ctrl[CONFIG_ID_SIZE]; + int i = 0; + u8 *p = f34->configuration_id; + *p = '\0'; + + ret = rmi_read_block(f34->fn->rmi_dev, + f34->fn->fd.control_base_addr, + f34_ctrl, + sizeof(f34_ctrl)); + if (ret) + return ret; + + /* Eat leading zeros */ + while (i < sizeof(f34_ctrl) && !f34_ctrl[i]) + i++; + + for (; i < sizeof(f34_ctrl); i++) + p += snprintf(p, f34->configuration_id + + sizeof(f34->configuration_id) - p, + "%02X", f34_ctrl[i]); + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "Configuration ID: %s\n", + f34->configuration_id); + } + + f34->v7.partitions = 0; + for (i = 0; i < sizeof(query_1_7.partition_support); i++) + for (j = 0; j < 8; j++) + if (query_1_7.partition_support[i] & (1 << j)) + f34->v7.partitions++; + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: Supported partitions: %*ph\n", + __func__, sizeof(query_1_7.partition_support), + query_1_7.partition_support); + + + f34->v7.partition_table_bytes = f34->v7.partitions * 8 + 2; + + f34->v7.read_config_buf = devm_kzalloc(&f34->fn->dev, + f34->v7.partition_table_bytes, + GFP_KERNEL); + if (!f34->v7.read_config_buf) { + f34->v7.read_config_buf_size = 0; + return -ENOMEM; + } + + f34->v7.read_config_buf_size = f34->v7.partition_table_bytes; + ptable = f34->v7.read_config_buf; + + ret = rmi_f34v7_read_f34v7_partition_table(f34); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to read partition table\n", + __func__); + return ret; + } + + rmi_f34v7_parse_partition_table(f34, ptable, + &f34->v7.blkcount, &f34->v7.phyaddr); + + return 0; +} + +static int rmi_f34v7_check_ui_firmware_size(struct f34_data *f34) +{ + u16 block_count; + + block_count = f34->v7.img.ui_firmware.size / f34->v7.block_size; + + if (block_count != f34->v7.blkcount.ui_firmware) { + dev_err(&f34->fn->dev, + "UI firmware size mismatch: %d != %d\n", + block_count, f34->v7.blkcount.ui_firmware); + return -EINVAL; + } + + return 0; +} + +static int rmi_f34v7_check_ui_config_size(struct f34_data *f34) +{ + u16 block_count; + + block_count = f34->v7.img.ui_config.size / f34->v7.block_size; + + if (block_count != f34->v7.blkcount.ui_config) { + dev_err(&f34->fn->dev, "UI config size mismatch\n"); + return -EINVAL; + } + + return 0; +} + +static int rmi_f34v7_check_dp_config_size(struct f34_data *f34) +{ + u16 block_count; + + block_count = f34->v7.img.dp_config.size / f34->v7.block_size; + + if (block_count != f34->v7.blkcount.dp_config) { + dev_err(&f34->fn->dev, "Display config size mismatch\n"); + return -EINVAL; + } + + return 0; +} + +static int rmi_f34v7_check_guest_code_size(struct f34_data *f34) +{ + u16 block_count; + + block_count = f34->v7.img.guest_code.size / f34->v7.block_size; + if (block_count != f34->v7.blkcount.guest_code) { + dev_err(&f34->fn->dev, "Guest code size mismatch\n"); + return -EINVAL; + } + + return 0; +} + +static int rmi_f34v7_check_bl_config_size(struct f34_data *f34) +{ + u16 block_count; + + block_count = f34->v7.img.bl_config.size / f34->v7.block_size; + + if (block_count != f34->v7.blkcount.bl_config) { + dev_err(&f34->fn->dev, "Bootloader config size mismatch\n"); + return -EINVAL; + } + + return 0; +} + +static int rmi_f34v7_erase_config(struct f34_data *f34) +{ + int ret; + + dev_info(&f34->fn->dev, "Erasing config...\n"); + + switch (f34->v7.config_area) { + case v7_UI_CONFIG_AREA: + ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_UI_CONFIG); + if (ret < 0) + return ret; + break; + case v7_DP_CONFIG_AREA: + ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_DISP_CONFIG); + if (ret < 0) + return ret; + break; + case v7_BL_CONFIG_AREA: + ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_BL_CONFIG); + if (ret < 0) + return ret; + break; + } + + ret = rmi_f34v7_wait_for_idle(f34, ENABLE_WAIT_MS); + if (ret < 0) + return ret; + + return ret; +} + +static int rmi_f34v7_erase_guest_code(struct f34_data *f34) +{ + int ret; + + dev_info(&f34->fn->dev, "Erasing guest code...\n"); + + ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_GUEST_CODE); + if (ret < 0) + return ret; + + ret = rmi_f34v7_wait_for_idle(f34, ENABLE_WAIT_MS); + if (ret < 0) + return ret; + + return 0; +} + +static int rmi_f34v7_erase_all(struct f34_data *f34) +{ + int ret; + + dev_info(&f34->fn->dev, "Erasing firmware...\n"); + + ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_UI_FIRMWARE); + if (ret < 0) + return ret; + + ret = rmi_f34v7_wait_for_idle(f34, ENABLE_WAIT_MS); + if (ret < 0) + return ret; + + f34->v7.config_area = v7_UI_CONFIG_AREA; + ret = rmi_f34v7_erase_config(f34); + if (ret < 0) + return ret; + + if (f34->v7.has_display_cfg) { + f34->v7.config_area = v7_DP_CONFIG_AREA; + ret = rmi_f34v7_erase_config(f34); + if (ret < 0) + return ret; + } + + if (f34->v7.new_partition_table && f34->v7.has_guest_code) { + ret = rmi_f34v7_erase_guest_code(f34); + if (ret < 0) + return ret; + } + + return 0; +} + +static int rmi_f34v7_read_f34v7_blocks(struct f34_data *f34, u16 block_cnt, + u8 command) +{ + int ret; + u8 base; + __le16 length; + u16 transfer; + u16 max_transfer; + u16 remaining = block_cnt; + u16 block_number = 0; + u16 index = 0; + + base = f34->fn->fd.data_base_addr; + + ret = rmi_f34v7_write_partition_id(f34, command); + if (ret < 0) + return ret; + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.block_number, + &block_number, sizeof(block_number)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to write block number\n", + __func__); + return ret; + } + + max_transfer = min(f34->v7.payload_length, + (u16)(PAGE_SIZE / f34->v7.block_size)); + + do { + transfer = min(remaining, max_transfer); + put_unaligned_le16(transfer, &length); + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.transfer_length, + &length, sizeof(length)); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Write transfer length fail (%d remaining)\n", + __func__, remaining); + return ret; + } + + ret = rmi_f34v7_write_command(f34, command); + if (ret < 0) + return ret; + + ret = rmi_f34v7_wait_for_idle(f34, ENABLE_WAIT_MS); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Wait for idle failed (%d blks remaining)\n", + __func__, remaining); + return ret; + } + + ret = rmi_read_block(f34->fn->rmi_dev, + base + f34->v7.off.payload, + &f34->v7.read_config_buf[index], + transfer * f34->v7.block_size); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Read block failed (%d blks remaining)\n", + __func__, remaining); + return ret; + } + + index += (transfer * f34->v7.block_size); + remaining -= transfer; + } while (remaining); + + return 0; +} + +static int rmi_f34v7_write_f34v7_blocks(struct f34_data *f34, + const void *block_ptr, u16 block_cnt, + u8 command) +{ + int ret; + u8 base; + __le16 length; + u16 transfer; + u16 max_transfer; + u16 remaining = block_cnt; + u16 block_number = 0; + + base = f34->fn->fd.data_base_addr; + + ret = rmi_f34v7_write_partition_id(f34, command); + if (ret < 0) + return ret; + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.block_number, + &block_number, sizeof(block_number)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to write block number\n", + __func__); + return ret; + } + + if (f34->v7.payload_length > (PAGE_SIZE / f34->v7.block_size)) + max_transfer = PAGE_SIZE / f34->v7.block_size; + else + max_transfer = f34->v7.payload_length; + + do { + transfer = min(remaining, max_transfer); + put_unaligned_le16(transfer, &length); + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.transfer_length, + &length, sizeof(length)); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Write transfer length fail (%d remaining)\n", + __func__, remaining); + return ret; + } + + ret = rmi_f34v7_write_command(f34, command); + if (ret < 0) + return ret; + + ret = rmi_write_block(f34->fn->rmi_dev, + base + f34->v7.off.payload, + block_ptr, transfer * f34->v7.block_size); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Failed writing data (%d blks remaining)\n", + __func__, remaining); + return ret; + } + + ret = rmi_f34v7_wait_for_idle(f34, ENABLE_WAIT_MS); + if (ret < 0) { + dev_err(&f34->fn->dev, + "%s: Failed wait for idle (%d blks remaining)\n", + __func__, remaining); + return ret; + } + + block_ptr += (transfer * f34->v7.block_size); + remaining -= transfer; + } while (remaining); + + return 0; +} + +static int rmi_f34v7_write_config(struct f34_data *f34) +{ + return rmi_f34v7_write_f34v7_blocks(f34, f34->v7.config_data, + f34->v7.config_block_count, + v7_CMD_WRITE_CONFIG); +} + +static int rmi_f34v7_write_ui_config(struct f34_data *f34) +{ + f34->v7.config_area = v7_UI_CONFIG_AREA; + f34->v7.config_data = f34->v7.img.ui_config.data; + f34->v7.config_size = f34->v7.img.ui_config.size; + f34->v7.config_block_count = f34->v7.config_size / f34->v7.block_size; + + return rmi_f34v7_write_config(f34); +} + +static int rmi_f34v7_write_dp_config(struct f34_data *f34) +{ + f34->v7.config_area = v7_DP_CONFIG_AREA; + f34->v7.config_data = f34->v7.img.dp_config.data; + f34->v7.config_size = f34->v7.img.dp_config.size; + f34->v7.config_block_count = f34->v7.config_size / f34->v7.block_size; + + return rmi_f34v7_write_config(f34); +} + +static int rmi_f34v7_write_guest_code(struct f34_data *f34) +{ + return rmi_f34v7_write_f34v7_blocks(f34, f34->v7.img.guest_code.data, + f34->v7.img.guest_code.size / + f34->v7.block_size, + v7_CMD_WRITE_GUEST_CODE); +} + +static int rmi_f34v7_write_flash_config(struct f34_data *f34) +{ + int ret; + + f34->v7.config_area = v7_FLASH_CONFIG_AREA; + f34->v7.config_data = f34->v7.img.fl_config.data; + f34->v7.config_size = f34->v7.img.fl_config.size; + f34->v7.config_block_count = f34->v7.config_size / f34->v7.block_size; + + if (f34->v7.config_block_count != f34->v7.blkcount.fl_config) { + dev_err(&f34->fn->dev, "%s: Flash config size mismatch\n", + __func__); + return -EINVAL; + } + + ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_FLASH_CONFIG); + if (ret < 0) + return ret; + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: Erase flash config command written\n", __func__); + + ret = rmi_f34v7_wait_for_idle(f34, ENABLE_WAIT_MS); + if (ret < 0) + return ret; + + ret = rmi_f34v7_write_config(f34); + if (ret < 0) + return ret; + + return 0; +} + +static int rmi_f34v7_write_partition_table(struct f34_data *f34) +{ + u16 block_count; + int ret; + + block_count = f34->v7.blkcount.bl_config; + f34->v7.config_area = v7_BL_CONFIG_AREA; + f34->v7.config_size = f34->v7.block_size * block_count; + devm_kfree(&f34->fn->dev, f34->v7.read_config_buf); + f34->v7.read_config_buf = devm_kzalloc(&f34->fn->dev, + f34->v7.config_size, GFP_KERNEL); + if (!f34->v7.read_config_buf) { + f34->v7.read_config_buf_size = 0; + return -ENOMEM; + } + + f34->v7.read_config_buf_size = f34->v7.config_size; + + ret = rmi_f34v7_read_f34v7_blocks(f34, block_count, v7_CMD_READ_CONFIG); + if (ret < 0) + return ret; + + ret = rmi_f34v7_erase_config(f34); + if (ret < 0) + return ret; + + ret = rmi_f34v7_write_flash_config(f34); + if (ret < 0) + return ret; + + f34->v7.config_area = v7_BL_CONFIG_AREA; + f34->v7.config_data = f34->v7.read_config_buf; + f34->v7.config_size = f34->v7.img.bl_config.size; + f34->v7.config_block_count = f34->v7.config_size / f34->v7.block_size; + + ret = rmi_f34v7_write_config(f34); + if (ret < 0) + return ret; + + return 0; +} + +static int rmi_f34v7_write_firmware(struct f34_data *f34) +{ + u16 blk_count; + + blk_count = f34->v7.img.ui_firmware.size / f34->v7.block_size; + + return rmi_f34v7_write_f34v7_blocks(f34, f34->v7.img.ui_firmware.data, + blk_count, v7_CMD_WRITE_FW); +} + +static void rmi_f34v7_compare_partition_tables(struct f34_data *f34) +{ + if (f34->v7.phyaddr.ui_firmware != f34->v7.img.phyaddr.ui_firmware) { + f34->v7.new_partition_table = true; + return; + } + + if (f34->v7.phyaddr.ui_config != f34->v7.img.phyaddr.ui_config) { + f34->v7.new_partition_table = true; + return; + } + + if (f34->v7.has_display_cfg && + f34->v7.phyaddr.dp_config != f34->v7.img.phyaddr.dp_config) { + f34->v7.new_partition_table = true; + return; + } + + if (f34->v7.has_guest_code && + f34->v7.phyaddr.guest_code != f34->v7.img.phyaddr.guest_code) { + f34->v7.new_partition_table = true; + return; + } + + f34->v7.new_partition_table = false; +} + +static void rmi_f34v7_parse_img_header_10_bl_container(struct f34_data *f34, + const void *image) +{ + int i; + int num_of_containers; + unsigned int addr; + unsigned int container_id; + unsigned int length; + const void *content; + const struct container_descriptor *descriptor; + + num_of_containers = f34->v7.img.bootloader.size / 4 - 1; + + for (i = 1; i <= num_of_containers; i++) { + addr = get_unaligned_le32(f34->v7.img.bootloader.data + i * 4); + descriptor = image + addr; + container_id = le16_to_cpu(descriptor->container_id); + content = image + le32_to_cpu(descriptor->content_address); + length = le32_to_cpu(descriptor->content_length); + switch (container_id) { + case BL_CONFIG_CONTAINER: + case GLOBAL_PARAMETERS_CONTAINER: + f34->v7.img.bl_config.data = content; + f34->v7.img.bl_config.size = length; + break; + case BL_LOCKDOWN_INFO_CONTAINER: + case DEVICE_CONFIG_CONTAINER: + f34->v7.img.lockdown.data = content; + f34->v7.img.lockdown.size = length; + break; + default: + break; + } + } +} + +static void rmi_f34v7_parse_image_header_10(struct f34_data *f34) +{ + unsigned int i; + unsigned int num_of_containers; + unsigned int addr; + unsigned int offset; + unsigned int container_id; + unsigned int length; + const void *image = f34->v7.image; + const u8 *content; + const struct container_descriptor *descriptor; + const struct image_header_10 *header = image; + + f34->v7.img.checksum = le32_to_cpu(header->checksum); + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: f34->v7.img.checksum=%X\n", + __func__, f34->v7.img.checksum); + + /* address of top level container */ + offset = le32_to_cpu(header->top_level_container_start_addr); + descriptor = image + offset; + + /* address of top level container content */ + offset = le32_to_cpu(descriptor->content_address); + num_of_containers = le32_to_cpu(descriptor->content_length) / 4; + + for (i = 0; i < num_of_containers; i++) { + addr = get_unaligned_le32(image + offset); + offset += 4; + descriptor = image + addr; + container_id = le16_to_cpu(descriptor->container_id); + content = image + le32_to_cpu(descriptor->content_address); + length = le32_to_cpu(descriptor->content_length); + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: container_id=%d, length=%d\n", __func__, + container_id, length); + + switch (container_id) { + case UI_CONTAINER: + case CORE_CODE_CONTAINER: + f34->v7.img.ui_firmware.data = content; + f34->v7.img.ui_firmware.size = length; + break; + case UI_CONFIG_CONTAINER: + case CORE_CONFIG_CONTAINER: + f34->v7.img.ui_config.data = content; + f34->v7.img.ui_config.size = length; + break; + case BL_CONTAINER: + f34->v7.img.bl_version = *content; + f34->v7.img.bootloader.data = content; + f34->v7.img.bootloader.size = length; + rmi_f34v7_parse_img_header_10_bl_container(f34, image); + break; + case GUEST_CODE_CONTAINER: + f34->v7.img.contains_guest_code = true; + f34->v7.img.guest_code.data = content; + f34->v7.img.guest_code.size = length; + break; + case DISPLAY_CONFIG_CONTAINER: + f34->v7.img.contains_display_cfg = true; + f34->v7.img.dp_config.data = content; + f34->v7.img.dp_config.size = length; + break; + case FLASH_CONFIG_CONTAINER: + f34->v7.img.contains_flash_config = true; + f34->v7.img.fl_config.data = content; + f34->v7.img.fl_config.size = length; + break; + case GENERAL_INFORMATION_CONTAINER: + f34->v7.img.contains_firmware_id = true; + f34->v7.img.firmware_id = + get_unaligned_le32(content + 4); + break; + default: + break; + } + } +} + +static int rmi_f34v7_parse_image_info(struct f34_data *f34) +{ + const struct image_header_10 *header = f34->v7.image; + + memset(&f34->v7.img, 0x00, sizeof(f34->v7.img)); + + rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, + "%s: header->major_header_version = %d\n", + __func__, header->major_header_version); + + switch (header->major_header_version) { + case IMAGE_HEADER_VERSION_10: + rmi_f34v7_parse_image_header_10(f34); + break; + default: + dev_err(&f34->fn->dev, "Unsupported image file format %02X\n", + header->major_header_version); + return -EINVAL; + } + + if (!f34->v7.img.contains_flash_config) { + dev_err(&f34->fn->dev, "%s: No flash config in fw image\n", + __func__); + return -EINVAL; + } + + rmi_f34v7_parse_partition_table(f34, f34->v7.img.fl_config.data, + &f34->v7.img.blkcount, &f34->v7.img.phyaddr); + + rmi_f34v7_compare_partition_tables(f34); + + return 0; +} + +int rmi_f34v7_do_reflash(struct f34_data *f34, const struct firmware *fw) +{ + int ret; + + rmi_f34v7_read_queries_bl_version(f34); + + f34->v7.image = fw->data; + + ret = rmi_f34v7_parse_image_info(f34); + if (ret < 0) + goto fail; + + if (!f34->v7.new_partition_table) { + ret = rmi_f34v7_check_ui_firmware_size(f34); + if (ret < 0) + goto fail; + + ret = rmi_f34v7_check_ui_config_size(f34); + if (ret < 0) + goto fail; + + if (f34->v7.has_display_cfg && + f34->v7.img.contains_display_cfg) { + ret = rmi_f34v7_check_dp_config_size(f34); + if (ret < 0) + goto fail; + } + + if (f34->v7.has_guest_code && f34->v7.img.contains_guest_code) { + ret = rmi_f34v7_check_guest_code_size(f34); + if (ret < 0) + goto fail; + } + } else { + ret = rmi_f34v7_check_bl_config_size(f34); + if (ret < 0) + goto fail; + } + + ret = rmi_f34v7_erase_all(f34); + if (ret < 0) + goto fail; + + if (f34->v7.new_partition_table) { + ret = rmi_f34v7_write_partition_table(f34); + if (ret < 0) + goto fail; + dev_info(&f34->fn->dev, "%s: Partition table programmed\n", + __func__); + } + + dev_info(&f34->fn->dev, "Writing firmware (%d bytes)...\n", + f34->v7.img.ui_firmware.size); + + ret = rmi_f34v7_write_firmware(f34); + if (ret < 0) + goto fail; + + dev_info(&f34->fn->dev, "Writing config (%d bytes)...\n", + f34->v7.img.ui_config.size); + + f34->v7.config_area = v7_UI_CONFIG_AREA; + ret = rmi_f34v7_write_ui_config(f34); + if (ret < 0) + goto fail; + + if (f34->v7.has_display_cfg && f34->v7.img.contains_display_cfg) { + dev_info(&f34->fn->dev, "Writing display config...\n"); + + ret = rmi_f34v7_write_dp_config(f34); + if (ret < 0) + goto fail; + } + + if (f34->v7.new_partition_table) { + if (f34->v7.has_guest_code && f34->v7.img.contains_guest_code) { + dev_info(&f34->fn->dev, "Writing guest code...\n"); + + ret = rmi_f34v7_write_guest_code(f34); + if (ret < 0) + goto fail; + } + } + +fail: + return ret; +} + +static int rmi_f34v7_enter_flash_prog(struct f34_data *f34) +{ + int ret; + + ret = rmi_f34v7_read_flash_status(f34); + if (ret < 0) + return ret; + + if (f34->v7.in_bl_mode) + return 0; + + ret = rmi_f34v7_write_command(f34, v7_CMD_ENABLE_FLASH_PROG); + if (ret < 0) + return ret; + + ret = rmi_f34v7_wait_for_idle(f34, ENABLE_WAIT_MS); + if (ret < 0) + return ret; + + if (!f34->v7.in_bl_mode) { + dev_err(&f34->fn->dev, "%s: BL mode not entered\n", __func__); + return -EINVAL; + } + + return 0; +} + +int rmi_f34v7_start_reflash(struct f34_data *f34, const struct firmware *fw) +{ + int ret = 0; + + f34->v7.config_area = v7_UI_CONFIG_AREA; + f34->v7.image = fw->data; + + ret = rmi_f34v7_parse_image_info(f34); + if (ret < 0) + goto exit; + + if (!f34->v7.force_update && f34->v7.new_partition_table) { + dev_err(&f34->fn->dev, "%s: Partition table mismatch\n", + __func__); + ret = -EINVAL; + goto exit; + } + + dev_info(&f34->fn->dev, "Firmware image OK\n"); + + ret = rmi_f34v7_read_flash_status(f34); + if (ret < 0) + goto exit; + + if (f34->v7.in_bl_mode) { + dev_info(&f34->fn->dev, "%s: Device in bootloader mode\n", + __func__); + } + + rmi_f34v7_enter_flash_prog(f34); + + return 0; + +exit: + return ret; +} + +int rmi_f34v7_probe(struct f34_data *f34) +{ + int ret; + + /* Read bootloader version */ + ret = rmi_read_block(f34->fn->rmi_dev, + f34->fn->fd.query_base_addr + V7_BOOTLOADER_ID_OFFSET, + f34->bootloader_id, + sizeof(f34->bootloader_id)); + if (ret < 0) { + dev_err(&f34->fn->dev, "%s: Failed to read bootloader ID\n", + __func__); + return ret; + } + + if (f34->bootloader_id[1] == '5') { + f34->bl_version = 5; + } else if (f34->bootloader_id[1] == '6') { + f34->bl_version = 6; + } else if (f34->bootloader_id[1] == 7) { + f34->bl_version = 7; + } else { + dev_err(&f34->fn->dev, "%s: Unrecognized bootloader version\n", + __func__); + return -EINVAL; + } + + memset(&f34->v7.blkcount, 0x00, sizeof(f34->v7.blkcount)); + memset(&f34->v7.phyaddr, 0x00, sizeof(f34->v7.phyaddr)); + rmi_f34v7_read_queries(f34); + + f34->v7.force_update = false; + return 0; +} diff --git a/include/linux/rmi.h b/include/linux/rmi.h index ac910f730688..64125443f8a6 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -342,7 +342,7 @@ struct rmi_driver_data { struct rmi_function *f01_container; struct rmi_function *f34_container; - bool f01_bootloader_mode; + bool bootloader_mode; int num_of_irq_regs; int irq_count;