tegra-camera-platform device tree settings

I’m a bit confused by the options in the tegra-camera-platform device tree.

/**
* Physical settings to calculate max ISO BW
*
* num_csi_lanes = <>;
* Total number of CSI lanes when all cameras are active
*
* max_lane_speed = <>;
* Max lane speed in Kbit/s
*
* min_bits_per_pixel = <>;
* Min bits per pixel
*
* vi_peak_byte_per_pixel = <>;
* Max byte per pixel for the VI ISO case
*
* vi_bw_margin_pct = <>;
* Vi bandwidth margin in percentage
*
* max_pixel_rate = <>;
* Max pixel rate in Kpixel/s for the ISP ISO case
*
* isp_peak_byte_per_pixel = <>;
* Max byte per pixel for the ISP ISO case
*
* isp_bw_margin_pct = <>;
* Isp bandwidth margin in percentage
*/

num_csi_lanes makes sense, if I have two cameras that each use one lane then it would be 2. Or if both of those cameras used 2 lanes, it would be 4.

max_lane_speed is how fast the TX should talk to the camera over mipi. What was this value in r24.2?

min_bits_per_pixel I assume is your bayer pixel format bits per pixel. So MEDIA_BUS_FMT_SRGGB12_1X12 would be 12, or MEDIA_BUS_FMT_SRGGB12_1X10 would be 10.

As for the rest, what are “VI ISO case” and “ISP ISO case?” And how do we calculate the ISP bandwidth margin?

Found the default values from r24.2:

#define CAMERA_PEAK_BPP 2
#define LANE_SPEED_1_GBPS 1000000000
#define LANE_SPEED_1_5_GBPS 1500000000

#if defined(CONFIG_ARCH_TEGRA_21x_SOC)
    num_csi_lanes = 2;
    max_num_streams = 6;
    max_lane_speed = LANE_SPEED_1_5_GBPS;
    min_bits_per_pixel = 10;
#elif defined(CONFIG_ARCH_TEGRA_12x_SOC) || defined(CONFIG_ARCH_TEGRA_13x_SOC)
    num_csi_lanes = 2;
    max_num_streams = 2;
    max_lane_speed = LANE_SPEED_1_GBPS;
    min_bits_per_pixel = 10;

Then there’s this formula

/*
     * Let's go with simple registering max dedicated BW
     * approach for now.
     *
     * The formula is:
     * Camera's max total ISO BW =
     * ((max_num_streams *
     * num_csi_lanes * max_lane_speed) /
     * min_bits_per_pixel) * max_peak_BPP
     *
     * Above considered cap is CSI link cap, but we need to
     * consider real sensor-on-board cap also, DT based approach
     * should handle it.
     *
     * Only VI out is considered, because in case of
     * max # of cameras running, only VI is in ISO mode.
     *
     * TODO: Try renegotiate approach later.
     */

So Camera’s max total ISO bandwidth in r24.2 would be (((2 * 1500000000 * 6) / 10) * 2) / 1000 = 3600000 Kbit/s

hello Atrer,

please check the [Sensor Driver Programming Guide] from L4T documentation.
there are descriptions about these properties,
thanks

Which version? I’m looking at r28.2 and I don’t even see a mention that those are required for tegra-camera-platform. I had to find out about them from the dtsi.

Here’s the example it gives:

tegra-camera-platform {
    compatible = "nvidia, tegra-camera-platform";
    modules {
        module0 {
            badge = "imx185_bottom_liimx185";
		   position = "bottom";
		   orientation = "0";
		   drivernode0 {
                pcl_id = "v4l2_sensor";
                devname = "imx185 30-001a";
                proc-device-tree = "/proc/device-tree/i2c@3180000/tca9546@70/i2c@0/imx185_a@1a";
            };        };
    };

hello Atrer,

please check [L4T R28.2 DP Documentation]-> [Release 28.2 Development Guide]-> [Camera Development]-> [Sensor Driver Programming Guide]
searching for the “Module Properties” for the descriptions.
thanks

Hello JerryChang,

Is there really a description of ‘max_lane_speed’ in the documentation ? I don’t find it.

What’s the unit of that value ? bits/s or Kbits/s ?

hello phdm,

it is used to calculate ISO bandwidth, you could found the formula in the kernel sources,
thanks

sources/kernel/kernel-4.4/drivers/video/tegra/camera/tegra_camera_platform.c