platform/kernel/linux-rpi.git
5 years agomedia: rcar-csi2: add R8A77980 support
Sergei Shtylyov [Mon, 6 Aug 2018 16:56:27 +0000 (12:56 -0400)]
media: rcar-csi2: add R8A77980 support

Add the R-Car V3H (AKA R8A77980) SoC support to the R-Car CSI2 driver.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: Use of_node_name_eq for node name comparisons
Rob Herring [Thu, 6 Dec 2018 19:35:19 +0000 (14:35 -0500)]
media: Use of_node_name_eq for node name comparisons

Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Hyun Kwon <hyun.kwon@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: venus: core: Set dma maximum segment size
Vivek Gautam [Wed, 5 Dec 2018 08:31:51 +0000 (03:31 -0500)]
media: venus: core: Set dma maximum segment size

Turning on CONFIG_DMA_API_DEBUG_SG results in the following error:

[  460.308650] ------------[ cut here ]------------
[  460.313490] qcom-venus aa00000.video-codec: DMA-API: mapping sg segment longer than device claims to support [len=4194304] [max=65536]
[  460.326017] WARNING: CPU: 3 PID: 3555 at src/kernel/dma/debug.c:1301 debug_dma_map_sg+0x174/0x254
[  460.338888] Modules linked in: venus_dec venus_enc videobuf2_dma_sg videobuf2_memops hci_uart btqca bluetooth venus_core v4l2_mem2mem videobuf2_v4l2 videobuf2_common ath10k_snoc ath10k_core ath lzo lzo_compress zramjoydev
[  460.375811] CPU: 3 PID: 3555 Comm: V4L2DecoderThre Tainted: G        W         4.19.1 #82
[  460.384223] Hardware name: Google Cheza (rev1) (DT)
[  460.389251] pstate: 60400009 (nZCv daif +PAN -UAO)
[  460.394191] pc : debug_dma_map_sg+0x174/0x254
[  460.398680] lr : debug_dma_map_sg+0x174/0x254
[  460.403162] sp : ffffff80200c37d0
[  460.406583] x29: ffffff80200c3830 x28: 0000000000010000
[  460.412056] x27: 00000000ffffffff x26: ffffffc0f785ea80
[  460.417532] x25: 0000000000000000 x24: ffffffc0f4ea1290
[  460.423001] x23: ffffffc09e700300 x22: ffffffc0f4ea1290
[  460.428470] x21: ffffff8009037000 x20: 0000000000000001
[  460.433936] x19: ffffff80091b0000 x18: 0000000000000000
[  460.439411] x17: 0000000000000000 x16: 000000000000f251
[  460.444885] x15: 0000000000000006 x14: 0720072007200720
[  460.450354] x13: ffffff800af536e0 x12: 0000000000000000
[  460.455822] x11: 0000000000000000 x10: 0000000000000000
[  460.461288] x9 : 537944d9c6c48d00 x8 : 537944d9c6c48d00
[  460.466758] x7 : 0000000000000000 x6 : ffffffc0f8d98f80
[  460.472230] x5 : 0000000000000000 x4 : 0000000000000000
[  460.477703] x3 : 000000000000008a x2 : ffffffc0fdb13948
[  460.483170] x1 : ffffffc0fdb0b0b0 x0 : 000000000000007a
[  460.488640] Call trace:
[  460.491165]  debug_dma_map_sg+0x174/0x254
[  460.495307]  vb2_dma_sg_alloc+0x260/0x2dc [videobuf2_dma_sg]
[  460.501150]  __vb2_queue_alloc+0x164/0x374 [videobuf2_common]
[  460.507076]  vb2_core_reqbufs+0xfc/0x23c [videobuf2_common]
[  460.512815]  vb2_reqbufs+0x44/0x5c [videobuf2_v4l2]
[  460.517853]  v4l2_m2m_reqbufs+0x44/0x78 [v4l2_mem2mem]
[  460.523144]  v4l2_m2m_ioctl_reqbufs+0x1c/0x28 [v4l2_mem2mem]
[  460.528976]  v4l_reqbufs+0x30/0x40
[  460.532480]  __video_do_ioctl+0x36c/0x454
[  460.536610]  video_usercopy+0x25c/0x51c
[  460.540572]  video_ioctl2+0x38/0x48
[  460.544176]  v4l2_ioctl+0x60/0x74
[  460.547602]  do_video_ioctl+0x948/0x3520
[  460.551648]  v4l2_compat_ioctl32+0x60/0x98
[  460.555872]  __arm64_compat_sys_ioctl+0x134/0x20c
[  460.560718]  el0_svc_common+0x9c/0xe4
[  460.564498]  el0_svc_compat_handler+0x2c/0x38
[  460.568982]  el0_svc_compat+0x8/0x18
[  460.572672] ---[ end trace ce209b87b2f3af88 ]---

>From above warning one would deduce that the sg segment will overflow
the device's capacity. In reality, the hardware can accommodate larger
sg segments.
So, initialize the max segment size properly to weed out this warning.

Based on a similar patch sent by Sean Paul for mdss:
https://patchwork.kernel.org/patch/10671457/

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: venus: Support V4L2 QP parameters in Venus encoder
Kelvin Lawson [Fri, 30 Nov 2018 00:07:28 +0000 (19:07 -0500)]
media: venus: Support V4L2 QP parameters in Venus encoder

Support V4L2 QP parameters in Venus encoder:
 * V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP
 * V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP
 * V4L2_CID_MPEG_VIDEO_H264_MIN_QP
 * V4L2_CID_MPEG_VIDEO_H264_MAX_QP

Signed-off-by: Kelvin Lawson <klawson@lisden.com>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields
Ezequiel Garcia [Thu, 6 Dec 2018 19:46:39 +0000 (14:46 -0500)]
media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields

Make the core set the reserved fields to zero in
vv4l2_pix_format_mplane.4l2_plane_pix_format,
for _MPLANE queue types.

Moving this to the core avoids having to do so in each
and every driver.

Suggested-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: marvell-ccic: trivial fix to the datasheet URL
Lubomir Rintel [Mon, 3 Dec 2018 11:47:42 +0000 (06:47 -0500)]
media: marvell-ccic: trivial fix to the datasheet URL

Update URL.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: MAINTAINERS: Change Todor Tomov's email address
Todor Tomov [Fri, 30 Nov 2018 12:01:39 +0000 (07:01 -0500)]
media: MAINTAINERS: Change Todor Tomov's email address

My Linaro email address with be inactive very soon so switch
it to my Gmail address.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cedrus: Remove global IRQ spin lock from the driver
Paul Kocialkowski [Fri, 30 Nov 2018 08:16:17 +0000 (03:16 -0500)]
media: cedrus: Remove global IRQ spin lock from the driver

We initially introduced a spin lock to ensure that the VPU registers
are not accessed concurrently between our setup function and IRQ
handler. The V4L2 M2M API ensures that only one decoding job runs at a
time, so the interrupt signaling the end of decoding will not occur
while the next picture is being configured.

Spurious interrupts are taken care of in the handler, by checking that
we have a valid M2M context and a decoding status available before
marking the buffers as done.

In addition, holding a spin lock could be problematic if non-atomic
operations are required in the setup process for future codec support.

As a result, remove the global IRQ spin lock.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: sun6i: fix spelling mistake "droped" -> "dropped"
Colin Ian King [Thu, 29 Nov 2018 10:50:38 +0000 (05:50 -0500)]
media: sun6i: fix spelling mistake "droped" -> "dropped"

There are spelling mistakes in dev_dbg messages, fix them.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: pvrusb2: fix spelling mistake "statuss" -> "status"
Colin Ian King [Thu, 29 Nov 2018 10:19:45 +0000 (05:19 -0500)]
media: pvrusb2: fix spelling mistake "statuss" -> "status"

There is a spelling mistake in a pvr2_trace trace message, fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: fix H.264 deblocking filter controls
Philipp Zabel [Wed, 28 Nov 2018 13:01:22 +0000 (08:01 -0500)]
media: coda: fix H.264 deblocking filter controls

Add support for the third loop filter mode
V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY,
and fix V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA and
V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA controls.

The filter offset controls are signed values in the -6 to 6 range and
are stored into the slice header fields slice_alpha_c0_offset_div2 and
slice_beta_offset_div2. The actual filter offsets FilterOffsetA/B are
double their value, in range of -12 to 12.

Rename variables to more closely match the nomenclature in the H.264
specification.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2: clarify H.264 loop filter offset controls
Philipp Zabel [Wed, 28 Nov 2018 13:01:21 +0000 (08:01 -0500)]
media: v4l2: clarify H.264 loop filter offset controls

The venus and s5p-mfc drivers add the loop filter alpha/beta offset
controls V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA/BETA with a range of
-6 to +6, inclusive. This is exactly the range specified for the slice
header fields slice_alpha_c0_offset_div2 and slice_beta_offset_div2,
which store half the actual filter offsets FilterOffsetA/B.

Clarify that this control contains the halved offsets.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging: tegra-vde: Replace debug messages with trace points
Dmitry Osipenko [Mon, 19 Nov 2018 11:17:18 +0000 (06:17 -0500)]
media: staging: tegra-vde: Replace debug messages with trace points

Trace points are much more efficient than debug messages for intensive
tracing and could be conveniently enabled / disabled dynamically, hence
let's replace debug messages with the trace points. This also makes
code a bit cleaner.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: venus: add support for key frame
Malathi Gottam [Fri, 2 Nov 2018 12:57:56 +0000 (08:57 -0400)]
media: venus: add support for key frame

When client requests for a keyframe, set the property
to hardware to generate the sync frame.

Signed-off-by: Malathi Gottam <mgottam@codeaurora.org>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: lmedm04: Move interrupt buffer to priv buffer.
Malcolm Priestley [Wed, 5 Dec 2018 19:14:31 +0000 (14:14 -0500)]
media: lmedm04: Move interrupt buffer to priv buffer.

Interrupt is always present throughout life time of driver and
there is no dma element move this buffer to private area of driver.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: lmedm04: Add missing usb_free_urb to free interrupt urb.
Malcolm Priestley [Wed, 5 Dec 2018 19:11:57 +0000 (14:11 -0500)]
media: lmedm04: Add missing usb_free_urb to free interrupt urb.

The interrupt urb is killed but never freed add the function

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: stkwebcam: Bugfix for wrong return values
Andreas Pape [Fri, 23 Nov 2018 16:14:54 +0000 (11:14 -0500)]
media: stkwebcam: Bugfix for wrong return values

usb_control_msg returns in case of a successfully sent message the number
of sent bytes as a positive number. Don't use this value as a return value
for stk_camera_read_reg, as a non-zero return value is used as an error
condition in some cases when stk_camera_read_reg is called.

Signed-off-by: Andreas Pape <ap@ca-pape.de>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: stkwebcam: Support for ASUS A6VM notebook added.
Andreas Pape [Fri, 23 Nov 2018 16:14:52 +0000 (11:14 -0500)]
media: stkwebcam: Support for ASUS A6VM notebook added.

The ASUS A6VM notebook has a built in stk11xx webcam which is mounted
in a way that the video is vertically and horizontally flipped.
Therefore this notebook is added to the special handling in the driver
to automatically flip the video into the correct orientation.

Signed-off-by: Andreas Pape <ap@ca-pape.de>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rockchip/vpu: fix a few alignments
Mauro Carvalho Chehab [Wed, 5 Dec 2018 18:42:30 +0000 (13:42 -0500)]
media: rockchip/vpu: fix a few alignments

As reported by checkpatch.pl, some function calls have a wrong
alignment.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: add Rockchip VPU JPEG encoder driver
Ezequiel Garcia [Wed, 5 Dec 2018 16:09:52 +0000 (11:09 -0500)]
media: add Rockchip VPU JPEG encoder driver

Add a mem2mem driver for the VPU available on Rockchip SoCs.
Currently only JPEG encoding is supported, for RK3399 and RK3288
platforms.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: fix checkpatch.pl alignment warning]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: Document the Rockchip VPU bindings
Ezequiel Garcia [Fri, 30 Nov 2018 17:34:30 +0000 (12:34 -0500)]
media: dt-bindings: Document the Rockchip VPU bindings

Add devicetree binding documentation for Rockchip Video Processing
Unit IP.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agoMerge commit '0072a0c14d5b7cb72c611d396f143f5dcd73ebe2' into patchwork
Mauro Carvalho Chehab [Wed, 5 Dec 2018 18:16:24 +0000 (13:16 -0500)]
Merge commit '0072a0c14d5b7cb72c611d396f143f5dcd73ebe2' into patchwork

Merge from Upstream after the latest media fixes branch, because we
need one patch that it is there.

* commit '0072a0c14d5b7cb72c611d396f143f5dcd73ebe2': (1108 commits)
  ide: Change to use DEFINE_SHOW_ATTRIBUTE macro
  ide: pmac: add of_node_put()
  drivers/tty: add missing of_node_put()
  drivers/sbus/char: add of_node_put()
  sbus: char: add of_node_put()
  Linux 4.20-rc5
  PCI: Fix incorrect value returned from pcie_get_speed_cap()
  MAINTAINERS: Update linux-mips mailing list address
  ocfs2: fix potential use after free
  mm/khugepaged: fix the xas_create_range() error path
  mm/khugepaged: collapse_shmem() do not crash on Compound
  mm/khugepaged: collapse_shmem() without freezing new_page
  mm/khugepaged: minor reorderings in collapse_shmem()
  mm/khugepaged: collapse_shmem() remember to clear holes
  mm/khugepaged: fix crashes due to misaccounted holes
  mm/khugepaged: collapse_shmem() stop if punched or truncated
  mm/huge_memory: fix lockdep complaint on 32-bit i_size_read()
  mm/huge_memory: splitting set mapping+index before unfreeze
  mm/huge_memory: rename freeze_page() to unmap_page()
  initramfs: clean old path before creating a hardlink
  ...

5 years agomedia: pixfmt-meta-d4xx.rst: Add a license to it
Mauro Carvalho Chehab [Fri, 23 Nov 2018 18:21:10 +0000 (13:21 -0500)]
media: pixfmt-meta-d4xx.rst: Add a license to it

This file is a recent addition to media docs, and it is now the
only one without any license.

While the best is to dual-license with GFDL and GPL, it is,
at least, compatible with GFDL, as this is a requirement to be
part of the media uAPI docs.

So, add such license to it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: docs: brainless mass add SPDX headers to all media files
Mauro Carvalho Chehab [Thu, 30 Aug 2018 14:20:04 +0000 (10:20 -0400)]
media: docs: brainless mass add SPDX headers to all media files

All Documentation files outside the uAPI are all licensed with,
at least, GPL 2.0. So, mark them as such.

The ondes at media/uapi are at least GFDL 1.1+.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: svg files: dual-licence some files with GPL and GFDL
Mauro Carvalho Chehab [Thu, 30 Aug 2018 15:07:49 +0000 (11:07 -0400)]
media: svg files: dual-licence some files with GPL and GFDL

Along the time, several image files got replaced by me by
new ones with similar contents.

As those were not simple conversions, dual-license them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: add SPDX header to media uAPI files
Mauro Carvalho Chehab [Thu, 30 Aug 2018 14:15:26 +0000 (10:15 -0400)]
media: add SPDX header to media uAPI files

All those files are under GFDL 1.1 or later, with no invariant sections.
Tag them as such.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: remove text encoding from rst files
Mauro Carvalho Chehab [Thu, 30 Aug 2018 14:09:48 +0000 (10:09 -0400)]
media: remove text encoding from rst files

This is not needed there. Also, the same UTF-8 encoding should
be used on all documents.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: Documentation/media: uapi: Explicitly say there are no Invariant Sections
Ben Hutchings [Fri, 23 Nov 2018 18:38:34 +0000 (13:38 -0500)]
media: Documentation/media: uapi: Explicitly say there are no Invariant Sections

The GNU Free Documentation License allows for a work to specify
Invariant Sections that are not allowed to be modified.  (Debian
considers that this makes such works non-free.)

The Linux Media Infrastructure userspace API documentation does not
specify any such sections, but it also doesn't say there are none (as
is recommended by the license text).  Make it explicit that there are
none.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Marcus Metzler <mocm@metzlerbros.de>
Signed-off-by: Michael Ira Krufky <mkrufky@gmail.com>
Signed-off-by: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Sylwester Nawrocki <snawrocki@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: Change variable names
Dafna Hirschfeld [Tue, 4 Dec 2018 20:54:37 +0000 (15:54 -0500)]
media: vicodec: Change variable names

Change variables names in vicodec-core.c to *_src *_dst
to improve readability

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2: async: remove locking when initializing async notifier
Niklas Söderlund [Fri, 30 Nov 2018 02:11:07 +0000 (21:11 -0500)]
media: v4l2: async: remove locking when initializing async notifier

There is no need to hold the list_lock when initializing the local
asd_list of a notifier. Remove the lock handling to simplify the code
and remove a potential LOCKDEP warning.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reported-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Remove duplicate auto-exposure setup
Maxime Ripard [Mon, 3 Dec 2018 08:44:27 +0000 (03:44 -0500)]
media: ov5640: Remove duplicate auto-exposure setup

The autoexposure setup in the 1080p init array is redundant with the
default value of the sensor.

Remove it.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Add 60 fps support
Maxime Ripard [Mon, 3 Dec 2018 08:44:26 +0000 (03:44 -0500)]
media: ov5640: Add 60 fps support

Now that we have everything in place to compute the clock rate at runtime,
we can enable the 60fps framerate for the mode we tested it with.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Make the FPS clamping / rounding more extendable
Maxime Ripard [Mon, 3 Dec 2018 08:44:25 +0000 (03:44 -0500)]
media: ov5640: Make the FPS clamping / rounding more extendable

The current code uses an algorithm to clamp the FPS values and round them
to the closest supported one that isn't really allows to be extended to
more than two values.

Rework it a bit to make it much easier to extend the amount of FPS options
we support.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Make the return rate type more explicit
Maxime Ripard [Mon, 3 Dec 2018 08:44:24 +0000 (03:44 -0500)]
media: ov5640: Make the return rate type more explicit

In the ov5640_try_frame_interval function, the ret variable actually holds
the frame rate index to use, which is represented by the enum
ov5640_frame_rate in the driver.

Make it more obvious.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Enhance FPS handling
Maxime Ripard [Mon, 3 Dec 2018 08:44:23 +0000 (03:44 -0500)]
media: ov5640: Enhance FPS handling

Now that we have moved the clock generation logic out of the bytes array,
these arrays are identical between the 15fps and 30fps variants.

Remove the duplicate entries, and convert the code accordingly.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Remove pixel clock rates
Maxime Ripard [Mon, 3 Dec 2018 08:44:22 +0000 (03:44 -0500)]
media: ov5640: Remove pixel clock rates

The pixel clock rates were introduced to report the initially static clock
rate.

Since this is now handled dynamically, we can remove them entirely.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Compute the clock rate at runtime
Maxime Ripard [Mon, 3 Dec 2018 08:44:21 +0000 (03:44 -0500)]
media: ov5640: Compute the clock rate at runtime

The clock rate, while hardcoded until now, is actually a function of the
resolution, framerate and bytes per pixel. Now that we have an algorithm to
adjust our clock rate, we can select it dynamically when we change the
mode.

This changes a bit the clock rate being used, with the following effect:

+------+------+------+------+-----+-----------------+----------------+-----------+
| Hact | Vact | Htot | Vtot | FPS | Hardcoded clock | Computed clock | Deviation |
+------+------+------+------+-----+-----------------+----------------+-----------+
|  640 |  480 | 1896 | 1080 |  15 |        56000000 |       61430400 | 8.84 %    |
|  640 |  480 | 1896 | 1080 |  30 |       112000000 |      122860800 | 8.84 %    |
| 1024 |  768 | 1896 | 1080 |  15 |        56000000 |       61430400 | 8.84 %    |
| 1024 |  768 | 1896 | 1080 |  30 |       112000000 |      122860800 | 8.84 %    |
|  320 |  240 | 1896 |  984 |  15 |        56000000 |       55969920 | 0.05 %    |
|  320 |  240 | 1896 |  984 |  30 |       112000000 |      111939840 | 0.05 %    |
|  176 |  144 | 1896 |  984 |  15 |        56000000 |       55969920 | 0.05 %    |
|  176 |  144 | 1896 |  984 |  30 |       112000000 |      111939840 | 0.05 %    |
|  720 |  480 | 1896 |  984 |  15 |        56000000 |       55969920 | 0.05 %    |
|  720 |  480 | 1896 |  984 |  30 |       112000000 |      111939840 | 0.05 %    |
|  720 |  576 | 1896 |  984 |  15 |        56000000 |       55969920 | 0.05 %    |
|  720 |  576 | 1896 |  984 |  30 |       112000000 |      111939840 | 0.05 %    |
| 1280 |  720 | 1892 |  740 |  15 |        42000000 |       42002400 | 0.01 %    |
| 1280 |  720 | 1892 |  740 |  30 |        84000000 |       84004800 | 0.01 %    |
| 1920 | 1080 | 2500 | 1120 |  15 |        84000000 |       84000000 | 0.00 %    |
| 1920 | 1080 | 2500 | 1120 |  30 |       168000000 |      168000000 | 0.00 %    |
| 2592 | 1944 | 2844 | 1944 |  15 |        84000000 |      165862080 | 49.36 %   |
+------+------+------+------+-----+-----------------+----------------+-----------+

Only the 640x480, 1024x768 and 2592x1944 modes are significantly affected
by the new formula.

In this case, 640x480 and 1024x768 are actually fixed by this change.
Indeed, the sensor was sending data at, for example, 27.33fps instead of
30fps. This is -9%, which is roughly what we're seeing in the array.
Testing these modes with the new clock setup actually fix that error, and
data are now sent at around 30fps.

2592x1944, on the other hand, is probably due to the fact that this mode
can only be used using MIPI-CSI2, in a two lane mode, and never really
tested with a DVP bus.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Remove redundant register setup
Maxime Ripard [Mon, 3 Dec 2018 08:44:20 +0000 (03:44 -0500)]
media: ov5640: Remove redundant register setup

The MIPI divider is also cleared as part of the clock setup sequence, so we
can remove that code.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Remove redundant defines
Maxime Ripard [Mon, 3 Dec 2018 08:44:19 +0000 (03:44 -0500)]
media: ov5640: Remove redundant defines

The OV5640_SCLK2X_ROOT_DIVIDER_DEFAULT and OV5640_SCLK_ROOT_DIVIDER_DEFAULT
defines represent exactly the same setup, and are at the same value, than
the more consistent with the rest of the driver OV5640_SCLK2X_ROOT_DIV and
OV5640_SCLK_ROOT_DIV.

Remove them.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Remove the clocks registers initialization
Maxime Ripard [Mon, 3 Dec 2018 08:44:18 +0000 (03:44 -0500)]
media: ov5640: Remove the clocks registers initialization

Part of the hardcoded initialization sequence is to set up the proper clock
dividers. However, this is now done dynamically through proper code and as
such, the static one is now redundant.

Let's remove it.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Adjust the clock based on the expected rate
Maxime Ripard [Mon, 3 Dec 2018 08:44:17 +0000 (03:44 -0500)]
media: ov5640: Adjust the clock based on the expected rate

The clock structure for the PCLK is quite obscure in the documentation, and
was hardcoded through the bytes array of each and every mode.

This is troublesome, since we cannot adjust it at runtime based on other
parameters (such as the number of bytes per pixel), and we can't support
either framerates that have not been used by the various vendors, since we
don't have the needed initialization sequence.

We can however understand how the clock tree works, and then implement some
functions to derive the various parameters from a given rate. And now that
those parameters are calculated at runtime, we can remove them from the
initialization sequence.

The modes also gained a new parameter which is the clock that they are
running at, from the register writes they were doing, so for now the switch
to the new algorithm should be transparent.

Co-Developed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Tested-by: Adam Ford <aford173@gmail.com> #imx6dq
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov5640: Fix set format regression
Jacopo Mondi [Mon, 3 Dec 2018 08:44:16 +0000 (03:44 -0500)]
media: ov5640: Fix set format regression

The set_fmt operations updates the sensor format only when the image format
is changed. When only the image sizes gets changed, the format do not get
updated causing the sensor to always report the one that was previously in
use.

Without this patch, updating frame size only fails:
  [fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:srgb xfer:srgb ...]

With this patch applied:
  [fmt:UYVY8_2X8/1024x768@1/30 field:none colorspace:srgb xfer:srgb ...]

Fixes: 6949d864776e ("media: ov5640: do not change mode if format or frame interval is unchanged")

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx6 w/ CSI2 interface on 4.19.6 and 4.20-RC5
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mt9m111: allow to setup pixclk polarity
Enrico Scholz [Tue, 27 Nov 2018 10:02:53 +0000 (05:02 -0500)]
media: mt9m111: allow to setup pixclk polarity

The chip can be configured to output data transitions on the
rising or falling edge of PIXCLK (Datasheet R58:1[9]), default is on the
falling edge.

Parsing the fw-node is made in a subfunction to bundle all (future)
dt-parsing / fw-parsing stuff.

[m.grzeschik@pengutronix.de: Fix inverting clock. INV_PIX_CLOCK bit is set
 per default. Set bit to 0 (enable mask bit without value) to enable
 falling edge sampling.]
[m.felsch@pengutronix.de: use fwnode helpers]
[m.felsch@pengutronix.de: mv fw parsing into own function]
[m.felsch@pengutronix.de: adapt commit msg]
[sakari.ailus@linux.intel.com: V4L2 API usage changes to compile
 on media tree master]

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: media: mt9m111: add pclk-sample property
Marco Felsch [Tue, 27 Nov 2018 10:02:52 +0000 (05:02 -0500)]
media: dt-bindings: media: mt9m111: add pclk-sample property

Add the pclk-sample property to the list of optional properties
for the mt9m111 camera sensor.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: media: mt9m111: adapt documentation to be more clear
Marco Felsch [Tue, 27 Nov 2018 10:02:51 +0000 (05:02 -0500)]
media: dt-bindings: media: mt9m111: adapt documentation to be more clear

Replace the vague binding by a more verbose. Remove the remote property
from the example since the driver don't support such a property. Also
remove the bus-width property from the endpoint since the driver don't
take care of it.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mt9m111: add support to select formats and fps for {Q,SXGA}
Michael Grzeschik [Tue, 27 Nov 2018 10:02:50 +0000 (05:02 -0500)]
media: mt9m111: add support to select formats and fps for {Q,SXGA}

This patch implements the framerate selection using the skipping and
readout power-modi features. The power-modi cut the framerate by half
and each context has an independent selection bit. The same applies to
the 2x skipping feature.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mt9m111: add streaming check to set_fmt
Michael Grzeschik [Tue, 27 Nov 2018 10:02:49 +0000 (05:02 -0500)]
media: mt9m111: add streaming check to set_fmt

Currently set_fmt don't care about the streaming status, so the format
can be changed during streaming. This can lead into wrong behaviours.

Check if the device is already streaming and return -EBUSY to avoid
wrong behaviours.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mt9m111: add s_stream callback
Marco Felsch [Tue, 27 Nov 2018 10:02:48 +0000 (05:02 -0500)]
media: mt9m111: add s_stream callback

Add callback to check if we are already streaming. Now other callbacks
can check the state and return -EBUSY if we already streaming.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx274: select REGMAP_I2C
Luca Ceresoli [Tue, 27 Nov 2018 08:34:45 +0000 (03:34 -0500)]
media: imx274: select REGMAP_I2C

The imx274 driver uses regmap and the build will fail without it.

Fixes:

  drivers/media/i2c/imx274.c:142:21: error: variable â€˜imx274_regmap_config’ has initializer but incomplete type
   static const struct regmap_config imx274_regmap_config = {
                       ^~~~~~~~~~~~~
  drivers/media/i2c/imx274.c:1869:19: error: implicit declaration of function â€˜devm_regmap_init_i2c’ [-Werror=implicit-function-declaration]
    imx274->regmap = devm_regmap_init_i2c(client, &imx274_regmap_config);
                     ^~~~~~~~~~~~~~~~~~~~

and others.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx274: declare the correct number of controls
Luca Ceresoli [Tue, 27 Nov 2018 08:34:44 +0000 (03:34 -0500)]
media: imx274: declare the correct number of controls

v4l2_ctrl_handler_init() expects a hint of how many controls this
handler is expected to refer to. Since this number here is always 4,
let's pass exactly 4.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx274: fix stack corruption in imx274_read_reg
Luca Ceresoli [Mon, 26 Nov 2018 16:35:07 +0000 (11:35 -0500)]
media: imx274: fix stack corruption in imx274_read_reg

imx274_read_reg() takes a u8 pointer ("reg") and casts it to pass it
to regmap_read(), which takes an unsigned int pointer. This results in
a corrupted stack and random crashes.

Fixes: 0985dd306f72 ("media: imx274: V4l2 driver for Sony imx274 CMOS sensor")

Cc: stable@vger.kernel.org # for 4.15 and up
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: unify some sony camera sensors pattern naming
Bingbu Cao [Tue, 27 Nov 2018 04:01:01 +0000 (23:01 -0500)]
media: unify some sony camera sensors pattern naming

Some Sony camera sensors have same test pattern
definitions, this patch unify the pattern naming
to make it more clear to the userspace.

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx355: fix wrong order in test pattern menus
Bingbu Cao [Mon, 26 Nov 2018 07:43:34 +0000 (02:43 -0500)]
media: imx355: fix wrong order in test pattern menus

current imx355 test pattern order in ctrl menu
is not correct, this patch fixes it.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx319: fix wrong order in test pattern menus
Bingbu Cao [Mon, 26 Nov 2018 07:43:33 +0000 (02:43 -0500)]
media: imx319: fix wrong order in test pattern menus

current imx319 test pattern order in ctrl menu
is not correct, this patch fixes it.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-fwnode: Demote warning to debug level
Fabio Estevam [Fri, 23 Nov 2018 12:50:59 +0000 (07:50 -0500)]
media: v4l2-fwnode: Demote warning to debug level

On a imx6q-wandboard the following warnings are observed:

[    4.327794] video-mux 20e0000.iomuxc-gpr:ipu1_csi0_mux: bad remote port parent
[    4.336118] video-mux 20e0000.iomuxc-gpr:ipu2_csi1_mux: bad remote port parent

As explained by Philipp Zabel:

"There are empty endpoint nodes (without remote-endpoint property)
labeled ipu1_csi[01]_mux_from_parallel_sensor in the i.MX6 device trees
for board DT implementers' convenience. See commit 2539f517acbdc ("ARM:
dts: imx6qdl: Add video multiplexers, mipi_csi, and their connections")."

So demote the warning to debug level and make the wording a bit
less misleading.

Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: firewire: Fix app_info parameter type in avc_ca{,_app}_info
Nathan Chancellor [Thu, 18 Oct 2018 20:03:06 +0000 (16:03 -0400)]
media: firewire: Fix app_info parameter type in avc_ca{,_app}_info

Clang warns:

drivers/media/firewire/firedtv-avc.c:999:45: warning: implicit
conversion from 'int' to 'char' changes value from 159 to -97
[-Wconstant-conversion]
        app_info[0] = (EN50221_TAG_APP_INFO >> 16) & 0xff;
                    ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
drivers/media/firewire/firedtv-avc.c:1000:45: warning: implicit
conversion from 'int' to 'char' changes value from 128 to -128
[-Wconstant-conversion]
        app_info[1] = (EN50221_TAG_APP_INFO >>  8) & 0xff;
                    ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
drivers/media/firewire/firedtv-avc.c:1040:44: warning: implicit
conversion from 'int' to 'char' changes value from 159 to -97
[-Wconstant-conversion]
        app_info[0] = (EN50221_TAG_CA_INFO >> 16) & 0xff;
                    ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
drivers/media/firewire/firedtv-avc.c:1041:44: warning: implicit
conversion from 'int' to 'char' changes value from 128 to -128
[-Wconstant-conversion]
        app_info[1] = (EN50221_TAG_CA_INFO >>  8) & 0xff;
                    ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
4 warnings generated.

Change app_info's type to unsigned char to match the type of the
member msg in struct ca_msg, which is the only thing passed into the
app_info parameter in this function.

Link: https://github.com/ClangBuiltLinux/linux/issues/105
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: sti/bdisp: don't pass GFP_DMA32 to dma_alloc_attrs
Christoph Hellwig [Sat, 13 Oct 2018 15:17:06 +0000 (11:17 -0400)]
media: sti/bdisp: don't pass GFP_DMA32 to dma_alloc_attrs

The DMA API does its own zone decisions based on the coherent_dma_mask.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx-pxp: remove duplicated include from imx-pxp.c
YueHaibing [Sat, 6 Oct 2018 07:36:02 +0000 (03:36 -0400)]
media: imx-pxp: remove duplicated include from imx-pxp.c

Remove duplicated include.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: Staging: media: replace deprecated probe method
Andrey Abramov [Mon, 1 Oct 2018 10:15:31 +0000 (06:15 -0400)]
media: Staging: media: replace deprecated probe method

Replaced i2c_driver::probe with i2c_driver::probe_new,
because documentation says that probe method is "soon to be deprecated".

Signed-off-by: Andrey Abramov <st5pub@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge: remove another duplicate of io.h and sort includes
Mauro Carvalho Chehab [Wed, 5 Dec 2018 10:02:33 +0000 (05:02 -0500)]
media: ddbridge: remove another duplicate of io.h and sort includes

The io.h was still included twice. Having a large number of
includes like that unsorted is likely the reason why we ended
by having 3 includes of io.h and two includes of interrupt.h
at the first place.

So, let's reorder the includes on alphabetic order. That would
make easier to maintain it.

Fixes: 12645e0655e4 ("media: ddbridge: remove some duplicated include file")
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ddbridge: remove some duplicated include file
zhong jiang [Thu, 20 Sep 2018 04:56:36 +0000 (00:56 -0400)]
media: ddbridge: remove some duplicated include file

interrupt.h and io.h have duplicated include. hence just remove
redundant file.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: tvp5150: fix irq_request error path during probe
Marco Felsch [Tue, 18 Sep 2018 13:14:46 +0000 (09:14 -0400)]
media: tvp5150: fix irq_request error path during probe

Commit 37c65802e76a ("media: tvp5150: Add sync lock interrupt handling")
introduced the interrupt handling. But we have to free the
v4l2_ctrl_handler before we can return the error code.

Fixes: 37c65802e76a ("media: tvp5150: Add sync lock interrupt handling")

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: remove redundant include moduleparam.h
zhong jiang [Tue, 18 Sep 2018 08:24:03 +0000 (04:24 -0400)]
media: remove redundant include moduleparam.h

module.h already contained moduleparam.h,  so it is safe to remove
the redundant include.

The issue is detected with the help of Coccinelle.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: drivers: media: pci: b2c2: Fix errors due to unappropriate coding style.
Iliya Iliev [Sun, 12 Aug 2018 07:23:11 +0000 (03:23 -0400)]
media: drivers: media: pci: b2c2: Fix errors due to unappropriate coding style.

Fix error due to assignment in conditional expression.
Fix errors due to absence of empty spaces separators after commas in
function calls.
Fix errors due to lines longer than 80 characters.

Signed-off-by: Iliya Iliev <iliyailiev3592@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: usb: dvb-usb: remove old friio driver
Corentin Labbe [Wed, 26 Sep 2018 11:44:20 +0000 (07:44 -0400)]
media: usb: dvb-usb: remove old friio driver

friio drivers is unused and un-compilable since
commit b30cc07de8a9 ("media: dvb-usb/friio, dvb-usb-v2/gl861: decompose
friio and merge with gl861"). Let's remove it.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Cc: Akihiro Tsukada <tskd2@yahoo.co.jp>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: lmedm04: use dvb_usbv2_generic_rw_locked
Malcolm Priestley [Thu, 29 Nov 2018 22:30:25 +0000 (17:30 -0500)]
media: lmedm04: use dvb_usbv2_generic_rw_locked

Use dvb-usb-v2 generic usb function for bulk transfers and simplify logic.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: lmedm04: Move usb buffer to lme2510_state.
Malcolm Priestley [Thu, 29 Nov 2018 22:29:51 +0000 (17:29 -0500)]
media: lmedm04: Move usb buffer to lme2510_state.

lme2510_state exists for the entire duration of driver.

Move usb_buffer to lme2510_state removing the need for
lme2510_exit_int for removing the buffer.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dib7000p: Remove dead code
Sean Young [Tue, 4 Dec 2018 09:59:10 +0000 (04:59 -0500)]
media: dib7000p: Remove dead code

Clang warns that 'interleaving' is assigned to itself in this function.

drivers/media/dvb-frontends/dib7000p.c:1874:15: warning: explicitly
assigning value of variable of type 'int' to itself [-Wself-assign]
        interleaving = interleaving;
        ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
1 warning generated.

Just remove the self-assign and leave existing code in place for now.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rtl28xxu: add support for Sony CXD2837ER slave demod
Nikita Gerasimov [Wed, 26 Sep 2018 21:44:45 +0000 (17:44 -0400)]
media: rtl28xxu: add support for Sony CXD2837ER slave demod

Since 2018 some new revisions of RTL2832P based devices having
Sony CXD2837ER as a slave demodulator instead of Panasonic MN88473.
CXD2837ER handled in DVB_CXD2841ER module but it's has a lack of control.
So slave demod has to be reseted by GPIO0 before detecting to woke up
CXD2837ER.

Signed-off-by: Nikita Gerasimov <nikitych@yandex.ru>
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Utilise for_each_uvc_urb iterator
Kieran Bingham [Sat, 27 Jan 2018 23:43:01 +0000 (18:43 -0500)]
media: uvcvideo: Utilise for_each_uvc_urb iterator

A new iterator is available for processing UVC URB structures. This
simplifies the processing of the internal stream data.

Convert the manual loop iterators to the new helper, adding an index
helper to keep the existing debug print.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Rename uvc_{un,}init_video()
Kieran Bingham [Mon, 5 Nov 2018 15:41:09 +0000 (10:41 -0500)]
media: uvcvideo: Rename uvc_{un,}init_video()

We have both uvc_init_video() and uvc_video_init() calls which can be
quite confusing to determine the process for each. Now that video
uvc_video_enable() has been renamed to uvc_video_start_streaming(),
adapt these calls to suit the new flow.

Rename uvc_init_video() to uvc_video_start_transfer() and
uvc_uninit_video() to uvc_video_stop_transfer().

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Split uvc_video_enable into two
Kieran Bingham [Mon, 5 Nov 2018 15:28:24 +0000 (10:28 -0500)]
media: uvcvideo: Split uvc_video_enable into two

uvc_video_enable() is used both to start and stop the video stream
object, however the single function entry point shares no code between
the two operations.

Split the function into two distinct calls, and rename to
uvc_video_start_streaming() and uvc_video_stop_streaming() as
appropriate.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Move decode processing to process context
Kieran Bingham [Wed, 22 Mar 2017 09:42:52 +0000 (05:42 -0400)]
media: uvcvideo: Move decode processing to process context

Newer high definition cameras, and cameras with multiple lenses such as
the range of stereo-vision cameras now available have ever increasing
data rates.

The inclusion of a variable length packet header in URB packets mean
that we must memcpy the frame data out to our destination 'manually'.
This can result in data rates of up to 2 gigabits per second being
processed.

To improve efficiency, and maximise throughput, handle the URB decode
processing through a work queue to move it from interrupt context, and
allow multiple processors to work on URBs in parallel.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Abstract streaming object lifetime
Kieran Bingham [Fri, 9 Nov 2018 14:26:10 +0000 (09:26 -0500)]
media: uvcvideo: Abstract streaming object lifetime

The streaming object is a key part of handling the UVC device. Although
not critical, we are currently missing a call to destroy the mutex on
clean up paths, and we are due to extend the objects complexity in the
near future.

Facilitate easy management of a stream object by creating a pair of
functions to handle creating and destroying the allocation. The new
uvc_stream_delete() function also performs the missing mutex_destroy()
operation.

Previously a failed streaming object allocation would cause
uvc_parse_streaming() to return -EINVAL, which is inappropriate. If the
constructor failes, we will instead return -ENOMEM.

While we're here, fix the trivial spelling error in the function banner
of uvc_delete().

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: queue: Support asynchronous buffer handling
Kieran Bingham [Thu, 16 Mar 2017 13:33:05 +0000 (09:33 -0400)]
media: uvcvideo: queue: Support asynchronous buffer handling

The buffer queue interface currently operates sequentially, processing
buffers after they have fully completed.

In preparation for supporting parallel tasks operating on the buffers,
we will need to support buffers being processed on multiple CPUs.

Adapt the uvc_queue_next_buffer() such that a reference count tracks the
active use of the buffer, returning the buffer to the VB2 stack at
completion.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: queue: Simplify spin-lock usage
Kieran Bingham [Wed, 3 Jan 2018 17:33:49 +0000 (12:33 -0500)]
media: uvcvideo: queue: Simplify spin-lock usage

Both uvc_start_streaming(), and uvc_stop_streaming() are called from
userspace context, with interrupts enabled. As such, they do not need to
save the IRQ state, and can use spin_lock_irq() and spin_unlock_irq()
respectively.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Protect queue internals with helper
Kieran Bingham [Thu, 23 Mar 2017 12:25:14 +0000 (08:25 -0400)]
media: uvcvideo: Protect queue internals with helper

The URB completion operation obtains the current buffer by reading
directly into the queue internal interface.

Protect this queue abstraction by providing a helper
uvc_queue_get_current_buffer() which can be used by both the decode
task, and the uvc_queue_next_buffer() functions.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Convert decode functions to use new context structure
Kieran Bingham [Wed, 15 Mar 2017 09:39:14 +0000 (05:39 -0400)]
media: uvcvideo: Convert decode functions to use new context structure

The URB completion handlers currently reference the stream context.

Now that each URB has its own context structure, convert the decode (and
one encode) functions to utilise this context for URB management.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Refactor URB descriptors
Kieran Bingham [Tue, 14 Mar 2017 22:03:23 +0000 (18:03 -0400)]
media: uvcvideo: Refactor URB descriptors

We currently store three separate arrays for each URB reference we hold.

Objectify the data needed to track URBs into a single uvc_urb structure,
allowing better object management and tracking of the URB.

All accesses to the data pointers through stream, are converted to use a
uvc_urb pointer for consistency.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: seco-cec: add missing header file to fix build
Randy Dunlap [Fri, 30 Nov 2018 16:30:20 +0000 (11:30 -0500)]
media: seco-cec: add missing header file to fix build

Fix build errors due to missing <linux/module.h> header file.
The header file is inserted first because module-related errors
begin showing up in <linux/acpi.h> (when CONFIG_ACPI is not set).

Sample of build errors:

In file included from ../include/linux/acpi.h:27:0,
                 from ../drivers/media/platform/seco-cec/seco-cec.c:10:
../include/linux/device.h:1620:1: warning: data definition has no type or storage class [enabled by default]
 module_exit(__driver##_exit);
 ^
../include/linux/platform_device.h:229:2: note: in expansion of macro 'module_driver'
  module_driver(__platform_driver, platform_driver_register, \
  ^
../drivers/media/platform/seco-cec/seco-cec.c:791:1: note: in expansion of macro 'module_platform_driver'
 module_platform_driver(secocec_driver);
 ^
../include/linux/device.h:1620:1: error: type defaults to 'int' in declaration of 'module_exit' [-Werror=implicit-int]
 module_exit(__driver##_exit);
 ^
../include/linux/platform_device.h:229:2: note: in expansion of macro 'module_driver'
  module_driver(__platform_driver, platform_driver_register, \
  ^
../drivers/media/platform/seco-cec/seco-cec.c:791:1: note: in expansion of macro 'module_platform_driver'
 module_platform_driver(secocec_driver);
 ^
In file included from ../include/linux/linkage.h:7:0,
                 from ../include/linux/kernel.h:7,
                 from ../include/linux/list.h:9,
                 from ../include/linux/resource_ext.h:17,
                 from ../include/linux/acpi.h:26,
                 from ../drivers/media/platform/seco-cec/seco-cec.c:10:
../include/linux/export.h:18:30: warning: parameter names (without types) in function declaration [enabled by default]
 #define THIS_MODULE ((struct module *)0)
                              ^
../include/linux/platform_device.h:199:34: note: in expansion of macro 'THIS_MODULE'
  __platform_driver_register(drv, THIS_MODULE)
                                  ^
../include/linux/device.h:1613:9: note: in expansion of macro 'platform_driver_register'
  return __register(&(__driver) , ##__VA_ARGS__); \
         ^
../include/linux/platform_device.h:229:2: note: in expansion of macro 'module_driver'
  module_driver(__platform_driver, platform_driver_register, \
  ^
../drivers/media/platform/seco-cec/seco-cec.c:791:1: note: in expansion of macro 'module_platform_driver'
 module_platform_driver(secocec_driver);
 ^
../drivers/media/platform/seco-cec/seco-cec.c:793:20: error: expected declaration specifiers or '...' before string constant
 MODULE_DESCRIPTION("SECO CEC X86 Driver");
                    ^
../drivers/media/platform/seco-cec/seco-cec.c:794:15: error: expected declaration specifiers or '...' before string constant
 MODULE_AUTHOR("Ettore Chimenti <ek5.chimenti@gmail.com>");
               ^
../drivers/media/platform/seco-cec/seco-cec.c:795:16: error: expected declaration specifiers or '...' before string constant
 MODULE_LICENSE("Dual BSD/GPL");
                ^
In file included from ../include/linux/acpi.h:27:0,
                 from ../drivers/media/platform/seco-cec/seco-cec.c:10:
../drivers/media/platform/seco-cec/seco-cec.c:791:24: warning: 'secocec_driver_init' defined but not used [-Wunused-function]
 module_platform_driver(secocec_driver);
                        ^
../include/linux/device.h:1611:19: note: in definition of macro 'module_driver'
 static int __init __driver##_init(void) \
                   ^
../drivers/media/platform/seco-cec/seco-cec.c:791:1: note: in expansion of macro 'module_platform_driver'
 module_platform_driver(secocec_driver);

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Ettore Chimenti <ek5.chimenti@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: move the GREY format to the end of the list
Hans Verkuil [Wed, 28 Nov 2018 16:34:51 +0000 (11:34 -0500)]
media: vicodec: move the GREY format to the end of the list

With the GREY format at the beginning, the default format selected
by vicodec would be GREY instead of YUV420. That didn't make sense,
so move it to the end of the list.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: tda7432: fix spelling mistake "maximium" -> "maximum"
Colin Ian King [Wed, 28 Nov 2018 15:34:09 +0000 (10:34 -0500)]
media: tda7432: fix spelling mistake "maximium" -> "maximum"

There is a spelling mistake in the module description as well
as a comment. Fix them.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vivid: add req_validate error injection
Hans Verkuil [Wed, 28 Nov 2018 09:11:52 +0000 (04:11 -0500)]
media: vivid: add req_validate error injection

Add a new vivid button control to inject an error into the
req_validate request callback.

This will help testing with v4l2-compliance.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: adv7604 added include of linux/interrupt.h
Jasmin Jessich [Mon, 26 Nov 2018 22:01:09 +0000 (17:01 -0500)]
media: adv7604 added include of linux/interrupt.h

On older Kernels (prior to 4.15) irqreturn_t and devm_request_threaded_irq
is not defined when compiling adv7604.c. It seems more recent Kernels
include it via another header which is included by adv7604.c.
Now we include linux/interrupt.h explicitly to get the type also defined
for Kernels prior to 4.15.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-pci-skeleton: depend on CONFIG_SAMPLES
Michael Tretter [Mon, 26 Nov 2018 18:01:23 +0000 (13:01 -0500)]
media: v4l2-pci-skeleton: depend on CONFIG_SAMPLES

Commit 0185f8501762 ("[media] samples: v4l: from Documentation to
samples directory") moved the v4l2-pci-skeleton driver to the samples
directory. The samples are only be built, if CONFIG_SAMPLES is enabled.

Therefore, VIDEO_PCI_SKELETON is not enough to build the
v4l2-pci-skeleton driver, but SAMPLES needs to be enabled, too. Let
VIDEO_PCI_SKELETON depend on SAMPLES.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-pci-skeleton: replace vb2_buffer with vb2_v4l2_buffer
Michael Tretter [Mon, 26 Nov 2018 18:01:24 +0000 (13:01 -0500)]
media: v4l2-pci-skeleton: replace vb2_buffer with vb2_v4l2_buffer

Commit 2d7007153f0c ("[media] media: videobuf2: Restructure vb2_buffer")
replaced vb2_buffer with vb2_v4l2_buffer in all v4l2 drivers. The
restructuring skipped the v4l2-pci-skeleton, probably because it resides
outside the drivers directory.

The v4l2_buf_ops assume that the passed buffer is a vb2_v4l2_buffer.
This is not the case if the skel_buffer is based on vb2_buffer instead
of vb2_v4l2_buffer.

Replace vb2_buffer with vb2_v4l2_buffer in the skeleton to make sure
that future drivers that are based on the skeleton use vb2_v4l2_buffer.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: ioctl: Allow drivers to fill in the format description
Sakari Ailus [Mon, 26 Nov 2018 11:07:29 +0000 (06:07 -0500)]
media: v4l: ioctl: Allow drivers to fill in the format description

The v4l_fill_fmtdesc() function does a good job in filling in pixelformat
description. While generally all drivers should depend on this function
doing the job, staging drivers that use their own formats may not.

Allow staging drivers to fill in their own formats by checking whether the
description begins with a non-nil character before issuing the warning.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: Fix MPEG-2 slice Intra DC Precision validation
Jonas Karlman [Sun, 25 Nov 2018 15:21:42 +0000 (10:21 -0500)]
media: v4l: Fix MPEG-2 slice Intra DC Precision validation

intra_dc_precision is a 2-bit integer [1]
allow use of all valid options, 8 - 11 bits precision

[1] ISO/IEC 13818-2 Table 6-13

Fixes: c27bb30e7b6d ("media: v4l: Add definitions for MPEG-2 slice format and metadata")

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: DaVinci-VPBE: fix error handling in vpbe_initialize()
Alexey Khoroshilov [Fri, 23 Nov 2018 21:56:26 +0000 (16:56 -0500)]
media: DaVinci-VPBE: fix error handling in vpbe_initialize()

If vpbe_set_default_output() or vpbe_set_default_mode() fails,
vpbe_initialize() returns error code without releasing resources.

The patch adds error handling for that case.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vivid: fix smatch warnings
Hans Verkuil [Fri, 23 Nov 2018 12:07:33 +0000 (07:07 -0500)]
media: vivid: fix smatch warnings

Reorganize code to fix two smatch warnings:

drivers/media/platform/vivid/vivid-core.c: drivers/media/platform/vivid/vivid-core.c:889 vivid_create_instance() warn: potentially one past the end of array
'dev->query_dv_timings_qmenu[dev->query_dv_timings_size]'
drivers/media/platform/vivid/vivid-core.c: drivers/media/platform/vivid/vivid-core.c:889 vivid_create_instance() warn: potentially one past the end of array
'dev->query_dv_timings_qmenu[dev->query_dv_timings_size]'

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agoMerge tag 'media/v4.20-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Mon, 3 Dec 2018 19:29:20 +0000 (11:29 -0800)]
Merge tag 'media/v4.20-4' of git://git./linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:

 - Revert a dt-bindings patch whose driver didn't make for 4.20

 - fix a kernel oops at vicodec driver

 - fix a frame overflow at gspca with was causing regressions on some
   cameras, making them to not work

 - use the proper type for wait_queue head

 - make media request API compatible with 32-bit userspace on 64-bit
   kernel

 - fix a regression on Kernel 4.19 at dvb-pll

 - don't use SPDX headers yet for GFDL

* tag 'media/v4.20-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: mediactl docs: Fix licensing message
  media: dvb-pll: don't re-validate tuner frequencies
  media: dvb-pll: fix tuner frequency ranges
  media: Revert "media: dt-bindings: Document the Rockchip VPU bindings"
  media: gspca: fix frame overflow error
  media: vicodec: fix memchr() kernel oops
  media: cedrus: add action item to the TODO
  media: media-request: Add compat ioctl
  media: Use wait_queue_head_t for media_request

5 years agomedia: mtk-vcodec: Remove VA from encoder frame buffers
Tomasz Figa [Wed, 21 Nov 2018 06:37:59 +0000 (01:37 -0500)]
media: mtk-vcodec: Remove VA from encoder frame buffers

The encoder driver has no need to do any CPU access to the source frame
buffers. Use a separate structure for holding DMA addresses and sizes
for those and remove, so we do not end up introducing any erroneous
dereferences of those VAs.

This fixes DMA-buf import from exporters that do not provide contiguous
kernel mappings, which includes the MTK DRM driver.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: camss: Take in account sensor skip frames
Todor Tomov [Tue, 13 Nov 2018 14:03:07 +0000 (09:03 -0500)]
media: camss: Take in account sensor skip frames

When streaming is starting ask the sensor for its skip frames value.
Max supported frame skip is 29 frames, so clip it if it is higher.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: adv7180: add g_skip_frames support
Tim Harvey [Wed, 24 Oct 2018 20:25:51 +0000 (16:25 -0400)]
media: adv7180: add g_skip_frames support

The adv7180 produces 1 to 2 frames of garbage before proper sync is
established. This allows V4L2 drivers and apps to skip those.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: em28xx: fix spelling mistake, "Cinnergy" -> "Cinergy"
Colin Ian King [Fri, 12 Oct 2018 15:37:17 +0000 (11:37 -0400)]
media: em28xx: fix spelling mistake, "Cinnergy" -> "Cinergy"

Fix name of the Hybrid T USB XS em28xx card, should be Cinergy.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: exynos4-is: fix spelling mistake ACTURATOR -> ACTUATOR
Colin Ian King [Fri, 12 Oct 2018 14:48:32 +0000 (10:48 -0400)]
media: exynos4-is: fix spelling mistake ACTURATOR -> ACTUATOR

Trivial fix to spelling mistake in macro name and text string
ERROR_SENSOR_ACTURATOR_INIT_FAIL -> ERROR_SENSOR_ACTUATOR_INIT_FAIL

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: TDA1997x: select CONFIG_HDMI
Arnd Bergmann [Tue, 2 Oct 2018 21:12:43 +0000 (17:12 -0400)]
media: i2c: TDA1997x: select CONFIG_HDMI

Without CONFIG_HDMI, we get a link error for this driver:

drivers/media/i2c/tda1997x.o: In function `tda1997x_parse_infoframe':
tda1997x.c:(.text+0x2195): undefined reference to `hdmi_infoframe_unpack'
tda1997x.c:(.text+0x21b6): undefined reference to `hdmi_infoframe_log'
drivers/media/i2c/tda1997x.o: In function `tda1997x_log_infoframe':
tda1997x.c:(.text.unlikely+0x13d3): undefined reference to `hdmi_infoframe_unpack'
tda1997x.c:(.text.unlikely+0x1426): undefined reference to `hdmi_infoframe_log'

All other drivers in this directory that use HDMI select CONFIG_HDMI,
so do the same here:

Fixes: 9ac0038db9a7 ("media: i2c: Add TDA1997x HDMI receiver driver")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Refactor teardown of uvc on USB disconnect
Daniel Axtens [Sun, 23 Apr 2017 04:53:49 +0000 (00:53 -0400)]
media: uvcvideo: Refactor teardown of uvc on USB disconnect

Currently, disconnecting a USB webcam while it is in use prints out a
number of warnings, such as:

WARNING: CPU: 2 PID: 3118 at /build/linux-ezBi1T/linux-4.8.0/fs/sysfs/group.c:237 sysfs_remove_group+0x8b/0x90
sysfs group ffffffffa7cd0780 not found for kobject 'event13'

This has been noticed before. [0]

This is because of the order in which things are torn down.

If there are no streams active during a USB disconnect:

 - uvc_disconnect() is invoked via device_del() through the bus
   notifier mechanism.

 - this calls uvc_unregister_video().

 - uvc_unregister_video() unregisters the video device for each
   stream,

 - because there are no streams open, it calls uvc_delete()

 - uvc_delete() calls uvc_status_cleanup(), which cleans up the status
   input device.

 - uvc_delete() calls media_device_unregister(), which cleans up the
   media device

 - uvc_delete(), uvc_unregister_video() and uvc_disconnect() all
   return, and we end up back in device_del().

 - device_del() then cleans up the sysfs folder for the camera with
   dpm_sysfs_remove(). Because uvc_status_cleanup() and
   media_device_unregister() have already been called, this all works
   nicely.

If, on the other hand, there *are* streams active during a USB disconnect:

 - uvc_disconnect() is invoked

 - this calls uvc_unregister_video()

 - uvc_unregister_video() unregisters the video device for each
   stream,

 - uvc_unregister_video() and uvc_disconnect() return, and we end up
   back in device_del().

 - device_del() then cleans up the sysfs folder for the camera with
   dpm_sysfs_remove(). Because the status input device and the media
   device are children of the USB device, this also deletes their
   sysfs folders.

 - Sometime later, the final stream is closed, invoking uvc_release().

 - uvc_release() calls uvc_delete()

 - uvc_delete() calls uvc_status_cleanup(), which cleans up the status
   input device. Because the sysfs directory has already been removed,
   this causes a WARNing.

 - uvc_delete() calls media_device_unregister(), which cleans up the
   media device. Because the sysfs directory has already been removed,
   this causes another WARNing.

To fix this, we need to make sure the devices are always unregistered
before the end of uvc_disconnect(). To this, move the unregistration
into the disconnect path:

 - split uvc_status_cleanup() into two parts, one on disconnect that
   unregisters and one on delete that frees.

 - move v4l2_device_unregister() and media_device_unregister() into
   the disconnect path.

[0]: https://lkml.org/lkml/2016/12/8/657

[Renamed uvc_input_cleanup() to uvc_input_unregister()]

Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uvcvideo: Add support for the CNF4 format
Sergey Dorodnicov [Wed, 12 Sep 2018 06:42:07 +0000 (02:42 -0400)]
media: uvcvideo: Add support for the CNF4 format

Register the GUID used by Intel RealSense cameras with fourcc CNF4,
encoding depth sensor confidence information for every pixel.

Signed-off-by: Sergey Dorodnicov <sergey.dorodnicov@intel.com>
Signed-off-by: Evgeni Raikhel <evgeni.raikhel@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: Add 4bpp packed depth confidence format CNF4
Sergey Dorodnicov [Wed, 12 Sep 2018 06:42:06 +0000 (02:42 -0400)]
media: v4l: Add 4bpp packed depth confidence format CNF4

Adding new fourcc CNF4 for 4 bit-per-pixel packed depth confidence
information provided by Intel RealSense cameras. Every two consecutive
pixels are packed into a single byte.

Signed-off-by: Sergey Dorodnicov <sergey.dorodnicov@intel.com>
Signed-off-by: Evgeni Raikhel <evgeni.raikhel@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>