Enable v4l2 timestamps for each frames captured

I am working on a Xavier NX board. I want to enable v4l2 timestamping for each frame captured from the driver. I saw some v4l2-ctl commands in userspace to get time stamp information which is monotonic clock. I wish to enable timestamps from the v4l2 driver itself. I am capturing radar LVDS data and converting it to CSI data through FPGA and sending it to Xavier NX.

Have reference to below topic for the timestamp of kernel driver.

Topic 159220

I went through the topic, I am a newbie. I would like to know in detail how to enable this feature in kernel? I went through some part vi5 driver, added few prints but were not visible in the dmesg. Also where can I find the source code to libargus code to get timestamps for start and end of frame? Is this feature already included or have to be implemented?

When you check by the v4l2-ctl to capture then you should be able see the message from vi5_fops.c
And yes the API already provide for Argus use case.

Do I have to write an application for argus use case or to be used in command?

For you need to implement the APP to use below API to get the timestamp.

https://docs.nvidia.com/jetson/l4t-multimedia/classArgus_1_1Ext_1_1ISensorTimestampTsc.html#ac6f2ccee516561329ee9aef39ad3d6d1

Since I am new to this, I don’t know where to begin with. Can you provide any example application or a proper documentation for the same?

Start from here.

Okay thanks. I will go through it.
Is it possible to get individual frame numbers? I would like to assign frame numbers and check if any frames are being dropped? If possible how can I achieve this?

Hi Shane,
nvidia/drivers/media/platform/tegra/camera/vi/vi4_fops.c I assume this is for Jetson TX2.
In function tegra_channel_notify_status_callback,

    dev_err(chan->vi->dev, "Status: %2u channel:%02X frame:%04X\n",
                    status->status, chan->vnc_id[i], status->frame);
    dev_err(chan->vi->dev, "     timestamp sof %llu eof %llu data 0x%08x\n",
            status->sof_ts, status->eof_ts, status->data);
    dev_err(chan->vi->dev, "     capture_id %u stream %2u vchan %2u\n",
            status->capture_id, status->st, status->vc);

It gives info about channel, frames, start of frame and end of frame timestamp. Is this true? Is this not supported on Xavier NX?

Checking the vi5_fops.c for Xavier NX

Hi Shane, any updates on this?

Sorry, I don’t follow you.
What’s else do you still need to know?

Why tegra_channel_notify_status_callback is included in vi4_ops but not in vi5_ops? Is it possible to implement it or it isn’t?

The arch of vi5 is different with vi4 I think. Suppose can’t implement it in vi5_fops.c

Thanks