linux/drivers/media/pci/cx88/cx88.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * v4l2 device driver for cx2388x based TV cards
 *
 * (c) 2003,04 Gerd Knorr <[email protected]> [SUSE Labs]
 */

#ifndef CX88_H
#define CX88_H

#define pr_fmt(fmt)

#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/videodev2.h>
#include <linux/kdev_t.h>
#include <linux/refcount.h>

#include <media/v4l2-device.h>
#include <media/v4l2-fh.h>
#include <media/tuner.h>
#include <media/tveeprom.h>
#include <media/videobuf2-dma-sg.h>
#include <media/drv-intf/cx2341x.h>
#include <media/videobuf2-dvb.h>
#include <media/i2c/ir-kbd-i2c.h>
#include <media/i2c/wm8775.h>

#include "cx88-reg.h"
#include "xc2028.h"

#include <linux/mutex.h>

#define CX88_VERSION

#define UNSET

#define CX88_MAXBOARDS

/* Max number of inputs by card */
#define MAX_CX88_INPUT

/* ----------------------------------------------------------- */
/* defines and enums                                           */

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

#define FORMAT_FLAGS_PACKED
#define FORMAT_FLAGS_PLANAR

#define VBI_LINE_PAL_COUNT
#define VBI_LINE_NTSC_COUNT
#define VBI_LINE_LENGTH

#define AUD_RDS_LINES

/* need "shadow" registers for some write-only ones ... */
#define SHADOW_AUD_VOL_CTL
#define SHADOW_AUD_BAL_CTL
#define SHADOW_MAX

/* FM Radio deemphasis type */
enum cx88_deemph_type {};

enum cx88_board_type {};

enum cx8802_board_access {};

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

static inline unsigned int norm_maxw(v4l2_std_id norm)
{}

static inline unsigned int norm_maxh(v4l2_std_id norm)
{}

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

struct cx8800_fmt {};

/* ----------------------------------------------------------- */
/* SRAM memory management data (see cx88-core.c)               */

#define SRAM_CH21
#define SRAM_CH22
#define SRAM_CH23
#define SRAM_CH24
#define SRAM_CH25
#define SRAM_CH26
#define SRAM_CH28
#define SRAM_CH27
/* more */

struct sram_channel {};

extern const struct sram_channel cx88_sram_channels[];

/* ----------------------------------------------------------- */
/* card configuration                                          */

#define CX88_BOARD_NOAUTO
#define CX88_BOARD_UNKNOWN
#define CX88_BOARD_HAUPPAUGE
#define CX88_BOARD_GDI
#define CX88_BOARD_PIXELVIEW
#define CX88_BOARD_ATI_WONDER_PRO
#define CX88_BOARD_WINFAST2000XP_EXPERT
#define CX88_BOARD_AVERTV_STUDIO_303
#define CX88_BOARD_MSI_TVANYWHERE_MASTER
#define CX88_BOARD_WINFAST_DV2000
#define CX88_BOARD_LEADTEK_PVR2000
#define CX88_BOARD_IODATA_GVVCP3PCI
#define CX88_BOARD_PROLINK_PLAYTVPVR
#define CX88_BOARD_ASUS_PVR_416
#define CX88_BOARD_MSI_TVANYWHERE
#define CX88_BOARD_KWORLD_DVB_T
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1
#define CX88_BOARD_KWORLD_LTV883
#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q
#define CX88_BOARD_HAUPPAUGE_DVB_T1
#define CX88_BOARD_CONEXANT_DVB_T1
#define CX88_BOARD_PROVIDEO_PV259
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS
#define CX88_BOARD_PCHDTV_HD3000
#define CX88_BOARD_DNTV_LIVE_DVB_T
#define CX88_BOARD_HAUPPAUGE_ROSLYN
#define CX88_BOARD_DIGITALLOGIC_MEC
#define CX88_BOARD_IODATA_GVBCTV7E
#define CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO
#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T
#define CX88_BOARD_ADSTECH_DVB_T_PCI
#define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1
#define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD
#define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550
#define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD
#define CX88_BOARD_ATI_HDTVWONDER
#define CX88_BOARD_WINFAST_DTV1000
#define CX88_BOARD_AVERTV_303
#define CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1
#define CX88_BOARD_HAUPPAUGE_NOVASE2_S1
#define CX88_BOARD_KWORLD_DVBS_100
#define CX88_BOARD_HAUPPAUGE_HVR1100
#define CX88_BOARD_HAUPPAUGE_HVR1100LP
#define CX88_BOARD_DNTV_LIVE_DVB_T_PRO
#define CX88_BOARD_KWORLD_DVB_T_CX22702
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL
#define CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID
#define CX88_BOARD_PCHDTV_HD5500
#define CX88_BOARD_KWORLD_MCE200_DELUXE
#define CX88_BOARD_PIXELVIEW_PLAYTV_P7000
#define CX88_BOARD_NPGTECH_REALTV_TOP10FM
#define CX88_BOARD_WINFAST_DTV2000H
#define CX88_BOARD_GENIATECH_DVBS
#define CX88_BOARD_HAUPPAUGE_HVR3000
#define CX88_BOARD_NORWOOD_MICRO
#define CX88_BOARD_TE_DTV_250_OEM_SWANN
#define CX88_BOARD_HAUPPAUGE_HVR1300
#define CX88_BOARD_ADSTECH_PTV_390
#define CX88_BOARD_PINNACLE_PCTV_HD_800i
#define CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO
#define CX88_BOARD_PINNACLE_HYBRID_PCTV
#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL
#define CX88_BOARD_POWERCOLOR_REAL_ANGEL
#define CX88_BOARD_GENIATECH_X8000_MT
#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO
#define CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD
#define CX88_BOARD_PROLINK_PV_8000GT
#define CX88_BOARD_KWORLD_ATSC_120
#define CX88_BOARD_HAUPPAUGE_HVR4000
#define CX88_BOARD_HAUPPAUGE_HVR4000LITE
#define CX88_BOARD_TEVII_S460
#define CX88_BOARD_OMICOM_SS4_PCI
#define CX88_BOARD_TBS_8920
#define CX88_BOARD_TEVII_S420
#define CX88_BOARD_PROLINK_PV_GLOBAL_XTREME
#define CX88_BOARD_PROF_7300
#define CX88_BOARD_SATTRADE_ST4200
#define CX88_BOARD_TBS_8910
#define CX88_BOARD_PROF_6200
#define CX88_BOARD_TERRATEC_CINERGY_HT_PCI_MKII
#define CX88_BOARD_HAUPPAUGE_IRONLY
#define CX88_BOARD_WINFAST_DTV1800H
#define CX88_BOARD_WINFAST_DTV2000H_J
#define CX88_BOARD_PROF_7301
#define CX88_BOARD_SAMSUNG_SMT_7020
#define CX88_BOARD_TWINHAN_VP1027_DVBS
#define CX88_BOARD_TEVII_S464
#define CX88_BOARD_WINFAST_DTV2000H_PLUS
#define CX88_BOARD_WINFAST_DTV1800H_XC4000
#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F36
#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F43
#define CX88_BOARD_NOTONLYTV_LV3H

enum cx88_itype {};

struct cx88_input {};

enum cx88_audio_chip {};

struct cx88_board {};

struct cx88_subid {};

enum cx88_tvaudio {};

#define INPUT(nr)

/* ----------------------------------------------------------- */
/* device / file handle status                                 */

#define RESOURCE_OVERLAY
#define RESOURCE_VIDEO
#define RESOURCE_VBI

#define BUFFER_TIMEOUT

struct cx88_riscmem {};

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

struct cx88_dmaqueue {};

struct cx8800_dev;
struct cx8802_dev;

struct cx88_core {};

static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
{}

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

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

#define WM8775_GID

#define wm8775_s_ctrl(core, id, val)

#define wm8775_g_ctrl(core, id)

/* ----------------------------------------------------------- */
/* function 0: video stuff                                     */

struct cx8800_suspend_state {};

struct cx8800_dev {};

/* ----------------------------------------------------------- */
/* function 1: audio/alsa stuff                                */
/* =============> moved to cx88-alsa.c <====================== */

/* ----------------------------------------------------------- */
/* function 2: mpeg stuff                                      */

struct cx8802_suspend_state {};

struct cx8802_driver {};

struct cx8802_dev {};

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

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

#define cx_andor(reg, mask, value)
#define cx_set(reg, bit)
#define cx_clear(reg, bit)

#define cx_wait(d)

/* shadow registers */
#define cx_sread(sreg)
#define cx_swrite(sreg, reg, value)
#define cx_sandor(sreg, reg, mask, value)

/* ----------------------------------------------------------- */
/* cx88-core.c                                                 */

extern unsigned int cx88_core_debug;

void cx88_print_irqbits(const char *tag, const char *strings[],
			int len, u32 bits, u32 mask);

int cx88_core_irq(struct cx88_core *core, u32 status);
void cx88_wakeup(struct cx88_core *core,
		 struct cx88_dmaqueue *q, u32 count);
void cx88_shutdown(struct cx88_core *core);
int cx88_reset(struct cx88_core *core);

extern int
cx88_risc_buffer(struct pci_dev *pci, struct cx88_riscmem *risc,
		 struct scatterlist *sglist,
		 unsigned int top_offset, unsigned int bottom_offset,
		 unsigned int bpl, unsigned int padding, unsigned int lines);
extern int
cx88_risc_databuffer(struct pci_dev *pci, struct cx88_riscmem *risc,
		     struct scatterlist *sglist, unsigned int bpl,
		     unsigned int lines, unsigned int lpi);

void cx88_risc_disasm(struct cx88_core *core,
		      struct cx88_riscmem *risc);
int cx88_sram_channel_setup(struct cx88_core *core,
			    const struct sram_channel *ch,
			    unsigned int bpl, u32 risc);
void cx88_sram_channel_dump(struct cx88_core *core,
			    const struct sram_channel *ch);

int cx88_set_scale(struct cx88_core *core, unsigned int width,
		   unsigned int height, enum v4l2_field field);
int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm);

void cx88_vdev_init(struct cx88_core *core,
		    struct pci_dev *pci,
		    struct video_device *vfd,
		    const struct video_device *template_,
		    const char *type);
struct cx88_core *cx88_core_get(struct pci_dev *pci);
void cx88_core_put(struct cx88_core *core,
		   struct pci_dev *pci);

int cx88_start_audio_dma(struct cx88_core *core);
int cx88_stop_audio_dma(struct cx88_core *core);

/* ----------------------------------------------------------- */
/* cx88-vbi.c                                                  */

/* Can be used as g_vbi_fmt, try_vbi_fmt and s_vbi_fmt */
int cx8800_vbi_fmt(struct file *file, void *priv,
		   struct v4l2_format *f);

void cx8800_stop_vbi_dma(struct cx8800_dev *dev);
int cx8800_restart_vbi_queue(struct cx8800_dev *dev, struct cx88_dmaqueue *q);

extern const struct vb2_ops cx8800_vbi_qops;

/* ----------------------------------------------------------- */
/* cx88-i2c.c                                                  */

int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci);

/* ----------------------------------------------------------- */
/* cx88-cards.c                                                */

int cx88_tuner_callback(void *dev, int component, int command, int arg);
int cx88_get_resources(const struct cx88_core *core,
		       struct pci_dev *pci);
struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr);
void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);

/* ----------------------------------------------------------- */
/* cx88-tvaudio.c                                              */

void cx88_set_tvaudio(struct cx88_core *core);
void cx88_newstation(struct cx88_core *core);
void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t);
void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual);
int cx88_audio_thread(void *data);

int cx8802_register_driver(struct cx8802_driver *drv);
int cx8802_unregister_driver(struct cx8802_driver *drv);

/* Caller must hold core->lock */
struct cx8802_driver *cx8802_get_driver(struct cx8802_dev *dev,
					enum cx88_board_type btype);

/* ----------------------------------------------------------- */
/* cx88-dsp.c                                                  */

s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core);

/* ----------------------------------------------------------- */
/* cx88-input.c                                                */

int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci);
int cx88_ir_fini(struct cx88_core *core);
void cx88_ir_irq(struct cx88_core *core);
int cx88_ir_start(struct cx88_core *core);
void cx88_ir_stop(struct cx88_core *core);
void cx88_i2c_init_ir(struct cx88_core *core);

/* ----------------------------------------------------------- */
/* cx88-mpeg.c                                                 */

int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
		       struct cx88_buffer *buf);
void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf);
void cx8802_cancel_buffers(struct cx8802_dev *dev);
int cx8802_start_dma(struct cx8802_dev    *dev,
		     struct cx88_dmaqueue *q,
		     struct cx88_buffer   *buf);

/* ----------------------------------------------------------- */
/* cx88-video.c*/
int cx88_enum_input(struct cx88_core *core, struct v4l2_input *i);
int cx88_set_freq(struct cx88_core  *core, const struct v4l2_frequency *f);
int cx88_video_mux(struct cx88_core *core, unsigned int input);
int cx88_querycap(struct file *file, struct cx88_core *core,
		  struct v4l2_capability *cap);

#endif