linux/drivers/media/usb/cx231xx/cx231xx-417.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *
 *  Support for a cx23417 mpeg encoder via cx231xx 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://ivtv.sourceforge.net/),
 */

#include "cx231xx.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 <linux/vmalloc.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
#include <media/drv-intf/cx2341x.h>
#include <media/tuner.h>

#define CX231xx_FIRM_IMAGE_SIZE
#define CX231xx_FIRM_IMAGE_NAME

/* for polaris ITVC */
#define ITVC_WRITE_DIR
#define ITVC_READ_DIR

#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 for polaris ITVC */
#define MCI_MODE_REGISTER_READ
#define MCI_MODE_REGISTER_WRITE
#define MCI_MODE_MEMORY_READ
#define MCI_MODE_MEMORY_WRITE

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 cx231xx_tvnorm cx231xx_tvnorms[] =;

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

enum cx231xx_capture_type {};

enum cx231xx_capture_bits {};

enum cx231xx_capture_end {};

enum cx231xx_framerate {};

enum cx231xx_stream_port {};

enum cx231xx_data_xfer_status {};

enum cx231xx_picture_mask {};

enum cx231xx_vbi_mode_bits {};

enum cx231xx_vbi_insertion_bits {};

enum cx231xx_dma_unit {};

enum cx231xx_dma_transfer_status_bits {};

enum cx231xx_pause {};

enum cx231xx_copyright {};

enum cx231xx_notification_type {};

enum cx231xx_notification_status {};

enum cx231xx_notification_mailbox {};

enum cx231xx_field1_lines {};

enum cx231xx_field2_lines {};

enum cx231xx_custom_data_type {};

enum cx231xx_mute {};

enum cx231xx_mute_video_mask {};

enum cx231xx_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


/* 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


#define CX23417_GPIO_MASK

static int set_itvc_reg(struct cx231xx *dev, u32 gpio_direction, u32 value)
{}

static int get_itvc_reg(struct cx231xx *dev, u32 gpio_direction, u32 *val_ptr)
{}

static int wait_for_mci_complete(struct cx231xx *dev)
{}

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

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

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

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

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

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

static int cx231xx_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 cx231xx_api_cmd(struct cx231xx *dev, u32 command,
		u32 inputcnt, u32 outputcnt, ...)
{}


static int cx231xx_find_mailbox(struct cx231xx *dev)
{}

static void mci_write_memory_to_gpio(struct cx231xx *dev, u32 address, u32 value,
		u32 *p_fw_image)
{}


static int cx231xx_load_firmware(struct cx231xx *dev)
{}

static void cx231xx_codec_settings(struct cx231xx *dev)
{}

static int cx231xx_initialize_codec(struct cx231xx *dev)
{}

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

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

static void buffer_copy(struct cx231xx *dev, char *data, int len, struct urb *urb,
		struct cx231xx_dmaqueue *dma_q)
{}

static void buffer_filled(char *data, int len, struct urb *urb,
		struct cx231xx_dmaqueue *dma_q)
{}

static int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb)
{}

static int cx231xx_bulk_copy(struct cx231xx *dev, struct urb *urb)
{}

static void buffer_queue(struct vb2_buffer *vb)
{}

static void return_all_buffers(struct cx231xx *dev,
			       enum vb2_buffer_state state)
{}

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

static void stop_streaming(struct vb2_queue *vq)
{}

static const struct vb2_ops cx231xx_video_qops =;

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

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 *priv,
			      struct v4l2_selection *s)
{}

static int vidioc_g_std(struct file *file, void *fh0, v4l2_std_id *norm)
{}

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

static int vidioc_s_ctrl(struct file *file, void *priv,
				struct v4l2_control *ctl)
{}

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_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 cx231xx_mpeg_template =;

void cx231xx_417_unregister(struct cx231xx *dev)
{}

static int cx231xx_s_video_encoding(struct cx2341x_handler *cxhdl, u32 val)
{}

static int cx231xx_s_audio_sampling_freq(struct cx2341x_handler *cxhdl, u32 idx)
{}

static const struct cx2341x_handler_ops cx231xx_ops =;

static void cx231xx_video_dev_init(
	struct cx231xx *dev,
	struct usb_device *usbdev,
	struct video_device *vfd,
	const struct video_device *template,
	const char *type)
{}

int cx231xx_417_register(struct cx231xx *dev)
{}

MODULE_FIRMWARE();