platform/kernel/linux-rpi.git
6 years agomedia: staging/imx: Implement init_cfg subdev pad op
Steve Longerbeam [Sun, 11 Feb 2018 18:29:34 +0000 (13:29 -0500)]
media: staging/imx: Implement init_cfg subdev pad op

Implement the init_cfg pad op in all imx-media subdevices. The try
formats are initialized to the current active formats on all pads.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: imx-ic-prpencvf: Use empty initializer to clear all struct members
Fabio Estevam [Sat, 10 Feb 2018 14:38:50 +0000 (09:38 -0500)]
media: imx-ic-prpencvf: Use empty initializer to clear all struct members

{0} only cleans the first member of the structure.

Use {} instead, which cleans all the members of the structure.

Reported-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: imx-media-internal-sd: Use empty initializer
Fabio Estevam [Fri, 9 Feb 2018 23:11:16 +0000 (18:11 -0500)]
media: imx-media-internal-sd: Use empty initializer

When building with W=1 the following warning shows up:

drivers/staging/media/imx/imx-media-internal-sd.c:274:49: warning: Using plain integer as NULL pointer

Fix this problem by using an empty initializer, which guarantees that all
struct members are zero-cleared.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
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: stm32-dcmi: add g/s_parm framerate support
Hugues Fruchet [Thu, 8 Feb 2018 11:00:45 +0000 (06:00 -0500)]
media: stm32-dcmi: add g/s_parm framerate support

Add g/s_parm framerate support by calling subdev
g/s_frame_interval ops.
This allows user to control sensor framerate by
calling ioctl G/S_PARM.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: adv748x: Fix cleanup jump on chip identification
Kieran Bingham [Wed, 7 Feb 2018 21:11:35 +0000 (16:11 -0500)]
media: i2c: adv748x: Fix cleanup jump on chip identification

The error handling for the adv748x_identify_chip() call erroneously
jumps to the err_cleanup_clients label before the clients have been
established.

Correct this by jumping to the next (and correct) label in the cleanup
code: err_cleanup_dt.

Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver")

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 <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: stm32-dcmi: improve error trace points
Hugues Fruchet [Wed, 7 Feb 2018 17:35:36 +0000 (12:35 -0500)]
media: stm32-dcmi: improve error trace points

Fix some missing "\n".
Trace error returned by subdev streamon/streamoff.
Remove extra "0x" unneeded with %pad formatter.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: stm32-dcmi: remove redundant clear of interrupt flags
Hugues Fruchet [Wed, 7 Feb 2018 17:35:35 +0000 (12:35 -0500)]
media: stm32-dcmi: remove redundant clear of interrupt flags

It is already cleared in dcmi_irq_callback().

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: stm32-dcmi: remove redundant capture enable
Hugues Fruchet [Wed, 7 Feb 2018 17:35:34 +0000 (12:35 -0500)]
media: stm32-dcmi: remove redundant capture enable

Remove redundant capture enable already done
in dcmi_start_capture().

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: vsp1: Fix video output on R8A77970
Sergei Shtylyov [Thu, 18 Jan 2018 14:05:51 +0000 (09:05 -0500)]
media: v4l: vsp1: Fix video output on R8A77970

Commit d455b45f8393 ("v4l: vsp1: Add support for new VSP2-BS, VSP2-DL,
and VSP2-D instances") added support for the VSP2-D found in the R-Car
V3M (R8A77970) but the video output that VSP2-D sends to DU has a greenish
garbage-like line repeated every 8 screen rows. It turns out that R-Car
V3M has the LIF0 buffer attribute register that you need to set to a non-
default value in order to get rid of the output artifacts.

Based on the original (and large) patch by Daisuke Matsushita
<daisuke.matsushita.ns@hitachi.com>.

Fixes: d455b45f8393 ("v4l: vsp1: Add support for new VSP2-BS, VSP2-DL and VSP2-D instances")
[Removed braces, added VI6_IP_VERSION_MASK to improve readabiliy]

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: vsp1: Fix mask creation for MULT_ALPHA_RATIO
Wolfram Sang [Mon, 5 Feb 2018 20:09:58 +0000 (15:09 -0500)]
media: v4l: vsp1: Fix mask creation for MULT_ALPHA_RATIO

Due to a typo, the mask was destroyed by a comparison instead of a bit
shift. No regression since the mask has not been used yet.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: vsp1: Print the correct blending unit name in debug messages
Laurent Pinchart [Sat, 2 Dec 2017 19:39:51 +0000 (14:39 -0500)]
media: v4l: vsp1: Print the correct blending unit name in debug messages

The DRM pipelines can use either the BRU or the BRS for blending. Make
sure the right name is used in debugging messages to avoid confusion.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: vsp1: Fix header display list status check in continuous mode
Kieran Bingham [Fri, 9 Feb 2018 14:50:34 +0000 (09:50 -0500)]
media: v4l: vsp1: Fix header display list status check in continuous mode

To allow dual pipelines utilising two WPF entities when available, the
VSP was updated to support header-mode display list in continuous
pipelines.

A small bug in the status check of the command register causes the
second pipeline to be directly afflicted by the running of the first;
appearing as a perceived performance issue with stuttering display.

Fix the vsp1_dl_list_hw_update_pending() call to ensure that the read
comparison corresponds to the correct pipeline.

Fixes: eaf4bfad6ad8 ("v4l: vsp1: Add support for header display lists in continuous mode")

Cc: "Stable v4.14+" <stable@vger.kernel.org>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: vsp1: Fix display stalls when requesting too many inputs
Laurent Pinchart [Sun, 3 Dec 2017 10:06:57 +0000 (05:06 -0500)]
media: v4l: vsp1: Fix display stalls when requesting too many inputs

Make sure we don't accept more inputs than the hardware can handle. This
is a temporary fix to avoid display stall, we need to instead allocate
the BRU or BRS to display pipelines dynamically based on the number of
planes they each use.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: media.h: reorganize header to make it easier to understand
Hans Verkuil [Mon, 5 Feb 2018 11:19:00 +0000 (06:19 -0500)]
media: media.h: reorganize header to make it easier to understand

The media.h public header is very messy. It mixes legacy and 'new' defines
and it is not easy to figure out what should and what shouldn't be used. It
also contains confusing comment that are either out of date or completely
uninteresting for anyone that needs to use this header.

The patch groups all entity functions together, including the 'old' defines
based on the old range base. The reader just wants to know about the available
functions and doesn't care about what range is used.

All legacy defines are moved to the end of the header, so it is easier to
locate them and just ignore them.

The legacy structs in the struct media_entity_desc are put under
also a much more effective signal to the reader that they shouldn't be used
compared to the old method of relying on '#if 1' followed by a comment.

The unused MEDIA_INTF_T_ALSA_* defines are also moved to the end of the header
in the legacy area. They are also dropped from intf_type() in media-entity.c.

All defines are also aligned at the same tab making the header easier to read.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[mchehab@s-opensource.com: removed lots of spaces before tabs; typo changes ->change ]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: media-ioc-enum-entities/links.rst: document reserved fields
Hans Verkuil [Sat, 3 Feb 2018 18:26:07 +0000 (13:26 -0500)]
media: media-ioc-enum-entities/links.rst: document reserved fields

These structures have reserved fields that were never documented.

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: document the reservedX fields in media_v2_topology
Hans Verkuil [Sat, 3 Feb 2018 18:06:01 +0000 (13:06 -0500)]
media: document the reservedX fields in media_v2_topology

The MEDIA_IOC_G_TOPOLOGY documentation didn't document the reservedX
fields. Related to that was that the documented type of the num_* fields
was also wrong.

Fix both.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: zero reservedX fields in media_v2_topology
Hans Verkuil [Sat, 3 Feb 2018 18:06:01 +0000 (13:06 -0500)]
media: zero reservedX fields in media_v2_topology

The MEDIA_IOC_G_TOPOLOGY implementation did not zero the reservedX fields.
Fix this.

Found with v4l2-compliance.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: media.h: fix confusing typo in comment
Hans Verkuil [Mon, 5 Feb 2018 09:30:48 +0000 (04:30 -0500)]
media: media.h: fix confusing typo in comment

Subdevs are initialized with MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN, not
MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN.

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: media-device.c: zero reserved fields
Hans Verkuil [Sat, 3 Feb 2018 18:46:05 +0000 (13:46 -0500)]
media: media-device.c: zero reserved fields

MEDIA_IOC_SETUP_LINK didn't zero the reserved field of the media_link_desc
struct. Do so in media_device_setup_link().

MEDIA_IOC_ENUM_LINKS didn't zero the reserved field of the media_links_enum
struct. Do so in media_device_enum_links().

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: media-types.rst: fix typo
Alexandre Courbot [Mon, 5 Feb 2018 02:24:02 +0000 (21:24 -0500)]
media: media-types.rst: fix typo

with -> which

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: media-types.rst: fix type, small improvements
Hans Verkuil [Sun, 4 Feb 2018 13:40:37 +0000 (08:40 -0500)]
media: media-types.rst: fix type, small improvements

data conector -> connector

... -> etc.

'...' looked odd when my browser put the ... by itself on the next line, 'etc.'
is clearer IMHO.

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: media-ioc-g-topology.rst: fix interface-to-entity link description
Hans Verkuil [Sat, 3 Feb 2018 19:18:38 +0000 (14:18 -0500)]
media: media-ioc-g-topology.rst: fix interface-to-entity link description

The source_id and sink_id descriptions were the same for interface-to-entity
links. The source_id is the interface ID, not the entity ID. Fix 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: implement VIDIOC_DBG_G_CHIP_INFO ioctl
Hans Verkuil [Sat, 3 Feb 2018 13:24:44 +0000 (08:24 -0500)]
media: v4l2-subdev: implement VIDIOC_DBG_G_CHIP_INFO ioctl

The VIDIOC_DBG_G/S_REGISTER ioctls imply that VIDIOC_DBG_G_CHIP_INFO is also
present, since without that you cannot use v4l2-dbg.

Just like the implementation in v4l2-ioctl.c this can be implemented in the
core and no drivers need to be modified.

It also makes it possible for v4l2-compliance to properly test the
VIDIOC_DBG_G/S_REGISTER ioctls.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-subdev: without controls return -ENOTTY
Hans Verkuil [Fri, 2 Feb 2018 13:05:23 +0000 (08:05 -0500)]
media: v4l2-subdev: without controls return -ENOTTY

If the subdev did not define any controls, then return -ENOTTY if
userspace attempts to call these ioctls.

The control framework functions will return -EINVAL, not -ENOTTY if
vfh->ctrl_handler is NULL.

Several of these framework functions are also called directly from
drivers, so I don't want to change the error code there.

Found with vimc and 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: vimc: use correct subdev functions
Hans Verkuil [Wed, 7 Feb 2018 17:06:30 +0000 (12:06 -0500)]
media: vimc: use correct subdev functions

Instead of calling everything a MEDIA_ENT_F_ATV_DECODER, pick the
correct functions for these blocks.

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: vimc: fix control event handling
Hans Verkuil [Fri, 2 Feb 2018 13:00:32 +0000 (08:00 -0500)]
media: vimc: fix control event handling

The sensor subdev didn't handle control events. Add support for this.
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: tw9910: solve coding style issues
Mauro Carvalho Chehab [Mon, 26 Feb 2018 14:25:26 +0000 (09:25 -0500)]
media: tw9910: solve coding style issues

As we're adding this as a new driver, make checkpatch happier by
solving several style issues, using --fix-inplace at strict mode.

Some issues required manual work.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov772x: fix whitespace issues
Mauro Carvalho Chehab [Mon, 26 Feb 2018 14:23:32 +0000 (09:23 -0500)]
media: ov772x: fix whitespace issues

As we're adding this as a new driver, make checkpatch happier by
solving some whitespace issues, using --fix-inplace.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: arch: sh: migor: Use new renesas-ceu camera driver
Jacopo Mondi [Wed, 21 Feb 2018 17:48:04 +0000 (12:48 -0500)]
media: arch: sh: migor: Use new renesas-ceu camera driver

Migo-R platform uses sh_mobile_ceu camera driver, which is now being
replaced by a proper V4L2 camera driver named 'renesas-ceu'.

Move Migo-R platform to use the v4l2 renesas-ceu camera driver
interface and get rid of soc_camera defined components used to register
sensor drivers and of platform specific enable/disable routines.

Register clock source and GPIOs for sensor drivers, so they can use
clock and gpio APIs.

Also, memory for CEU video buffers is now reserved with membocks APIs,
and need to be declared as dma_coherent during machine initialization to
remove that architecture specific part from CEU driver.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
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: MAINTAINERS: Add entry for Techwell TW9910
Jacopo Mondi [Thu, 22 Feb 2018 09:47:19 +0000 (04:47 -0500)]
media: MAINTAINERS: Add entry for Techwell TW9910

Add entry for Techwell TW9910 video decoder. The driver is currently
orphaned.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: tw9910: Remove soc_camera dependencies
Jacopo Mondi [Wed, 21 Feb 2018 17:48:03 +0000 (12:48 -0500)]
media: i2c: tw9910: Remove soc_camera dependencies

Remove soc_camera framework dependencies from tw9910 sensor driver.
- Handle clock and gpios
- Register async subdevice
- Remove soc_camera specific g/s_mbus_config operations
- Add kernel doc to driver interface header file
- Adjust build system

This commit does not remove the original soc_camera based driver as long
as other platforms depends on soc_camera-based CEU driver.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
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: i2c: Copy tw9910 soc_camera sensor driver
Jacopo Mondi [Wed, 21 Feb 2018 17:48:02 +0000 (12:48 -0500)]
media: i2c: Copy tw9910 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.
No modification to KConfig and Makefile as soc_camera framework
dependencies need to be removed first in next commit.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-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: MAINTAINERS: Add entry for Omnivision OV772x
Jacopo Mondi [Thu, 22 Feb 2018 09:47:18 +0000 (04:47 -0500)]
media: MAINTAINERS: Add entry for Omnivision OV772x

Add entry for Omnivision OV772x image sensor listing myself as maintainer
for 'Odd fixes' only, as I currently have access to a platform for
testing.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: ov772x: Support frame interval handling
Jacopo Mondi [Wed, 21 Feb 2018 17:48:01 +0000 (12:48 -0500)]
media: i2c: ov772x: Support frame interval handling

Add support to ov772x driver for frame intervals handling and enumeration.
Tested with 10MHz and 24MHz input clock at VGA and QVGA resolutions for
10, 15 and 30 frame per second rates.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
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: i2c: ov772x: Remove soc_camera dependencies
Jacopo Mondi [Wed, 21 Feb 2018 17:48:00 +0000 (12:48 -0500)]
media: i2c: ov772x: Remove soc_camera dependencies

Remove soc_camera framework dependencies from ov772x sensor driver.
- Handle clock and gpios
- Register async subdevice
- Remove soc_camera specific g/s_mbus_config operations
- Change image format colorspace from JPEG to SRGB as the two use the
  same colorspace information but JPEG makes assumptions on color
  components quantization that do not apply to the sensor
- Remove sizes crop from get_selection as driver can't scale
- Add kernel doc to driver interface header file
- Adjust build system

This commit does not remove the original soc_camera based driver as long
as other platforms depends on soc_camera-based CEU driver.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
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: i2c: Copy ov772x soc_camera sensor driver
Jacopo Mondi [Wed, 21 Feb 2018 17:47:59 +0000 (12:47 -0500)]
media: i2c: Copy ov772x 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.
No modification to KConfig and Makefile as soc_camera framework
dependencies need to be removed first in next commit.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-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: MAINTAINERS: Add entry for Renesas CEU
Jacopo Mondi [Thu, 22 Feb 2018 09:47:17 +0000 (04:47 -0500)]
media: MAINTAINERS: Add entry for Renesas CEU

Add entry for Renesas Capture Engine Interface listing myself as
maintainer.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: platform: Add Renesas CEU driver
Jacopo Mondi [Thu, 22 Feb 2018 10:37:19 +0000 (05:37 -0500)]
media: platform: Add Renesas CEU driver

Add driver for Renesas Capture Engine Unit (CEU).

The CEU interface supports capturing 'data' (YUV422) and 'images'
(NV[12|21|16|61]).

This driver aims to replace the soc_camera-based sh_mobile_ceu one.

Tested with ov7670 camera sensor, providing YUYV_2X8 data on Renesas RZ
platform GR-Peach.

Tested with ov7725 camera sensor on SH4 platform Migo-R.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: added two 'fall-through' comments]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: include: media: Add Renesas CEU driver interface
Jacopo Mondi [Wed, 21 Feb 2018 17:47:56 +0000 (12:47 -0500)]
media: include: media: Add Renesas CEU driver interface

Add renesas-ceu header file.

Do not remove the existing sh_mobile_ceu.h one as long as the original
driver does not go away.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
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: dt-bindings: media: Add Renesas CEU bindings
Jacopo Mondi [Wed, 21 Feb 2018 17:47:55 +0000 (12:47 -0500)]
media: dt-bindings: media: Add Renesas CEU bindings

Add bindings documentation for Renesas Capture Engine Unit (CEU).

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
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: imx: Don't initialize vars that won't be used
Mauro Carvalho Chehab [Mon, 26 Feb 2018 13:33:41 +0000 (08:33 -0500)]
media: imx: Don't initialize vars that won't be used

As reported by gcc:

  + drivers/staging/media/imx/imx-media-csi.c: warning: variable 'input_fi' set but not used [-Wunused-but-set-variable]:  => 671:33
  + drivers/staging/media/imx/imx-media-csi.c: warning: variable 'pinctrl' set but not used [-Wunused-but-set-variable]:  => 1742:18

input_fi is not used, so just remove it.

However, pinctrl should be used, as it devm_pinctrl_get_select_default()
is declared with attribute warn_unused_result. What's missing there
is an error handling code, in case it fails. Add it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: tvp541x: fix some kernel-doc parameters
Mauro Carvalho Chehab [Mon, 26 Feb 2018 13:31:28 +0000 (08:31 -0500)]
media: tvp541x: fix some kernel-doc parameters

Solve the following warnings:
  + drivers/media/i2c/tvp514x.c: warning: Excess function parameter 'a' description in 'tvp514x_g_frame_interval':  => 759
  + drivers/media/i2c/tvp514x.c: warning: Excess function parameter 'a' description in 'tvp514x_s_frame_interval':  => 784
  + drivers/media/i2c/tvp514x.c: warning: Function parameter or member 'ival' not described in 'tvp514x_g_frame_interval':  => 759
  + drivers/media/i2c/tvp514x.c: warning: Function parameter or member 'ival' not described in 'tvp514x_s_frame_interval':  => 784

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ov7740: remove an unused var
Mauro Carvalho Chehab [Mon, 26 Feb 2018 13:28:22 +0000 (08:28 -0500)]
media: ov7740: remove an unused var

Fix this warning regression:
   drivers/media/i2c/ov7740.c: warning: variable 'ret' set but not used [-Wunused-but-set-variable]:  => 276:6

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: adv748x: fix HDMI field heights
Kieran Bingham [Mon, 8 Jan 2018 18:14:04 +0000 (13:14 -0500)]
media: i2c: adv748x: fix HDMI field heights

The ADV748x handles interlaced media using V4L2_FIELD_ALTERNATE field
types.  The correct specification for the height on the mbus is the
image height, in this instance, the field height.

The AFE component already correctly adjusts the height on the mbus, but
the HDMI component got left behind.

Adjust the mbus height to correctly describe the image height of the
fields when processing interlaced video for HDMI pipelines.

Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver")

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l: doc: Clarify v4l2_mbus_fmt height definition
Kieran Bingham [Mon, 8 Jan 2018 17:55:23 +0000 (12:55 -0500)]
media: v4l: doc: Clarify v4l2_mbus_fmt height definition

The v4l2_mbus_fmt width and height corresponds directly with the
v4l2_pix_format definitions, yet the differences in documentation make
it ambiguous what to do in the event of field heights.

Clarify this using the same text as is provided for the v4l2_pix_format
which is explicit on the matter, and by matching the terminology of
'image height' rather than the misleading 'frame height'.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: gspca: dtcs033: use %*ph to print small buffer
Antonio Cardace [Mon, 12 Feb 2018 18:35:25 +0000 (13:35 -0500)]
media: gspca: dtcs033: use %*ph to print small buffer

Use %*ph format to print small buffer as hex string.

Remove newline at the end of the format string as it would be duplicated
by the one supplied as last argument.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Antonio Cardace <anto.cardace@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: vivid: check if the cec_adapter is valid
Hans Verkuil [Mon, 12 Feb 2018 11:45:32 +0000 (06:45 -0500)]
media: vivid: check if the cec_adapter is valid

If CEC is not enabled for the vivid driver, then the adap pointer is NULL
and 'adap->phys_addr' will fail.

Cc: <stable@vger.kernel.org> # for v4.12 and up
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: em28xx: use %*phC to print small buffers
Antonio Cardace [Fri, 9 Feb 2018 14:13:26 +0000 (09:13 -0500)]
media: em28xx: use %*phC to print small buffers

Use %*phC format to print small buffers as hex strings

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Antonio Cardace <anto.cardace@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cec: improve debugging
Hans Verkuil [Thu, 8 Feb 2018 16:55:48 +0000 (11:55 -0500)]
media: cec: improve debugging

cec_transmit_msg_fh() first checked the message for errors, and only
after the message was found to be valid did it log the message contents.

However, that makes it hard to associate an error in the kernel log with
the message since the message contents was never logged in that case.

So swap the order: first log the message (once some very basic checks
are done), and only after that check for errors.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
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>