The image processing unit (IPU) has two identical camera serial interfaces. A camera serial interface, or CSI, consists of synchronizer, interface logic, data packing unit, and sensor interface control. The CSI is controlled via the peripheral bus registers.

The ConnectCore 6 Plus SBC CSI camera port is connected to I2C3.

Kernel configuration

You can manage the CSI driver support and Video4Linux (V4L2) capture driver through the kernel configuration options:

  • IPU CSI encoder library (CONFIG_MXC_IPU_CSI_ENC)

  • MXC video for Linux video capture (CONFIG_VIDEO_MXC_CAPTURE)

These options are enabled as built-in on the ConnectCore 6 Plus SBC kernel configuration file.

The kernel configuration file enables support for Omnivision OV5642 CSI camera sensor through the kernel configuration option:

  • OmniVision ov5642 camera support (CONFIG_MXC_CAMERA_OV5642_V2)

Kernel driver

The drivers for CSI capture are located at:

File Description

drivers/media/platform/mxc/capture/ipu_csi_enc.c

CSI driver source file

drivers/media/platform/mxc/capture/mxc_v4l2_capture.c

Video4Linux (V4L2) capture driver

drivers/media/platform/mxc/capture/ov5642_v2.c

Omnivision OV5642 CSI camera sensor driver

Device tree bindings and customization

The V4L2 framework device tree binding is documented at Documentation/devicetree/bindings/video/fsl,v4l2-capture.txt.

The CSI camera interface is a subset of the IPU and only requires an appropriate IOMUX of the IPU lines involved in camera capture.

The device tree must contain entries for:

  • The V4L2 capture interface

  • The camera sensor

Example: primary camera (CSI0)

IOMUX configuration

{cpu-family} device tree
ipu1 {
	pinctrl_ipu1_1: ipu1grp-1 { /* parallel camera */
		fsl,pins = <
			MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12    0x80000000
			MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13    0x80000000
			MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14    0x80000000
			MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15    0x80000000
			MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16    0x80000000
			MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17    0x80000000
			MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18    0x80000000
			MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19    0x80000000
			MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK   0x0000a0b0
			MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC      0x80000000
			MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC     0x80000000
			MX6QDL_PAD_EIM_WAIT__GPIO5_IO00            0x80000000
			MX6QDL_PAD_CSI0_DATA_EN__GPIO5_IO20	   0x80000000
		>;
	};
};

CSI V4L2 capture device

The video input to the CSI is configurable and may come from any IPU present in the CPU and from either of the two CSI interfaces within each IPU: CSI0 or CSI1.

{cpu-family} SOM-specific device tree
v4l2_cap_1 {
	ipu_id = <0>;
	csi_id = <0>;
};
In some cases, this configuration is overwritten in specific SBC variants' device trees to match the available CSI connector on the board.

Camera sensor

The ConnectCore 6 Plus SBC device tree defines the CSI OmniVision OV5642 camera.

{cpu-family} device tree
&i2c3 {
	clock-frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c3>;
	status = "okay";
	/* Primary parallel camera */
	ov5642_1: ov5642_1@5c {
		compatible = "ovti,ov564x";
		reg = <0x5c>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_ipu1_1>;
		clocks = <&clks 201>;
		clock-names = "csi_mclk";
		pwn-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
		digi,alt-pwn-gpios = <&gpio7 6 1>;
		csi_id = <0>;
		ipu_id = <0>;
		mclk = <24000000>;
		mclk_source = <0>;
		digi,defer-probe;
	};
};

The {cpu-family} supports another additional CSI camera:

{cpu-family} SOM-specific device tree
/* Parallel camera CSI1 */
ov5642_2: ov5642_2@6c {
	compatible = "ovti,ov564x";
	reg = <0x6c>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ipu2_2>;
	clocks = <&clks 201>;
	clock-names = "csi_mclk";
	pwn-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
	digi,alt-pwn-gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
	mclk = <24000000>;
	mclk_source = <0>;
	digi,defer-probe;
	csi_id = <1>;
	ipu_id = <1>;
};