Skip to content

Camera Porting ​

This document uses the IMX577 as an example to describe the process of porting a Camera sensor on Rhino Pi A1 Mini (QCS6490 platform), covering hardware configuration, device tree modifications, and driver compilation and configuration.

1. Hardware Configuration ​

The hardware interfaces involved in Camera porting mainly include three parts:

  • Power control (GPIO): Controls sensor power-on and reset
  • I2C (CCI): The camera-dedicated I2C bus, used to read and write sensor registers
  • CSI: The MIPI CSI interface, used to transmit image data

1.1 Device Tree Configuration ​

Device tree modifications mainly target root hardware binding: if the hardware is unchanged, no modifications are needed when debugging other sensors later. One hardware interface is configured for one sensor; for example, if there are 2 CSI hardware interfaces, two sensor configs are required. The following uses the configuration of one IMX577 as an example:

dts
&cam_cci0 {                                 // cci bus 0
    /* CAM 0 IMX577 */
    cam_slot0: qcom,cam-sensor0 {
        cell-index = <0>;                   // This ID must not be duplicated; it matches the cameraId in the camx module with the device in the kernel
        compatible = "qcom,cam-sensor";
        csiphy-sd-index = <1>;              // The CSI ID, corresponding to the csi2 hardware interface here
        sensor-position-roll = <0>;
        sensor-position-pitch = <0>;
        sensor-position-yaw = <0>;
        power-domains = <&camcc CAM_CC_TITAN_TOP_GDSC>;
        cam_vio-supply = <&vreg_l18b_1p8>;
        regulator-names = "cam_vio";
        rgltr-cntrl-support;
        rgltr-min-voltage = <0>;
        rgltr-max-voltage = <0>;
        rgltr-load-current = <0>;
        gpio-no-mux = <0>;
        pinctrl-names = "cam_default", "cam_suspend";
        pinctrl-0 = <&cam_sensor_active_rst1>;       // Camera reset pin configuration
        pinctrl-1 = <&cam_sensor_suspend_rst1>;
        gpios = <&tlmm 94 0>, <&tlmm 21 0>;
        gpio-custom1 = <0>;
        gpio-custom2 = <1>;
        gpio-req-tbl-num = <0 1>;
        gpio-req-tbl-flags = <0 0>;
        gpio-req-tbl-label = "CAM_CUSTOM1", "CAM_CUSTOM2";
        cci-master = <CCI_MASTER_0>;        // Each CCI controller has 2 masters (0,1); this corresponds to CCI bus:0 Master:0
        status = "ok";
        clocks = <&camcc CAM_CC_MCLK1_CLK>; // MCLK
        clock-names = "cam_clk";
        clock-cntl-level = "nominal";
        clock-rates = <24000000>;           // MCLK frequency
    };
};

CCI mapping: Each CCI controller has 2 masters (0, 1), which can be determined using the following mapping (and so on for the rest):

CCICCI busMaster
cci000
cci101
cci210
cci311
cci420

2. Driver Section ​

2.1 Compilation ​

Add the sensor build subdirectory to CMakeLists.txt of chi-cdk-kt:

text
layers/meta-qcom-extras/recipes-multimedia/camx/files/chi-cdk-kt/CMakeLists.txt
cmake
add_subdirectory (${CAMX_CHICDK_SENSOR_PATH}/sensor/cmk_imx577/build/linuxembedded ${CAMX_OUT_PATH}/sensor/cmk_imx577)

Add the XML build configuration:

text
layers/meta-qcom-extras/recipes-multimedia/camx/files/chi-cdk-kt/oem/qcom/buildbins/build/linuxembedded/binary_yupik/com.qti.sensormodule.cmk_imx577_cam1.cmake

2.2 Mapping ​

Add the SOC-to-sensor-bin mapping in socid_sensorbin_map.xml:

text
layers/meta-qcom-extras/recipes-multimedia/camx/files/chi-cdk-kt/oem/qcom/module/socid_sensorbin_map.xml
xml
<socIdInfo>
    <!--SOC ID or list of SOC Ids comma seperated-->
    <socId>QCM6490</socId>
    <binName>cmk_imx577_cam1</binName>
</socIdInfo>

Add the probe list in kodiak_dc.xml:

text
layers/meta-qcom-extras/recipes-multimedia/camx/files/chi-cdk-kt/oem/qcom/multicamera/chimcxcameraconfig/configs/kodiak/kodiak_dc.xml
xml
<PhysicalDevice name="RearPhysicalCam0" slotId="0" cameraId="0" sensorName="cmk_imx577"/>

2.3 Module Configuration ​

Configuration file:

text
layers/meta-qcom-extras/recipes-multimedia/camx/files/chi-cdk-kt/oem/qcom/module/cmk_imx577_module_cam1.xml
xml
<cameraId>0</cameraId>
  • <cameraId>: This ID must be consistent with the cell-index of the corresponding hardware configuration in the DTS.
  • <chromatixName>kodiak_cmk_imx577</chromatixName>: Configures the tuning (ISP) effect; if not available, copy one from another sensor and modify it.

2.4 Sensor Configuration ​

Sensor configuration file directory:

text
layers/meta-qcom-extras/recipes-multimedia/camx/files/chi-cdk-kt/oem/qcom/sensor/cmk_imx577
  • cmk_imx577_sensor.cpp: Refer to other sensors and just change the name accordingly.

Key configuration items of cmk_imx577_sensor.xml:

xml
<slaveAddress>0x34</slaveAddress>
<sensorIdRegAddr>0x0016</sensorIdRegAddr>
<sensorId>0x0577</sensorId>
<colorFilterArrangement>BAYER_RGGB</colorFilterArrangement>
<dt>43</dt>
<is3Phase>0</is3Phase>
Configuration itemValueDescription
<slaveAddress>0x348-bit I2C address
<sensorIdRegAddr>0x0016Sensor ID register
<sensorId>0x0577Sensor ID
powerUpSequence—Power-up related configuration; configType corresponds to the GPIO configuration in the kernel DTS
<colorFilterArrangement>BAYER_RGGBActual color format
<dt>43Data type
<is3Phase>0If it is a C-PHY camera, this value must be set to 1