ARM: dts: imx6qdl: Flesh out mipi_csi node

Add compatible string, interrupt sources, and clocks to the MIPI CSI2
receiver node.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: imx6q: clk: Add video 27m clock

Adds a 27MHz clock that is a fixed /20 from the pll3_pfd1_540m clock.
The MIPI CSI2 receiver requires this clock.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: dts: imx: sabrelite: add video capture ports and endpoints

Defines the host v4l2-capture device node and an OV5642 camera sensor
node on i2c2. The host capture device is a child of ipu1. An OV5642
parallel-bus endpoint is defined that connects to the host parallel-bus
endpoint on CSI0, using the OF graph bindings described in
Documentation/devicetree/bindings/media/video-interfaces.txt.

Note there is a pin conflict with GPIO6. This pin functions as a power
input pin to the OV5642, but ENET requires it to wake-up the ARM cores
on normal RX and TX packet done events (see 6261c4c8). So by default,
capture is disabled, enable by uncommenting __OV5642_CAPTURE__ macro
(ethernet will still work but slower).

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: dts: imx6-sabresd: add video capture ports and endpoints

Defines the host v4l2-capture device node and two camera sensors:
parallel-bus OV5642 and MIPI CSI-2 OV5640. The host capture device
is a child of ipu1. The MIPI CSI-2 receiver device is also defined.

The OV5642 is connected to the host parallel-bus endpoint on CSI0,
and the OV5640 is connected to the host MIPI CSI-2 endpoint on CSI1,
over virtual channel 0.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: dts: imx6-sabreauto: add video capture ports and endpoints

Defines the host v4l2-capture device node and the ADV7180 decoder
sensor. The host capture device is a child of ipu1. The ADV7180 is
connected to the host parallel-bus endpoint on CSI0.

On the sabreauto, two analog video inputs are routed to the ADV7180,
composite on Ain1, and composite on Ain3. Those inputs are defined
via inputs and input-names under the host endpoint node on CSI0.

Regulators and port expanders are defined which are required for the
ADV7180 (power pin is via port expander gpio on i2c3). The reset pin
to the port expander chip (MAX7310) is controlled by a gpio, so define
the reset-gpios property to control it.

The sabreauto uses a steering pin to select between the SDA signal on
i2c3 bus, and a data-in pin for an SPI NOR chip. Use i2cmux to control
this steering pin. Idle state of the i2cmux selects SPI NOR. This is not
a classic way to use i2cmux, since one side of the mux selects something
other than an i2c bus, but it works and is probably the cleanest
solution. Note that if one thread is attempting to access SPI NOR while
another thread is accessing i2c3, the SPI NOR access will fail since the
i2cmux has selected the SDA pin rather than SPI NOR data-in. This couldn't
be avoided in any case, the board is not designed to allow concurrent
i2c3 and SPI NOR functions (and the default device-tree does not enable
SPI NOR anyway).

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: imx6dl: Add iomux field defines for imx6dl

Start adding iomux field defines for imx6dl. Adds GPR13 fields for
MIPI-CSI2/Parallel video mux selection.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: imx: Add imx6 video capture platform_data

Adds platform_data for imx6 v4l2 video capture device. Implements
set_video_mux(), which sets the video capture mux in IOMUXC, which
selects between MIPI CSI-2 gasket and Parallel camera sensor
interface.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
gpio: pca953x: Add reset-gpios property

Add optional reset-gpios property. If present, de-assert the
specified reset gpio pin to bring the chip out of reset.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
media: imx6: Add device tree binding documentation

Add device tree binding documentation for i.MX6 media devices.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
media: Add new camera interface driver for i.MX6

This is a V4L2 camera interface driver for i.MX6. See
Documentation/video4linux/mx6_camera.txt.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
media: imx6: Add support for MIPI CSI-2 OV5640

This driver is based on ov5640_mipi.c from Freescale imx_3.10.17_1.0.0_beta
branch, modified heavily for code cleanup and converted from int-device
to subdev.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
media: imx6: Add support for Parallel OV5642

This driver is based on ov5642.c from Freescale imx_3.10.17_1.0.0_beta
branch, modified heavily for code cleanup and converted from int-device
to subdev.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
media: imx6: Add support for ADV7180 Video Decoder

This driver is based on adv7180.c from Freescale imx_3.10.17_1.0.0_beta
branch, modified heavily for code cleanup and converted from int-device
to subdev.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
media: imx6 camera: Add deinterlace motion control

Add a custom control to set a motion compensation setting for
deinterlacing using the VDIC.

Use of the VDIC is not compatible with preview because both
require the IC viewfinder task.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
media: imx6 camera: Add VDIC deinterlacing subdev

This subdev implements two different video pipelines:

CSI -> VDIC -> IC-VF -> CH21 -> MEM

In this pipeline, the CSI sends a single interlaced field F(n-1)
directly to the VDIC (and optionally the following field F(n)
can be sent to memory via IDMAC channel 13). This pipeline only works
in VDIC's high motion mode, which only requires a single field for
processing. The other motion modes (low and medium) require three fields,
so this pipeline does not work in those modes. Also, it is not clear how
this pipeline can deal with the various field orders (sequential BT/TB,
interlaced BT/TB) and there are reported image quality issues output
from the VDIC in this pipeline.

CSI -> CH[0-3] -> MEM -> CH8,9,10 -> VDIC -> IC-VF -> CH21 -> MEM

In this pipeline, the CSI sends raw and full frames to memory buffers
via the IDMAC SMFC channels 0-3. Fields from these frames are then
transferred to the VDIC via IDMAC channels 8,9,10. The VDIC requires
three fields: previous field F(n-1), current field F(n), and next
field F(n+1), so we need three raw frames in memory: two completed frames
to send F(n-1), F(n), F(n+1) to the VDIC, and a third frame for active
CSI capture while the completed fields are sent through the VDIC->IC for
processing.

While the "direct" CSI->VDIC pipeline requires less memory bus bandwidth
(just 1 channel vs. 5 channels for indirect pipeline), it can't be used
for all motion modes, it only processes a single field (so half the
original image resolution is lost), and it has the image quality issues
mentioned above. With the indirect pipeline we have full control over
field order. So by default the direct pipeline is disabled via a module
parameter, if enabled it will be used by high motion mode.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers

Enable imx6 v4l2 staging drivers as modules. For video capture on
the SabreAuto, the ADV7180 video decoder also requires the
i2c-mux-gpio and the max7310 port expander.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>