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

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *
 *  Support for a cx23417 mpeg encoder via cx23885 host port.
 *
 *    (c) 2004 Jelle Foks <[email protected]>
 *    (c) 2004 Gerd Knorr <[email protected]>
 *    (c) 2008 Steven Toth <[email protected]>
 *      - CX23885/7/8 support
 *
 *  Includes parts from the ivtv driver <http://sourceforge.net/projects/ivtv/>
 */

#include "cx23885.h"
#include "cx23885-ioctl.h"

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/slab.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/drv-intf/cx2341x.h>

#define CX23885_FIRM_IMAGE_SIZE
#define CX23885_FIRM_IMAGE_NAME

static unsigned int mpegbufs =;
module_param(mpegbufs, int, 0644);
MODULE_PARM_DESC();
static unsigned int mpeglines =;
module_param(mpeglines, int, 0644);
MODULE_PARM_DESC();
static unsigned int mpeglinesize =;
module_param(mpeglinesize, int, 0644);
MODULE_PARM_DESC();

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

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

static struct cx23885_tvnorm cx23885_tvnorms[] =;

/* ------------------------------------------------------------------ */
enum cx23885_capture_type {};
enum cx23885_capture_bits {};
enum cx23885_capture_end {};
enum cx23885_framerate {};
enum cx23885_stream_port {};
enum cx23885_data_xfer_status {};
enum cx23885_picture_mask {};
enum cx23885_vbi_mode_bits {};
enum cx23885_vbi_insertion_bits {};
enum cx23885_dma_unit {};
enum cx23885_dma_transfer_status_bits {};
enum cx23885_pause {};
enum cx23885_copyright {};
enum cx23885_notification_type {};
enum cx23885_notification_status {};
enum cx23885_notification_mailbox {};
enum cx23885_field1_lines {};
enum cx23885_field2_lines {};
enum cx23885_custom_data_type {};
enum cx23885_mute {};
enum cx23885_mute_video_mask {};
enum cx23885_mute_video_shift {};

/* defines below are from ivtv-driver.h */
#define IVTV_CMD_HW_BLOCKS_RST

/* Firmware API commands */
#define IVTV_API_STD_TIMEOUT

/* Registers */
/* IVTV_REG_OFFSET */
#define IVTV_REG_ENC_SDRAM_REFRESH
#define IVTV_REG_ENC_SDRAM_PRECHARGE
#define IVTV_REG_SPU
#define IVTV_REG_HW_BLOCKS
#define IVTV_REG_VPU
#define IVTV_REG_APU

/**** Bit definitions for MC417_RWD and MC417_OEN registers  ***
  bits 31-16
+-----------+
| Reserved  |
+-----------+
  bit 15  bit 14  bit 13 bit 12  bit 11  bit 10  bit 9   bit 8
+-------+-------+-------+-------+-------+-------+-------+-------+
| MIWR# | MIRD# | MICS# |MIRDY# |MIADDR3|MIADDR2|MIADDR1|MIADDR0|
+-------+-------+-------+-------+-------+-------+-------+-------+
 bit 7   bit 6   bit 5   bit 4   bit 3   bit 2   bit 1   bit 0
+-------+-------+-------+-------+-------+-------+-------+-------+
|MIDATA7|MIDATA6|MIDATA5|MIDATA4|MIDATA3|MIDATA2|MIDATA1|MIDATA0|
+-------+-------+-------+-------+-------+-------+-------+-------+
***/
#define MC417_MIWR
#define MC417_MIRD
#define MC417_MICS
#define MC417_MIRDY
#define MC417_MIADDR
#define MC417_MIDATA

/* MIADDR* nibble definitions */
#define MCI_MEMORY_DATA_BYTE0
#define MCI_MEMORY_DATA_BYTE1
#define MCI_MEMORY_DATA_BYTE2
#define MCI_MEMORY_DATA_BYTE3
#define MCI_MEMORY_ADDRESS_BYTE2
#define MCI_MEMORY_ADDRESS_BYTE1
#define MCI_MEMORY_ADDRESS_BYTE0
#define MCI_REGISTER_DATA_BYTE0
#define MCI_REGISTER_DATA_BYTE1
#define MCI_REGISTER_DATA_BYTE2
#define MCI_REGISTER_DATA_BYTE3
#define MCI_REGISTER_ADDRESS_BYTE0
#define MCI_REGISTER_ADDRESS_BYTE1
#define MCI_REGISTER_MODE

/* Read and write modes */
#define MCI_MODE_REGISTER_READ
#define MCI_MODE_REGISTER_WRITE
#define MCI_MODE_MEMORY_READ
#define MCI_MODE_MEMORY_WRITE

/*** Bit definitions for MC417_CTL register ****
 bits 31-6   bits 5-4   bit 3    bits 2-1       Bit 0
+--------+-------------+--------+--------------+------------+
|Reserved|MC417_SPD_CTL|Reserved|MC417_GPIO_SEL|UART_GPIO_EN|
+--------+-------------+--------+--------------+------------+
***/
#define MC417_SPD_CTL(x)
#define MC417_GPIO_SEL(x)
#define MC417_UART_GPIO_EN

/* Values for speed control */
#define MC417_SPD_CTL_SLOW
#define MC417_SPD_CTL_MEDIUM
#define MC417_SPD_CTL_FAST

/* Values for GPIO select */
#define MC417_GPIO_SEL_GPIO3
#define MC417_GPIO_SEL_GPIO2
#define MC417_GPIO_SEL_GPIO1
#define MC417_GPIO_SEL_GPIO0

void cx23885_mc417_init(struct cx23885_dev *dev)
{}

static int mc417_wait_ready(struct cx23885_dev *dev)
{}

int mc417_register_write(struct cx23885_dev *dev, u16 address, u32 value)
{}

int mc417_register_read(struct cx23885_dev *dev, u16 address, u32 *value)
{}

int mc417_memory_write(struct cx23885_dev *dev, u32 address, u32 value)
{}

int mc417_memory_read(struct cx23885_dev *dev, u32 address, u32 *value)
{}

void mc417_gpio_set(struct cx23885_dev *dev, u32 mask)
{}

void mc417_gpio_clear(struct cx23885_dev *dev, u32 mask)
{}

void mc417_gpio_enable(struct cx23885_dev *dev, u32 mask, int asoutput)
{}
/* ------------------------------------------------------------------ */

/* MPEG encoder API */
static char *cmd_to_str(int cmd)
{}

static int cx23885_mbox_func(void *priv,
			     u32 command,
			     int in,
			     int out,
			     u32 data[CX2341X_MBOX_MAX_DATA])
{}

/* We don't need to call the API often, so using just one
 * mailbox will probably suffice
 */
static int cx23885_api_cmd(struct cx23885_dev *dev,
			   u32 command,
			   u32 inputcnt,
			   u32 outputcnt,
			   ...)
{}

static int cx23885_api_func(void *priv, u32 cmd, int in, int out, u32 data[CX2341X_MBOX_MAX_DATA])
{}

static int cx23885_find_mailbox(struct cx23885_dev *dev)
{}

static int cx23885_load_firmware(struct cx23885_dev *dev)
{}

void cx23885_417_check_encoder(struct cx23885_dev *dev)
{}

static void cx23885_codec_settings(struct cx23885_dev *dev)
{}

static int cx23885_initialize_codec(struct cx23885_dev *dev, int startencoder)
{}

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

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)
{}

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_qops =;

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

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 id)
{}

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

static int vidioc_g_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_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 vidioc_s_frequency(struct file *file, void *priv,
	const struct v4l2_frequency *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_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_log_status(struct file *file, void *priv)
{}

static const struct v4l2_file_operations mpeg_fops =;

static const struct v4l2_ioctl_ops mpeg_ioctl_ops =;

static struct video_device cx23885_mpeg_template =;

void cx23885_417_unregister(struct cx23885_dev *dev)
{}

static struct video_device *cx23885_video_dev_alloc(
	struct cx23885_tsport *tsport,
	struct pci_dev *pci,
	struct video_device *template,
	char *type)
{}

int cx23885_417_register(struct cx23885_dev *dev)
{}

MODULE_FIRMWARE();