Skip to content

Camera Porting

Using the IMX577 as an example, this document describes the complete Camera Sensor porting flow.

1. Device Tree Configuration

  • Power supply related settings do not need to be modified 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 a detailed parameter description, 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 the kernel device tree
        compatible = "qcom,cam-sensor";
        csiphy-sd-index = <1>;                          // corresponding CSI physical ID, here CSI1 is used
        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 configuration, used by the 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"/>

Note

  • slotId must be consistent with the cameraId in aidlux_imx577_cam0_module.xml and the cell-index in the 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-on sequence, I2C parameters, initialization parameters, etc.:

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

The fixed interfaces and formats can be modified accordingly:

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. Confirm the hardware connection first: The configuration in the device tree must be consistent with the hardware connection.
  2. Reference a similar model: Find a sensor with a similar model, copy its code and configuration, and modify the power-on and initialization parameters. For example, to debug the IMX586 when there is no corresponding code in the system, copy the IMX577 code and modify the parameters to the actual configuration.