linux/drivers/media/pci/cx23885/cx23885.h

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

#define pr_fmt(fmt)

#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/kdev_t.h>
#include <linux/slab.h>

#include <media/v4l2-device.h>
#include <media/v4l2-fh.h>
#include <media/v4l2-ctrls.h>
#include <media/tuner.h>
#include <media/tveeprom.h>
#include <media/videobuf2-dma-sg.h>
#include <media/videobuf2-dvb.h>
#include <media/rc-core.h>

#include "cx23885-reg.h"
#include "media/drv-intf/cx2341x.h"

#include <linux/mutex.h>

#define CX23885_VERSION

#define UNSET

#define CX23885_MAXBOARDS

/* Max number of inputs by card */
#define MAX_CX23885_INPUT
#define INPUT(nr)

#define BUFFER_TIMEOUT

#define CX23885_BOARD_NOAUTO
#define CX23885_BOARD_UNKNOWN
#define CX23885_BOARD_HAUPPAUGE_HVR1800lp
#define CX23885_BOARD_HAUPPAUGE_HVR1800
#define CX23885_BOARD_HAUPPAUGE_HVR1250
#define CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP
#define CX23885_BOARD_HAUPPAUGE_HVR1500Q
#define CX23885_BOARD_HAUPPAUGE_HVR1500
#define CX23885_BOARD_HAUPPAUGE_HVR1200
#define CX23885_BOARD_HAUPPAUGE_HVR1700
#define CX23885_BOARD_HAUPPAUGE_HVR1400
#define CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP
#define CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP
#define CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H
#define CX23885_BOARD_COMPRO_VIDEOMATE_E650F
#define CX23885_BOARD_TBS_6920
#define CX23885_BOARD_TEVII_S470
#define CX23885_BOARD_DVBWORLD_2005
#define CX23885_BOARD_NETUP_DUAL_DVBS2_CI
#define CX23885_BOARD_HAUPPAUGE_HVR1270
#define CX23885_BOARD_HAUPPAUGE_HVR1275
#define CX23885_BOARD_HAUPPAUGE_HVR1255
#define CX23885_BOARD_HAUPPAUGE_HVR1210
#define CX23885_BOARD_MYGICA_X8506
#define CX23885_BOARD_MAGICPRO_PROHDTVE2
#define CX23885_BOARD_HAUPPAUGE_HVR1850
#define CX23885_BOARD_COMPRO_VIDEOMATE_E800
#define CX23885_BOARD_HAUPPAUGE_HVR1290
#define CX23885_BOARD_MYGICA_X8558PRO
#define CX23885_BOARD_LEADTEK_WINFAST_PXTV1200
#define CX23885_BOARD_GOTVIEW_X5_3D_HYBRID
#define CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF
#define CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000
#define CX23885_BOARD_MPX885
#define CX23885_BOARD_MYGICA_X8507
#define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL
#define CX23885_BOARD_TEVII_S471
#define CX23885_BOARD_HAUPPAUGE_HVR1255_22111
#define CX23885_BOARD_PROF_8000
#define CX23885_BOARD_HAUPPAUGE_HVR4400
#define CX23885_BOARD_AVERMEDIA_HC81R
#define CX23885_BOARD_TBS_6981
#define CX23885_BOARD_TBS_6980
#define CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200
#define CX23885_BOARD_HAUPPAUGE_IMPACTVCBE
#define CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP2
#define CX23885_BOARD_DVBSKY_T9580
#define CX23885_BOARD_DVBSKY_T980C
#define CX23885_BOARD_DVBSKY_S950C
#define CX23885_BOARD_TT_CT2_4500_CI
#define CX23885_BOARD_DVBSKY_S950
#define CX23885_BOARD_DVBSKY_S952
#define CX23885_BOARD_DVBSKY_T982
#define CX23885_BOARD_HAUPPAUGE_HVR5525
#define CX23885_BOARD_HAUPPAUGE_STARBURST
#define CX23885_BOARD_VIEWCAST_260E
#define CX23885_BOARD_VIEWCAST_460E
#define CX23885_BOARD_HAUPPAUGE_QUADHD_DVB
#define CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC
#define CX23885_BOARD_HAUPPAUGE_HVR1265_K4
#define CX23885_BOARD_HAUPPAUGE_STARBURST2
#define CX23885_BOARD_HAUPPAUGE_QUADHD_DVB_885
#define CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC_885
#define CX23885_BOARD_AVERMEDIA_CE310B

#define GPIO_0
#define GPIO_1
#define GPIO_2
#define GPIO_3
#define GPIO_4
#define GPIO_5
#define GPIO_6
#define GPIO_7
#define GPIO_8
#define GPIO_9
#define GPIO_10
#define GPIO_11
#define GPIO_12
#define GPIO_13
#define GPIO_14
#define GPIO_15

/* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM B/G/H/LC */
#define CX23885_NORMS

struct cx23885_fmt {};

struct cx23885_tvnorm {};

enum cx23885_itype {};

enum cx23885_src_sel_type {};

struct cx23885_riscmem {};

/* buffer for one video frame */
struct cx23885_buffer {};

struct cx23885_input {};

port_t;

struct cx23885_board {};

struct cx23885_subid {};

struct cx23885_i2c {};

struct cx23885_dmaqueue {};

struct cx23885_tsport {};

struct cx23885_kernel_ir {};

struct cx23885_audio_buffer {};

struct cx23885_audio_dev {};

struct cx23885_dev {};

static inline struct cx23885_dev *to_cx23885(struct v4l2_device *v4l2_dev)
{}

#define call_all(dev, o, f, args...)

#define CX23885_HW_888_IR
#define CX23885_HW_AV_CORE

#define call_hw(dev, grpid, o, f, args...)

extern struct v4l2_subdev *cx23885_find_hw(struct cx23885_dev *dev, u32 hw);

#define SRAM_CH01
#define SRAM_CH02
#define SRAM_CH03
#define SRAM_CH04
#define SRAM_CH05
#define SRAM_CH06
#define SRAM_CH07
#define SRAM_CH08
#define SRAM_CH09
#define SRAM_CH10
#define SRAM_CH11
#define SRAM_CH12
#define SRAM_CH13
#define SRAM_CH14
#define SRAM_CH15

struct sram_channel {};

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

#define cx_read(reg)
#define cx_write(reg, value)

#define cx_andor(reg, mask, value)

#define cx_set(reg, bit)
#define cx_clear(reg, bit)

/* ----------------------------------------------------------- */
/* cx23885-core.c                                              */

extern int cx23885_sram_channel_setup(struct cx23885_dev *dev,
	struct sram_channel *ch,
	unsigned int bpl, u32 risc);

extern void cx23885_sram_channel_dump(struct cx23885_dev *dev,
	struct sram_channel *ch);

extern int cx23885_risc_buffer(struct pci_dev *pci, struct cx23885_riscmem *risc,
	struct scatterlist *sglist,
	unsigned int top_offset, unsigned int bottom_offset,
	unsigned int bpl, unsigned int padding, unsigned int lines);

extern int cx23885_risc_vbibuffer(struct pci_dev *pci,
	struct cx23885_riscmem *risc, struct scatterlist *sglist,
	unsigned int top_offset, unsigned int bottom_offset,
	unsigned int bpl, unsigned int padding, unsigned int lines);

int cx23885_start_dma(struct cx23885_tsport *port,
			     struct cx23885_dmaqueue *q,
			     struct cx23885_buffer   *buf);
void cx23885_cancel_buffers(struct cx23885_tsport *port);


extern void cx23885_gpio_set(struct cx23885_dev *dev, u32 mask);
extern void cx23885_gpio_clear(struct cx23885_dev *dev, u32 mask);
extern u32 cx23885_gpio_get(struct cx23885_dev *dev, u32 mask);
extern void cx23885_gpio_enable(struct cx23885_dev *dev, u32 mask,
	int asoutput);

extern void cx23885_irq_add_enable(struct cx23885_dev *dev, u32 mask);
extern void cx23885_irq_enable(struct cx23885_dev *dev, u32 mask);
extern void cx23885_irq_disable(struct cx23885_dev *dev, u32 mask);
extern void cx23885_irq_remove(struct cx23885_dev *dev, u32 mask);

/* ----------------------------------------------------------- */
/* cx23885-cards.c                                             */
extern struct cx23885_board cx23885_boards[];
extern const unsigned int cx23885_bcount;

extern struct cx23885_subid cx23885_subids[];
extern const unsigned int cx23885_idcount;

extern int cx23885_tuner_callback(void *priv, int component,
	int command, int arg);
extern void cx23885_card_list(struct cx23885_dev *dev);
extern int  cx23885_ir_init(struct cx23885_dev *dev);
extern void cx23885_ir_pci_int_enable(struct cx23885_dev *dev);
extern void cx23885_ir_fini(struct cx23885_dev *dev);
extern void cx23885_gpio_setup(struct cx23885_dev *dev);
extern void cx23885_card_setup(struct cx23885_dev *dev);
extern void cx23885_card_setup_pre_i2c(struct cx23885_dev *dev);

extern int cx23885_dvb_register(struct cx23885_tsport *port);
extern int cx23885_dvb_unregister(struct cx23885_tsport *port);

extern int cx23885_buf_prepare(struct cx23885_buffer *buf,
			       struct cx23885_tsport *port);
extern void cx23885_buf_queue(struct cx23885_tsport *port,
			      struct cx23885_buffer *buf);
extern void cx23885_free_buffer(struct cx23885_dev *dev,
				struct cx23885_buffer *buf);

/* ----------------------------------------------------------- */
/* cx23885-video.c                                             */
/* Video */
extern int cx23885_video_register(struct cx23885_dev *dev);
extern void cx23885_video_unregister(struct cx23885_dev *dev);
extern int cx23885_video_irq(struct cx23885_dev *dev, u32 status);
extern void cx23885_video_wakeup(struct cx23885_dev *dev,
	struct cx23885_dmaqueue *q, u32 count);
int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i);
int cx23885_set_input(struct file *file, void *priv, unsigned int i);
int cx23885_get_input(struct file *file, void *priv, unsigned int *i);
int cx23885_set_frequency(struct file *file, void *priv, const struct v4l2_frequency *f);
int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm);

/* ----------------------------------------------------------- */
/* cx23885-vbi.c                                               */
extern int cx23885_vbi_fmt(struct file *file, void *priv,
	struct v4l2_format *f);
extern void cx23885_vbi_timeout(unsigned long data);
extern const struct vb2_ops cx23885_vbi_qops;
extern int cx23885_vbi_irq(struct cx23885_dev *dev, u32 status);

/* cx23885-i2c.c                                                */
extern int cx23885_i2c_register(struct cx23885_i2c *bus);
extern int cx23885_i2c_unregister(struct cx23885_i2c *bus);
extern void cx23885_av_clk(struct cx23885_dev *dev, int enable);

/* ----------------------------------------------------------- */
/* cx23885-417.c                                               */
extern int cx23885_417_register(struct cx23885_dev *dev);
extern void cx23885_417_unregister(struct cx23885_dev *dev);
extern int cx23885_irq_417(struct cx23885_dev *dev, u32 status);
extern void cx23885_417_check_encoder(struct cx23885_dev *dev);
extern void cx23885_mc417_init(struct cx23885_dev *dev);
extern int mc417_memory_read(struct cx23885_dev *dev, u32 address, u32 *value);
extern int mc417_memory_write(struct cx23885_dev *dev, u32 address, u32 value);
extern int mc417_register_read(struct cx23885_dev *dev,
				u16 address, u32 *value);
extern int mc417_register_write(struct cx23885_dev *dev,
				u16 address, u32 value);
extern void mc417_gpio_set(struct cx23885_dev *dev, u32 mask);
extern void mc417_gpio_clear(struct cx23885_dev *dev, u32 mask);
extern void mc417_gpio_enable(struct cx23885_dev *dev, u32 mask, int asoutput);

/* ----------------------------------------------------------- */
/* cx23885-alsa.c                                             */
extern struct cx23885_audio_dev *cx23885_audio_register(
					struct cx23885_dev *dev);
extern void cx23885_audio_unregister(struct cx23885_dev *dev);
extern int cx23885_audio_irq(struct cx23885_dev *dev, u32 status, u32 mask);
extern int cx23885_risc_databuffer(struct pci_dev *pci,
				   struct cx23885_riscmem *risc,
				   struct scatterlist *sglist,
				   unsigned int bpl,
				   unsigned int lines,
				   unsigned int lpi);

/* ----------------------------------------------------------- */
/* tv norms                                                    */

static inline unsigned int norm_maxh(v4l2_std_id norm)
{}