linux-2.6-block.git
5 years agomedia: gspca_kinect: cast sizeof to int for comparison
Julia Lawall [Sun, 1 Jul 2018 17:32:05 +0000 (13:32 -0400)]
media: gspca_kinect: cast sizeof to int for comparison

Comparing an int to a size, which is unsigned, causes the int to become
unsigned, giving the wrong result.  kinect_read returns the result of
usb_control_msg, which can return a negtive error code.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
int x;
expression e,e1;
identifier f;
@@

*x = f(...);
... when != x = e1
    when != if (x < 0 || ...) { ... return ...; }
*x < sizeof(e)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: tw686x: Fix oops on buffer alloc failure
Krzysztof Ha?asa [Thu, 28 Jun 2018 21:45:07 +0000 (17:45 -0400)]
media: tw686x: Fix oops on buffer alloc failure

The error path currently calls tw686x_video_free() which requires
vc->dev to be initialized, causing a NULL dereference on uninitizalized
channels.

Fix this by setting the vc->dev fields for all the channels first.

Fixes: f8afaa8dbc0d ("[media] tw686x: Introduce an interface to support multiple DMA modes")

Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: video-i2c: add hwmon support for amg88xx
Matt Ranostay [Thu, 28 Jun 2018 18:11:04 +0000 (14:11 -0400)]
media: video-i2c: add hwmon support for amg88xx

AMG88xx has an on-board thermistor which is used for more accurate
processing of its temperature readings from the 8x8 thermopile array

Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: add missing h.264 levels
Philipp Zabel [Thu, 28 Jun 2018 11:01:47 +0000 (07:01 -0400)]
media: coda: add missing h.264 levels

This enables reordering support for h.264 main profile level 4.2,
5.0, and 5.1 streams. Even though we likely can't play back such
streams at full speed, we should still recognize them correctly.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: use encoder crop rectangle to set visible width and height
Philipp Zabel [Thu, 28 Jun 2018 10:57:54 +0000 (06:57 -0400)]
media: coda: use encoder crop rectangle to set visible width and height

Allow to set a crop rectangle on the encoder output queue to set the
visible resolution as required by the V4L2 codec API.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: streamline framebuffer size calculation a bit
Philipp Zabel [Thu, 28 Jun 2018 10:57:53 +0000 (06:57 -0400)]
media: coda: streamline framebuffer size calculation a bit

Remove the intermediate width and height variables, the calculation is
simple enough.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: move framebuffer size calculation out of loop
Philipp Zabel [Thu, 28 Jun 2018 10:57:52 +0000 (06:57 -0400)]
media: coda: move framebuffer size calculation out of loop

All internal YCbCr frame buffers are the same size, calculate ycbcr_size
once before the allocation loop.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: add the virtual codec driver
Hans Verkuil [Fri, 20 Jul 2018 07:52:50 +0000 (03:52 -0400)]
media: vicodec: add the virtual codec driver

Add the virtual codec driver that uses the Fast Walsh Hadamard Transform.

Keiichi Watanabe contributed the multiplanar support.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Co-Developed-by: Keiichi Watanabe <keiichiw@chromium.org>
Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: add the FWHT software codec
Hans Verkuil [Fri, 20 Jul 2018 07:49:21 +0000 (03:49 -0400)]
media: vicodec: add the FWHT software codec

Add a software codec based on the Fast Walsh Hadamard Transform.

The original FWHT codec was developed by Tom aan de Wiel, and it was
turned into 'proper' kernel code by Hans Verkuil, with a lot of
performance and memory improvements.

Signed-off-by: Tom aan de Wiel <tom.aandewiel@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-mem2mem: add v4l2_m2m_last_buf()
Hans Verkuil [Tue, 26 Jun 2018 13:26:52 +0000 (09:26 -0400)]
media: v4l2-mem2mem: add v4l2_m2m_last_buf()

This can be used to mark the last queued source buffer as the last
buffer.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: videodev.h: add PIX_FMT_FWHT for use with vicodec
Hans Verkuil [Wed, 4 Jul 2018 14:13:47 +0000 (10:13 -0400)]
media: videodev.h: add PIX_FMT_FWHT for use with vicodec

Add a new pixelformat for the vicodec software codec using the
Fast Walsh Hadamard Transform.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media.h: add encoder/decoder functions for codecs
Hans Verkuil [Wed, 4 Jul 2018 14:13:47 +0000 (10:13 -0400)]
media: media.h: add encoder/decoder functions for codecs

Add MEDIA_ENT_F_PROC_VIDEO_EN/DECODER to be used for the encoder
and decoder entities of codec hardware.

[mchehab+samsung@kernel.org: split description on two senteces by adding dots]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media-ioc-enum-entities.rst/-g-topology.rst: clarify ID/name usage
Hans Verkuil [Fri, 29 Jun 2018 11:31:20 +0000 (07:31 -0400)]
media: media-ioc-enum-entities.rst/-g-topology.rst: clarify ID/name usage

Mention that IDs should not be hardcoded in applications and that the
entity name must be unique within the media topology.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media-ioc-enum-links.rst: improve pad index description
Hans Verkuil [Fri, 29 Jun 2018 11:29:52 +0000 (07:29 -0400)]
media: media-ioc-enum-links.rst: improve pad index description

Make it clearer that the index starts at 0.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media/i2c: add missing entity functions
Hans Verkuil [Mon, 18 Jun 2018 09:10:28 +0000 (05:10 -0400)]
media: media/i2c: add missing entity functions

Several drivers in media/i2c do not set the entity function.
Correct this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: adv7180/tvp514x/tvp7002: fix entity function
Hans Verkuil [Mon, 18 Jun 2018 09:09:45 +0000 (05:09 -0400)]
media: adv7180/tvp514x/tvp7002: fix entity function

The entity function was ORed with the flags field instead of
assigned to the function field. Correct this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ad9389b/adv7511: set proper media entity function
Hans Verkuil [Mon, 18 Jun 2018 09:08:20 +0000 (05:08 -0400)]
media: ad9389b/adv7511: set proper media entity function

These two drivers both have function MEDIA_ENT_F_DV_ENCODER.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media.h: reorder video en/decoder functions
Hans Verkuil [Thu, 28 Jun 2018 13:03:42 +0000 (09:03 -0400)]
media: media.h: reorder video en/decoder functions

Keep the function defines in numerical order: 0x6000 comes after
0x2000, so move it back.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media.h: add MEDIA_ENT_F_DV_ENCODER
Hans Verkuil [Mon, 18 Jun 2018 09:07:43 +0000 (05:07 -0400)]
media: media.h: add MEDIA_ENT_F_DV_ENCODER

Add a new function for digital video encoders such as HDMI transmitters.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rename MEDIA_ENT_F_DTV_DECODER to MEDIA_ENT_F_DV_DECODER
Hans Verkuil [Thu, 28 Jun 2018 12:56:02 +0000 (08:56 -0400)]
media: rename MEDIA_ENT_F_DTV_DECODER to MEDIA_ENT_F_DV_DECODER

The use of 'DTV' is very confusing since it normally refers to Digital
TV e.g. DVB etc.

Instead use 'DV' (Digital Video), which nicely corresponds to the
DV Timings API used to configure such receivers and transmitters.

We keep an alias to avoid breaking userspace applications.

Since this alias is only available if __KERNEL__ is *not* defined
(i.e. it is only available for userspace, not kernelspace), any
drivers that use it also have to be converted to the new define.
These drivers are adv7604, adv7842 and tda1997x.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media-ioc-g-topology.rst: document new 'flags' field
Hans Verkuil [Mon, 19 Mar 2018 15:17:17 +0000 (11:17 -0400)]
media: media-ioc-g-topology.rst: document new 'flags' field

Document the new struct media_v2_entity 'flags' field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: add flags field to struct media_v2_entity
Hans Verkuil [Wed, 28 Feb 2018 10:41:11 +0000 (05:41 -0500)]
media: add flags field to struct media_v2_entity

The v2 entity structure never exposed the entity flags, which made it
impossible to detect connector or default entities.

It is really trivial to just expose this information, so implement this.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: media-ioc-g-topology.rst: document new 'index' field
Hans Verkuil [Mon, 19 Mar 2018 15:11:10 +0000 (11:11 -0400)]
media: media-ioc-g-topology.rst: document new 'index' field

Document the new struct media_v2_pad 'index' field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: add 'index' to struct media_v2_pad
Hans Verkuil [Tue, 27 Feb 2018 12:24:09 +0000 (07:24 -0500)]
media: add 'index' to struct media_v2_pad

The v2 pad structure never exposed the pad index, which made it impossible
to call the MEDIA_IOC_SETUP_LINK ioctl, which needs that information.

It is really trivial to just expose this information, so implement this.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cec-gpio: support 5v testing
Hans Verkuil [Thu, 28 Jun 2018 11:44:03 +0000 (07:44 -0400)]
media: cec-gpio: support 5v testing

Add support for the new (optional) 5V gpio in order to debug 5V
changes. Some displays turn off CEC if the 5V is not detected,
so it is useful to be able to monitor this line.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cec: add support for 5V signal testing
Hans Verkuil [Thu, 28 Jun 2018 11:43:46 +0000 (07:43 -0400)]
media: cec: add support for 5V signal testing

Add support for the new 5V CEC events

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: uapi/linux/cec.h: add 5V events
Hans Verkuil [Thu, 28 Jun 2018 11:43:26 +0000 (07:43 -0400)]
media: uapi/linux/cec.h: add 5V events

Add two new events to signal when the 5V line goes high or low.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cec-ioc-dqevent.rst: document the new 5V events
Hans Verkuil [Thu, 28 Jun 2018 14:07:41 +0000 (10:07 -0400)]
media: cec-ioc-dqevent.rst: document the new 5V events

Document the two new 5V events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cec-gpio.txt: add v5-gpios for testing the 5V line
Hans Verkuil [Thu, 28 Jun 2018 11:42:57 +0000 (07:42 -0400)]
media: cec-gpio.txt: add v5-gpios for testing the 5V line

In order to debug the HDMI 5V line we need to add a new v5-gpios
property.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: rcar_fdp1: Enable compilation on Gen2 platforms
Laurent Pinchart [Wed, 11 Jul 2018 14:23:32 +0000 (10:23 -0400)]
media: v4l: rcar_fdp1: Enable compilation on Gen2 platforms

Commit 1d3897143815 ("[media] v4l: rcar_fdp1: add FCP dependency") fixed
a compilation breakage when the optional VIDEO_RENESAS_FCP dependency is
compiled as a module while the rcar_fdp1 driver is built in. As a side
effect it disabled compilation on Gen2 by disallowing the valid
combination ARCH_RENESAS && !VIDEO_RENESAS_FCP. Fix it by handling the
dependency the same way the vsp1 driver did in commit 199946731fa4
("[media] vsp1: clarify FCP dependency").

Fixes: 1d3897143815 ("[media] v4l: rcar_fdp1: add FCP dependency")

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: platform: meson-ao-cec: make busy TX warning silent
Neil Armstrong [Tue, 10 Jul 2018 13:44:57 +0000 (09:44 -0400)]
media: platform: meson-ao-cec: make busy TX warning silent

Switch to dev_dbg for the busy TX message to avoid having a flood of:
[  228.064570] meson-ao-cec c8100100.cec: meson_ao_cec_transmit: busy TX: aborting
[  230.368489] meson-ao-cec c8100100.cec: meson_ao_cec_transmit: busy TX: aborting
[  234.208655] meson-ao-cec c8100100.cec: meson_ao_cec_transmit: busy TX: aborting
[  236.512558] meson-ao-cec c8100100.cec: meson_ao_cec_transmit: busy TX: aborting

This message is only a debug hint and not an error.

Fixes: 7ec2c0f72cb1 ("media: platform: Add Amlogic Meson AO CEC Controller driver")

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: videobuf2-core: check for q->error in vb2_core_qbuf()
Hans Verkuil [Thu, 5 Jul 2018 08:25:19 +0000 (04:25 -0400)]
media: videobuf2-core: check for q->error in vb2_core_qbuf()

The vb2_core_qbuf() function didn't check if q->error was set. It is
checked in __buf_prepare(), but that function isn't called if the buffer
was already prepared before with VIDIOC_PREPARE_BUF.

So check it at the start of vb2_core_qbuf() as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: sh: migor: Remove stale soc_camera include
Jacopo Mondi [Wed, 4 Jul 2018 10:15:46 +0000 (06:15 -0400)]
media: sh: migor: Remove stale soc_camera include

Remove a stale inclusion for the soc_camera header.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mem2mem: Make .job_abort optional
Ezequiel Garcia [Mon, 18 Jun 2018 04:38:52 +0000 (00:38 -0400)]
media: mem2mem: Make .job_abort optional

Implementing job_abort() does not make sense on some drivers.
This is not a problem, as the abort is not required to
wait for the job to finish. Quite the opposite, drivers
are encouraged not to wait.

Demote v4l2_m2m_ops.job_abort from required to optional, and
clean all drivers with dummy implementations.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: s5p-g2d: Remove unrequired wait in .job_abort
Ezequiel Garcia [Mon, 18 Jun 2018 04:38:51 +0000 (00:38 -0400)]
media: s5p-g2d: Remove unrequired wait in .job_abort

As per the documentation, job_abort is not required
to wait until the current job finishes. It is redundant
to do so, as the core will perform the wait operation.

Remove the wait infrastructure completely.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar_jpu: Remove unrequired wait in .job_abort
Ezequiel Garcia [Mon, 18 Jun 2018 04:38:50 +0000 (00:38 -0400)]
media: rcar_jpu: Remove unrequired wait in .job_abort

As per the documentation, job_abort is not required
to wait until the current job finishes. It is redundant
to do so, as the core will perform the wait operation.

Remove the wait infrastructure completely.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Acked-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: video-mux: fix compliance failures
Philipp Zabel [Thu, 24 May 2018 14:50:44 +0000 (10:50 -0400)]
media: video-mux: fix compliance failures

Limit frame sizes to the [1, 65536] interval, media bus formats to
the available list of formats, and initialize pad and try formats.

Reported-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Tested-by: Rui Miguel Silva <rui.silva@linaro.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: Add support for STD ioctls on subdev nodes
Niklas Söderlund [Thu, 17 May 2018 14:30:16 +0000 (10:30 -0400)]
media: v4l: Add support for STD ioctls on subdev nodes

There is no way to control the standard of subdevices which are part of
a media device. The ioctls which exists all target video devices
explicitly and the idea is that the video device should talk to the
subdevice. For subdevices part of a media graph this is not possible and
the standard must be controlled on the subdev device directly.

Add four new ioctls to be able to directly interact with subdevices and
control the video standard; VIDIOC_SUBDEV_ENUMSTD, VIDIOC_SUBDEV_G_STD,
VIDIOC_SUBDEV_S_STD and VIDIOC_SUBDEV_QUERYSTD.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: i2c: Replace "sensor-level" by "sensor"
Sakari Ailus [Mon, 16 Jul 2018 15:20:33 +0000 (11:20 -0400)]
media: v4l: i2c: Replace "sensor-level" by "sensor"

A lot of sensor drivers are labelled as "sensor-level" drivers. That's
odd and somewhat confusing as the term isn't used elsewhere: these are
just sensor drivers. Call them such.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: ov7670: Put ep fwnode after use
Jacopo Mondi [Thu, 31 May 2018 17:35:03 +0000 (13:35 -0400)]
media: i2c: ov7670: Put ep fwnode after use

The just parsed endpoint fwnode has to be put after use.
Currently this is done only in error handling path. Fix that by
putting node unconditionally after use.

Fixes: 01b8444828fc ("media: v4l2: i2c: ov7670: Implement OF mbus configuration")

Signed-off-by: Jacopo Mondi <jacopo+renesas@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: ov5645: Supported external clock is 24MHz
Todor Tomov [Mon, 18 Jun 2018 08:06:58 +0000 (04:06 -0400)]
media: ov5645: Supported external clock is 24MHz

The external clock frequency was set to 23.88MHz by mistake
because of a platform which cannot get closer to 24MHz.
The supported by the driver external clock is 24MHz so
set it correctly and also fix the values of the pixel
clock and link clock.
However allow 1% tolerance to the external clock as this
difference is small enough to be insignificant.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Handle data-enable polarity
Jacopo Mondi [Mon, 9 Jul 2018 14:19:21 +0000 (10:19 -0400)]
media: rcar-vin: Handle data-enable polarity

Handle data-enable signal polarity. If the polarity is not specifically
requested to be active low, use the active high default.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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: rcar-vin: Add 'data-enable-active'
Jacopo Mondi [Mon, 9 Jul 2018 14:19:20 +0000 (10:19 -0400)]
media: dt-bindings: media: rcar-vin: Add 'data-enable-active'

Describe optional endpoint property 'data-enable-active' for R-Car VIN.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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: parse 'data-enable-active' prop
Jacopo Mondi [Mon, 9 Jul 2018 14:19:19 +0000 (10:19 -0400)]
media: v4l2-fwnode: parse 'data-enable-active' prop

Parse the newly defined 'data-enable-active' property in parallel
endpoint parsing function.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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: Document data-enable-active property
Jacopo Mondi [Mon, 9 Jul 2018 14:19:18 +0000 (10:19 -0400)]
media: dt-bindings: media: Document data-enable-active property

Add 'data-enable-active' property to endpoint node properties list.

The property allows to specify the polarity of the data-enable signal,
which when in active state determinates when data lines have to sampled
for valid pixel data.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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: rcar-vin: Describe optional ep properties
Jacopo Mondi [Mon, 9 Jul 2018 14:19:17 +0000 (10:19 -0400)]
media: dt-bindings: media: rcar-vin: Describe optional ep properties

Describe the optional endpoint properties for endpoint nodes of the R-Car
VIN interface device tree bindings documentation.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
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: rcar-vin: Align Gen2 and Gen3
Jacopo Mondi [Mon, 9 Jul 2018 14:19:16 +0000 (10:19 -0400)]
media: dt-bindings: media: rcar-vin: Align Gen2 and Gen3

Align description of the Gen2 and Gen3 bindings for parallel input.
This commit prepares for description of optional endpoint properties in ports
subnodes accepting parallel video connections.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: smiapp: fix debug message
Luca Ceresoli [Thu, 5 Jul 2018 14:41:11 +0000 (10:41 -0400)]
media: smiapp: fix debug message

ask_h gets printed here instead of ask_w.

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: ov5640: do not change mode if format or frame interval is unchanged
Hugues Fruchet [Wed, 4 Jul 2018 13:04:38 +0000 (09:04 -0400)]
media: ov5640: do not change mode if format or frame interval is unchanged

Save load of mode registers array when V4L2 client sets a format or a
frame interval which selects the same mode than the current one.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: smiapp: Set correct MODULE_LICENSE
Sakari Ailus [Tue, 3 Jul 2018 13:54:39 +0000 (09:54 -0400)]
media: smiapp: Set correct MODULE_LICENSE

The smiapp driver is licensed under GNU GPL v2 only, as stated by the
header. Reflect this in the MODULE_LICENSE macro.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: bpf: ensure bpf program is freed on detach
Sean Young [Wed, 4 Jul 2018 14:57:58 +0000 (10:57 -0400)]
media: bpf: ensure bpf program is freed on detach

Currently we are leaking bpf programs when they are detached from the
lirc device; the refcount never reaches zero.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt()
Sylwester Nawrocki [Tue, 15 May 2018 09:21:45 +0000 (05:21 -0400)]
media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt()

This patch fixes potential NULL pointer dereference as indicated
by the following static checker warning:

drivers/media/platform/exynos4-is/fimc-isp-video.c:408 isp_video_try_fmt_mplane()
error: NULL dereference inside function '__isp_video_try_fmt(isp, &f->fmt.pix_mp, (0))()'.

Fixes: 34947b8aebe3: ("[media] exynos4-is: Add the FIMC-IS ISP capture DMA driver")

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: platform: s5p-mfc: simplify getting .drvdata
Wolfram Sang [Thu, 19 Apr 2018 14:05:57 +0000 (10:05 -0400)]
media: platform: s5p-mfc: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: platform: exynos4-is: simplify getting .drvdata
Wolfram Sang [Thu, 19 Apr 2018 14:05:56 +0000 (10:05 -0400)]
media: platform: exynos4-is: simplify getting .drvdata

We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: tuner-simple: allow setting mono radio mode
Maciej S. Szmigiero [Mon, 2 Jul 2018 21:23:24 +0000 (17:23 -0400)]
media: tuner-simple: allow setting mono radio mode

For some types of tuners (Philips FMD1216ME(X) MK3 currently) we know that
letting TDA9887 output port 1 remain high (inactive) will switch FM radio
to mono mode.
Let's make use of this functionality - nothing changes for the default
stereo radio mode.

Tested on a Medion 95700 board which has a FMD1216ME tuner.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cx25840: add kernel-doc description of struct cx25840_state
Maciej S. Szmigiero [Mon, 2 Jul 2018 21:23:22 +0000 (17:23 -0400)]
media: cx25840: add kernel-doc description of struct cx25840_state

This commit describes a device instance private data of the driver
(struct cx25840_state) in a kernel-doc style comment.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ivtv: zero-initialize cx25840 platform data
Maciej S. Szmigiero [Mon, 2 Jul 2018 21:23:21 +0000 (17:23 -0400)]
media: ivtv: zero-initialize cx25840 platform data

We need to zero-initialize cx25840 platform data structure to make sure
that its future members do not contain random stack garbage.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mtk-vcodec: Support VP9 profile in decoder
Keiichi Watanabe [Mon, 18 Jun 2018 07:58:54 +0000 (03:58 -0400)]
media: mtk-vcodec: Support VP9 profile in decoder

Add V4L2_CID_MPEG_VIDEO_VP9_PROFILE control in MediaTek decoder's
driver. MediaTek decoder only supports profile 0 for now.

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-ctrl: Add control for VP9 profile
Keiichi Watanabe [Mon, 18 Jun 2018 07:58:53 +0000 (03:58 -0400)]
media: v4l2-ctrl: Add control for VP9 profile

Add a new control V4L2_CID_MPEG_VIDEO_VP9_PROFILE for VP9 profiles. This control
allows selecting the desired profile for VP9 encoder and querying for supported
profiles by VP9 encoder/decoder.

Though this control is similar to V4L2_CID_MPEG_VIDEO_VP8_PROFILE, we need to
separate this control from it because supported profiles usually differ between
VP8 and VP9.

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-ctrl: Change control for VP8 profile to menu control
Keiichi Watanabe [Mon, 18 Jun 2018 07:58:52 +0000 (03:58 -0400)]
media: v4l2-ctrl: Change control for VP8 profile to menu control

Add a menu control V4L2_CID_MPEG_VIDEO_VP8_PROFILE for VP8 profile and make
V4L2_CID_MPEG_VIDEO_VPX_PROFILE an alias of it. This new control is used to
select the desired profile for VP8 encoder and query for supported profiles by
VP8 encoder/decoder.

Though we have originally a control V4L2_CID_MPEG_VIDEO_VPX_PROFILE and its name
contains 'VPX', it works only for VP8 because supported profiles usually differ
between VP8 and VP9. In addition, this control cannot be used for querying since
it is not a menu control but an integer control, which cannot return an
arbitrary set of supported profiles.

The new control V4L2_CID_MPEG_VIDEO_VP8_PROFILE is a menu control as with
controls for other codec profiles. (e.g. H264)

In addition, this patch also fixes the use of V4L2_CID_MPEG_VIDEO_VPX_PROFILE in
drivers of Qualcomm's venus and Samsung's s5p-mfc.

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: add support for RGB565_2X8 on parallel bus
Jan Luebbe [Fri, 18 May 2018 13:56:39 +0000 (09:56 -0400)]
media: imx: add support for RGB565_2X8 on parallel bus

The IPU can only capture RGB565 with two 8-bit cycles in bayer/generic
mode on the parallel bus, compared to a specific mode on MIPI CSI-2.
To handle this, we extend imx_media_pixfmt with a cycles per pixel
field, which is used for generic formats on the parallel bus.

Based on the selected format and bus, we then update the width to
account for the multiple cycles per pixel.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: capture: refactor enum_/try_fmt
Jan Luebbe [Fri, 18 May 2018 13:56:38 +0000 (09:56 -0400)]
media: imx: capture: refactor enum_/try_fmt

By checking and handling the internal IPU formats (ARGB or AYUV) first,
we don't need to check whether it's a bayer format, as we can default to
passing the input format on in all other cases.

This simplifies handling the different configurations for RGB565 between
parallel and MIPI CSI-2, as we don't need to check the details of the
format anymore.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging/imx: fill vb2_v4l2_buffer sequence entry
Peter Seiderer [Thu, 15 Mar 2018 19:13:23 +0000 (15:13 -0400)]
media: staging/imx: fill vb2_v4l2_buffer sequence entry

- enables gstreamer v4l2src lost frame detection, e.g:

  0:00:08.685185668  348  0x54f520 WARN  v4l2src gstv4l2src.c:970:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 141 - ts: 0:00:08.330177332

- fixes v4l2-compliance test failure:

  Streaming ioctls:
          test read/write: OK (Not Supported)
              Video Capture:
                  Buffer: 0 Sequence: 0 Field: None Timestamp: 92.991450s
                  Buffer: 1 Sequence: 0 Field: None Timestamp: 93.008135s
                  fail: v4l2-test-buffers.cpp(294): (int)g_sequence() < seq.last_seq + 1
                  fail: v4l2-test-buffers.cpp(707): buf.check(q, last_seq)

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging/imx: fill vb2_v4l2_buffer field entry
Peter Seiderer [Thu, 15 Mar 2018 19:13:22 +0000 (15:13 -0400)]
media: staging/imx: fill vb2_v4l2_buffer field entry

- fixes gstreamer v4l2src warning:

  0:00:00.716640334  349  0x164f720 WARN  v4l2bufferpool gstv4l2bufferpool.c:1195:gst_v4l2_buffer_pool_dqbuf:<v4l2src0:pool:src> Driver should never set v4l2_buffer.field to ANY

- fixes v4l2-compliance test failure:

  Streaming ioctls:
          test read/write: OK (Not Supported)
              Video Capture:
                  Buffer: 0 Sequence: 0 Field: Any Timestamp: 58.383658s
                  fail: v4l2-test-buffers.cpp(297): g_field() == V4L2_FIELD_ANY

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: media: rcar-vin: Add R8A77995 support
Jacopo Mondi [Wed, 4 Jul 2018 08:51:36 +0000 (04:51 -0400)]
media: dt-bindings: media: rcar-vin: Add R8A77995 support

Add compatible string for R-Car D3 R8A7795 to list of SoCs supported by
rcar-vin driver.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Add support for R-Car R8A77995 SoC
Jacopo Mondi [Tue, 12 Jun 2018 09:43:32 +0000 (05:43 -0400)]
media: rcar-vin: Add support for R-Car R8A77995 SoC

Add R-Car R8A77995 SoC to the rcar-vin supported ones.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Rename _rcar_info to rcar_info
Jacopo Mondi [Tue, 12 Jun 2018 09:43:31 +0000 (05:43 -0400)]
media: rcar-vin: Rename _rcar_info to rcar_info

Remove leading underscore to align all rcar_group_route structure
declarations.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Handle parallel subdev in link_notify
Jacopo Mondi [Tue, 12 Jun 2018 09:43:30 +0000 (05:43 -0400)]
media: rcar-vin: Handle parallel subdev in link_notify

Handle parallel subdevices in link_notify callback. If the notified link
involves a parallel subdevice, do not change routing of the VIN-CSI-2
devices and mark the VIN instance as using a parallel input. If the
CSI-2 link setup succeeds instead, mark the VIN instance as using CSI-2.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Link parallel input media entities
Jacopo Mondi [Tue, 12 Jun 2018 09:43:29 +0000 (05:43 -0400)]
media: rcar-vin: Link parallel input media entities

When running with media-controller link the parallel input
media entities with the VIN entities at 'complete' callback time.

To create media links the v4l2_device should be registered first.
Check if the device is already registered, to avoid double registrations.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Parse parallel input on Gen3
Jacopo Mondi [Tue, 12 Jun 2018 09:43:28 +0000 (05:43 -0400)]
media: rcar-vin: Parse parallel input on Gen3

The rcar-vin driver so far had a mutually exclusive code path for
handling parallel and CSI-2 video input subdevices, with only the CSI-2
use case supporting media-controller. As we add support for parallel
inputs to Gen3 media-controller compliant code path now parse both port@0
and port@1, handling the media-controller use case in the parallel
bound/unbind notifier operations.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Cache the mbus configuration flags
Jacopo Mondi [Tue, 12 Jun 2018 09:43:27 +0000 (05:43 -0400)]
media: rcar-vin: Cache the mbus configuration flags

Media bus configuration flags and media bus type were so far a property
of each VIN instance, as the subdevice they were connected to was
immutable during the whole system life time.

With the forth-coming introduction of parallel input devices support,
a VIN instance can have the subdevice it is connected to switched at
runtime, from a CSI-2 subdevice to a parallel one and viceversa, through
the modification of links between media entities in the media controller
graph. To avoid discarding the per-subdevice configuration flags retrieved by
v4l2_fwnode parsing facilities, cache them in the 'rvin_graph_entity'
member of each VIN instance, opportunely renamed to 'rvin_parallel_entity'.

Also modify the register configuration function to take mbus flags into
account when running on a bus type that supports them.

The media bus type currently in use will be updated in a follow-up patch
to the link state change notification function.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Cleanup notifier in error path
Jacopo Mondi [Tue, 12 Jun 2018 09:43:26 +0000 (05:43 -0400)]
media: rcar-vin: Cleanup notifier in error path

During the notifier initialization, memory for the list of associated async
subdevices is reserved during the fwnode endpoint parsing from the v4l2-async
framework. If the notifier registration fails, that memory should be released
and the notifier 'cleaned up'.

Catch the notifier registration error and perform the cleanup both for the
group and the parallel notifiers.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Create a group notifier
Jacopo Mondi [Tue, 12 Jun 2018 09:43:25 +0000 (05:43 -0400)]
media: rcar-vin: Create a group notifier

As CSI-2 subdevices are shared between several VIN instances, a shared
notifier to collect the CSI-2 async subdevices is required. So far, the
rcar-vin driver used the notifier of the last VIN instance to probe but
with the forth-coming introduction of parallel input subdevices support
in mc-compliant code path, each VIN may register its own notifier if any
parallel subdevice is connected there.

To avoid registering a notifier twice (once for parallel subdev and one
for the CSI-2 subdevs) create a group notifier, shared by all the VIN
instances.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Remove two empty lines
Jacopo Mondi [Tue, 12 Jun 2018 09:43:24 +0000 (05:43 -0400)]
media: rcar-vin: Remove two empty lines

Remove un-necessary empty lines.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Rename 'digital' to 'parallel'
Jacopo Mondi [Tue, 12 Jun 2018 09:43:23 +0000 (05:43 -0400)]
media: rcar-vin: Rename 'digital' to 'parallel'

As the term 'digital' is used all over the rcar-vin code in place of
'parallel', rename all the occurrencies.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vim2m: add media device
Hans Verkuil [Mon, 2 Jul 2018 15:36:06 +0000 (11:36 -0400)]
media: vim2m: add media device

Request API requires a media node. Add one to the vim2m driver so we can
use requests with it.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: add helpers for memory-to-memory media controller
Ezequiel Garcia [Mon, 2 Jul 2018 15:36:05 +0000 (11:36 -0400)]
media: add helpers for memory-to-memory media controller

A memory-to-memory pipeline device consists in three
entities: two DMA engine and one video processing entities.
The DMA engine entities are linked to a V4L interface.

This commit add a new v4l2_m2m_{un}register_media_controller
API to register this topology.

For instance, a typical mem2mem device topology would
look like this:

Device topology
- entity 1: source (1 pad, 1 link)
            type Node subtype V4L flags 0
pad0: Source
-> "proc":1 [ENABLED,IMMUTABLE]

- entity 3: proc (2 pads, 2 links)
            type Node subtype Unknown flags 0
pad0: Source
-> "sink":0 [ENABLED,IMMUTABLE]
pad1: Sink
<- "source":0 [ENABLED,IMMUTABLE]

- entity 6: sink (1 pad, 1 link)
            type Node subtype V4L flags 0
pad0: Sink
<- "proc":0 [ENABLED,IMMUTABLE]

[hans.verkuil@cisco.com: mark interface links as IMMUTABLE]

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mark entity-intf links as IMMUTABLE
Hans Verkuil [Mon, 2 Jul 2018 12:43:02 +0000 (08:43 -0400)]
media: mark entity-intf links as IMMUTABLE

Currently links between entities and an interface are just marked as
ENABLED. But (at least today) these links cannot be disabled by userspace
or the driver, so they should also be marked as IMMUTABLE.

It might become possible that drivers can disable such links (if for some
reason the device node cannot be used), so we might need to add a new link
flag at some point to mark interface links that can be changed by the driver
but not by userspace.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-ctrls.c: fix broken auto cluster handling
Hans Verkuil [Fri, 29 Jun 2018 10:12:43 +0000 (06:12 -0400)]
media: v4l2-ctrls.c: fix broken auto cluster handling

When you switch from auto to manual mode for an auto-cluster (e.g.
autogain+gain controls), then the current HW value has to be copied
to the current control value. However, has_changed was never set to
true, so new_to_cur didn't actually copy this value.

Reported-by: Hugues FRUCHET <hugues.fruchet@st.com>
Tested-by: Hugues FRUCHET <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: fsl-viu: fix error handling in viu_of_probe()
Alexey Khoroshilov [Fri, 29 Jun 2018 21:49:22 +0000 (17:49 -0400)]
media: fsl-viu: fix error handling in viu_of_probe()

viu_of_probe() ignores fails in i2c_get_adapter(),
tries to unlock uninitialized mutex on error path.

The patch streamlining the error handling in viu_of_probe().

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: mark CODA960 firmware version 2.1.9 as supported
Philipp Zabel [Fri, 29 Jun 2018 12:47:20 +0000 (08:47 -0400)]
media: coda: mark CODA960 firmware version 2.1.9 as supported

This patch adds the i.MX6 CODA960 firmware versions 2.1.9
(revision 32515) to the list of supported firmware versions.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: jpeg: explicitly disable thumbnails in SEQ_INIT
Philipp Zabel [Fri, 29 Jun 2018 12:46:48 +0000 (08:46 -0400)]
media: coda: jpeg: explicitly disable thumbnails in SEQ_INIT

Explicitly clear DEC_SEQ_JPG_THUMB_EN during sequence initialization.
Not clearing the register does not cause problems, since the only other
codec (MPEG-4 decode) that writes to this register happens to always
write 0 as well.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: jpeg: only queue two buffers into the bitstream for JPEG on CODA7541
Philipp Zabel [Fri, 29 Jun 2018 12:46:47 +0000 (08:46 -0400)]
media: coda: jpeg: only queue two buffers into the bitstream for JPEG on CODA7541

Padding the bitstream buffer is not enough to reliably avoid prefetch
failures.  Picture runs with the next buffer's header already visible to
the CODA7541 succeed much more reliably, so always queue two JPEG frames
into the bitstream buffer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: jpeg: allow non-JPEG colorspace
Philipp Zabel [Fri, 29 Jun 2018 12:46:46 +0000 (08:46 -0400)]
media: coda: jpeg: allow non-JPEG colorspace

The hardware codec is not colorspace aware. We should trust userspace to
set the correct colorimetry information on the OUTPUT queue and mirror
the exact same setting on the CAPTURE queue.

There is no reason to restrict colorspace to JPEG for JPEG images, if
userspace injects the correct colorspace information into the JPEG
headers after encoding.

Fixes: b14ac545688d ("[media] coda: improve colorimetry handling")

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: clear hold flag on streamoff
Philipp Zabel [Fri, 29 Jun 2018 12:42:08 +0000 (08:42 -0400)]
media: coda: clear hold flag on streamoff

If new buffers are queued after streamoff, the flag will be cleared
anyway, so this is mostly for the purpose of correctness.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vivid: fix gain when autogain is on
Hans Verkuil [Fri, 29 Jun 2018 09:40:41 +0000 (05:40 -0400)]
media: vivid: fix gain when autogain is on

In the vivid driver you want gain to continuous change while autogain
is on. However, dev->jiffies_vid_cap doesn't actually change. It probably
did in the past, but changes in the code caused this to be a fixed value
that is only set when you start streaming.

Replace it by jiffies, which is always changing.

[mchehab@kernel.org: use jiffies_to_msecs() instead of dividing by HZ]

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: fix reorder detection for unknown levels
Philipp Zabel [Thu, 28 Jun 2018 15:47:09 +0000 (11:47 -0400)]
media: coda: fix reorder detection for unknown levels

Whether reordering should be enabled only depends on the h.264 profile.
Stop parsing the level and drop the debug message, profile and level
can now be determined via read-only decoder controls.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: add read-only h.264 decoder profile/level controls
Philipp Zabel [Thu, 28 Jun 2018 15:47:08 +0000 (11:47 -0400)]
media: coda: add read-only h.264 decoder profile/level controls

The decoder profile/level controls initially can be used to determine
supported profiles and levels. The values are set for a given stream
once the headers are parsed.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: fix encoder source stride
Philipp Zabel [Thu, 28 Jun 2018 15:44:12 +0000 (11:44 -0400)]
media: coda: fix encoder source stride

The encoder picture run command takes a picture source stride parameter.
This must be set to the output queue's bytesperline, not width.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-ctrls: Fix CID base conflict between MAX217X and IMX
Steve Longerbeam [Wed, 27 Jun 2018 18:39:43 +0000 (14:39 -0400)]
media: v4l2-ctrls: Fix CID base conflict between MAX217X and IMX

When the imx-media driver was initially merged, there was a conflict
with 8d67ae25 ("media: v4l2-ctrls: Reserve controls for MAX217X") which
was not fixed up correctly, resulting in V4L2_CID_USER_MAX217X_BASE and
V4L2_CID_USER_IMX_BASE taking on the same value. Fix by assigning imx
CID base the next available range at 0x10b0.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: stk1160: Set the vb2_queue lock before calling vb2_queue_init
Ezequiel Garcia [Fri, 15 Jun 2018 19:07:32 +0000 (15:07 -0400)]
media: stk1160: Set the vb2_queue lock before calling vb2_queue_init

The vb2_queue will soon be mandatory. The videobuf2 core
will throw a verbose warning if it's not set.

The stk1160 driver is setting the queue lock, but after
the vb2_queue_init call. Avoid the warning by setting
the lock before the queue initialization.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: m2m-deinterlace: Implement wait_prepare and wait_finish
Ezequiel Garcia [Fri, 15 Jun 2018 19:07:31 +0000 (15:07 -0400)]
media: m2m-deinterlace: Implement wait_prepare and wait_finish

This driver is currently specifying a video_device lock,
which means it is protecting all the ioctls (including
queue ioctls) with a single mutex.

It's therefore straightforward to implement wait_prepare
and wait_finish, by explicitly setting the vb2_queue lock.

Having these callbacks releases the queue lock while blocking,
which improves latency by allowing for example streamoff
or qbuf operations while waiting in dqbuf.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mx_emmaprp: Implement wait_prepare and wait_finish
Ezequiel Garcia [Fri, 15 Jun 2018 19:07:30 +0000 (15:07 -0400)]
media: mx_emmaprp: Implement wait_prepare and wait_finish

This driver is currently specifying a video_device lock,
which means it is protecting all the ioctls (including
queue ioctls) with a single mutex.

It's therefore straightforward to implement wait_prepare
and wait_finish, by explicitly setting the vb2_queue lock.

Having these callbacks releases the queue lock while blocking,
which improves latency by allowing for example streamoff
or qbuf operations while waiting in dqbuf.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: davinci_vpfe: Add video_device and vb2_queue locks
Ezequiel Garcia [Fri, 15 Jun 2018 19:07:29 +0000 (15:07 -0400)]
media: davinci_vpfe: Add video_device and vb2_queue locks

Currently, this driver does not serialize its video4linux
ioctls, which is a bug, as race conditions might appear.

In addition, video_device and vb2_queue locks are now both
mandatory. Add them, and implement wait_prepare and
wait_finish.

To stay on the safe side, this commit uses a single mutex
for both locks. Better latency can be obtained by separating
these if needed.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: staging: bcm2835-camera: Provide lock for vb2_queue
Ezequiel Garcia [Fri, 15 Jun 2018 19:07:27 +0000 (15:07 -0400)]
media: staging: bcm2835-camera: Provide lock for vb2_queue

Use the device mutex to protect the vb2_queue.
This allows to replace the ad-hoc wait_{prepare, finish}
with vb2_ops_wait_{prepare, finish}.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: s5p-g2d: Implement wait_prepare and wait_finish
Ezequiel Garcia [Fri, 15 Jun 2018 19:07:26 +0000 (15:07 -0400)]
media: s5p-g2d: Implement wait_prepare and wait_finish

This driver is currently specifying a vb2_queue lock,
which means it straightforward to implement wait_prepare
and wait_finish.

Having these callbacks releases the queue lock while blocking,
which improves latency by allowing for example streamoff
or qbuf operations while waiting in dqbuf.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mtk-mdp: Add locks for capture and output vb2_queues
Ezequiel Garcia [Fri, 15 Jun 2018 19:07:25 +0000 (15:07 -0400)]
media: mtk-mdp: Add locks for capture and output vb2_queues

Use the mutex in struct mtk_mdp_ctx to protect the
capture and output  vb2_queues. This allows to replace
the ad-hoc wait_{prepare, finish} with
vb2_ops_wait_{prepare, finish}.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: sta2x11: Add video_device and vb2_queue locks
Ezequiel Garcia [Fri, 15 Jun 2018 19:07:22 +0000 (15:07 -0400)]
media: sta2x11: Add video_device and vb2_queue locks

Currently, this driver does not serialize its video4linux
ioctls, which is a bug, as race conditions might appear.

In addition, video_device and vb2_queue locks are now both
mandatory. Add them, and implement wait_prepare and
wait_finish.

To stay on the safe side, this commit uses a single mutex
for both locks. Better latency can be obtained by separating
these if needed.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l2-ioctl.c: use correct vb2_queue lock for m2m devices
Hans Verkuil [Fri, 15 Jun 2018 19:07:21 +0000 (15:07 -0400)]
media: v4l2-ioctl.c: use correct vb2_queue lock for m2m devices

For m2m devices the vdev->queue lock was always taken instead of the
lock for the specific capture or output queue. Now that we pushed
the locking down into __video_do_ioctl() we can pick the correct
lock and potentially improve the performance of m2m devices.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx274: fix typo
Luca Ceresoli [Mon, 11 Jun 2018 11:35:38 +0000 (07:35 -0400)]
media: imx274: fix typo

pd -> pad

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>