IMX378 Camera Sensor integration with Android

I am trying to make working IMX378 Camera on Android.

I have implemented initial version of v4l2 driver, based on existing IMX214.
Updated DTS kernel/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge-android.dts for sensor

	imx378f: imx378f@1a {
       status = "okay";

       compatible = "sony,imx378";
       reg = <0x1a>;
       clocks = <&cru SCLK_CIF_OUT>;
       clock-names = "xvclk";
       /* avdd-supply = <>; */
       /* dvdd-supply = <>; */
       /* dovdd-supply = <>; */
       /* reset-gpios = <>; */
       pwdn-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
       reset-gpios = <&gpio2 12 GPIO_ACTIVE_HIGH>;
       pinctrl-names = "rockchip,camera_default";
       pinctrl-0 = <&cif_clkout>;
       rockchip,camera-module-index = <0>;
       rockchip,camera-module-facing = "back";
       rockchip,camera-module-name = "A12N02A-202";
       rockchip,camera-module-lens-name = "LENS";
       port {
           ucam_out0: endpoint {
                    remote-endpoint = <&mipi_in_ucam0>;
                    data-lanes = <1 2 3 4>;

Created file hardware/rockchip/camera/etc/camera/rkisp1/imx378_A12N02A-202_LENS.xml and just copy-pasted content from hardware/rockchip/camera/etc/camera/rkisp1/imx214_YG9626-S600Y7-C_LG-50013A7.xml, then replaced resolution parameters.

Updated file hardware/rockchip/camera/etc/camera/camera3_profiles_rk3399.xml by copy-pasing of imx214 section and resolution corrections.

<Profiles cameraId="0" name="imx378" moduleId="m00">
        <scaler.availableStreamConfigurations value="
		<scaler.availableMinFrameDurations value="
		<scaler.availableStallDurations value="
											   BLOB,4056x3040,33333333" />
    <Hal_tuning_RKISP1> <!-- Parameters to tune the HAL and hacks for the HAL that are camera dependent -->
        <flipping value="" value_v=""/> <!-- value: SENSOR_FLIP_H or "", value_v: SENSOR_FLIP_V or "" -->
        <supportIsoMap value="false"/>
        <supportTuningSize value="4056x3040, 3840x2160"/>

    <Sensor_info_RKISP1> <!-- Information that parametrizes the behavior or qualities of the physical sensor -->
        <sensorType value="SENSOR_TYPE_RAW"/> <!-- SENSOR_TYPE_SOC or SENSOR_TYPE_RAW -->
        <exposure.sync value="true"/> <!-- compensate expsure sync-->
        <sensor.digitalGain value="false"/> <!-- digital gain support on sensor-->
        <gain.lag value="2"/> <!-- camera3 HAL CPF parameters moved here start-->
        <exposure.lag value="2"/>
        <fov value= "54.8" value_v="42.5"/>
        <statistics.initialSkip value="1"/> <!-- camera3 HAL CPF parameters moved here end-->
        <frame.initialSkip value="0"/> <!-- should equal actual skipFrames - 2 for driver dropped 2 frames -->
        <isoAnalogGain1 value="75"/> <!--Pseudo ISO corresponding analog gain value 1.0. -->
        <cITMaxMargin value="10"/> <!--coarse integration time max margin -->

dmesg logs contains information from imx378 driver, that successfully mapped and initialized.
When I am trying to launch standard Camera2 App it seems that stream from camera started, but camera app is crashed with timeout error and dmesg receive a lot of logs with error rkisp1: MIPI mis error: 0x00000002.

Is there any documentation how to write proper parameters for rkisp driver and camera engine?
What is the error type 0x0000002 means?
Is any way to “debug” MIPI data?

Hardware: Khadas Edge-V <- Connection board <- IMX378 Sensor

Replacing an IQ directly with another IQ may cause it to not work properly. You can modify it like this to confirm whether the driver is correct first?


After this modification, it will not go through the ISP channel conversion of the upper layer. If your driver and DTS configuration are OK, there will be an image.

Hi All,

By changing the sensorType, I am able to stream the imx219 camera on RK3399. But camera preview is dark. Can anyone please let me know how to get better preview.
Also please share me the latest iq xml files of imx cameras if available or let me know where can i get.

Thanks in advance.