Skip to content

Porting - Camera

Using IMX577 as an example, this section describes the complete Camera Sensor porting process.

1. Device Tree Configuration

  • Power supply related: no modification needed by default. If the power supply differs from the reference design, modify:
src/vendor/qcom/proprietary/camera-devicetree/kalama-camera-sensor-rb5gen2-evt.dtsi
  • For detailed parameter descriptions, refer to src/vendor/qcom/proprietary/camera-devicetree/bindings/msm-cam-cci.txt.
&cam_cci0 {                                             // Corresponding hardware cci0
    /* CAM 0 IMX577 */
    qcom,cam-sensor0 {
        cell-index = <0>;                               // Camera ID in kernel device tree
        compatible = "qcom,cam-sensor";
        csiphy-sd-index = <1>;                          // Corresponding CSI physical ID; here uses CSI1
        sensor-position-roll = <0>;
        sensor-position-pitch = <0>;
        sensor-position-yaw = <0>;
        cam_clk-supply = <&cam_cc_titan_top_gdsc>;
        regulator-names = "cam_clk";
        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_mclk1_active
                 &cam_sensor_active_enble1>;
        pinctrl-1 = <&cam_sensor_mclk1_suspend
                 &cam_sensor_suspend_enble1>;
        gpios = <&tlmm 101 0>,                          // Custom GPIO config, can be used by driver for sensor power operations
            <&tlmm 7 0>,
            <&tlmm 117 0>;
        gpio-custom1 = <1>;
        gpio-custom2 = <2>;
        gpio-req-tbl-num = <0 1 2>;
        gpio-req-tbl-flags = <1 0 0>;
        gpio-req-tbl-label = "CAMIF_MCLK1",
                    "CAM_CUSTOM1",
                    "CAM_CUSTOM2";
        cci-master = <CCI_MASTER_0>;
        status = "ok";
        clocks = <&camcc CAM_CC_MCLK1_CLK>;
        clock-names = "cam_clk";
        clock-cntl-level = "nominal";
        clock-rates = <24000000>;                       // MCLK frequency setting
    };
};

2. Camera List Configuration

src/vendor/qcom/proprietary/chi-cdk/oem/qcom/multicamera/chimcxcameraconfig/configs/kailua/kailua_dualcamera.xml
xml
<PhysicalDevice name="WidePhysicalCam0" slotId="0" cameraId="0" sensorName="aidlux_imx577_cam0"/>

Reminder

  • slotId must match the cameraId in aidlux_imx577_cam0_module.xml and the cell-index in dtsi.
  • cameraId defines the order in which logical camera IDs are assigned to camera sensors.
src/vendor/qcom/proprietary/chi-cdk/oem/qcom/module/aidlux_imx577_cam0_module.xml

3. Camera Driver Code

Power-up sequence, I2C parameters, initialization parameters, etc.:

src/vendor/qcom/proprietary/chi-cdk/oem/qcom/sensor/aidlux_imx577_cam0/aidlux_imx577_cam0_sensor.xml

Fixed interface and format — modify as needed:

src/vendor/qcom/proprietary/chi-cdk/oem/qcom/sensor/aidlux_imx577_cam0/aidlux_imx577_cam0_sensor.cpp

4. Sensor Tuning Project

src/vendor/qcom/proprietary/chi-cdk/oem/qcom/tuning/sm8550_aidlux_imx577/Scenario.Default/XML/BPS/bgtm10_bps_v2.xml

5. Build Configuration

src/vendor/qcom/proprietary/camx/build/infrastructure/linuxembedded/CMakeLists.txt
src/vendor/qcom/proprietary/chi-cdk/oem/qcom/buildbins/build/linuxembedded/binary_kalama/com.qti.sensormodule.aidlux_imx577_cam0.cmake
src/vendor/qcom/proprietary/chi-cdk/oem/qcom/buildbins/buildbins.cmake

6. Starting the Camera

bash
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! fakesink

Debugging Summary

  1. Verify hardware connections first: Device tree configuration must match the hardware connections.
  2. Reference similar models: Find a sensor with a similar model number, copy its code and configuration, then modify the power-up and initialization parameters. For example, to debug IMX586 but no corresponding code exists in the system, copy the IMX577 code and modify the parameters to match the actual configuration.