Initializing media entity for camera sensor

I am trying to add support for a new v4l2 camera sensor in 24.2.

I have created a new device tree entry for the sensor and linked it to vi port 0. My sensor driver probe routine is being called and i am initializing it as a media entity as follows

priv->pad.flags = MEDIA_PAD_FL_SOURCE;
	priv->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
	ret = media_entity_init(&priv->subdev.entity, 1, &priv->pad, 0);
	if (ret < 0) {
		dev_err(&client->dev, "unable to init media entity\n");
		return ret;
	}

sd->dev = &client->dev;
ret = v4l2_async_register_subdev(sd);
if (!ret)
	v4l2_info(&priv->subdev, "%s camera sensor driver registered\n", &priv->subdev.name);

There are no errors during this process and i see in the logs the successful camera sensor driver registered message.

However when i check the media devices using media-ctl -p i only see the vi-output-0 device. My sensor does not show up.

Media controller API version 0.1.0

Media device information
------------------------
driver          vi
model           NVIDIA Tegra Video Input Device
serial
bus info
hw revision     0x3
driver version  0.0.0

Device topology
- entity 1: vi-output-0 (1 pad, 0 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink

Any ideas on where to look to further debug this problem?

I tried to build media-ctl on TX1(https://github.com/fastr/media-ctl ?), but got compilation failure.

You can use the following commands to list the v4l2 devices and check the compliance,

v4l2-ctl --list-devices
	v4l2-compliance -d /dev/video0