platform/kernel/linux-starfive.git
6 years agomedia: ivtv: remove ivtv-alsa-mixer
Corentin Labbe [Thu, 8 Feb 2018 08:31:07 +0000 (03:31 -0500)]
media: ivtv: remove ivtv-alsa-mixer

ivtv-alsa-mixer functions was introduced in commit 269c11fbac4f
("[media] ivtv, ivtv-alsa: Add initial ivtv-alsa interface driver for ivtv")
But according to commit message, ivtv-alsa-mixer.c was already dead code.
5 years after, we should remove it.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: removed forgotten ivtv-alsa-mixer.h include]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx18: remove unused cx18-alsa-mixer
Corentin Labbe [Thu, 8 Feb 2018 08:26:14 +0000 (03:26 -0500)]
media: cx18: remove unused cx18-alsa-mixer

cx18-alsa-mixer functions are not used since commit 4cb565cc2700
("V4L/DVB: cx18: make it so cx18-alsa-main.c compiles") 9 year later,
let's just remove them.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: platform: vivid-cec: use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Tue, 6 Feb 2018 16:53:44 +0000 (11:53 -0500)]
media: platform: vivid-cec: use 64-bit arithmetic instead of 32-bit

Add suffix ULL to constant 10 in order to give the compiler complete
information about the proper arithmetic to use. Notice that this
constant is used in a context that expects an expression of type
u64 (64 bits, unsigned).

The expression len * 10 * CEC_TIM_DATA_BIT_TOTAL is currently being
evaluated using 32-bit arithmetic.

Also, remove unnecessary parentheses and add a code comment to make it
clear what is the reason of the code change.

Addresses-Coverity-ID: 1454996 ("Unintentional integer overflow")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: platform: sh_veu: use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Tue, 6 Feb 2018 16:52:24 +0000 (11:52 -0500)]
media: platform: sh_veu: use 64-bit arithmetic instead of 32-bit

Cast left and top to dma_addr_t in order to give the compiler complete
information about the proper arithmetic to use. Notice that these
variables are being used in contexts that expect expressions of
type dma_addr_t (64 bit, unsigned).

Such expressions are currently being evaluated using 32-bit arithmetic.

Also, move the expression (((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3)
at the end in order to avoid a line wrapping checkpatch.pl warning.

Addresses-Coverity-ID: 1056807 ("Unintentional integer overflow")
Addresses-Coverity-ID: 1056808 ("Unintentional integer overflow")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rockchip/rga: use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Tue, 6 Feb 2018 16:51:18 +0000 (11:51 -0500)]
media: rockchip/rga: use 64-bit arithmetic instead of 32-bit

Cast p to dma_addr_t in order to avoid a potential integer overflow.
This variable is being used in a context that expects an expression
of type dma_addr_t (u64).

The expression p << PAGE_SHIFT is currently being evaluated
using 32-bit arithmetic.

Addresses-Coverity-ID: 1458347 ("Unintentional integer overflow")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: pci: cx88-input: use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Tue, 6 Feb 2018 16:49:04 +0000 (11:49 -0500)]
media: pci: cx88-input: use 64-bit arithmetic instead of 32-bit

Add suffix LL to constant 1000000 in order to give the compiler
complete information about the proper arithmetic to use. Notice
that this constant is used in a context that expects an expression
of type ktime_t (64 bits, signed).

The expression ir->polling * 1000000 is currently being evaluated
using 32-bit arithmetic.

Addresses-Coverity-ID: 1392628 ("Unintentional integer overflow")
Addresses-Coverity-ID: 1392630 ("Unintentional integer overflow")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: max2175: use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Tue, 6 Feb 2018 16:47:37 +0000 (11:47 -0500)]
media: i2c: max2175: use 64-bit arithmetic instead of 32-bit

Add suffix LL to constant 2 in order to give the compiler complete
information about the proper arithmetic to use. Notice that this
constant is used in a context that expects an expression of type
s64 (64 bits, signed).

The expression 2 * (clock_rate - abs_nco_freq) is currently being
evaluated using 32-bit arithmetic.

Addresses-Coverity-ID: 1446589 ("Unintentional integer overflow")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends: ves1820: use 64-bit arithmetic instead of 32-bit
Gustavo A. R. Silva [Tue, 6 Feb 2018 16:47:09 +0000 (11:47 -0500)]
media: dvb-frontends: ves1820: use 64-bit arithmetic instead of 32-bit

Add suffix ULL to constant 10 in order to give the compiler complete
information about the proper arithmetic to use. Notice that this
constant is used in a context that expects an expression of type
u64 (64 bits, unsigned).

The expression fpxin = state->config->xin * 10 is currently being
evaluated using 32-bit arithmetic.

Addresses-Coverity-ID: 200604 ("Unintentional integer overflow")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rtl2832: use 64-bit arithmetic instead of 32-bit in rtl2832_set_frontend
Gustavo A. R. Silva [Tue, 6 Feb 2018 16:46:59 +0000 (11:46 -0500)]
media: rtl2832: use 64-bit arithmetic instead of 32-bit in rtl2832_set_frontend

Add suffix ULL to constant 7 in order to give the compiler complete
information about the proper arithmetic to use. Notice that this
constant is used in a context that expects an expression of type
u64 (64 bits, unsigned).

The expression dev->pdata->clk * 7 is currently being evaluated
using 32-bit arithmetic.

Addresses-Coverity-ID: 1271223 ("Unintentional integer overflow")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vb2: Fix videobuf2 to map correct area
Masami Hiramatsu [Tue, 6 Feb 2018 08:02:23 +0000 (03:02 -0500)]
media: vb2: Fix videobuf2 to map correct area

Fixes vb2_vmalloc_get_userptr() to ioremap correct area.
Since the current code does ioremap the page address, if the offset > 0,
it does not do ioremap the last page and results in kernel panic.

This fixes to pass the size + offset to ioremap so that ioremap
can map correct area. Also, this uses __pfn_to_phys() to get the physical
address of given PFN.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Reported-by: Takao Orito <orito.takao@socionext.com>
Reported-by: Fumihiro ATSUMI <atsumi@infinitegra.co.jp>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2_fh.h: add missing kconfig.h include
Alexandre Courbot [Mon, 5 Feb 2018 02:33:04 +0000 (21:33 -0500)]
media: v4l2_fh.h: add missing kconfig.h include

v4l2_fh.h uses the IS_ENABLED() macro and thus should include kconfig.h.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: vidioc-prepare-buf.rst: fix link to VIDIOC_QBUF
Alexandre Courbot [Mon, 5 Feb 2018 02:24:43 +0000 (21:24 -0500)]
media: v4l: vidioc-prepare-buf.rst: fix link to VIDIOC_QBUF

The description for VIDIOC_PREPARE_BUF results in the following
sentence: "...before actually enqueuing it, using the ioctl VIDIOC_QBUF,
VIDIOC_DQBUF ioctl...".

The intent is to only refer to VIDIOC_QBUF though, so fix this.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-ctrls.h: fix wrong copy-and-paste comment
Hans Verkuil [Sat, 3 Feb 2018 13:18:14 +0000 (08:18 -0500)]
media: v4l2-ctrls.h: fix wrong copy-and-paste comment

The __v4l2_ctrl_modify_range is the unlocked variant, so the comment about
taking a lock is obviously wrong.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vb2: core: Finish buffers at the end of the stream
Sakari Ailus [Fri, 2 Feb 2018 10:08:59 +0000 (05:08 -0500)]
media: vb2: core: Finish buffers at the end of the stream

If buffers were prepared or queued and the buffers were released without
starting the queue, the finish mem op (corresponding to the prepare mem
op) was never called to the buffers.

Before commit a136f59c0a1f there was no need to do this as in such a case
the prepare mem op had not been called yet. Address the problem by
explicitly calling finish mem op when the queue is stopped if the buffer
is in either prepared or queued state.

Fixes: a136f59c0a1f ("[media] vb2: Move buffer cache synchronisation to prepare from queue")

Cc: stable@vger.kernel.org # for v4.13 and up
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vivid: fix incorrect capabilities for radio
Hans Verkuil [Thu, 1 Feb 2018 07:36:33 +0000 (02:36 -0500)]
media: vivid: fix incorrect capabilities for radio

The vivid driver has two custom controls that change the behavior of RDS.
Depending on the control setting the V4L2_CAP_READWRITE capability is toggled.
However, after an earlier commit the capability was no longer set correctly.
This is now fixed.

Fixes: 9765a32cd8 ("vivid: set device_caps in video_device")

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx25821: prevent out-of-bounds read on array card
Colin Ian King [Wed, 31 Jan 2018 17:33:09 +0000 (12:33 -0500)]
media: cx25821: prevent out-of-bounds read on array card

Currently an out of range dev->nr is detected by just reporting the
issue and later on an out-of-bounds read on array card occurs because
of this. Fix this by checking the upper range of dev->nr with the size
of array card (removes the hard coded size), move this check earlier
and also exit with the error -ENOSYS to avoid the later out-of-bounds
array read.

Detected by CoverityScan, CID#711191 ("Out-of-bounds-read")

Fixes: commit 02b20b0b4cde ("V4L/DVB (12730): Add conexant cx25821 driver")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: %ld -> %zd]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-dev.h: fix symbol collision in media_entity_to_video_device()
Niklas Söderlund [Thu, 25 Jan 2018 13:08:52 +0000 (08:08 -0500)]
media: v4l2-dev.h: fix symbol collision in media_entity_to_video_device()

A recent change to the media_entity_to_video_device() macro breaks some
use-cases for the macro due to a symbol collision. Before the change
this worked:

    vdev = media_entity_to_video_device(link->sink->entity);

While after the change it results in a compiler error "error: 'struct
video_device' has no member named 'link'; did you mean 'lock'?". While
the following still works after the change.

    struct media_entity *entity = link->sink->entity;
    vdev = media_entity_to_video_device(entity);

Fix the collision by renaming the macro argument to '__entity'.

Fixes: 69b925c5fc36d8f1 ("media: v4l2-dev.h: add kernel-doc to two macros")

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: s2255drv: Remove unneeded if else blocks
Christopher Díaz Riveros [Wed, 24 Jan 2018 21:40:43 +0000 (16:40 -0500)]
media: s2255drv: Remove unneeded if else blocks

Given the following definitions from s2255drv.c

 #define LINE_SZ_4CIFS_NTSC      640
 #define LINE_SZ_2CIFS_NTSC      640
 #define LINE_SZ_1CIFS_NTSC      320

and

 #define LINE_SZ_4CIFS_PAL       704
 #define LINE_SZ_2CIFS_PAL       704
 #define LINE_SZ_1CIFS_PAL       352

f->fmt.pix.width possible values can be reduced to
LINE_SZ_4CIFS_NTSC or LINE_SZ_1CIFS_NTSC.

This patch removes unneeded if else blocks in vidioc_try_fmt_vid_cap
function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: imx-media-vdic: fix inconsistent IS_ERR and PTR_ERR
Gustavo A. R. Silva [Wed, 24 Jan 2018 00:43:40 +0000 (19:43 -0500)]
media: staging: imx-media-vdic: fix inconsistent IS_ERR and PTR_ERR

Fix inconsistent IS_ERR and PTR_ERR in vdic_get_ipu_resources.
The proper pointer to be passed as argument is ch.

This issue was detected with the help of Coccinelle.

Fixes: 0b2e9e7947e7 ("media: staging/imx: remove confusing IS_ERR_OR_NULL usage")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: venus: hfi: use true for boolean values
Gustavo A. R. Silva [Tue, 23 Jan 2018 17:54:53 +0000 (12:54 -0500)]
media: venus: hfi: use true for boolean values

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: buffer.rst: fix link text of VIDIOC_QBUF
Gustavo Padovan [Mon, 22 Jan 2018 12:32:18 +0000 (07:32 -0500)]
media: buffer.rst: fix link text of VIDIOC_QBUF

The link was showing both VIDIOC_QBUF, VIDIOC_DQBUF while it should show
only VIDIOC_QBUF in this case.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rcar_drif: fix error return code in rcar_drif_alloc_dmachannels()
Wei Yongjun [Wed, 17 Jan 2018 11:24:52 +0000 (06:24 -0500)]
media: rcar_drif: fix error return code in rcar_drif_alloc_dmachannels()

Fix to return error code -ENODEV from the dma_request_slave_channel()
error handling case instead of 0, as done elsewhere in this function.
rc can be overwrite to 0 by dmaengine_slave_config() in the for loop.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ramesh Shanmugasundaram <Ramesh.shanmugasundaram@bp.renesas.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbtv: Add USB ID 1f71:3306 to the UTV007 driver
Ian Douglas Scott [Mon, 15 Jan 2018 00:27:55 +0000 (19:27 -0500)]
media: usbtv: Add USB ID 1f71:3306 to the UTV007 driver

Add support for a new USB ID in this driver.

Signed-off-by: Ian Douglas Scott <ian@iandouglasscott.com>
[hans.verkuil@cisco.com: add commit message]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-core: v4l2-mc: Add SPDX license identifier
Shuah Khan [Thu, 11 Jan 2018 22:26:22 +0000 (17:26 -0500)]
media: v4l2-core: v4l2-mc: Add SPDX license identifier

Replace GPL license statement with SPDX GPL-2.0 license identifier.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mtk-vcodec: Always signal source change event on format change
Tomasz Figa [Tue, 9 Jan 2018 08:42:47 +0000 (03:42 -0500)]
media: mtk-vcodec: Always signal source change event on format change

Currently the driver signals the source change event only in case of
a midstream resolution change, however the initial format detection
is also defined as a source change by the V4L2 codec API specification.
Fix this by signaling the event after the initial header is parsed as
well.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Wu-Cheng Li <wuchengli@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbtv: prevent double free in error case
Oliver Neukum [Mon, 8 Jan 2018 14:21:07 +0000 (09:21 -0500)]
media: usbtv: prevent double free in error case

Quoting the original report:

It looks like there is a double-free vulnerability in Linux usbtv driver
on an error path of usbtv_probe function. When audio registration fails,
usbtv_video_free function ends up freeing usbtv data structure, which
gets freed the second time under usbtv_video_fail label.

usbtv_audio_fail:

        usbtv_video_free(usbtv); =>

           v4l2_device_put(&usbtv->v4l2_dev);

              => v4l2_device_put

                  => kref_put

                      => v4l2_device_release

  => usbtv_release (CALLBACK)

                             => kfree(usbtv) (1st time)

usbtv_video_fail:

        usb_set_intfdata(intf, NULL);

        usb_put_dev(usbtv->udev);

        kfree(usbtv); (2nd time)

So, as we have refcounting, use it

Reported-by: Yavuz, Tuba <tuba@ece.ufl.edu>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: media-device: use strlcpy() instead of strncpy()
Xiongfeng Wang [Mon, 8 Jan 2018 12:40:59 +0000 (07:40 -0500)]
media: media-device: use strlcpy() instead of strncpy()

gcc-8 reports

drivers/media/media-device.c: In function 'media_device_get_topology':
./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified
bound 64 equals destination size [-Wstringop-truncation]

We need to use strlcpy() to make sure the dest string is nul-terminated.

Signed-off-by: Xiongfeng Wang <xiongfeng.wang@linaro.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: coda: bump maximum number of internal framebuffers to 19
Philipp Zabel [Thu, 4 Jan 2018 15:58:55 +0000 (10:58 -0500)]
media: coda: bump maximum number of internal framebuffers to 19

While the h.264 standard only allows up to 16 reference frames, the CODA
firmware needs two more buffers: one to hold the currently decoded frame
and one for the display frame. Adding the framebuffer needed by the
driver for VDOA operation brings the total to a maximum of 19 internal
framebuffers.
Lift the current maximum of 17 internal framebuffers to allow playback
of high profile streams that require more than 14 reference frames.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: au0828: fix VIDEO_V4L2 dependency
Arnd Bergmann [Thu, 4 Jan 2018 13:43:50 +0000 (08:43 -0500)]
media: au0828: fix VIDEO_V4L2 dependency

After the move of videobuf2 into the common directory, selecting the
au0828 driver with CONFIG_V4L2 disabled started causing a link failure,
as we now attempt to build videobuf2 but it still requires v4l2:

ERROR: "v4l2_event_pending" [drivers/media/common/videobuf/videobuf2-v4l2.ko] undefined!
ERROR: "v4l2_fh_release" [drivers/media/common/videobuf/videobuf2-v4l2.ko] undefined!
ERROR: "video_devdata" [drivers/media/common/videobuf/videobuf2-v4l2.ko] undefined!
ERROR: "__tracepoint_vb2_buf_done" [drivers/media/common/videobuf/videobuf2-core.ko] undefined!
ERROR: "__tracepoint_vb2_dqbuf" [drivers/media/common/videobuf/videobuf2-core.ko] undefined!
ERROR: "v4l_vb2q_enable_media_source" [drivers/media/common/videobuf/videobuf2-core.ko] undefined!

We want to be able to build the core au0828 support without V4L2,
so this makes the 'select' conditional on V4L2, and refines the
dependencies in VIDEO_AU0828_V4L2 so it can only be enabled in
the exact conditions that have VIDEOBUF2_VMALLOC reachable.

Fixes: 03fbdb2fc2b8 ("media: move videobuf2 to drivers/media/common")
Fixes: 05439b1a3693 ("[media] media: au0828 - convert to use videobuf2")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: atmel-isc: Make local symbol fmt_configs_list static
Wei Yongjun [Sat, 23 Dec 2017 01:57:04 +0000 (20:57 -0500)]
media: atmel-isc: Make local symbol fmt_configs_list static

Fixes the following sparse warning:

drivers/media/platform/atmel/atmel-isc.c:338:19: warning:
 symbol 'fmt_configs_list' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Wenyou Yang <wenyou.yang@microchip.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: imx: allow to build with COMPILE_TEST
Philipp Zabel [Tue, 19 Dec 2017 11:42:32 +0000 (06:42 -0500)]
media: imx: allow to build with COMPILE_TEST

Allow building this driver for other platforms under COMPILE_TEST.

Suggested-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: coda: Add i.MX51 (CodaHx4) support
Philipp Zabel [Mon, 18 Dec 2017 10:16:29 +0000 (05:16 -0500)]
media: coda: Add i.MX51 (CodaHx4) support

Add support for the CodaHx4 VPU used on i.MX51.

Decoding h.264, MPEG-4, and MPEG-2 video works, as well as encoding
h.264. MPEG-4 encoding is not enabled, it currently produces visual
artifacts.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: fix (bogus) sparse warning about uninited me_bits]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dt-bindings: coda: Add compatible for CodaHx4 on i.MX51
Philipp Zabel [Mon, 18 Dec 2017 10:16:28 +0000 (05:16 -0500)]
media: dt-bindings: coda: Add compatible for CodaHx4 on i.MX51

Add a compatible for the CodaHx4 VPU used on i.MX51.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: platform: stm32: Adopt SPDX identifier
Benjamin Gaignard [Tue, 5 Dec 2017 14:51:07 +0000 (09:51 -0500)]
media: platform: stm32: Adopt SPDX identifier

Add SPDX identifiers to files under stm32 directory

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Acked-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agoov13858: fix endiannes warnings
Mauro Carvalho Chehab [Fri, 23 Feb 2018 08:15:42 +0000 (03:15 -0500)]
ov13858: fix endiannes warnings

3 warning regressions:
  + drivers/media/i2c/ov13858.c: warning: cast to restricted __be32:  => 1093:16
  + drivers/media/i2c/ov13858.c: warning: incorrect type in assignment (different base types):  => 1111:13
  + drivers/media/i2c/ov13858.c: warning: incorrect type in initializer (different base types):  => 1071:27

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov5640: fix framerate update
Hugues Fruchet [Thu, 8 Feb 2018 12:22:14 +0000 (07:22 -0500)]
media: ov5640: fix framerate update

After a framerate update through s_frame_interval(), the new
framerate was not taken into account when streaming,
but was taken into account on next session.
This was due to sensor->current_mode not updated accordingly to new
framerate setting in ov5640_s_frame_interval().

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov5640: fix virtual_channel parameter permissions
Hugues Fruchet [Tue, 6 Feb 2018 13:24:09 +0000 (08:24 -0500)]
media: ov5640: fix virtual_channel parameter permissions

Fix module_param(virtual_channel) permissions.
This problem was detected by checkpatch:
$ scripts/checkpatch.pl -f drivers/media/i2c/ov5640.c
ERROR: Use 4 digit octal (0777) not decimal permissions
+module_param(virtual_channel, int, 0);

Also add an error trace in case of virtual_channel not in
the valid range of values.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov5640: various typo & style fixes
Hugues Fruchet [Thu, 1 Feb 2018 08:44:06 +0000 (03:44 -0500)]
media: ov5640: various typo & style fixes

Various typo & style fixes either detected by code
review or checkpatch.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov5640: add error trace in case of i2c read failure
Hugues Fruchet [Wed, 31 Jan 2018 12:46:17 +0000 (07:46 -0500)]
media: ov5640: add error trace in case of i2c read failure

Add an error trace in ov5640_read_reg() in case of i2c_transfer()
failure.
Uniformize error traces using dev_err instead v4l2_err.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov5640: add JPEG support
Hugues Fruchet [Wed, 31 Jan 2018 09:08:10 +0000 (04:08 -0500)]
media: ov5640: add JPEG support

Add YUV422 encoded JPEG support.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2: i2c: ov7670: Implement OF mbus configuration
Jacopo Mondi [Wed, 24 Jan 2018 09:30:50 +0000 (04:30 -0500)]
media: v4l2: i2c: ov7670: Implement OF mbus configuration

ov7670 driver supports two optional properties supplied through platform
data, but currently does not support any standard video interface
property.

Add support through OF parsing for 2 generic properties (vsync and hsync
polarities) and for one custom property already supported through
platform data to suppress pixel clock output during horizontal
blanking.

While at there, check return value of register writes in set_fmt
function and rationalize spacings.

Signal polarities and pixel clock blanking verified through scope and
image capture.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dt-bindings: Add OF properties to ov7670
Jacopo Mondi [Wed, 24 Jan 2018 09:30:49 +0000 (04:30 -0500)]
media: dt-bindings: Add OF properties to ov7670

Describe newly introduced OF properties for ov7670 image sensor.
The driver supports two standard properties to configure synchronism
signals polarities and one custom property already supported as
platform data options to suppress pixel clock during horizontal
blankings.

Re-phrase child nodes description while at there.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: ov9650: fix potential integer overflow in __ov965x_set_frame_interval
Gustavo A. R. Silva [Tue, 30 Jan 2018 00:32:01 +0000 (19:32 -0500)]
media: i2c: ov9650: fix potential integer overflow in __ov965x_set_frame_interval

Cast fi->interval.numerator to u64 in order to avoid a potential integer
overflow. This variable is being used in a context that expects an
expression of type u64.

Addresses-Coverity-ID: 1324146 ("Unintentional integer overflow")
[Sakari Ailus: use do_div() to make this work on 32-bit systems]

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov9650: support device tree probing
Akinobu Mita [Sun, 21 Jan 2018 15:14:14 +0000 (10:14 -0500)]
media: ov9650: support device tree probing

The ov9650 driver currently only supports legacy platform data probe.
This change adds device tree probing.

There has been an attempt to add device tree support for ov9650 driver
by Hugues Fruchet as a part of the patchset that adds support of OV9655
camera (http://www.spinics.net/lists/linux-media/msg117903.html), but
it wasn't merged into mainline because creating a separate driver for
OV9655 is preferred.

This is very similar to Hugues's patch, but not supporting new device.

Cc: Jacopo Mondi <jacopo@jmondi.org>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Hugues Fruchet <hugues.fruchet@st.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Cc: Rob Herring <robh@kernel.org>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov9650: add device tree binding
Akinobu Mita [Sun, 21 Jan 2018 15:14:16 +0000 (10:14 -0500)]
media: ov9650: add device tree binding

Now the ov9650 driver supports device tree probing.  So this adds a
device tree binding documentation.

Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Jacopo Mondi <jacopo@jmondi.org>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Hugues Fruchet <hugues.fruchet@st.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: MAINTAINERS: add entry for ov9650 driver
Akinobu Mita [Sun, 21 Jan 2018 15:14:15 +0000 (10:14 -0500)]
media: MAINTAINERS: add entry for ov9650 driver

This adds an entry to the MAINTAINERS file for ov9650 driver.  The
following persons are added in this entry.

* Sakari as a person who looks after media sensor driver patches
* Sylwester as a module author
* Myself as a person who has the hardware and can test the patches

Cc: Jacopo Mondi <jacopo@jmondi.org>
Cc: H. Nikolaus Schaller <hns@goldelico.com>
Cc: Hugues Fruchet <hugues.fruchet@st.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov13858: Use false for boolean value
Gustavo A. R. Silva [Tue, 23 Jan 2018 17:49:29 +0000 (12:49 -0500)]
media: ov13858: Use false for boolean value

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov13858: Avoid possible null first frame
Chiranjeevi Rapolu [Thu, 25 Jan 2018 04:34:39 +0000 (23:34 -0500)]
media: ov13858: Avoid possible null first frame

Previously, the sensor, with default settings, was outputting SOF without
data. This results in frame sync error on the receiver side.

Now, configure the sensor to output SOF with MIPI data for all frames. This
avoids possible null first frame on the bus.

Signed-off-by: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
Signed-off-by: Tianshu Qiu <tian.shu.qiu@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov2685: Assign ret in default case in s_ctrl callback
Sakari Ailus [Fri, 19 Jan 2018 10:49:02 +0000 (05:49 -0500)]
media: ov2685: Assign ret in default case in s_ctrl callback

Assign ret in the default case for s_ctrl callback. This can't happen but
still may result in compiler warnings.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov2685: add support for OV2685 sensor
Shunqian Zheng [Tue, 16 Jan 2018 09:22:01 +0000 (04:22 -0500)]
media: ov2685: add support for OV2685 sensor

This patch adds driver for Omnivision's ov2685 sensor.
Though the ov2685 can output yuv data, this driver only
supports the raw bayer format, including the following features:
  - output 1600x1200 at 30fps
  - test patterns
  - manual exposure/gain control
  - vblank and hblank
  - media controller
  - runtime pm

[Sakari Ailus: trivial: ov5695_of_match -> ov2685_of_match]

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dt-bindings: media: Add bindings for OV2685
Shunqian Zheng [Tue, 16 Jan 2018 09:22:00 +0000 (04:22 -0500)]
media: dt-bindings: media: Add bindings for OV2685

Add device tree binding documentation for the OV2685 sensor.

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov5695: add support for OV5695 sensor
Shunqian Zheng [Tue, 16 Jan 2018 09:21:59 +0000 (04:21 -0500)]
media: ov5695: add support for OV5695 sensor

This patch adds driver for Omnivision's ov5695 sensor,
the driver supports following features:
 - supported resolutions
   + 2592x1944 at 30fps
   + 1920x1080 at 30fps
   + 1296x972 at 60fps
   + 1280x720 at 30fps
   + 640x480 at 120fps
 - test patterns
 - manual exposure/gain(analog and digital) control
 - vblank and hblank
 - media controller
 - runtime pm

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dt-bindings: media: Add bindings for OV5695
Shunqian Zheng [Tue, 16 Jan 2018 09:21:58 +0000 (04:21 -0500)]
media: dt-bindings: media: Add bindings for OV5695

Add device tree binding documentation for the OV5695 sensor.

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mt9t031: deprecate, move to staging
Hans Verkuil [Tue, 16 Jan 2018 11:02:45 +0000 (06:02 -0500)]
media: mt9t031: deprecate, move to staging

This driver is unused and depends on the deprecated soc-camera framework.
Move it to staging in preparation for being removed unless someone does
the work to convert it to a proper V4L2 subdev driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: imx074: deprecate, move to staging
Hans Verkuil [Tue, 16 Jan 2018 11:02:44 +0000 (06:02 -0500)]
media: imx074: deprecate, move to staging

This driver is unused and depends on the deprecated soc-camera framework.
Move it to staging in preparation for being removed unless someone does
the work to convert it to a proper V4L2 subdev driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: intel-ipu3: cio2: Use SPDX license headers
Yong Zhi [Fri, 16 Feb 2018 23:48:34 +0000 (18:48 -0500)]
media: intel-ipu3: cio2: Use SPDX license headers

Adopt SPDX license headers for ipu3 cio2 driver.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: intel-ipu3: cio2: Disable and sync irq before stream off
Yong Zhi [Fri, 9 Feb 2018 00:14:24 +0000 (19:14 -0500)]
media: intel-ipu3: cio2: Disable and sync irq before stream off

This is to avoid pending interrupts to be handled during
stream off, in which case, the ready buffer will be removed
from buffer list, thus not all buffers can be returned to VB2
as expected. Disable CIO2 irq at cio2_hw_exit() so no new
interrupts are generated.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Tianshu Qiu <tian.shu.qiu@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: uvcvideo: Fixed ktime_t to ns conversion
Jasmin Jessich [Sun, 14 Jan 2018 10:21:43 +0000 (05:21 -0500)]
media: uvcvideo: Fixed ktime_t to ns conversion

Commit 828ee8c71950 ("media: uvcvideo: Use ktime_t for timestamps")
changed to use ktime_t for timestamps. Older Kernels use a struct for
ktime_t, which requires the conversion function ktime_to_ns to be used on
some places. With this patch it will compile now also for older Kernel
versions.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: uvcvideo: Use parentheses around sizeof operand
Laurent Pinchart [Tue, 16 Jan 2018 17:45:36 +0000 (12:45 -0500)]
media: uvcvideo: Use parentheses around sizeof operand

While the sizeof is an operator and not a function, the preferred coding
style in the kernel is to enclose its operand in parentheses. To avoid
mixing multiple coding styles in the driver, use parentheses around all
sizeof operands.

While at it replace a kmalloc() with a kmalloc_array() to silence a
checkpatch warning triggered by this patch.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: uvcvideo: Use internal kernel integer types
Laurent Pinchart [Tue, 16 Jan 2018 17:45:36 +0000 (12:45 -0500)]
media: uvcvideo: Use internal kernel integer types

Replace the __[su]{8,16,32} variant of integer types with the
non-underscored types as the code is internal to the driver, not exposed
to userspace.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: uvcvideo: Use kernel integer types
Laurent Pinchart [Tue, 16 Jan 2018 17:35:17 +0000 (12:35 -0500)]
media: uvcvideo: Use kernel integer types

Replace the uint_{8,16,32} types with the corresponding native kernel
types u{8,16,32}.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: uvcvideo: Drop extern keyword in function declarations
Laurent Pinchart [Tue, 16 Jan 2018 17:32:54 +0000 (12:32 -0500)]
media: uvcvideo: Drop extern keyword in function declarations

The extern keyword isn't needed to declare functions in header files.
Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: uvcvideo: Support multiple frame descriptors with the same dimensions
Philipp Zabel [Thu, 4 Jan 2018 22:51:29 +0000 (17:51 -0500)]
media: uvcvideo: Support multiple frame descriptors with the same dimensions

The Microsoft HoloLens Sensors device has two separate frame descriptors
with the same dimensions, each with a single different frame interval:

      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         1
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                           1280
        wHeight                           481
        dwMinBitRate                147763200
        dwMaxBitRate                147763200
        dwMaxVideoFrameBufferSize      615680
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         2
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                           1280
        wHeight                           481
        dwMinBitRate                443289600
        dwMaxBitRate                443289600
        dwMaxVideoFrameBufferSize      615680
        dwDefaultFrameInterval         111111
        bFrameIntervalType                  1
        dwFrameInterval( 0)            111111

Skip duplicate dimensions in enum_framesizes, let enum_frameintervals list
the intervals from both frame descriptors. Change set_streamparm to switch
to the correct frame index when changing the interval. This enables 90 fps
capture on a Lenovo Explorer Windows Mixed Reality headset.

[laurent.pinchart@ideasonboard.com: Renamed tmp_ival to ival]

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: uvcvideo: Apply flags from device to actual properties
Edgar Thier [Thu, 12 Oct 2017 07:54:17 +0000 (03:54 -0400)]
media: uvcvideo: Apply flags from device to actual properties

Use flags the device exposes for UVC controls.
This allows the device to define which property flags are set.

Since some cameras offer auto-adjustments for properties (e.g. auto-gain),
the values of other properties (e.g. gain) can change in the camera.
Examining the flags ensures that the driver is aware of such properties.

Signed-off-by: Edgar Thier <info@edgarthier.net>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agotda1997x: get rid of an unused var
Mauro Carvalho Chehab [Thu, 22 Feb 2018 17:54:28 +0000 (12:54 -0500)]
tda1997x: get rid of an unused var

1 warning regressions:
  + drivers/media/i2c/tda1997x.c: warning: variable 'last_irq_status' set but not used [-Wunused-but-set-variable]:  => 1421:17

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: Add TDA1997x HDMI receiver driver
Tim Harvey [Thu, 15 Feb 2018 17:55:34 +0000 (12:55 -0500)]
media: i2c: Add TDA1997x HDMI receiver driver

Add support for the TDA1997x HDMI receivers.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: fix type 'testin' -> 'testing']
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dt-bindings: Add bindings for TDA1997X
Tim Harvey [Thu, 15 Feb 2018 17:55:33 +0000 (12:55 -0500)]
media: dt-bindings: Add bindings for TDA1997X

Define the device tree bindings for the TDA1997X.

Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: make a proper commit message]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: MAINTAINERS: add entry for NXP TDA1997x driver
Tim Harvey [Thu, 15 Feb 2018 17:55:32 +0000 (12:55 -0500)]
media: MAINTAINERS: add entry for NXP TDA1997x driver

Add new MAINTAINERS entry.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: make a proper commit message]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: add digital video decoder entity functions
Tim Harvey [Thu, 15 Feb 2018 17:55:31 +0000 (12:55 -0500)]
media: add digital video decoder entity functions

Add a new media entity function definition for digital TV decoders:
MEDIA_ENT_F_DTV_DECODER

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l-ioctl: fix clearing pad for VIDIOC_DV_TIMINGS_CAP
Tim Harvey [Thu, 15 Feb 2018 17:55:30 +0000 (12:55 -0500)]
media: v4l-ioctl: fix clearing pad for VIDIOC_DV_TIMINGS_CAP

The pad field was inadvertently cleared. Fix this. It's needed for subdevs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: make a proper commit message]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-dv-timings: add v4l2_hdmi_colorimetry()
Hans Verkuil [Thu, 15 Feb 2018 17:55:29 +0000 (12:55 -0500)]
media: v4l2-dv-timings: add v4l2_hdmi_colorimetry()

Add the v4l2_hdmi_colorimetry() function so we have a single function
that determines the colorspace, YCbCr encoding, quantization range and
transfer function from the InfoFrame data.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vidioc-g-parm.rst: also allow _MPLANE buffer types
Hans Verkuil [Mon, 22 Jan 2018 10:02:19 +0000 (05:02 -0500)]
media: vidioc-g-parm.rst: also allow _MPLANE buffer types

The specification mentions that type can be V4L2_BUF_TYPE_VIDEO_CAPTURE,
but the v4l2 core implementation also allows the _MPLANE variant.

Document this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-subdev.h: remove obsolete g/s_parm
Hans Verkuil [Fri, 19 Jan 2018 13:57:44 +0000 (08:57 -0500)]
media: v4l2-subdev.h: remove obsolete g/s_parm

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: atomisp: Drop g_parm and s_parm subdev ops use
Sakari Ailus [Sun, 21 Jan 2018 21:49:47 +0000 (16:49 -0500)]
media: staging: atomisp: Drop g_parm and s_parm subdev ops use

The s_parm and g_parm did nothing. Remove them.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: atomisp: mt9m114: Drop empty s_parm callback
Sakari Ailus [Sun, 21 Jan 2018 21:48:45 +0000 (16:48 -0500)]
media: staging: atomisp: mt9m114: Drop empty s_parm callback

The s_parm callback in mt9m114 driver did nothing, remove it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: atomisp: i2c: Drop g_parm support in sensor drivers
Sakari Ailus [Sun, 21 Jan 2018 21:47:29 +0000 (16:47 -0500)]
media: staging: atomisp: i2c: Drop g_parm support in sensor drivers

These drivers already support g_frame_interval. Therefore just dropping
g_parm is enough.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: atomisp: i2c: Disable non-preview configurations
Sakari Ailus [Mon, 19 Feb 2018 13:27:19 +0000 (08:27 -0500)]
media: staging: atomisp: i2c: Disable non-preview configurations

These sensor drivers have use case specific mode lists. This is currently
not used nor there is a standard API for selecting the mode list. Disable
configurations for non-preview modes until configuration selection is
improved so that all the configurations are always usable.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
[hans.verkuil@cisco.com: clarify that this functionality it currently unused]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: atomisp: Kill subdev s_parm abuse
Sakari Ailus [Sun, 21 Jan 2018 21:43:42 +0000 (16:43 -0500)]
media: staging: atomisp: Kill subdev s_parm abuse

Remove sensor driver's interface for setting the use case specific mode
list as well as the mode lists that are related to other than
CI_MODE_PREVIEW. This removes s_parm abuse in using driver specific values
in v4l2_streamparm.capture.capturemode. The drivers already support
[gs]_frame_interval so removing support for [gs]_parm is enough.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: convert g/s_parm to g/s_frame_interval in subdevs
Hans Verkuil [Mon, 22 Jan 2018 09:00:45 +0000 (04:00 -0500)]
media: convert g/s_parm to g/s_frame_interval in subdevs

Convert all g/s_parm calls to g/s_frame_interval. This allows us
to remove the g/s_parm ops since those are a duplicate of
g/s_frame_interval.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-common: create v4l2_g/s_parm_cap helpers
Hans Verkuil [Mon, 22 Jan 2018 08:58:36 +0000 (03:58 -0500)]
media: v4l2-common: create v4l2_g/s_parm_cap helpers

Create helpers to handle VIDIOC_G/S_PARM by querying the
g/s_frame_interval v4l2_subdev ops.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-subdev: clear reserved fields
Hans Verkuil [Sat, 3 Feb 2018 13:20:21 +0000 (08:20 -0500)]
media: v4l2-subdev: clear reserved fields

Clear the reserved fields for these ioctls according to the specification:

VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
VIDIOC_SUBDEV_ENUM_FRAME_SIZE
VIDIOC_SUBDEV_ENUM_MBUS_CODE
VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP
VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT
VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL
VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION

Found with v4l2-compliance.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: get start time just before calling driver tx
Sean Young [Mon, 12 Feb 2018 14:00:28 +0000 (09:00 -0500)]
media: rc: get start time just before calling driver tx

The current code gets the start time before copying the IR from
userspace (could cause page faults) and encoding IR. This means
that the gap calculation could be off.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: remove useless if statement
Sean Young [Mon, 12 Feb 2018 13:59:00 +0000 (08:59 -0500)]
media: rc: remove useless if statement

ret is always 0, so remove if statement.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: remove obsolete comment
Sean Young [Mon, 12 Feb 2018 13:58:01 +0000 (08:58 -0500)]
media: rc: remove obsolete comment

This comment is no longer relevant.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: remove IR_dprintk() from rc-core
Sean Young [Mon, 12 Feb 2018 12:27:50 +0000 (07:27 -0500)]
media: rc: remove IR_dprintk() from rc-core

Use dev_dbg() rather than custom debug function.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: replace IR_dprintk() with dev_dbg in IR decoders
Sean Young [Mon, 12 Feb 2018 12:20:52 +0000 (07:20 -0500)]
media: rc: replace IR_dprintk() with dev_dbg in IR decoders

Use dev_dbg() rather than custom debug function.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: ir-spi: fix duty cycle
Sean Young [Sat, 27 Jan 2018 14:05:37 +0000 (09:05 -0500)]
media: rc: ir-spi: fix duty cycle

Calculate the pulse rather than having a few preset values.

Signed-off-by: Sean Young <sean@mess.org>
Acked-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: ir-hix5hd2: fix error handling of clk_prepare_enable()
Alexey Khoroshilov [Fri, 26 Jan 2018 22:10:17 +0000 (17:10 -0500)]
media: rc: ir-hix5hd2: fix error handling of clk_prepare_enable()

Return code of clk_prepare_enable() is ignored in many places.
The patch adds error handling for all of them.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: don't mark IR decoders default y
Andi Kleen [Thu, 25 Jan 2018 22:19:08 +0000 (17:19 -0500)]
media: rc: don't mark IR decoders default y

I usually update my config with make oldconfig and pressing return,
trusting that whoever updates Kconfig sets sensible defaults.

But my recent kernels ended up with all kinds of IR decoders
built in that are not used by anything because they are all
marked with default y.

default y should only be set for something that prevents
booting on common systems, never for some random weirdo
driver feature like this.

Remove all the "default y" in drivers/media/rc/Kconfig

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: add video control handlers using V4L2 control framework
Florian Echtler [Thu, 8 Feb 2018 08:43:06 +0000 (03:43 -0500)]
media: add video control handlers using V4L2 control framework

This patch registers four standard control handlers using the corresponding
V4L2 framework.

Signed-off-by: Florian Echtler <floe@butterbrot.org>
[hans.verkuil@cisco.com: lower-cased 0x0F and 0xF0]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: add panel register access functions
Florian Echtler [Thu, 8 Feb 2018 08:43:05 +0000 (03:43 -0500)]
media: add panel register access functions

These functions provide write access to the internal LCD panel registers
which also control the sensor. They can be used to disable the
preprocessor, set the illumination brightness, and adjust gain/contrast
(which are stored together in one register internally called "vsvideo").

Signed-off-by: Florian Echtler <floe@butterbrot.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: add default settings and module parameters for video controls
Florian Echtler [Thu, 8 Feb 2018 08:43:04 +0000 (03:43 -0500)]
media: add default settings and module parameters for video controls

This patch adds parameter definitions and module parameters for the four
userspace controls that the SUR40 can currently provide.

Signed-off-by: Florian Echtler <floe@butterbrot.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: add missing blob structure field for tag id
Florian Echtler [Thu, 8 Feb 2018 08:43:03 +0000 (03:43 -0500)]
media: add missing blob structure field for tag id

The SUR40 can recognize specific printed patterns directly in hardware;
this information (i.e. the pattern id) is present but currently unused
in the blob structure.

Signed-off-by: Florian Echtler <floe@butterbrot.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: include/(uapi/)media: add SPDX license info
Hans Verkuil [Wed, 7 Feb 2018 14:05:46 +0000 (09:05 -0500)]
media: include/(uapi/)media: add SPDX license info

Replace the old license information with the corresponding SPDX
license for those headers that I authored.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: add SPDX license info
Hans Verkuil [Wed, 7 Feb 2018 14:34:55 +0000 (09:34 -0500)]
media: add SPDX license info

Replace the old license information with the corresponding SPDX
license for the remaining media drivers that Cisco authored.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: add SPDX license info
Hans Verkuil [Wed, 7 Feb 2018 14:34:26 +0000 (09:34 -0500)]
media: i2c: add SPDX license info

Replace the old license information with the corresponding SPDX
license for those drivers Cisco authored.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cec: add SPDX license info
Hans Verkuil [Wed, 7 Feb 2018 14:34:03 +0000 (09:34 -0500)]
media: cec: add SPDX license info

Replace the old license information with the corresponding SPDX
license.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cobalt: add SPDX license info
Hans Verkuil [Wed, 7 Feb 2018 14:27:12 +0000 (09:27 -0500)]
media: cobalt: add SPDX license info

Replace the old license information with the corresponding SPDX
license.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vivid: add SPDX license info
Hans Verkuil [Wed, 7 Feb 2018 14:12:45 +0000 (09:12 -0500)]
media: vivid: add SPDX license info

Replace the old license information with the corresponding SPDX
license.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agoLinux 4.16-rc1
Linus Torvalds [Sun, 11 Feb 2018 23:04:29 +0000 (15:04 -0800)]
Linux 4.16-rc1