linux/drivers/media/pci/mgb4/mgb4_vin.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2021-2023 Digiteq Automotive
 *     author: Martin Tuma <[email protected]>
 *
 * This is the v4l2 input device module. It initializes the signal deserializers
 * and creates the v4l2 video devices. The input signal can change at any time
 * which is handled by the "timings" callbacks and an IRQ based watcher, that
 * emits the V4L2_EVENT_SOURCE_CHANGE event in case of a signal source change.
 *
 * When the device is in loopback mode (a direct, in HW, in->out frame passing
 * mode) the card's frame queue must be running regardless of whether a v4l2
 * stream is running and the output parameters like frame buffers padding must
 * be in sync with the input parameters.
 */

#include <linux/pci.h>
#include <linux/workqueue.h>
#include <linux/align.h>
#include <linux/dma/amd_xdma.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-dma-sg.h>
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-event.h>
#include "mgb4_core.h"
#include "mgb4_dma.h"
#include "mgb4_sysfs.h"
#include "mgb4_io.h"
#include "mgb4_vout.h"
#include "mgb4_vin.h"

ATTRIBUTE_GROUPS();
ATTRIBUTE_GROUPS();

static const struct mgb4_vin_config vin_cfg[] =;

static const struct i2c_board_info fpdl3_deser_info[] =;

static const struct i2c_board_info gmsl_deser_info[] =;

static const struct mgb4_i2c_kv fpdl3_i2c[] =;

static const struct mgb4_i2c_kv gmsl_i2c[] =;

static const struct v4l2_dv_timings_cap video_timings_cap =;

/*
 * Returns the video output connected with the given video input if the input
 * is in loopback mode.
 */
static struct mgb4_vout_dev *loopback_dev(struct mgb4_vin_dev *vindev, int i)
{}

/*
 * Check, whether the loopback mode - a HW INPUT->OUTPUT transmission - is
 * enabled on the given input.
 */
static int loopback_active(struct mgb4_vin_dev *vindev)
{}

/*
 * Set the output frame buffer padding of all outputs connected with the given
 * input when the video input is set to loopback mode. The paddings must be
 * the same for the loopback to work properly.
 */
static void set_loopback_padding(struct mgb4_vin_dev *vindev, u32 padding)
{}

static int get_timings(struct mgb4_vin_dev *vindev,
		       struct v4l2_dv_timings *timings)
{}

static void return_all_buffers(struct mgb4_vin_dev *vindev,
			       enum vb2_buffer_state state)
{}

static int queue_setup(struct vb2_queue *q, unsigned int *nbuffers,
		       unsigned int *nplanes, unsigned int sizes[],
		       struct device *alloc_devs[])
{}

static int buffer_init(struct vb2_buffer *vb)
{}

static int buffer_prepare(struct vb2_buffer *vb)
{}

static void buffer_queue(struct vb2_buffer *vb)
{}

static void stop_streaming(struct vb2_queue *vq)
{}

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

static const struct vb2_ops queue_ops =;

static int fh_open(struct file *file)
{}

static int fh_release(struct file *file)
{}

static const struct v4l2_file_operations video_fops =;

static int vidioc_querycap(struct file *file, void *priv,
			   struct v4l2_capability *cap)
{}

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

static int vidioc_enum_frameintervals(struct file *file, void *priv,
				      struct v4l2_frmivalenum *ival)
{}

static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
{}

static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
{}

static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
{}

static int vidioc_enum_input(struct file *file, void *priv,
			     struct v4l2_input *i)
{}

static int vidioc_enum_framesizes(struct file *file, void *fh,
				  struct v4l2_frmsizeenum *fsize)
{}

static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
{}

static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
{}

static int vidioc_parm(struct file *file, void *priv,
		       struct v4l2_streamparm *parm)
{}

static int vidioc_s_dv_timings(struct file *file, void *fh,
			       struct v4l2_dv_timings *timings)
{}

static int vidioc_g_dv_timings(struct file *file, void *fh,
			       struct v4l2_dv_timings *timings)
{}

static int vidioc_query_dv_timings(struct file *file, void *fh,
				   struct v4l2_dv_timings *timings)
{}

static int vidioc_enum_dv_timings(struct file *file, void *fh,
				  struct v4l2_enum_dv_timings *timings)
{}

static int vidioc_dv_timings_cap(struct file *file, void *fh,
				 struct v4l2_dv_timings_cap *cap)
{}

static int vidioc_subscribe_event(struct v4l2_fh *fh,
				  const struct v4l2_event_subscription *sub)
{}

static const struct v4l2_ioctl_ops video_ioctl_ops =;

static void dma_transfer(struct work_struct *work)
{}

static void signal_change(struct work_struct *work)
{}

static irqreturn_t vin_handler(int irq, void *ctx)
{}

static irqreturn_t err_handler(int irq, void *ctx)
{}

static int deser_init(struct mgb4_vin_dev *vindev, int id)
{}

static void fpga_init(struct mgb4_vin_dev *vindev)
{}

#ifdef CONFIG_DEBUG_FS
static void debugfs_init(struct mgb4_vin_dev *vindev)
{}
#endif

struct mgb4_vin_dev *mgb4_vin_create(struct mgb4_dev *mgbdev, int id)
{}

void mgb4_vin_free(struct mgb4_vin_dev *vindev)
{}