How to add new V4L2_CID?

I develop camera driver in Jetson AGX Orin.
I could send V4L2_CID_FRAME_SYNC by VIDIOC_S_CTRL from application, and our camera driver could get V4L2_CID_FRAME_SYNC in v4l2_ctrl_ops.s_ctrl function(cam_s_ctrl).

My user application:

enum {
	V4L2_CID_FACEDETECT = (V4L2_CID_AUTO_FOCUS_RANGE+1),
	V4L2_CID_FACEMARK,
	V4L2_CID_SMILEDETECT,
	V4L2_GET_FACEINFO,
	V4L2_CID_ROI_WINDOW,
	V4L2_CID_ROI_FOCUS,
	V4L2_CID_ROI_EXPOSURE,
	V4L2_CID_TRIGGER_FOCUS,
	V4L2_CID_HDR,
	V4L2_CID_COLORKILL,
	V4L2_CID_FRAME_SYNC,
	V4L2_CID_CUSTOM_EXPOSURE_AUTO,
	V4L2_CID_CUSTOM_FLASH_STROBE,
	V4L2_CID_DENOISE,
	V4L2_CID_GRAYSCALE,
	V4L2_CID_LSCMODE,
	V4L2_CID_FOCUS_WINDOW,
	V4L2_CID_EXPOSURE_COMPENSATION,
};

struct v4l2_control s_ctrl;

s_ctrl.id = V4L2_CID_FRAME_SYNC;
s_ctrl.value = 0x1;
V4L2_IOCTL( pDevice, VIDIOC_S_CTRL, &s_ctrl )


Camera driver:

static const struct v4l2_ctrl_ops cam_ctrl_ops = {
.g_volatile_ctrl = cam_g_volatile_ctrl,
.s_ctrl = cam_s_ctrl,
};

static int cam_s_ctrl(struct v4l2_ctrl *ctrl)
{
if(ctrl->id == V4L2_CID_FRAME_SYNC) do_cam_frame_sync;

}

I want add new V4L2_CID_NEW_ITEAM, but it can’t call into our v4l2_ctrl_ops.s_ctrl function(cam_s_ctrl), and v4l2_ctrl_find() get ref=NULL.
Do I missing some setting for add new V4L2_CID?

enum {
	V4L2_CID_FACEDETECT = (V4L2_CID_AUTO_FOCUS_RANGE+1),
	V4L2_CID_FACEMARK,
	V4L2_CID_SMILEDETECT,
	V4L2_GET_FACEINFO,
	V4L2_CID_ROI_WINDOW,
	V4L2_CID_ROI_FOCUS,
	V4L2_CID_ROI_EXPOSURE,
	V4L2_CID_TRIGGER_FOCUS,
	V4L2_CID_HDR,
	V4L2_CID_COLORKILL,
	V4L2_CID_FRAME_SYNC,
	V4L2_CID_CUSTOM_EXPOSURE_AUTO,
	V4L2_CID_CUSTOM_FLASH_STROBE,
	V4L2_CID_DENOISE,
	V4L2_CID_GRAYSCALE,
	V4L2_CID_LSCMODE,
	V4L2_CID_FOCUS_WINDOW,
	V4L2_CID_EXPOSURE_COMPENSATION,
	V4L2_CID_NEW_ITEAM, /* add this new CID */
};

struct v4l2_control s_ctrl;

s_ctrl.id = V4L2_CID_NEW_ITEAM;
s_ctrl.value = 0x1;
V4L2_IOCTL( pDevice, VIDIOC_S_CTRL, &s_ctrl )

dmesg log:

[ 1350.756153] videodev: v4l2_ioctl:  FILE:/v4l2-dev.c,FUNC:v4l2_ioctl(cmd=0xC008561C),LINE:358,cmd=VIDIOC_S_CTRL
[ 1350.756163]  FILE:/v4l2-ioctl.c,FUNC:v4l_s_ctrl(),LINE:2327
[ 1350.756168]  FILE:/v4l2-ctrls.c,FUNC:find_ref_lock(id=0x9A0932),LINE:2486
[ 1350.756170]  FILE:/v4l2-ctrls.c,FUNC:find_ref(id=0x9A0932),LINE:2441
[ 1350.756174]  hdl->cached==0x0000000046aedc50, hdl->cached->ctrl->id=0x9A092A
[ 1350.756177]  bucket(0x3), hdl->nr_of_buckets(0x5) LINE:2453
[ 1350.756180]  ref->ctrl->id(0x9A2034), id(0x9A0932), hdl->buckets=00000000d5823dc0 --LINE:2463
[ 1350.756182]  ref->ctrl->id(0x9A2034), id(0x9A0932)
[ 1350.756185]  ref->ctrl->id(0x9A206B), id(0x9A0932)
[ 1350.756187]  ref->ctrl->id(0x9A2066), id(0x9A0932)
[ 1350.756189]  ref->ctrl->id(0x9A092D), id(0x9A0932)
[ 1350.756191]  ref->ctrl->id(0x98091B), id(0x9A0932)
[ 1350.756193]  ref->ctrl->id(0x98090C), id(0x9A0932)
[ 1350.756196]  ref->ctrl->id(0x980902), id(0x9A0932)
[ 1350.756198]  ref->ctrl->id(0x980001), id(0x9A0932)
[ 1350.756200]  ref=NULL ++LINE:2472
[ 1350.756203]  FILE:/v4l2-ctrls.c,FUNC:v4l2_ctrl_find(id=0x9A0932),LINE:2500
[ 1350.756204]  ref=NULL, id=0x9A0932

Using tegracam_ctrl_ops to implement it. You should be able reference to the ov5693.c to know the detail.

It is same the Configuring Controls in Sensor Software Driver Programming online documents?
https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/SD/CameraDevelopment/SensorSoftwareDriverProgramming.html#configuring-controls

Looks like it’s the older version and yes your can reference to nv_imx185_v1.c

Have you any document to introduce the new version tegracam_ctrl_ops to ov5693.cc?

Sorry to tell don’t have document for it. But you can check the source code to know the detail.

Thanks

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