* How to Enable MIPI CSI Module


1. Driver Compile
Configures:

CONFIG_VIDEO_RK_CIF_ISP10=y
CONFIG_SOC_CAMERA=y

ISP driver:

drivers/media/platform/rk-isp10/*

sensor driver:

drivers/media/i2c/soc_camera/rockchip/*

2. DTS Setting
2.1 Enable ISP Device Node:

  • Set the cif_isp0 device node state to 'okay'.
  • Set the rockchip,camera-modules-attached property to sensor node.
&cif_isp0 {
    rockchip,camera-modules-attached = <&camera0>;
    status = "okay";
};
  • Add the camera-module node.
&i2c3 {
    status = "okay";

    afc0:af-controller@0 {
        status = "okay";
        compatible = "silicon touch,vm149C-v4l2-i2c-subdev";
        reg = < 0x0c >;
    };

    camera0:camera-module@0 {
        status = "okay";

        compatible = "omnivision,ov8858-v4l2-i2c-subdev";
        reg = < 0x10 >;
        device_type = "v4l2-i2c-subdev";

        clocks = <&cru SCLK_VIP_OUT>;
        clock-names = "clk_cif_out";

        pinctrl-names = "rockchip,camera_default", "rockchip,camera_sleep";
        pinctrl-0 = <&cam0_default_pins>;
        pinctrl-1 = <&cam0_sleep_pins>;
        rockchip,pd-gpio = <&gpio2 15 GPIO_ACTIVE_LOW>;
        rockchip,pwr-gpio = <&gpio0 17 GPIO_ACTIVE_HIGH>;

        rockchip,camera-module-mclk-name = "clk_cif_out";
        rockchip,camera-module-dovdd = "1.8v";
        rockchip,camera-module-facing = "back";
        rockchip,camera-module-name = "cmk-cb0695-fv1";
        rockchip,camera-module-len-name = "lg9569a2";
        rockchip,camera-module-fov-h = "66.0";
        rockchip,camera-module-fov-v = "50.1";
        rockchip,camera-module-orientation = <0>;
        rockchip,camera-module-iq-flip = <0>;
        rockchip,camera-module-iq-mirror = <0>;
        rockhip,camera-module-flip = <0>;
        rockchip,camera-module-mirror = <0>;

        /* resolution.w, resolution.h, defrect.left, defrect.top, defrect.w, defrect.h */
        rockchip,camera-module-defrect0 = <3264 2448 0 0 3264 2448>;
        rockchip,camera-module-flash-support = <0>;
        rockchip,camera-module-mipi-dphy-index = <0>;
    };
};

2.2 Senor node parameters:

  • "camera-module-mipi-dphy-index": Define which mipi phy will be used.
  • "pd-gpio": Pin PD used by camera module.
  • "pwr-gpio": Pin PWR used by camera module.

* How To USE MIPI CSI

3. How to GET USERSPACE

3.1 Enable ION and CMA:

  • Enable ION and CMA in kernel config.
  • ADD ION node to dts.
  • Apply patch.
CONFIG_CMA=y
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=128
CONFIG_ION=y
CONFIG_ION_ROCKCHIP=y
    ion {
        compatible = "rockchip,ion";
        #address-cells = <1>;
        #size-cells = <0>;

        cma-heap {
            reg = <0x78000000 0x08000000>;
        };

        system-heap {
        };
    };

3.2 Build Camera Demo:

git clone https://github.com/rockchip-linux/rk_camera.git
cd rk_camera/CameraHal
make

cp build/lib/libcam_hal.so /lib/
cp build/bin/camHalTest.bin /usr/local/bin
cp build/bin/dumpsys /usr/local/bi
cp xml/cam_default.xml /etc/cam_iq
cp xml/capcmd.xml /tmp
cp ext_lib/libion.so /lib/

3.3 RUN

camHalTest.bin