]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
5 years agomedia: vim2m: allow setting the default transaction time via parameter
Mauro Carvalho Chehab [Tue, 29 Jan 2019 16:00:17 +0000 (14:00 -0200)]
media: vim2m: allow setting the default transaction time via parameter

While there's a control to allow setting it at runtime, as the
control handler is per file handler, only the application setting
the m2m device can change it. As this is a custom control, it is
unlikely that existing apps would be able to set it.

Due to that, and due to the fact that v4l2-mem2mem serializes all
accesses to a m2m device, trying to setup two GStreamer
v4l2videoconvert instance at the same time will cause frame drops.

So, add an alternate way of setting its default via a modprobe parameter.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vim2m: use per-file handler work queue
Mauro Carvalho Chehab [Tue, 29 Jan 2019 16:00:16 +0000 (14:00 -0200)]
media: vim2m: use per-file handler work queue

It doesn't make sense to have a per-device work queue, as the
scheduler should be called per file handler. Having a single
one causes failures if multiple streams are filtered by vim2m.

So, move it to be inside the context structure.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vim2m: fix driver for it to handle different fourcc formats
Mauro Carvalho Chehab [Tue, 29 Jan 2019 16:00:15 +0000 (14:00 -0200)]
media: vim2m: fix driver for it to handle different fourcc formats

Despite vim2m is reporting that it supports RGB565BE and YUYV,
that's not true.

Right now, it just says that it supports both format, but it
doesn't actually support them.

Also, horizontal flip is not properly implemented. It sounds
that it was designed to do a pseudo-horizontal flip using 8
tiles. Yet, as it doesn't do format conversion, the result
is a mess.

I suspect that it was done this way in order to save CPU time,
at the time of OMAP2 days.

That's messy and doesn't really help if someone wants to
use vim2m to test a pipeline.

Worse than that, the unique RGB format it says it supports is
RGB565BE, with is not supported by Gstreamer. That prevents
practical usage of it, even for tests.

So, instead, properly implement fourcc format conversions,
adding a few more RGB formats:

- RGB and BGR with 24 bits
- RGB565LE (known as RGB16 at gstreamer)

Also allows using any of the 5 supported formats as either
capture or output.

Note: The YUYV conversion routines are based on the conversion code
written by Hans de Goede inside libv4lconvert (part of v4l-utils),
released under LGPGL 2.1 (GPL 2.0 compatible).

Tested all possible format combinations except for RGB565BE,
as Gstreamer currently doesn't support it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vivid: fix vid_out_buf_prepare()
Hans Verkuil [Fri, 25 Jan 2019 15:40:04 +0000 (13:40 -0200)]
media: vivid: fix vid_out_buf_prepare()

The wrong size check was performed for output formats like NV24 which
set vfmt->buffers to 1, but vfmt->planes is 2. It was incorrectly
checking the payload size for plane 1, which doesn't exist.

Note: vfmt->buffers refers to the number of per-plane-buffers that
should be allocated. vfmt->planes refers to the number of planes
that make up an image. vfmt->planes may be > vfmt->buffers.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vb2: check that buf_out_validate is present
Hans Verkuil [Wed, 16 Jan 2019 12:01:17 +0000 (10:01 -0200)]
media: vb2: check that buf_out_validate is present

The buf_out_validate is required for output queues in combination
with requests. Check this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cedrus: add buf_out_validate callback
Hans Verkuil [Wed, 16 Jan 2019 12:01:16 +0000 (10:01 -0200)]
media: cedrus: add buf_out_validate callback

Validate the field for an output buffer. This ensures that the
field is validated when the buffer is queued to a request, and
not when the request itself is queued, which is too late.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vivid: add buf_out_validate callback
Hans Verkuil [Wed, 16 Jan 2019 12:01:15 +0000 (10:01 -0200)]
media: vivid: add buf_out_validate callback

Validate the field for an output buffer. This ensures that the
field is validated when the buffer is queued to a request, and
not when the request itself is queued, which is too late.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vim2m: add buf_out_validate callback
Hans Verkuil [Wed, 16 Jan 2019 12:01:14 +0000 (10:01 -0200)]
media: vim2m: add buf_out_validate callback

Validate the field for an output buffer. This ensures that the
field is validated when the buffer is queued to a request, and
not when the request itself is queued, which is too late.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vb2: add buf_out_validate callback
Hans Verkuil [Wed, 16 Jan 2019 12:01:13 +0000 (10:01 -0200)]
media: vb2: add buf_out_validate callback

When queueing a buffer to a request the 'field' value is not validated.
That field is only validated when the _buf_prepare() is called,
which happens when the request is queued.

However, this validation should happen at QBUF time, since you want
to know about this as soon as possible. Also, the spec requires that
the 'field' value is validated at QBUF time.

This patch adds a new buf_out_validate callback to validate the
output buffer at buf_prepare time or when QBUF queues an unprepared
buffer to a request. This callback is mandatory for output queues
that support requests.

This issue was found by v4l2-compliance since it failed to replace
V4L2_FIELD_ANY by a proper field value when testing the vivid video
output in combination with requests.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: cedrus: Remove completed item from TODO list (dma-buf references)
Paul Kocialkowski [Thu, 24 Jan 2019 09:51:56 +0000 (07:51 -0200)]
media: cedrus: Remove completed item from TODO list (dma-buf references)

Access to reference frames that were imported from dma-buf was taken
care of and is no longer a pending item on the driver's TODO list.

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: vb2: Keep dma-buf buffers mapped until they are freed
Pawel Osciak [Thu, 24 Jan 2019 09:51:55 +0000 (07:51 -0200)]
media: vb2: Keep dma-buf buffers mapped until they are freed

When using vb2 for video decoding, dequeued capture buffers may still
be accessed by the hardware: this is the case when they are used as
reference frames for decoding subsequent frames.

When the buffer is imported with dma-buf, it needs to be mapped before
access. Until now, it was mapped when queuing and unmapped when
dequeuing, which doesn't work for access as a reference frames.

One way to solve this would be to map the buffer again when it is
needed as a reference, but the mapping/unmapping operations can
seriously impact performance. As a result, map the buffer once (when it
is first needed when queued) and keep it mapped until it is freed.

Reviewed-on: https://chromium-review.googlesource.com/334103
[Paul: Updated for mainline and changed commit message]

Signed-off-by: Pawel Osciak <posciak@chromium.org>
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: Revert "media: cedrus: Allow using the current dst buffer as reference"
Paul Kocialkowski [Thu, 24 Jan 2019 12:49:45 +0000 (10:49 -0200)]
media: Revert "media: cedrus: Allow using the current dst buffer as reference"

This reverts commit cf20ae1535eb690a87c29b9cc7af51881384e967.

The vb2_find_timestamp helper was modified to allow finding buffers
regardless of their current state in the queue. This means that we
no longer have to take particular care of references to the current
capture buffer.

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: vb2: vb2_find_timestamp: drop restriction on buffer state
Hans Verkuil [Thu, 24 Jan 2019 08:47:49 +0000 (06:47 -0200)]
media: vb2: vb2_find_timestamp: drop restriction on buffer state

There really is no reason why vb2_find_timestamp can't just find
buffers in any state. Drop that part of the test.

This also means that vb->timestamp should only be set to 0 when
the driver doesn't copy timestamps.

This change allows for more efficient pipelining (i.e. you can use
a buffer for a reference frame even when it is queued).

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: mtk-vcodec: Using common interface to manage vdec/venc clock
Yunfei Dong [Thu, 17 Jan 2019 05:39:20 +0000 (03:39 -0200)]
media: mtk-vcodec: Using common interface to manage vdec/venc clock

Vdec: Using standard CCF interface to set parent clock and
clock rate in dtsi and using common interface to open/close
video decoder clock.
Venc: Using standard CCF interface to set parent clock in dtsi
and using common interface to open/close video encoder clock.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Qianqian Yan <qianqian.yan@mediatek.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: add 'assigned-clocks' to vcodec examples
Yunfei Dong [Thu, 17 Jan 2019 05:39:18 +0000 (03:39 -0200)]
media: dt-bindings: media: add 'assigned-clocks' to vcodec examples

Fix MTK binding document for MT8173 dtsi changed in order
to use standard CCF interface.
MT8173 SoC from Mediatek.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Qianqian Yan <qianqian.yan@mediatek.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: imx: prpencvf: Stop upstream before disabling IDMA channel
Steve Longerbeam [Mon, 21 Jan 2019 23:35:52 +0000 (21:35 -0200)]
media: imx: prpencvf: Stop upstream before disabling IDMA channel

Upstream must be stopped immediately after receiving the last EOF and
before disabling the IDMA channel. This can be accomplished by moving
upstream stream off to just after receiving the last EOF completion in
prp_stop(). For symmetry also move upstream stream on to end of
prp_start().

This fixes a complete system hard lockup on the SabreAuto when streaming
from the ADV7180, by repeatedly sending a stream off immediately followed
by stream on:

while true; do v4l2-ctl  -d1 --stream-mmap --stream-count=3; done

Eventually this either causes the system lockup or EOF timeouts at all
subsequent stream on, until a system reset.

The lockup occurs when disabling the IDMA channel at stream off. Stopping
the video data stream entering the IDMA channel before disabling the
channel itself appears to be a reliable fix for the hard lockup.

Fixes: f0d9c8924e2c3 ("[media] media: imx: Add IC subdev drivers")
Reported-by: Gaël PORTAY <gael.portay@collabora.com>
Tested-by: Gaël PORTAY <gael.portay@collabora.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Cc: stable@vger.kernel.org # for 4.13 and up
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: csi: Stop upstream before disabling IDMA channel
Steve Longerbeam [Mon, 21 Jan 2019 23:35:51 +0000 (21:35 -0200)]
media: imx: csi: Stop upstream before disabling IDMA channel

Move upstream stream off to just after receiving the last EOF completion
and disabling the CSI (and thus before disabling the IDMA channel) in
csi_stop(). For symmetry also move upstream stream on to beginning of
csi_start().

Doing this makes csi_s_stream() more symmetric with prp_s_stream() which
will require the same change to fix a hard lockup.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Cc: stable@vger.kernel.org # for 4.13 and up
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: imx: csi: Disable CSI immediately after last EOF
Steve Longerbeam [Mon, 21 Jan 2019 23:35:50 +0000 (21:35 -0200)]
media: imx: csi: Disable CSI immediately after last EOF

Disable the CSI immediately after receiving the last EOF before stream
off (and thus before disabling the IDMA channel). Do this by moving the
wait for EOF completion into a new function csi_idmac_wait_last_eof().

This fixes a complete system hard lockup on the SabreAuto when streaming
from the ADV7180, by repeatedly sending a stream off immediately followed
by stream on:

while true; do v4l2-ctl  -d4 --stream-mmap --stream-count=3; done

Eventually this either causes the system lockup or EOF timeouts at all
subsequent stream on, until a system reset.

The lockup occurs when disabling the IDMA channel at stream off. Disabling
the CSI before disabling the IDMA channel appears to be a reliable fix for
the hard lockup.

Fixes: 4a34ec8e470cb ("[media] media: imx: Add CSI subdev driver")
Reported-by: Gaël PORTAY <gael.portay@collabora.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Cc: stable@vger.kernel.org # for 4.13 and up
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: get_next_header is static
Mauro Carvalho Chehab [Sat, 26 Jan 2019 11:12:04 +0000 (09:12 -0200)]
media: vicodec: get_next_header is static

drivers/media/platform/vicodec/vicodec-core.c:drivers/media/platform/vicodec/vicodec-core.c:210:23:  warning: symbol 'get_next_header' was not declared. Should it be static?
drivers/media/platform/vicodec/vicodec-core.c:210:23: warning: no previous prototype for 'get_next_header' [-Wmissing-prototypes]
 enum vb2_buffer_state get_next_header(struct vicodec_ctx *ctx, u8 **pp, u32 sz)
                       ^~~~~~~~~~~~~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5 years agomedia: vicodec: ensure comp frame pointer kept in range
Dafna Hirschfeld [Thu, 24 Jan 2019 09:51:08 +0000 (07:51 -0200)]
media: vicodec: ensure comp frame pointer kept in range

Make sure that the pointer to the compressed frame does not
get out of the buffer.

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 resolution change event.
Dafna Hirschfeld [Mon, 21 Jan 2019 11:46:18 +0000 (09:46 -0200)]
media: vicodec: Add support for resolution change event.

If the the queues are not streaming then the first resolution
change is handled in the buf_queue callback.
The following resolution change events are handled in job_ready.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: wrap info_from_header prototype]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
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>