linux/drivers/media/pci/cx23885/cx23885-video.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Driver for the Conexant CX23885 PCIe bridge
 *
 *  Copyright (c) 2007 Steven Toth <[email protected]>
 */

#include "cx23885.h"
#include "cx23885-video.h"

#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kmod.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include <asm/div64.h>

#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
#include "cx23885-ioctl.h"
#include "xc2028.h"

#include <media/drv-intf/cx25840.h>

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();

/* ------------------------------------------------------------------ */

static unsigned int video_nr[] =;
static unsigned int vbi_nr[]   =;

module_param_array();
module_param_array();

MODULE_PARM_DESC();
MODULE_PARM_DESC();

static unsigned int video_debug;
module_param(video_debug, int, 0644);
MODULE_PARM_DESC();

static unsigned int irq_debug;
module_param(irq_debug, int, 0644);
MODULE_PARM_DESC();

static unsigned int vid_limit =;
module_param(vid_limit, int, 0644);
MODULE_PARM_DESC();

#define dprintk(level, fmt, arg...)

/* ------------------------------------------------------------------- */
/* static data                                                         */

#define FORMAT_FLAGS_PACKED
static struct cx23885_fmt formats[] =;

static struct cx23885_fmt *format_by_fourcc(unsigned int fourcc)
{}

/* ------------------------------------------------------------------- */

void cx23885_video_wakeup(struct cx23885_dev *dev,
	struct cx23885_dmaqueue *q, u32 count)
{}

int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
{}

static struct video_device *cx23885_vdev_init(struct cx23885_dev *dev,
				    struct pci_dev *pci,
				    struct video_device *template,
				    char *type)
{}

int cx23885_flatiron_write(struct cx23885_dev *dev, u8 reg, u8 data)
{}

u8 cx23885_flatiron_read(struct cx23885_dev *dev, u8 reg)
{}

static void cx23885_flatiron_dump(struct cx23885_dev *dev)
{}

static int cx23885_flatiron_mux(struct cx23885_dev *dev, int input)
{}

static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input)
{}

static int cx23885_audio_mux(struct cx23885_dev *dev, unsigned int input)
{}

/* ------------------------------------------------------------------ */
static int cx23885_start_video_dma(struct cx23885_dev *dev,
			   struct cx23885_dmaqueue *q,
			   struct cx23885_buffer *buf)
{}

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

static int buffer_prepare(struct vb2_buffer *vb)
{}

static void buffer_finish(struct vb2_buffer *vb)
{}

/*
 * The risc program for each buffer works as follows: it starts with a simple
 * 'JUMP to addr + 12', which is effectively a NOP. Then the code to DMA the
 * buffer follows and at the end we have a JUMP back to the start + 12 (skipping
 * the initial JUMP).
 *
 * This is the risc program of the first buffer to be queued if the active list
 * is empty and it just keeps DMAing this buffer without generating any
 * interrupts.
 *
 * If a new buffer is added then the initial JUMP in the code for that buffer
 * will generate an interrupt which signals that the previous buffer has been
 * DMAed successfully and that it can be returned to userspace.
 *
 * It also sets the final jump of the previous buffer to the start of the new
 * buffer, thus chaining the new buffer into the DMA chain. This is a single
 * atomic u32 write, so there is no race condition.
 *
 * The end-result of all this that you only get an interrupt when a buffer
 * is ready, so the control flow is very easy.
 */
static void buffer_queue(struct vb2_buffer *vb)
{}

static int cx23885_start_streaming(struct vb2_queue *q, unsigned int count)
{}

static void cx23885_stop_streaming(struct vb2_queue *q)
{}

static const struct vb2_ops cx23885_video_qops =;

/* ------------------------------------------------------------------ */
/* VIDEO IOCTLS                                                       */

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

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

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

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

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

static int vidioc_g_pixelaspect(struct file *file, void *priv,
				int type, struct v4l2_fract *f)
{}

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

static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
{}

static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
{}

int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
{}

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

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

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

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

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

static int vidioc_log_status(struct file *file, void *priv)
{}

static int cx23885_query_audinput(struct file *file, void *priv,
	struct v4l2_audio *i)
{}

static int vidioc_enum_audinput(struct file *file, void *priv,
				struct v4l2_audio *i)
{}

static int vidioc_g_audinput(struct file *file, void *priv,
	struct v4l2_audio *i)
{}

static int vidioc_s_audinput(struct file *file, void *priv,
	const struct v4l2_audio *i)
{}

static int vidioc_g_tuner(struct file *file, void *priv,
				struct v4l2_tuner *t)
{}

static int vidioc_s_tuner(struct file *file, void *priv,
				const struct v4l2_tuner *t)
{}

static int vidioc_g_frequency(struct file *file, void *priv,
				struct v4l2_frequency *f)
{}

static int cx23885_set_freq(struct cx23885_dev *dev, const struct v4l2_frequency *f)
{}

static int cx23885_set_freq_via_ops(struct cx23885_dev *dev,
	const struct v4l2_frequency *f)
{}

int cx23885_set_frequency(struct file *file, void *priv,
	const struct v4l2_frequency *f)
{}

static int vidioc_s_frequency(struct file *file, void *priv,
	const struct v4l2_frequency *f)
{}

/* ----------------------------------------------------------- */

int cx23885_video_irq(struct cx23885_dev *dev, u32 status)
{}

/* ----------------------------------------------------------- */
/* exported stuff                                              */

static const struct v4l2_file_operations video_fops =;

static const struct v4l2_ioctl_ops video_ioctl_ops =;

static struct video_device cx23885_vbi_template;
static struct video_device cx23885_video_template =;

void cx23885_video_unregister(struct cx23885_dev *dev)
{}

int cx23885_video_register(struct cx23885_dev *dev)
{}