linux/drivers/media/pci/bt8xx/bttv.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 *
 *  bttv - Bt848 frame grabber driver
 *
 *  card ID's and external interfaces of the bttv driver
 *  basically stuff needed by other drivers (i2c, lirc, ...)
 *  and is supported not to change much over time.
 *
 *  Copyright (C) 1996,97 Ralph Metzler ([email protected])
 *  (c) 1999,2000 Gerd Knorr <[email protected]>
 *
 */

#ifndef _BTTV_H_
#define _BTTV_H_

#include <linux/videodev2.h>
#include <linux/i2c.h>
#include <media/v4l2-device.h>
#include <media/tuner.h>

/* ---------------------------------------------------------- */
/* exported by bttv-cards.c                                   */

#define BTTV_BOARD_UNKNOWN
#define BTTV_BOARD_MIRO
#define BTTV_BOARD_HAUPPAUGE
#define BTTV_BOARD_STB
#define BTTV_BOARD_INTEL
#define BTTV_BOARD_DIAMOND
#define BTTV_BOARD_AVERMEDIA
#define BTTV_BOARD_MATRIX_VISION
#define BTTV_BOARD_FLYVIDEO
#define BTTV_BOARD_TURBOTV
#define BTTV_BOARD_HAUPPAUGE878
#define BTTV_BOARD_MIROPRO
#define BTTV_BOARD_ADSTECH_TV
#define BTTV_BOARD_AVERMEDIA98
#define BTTV_BOARD_VHX
#define BTTV_BOARD_ZOLTRIX
#define BTTV_BOARD_PIXVIEWPLAYTV
#define BTTV_BOARD_WINVIEW_601
#define BTTV_BOARD_AVEC_INTERCAP
#define BTTV_BOARD_LIFE_FLYKIT
#define BTTV_BOARD_CEI_RAFFLES
#define BTTV_BOARD_CONFERENCETV
#define BTTV_BOARD_PHOEBE_TVMAS
#define BTTV_BOARD_MODTEC_205
#define BTTV_BOARD_MAGICTVIEW061
#define BTTV_BOARD_VOBIS_BOOSTAR
#define BTTV_BOARD_HAUPPAUG_WCAM
#define BTTV_BOARD_MAXI
#define BTTV_BOARD_TERRATV
#define BTTV_BOARD_PXC200
#define BTTV_BOARD_FLYVIDEO_98
#define BTTV_BOARD_IPROTV
#define BTTV_BOARD_INTEL_C_S_PCI
#define BTTV_BOARD_TERRATVALUE
#define BTTV_BOARD_WINFAST2000
#define BTTV_BOARD_CHRONOS_VS2
#define BTTV_BOARD_TYPHOON_TVIEW
#define BTTV_BOARD_PXELVWPLTVPRO
#define BTTV_BOARD_MAGICTVIEW063
#define BTTV_BOARD_PINNACLE
#define BTTV_BOARD_STB2
#define BTTV_BOARD_AVPHONE98
#define BTTV_BOARD_PV951
#define BTTV_BOARD_ONAIR_TV
#define BTTV_BOARD_SIGMA_TVII_FM
#define BTTV_BOARD_MATRIX_VISION2
#define BTTV_BOARD_ZOLTRIX_GENIE
#define BTTV_BOARD_TERRATVRADIO
#define BTTV_BOARD_DYNALINK
#define BTTV_BOARD_GVBCTV3PCI
#define BTTV_BOARD_PXELVWPLTVPAK
#define BTTV_BOARD_EAGLE
#define BTTV_BOARD_PINNACLEPRO
#define BTTV_BOARD_TVIEW_RDS_FM
#define BTTV_BOARD_LIFETEC_9415
#define BTTV_BOARD_BESTBUY_EASYTV
#define BTTV_BOARD_FLYVIDEO_98FM
#define BTTV_BOARD_GRANDTEC
#define BTTV_BOARD_ASKEY_CPH060
#define BTTV_BOARD_ASKEY_CPH03X
#define BTTV_BOARD_MM100PCTV
#define BTTV_BOARD_GMV1
#define BTTV_BOARD_BESTBUY_EASYTV2
#define BTTV_BOARD_ATI_TVWONDER
#define BTTV_BOARD_ATI_TVWONDERVE
#define BTTV_BOARD_FLYVIDEO2000
#define BTTV_BOARD_TERRATVALUER
#define BTTV_BOARD_GVBCTV4PCI
#define BTTV_BOARD_VOODOOTV_FM
#define BTTV_BOARD_AIMMS
#define BTTV_BOARD_PV_BT878P_PLUS
#define BTTV_BOARD_FLYVIDEO98EZ
#define BTTV_BOARD_PV_BT878P_9B
#define BTTV_BOARD_SENSORAY311_611
#define BTTV_BOARD_RV605
#define BTTV_BOARD_POWERCLR_MTV878
#define BTTV_BOARD_WINDVR
#define BTTV_BOARD_GRANDTEC_MULTI
#define BTTV_BOARD_KWORLD
#define BTTV_BOARD_DSP_TCVIDEO
#define BTTV_BOARD_HAUPPAUGEPVR
#define BTTV_BOARD_GVBCTV5PCI
#define BTTV_BOARD_OSPREY1x0
#define BTTV_BOARD_OSPREY1x0_848
#define BTTV_BOARD_OSPREY101_848
#define BTTV_BOARD_OSPREY1x1
#define BTTV_BOARD_OSPREY1x1_SVID
#define BTTV_BOARD_OSPREY2xx
#define BTTV_BOARD_OSPREY2x0_SVID
#define BTTV_BOARD_OSPREY2x0
#define BTTV_BOARD_OSPREY500
#define BTTV_BOARD_OSPREY540
#define BTTV_BOARD_OSPREY2000
#define BTTV_BOARD_IDS_EAGLE
#define BTTV_BOARD_PINNACLESAT
#define BTTV_BOARD_FORMAC_PROTV
#define BTTV_BOARD_MACHTV
#define BTTV_BOARD_EURESYS_PICOLO
#define BTTV_BOARD_PV150
#define BTTV_BOARD_AD_TVK503
#define BTTV_BOARD_HERCULES_SM_TV
#define BTTV_BOARD_PACETV
#define BTTV_BOARD_IVC200
#define BTTV_BOARD_XGUARD
#define BTTV_BOARD_NEBULA_DIGITV
#define BTTV_BOARD_PV143
#define BTTV_BOARD_VD009X1_VD011_MINIDIN
#define BTTV_BOARD_VD009X1_VD011_COMBI
#define BTTV_BOARD_VD009_MINIDIN
#define BTTV_BOARD_VD009_COMBI
#define BTTV_BOARD_IVC100
#define BTTV_BOARD_IVC120
#define BTTV_BOARD_PC_HDTV
#define BTTV_BOARD_TWINHAN_DST
#define BTTV_BOARD_WINFASTVC100
#define BTTV_BOARD_TEV560
#define BTTV_BOARD_SIMUS_GVC1100
#define BTTV_BOARD_NGSTV_PLUS
#define BTTV_BOARD_LMLBT4
#define BTTV_BOARD_TEKRAM_M205
#define BTTV_BOARD_CONTVFMI
#define BTTV_BOARD_PICOLO_TETRA_CHIP
#define BTTV_BOARD_SPIRIT_TV
#define BTTV_BOARD_AVDVBT_771
#define BTTV_BOARD_AVDVBT_761
#define BTTV_BOARD_MATRIX_VISIONSQ
#define BTTV_BOARD_MATRIX_VISIONSLC
#define BTTV_BOARD_APAC_VIEWCOMP
#define BTTV_BOARD_DVICO_DVBT_LITE
#define BTTV_BOARD_VGEAR_MYVCD
#define BTTV_BOARD_SUPER_TV
#define BTTV_BOARD_TIBET_CS16
#define BTTV_BOARD_KODICOM_4400R
#define BTTV_BOARD_KODICOM_4400R_SL
#define BTTV_BOARD_ADLINK_RTV24
#define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE
#define BTTV_BOARD_ACORP_Y878F
#define BTTV_BOARD_CONCEPTRONIC_CTVFMI2
#define BTTV_BOARD_PV_BT878P_2E
#define BTTV_BOARD_PV_M4900
#define BTTV_BOARD_OSPREY440
#define BTTV_BOARD_ASOUND_SKYEYE
#define BTTV_BOARD_SABRENT_TVFM
#define BTTV_BOARD_HAUPPAUGE_IMPACTVCB
#define BTTV_BOARD_MACHTV_MAGICTV
#define BTTV_BOARD_SSAI_SECURITY
#define BTTV_BOARD_SSAI_ULTRASOUND
#define BTTV_BOARD_VOODOOTV_200
#define BTTV_BOARD_DVICO_FUSIONHDTV_2
#define BTTV_BOARD_TYPHOON_TVTUNERPCI
#define BTTV_BOARD_GEOVISION_GV600
#define BTTV_BOARD_KOZUMI_KTV_01C
#define BTTV_BOARD_ENLTV_FM_2
#define BTTV_BOARD_VD012
#define BTTV_BOARD_VD012_X1
#define BTTV_BOARD_VD012_X2
#define BTTV_BOARD_IVCE8784
#define BTTV_BOARD_GEOVISION_GV800S
#define BTTV_BOARD_GEOVISION_GV800S_SL
#define BTTV_BOARD_PV183
#define BTTV_BOARD_TVT_TD3116
#define BTTV_BOARD_APOSONIC_WDVR
#define BTTV_BOARD_ADLINK_MPG24
#define BTTV_BOARD_BT848_CAP_14
#define BTTV_BOARD_CYBERVISION_CV06
#define BTTV_BOARD_KWORLD_VSTREAM_XPERT
#define BTTV_BOARD_PCI_8604PW

/* more card-specific defines */
#define PT2254_L_CHANNEL
#define PT2254_R_CHANNEL
#define PT2254_DBS_IN_2
#define PT2254_DBS_IN_10
#define WINVIEW_PT2254_CLK
#define WINVIEW_PT2254_DATA
#define WINVIEW_PT2254_STROBE

struct bttv_core {};

struct bttv;

struct tvcard {};

extern struct tvcard bttv_tvcards[];

/*
 * This bit of cpp voodoo is used to create a macro with a variable number of
 * arguments (1 to 16).  It will pack each argument into a word two bits at a
 * time.  It can't be a function because it needs to be compile time constant to
 * initialize structures.  Since each argument must fit in two bits, it's ok
 * that they are changed to octal.  One should not use hex number, macros, or
 * anything else with this macro.  Just use plain integers from 0 to 3.
 */
#define _MUXSELf(a)
#define _MUXSELe(a, b...)
#define _MUXSELd(a, b...)
#define _MUXSELc(a, b...)
#define _MUXSELb(a, b...)
#define _MUXSELa(a, b...)
#define _MUXSEL9(a, b...)
#define _MUXSEL8(a, b...)
#define _MUXSEL7(a, b...)
#define _MUXSEL6(a, b...)
#define _MUXSEL5(a, b...)
#define _MUXSEL4(a, b...)
#define _MUXSEL3(a, b...)
#define _MUXSEL2(a, b...)
#define _MUXSEL1(a, b...)
#define MUXSEL(a, b...)

/* identification / initialization of the card */
extern void bttv_idcard(struct bttv *btv);
extern void bttv_init_card1(struct bttv *btv);
extern void bttv_init_card2(struct bttv *btv);
extern void bttv_init_tuner(struct bttv *btv);

/* card-specific functions */
extern u32 bttv_tda9880_setnorm(struct bttv *btv, u32 gpiobits);

/* extra tweaks for some chipsets */
extern void bttv_check_chipset(void);
extern int bttv_handle_chipset(struct bttv *btv);

/* ---------------------------------------------------------- */
/* exported by bttv-if.c                                      */

/* this obsolete -- please use the sysfs-based
   interface below for new code */

extern struct pci_dev* bttv_get_pcidev(unsigned int card);

/* sets GPOE register (BT848_GPIO_OUT_EN) to new value:
   data | (current_GPOE_value & ~mask)
   returns negative value if error occurred
*/
extern int bttv_gpio_enable(unsigned int card,
			    unsigned long mask, unsigned long data);

/* fills data with GPDATA register contents
   returns negative value if error occurred
*/
extern int bttv_read_gpio(unsigned int card, unsigned long *data);

/* sets GPDATA register to new value:
  (data & mask) | (current_GPDATA_value & ~mask)
  returns negative value if error occurred
*/
extern int bttv_write_gpio(unsigned int card,
			   unsigned long mask, unsigned long data);




/* ---------------------------------------------------------- */
/* sysfs/driver-moded based gpio access interface             */

struct bttv_sub_device {};
#define to_bttv_sub_dev(x)

struct bttv_sub_driver {};
#define to_bttv_sub_drv(x)

int bttv_sub_register(struct bttv_sub_driver *drv, char *wanted);
int bttv_sub_unregister(struct bttv_sub_driver *drv);

/* gpio access functions */
void bttv_gpio_inout(struct bttv_core *core, u32 mask, u32 outbits);
u32 bttv_gpio_read(struct bttv_core *core);
void bttv_gpio_write(struct bttv_core *core, u32 value);
void bttv_gpio_bits(struct bttv_core *core, u32 mask, u32 bits);

#define gpio_inout(mask,bits)
#define gpio_read()
#define gpio_write(value)
#define gpio_bits(mask,bits)


/* ---------------------------------------------------------- */
/* i2c                                                        */

#define bttv_call_all(btv, o, f, args...)

#define bttv_call_all_err(btv, o, f, args...)

extern int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for);
extern int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
			 unsigned char b2, int both);
extern void bttv_readee(struct bttv *btv, unsigned char *eedata, int addr);

extern int bttv_input_init(struct bttv *dev);
extern void bttv_input_fini(struct bttv *dev);
extern void bttv_input_irq(struct bttv *dev);

#endif /* _BTTV_H_ */