MIPI CSI-2 driver for Sony 9500M

I’m writing driver for Sony 9500M. I have got image with gStreamer as usual v4l2 device. But when I use command v4l2-ctl --all, I didn’t see my device. My main task to acquire frames from the camera with Argus library from Multimedia SDK, but it also doesn’t see anything. I have tried to use samples, but I cannot find my camera.
Please, help me, to find whats wrong?

There is small part of device tree:

sony9500m_c@10 {
                compatible = "nvidia,sony9500m";
                status = "okay";

                clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
                        <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
                clock-names = "extperiph1", "pllp_grtba";
                mclk = "extperiph1";

                reg = <0x10>;
                //devnode = "video1";

                /* Physical dimensions of sensor */
                physical_w = "15.0";
                physical_h = "12.5";

                sensor_model ="tfm";
                /* Define any required hw resources needed by driver */
                /* ie. clocks, io pins, power sources */
                reset-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;
                reset_register = "2";

                /* Defines number of frames to be dropped by driver internally after applying */
                /* sensor crop settings. Some sensors send corrupt frames after applying */
                /* crop co-ordinates */
                post_crop_frame_drop = "0";

                /* Convert Gain to unit of dB (decibel) befor passing to kernel driver */
                use_decibel_gain = "true";

                /* if true, delay gain setting by one frame to be in sync with exposure */
                //  delayed_gain = "true";

                /* enable CID_SENSOR_MODE_ID for sensor modes selection */
                //use_sensor_mode_id = "true";

            mode0 {/*mode SONY_9500M_MODE_1920X1080P_RGB_60FPS*/
                    mclk_khz = "37125";
                    num_lanes = "4";
                    tegra_sinterface = "serial_a";
                    phy_mode = "DPHY";
                    discontinuous_clk = "no";
                    dpcm_enable = "false";
                    cil_settletime = "0";
                    dynamic_pixel_bit_depth = "24";
                    csi_pixel_bit_depth = "24";
                        mode_type = "rgb";
                    pixel_phase = "rgb888";

                    active_w = "1920";
                    active_h = "1080";
                    readout_orientation = "0";
                    line_length = "1920";
                    inherent_gain = "1";
                    mclk_multiplier = "4";
                    pix_clk_hz = "148500000";
            };

hello danila.pavalotski,

is this sensor output pixel formats? Argus doesn’t support this format types.

I have also another mode:

            mode1 {/*mode SONY_9500M_MODE_1920X1080P_YPbPr_60FPS*/
                    mclk_khz = "37125";
                    num_lanes = "4";
                    tegra_sinterface = "serial_a";
                    phy_mode = "DPHY";
                    discontinuous_clk = "no";
                    dpcm_enable = "false";
                    cil_settletime = "0";
                    dynamic_pixel_bit_depth = "16";
                    csi_pixel_bit_depth = "16";
                    mode_type = "yuv";
                    pixel_phase = "uyvy";

                    active_w = "1920";
                    active_h = "1080";
                    readout_orientation = "0";
                    line_length = "1920";
                    inherent_gain = "1";
                    mclk_multiplier = "4";
                    pix_clk_hz = "148500000";
                    };

hello danila.pavalotski,

please see-also Camera Architecture Stack.
this YUV formats also not supported by Argus.

  1. So, ARGUS API support only bayer sensor, am I right?
  2. What about showing my camera with v4l2-ctl tool? I didn’t see anything, when I try to list all available cameras? Why?

hello danila.pavalotski,

yes, it’s correct.

you may dig into your kernel init messages, it’s linux kernel to register the video node if you have correct port bindings.
please review your driver, you may also check below for reference,
for example,
Sensor Software Driver Programming
V4L2 Sensor Driver Development Tutorial

It’s strange, because on various resources I saw, that it support all of formats. And on video, that you have sent there is:

All the bindings is correct, but it doesn’t show anything. There is my probe function:

static int sony_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
{
	struct device *dev = &client->dev;
	struct tegracam_device *tc_dev;
	struct tfm *priv;
	int err;

	dev_info(dev, "Probing sony9500m v4l2 camera\n");

	if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
		return -EINVAL;

	priv = devm_kzalloc(dev,
			sizeof(struct tfm), GFP_KERNEL);
	if (!priv)
		return -ENOMEM;

	tc_dev = devm_kzalloc(dev,
			sizeof(struct tegracam_device), GFP_KERNEL);
	if (!tc_dev)
		return -ENOMEM;

	priv->i2c_client = tc_dev->client = client;
	tc_dev->dev = dev;
	strncpy(tc_dev->name, "sony9500m", sizeof(tc_dev->name));
	tc_dev->dev_regmap_config = &sensor_regmap_config;
	tc_dev->sensor_ops = &tfm_common_ops;
	tc_dev->v4l2sd_internal_ops = &tfm_subdev_internal_ops;
	tc_dev->tcctrl_ops = &tfm_ctrl_ops;

	err = tegracam_device_register(tc_dev);
	if (err) {
		dev_err(dev, "tegra camera driver registration failed\n");
		return err;
	}
	priv->tc_dev = tc_dev;
	priv->s_data = tc_dev->s_data;
	priv->subdev = &tc_dev->s_data->subdev;
	tegracam_set_privdata(tc_dev, (void *)priv);

	// ---- Added for nvarguscamerasrc ----
	dev_info(dev, "sony9500m_device_id\n");
	sony9500m_device_id(client, priv->s_data);
	err = sony9500m_board_setup(priv);
	if (err) {
		dev_err(dev, "board setup failed\n");
		return err;
	}
	dev_info(dev, "v4l2_i2c_subdev_init\n");
	v4l2_i2c_subdev_init(priv->subdev, client, &tfm_subdev_ops);
	// ---- Added for nvarguscamerasrc ----

	err = tegracam_v4l2subdev_register(tc_dev, true);
	if (err) {
		dev_err(dev, "tegra camera v4l2 subdev registration failed\n");
		return err;
	}

	dev_info(dev, "Detected sony9500m camera\n");

	return 0;
}

hello danila.pavalotski,

ya, that’s correct. CSI/VI able to support those formats.
as you can see in Camera Architecture Stack, there’s [Camera API Matrix] table to describe the camera APIs available for each camera configuration.
i.e. Does not use Jetson ISP/ Uses Jetson ISP.

may I know the kernel init messages regarding to sensor probing failure?

hello JerryChang,

There is log messages. So everything is ok. I can run the video.

but with v4l2-ctl I didn’t see anything.
So, as CSI/VI support yuv, how to acquire with argus?

Please, see the available file:
sony9500m_dt.dts (33.0 KB)
sony9500m_driver.c (13.7 KB)

hello danila.pavalotski,

please double check Camera Architecture Stack for [Camera API Matrix] table to describe the camera APIs available for each camera configuration.

Argus only support with bayer sensor which uses the Jetson ISP.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.