linux/drivers/staging/media/omap4iss/iss_video.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * TI OMAP4 ISS V4L2 Driver - Generic video node
 *
 * Copyright (C) 2012 Texas Instruments, Inc.
 *
 * Author: Sergio Aguirre <[email protected]>
 */

#include <linux/clk.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/module.h>

#include <media/v4l2-dev.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mc.h>

#include "iss_video.h"
#include "iss.h"

/* -----------------------------------------------------------------------------
 * Helper functions
 */

static struct iss_format_info formats[] =;

const struct iss_format_info *
omap4iss_video_format_info(u32 code)
{}

/*
 * iss_video_mbus_to_pix - Convert v4l2_mbus_framefmt to v4l2_pix_format
 * @video: ISS video instance
 * @mbus: v4l2_mbus_framefmt format (input)
 * @pix: v4l2_pix_format format (output)
 *
 * Fill the output pix structure with information from the input mbus format.
 * The bytesperline and sizeimage fields are computed from the requested bytes
 * per line value in the pix format and information from the video instance.
 *
 * Return the number of padding bytes at end of line.
 */
static unsigned int iss_video_mbus_to_pix(const struct iss_video *video,
					  const struct v4l2_mbus_framefmt *mbus,
					  struct v4l2_pix_format *pix)
{}

static void iss_video_pix_to_mbus(const struct v4l2_pix_format *pix,
				  struct v4l2_mbus_framefmt *mbus)
{}

static struct v4l2_subdev *
iss_video_remote_subdev(struct iss_video *video, u32 *pad)
{}

/* Return a pointer to the ISS video instance at the far end of the pipeline. */
static struct iss_video *
iss_video_far_end(struct iss_video *video, struct iss_pipeline *pipe)
{}

static int
__iss_video_get_format(struct iss_video *video,
		       struct v4l2_mbus_framefmt *format)
{}

static int
iss_video_check_format(struct iss_video *video, struct iss_video_fh *vfh)
{}

/* -----------------------------------------------------------------------------
 * Video queue operations
 */

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

static void iss_video_buf_cleanup(struct vb2_buffer *vb)
{}

static int iss_video_buf_prepare(struct vb2_buffer *vb)
{}

static void iss_video_buf_queue(struct vb2_buffer *vb)
{}

static const struct vb2_ops iss_video_vb2ops =;

/*
 * omap4iss_video_buffer_next - Complete the current buffer and return the next
 * @video: ISS video object
 *
 * Remove the current video buffer from the DMA queue and fill its timestamp,
 * field count and state fields before waking up its completion handler.
 *
 * For capture video nodes, the buffer state is set to VB2_BUF_STATE_DONE if no
 * error has been flagged in the pipeline, or to VB2_BUF_STATE_ERROR otherwise.
 *
 * The DMA queue is expected to contain at least one buffer.
 *
 * Return a pointer to the next buffer in the DMA queue, or NULL if the queue is
 * empty.
 */
struct iss_buffer *omap4iss_video_buffer_next(struct iss_video *video)
{}

/*
 * omap4iss_video_cancel_stream - Cancel stream on a video node
 * @video: ISS video object
 *
 * Cancelling a stream mark all buffers on the video node as erroneous and makes
 * sure no new buffer can be queued.
 */
void omap4iss_video_cancel_stream(struct iss_video *video)
{}

/* -----------------------------------------------------------------------------
 * V4L2 ioctls
 */

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

static int
iss_video_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f)
{}

static int
iss_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
{}

static int
iss_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
{}

static int
iss_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
{}

static int
iss_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{}

static int
iss_video_set_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{}

static int
iss_video_get_param(struct file *file, void *fh, struct v4l2_streamparm *a)
{}

static int
iss_video_set_param(struct file *file, void *fh, struct v4l2_streamparm *a)
{}

static int
iss_video_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *rb)
{}

static int
iss_video_querybuf(struct file *file, void *fh, struct v4l2_buffer *b)
{}

static int
iss_video_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)
{}

static int
iss_video_expbuf(struct file *file, void *fh, struct v4l2_exportbuffer *e)
{}

static int
iss_video_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)
{}

/*
 * Stream management
 *
 * Every ISS pipeline has a single input and a single output. The input can be
 * either a sensor or a video node. The output is always a video node.
 *
 * As every pipeline has an output video node, the ISS video objects at the
 * pipeline output stores the pipeline state. It tracks the streaming state of
 * both the input and output, as well as the availability of buffers.
 *
 * In sensor-to-memory mode, frames are always available at the pipeline input.
 * Starting the sensor usually requires I2C transfers and must be done in
 * interruptible context. The pipeline is started and stopped synchronously
 * to the stream on/off commands. All modules in the pipeline will get their
 * subdev set stream handler called. The module at the end of the pipeline must
 * delay starting the hardware until buffers are available at its output.
 *
 * In memory-to-memory mode, starting/stopping the stream requires
 * synchronization between the input and output. ISS modules can't be stopped
 * in the middle of a frame, and at least some of the modules seem to become
 * busy as soon as they're started, even if they don't receive a frame start
 * event. For that reason frames need to be processed in single-shot mode. The
 * driver needs to wait until a frame is completely processed and written to
 * memory before restarting the pipeline for the next frame. Pipelined
 * processing might be possible but requires more testing.
 *
 * Stream start must be delayed until buffers are available at both the input
 * and output. The pipeline must be started in the vb2 queue callback with
 * the buffers queue spinlock held. The modules subdev set stream operation must
 * not sleep.
 */
static int
iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
{}

static int
iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
{}

static int
iss_video_enum_input(struct file *file, void *fh, struct v4l2_input *input)
{}

static int
iss_video_g_input(struct file *file, void *fh, unsigned int *input)
{}

static int
iss_video_s_input(struct file *file, void *fh, unsigned int input)
{}

static const struct v4l2_ioctl_ops iss_video_ioctl_ops =;

/* -----------------------------------------------------------------------------
 * V4L2 file operations
 */

static int iss_video_open(struct file *file)
{}

static int iss_video_release(struct file *file)
{}

static __poll_t iss_video_poll(struct file *file, poll_table *wait)
{}

static int iss_video_mmap(struct file *file, struct vm_area_struct *vma)
{}

static const struct v4l2_file_operations iss_video_fops =;

/* -----------------------------------------------------------------------------
 * ISS video core
 */

static const struct iss_video_operations iss_video_dummy_ops =;

int omap4iss_video_init(struct iss_video *video, const char *name)
{}

void omap4iss_video_cleanup(struct iss_video *video)
{}

int omap4iss_video_register(struct iss_video *video, struct v4l2_device *vdev)
{}

void omap4iss_video_unregister(struct iss_video *video)
{}