STRUCT V4L2_SUBDEV_VIDEO_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct v4l2_subdev_video_ops(9) β€” Kernel API Manual πŸŽ€

okay so welcome to the Kernel API Manual, bestie 🌸 β€” this page is all about struct v4l2_subdev_video_ops, the callback collection that gets used when a v4l device was opened in video mode. yes that's the whole vibe. let's get into it ✨


✨ NAME ✨

struct v4l2_subdev_video_ops β€” Callbacks used when v4l device was opened in video mode. πŸŽ₯


πŸ¦‹ SYNOPSIS πŸ¦‹

struct v4l2_subdev_video_ops {
    int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
    int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
    int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
    int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
    int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
    int (*g_std_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
    int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
    int (*g_tvnorms)(struct v4l2_subdev *sd, v4l2_std_id *std);
    int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
    int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
    int (*s_stream)(struct v4l2_subdev *sd, int enable);
    int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf, unsigned int *size);
    int (*pre_streamon)(struct v4l2_subdev *sd, u32 flags);
    int (*post_streamoff)(struct v4l2_subdev *sd);
 };

🫢 Members 🫢

  • s_routing β€” see s_routing in audio_ops, except this version is for video devices. same energy, video edition πŸ’…
  • s_crystal_freq β€” sets the frequency of the crystal used to generate the clocks in Hz. an extra flags field allows device specific configuration regarding clock frequency dividers, etc. If not used, then set flags to 0. If the frequency is not supported, then -EINVAL is returned. classic. πŸ™ˆ
  • g_std β€” callback for VIDIOC_G_STD ioctl handler code.
  • s_std β€” callback for VIDIOC_S_STD ioctl handler code.
  • s_std_output β€” set v4l2_std_id for video OUTPUT devices. This is ignored by video input devices. rude but ok 😭
  • g_std_output β€” get current standard for video OUTPUT devices. This is ignored by video input devices.
  • querystd β€” callback for VIDIOC_QUERYSTD ioctl handler code.
  • g_tvnorms β€” get v4l2_std_id with all standards supported by the video CAPTURE device. This is ignored by video output devices.
  • g_tvnorms_output β€” get v4l2_std_id with all standards supported by the video OUTPUT device. This is ignored by video capture devices.
  • g_input_status β€” get input status. Same as the status field in the struct v4l2_input. iykyk 🌈
  • s_stream β€” start (enabled == 1) or stop (enabled == 0) streaming on the sub-device. Failure on stop will remove any resources acquired in streaming start, while the error code is still returned by the driver. The caller shall track the subdev state, and shall not start or stop an already started or stopped subdev. Also see call_s_stream wrapper in v4l2-subdev.c. ⭐
  • s_rx_buffer β€” set a host allocated memory buffer for the subdev. The subdev can adjust size to a lower value and must not write more data to the buffer starting at data than the original value of size. girl, respect the bounds πŸ”₯
  • pre_streamon β€” May be called before streaming is actually started, to help initialising the bus. Current usage is to set a CSI-2 transmitter to LP-11 or LP-111 mode before streaming. See enum v4l2_subdev_pre_streamon_flags. 🧚
  • post_streamoff β€” Called after streaming is stopped, but if and only if pre_streamon was called earlier. the way that these two are literally a matched set πŸ’œ

πŸ’€ Description πŸ’€

This callback is DEPRECATED. 🚨

New drivers should instead implement v4l2_subdev_pad_ops.enable_streams and v4l2_subdev_pad_ops.disable_streams operations, and use v4l2_subdev_s_stream_helper for the v4l2_subdev_video_ops.s_stream operation to support legacy users.

Drivers should also not call the .s_stream subdev operation directly, but use the v4l2_subdev_enable_streams and v4l2_subdev_disable_streams helpers.

pre_streamon shall return error if it cannot perform the operation as indicated by the flags argument. In particular, -EACCES indicates lack of support for the operation. The caller shall call post_streamoff for each successful call of pre_streamon. no cap, that's the contract πŸŽ€


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/media/v4l2-subdev.h β€” plus the whole girliepop extended universe 🌸:


and that's the page, bestie πŸ’œ β€” brought to you straight out of ./include/media, October 2026 edition, main character manual energy only βœ¨πŸ«ΆπŸ’…

πŸ“¦ where this page comes from