V4L2 Camera Driver Development Custom Controls

hello busch.johannes,

assume you have check Sensor Software Driver Programming Guide for sensor driver implementation.

you may check below kernel sources for available TEGRA_CAMERA_CID_* controls,
let’s taking preferred stride controls as an example,
$L4T_Sources/r32.4.3/Linux_for_Tegra/source/public/kernel/nvidia/include/media/tegra-v4l2-camera.h

#define TEGRA_CAMERA_CID_BASE   (V4L2_CTRL_CLASS_CAMERA | 0x2000)
...
#define TEGRA_CAMERA_CID_VI_PREFERRED_STRIDE (TEGRA_CAMERA_CID_BASE+110)

you should also refer to VI driver, which define the CID control property and also parse the control settings,
$L4T_Sources/r32.4.3/Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c

static const struct v4l2_ctrl_config common_custom_ctrls[] = {
...
        {
                .ops = &channel_ctrl_ops,
                .id = TEGRA_CAMERA_CID_VI_PREFERRED_STRIDE,
                ...

int tegra_channel_s_ctrl(struct v4l2_ctrl *ctrl)

        switch (ctrl->id) {
        ...
        case TEGRA_CAMERA_CID_VI_PREFERRED_STRIDE:
                chan->preferred_stride = ctrl->val;
                tegra_channel_update_format(...)

you may enable v4l2-ctl to display all available information, to check whether you’d implement that correctly,

$ v4l2-ctl --all
...
               preferred_stride 0x009a206e (int)    : min=0 max=65535 step=1 default=0 value=0

then, you’ll able to enable --set-ctrl flags to assign your property settings into VI drivers.
for example, $ v4l2-ctl -d /dev/video0 ... --set-ctrl preferred_stride=256 ...

moreover,
if you would like to extend your customize CID controls,
please adding specific CID flags to tegra-v4l2-camera.h,
you should also have implementation in the VI drivers, channel.c.
thanks