linux/drivers/staging/media/ipu3/ipu3-v4l2.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2018 Intel Corporation

#include <linux/module.h>
#include <linux/pm_runtime.h>

#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>

#include "ipu3.h"
#include "ipu3-dmamap.h"

/******************** v4l2_subdev_ops ********************/

#define IPU3_RUNNING_MODE_VIDEO
#define IPU3_RUNNING_MODE_STILL

static int imgu_subdev_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{}

static int imgu_subdev_s_stream(struct v4l2_subdev *sd, int enable)
{}

static int imgu_subdev_get_fmt(struct v4l2_subdev *sd,
			       struct v4l2_subdev_state *sd_state,
			       struct v4l2_subdev_format *fmt)
{}

static int imgu_subdev_set_fmt(struct v4l2_subdev *sd,
			       struct v4l2_subdev_state *sd_state,
			       struct v4l2_subdev_format *fmt)
{}

static struct v4l2_rect *
imgu_subdev_get_crop(struct imgu_v4l2_subdev *sd,
		     struct v4l2_subdev_state *sd_state, unsigned int pad,
		     enum v4l2_subdev_format_whence which)
{}

static struct v4l2_rect *
imgu_subdev_get_compose(struct imgu_v4l2_subdev *sd,
			struct v4l2_subdev_state *sd_state, unsigned int pad,
			enum v4l2_subdev_format_whence which)
{}

static int imgu_subdev_get_selection(struct v4l2_subdev *sd,
				     struct v4l2_subdev_state *sd_state,
				     struct v4l2_subdev_selection *sel)
{}

static int imgu_subdev_set_selection(struct v4l2_subdev *sd,
				     struct v4l2_subdev_state *sd_state,
				     struct v4l2_subdev_selection *sel)
{}

/******************** media_entity_operations ********************/

static int imgu_link_setup(struct media_entity *entity,
			   const struct media_pad *local,
			   const struct media_pad *remote, u32 flags)
{}

/******************** vb2_ops ********************/

static int imgu_vb2_buf_init(struct vb2_buffer *vb)
{}

/* Called when each buffer is freed */
static void imgu_vb2_buf_cleanup(struct vb2_buffer *vb)
{}

/* Transfer buffer ownership to me */
static void imgu_vb2_buf_queue(struct vb2_buffer *vb)
{}

static int imgu_vb2_queue_setup(struct vb2_queue *vq,
				unsigned int *num_buffers,
				unsigned int *num_planes,
				unsigned int sizes[],
				struct device *alloc_devs[])
{}

/* Check if all enabled video nodes are streaming, exception ignored */
static bool imgu_all_nodes_streaming(struct imgu_device *imgu,
				     struct imgu_video_device *except)
{}

static void imgu_return_all_buffers(struct imgu_device *imgu,
				    struct imgu_video_device *node,
				    enum vb2_buffer_state state)
{}

static int imgu_vb2_start_streaming(struct vb2_queue *vq, unsigned int count)
{}

static void imgu_vb2_stop_streaming(struct vb2_queue *vq)
{}

/******************** v4l2_ioctl_ops ********************/

#define VID_CAPTURE
#define VID_OUTPUT
#define DEF_VID_CAPTURE
#define DEF_VID_OUTPUT

struct imgu_fmt {};

/* format descriptions for capture and preview */
static const struct imgu_fmt formats[] =;

/* Find the first matched format, return default if not found */
static const struct imgu_fmt *find_format(struct v4l2_format *f, u32 type)
{}

static int imgu_vidioc_querycap(struct file *file, void *fh,
				struct v4l2_capability *cap)
{}

static int enum_fmts(struct v4l2_fmtdesc *f, u32 type)
{}

static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
				   struct v4l2_fmtdesc *f)
{}

static int vidioc_enum_fmt_vid_out(struct file *file, void *priv,
				   struct v4l2_fmtdesc *f)
{}

/* Propagate forward always the format from the CIO2 subdev */
static int imgu_vidioc_g_fmt(struct file *file, void *fh,
			     struct v4l2_format *f)
{}

/*
 * Set input/output format. Unless it is just a try, this also resets
 * selections (ie. effective and BDS resolutions) to defaults.
 */
static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node,
		    struct v4l2_format *f, bool try)
{}

static int imgu_try_fmt(struct file *file, void *fh, struct v4l2_format *f)
{}

static int imgu_vidioc_try_fmt(struct file *file, void *fh,
			       struct v4l2_format *f)
{}

static int imgu_vidioc_s_fmt(struct file *file, void *fh, struct v4l2_format *f)
{}

struct imgu_meta_fmt {};

/* From drivers/media/v4l2-core/v4l2-ioctl.c */
static const struct imgu_meta_fmt meta_fmts[] =;

static int imgu_meta_enum_format(struct file *file, void *fh,
				 struct v4l2_fmtdesc *fmt)
{}

static int imgu_vidioc_g_meta_fmt(struct file *file, void *fh,
				  struct v4l2_format *f)
{}

/******************** function pointers ********************/

static const struct v4l2_subdev_internal_ops imgu_subdev_internal_ops =;

static const struct v4l2_subdev_core_ops imgu_subdev_core_ops =;

static const struct v4l2_subdev_video_ops imgu_subdev_video_ops =;

static const struct v4l2_subdev_pad_ops imgu_subdev_pad_ops =;

static const struct v4l2_subdev_ops imgu_subdev_ops =;

static const struct media_entity_operations imgu_media_ops =;

/****************** vb2_ops of the Q ********************/

static const struct vb2_ops imgu_vb2_ops =;

/****************** v4l2_file_operations *****************/

static const struct v4l2_file_operations imgu_v4l2_fops =;

/******************** v4l2_ioctl_ops ********************/

static const struct v4l2_ioctl_ops imgu_v4l2_ioctl_ops =;

static const struct v4l2_ioctl_ops imgu_v4l2_meta_ioctl_ops =;

static int imgu_sd_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops imgu_subdev_ctrl_ops =;

static const char * const imgu_ctrl_mode_strings[] =;

static const struct v4l2_ctrl_config imgu_subdev_ctrl_mode =;

/******************** Framework registration ********************/

/* helper function to config node's video properties */
static void imgu_node_to_v4l2(u32 node, struct video_device *vdev,
			      struct v4l2_format *f)
{}

static int imgu_v4l2_subdev_register(struct imgu_device *imgu,
				     struct imgu_v4l2_subdev *imgu_sd,
				     unsigned int pipe)
{}

static int imgu_v4l2_node_setup(struct imgu_device *imgu, unsigned int pipe,
				int node_num)
{}

static void imgu_v4l2_nodes_cleanup_pipe(struct imgu_device *imgu,
					 unsigned int pipe, int node)
{}

static int imgu_v4l2_nodes_setup_pipe(struct imgu_device *imgu, int pipe)
{}

static void imgu_v4l2_subdev_cleanup(struct imgu_device *imgu, unsigned int i)
{}

static void imgu_v4l2_cleanup_pipes(struct imgu_device *imgu, unsigned int pipe)
{}

static int imgu_v4l2_register_pipes(struct imgu_device *imgu)
{}

int imgu_v4l2_register(struct imgu_device *imgu)
{}

int imgu_v4l2_unregister(struct imgu_device *imgu)
{}

void imgu_v4l2_buffer_done(struct vb2_buffer *vb,
			   enum vb2_buffer_state state)
{}