The MIPI camera sensor interface (MIPI CSI2) host controller is a digital core that implements all protocol functions, providing an interface between the system and the MIPI D-PHY and allowing communication with a MIPI CSI2-compliant camera sensor.
The MIPI CSI2 driver manages the MIPI D-PHY and coordinates with the MIPI sensor and IPU CSI. The MIPI CSI2 driver implements functions as follows:
-
MIPI CSI2 low-level interface for managing the MIPI D-PHY register and clock
-
MIPI CSI2 common API for communication between MIPI sensor and MIPI D-PHY
-
D-PHY
On the ConnectCore 6 SBC, the MIPI camera port is connected to port I2C3.
Kernel configuration
You can manage the MIPI driver support and Video4Linux (V4L2) capture driver through the kernel configuration options:
-
MXC MIPI support (CONFIG_MXC_MIPI_CSI2)
-
MXC video for Linux video capture (CONFIG_VIDEO_MXC_CAPTURE)
These options are enabled as built-in on the ConnectCore 6 SBC kernel configuration file.
The kernel configuration file enables support for OmniVision OV5640 MIPI camera sensor through the kernel configuration option:
-
OmniVision ov5640 camera support using MIPI (CONFIG_MXC_CAMERA_OV5640_MIPI)
Kernel driver
The drivers for MIPI capture are available at the following locations:
File | Description |
---|---|
MIPI CSI2 driver |
|
Video4Linux (V4L2) capture driver |
|
OmniVision OV5640 MIPI camera sensor driver |
Device tree bindings and customization
The i.MX6 MIPI interface device tree binding is documented at Documentation/devicetree/bindings/video/fsl,mipi-csi2.txt.
The V4L2 framework device tree binding is documented at Documentation/devicetree/bindings/video/fsl,v4l2-capture.txt.
The device tree must contain entries for:
-
The MIPI interface
-
The Video4Linux (V4L2) capture interface
-
The camera sensor
Definition of the MIPI CSI interface
mipi_csi: mipi_csi@021dc000 { /* MIPI-CSI */
compatible = "fsl,imx6q-mipi-csi2";
reg = <0x021dc000 0x4000>;
interrupts = <0 100 0x04>, <0 101 0x04>;
clocks = <&clks IMX6QDL_CLK_HSI_TX>,
<&clks IMX6QDL_CLK_EMI_SEL>,
<&clks IMX6QDL_CLK_VIDEO_27M>;
/* Note: clks 138 is hsi_tx, however, the dphy_c
* hsi_tx and pll_refclk use the same clk gate.
* In current clk driver, open/close clk gate do
* use hsi_tx for a temporary debug purpose.
*/
clock-names = "dphy_clk", "pixel_clk", "cfg_clk";
status = "disabled";
};
MIPI IPU:DI selection and enabling
The video input to the MIPI is configurable and may come from any IPU present in the i.MX6 CPU and from either of the two CSI interfaces within each IPU: CSI0 or CSI1.
&mipi_csi {
status = "okay";
ipu_id = <1>;
csi_id = <1>;
v_channel = <0>;
lanes = <2>;
};
MIPI CSI V4L2 capture device
v4l2_cap_0 {
compatible = "fsl,imx6q-v4l2-capture";
ipu_id = <1>;
csi_id = <1>;
mclk_source = <0>;
status = "okay";
};
Camera sensor
The ConnectCore 6 SBC device tree defines the MIPI-CSI2 OmniVision OV5640 camera.
&i2c3 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3>;
status = "okay";
/* MIPI-CSI2 camera */
ov5640_mipi: ov5640_mipi@4c {
compatible = "ovti,ov564x_mipi";
reg = <0x4c>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_mipi>;
clocks = <&clks 201>;
clock-names = "csi_mclk";
pwn-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
digi,alt-pwn-gpios = <&gpio7 6 1>;
csi_id = <1>;
ipu_id = <1>;
mclk = <24000000>;
mclk_source = <0>;
};
};
IOMUX configuration
The MIPI interface uses dedicated pins.
On the ConnectCore 6 SBC, GPIO7_6 of the CPU is routed to the MIPI connector for camera reset. The IOMUX for this GPIO is defined at the ConnectCore 6 SBC device tree file:
mipi {
pinctrl_mipi: mipi {
fsl,pins = <
MX6QDL_PAD_SD3_DAT2__GPIO7_IO06 0x80000000
>;
};
};
Although the driver supports an optional rst-gpios property for the camera sensor, the OmniVision camera board does not connect this line to the sensor so the ConnectCore 6 SBC device tree leaves this line in high impedance. |