]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
5 years agomedia: vicodec: Separate fwht header from the frame data
Dafna Hirschfeld [Mon, 21 Jan 2019 11:46:17 +0000 (09:46 -0200)]
media: vicodec: Separate fwht header from the frame data

Keep the fwht header in separated field from the data.
Refactor job_ready to use a new function 'get_next_header'

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: vicodec: Add pixel encoding flags to fwht header
Dafna Hirschfeld [Mon, 21 Jan 2019 11:46:16 +0000 (09:46 -0200)]
media: vicodec: Add pixel encoding flags to fwht header

Add flags indicating the pixel encoding - yuv/rgb/hsv to
fwht header and to the pixel info. Use it to enumerate
the supported pixel formats.

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: vicodec: use 3 bits for the number of components
Dafna Hirschfeld [Mon, 21 Jan 2019 11:46:15 +0000 (09:46 -0200)]
media: vicodec: use 3 bits for the number of components

Use 3 bits for the number of components mask in the fwht
header flags

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: vicodec: add support for CROP and COMPOSE selection
Dafna Hirschfeld [Mon, 21 Jan 2019 11:46:14 +0000 (09:46 -0200)]
media: vicodec: add support for CROP and COMPOSE selection

Add support for the selection api for the crop and compose targets.
The driver rounds up the coded width and height such that
all planes dimensions are multiple of 8.

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: vicodec: Add num_planes field to v4l2_fwht_pixfmt_info
Dafna Hirschfeld [Sun, 20 Jan 2019 13:29:02 +0000 (11:29 -0200)]
media: vicodec: Add num_planes field to v4l2_fwht_pixfmt_info

Add the field 'num_planes' to 'v4l2_fwht_pixfmt_info' struct.

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: Documentation/media: rename "Codec Interface"
Hans Verkuil [Wed, 23 Jan 2019 08:07:20 +0000 (06:07 -0200)]
media: Documentation/media: rename "Codec Interface"

The "Codec Interface" chapter is poorly named since codecs are just one
use-case of the Memory-to-Memory Interface. Rename it and clean up the
text a bit.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dev-teletext.rst: remove obsolete teletext interface
Hans Verkuil [Tue, 22 Jan 2019 11:27:26 +0000 (09:27 -0200)]
media: dev-teletext.rst: remove obsolete teletext interface

The teletext interface has been dead for years now, just
remove it.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dev-effect.rst: remove unused Effect Interface chapter
Hans Verkuil [Tue, 22 Jan 2019 11:27:25 +0000 (09:27 -0200)]
media: dev-effect.rst: remove unused Effect Interface chapter

We never had an effect interface, and if you want to do such
things you use the mem2mem interface instead.

Just drop this from the spec.

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.c: fix outdated irq code
Hans Verkuil [Mon, 21 Jan 2019 11:14:32 +0000 (09:14 -0200)]
media: v4l2-pci-skeleton.c: fix outdated irq code

Fix the outdated irq example code. It is under an #ifdef TODO
so it is never actually compiled and this code was never compiled.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: venus: helpers: drop setting of timestamp invalid flag
Stanimir Varbanov [Fri, 7 Dec 2018 13:04:13 +0000 (11:04 -0200)]
media: venus: helpers: drop setting of timestamp invalid flag

The zero timestamp is really valid so fix that mistake by
dropping the code which checks for zero timestamp.

Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: venus: core: correct frequency table for sdm845
Stanimir Varbanov [Thu, 6 Dec 2018 16:00:15 +0000 (14:00 -0200)]
media: venus: core: correct frequency table for sdm845

This corrects clock frequency table rates to be in sync
with video clock controller frequency table.

Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: venus: core: correct maximum hardware load for sdm845
Stanimir Varbanov [Thu, 6 Dec 2018 13:52:45 +0000 (11:52 -0200)]
media: venus: core: correct maximum hardware load for sdm845

This correct maximum hardware load constant in per SoC resources
for sdm845 aka Venus v4.

Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: venus: firmware: check fw size against DT memory region size
Stanimir Varbanov [Thu, 6 Dec 2018 13:28:43 +0000 (11:28 -0200)]
media: venus: firmware: check fw size against DT memory region size

By historical reasons we defined firmware memory size to be 6MB even
that the firmware size for all supported Venus versions is 5MBs. Correct
that by compare the required firmware size returned from mdt loader and
the one provided by DT reserved memory region. We proceed further if the
required firmware size is smaller than provided by DT memory region.

Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov2640: fix initial try format
Akinobu Mita [Tue, 22 Jan 2019 13:42:59 +0000 (11:42 -0200)]
media: ov2640: fix initial try format

Set initial try format with default configuration instead of current one.

Fixes: 8d3b307a150a ("media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY")
Signed-off-by: Akinobu Mita <akinobu.mita@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: s5k4ecgx: delete a bogus error message
Dan Carpenter [Tue, 15 Jan 2019 19:54:54 +0000 (17:54 -0200)]
media: s5k4ecgx: delete a bogus error message

This function prints an error message on success.  I don't have the
hardware, I just noticed this while reading the code.

Fixes: 8b99312b7214 ("[media] Add v4l2 subdev driver for S5K4ECGX sensor")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mt9m111: set initial frame size other than 0x0
Akinobu Mita [Tue, 15 Jan 2019 14:05:41 +0000 (12:05 -0200)]
media: mt9m111: set initial frame size other than 0x0

This driver sets initial frame width and height to 0x0, which is invalid.
So set it to selection rectangle bounds instead.

This is detected by v4l2-compliance detected.

Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m111: set all mbus format field when G_FMT and S_FMT ioctls
Akinobu Mita [Tue, 15 Jan 2019 14:05:40 +0000 (12:05 -0200)]
media: mt9m111: set all mbus format field when G_FMT and S_FMT ioctls

This driver doesn't set all members of mbus format field when the
VIDIOC_SUBDEV_{S,G}_FMT ioctls are called.

This is detected by v4l2-compliance.

Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m111: make SUBDEV_G_FMT ioctl work with SUBDEV_FORMAT_TRY
Akinobu Mita [Tue, 15 Jan 2019 14:05:39 +0000 (12:05 -0200)]
media: mt9m111: make SUBDEV_G_FMT ioctl work with SUBDEV_FORMAT_TRY

The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize
V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE
is specified.

Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: set all mbus format field when G_FMT and S_FMT ioctls
Akinobu Mita [Tue, 8 Jan 2019 14:51:50 +0000 (12:51 -0200)]
media: mt9m001: set all mbus format field when G_FMT and S_FMT ioctls

This driver doesn't set all members of mbus format field when the
VIDIOC_SUBDEV_{S,G}_FMT ioctls are called.

This is detected by v4l2-compliance.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: make SUBDEV_G_FMT ioctl work with SUBDEV_FORMAT_TRY
Akinobu Mita [Tue, 8 Jan 2019 14:51:49 +0000 (12:51 -0200)]
media: mt9m001: make SUBDEV_G_FMT ioctl work with SUBDEV_FORMAT_TRY

The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize
V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE
is specified.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: support log_status ioctl and event interface
Akinobu Mita [Tue, 8 Jan 2019 14:51:48 +0000 (12:51 -0200)]
media: mt9m001: support log_status ioctl and event interface

This adds log_status ioctl and event interface for mt9m001's v4l2 controls.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: register to V4L2 asynchronous subdevice framework
Akinobu Mita [Tue, 8 Jan 2019 14:51:47 +0000 (12:51 -0200)]
media: mt9m001: register to V4L2 asynchronous subdevice framework

Register a sub-device to the asynchronous subdevice framework, and also
create subdevice device node.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: add media controller support
Akinobu Mita [Tue, 8 Jan 2019 14:51:46 +0000 (12:51 -0200)]
media: mt9m001: add media controller support

Create a source pad and set the media controller type to the sensor.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: remove remaining soc_camera specific code
Akinobu Mita [Wed, 9 Jan 2019 15:07:46 +0000 (13:07 -0200)]
media: mt9m001: remove remaining soc_camera specific code

Remove remaining soc_camera specific code and drop soc_camera dependency
from this driver.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: switch s_power callback to runtime PM
Akinobu Mita [Tue, 8 Jan 2019 14:51:44 +0000 (12:51 -0200)]
media: mt9m001: switch s_power callback to runtime PM

Switch s_power() callback to runtime PM framework.  This also removes
soc_camera specific power management code and introduces reset and standby
gpios instead.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: introduce multi_reg_write()
Akinobu Mita [Tue, 8 Jan 2019 14:51:43 +0000 (12:51 -0200)]
media: mt9m001: introduce multi_reg_write()

Introduce multi_reg_write() to write multiple registers to the device and
use it where possible.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: add of_match_table
Akinobu Mita [Tue, 8 Jan 2019 14:51:42 +0000 (12:51 -0200)]
media: mt9m001: add of_match_table

Add of_match_table for the MT9M001 CMOS image sensor.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: sort headers alphabetically
Akinobu Mita [Tue, 8 Jan 2019 14:51:41 +0000 (12:51 -0200)]
media: mt9m001: sort headers alphabetically

Sort header block alphabetically for easy maintenance.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: mt9m001: convert to SPDX license identifer
Akinobu Mita [Tue, 8 Jan 2019 14:51:40 +0000 (12:51 -0200)]
media: mt9m001: convert to SPDX license identifer

Replace GPL license statements with SPDX license identifiers (GPL-2.0).

This also fixes MODULE_LICENSE() ident to match the actual license text.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: i2c: mt9m001: dt: add binding for mt9m001
Akinobu Mita [Tue, 8 Jan 2019 14:51:39 +0000 (12:51 -0200)]
media: i2c: mt9m001: dt: add binding for mt9m001

Add device tree binding documentation for the MT9M001 CMOS image sensor.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
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: i2c: mt9m001: copy mt9m001 soc_camera sensor driver
Akinobu Mita [Tue, 8 Jan 2019 14:51:38 +0000 (12:51 -0200)]
media: i2c: mt9m001: copy mt9m001 soc_camera sensor driver

Copy the soc_camera based driver in v4l2 sensor driver directory.
This commit just copies the original file without modifying it.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Akinobu Mita <akinobu.mita@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: ov8856: Modify ov8856 register reading function to be simplified
Ben Kao [Tue, 15 Jan 2019 09:36:07 +0000 (07:36 -0200)]
media: ov8856: Modify ov8856 register reading function to be simplified

We use put_unaligned_be16() to be simplified for setting register address
in ov8856_read_reg() and use sizeof() to be better suited for bytes
copying.

Signed-off-by: Ben Kao <ben.kao@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: ov7670: control clock along with power
Lubomir Rintel [Tue, 15 Jan 2019 08:54:46 +0000 (06:54 -0200)]
media: ov7670: control clock along with power

This provides more power saving when the sensor is off.

While at that, do the delay on power/clock enable even if the sensor driver
itself doesn't control the GPIOs. This is required for the OLPC XO-1
platform, that lacks the proper power/reset properties in its DT, but
needs the delay after the sensor is clocked up.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov7670: hook s_power onto v4l2 core
Lubomir Rintel [Tue, 15 Jan 2019 08:54:45 +0000 (06:54 -0200)]
media: ov7670: hook s_power onto v4l2 core

The commit 71862f63f351 ("media: ov7670: Add the ov7670_s_power function")
added a power control routing. However, it was not good enough to use as
a s_power() callback: it merely flipped on the power GPIOs without
restoring the register settings.

Fix this now and register an actual power callback.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov7670: split register setting from set_framerate() logic
Lubomir Rintel [Tue, 15 Jan 2019 08:54:48 +0000 (06:54 -0200)]
media: ov7670: split register setting from set_framerate() logic

This will allow us to restore the last set frame rate after the device
returns from a power off.

[sakari.ailus@linux.intel.com>: Wrap a line over 80 characters]

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov7670: split register setting from set_fmt() logic
Lubomir Rintel [Tue, 15 Jan 2019 08:54:47 +0000 (06:54 -0200)]
media: ov7670: split register setting from set_fmt() logic

This will allow us to restore the last set format after the device returns
from a power off.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov7670: Remove useless use of a ret variable
Sakari Ailus [Tue, 15 Jan 2019 08:54:44 +0000 (06:54 -0200)]
media: ov7670: Remove useless use of a ret variable

Instead of assigning the return value to ret and then checking and
returning it, just return the value to the caller directly. The success
value is always 0.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ov8856: Add support for OV8856 sensor
Ben Kao [Tue, 15 Jan 2019 08:30:29 +0000 (06:30 -0200)]
media: ov8856: Add support for OV8856 sensor

This patch adds driver for Omnivision's ov8856 sensor,
the driver supports following features:

- manual exposure/gain(analog and digital) control support
- two link frequencies
- VBLANK/HBLANK support
- test pattern support
- media controller support
- runtime PM support
- enable Vsync signal output
- supported resolutions
  + 3280x2464 at 30FPS
  + 1640x1232 at 30FPS

Signed-off-by: Ben Kao <ben.kao@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: imx274: remote unused function imx274_read_reg
Luca Ceresoli [Fri, 11 Jan 2019 16:30:42 +0000 (14:30 -0200)]
media: imx274: remote unused function imx274_read_reg

imx274_read_reg() is not used since commit ca017467c78b ("media:
imx274: add helper to read multibyte registers").

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: imx-csi: Input connections to CSI should be optional
Steve Longerbeam [Thu, 17 Jan 2019 20:58:37 +0000 (18:58 -0200)]
media: imx-csi: Input connections to CSI should be optional

Some imx platforms do not have fwnode connections to all CSI input
ports, and should not be treated as an error. This includes the
imx6q SabreAuto, which has no connections to ipu1_csi1 and ipu2_csi0.
Return -ENOTCONN in imx_csi_parse_endpoint() so that v4l2-fwnode
endpoint parsing will not treat an unconnected CSI input port as
an error.

Fixes: c893500a16baf ("media: imx: csi: Register a subdev notifier")
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>
Cc: stable@vger.kernel.org
Tested-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: capture: Allow event subscribe/unsubscribe
Steve Longerbeam [Tue, 15 Jan 2019 19:16:08 +0000 (17:16 -0200)]
media: imx: capture: Allow event subscribe/unsubscribe

Implement the vidioc_(un)subscribe_event operations. Imx will allow
subscribing to the imx-specific frame interval error events, events
from subdevices (V4L2_EVENT_SOURCE_CHANGE), and control events.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: queue subdev events to reachable video devices
Steve Longerbeam [Tue, 15 Jan 2019 19:15:46 +0000 (17:15 -0200)]
media: imx: queue subdev events to reachable video devices

In order to receive events generated by subdevices on the video capture
nodes, those events need to be forwarded to the subdevice's list of
reachable video capture devices.

Note this will queue the event to a video device even if there is
no actual _enabled_ media path from the sub-device to the video device.
So a future improvement is to skip the video device if there is no enabled
path to it from the sub-device. The entity->pipe pointer can't be
used for this check because in imx-media a sub-device can be a
member to more than one streaming pipeline at a time.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: lift CSI and PRP ENC/VF width alignment restriction
Philipp Zabel [Thu, 17 Jan 2019 15:51:54 +0000 (13:51 -0200)]
media: imx: lift CSI and PRP ENC/VF width alignment restriction

The CSI, PRP ENC, and PRP VF subdevices shouldn't have to care about
IDMAC line start address alignment. With compose rectangle support in
the capture driver, they don't have to anymore.
If the direct CSI -> IC path is enabled, the CSI output width must
still be aligned to 8 pixels (IC burst length).

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: set compose rectangle to mbus format
Philipp Zabel [Thu, 17 Jan 2019 15:51:53 +0000 (13:51 -0200)]
media: imx: set compose rectangle to mbus format

Prepare for mbus format being smaller than the written rectangle
due to burst size.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: add capture compose rectangle
Philipp Zabel [Thu, 17 Jan 2019 15:51:52 +0000 (13:51 -0200)]
media: imx: add capture compose rectangle

Allowing to compose captured images into larger memory buffers
will let us lift alignment restrictions on CSI crop width.

For now all compose rectangles are identical to the complete
frame width / height. This will be changed in the next patches.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Steve Longerbeam <slongerbeam@gmail.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 decoder capture buffer payload
Philipp Zabel [Tue, 8 Jan 2019 17:20:43 +0000 (15:20 -0200)]
media: coda: fix decoder capture buffer payload

It is not correct to calculate decoder capture payload dynamically from
the decoded frame width and height reported by the firmware. These tell
us what the decoder wrote into the internal framebuffers. The rotator or
VDOA always write the full sizeimage when copying the previously decoded
frame from the internal framebuffers into the capture queue.

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: coda: use macroblock tiling on CODA960 only
Philipp Zabel [Tue, 8 Jan 2019 17:20:16 +0000 (15:20 -0200)]
media: coda: use macroblock tiling on CODA960 only

Coda7541 and earlier do not support macroblock tiling. They do support
the NV12 format, though.  Enable macroblock tiling for NV12 only on
CODA960. This fixes crashes when trying to use NV12 support on CodaHx4.

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: media/v4l2-core/videobuf-vmalloc.c: Remove dead code
Souptick Joarder [Wed, 16 Jan 2019 18:49:33 +0000 (16:49 -0200)]
media: media/v4l2-core/videobuf-vmalloc.c: Remove dead code

This code is commented since version 3.7. If there is no plan to
use it in future, we can remove this dead code.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vidioc-prepare-buf.rst: drop reference to NO_CACHE flags
Hans Verkuil [Wed, 16 Jan 2019 11:46:26 +0000 (09:46 -0200)]
media: vidioc-prepare-buf.rst: drop reference to NO_CACHE flags

This was never implemented, so do not document this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vimc: fill in correct driver name in querycap
Hans Verkuil [Mon, 14 Jan 2019 12:27:45 +0000 (10:27 -0200)]
media: vimc: fill in correct driver name in querycap

The driver name as returned in v4l2_capabilities must be vimc, not vimc_capture.

Fix this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: i2c: adv748x: Use devm to allocate the device struct
Steve Longerbeam [Fri, 11 Jan 2019 16:17:03 +0000 (14:17 -0200)]
media: i2c: adv748x: Use devm to allocate the device struct

Switch to devm_kzalloc() when allocating the adv748x device struct.

The sizeof() is updated to determine the correct allocation size from
the dereferenced pointer type rather than hardcoding the struct type.

[Kieran: Change sizeof() to dereference the pointer type]

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cedrus: Allow using the current dst buffer as reference
Paul Kocialkowski [Wed, 9 Jan 2019 14:19:20 +0000 (12:19 -0200)]
media: cedrus: Allow using the current dst buffer as reference

It was reported that some cases of interleaved video decoding require
using the current destination buffer as a reference. However, this is
no longer possible after the move to vb2_find_timestamp because only
dequeued and done buffers are considered.

Add a helper in our driver that also considers the current destination
buffer before resorting to vb2_find_timestamp and use it in MPEG-2.

Signed-off-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: cedrus: Cleanup duplicate declarations from cedrus_dec header
Paul Kocialkowski [Wed, 9 Jan 2019 14:19:19 +0000 (12:19 -0200)]
media: cedrus: Cleanup duplicate declarations from cedrus_dec header

Some leftover declarations are still in the cedrus_dec header although
they were moved to cedrus_video already. Clean them up.

Signed-off-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: rcar-vin: fix wrong return value in rvin_set_channel_routing()
Niklas Söderlund [Fri, 14 Dec 2018 06:18:21 +0000 (04:18 -0200)]
media: rcar-vin: fix wrong return value in rvin_set_channel_routing()

If the operation in rvin_set_channel_routing() is successful the 'ret'
variable contains the runtime PM use count for the VIN master device.
The intention is not to return the use count to the caller but to return
0 on success else none zero.

Fix this by always returning 0 if the operation is successful.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: platform: sti: remove bdisp_dbg_declare() and hva_dbg_declare()
Yangtao Li [Wed, 12 Dec 2018 16:27:03 +0000 (14:27 -0200)]
media: platform: sti: remove bdisp_dbg_declare() and hva_dbg_declare()

We already have the DEFINE_SHOW_ATTRIBUTE. There is no need to define
bdisp_dbg_declare and hva_dbg_declare, so remove them. Also use
DEFINE_SHOW_ATTRIBUTE to simplify some code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.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: convert to DEFINE_SHOW_ATTRIBUTE
Yangtao Li [Wed, 12 Dec 2018 16:20:14 +0000 (14:20 -0200)]
media: exynos4-is: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: video-i2c: add Melexis MLX90640 thermal camera
Matt Ranostay [Tue, 11 Dec 2018 15:17:01 +0000 (13:17 -0200)]
media: video-i2c: add Melexis MLX90640 thermal camera

Add initial support for MLX90640 thermal cameras which output an 32x24
greyscale pixel image along with 2 rows of coefficent data.

Because of this the data outputed is really 32x26 and needs the two rows
removed after using the coefficent information to generate processed
images in userspace.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: dt-bindings: media: video-i2c: add melexis mlx90640 documentation
Matt Ranostay [Tue, 11 Dec 2018 15:17:00 +0000 (13:17 -0200)]
media: dt-bindings: media: video-i2c: add melexis mlx90640 documentation

Cc: devicetree@vger.kernel.org
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-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: dt-bindings: Add binding for si470x radio
Pawe? Chmiel [Fri, 7 Dec 2018 13:58:12 +0000 (11:58 -0200)]
media: dt-bindings: Add binding for si470x radio

Add device tree bindings for si470x family radio receiver driver.

Signed-off-by: Pawe? Chmiel <pawel.mikolaj.chmiel@gmail.com>
Reviewed-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: si470x-i2c: Add optional reset-gpio support
Pawe? Chmiel [Fri, 7 Dec 2018 13:58:11 +0000 (11:58 -0200)]
media: si470x-i2c: Add optional reset-gpio support

If reset-gpio is defined, use it to bring device out of reset.
Without this, it's not possible to access si470x registers.

Signed-off-by: Pawe? Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: si470x-i2c: Use managed resource helpers
Pawe? Chmiel [Fri, 7 Dec 2018 13:58:10 +0000 (11:58 -0200)]
media: si470x-i2c: Use managed resource helpers

Simplify cleanup of failures by using managed resource helpers

Signed-off-by: Pawe? Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: si470x-i2c: Add device tree support
Pawe? Chmiel [Fri, 7 Dec 2018 13:58:09 +0000 (11:58 -0200)]
media: si470x-i2c: Add device tree support

This commit enables device tree support adding simple of_match table.

Signed-off-by: Pawe? Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: ivtv: add parameter to enable ivtvfb on x86 PAT systems
French, Nicholas A [Sun, 11 Mar 2018 19:27:28 +0000 (16:27 -0300)]
media: ivtv: add parameter to enable ivtvfb on x86 PAT systems

ivtvfb was previously disabled for x86 PAT-enabled systems
by commit 1bf1735b4780 ("x86/mm/pat, drivers/media/ivtv:
Use arch_phys_wc_add() and require PAT disabled") as a
workaround to abstract MTRR code away from device drivers.

The driver is not easily upgradable to the PAT-aware
ioremap_wc() API since the firmware hides the address
ranges that should be marked write-combined from the driver.
However, since a write-combined cache on the framebuffer
is only a performance enhancement not a requirement for
the framebuffer to function, completely disabling the driver
in this configuration is not necessary.

Add force_pat module parameter and a corresponding kernel
configuration parameter to optionally force initialization
on PAT-enabled x86 systems with a warning about the lack of
write-combined caching, and document the reasons the driver
cannot be easily updated to support wc caching on all systems.

Signed-off-by: Nick French <naf@ou.edu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: fix typo, split long pr_ lines up]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: soc_camera_platform: remove obsolete soc_camera test driver
Hans Verkuil [Thu, 17 Jan 2019 13:47:55 +0000 (11:47 -0200)]
media: soc_camera_platform: remove obsolete soc_camera test driver

This is a test stub driver for soc_camera. Since soc_camera is
being deprecated (and in fact, nobody is using it anymore)
there's no sense in keeping this test driver.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: soc_camera/soc_scale_crop: drop this unused code
Hans Verkuil [Thu, 17 Jan 2019 13:44:21 +0000 (11:44 -0200)]
media: soc_camera/soc_scale_crop: drop this unused code

With the removal of sh_mobile_ceu_camera.c this code is no
longer used and can be removed.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: sh_mobile_ceu_camera: remove obsolete soc_camera driver
Hans Verkuil [Thu, 17 Jan 2019 13:41:23 +0000 (11:41 -0200)]
media: sh_mobile_ceu_camera: remove obsolete soc_camera driver

This driver got converted to not depend on soc_camera in commit
32e5a70dc8f4 ("media: platform: Add Renesas CEU driver").

There's no sense in keeping the old version there.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: soc_tw9910: remove obsolete sensor driver
Hans Verkuil [Thu, 17 Jan 2019 13:37:44 +0000 (11:37 -0200)]
media: soc_tw9910: remove obsolete sensor driver

This driver got converted to not depend on soc_camera in commit
7b20f325a566 ("media: i2c: tw9910: Remove soc_camera dependencies").

There's no sense in keeping the old version there.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: tw9910.h: remove obsolete soc_camera.h include.
Hans Verkuil [Thu, 17 Jan 2019 13:33:42 +0000 (11:33 -0200)]
media: tw9910.h: remove obsolete soc_camera.h include.

This include isn't use anymore, so drop it.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: soc_ov772x: remove obsolete sensor driver
Hans Verkuil [Thu, 17 Jan 2019 13:30:16 +0000 (11:30 -0200)]
media: soc_ov772x: remove obsolete sensor driver

This driver got converted to not depend on soc_camera in commit
762c28121d7c ("media: i2c: ov772x: Remove soc_camera dependencies").

There's no sense in keeping the old version there.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: soc_mt9t112: remove obsolete sensor driver
Hans Verkuil [Thu, 17 Jan 2019 13:27:00 +0000 (11:27 -0200)]
media: soc_mt9t112: remove obsolete sensor driver

This driver got converted to not depend on soc_camera in commit
6a26f141bf62 ("media: i2c: mt9t112: Remove soc_camera dependencies").

There's no sense in keeping the old version there.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: tw9910: Unregister subdevice with v4l2-async
Jacopo Mondi [Thu, 17 Jan 2019 14:33:04 +0000 (12:33 -0200)]
media: tw9910: Unregister subdevice with v4l2-async

As the tw9910 subdevice is registered through the v4l2-async framework,
use the v4l2-async provided function to register it.

Fixes: 7b20f325a566 ("media: i2c: tw9910: Remove soc_camera dependencies")
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
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: remove soc_camera ov9640
Mauro Carvalho Chehab [Thu, 17 Jan 2019 12:53:55 +0000 (07:53 -0500)]
media: remove soc_camera ov9640

This driver got converted to not depend on soc_camera on commit
57b0ad9ebe60 ("media: soc_camera: ov9640: move ov9640 out of soc_camera").

There's no sense on keeping the old version there.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx.rst: Update doc to reflect fixes to interlaced capture
Steve Longerbeam [Wed, 9 Jan 2019 18:30:14 +0000 (13:30 -0500)]
media: imx.rst: Update doc to reflect fixes to interlaced capture

Also add an example pipeline for unconverted capture with interweave
on SabreAuto.

Cleanup some language in various places in the process.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: imx: Allow interweave with top/bottom lines swapped
Steve Longerbeam [Wed, 9 Jan 2019 18:30:13 +0000 (13:30 -0500)]
media: imx: Allow interweave with top/bottom lines swapped

Allow sequential->interlaced interweaving but with top/bottom
lines swapped to the output buffer.

This can be accomplished by adding one line length to IDMAC output
channel address, with a negative line length for the interlace offset.

This is to allow the seq-bt -> interlaced-bt transformation, where
bottom lines are still dominant (older in time) but with top lines
first in the interweaved output buffer.

With this support, the CSI can now allow seq-bt at its source pads,
e.g. the following transformations are allowed in CSI from sink to
source:

seq-tb -> seq-bt
seq-bt -> seq-bt
alternate -> seq-bt

Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: imx-csi: Move crop/compose reset after filling default mbus fields
Steve Longerbeam [Wed, 9 Jan 2019 18:30:12 +0000 (13:30 -0500)]
media: imx-csi: Move crop/compose reset after filling default mbus fields

If caller passes un-initialized field type V4L2_FIELD_ANY to CSI
sink pad, the reset CSI crop window would not be correct, because
the crop window depends on a valid input field type. To fix move
the reset of crop and compose windows to after the call to
imx_media_fill_default_mbus_fields().

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: imx: vdic: rely on VDIC for correct field order
Steve Longerbeam [Wed, 9 Jan 2019 18:30:11 +0000 (13:30 -0500)]
media: imx: vdic: rely on VDIC for correct field order

prepare_vdi_in_buffers() was setting up the dma pointers as if the
VDIC is always programmed to receive the fields in bottom-top order,
i.e. as if ipu_vdi_set_field_order() only programs BT order in the VDIC.
But that's not true, ipu_vdi_set_field_order() is working correctly.

So fix prepare_vdi_in_buffers() to give the VDIC the fields in whatever
order they were received by the video source, and rely on the VDIC to
sort out which is top and which is bottom.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx-csi: Allow skipping odd chroma rows for YVU420
Steve Longerbeam [Wed, 9 Jan 2019 18:30:10 +0000 (13:30 -0500)]
media: imx-csi: Allow skipping odd chroma rows for YVU420

Skip writing U/V components to odd rows for YVU420 in addition to
YUV420 and NV12.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: imx: interweave and odd-chroma-row skip are incompatible
Steve Longerbeam [Wed, 9 Jan 2019 18:30:09 +0000 (13:30 -0500)]
media: imx: interweave and odd-chroma-row skip are incompatible

If IDMAC interweaving is enabled in a write channel, the channel must
write the odd chroma rows for 4:2:0 formats. Skipping writing the odd
chroma rows produces corrupted captured 4:2:0 images when interweave
is enabled.

Reported-by: Krzysztof Ha?asa <khalasa@piap.pl>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: imx-csi: Double crop height for alternate fields at sink
Steve Longerbeam [Wed, 9 Jan 2019 18:30:08 +0000 (13:30 -0500)]
media: imx-csi: Double crop height for alternate fields at sink

If the incoming sink field type is alternate, the reset crop height
and crop height bounds must be set to twice the incoming height,
because in alternate field mode, upstream will report only the
lines for a single field, and the CSI captures the whole frame.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: imx: Fix field negotiation
Steve Longerbeam [Wed, 9 Jan 2019 18:30:07 +0000 (13:30 -0500)]
media: imx: Fix field negotiation

IDMAC interlaced scan, a.k.a. interweave, should be enabled in the
IDMAC output channels only if the IDMAC output pad field type is
'seq-bt' or 'seq-tb', and field type at the capture interface is
'interlaced*'.

V4L2_FIELD_HAS_BOTH() macro should not be used on the input to determine
enabling interlaced/interweave scan. That macro includes the 'interlaced'
field types, and in those cases the data is already interweaved with
top/bottom field lines.

The CSI will capture whole frames when the source specifies alternate
field mode. So the CSI also enables interweave for alternate input
field type and the field type at capture interface is interlaced.

Fix the logic for setting field type in try_fmt in CSI entity.
The behavior should be:

- No restrictions on field type at sink pad.

- At the output pads, allow sequential fields in TB order, if the sink pad
  field type is sequential or alternate. Otherwise passthrough the field
  type from sink to source pad.

Move this logic to new function csi_try_field().

These changes result in the following allowed field transformations
from CSI sink -> source pads (all other field types at sink are passed
through to source):

seq-tb -> seq-tb
seq-bt -> seq-tb
alternate -> seq-tb

In a future patch, the CSI sink -> source will allow:

seq-tb -> seq-bt
seq-bt -> seq-bt
alternate -> seq-bt

This will require supporting interweave with top/bottom line swapping.
Until then seq-bt is not allowed at the CSI source pad because there is
no way to swap top/bottom lines when interweaving to INTERLACED_BT --
note that despite the name, INTERLACED_BT is top-bottom order in memory.
The BT in this case refers to field dominance: the bottom lines are
older in time than the top lines.

The capture interface device allows selecting IDMAC interweave by
choosing INTERLACED_TB if the CSI/PRPENCVF source pad is seq-tb and
INTERLACED_BT if the source pad is seq-bt (for future support of seq-bt).

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: gpu: ipu-v3: Add planar support to interlaced scan
Steve Longerbeam [Wed, 9 Jan 2019 18:30:06 +0000 (13:30 -0500)]
media: gpu: ipu-v3: Add planar support to interlaced scan

To support interlaced scan with planar formats, cpmem SLUV must
be programmed with the correct chroma line stride. For full and
partial planar 4:2:2 (YUV422P, NV16), chroma line stride must
be doubled. For full and partial planar 4:2:0 (YUV420, YVU420, NV12),
chroma line stride must _not_ be doubled, since a single chroma line
is shared by two luma lines.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: gpu: ipu-csi: Swap fields according to input/output field types
Steve Longerbeam [Wed, 9 Jan 2019 18:30:05 +0000 (13:30 -0500)]
media: gpu: ipu-csi: Swap fields according to input/output field types

The function ipu_csi_init_interface() was inverting the F-bit for
NTSC case, in the CCIR_CODE_1/2 registers. The result being that
for NTSC bottom-top field order, the CSI would swap fields and
capture in top-bottom order.

Instead, base field swap on the field order of the input to the CSI,
and the field order of the requested output. If the input/output
fields are sequential but different, swap fields, otherwise do
not swap. This requires passing both the input and output mbus
frame formats to ipu_csi_init_interface().

Move this code to a new private function ipu_csi_set_bt_interlaced_codes()
that programs the CCIR_CODE_1/2 registers for interlaced BT.656 (and
possibly interlaced BT.1120 in the future).

When detecting input video standard from the input frame width/height,
make sure to double height if input field type is alternate, since
in that case input height only includes lines for one field.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-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: videodev2.h: Add more field helper macros
Steve Longerbeam [Wed, 9 Jan 2019 18:30:04 +0000 (13:30 -0500)]
media: videodev2.h: Add more field helper macros

Adds two helper macros:

V4L2_FIELD_IS_SEQUENTIAL: returns true if the given field type is
'sequential', that is a full frame is transmitted, or exists in
memory, as all top field lines followed by all bottom field lines,
or vice-versa.

V4L2_FIELD_IS_INTERLACED: returns true if the given field type is
'interlaced', that is a full frame is transmitted, or exists in
memory, as top field lines interlaced with bottom field lines.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: rcar-vin: Allow independent VIN link enablement
Steve Longerbeam [Tue, 15 Jan 2019 01:10:19 +0000 (20:10 -0500)]
media: rcar-vin: Allow independent VIN link enablement

There is a block of code in rvin_group_link_notify() that prevents
enabling a link to a VIN node if any entity in the media graph is
in use. This prevents enabling a VIN link even if there is an in-use
entity somewhere in the graph that is independent of the link's
pipeline.

For example, the code block will prevent enabling a link from
the first rcar-csi2 receiver to a VIN node even if there is an
enabled link somewhere far upstream on the second independent
rcar-csi2 receiver pipeline.

If this code block is meant to prevent modifying a link if any entity
in the graph is actively involved in streaming (because modifying
the CHSEL register fields can disrupt any/all running streams), then
the entities stream counts should be checked rather than the use counts.

(There is already such a check in __media_entity_setup_link() that verifies
the stream_count of the link's source and sink entities are both zero,
but that is insufficient, since there should be no running streams in
the entire graph).

Modify the code block to check the entity stream_count instead of the
use_count (and elaborate on the comment). VIN node links can now be
enabled even if there are other independent in-use entities that are
not streaming.

Fixes: c0cc5aef31 ("media: rcar-vin: add link notify for Gen3")
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: coda: Add control for h.264 chroma qp index offset
Philipp Zabel [Thu, 10 Jan 2019 16:56:12 +0000 (11:56 -0500)]
media: coda: Add control for h.264 chroma qp index offset

Allow to set a fixed quantization parameter offset between luma and
chroma in the h.264 encoder.

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: coda: Add control for h.264 constrained intra prediction
Philipp Zabel [Thu, 10 Jan 2019 16:56:11 +0000 (11:56 -0500)]
media: coda: Add control for h.264 constrained intra prediction

Allow to enable constrained intra prediction in the h.264 encoder.

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-ctrl: Add control for h.264 chroma qp offset
Philipp Zabel [Thu, 10 Jan 2019 16:56:10 +0000 (11:56 -0500)]
media: v4l2-ctrl: Add control for h.264 chroma qp offset

Allow to add fixed quantization parameter offset between luma and
chroma quantization parameters. This control directly corresponds
to the chroma_qp_index_offset field of the h.264 picture parameter
set.

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-ctrl: Add control to enable h.264 constrained intra prediction
Philipp Zabel [Thu, 10 Jan 2019 16:56:09 +0000 (11:56 -0500)]
media: v4l2-ctrl: Add control to enable h.264 constrained intra prediction

Allow to enable h.264 constrained intra prediction (macroblocks using
intra prediction modes are not allowed to use residual data and decoded
samples of neighboring macroblocks coded using inter prediction modes).
This control directly corresponds to the constrained_intra_pred_flag
field in the h.264 picture parameter set.

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: gspca: ov534-ov772x: remove unnecessary COM3 initialization
Philipp Zabel [Fri, 14 Dec 2018 16:40:31 +0000 (11:40 -0500)]
media: gspca: ov534-ov772x: remove unnecessary COM3 initialization

The COM3 register at address 0x0c already defaults to 0x10, the two bits
COM3[7:6] are set according to V4L2 controls by sethvflip later.
There is no need to set it multiple times during bridge initialization.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: gspca: ov534-ov722x: remove camera clock setup from bridge_init
Philipp Zabel [Fri, 14 Dec 2018 16:40:30 +0000 (11:40 -0500)]
media: gspca: ov534-ov722x: remove camera clock setup from bridge_init

This register is later overwritten by set_frame_rate anyway.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: gspca: ov534-ov722x: remove mode specific video data registers from bridge_init
Philipp Zabel [Fri, 14 Dec 2018 16:40:29 +0000 (11:40 -0500)]
media: gspca: ov534-ov722x: remove mode specific video data registers from bridge_init

The video format, payload size, and frame size setup is video format
and frame size specific. Those registers are overwritten during
bridge_start anyway.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: gspca: ov534-ov772x: add SGBRG8 bayer mode support
Philipp Zabel [Fri, 14 Dec 2018 16:40:28 +0000 (11:40 -0500)]
media: gspca: ov534-ov772x: add SGBRG8 bayer mode support

Add support to pass through the sensor's native SGBRG8 bayer pattern,
allowing to cut the required USB bandwidth in half.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: gspca: ov543-ov772x: move video format specific registers into bridge_start
Philipp Zabel [Fri, 14 Dec 2018 16:40:27 +0000 (11:40 -0500)]
media: gspca: ov543-ov772x: move video format specific registers into bridge_start

In preparation for adding SGBRG8 as a second video format besides YUYV,
move video format specific register settings from the bridge_init array
into the bridge_start arrays.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: gspca: support multiple pixel formats in TRY_FMT
Philipp Zabel [Fri, 14 Dec 2018 16:40:26 +0000 (11:40 -0500)]
media: gspca: support multiple pixel formats in TRY_FMT

If a driver supports multiple pixel formats with the same frame size,
TRY_FMT will currently always return the first pixel format.
Fix this by adding pixelformat support to wxh_to_nearest_mode().

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: gspca: support multiple pixel formats in ENUM_FRAMEINTERVALS
Philipp Zabel [Fri, 14 Dec 2018 16:40:25 +0000 (11:40 -0500)]
media: gspca: support multiple pixel formats in ENUM_FRAMEINTERVALS

If a driver supports multiple pixel formats with the same frame size,
ENUM_FRAMEINTERVALS will currently only work for the first pixel format.
Fix this by adding pixelformat support to wxh_to_mode().

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: gspca: ov534: replace msleep(10) with usleep_range
Philipp Zabel [Fri, 14 Dec 2018 16:40:24 +0000 (11:40 -0500)]
media: gspca: ov534: replace msleep(10) with usleep_range

For short waits, usleep_range should be used instead of msleep,
see Documentation/timers/timers-howto.txt.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vim2m: the v4l2_m2m_buf_copy_data args were swapped
Hans Verkuil [Fri, 11 Jan 2019 11:43:12 +0000 (06:43 -0500)]
media: vim2m: the v4l2_m2m_buf_copy_data args were swapped

The buffer arguments to v4l2_m2m_buf_copy_data args were swapped.

The reason is confusing naming conventions in vim2m. It certainly
could be improved.

Fixes: 7aca565ee3d0 ("media: vim2m: use v4l2_m2m_buf_copy_data")
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vivid: do not implement VIDIOC_S_PARM for output streams
Hans Verkuil [Fri, 11 Jan 2019 11:37:03 +0000 (06:37 -0500)]
media: vivid: do not implement VIDIOC_S_PARM for output streams

v4l2_compliance gave a warning for the S_PARM test for output streams:

warn: v4l2-test-formats.cpp(1235): S_PARM is supported for buftype 2, but not for ENUM_FRAMEINTERVALS

The reason is that vivid mapped s_parm for output streams to g_parm. But if
S_PARM doesn't actually change anything, then it shouldn't be enabled at all.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vivid: take data_offset into account for video output
Hans Verkuil [Mon, 14 Jan 2019 16:23:52 +0000 (11:23 -0500)]
media: vivid: take data_offset into account for video output

The video output sizeimage calculation did not take data_offset into account.

This can cause problems with video loopback or exporting output buffers for
use as dmabuf import buffers since the output buffer size is now too small.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: v4l: uAPI: V4L2_BUF_TYPE_META_OUTPUT is an output buffer type
Sakari Ailus [Mon, 14 Jan 2019 14:01:54 +0000 (09:01 -0500)]
media: v4l: uAPI: V4L2_BUF_TYPE_META_OUTPUT is an output buffer type

V4L2_BUF_TYPE_META_OUTPUT was added by commit 72148d1a57e7
("media: v4l: Add support for V4L2_BUF_TYPE_META_OUTPUT") but the patch
missed adding the type to the macro telling whether a given type is an
output type or not. Do that now. Getting this wrong leads to handling the
buffer as a capture buffer in a lot of places.

Fixes: 72148d1a57e7 ("media: v4l: Add support for V4L2_BUF_TYPE_META_OUTPUT")
Signed-off-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>