1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 268de959fSMauro Carvalho Chehab /* 368de959fSMauro Carvalho Chehab * 468de959fSMauro Carvalho Chehab * bttv - Bt848 frame grabber driver 568de959fSMauro Carvalho Chehab * 668de959fSMauro Carvalho Chehab * card ID's and external interfaces of the bttv driver 768de959fSMauro Carvalho Chehab * basically stuff needed by other drivers (i2c, lirc, ...) 868de959fSMauro Carvalho Chehab * and is supported not to change much over time. 968de959fSMauro Carvalho Chehab * 1068de959fSMauro Carvalho Chehab * Copyright (C) 1996,97 Ralph Metzler (rjkm@thp.uni-koeln.de) 1168de959fSMauro Carvalho Chehab * (c) 1999,2000 Gerd Knorr <kraxel@goldbach.in-berlin.de> 1268de959fSMauro Carvalho Chehab * 1368de959fSMauro Carvalho Chehab */ 1468de959fSMauro Carvalho Chehab 1568de959fSMauro Carvalho Chehab #ifndef _BTTV_H_ 1668de959fSMauro Carvalho Chehab #define _BTTV_H_ 1768de959fSMauro Carvalho Chehab 1868de959fSMauro Carvalho Chehab #include <linux/videodev2.h> 1968de959fSMauro Carvalho Chehab #include <linux/i2c.h> 2068de959fSMauro Carvalho Chehab #include <media/v4l2-device.h> 2168de959fSMauro Carvalho Chehab #include <media/tuner.h> 2268de959fSMauro Carvalho Chehab 2368de959fSMauro Carvalho Chehab /* ---------------------------------------------------------- */ 2468de959fSMauro Carvalho Chehab /* exported by bttv-cards.c */ 2568de959fSMauro Carvalho Chehab 2668de959fSMauro Carvalho Chehab #define BTTV_BOARD_UNKNOWN 0x00 2768de959fSMauro Carvalho Chehab #define BTTV_BOARD_MIRO 0x01 2868de959fSMauro Carvalho Chehab #define BTTV_BOARD_HAUPPAUGE 0x02 2968de959fSMauro Carvalho Chehab #define BTTV_BOARD_STB 0x03 3068de959fSMauro Carvalho Chehab #define BTTV_BOARD_INTEL 0x04 3168de959fSMauro Carvalho Chehab #define BTTV_BOARD_DIAMOND 0x05 3268de959fSMauro Carvalho Chehab #define BTTV_BOARD_AVERMEDIA 0x06 3368de959fSMauro Carvalho Chehab #define BTTV_BOARD_MATRIX_VISION 0x07 3468de959fSMauro Carvalho Chehab #define BTTV_BOARD_FLYVIDEO 0x08 3568de959fSMauro Carvalho Chehab #define BTTV_BOARD_TURBOTV 0x09 3668de959fSMauro Carvalho Chehab #define BTTV_BOARD_HAUPPAUGE878 0x0a 3768de959fSMauro Carvalho Chehab #define BTTV_BOARD_MIROPRO 0x0b 3868de959fSMauro Carvalho Chehab #define BTTV_BOARD_ADSTECH_TV 0x0c 3968de959fSMauro Carvalho Chehab #define BTTV_BOARD_AVERMEDIA98 0x0d 4068de959fSMauro Carvalho Chehab #define BTTV_BOARD_VHX 0x0e 4168de959fSMauro Carvalho Chehab #define BTTV_BOARD_ZOLTRIX 0x0f 4268de959fSMauro Carvalho Chehab #define BTTV_BOARD_PIXVIEWPLAYTV 0x10 4368de959fSMauro Carvalho Chehab #define BTTV_BOARD_WINVIEW_601 0x11 4468de959fSMauro Carvalho Chehab #define BTTV_BOARD_AVEC_INTERCAP 0x12 4568de959fSMauro Carvalho Chehab #define BTTV_BOARD_LIFE_FLYKIT 0x13 4668de959fSMauro Carvalho Chehab #define BTTV_BOARD_CEI_RAFFLES 0x14 4768de959fSMauro Carvalho Chehab #define BTTV_BOARD_CONFERENCETV 0x15 4868de959fSMauro Carvalho Chehab #define BTTV_BOARD_PHOEBE_TVMAS 0x16 4968de959fSMauro Carvalho Chehab #define BTTV_BOARD_MODTEC_205 0x17 5068de959fSMauro Carvalho Chehab #define BTTV_BOARD_MAGICTVIEW061 0x18 5168de959fSMauro Carvalho Chehab #define BTTV_BOARD_VOBIS_BOOSTAR 0x19 5268de959fSMauro Carvalho Chehab #define BTTV_BOARD_HAUPPAUG_WCAM 0x1a 5368de959fSMauro Carvalho Chehab #define BTTV_BOARD_MAXI 0x1b 5468de959fSMauro Carvalho Chehab #define BTTV_BOARD_TERRATV 0x1c 5568de959fSMauro Carvalho Chehab #define BTTV_BOARD_PXC200 0x1d 5668de959fSMauro Carvalho Chehab #define BTTV_BOARD_FLYVIDEO_98 0x1e 5768de959fSMauro Carvalho Chehab #define BTTV_BOARD_IPROTV 0x1f 5868de959fSMauro Carvalho Chehab #define BTTV_BOARD_INTEL_C_S_PCI 0x20 5968de959fSMauro Carvalho Chehab #define BTTV_BOARD_TERRATVALUE 0x21 6068de959fSMauro Carvalho Chehab #define BTTV_BOARD_WINFAST2000 0x22 6168de959fSMauro Carvalho Chehab #define BTTV_BOARD_CHRONOS_VS2 0x23 6268de959fSMauro Carvalho Chehab #define BTTV_BOARD_TYPHOON_TVIEW 0x24 6368de959fSMauro Carvalho Chehab #define BTTV_BOARD_PXELVWPLTVPRO 0x25 6468de959fSMauro Carvalho Chehab #define BTTV_BOARD_MAGICTVIEW063 0x26 6568de959fSMauro Carvalho Chehab #define BTTV_BOARD_PINNACLE 0x27 6668de959fSMauro Carvalho Chehab #define BTTV_BOARD_STB2 0x28 6768de959fSMauro Carvalho Chehab #define BTTV_BOARD_AVPHONE98 0x29 6868de959fSMauro Carvalho Chehab #define BTTV_BOARD_PV951 0x2a 6968de959fSMauro Carvalho Chehab #define BTTV_BOARD_ONAIR_TV 0x2b 7068de959fSMauro Carvalho Chehab #define BTTV_BOARD_SIGMA_TVII_FM 0x2c 7168de959fSMauro Carvalho Chehab #define BTTV_BOARD_MATRIX_VISION2 0x2d 7268de959fSMauro Carvalho Chehab #define BTTV_BOARD_ZOLTRIX_GENIE 0x2e 7368de959fSMauro Carvalho Chehab #define BTTV_BOARD_TERRATVRADIO 0x2f 7468de959fSMauro Carvalho Chehab #define BTTV_BOARD_DYNALINK 0x30 7568de959fSMauro Carvalho Chehab #define BTTV_BOARD_GVBCTV3PCI 0x31 7668de959fSMauro Carvalho Chehab #define BTTV_BOARD_PXELVWPLTVPAK 0x32 7768de959fSMauro Carvalho Chehab #define BTTV_BOARD_EAGLE 0x33 7868de959fSMauro Carvalho Chehab #define BTTV_BOARD_PINNACLEPRO 0x34 7968de959fSMauro Carvalho Chehab #define BTTV_BOARD_TVIEW_RDS_FM 0x35 8068de959fSMauro Carvalho Chehab #define BTTV_BOARD_LIFETEC_9415 0x36 8168de959fSMauro Carvalho Chehab #define BTTV_BOARD_BESTBUY_EASYTV 0x37 8268de959fSMauro Carvalho Chehab #define BTTV_BOARD_FLYVIDEO_98FM 0x38 8368de959fSMauro Carvalho Chehab #define BTTV_BOARD_GRANDTEC 0x39 8468de959fSMauro Carvalho Chehab #define BTTV_BOARD_ASKEY_CPH060 0x3a 8568de959fSMauro Carvalho Chehab #define BTTV_BOARD_ASKEY_CPH03X 0x3b 8668de959fSMauro Carvalho Chehab #define BTTV_BOARD_MM100PCTV 0x3c 8768de959fSMauro Carvalho Chehab #define BTTV_BOARD_GMV1 0x3d 8868de959fSMauro Carvalho Chehab #define BTTV_BOARD_BESTBUY_EASYTV2 0x3e 8968de959fSMauro Carvalho Chehab #define BTTV_BOARD_ATI_TVWONDER 0x3f 9068de959fSMauro Carvalho Chehab #define BTTV_BOARD_ATI_TVWONDERVE 0x40 9168de959fSMauro Carvalho Chehab #define BTTV_BOARD_FLYVIDEO2000 0x41 9268de959fSMauro Carvalho Chehab #define BTTV_BOARD_TERRATVALUER 0x42 9368de959fSMauro Carvalho Chehab #define BTTV_BOARD_GVBCTV4PCI 0x43 9468de959fSMauro Carvalho Chehab #define BTTV_BOARD_VOODOOTV_FM 0x44 9568de959fSMauro Carvalho Chehab #define BTTV_BOARD_AIMMS 0x45 9668de959fSMauro Carvalho Chehab #define BTTV_BOARD_PV_BT878P_PLUS 0x46 9768de959fSMauro Carvalho Chehab #define BTTV_BOARD_FLYVIDEO98EZ 0x47 9868de959fSMauro Carvalho Chehab #define BTTV_BOARD_PV_BT878P_9B 0x48 9968de959fSMauro Carvalho Chehab #define BTTV_BOARD_SENSORAY311_611 0x49 10068de959fSMauro Carvalho Chehab #define BTTV_BOARD_RV605 0x4a 10168de959fSMauro Carvalho Chehab #define BTTV_BOARD_POWERCLR_MTV878 0x4b 10268de959fSMauro Carvalho Chehab #define BTTV_BOARD_WINDVR 0x4c 10368de959fSMauro Carvalho Chehab #define BTTV_BOARD_GRANDTEC_MULTI 0x4d 10468de959fSMauro Carvalho Chehab #define BTTV_BOARD_KWORLD 0x4e 10568de959fSMauro Carvalho Chehab #define BTTV_BOARD_DSP_TCVIDEO 0x4f 10668de959fSMauro Carvalho Chehab #define BTTV_BOARD_HAUPPAUGEPVR 0x50 10768de959fSMauro Carvalho Chehab #define BTTV_BOARD_GVBCTV5PCI 0x51 10868de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY1x0 0x52 10968de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY1x0_848 0x53 11068de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY101_848 0x54 11168de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY1x1 0x55 11268de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY1x1_SVID 0x56 11368de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY2xx 0x57 11468de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY2x0_SVID 0x58 11568de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY2x0 0x59 11668de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY500 0x5a 11768de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY540 0x5b 11868de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY2000 0x5c 11968de959fSMauro Carvalho Chehab #define BTTV_BOARD_IDS_EAGLE 0x5d 12068de959fSMauro Carvalho Chehab #define BTTV_BOARD_PINNACLESAT 0x5e 12168de959fSMauro Carvalho Chehab #define BTTV_BOARD_FORMAC_PROTV 0x5f 12268de959fSMauro Carvalho Chehab #define BTTV_BOARD_MACHTV 0x60 12368de959fSMauro Carvalho Chehab #define BTTV_BOARD_EURESYS_PICOLO 0x61 12468de959fSMauro Carvalho Chehab #define BTTV_BOARD_PV150 0x62 12568de959fSMauro Carvalho Chehab #define BTTV_BOARD_AD_TVK503 0x63 12668de959fSMauro Carvalho Chehab #define BTTV_BOARD_HERCULES_SM_TV 0x64 12768de959fSMauro Carvalho Chehab #define BTTV_BOARD_PACETV 0x65 12868de959fSMauro Carvalho Chehab #define BTTV_BOARD_IVC200 0x66 12968de959fSMauro Carvalho Chehab #define BTTV_BOARD_XGUARD 0x67 13068de959fSMauro Carvalho Chehab #define BTTV_BOARD_NEBULA_DIGITV 0x68 13168de959fSMauro Carvalho Chehab #define BTTV_BOARD_PV143 0x69 13268de959fSMauro Carvalho Chehab #define BTTV_BOARD_VD009X1_VD011_MINIDIN 0x6a 13368de959fSMauro Carvalho Chehab #define BTTV_BOARD_VD009X1_VD011_COMBI 0x6b 13468de959fSMauro Carvalho Chehab #define BTTV_BOARD_VD009_MINIDIN 0x6c 13568de959fSMauro Carvalho Chehab #define BTTV_BOARD_VD009_COMBI 0x6d 13668de959fSMauro Carvalho Chehab #define BTTV_BOARD_IVC100 0x6e 13768de959fSMauro Carvalho Chehab #define BTTV_BOARD_IVC120 0x6f 13868de959fSMauro Carvalho Chehab #define BTTV_BOARD_PC_HDTV 0x70 13968de959fSMauro Carvalho Chehab #define BTTV_BOARD_TWINHAN_DST 0x71 14068de959fSMauro Carvalho Chehab #define BTTV_BOARD_WINFASTVC100 0x72 14168de959fSMauro Carvalho Chehab #define BTTV_BOARD_TEV560 0x73 14268de959fSMauro Carvalho Chehab #define BTTV_BOARD_SIMUS_GVC1100 0x74 14368de959fSMauro Carvalho Chehab #define BTTV_BOARD_NGSTV_PLUS 0x75 14468de959fSMauro Carvalho Chehab #define BTTV_BOARD_LMLBT4 0x76 14568de959fSMauro Carvalho Chehab #define BTTV_BOARD_TEKRAM_M205 0x77 14668de959fSMauro Carvalho Chehab #define BTTV_BOARD_CONTVFMI 0x78 14768de959fSMauro Carvalho Chehab #define BTTV_BOARD_PICOLO_TETRA_CHIP 0x79 14868de959fSMauro Carvalho Chehab #define BTTV_BOARD_SPIRIT_TV 0x7a 14968de959fSMauro Carvalho Chehab #define BTTV_BOARD_AVDVBT_771 0x7b 15068de959fSMauro Carvalho Chehab #define BTTV_BOARD_AVDVBT_761 0x7c 15168de959fSMauro Carvalho Chehab #define BTTV_BOARD_MATRIX_VISIONSQ 0x7d 15268de959fSMauro Carvalho Chehab #define BTTV_BOARD_MATRIX_VISIONSLC 0x7e 15368de959fSMauro Carvalho Chehab #define BTTV_BOARD_APAC_VIEWCOMP 0x7f 15468de959fSMauro Carvalho Chehab #define BTTV_BOARD_DVICO_DVBT_LITE 0x80 15568de959fSMauro Carvalho Chehab #define BTTV_BOARD_VGEAR_MYVCD 0x81 15668de959fSMauro Carvalho Chehab #define BTTV_BOARD_SUPER_TV 0x82 15768de959fSMauro Carvalho Chehab #define BTTV_BOARD_TIBET_CS16 0x83 15868de959fSMauro Carvalho Chehab #define BTTV_BOARD_KODICOM_4400R 0x84 15968de959fSMauro Carvalho Chehab #define BTTV_BOARD_KODICOM_4400R_SL 0x85 16068de959fSMauro Carvalho Chehab #define BTTV_BOARD_ADLINK_RTV24 0x86 16168de959fSMauro Carvalho Chehab #define BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE 0x87 16268de959fSMauro Carvalho Chehab #define BTTV_BOARD_ACORP_Y878F 0x88 16368de959fSMauro Carvalho Chehab #define BTTV_BOARD_CONCEPTRONIC_CTVFMI2 0x89 16468de959fSMauro Carvalho Chehab #define BTTV_BOARD_PV_BT878P_2E 0x8a 16568de959fSMauro Carvalho Chehab #define BTTV_BOARD_PV_M4900 0x8b 16668de959fSMauro Carvalho Chehab #define BTTV_BOARD_OSPREY440 0x8c 16768de959fSMauro Carvalho Chehab #define BTTV_BOARD_ASOUND_SKYEYE 0x8d 16868de959fSMauro Carvalho Chehab #define BTTV_BOARD_SABRENT_TVFM 0x8e 16968de959fSMauro Carvalho Chehab #define BTTV_BOARD_HAUPPAUGE_IMPACTVCB 0x8f 17068de959fSMauro Carvalho Chehab #define BTTV_BOARD_MACHTV_MAGICTV 0x90 17168de959fSMauro Carvalho Chehab #define BTTV_BOARD_SSAI_SECURITY 0x91 17268de959fSMauro Carvalho Chehab #define BTTV_BOARD_SSAI_ULTRASOUND 0x92 17368de959fSMauro Carvalho Chehab #define BTTV_BOARD_VOODOOTV_200 0x93 17468de959fSMauro Carvalho Chehab #define BTTV_BOARD_DVICO_FUSIONHDTV_2 0x94 17568de959fSMauro Carvalho Chehab #define BTTV_BOARD_TYPHOON_TVTUNERPCI 0x95 17668de959fSMauro Carvalho Chehab #define BTTV_BOARD_GEOVISION_GV600 0x96 17768de959fSMauro Carvalho Chehab #define BTTV_BOARD_KOZUMI_KTV_01C 0x97 17868de959fSMauro Carvalho Chehab #define BTTV_BOARD_ENLTV_FM_2 0x98 17968de959fSMauro Carvalho Chehab #define BTTV_BOARD_VD012 0x99 18068de959fSMauro Carvalho Chehab #define BTTV_BOARD_VD012_X1 0x9a 18168de959fSMauro Carvalho Chehab #define BTTV_BOARD_VD012_X2 0x9b 18268de959fSMauro Carvalho Chehab #define BTTV_BOARD_IVCE8784 0x9c 18368de959fSMauro Carvalho Chehab #define BTTV_BOARD_GEOVISION_GV800S 0x9d 18468de959fSMauro Carvalho Chehab #define BTTV_BOARD_GEOVISION_GV800S_SL 0x9e 18568de959fSMauro Carvalho Chehab #define BTTV_BOARD_PV183 0x9f 18668de959fSMauro Carvalho Chehab #define BTTV_BOARD_TVT_TD3116 0xa0 18768de959fSMauro Carvalho Chehab #define BTTV_BOARD_APOSONIC_WDVR 0xa1 188835ab012SHans Verkuil #define BTTV_BOARD_ADLINK_MPG24 0xa2 189ec7c15b5SOndrej Zary #define BTTV_BOARD_BT848_CAP_14 0xa3 19005ff7240SHans Verkuil #define BTTV_BOARD_CYBERVISION_CV06 0xa4 191493a9cfdSPojar George #define BTTV_BOARD_KWORLD_VSTREAM_XPERT 0xa5 192c8204930SDaniel Glöckner #define BTTV_BOARD_PCI_8604PW 0xa6 19368de959fSMauro Carvalho Chehab 19468de959fSMauro Carvalho Chehab /* more card-specific defines */ 19568de959fSMauro Carvalho Chehab #define PT2254_L_CHANNEL 0x10 19668de959fSMauro Carvalho Chehab #define PT2254_R_CHANNEL 0x08 19768de959fSMauro Carvalho Chehab #define PT2254_DBS_IN_2 0x400 19868de959fSMauro Carvalho Chehab #define PT2254_DBS_IN_10 0x20000 19968de959fSMauro Carvalho Chehab #define WINVIEW_PT2254_CLK 0x40 20068de959fSMauro Carvalho Chehab #define WINVIEW_PT2254_DATA 0x20 20168de959fSMauro Carvalho Chehab #define WINVIEW_PT2254_STROBE 0x80 20268de959fSMauro Carvalho Chehab 20368de959fSMauro Carvalho Chehab struct bttv_core { 20468de959fSMauro Carvalho Chehab /* device structs */ 20568de959fSMauro Carvalho Chehab struct v4l2_device v4l2_dev; 20668de959fSMauro Carvalho Chehab struct pci_dev *pci; 20768de959fSMauro Carvalho Chehab struct i2c_adapter i2c_adap; 20868de959fSMauro Carvalho Chehab struct list_head subs; /* struct bttv_sub_device */ 20968de959fSMauro Carvalho Chehab 21068de959fSMauro Carvalho Chehab /* device config */ 21168de959fSMauro Carvalho Chehab unsigned int nr; /* dev nr (for printk("bttv%d: ..."); */ 21268de959fSMauro Carvalho Chehab unsigned int type; /* card type (pointer into tvcards[]) */ 21368de959fSMauro Carvalho Chehab }; 21468de959fSMauro Carvalho Chehab 21568de959fSMauro Carvalho Chehab struct bttv; 21668de959fSMauro Carvalho Chehab 21768de959fSMauro Carvalho Chehab struct tvcard { 21868de959fSMauro Carvalho Chehab char *name; 21968de959fSMauro Carvalho Chehab void (*volume_gpio)(struct bttv *btv, __u16 volume); 22068de959fSMauro Carvalho Chehab void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set); 22168de959fSMauro Carvalho Chehab void (*muxsel_hook)(struct bttv *btv, unsigned int input); 22268de959fSMauro Carvalho Chehab 22368de959fSMauro Carvalho Chehab /* MUX bits for each input, two bits per input starting with the LSB */ 22468de959fSMauro Carvalho Chehab u32 muxsel; /* Use MUXSEL() to set */ 22568de959fSMauro Carvalho Chehab 22668de959fSMauro Carvalho Chehab u32 gpiomask; 22768de959fSMauro Carvalho Chehab u32 gpiomux[4]; /* Tuner, Radio, external, internal */ 22868de959fSMauro Carvalho Chehab u32 gpiomute; /* GPIO mute setting */ 22968de959fSMauro Carvalho Chehab u32 gpiomask2; /* GPIO MUX mask */ 23068de959fSMauro Carvalho Chehab 23168de959fSMauro Carvalho Chehab unsigned int tuner_type; 23268de959fSMauro Carvalho Chehab u8 tuner_addr; 23368de959fSMauro Carvalho Chehab u8 video_inputs; /* Number of inputs */ 23468de959fSMauro Carvalho Chehab unsigned int svhs:4; /* Which input is s-video */ 23568de959fSMauro Carvalho Chehab #define NO_SVHS 15 23668de959fSMauro Carvalho Chehab unsigned int pll:2; 23768de959fSMauro Carvalho Chehab #define PLL_NONE 0 23868de959fSMauro Carvalho Chehab #define PLL_28 1 23968de959fSMauro Carvalho Chehab #define PLL_35 2 240ec7c15b5SOndrej Zary #define PLL_14 3 24168de959fSMauro Carvalho Chehab 24268de959fSMauro Carvalho Chehab /* i2c audio flags */ 24368de959fSMauro Carvalho Chehab unsigned int no_msp34xx:1; 24468de959fSMauro Carvalho Chehab unsigned int no_tda7432:1; 24568de959fSMauro Carvalho Chehab unsigned int msp34xx_alt:1; 24668de959fSMauro Carvalho Chehab /* Note: currently no card definition needs to mark the presence 24768de959fSMauro Carvalho Chehab of a RDS saa6588 chip. If this is ever needed, then add a new 24868de959fSMauro Carvalho Chehab 'has_saa6588' bit here. */ 24968de959fSMauro Carvalho Chehab 25068de959fSMauro Carvalho Chehab unsigned int no_video:1; /* video pci function is unused */ 25168de959fSMauro Carvalho Chehab unsigned int has_dvb:1; 25268de959fSMauro Carvalho Chehab unsigned int has_remote:1; 25368de959fSMauro Carvalho Chehab unsigned int has_radio:1; 25468de959fSMauro Carvalho Chehab unsigned int has_dig_in:1; /* Has digital input (always last input) */ 25568de959fSMauro Carvalho Chehab unsigned int no_gpioirq:1; 25668de959fSMauro Carvalho Chehab }; 25768de959fSMauro Carvalho Chehab 25868de959fSMauro Carvalho Chehab extern struct tvcard bttv_tvcards[]; 25968de959fSMauro Carvalho Chehab 26068de959fSMauro Carvalho Chehab /* 26168de959fSMauro Carvalho Chehab * This bit of cpp voodoo is used to create a macro with a variable number of 26268de959fSMauro Carvalho Chehab * arguments (1 to 16). It will pack each argument into a word two bits at a 26368de959fSMauro Carvalho Chehab * time. It can't be a function because it needs to be compile time constant to 26468de959fSMauro Carvalho Chehab * initialize structures. Since each argument must fit in two bits, it's ok 26568de959fSMauro Carvalho Chehab * that they are changed to octal. One should not use hex number, macros, or 26668de959fSMauro Carvalho Chehab * anything else with this macro. Just use plain integers from 0 to 3. 26768de959fSMauro Carvalho Chehab */ 26868de959fSMauro Carvalho Chehab #define _MUXSELf(a) 0##a << 30 26968de959fSMauro Carvalho Chehab #define _MUXSELe(a, b...) 0##a << 28 | _MUXSELf(b) 27068de959fSMauro Carvalho Chehab #define _MUXSELd(a, b...) 0##a << 26 | _MUXSELe(b) 27168de959fSMauro Carvalho Chehab #define _MUXSELc(a, b...) 0##a << 24 | _MUXSELd(b) 27268de959fSMauro Carvalho Chehab #define _MUXSELb(a, b...) 0##a << 22 | _MUXSELc(b) 27368de959fSMauro Carvalho Chehab #define _MUXSELa(a, b...) 0##a << 20 | _MUXSELb(b) 27468de959fSMauro Carvalho Chehab #define _MUXSEL9(a, b...) 0##a << 18 | _MUXSELa(b) 27568de959fSMauro Carvalho Chehab #define _MUXSEL8(a, b...) 0##a << 16 | _MUXSEL9(b) 27668de959fSMauro Carvalho Chehab #define _MUXSEL7(a, b...) 0##a << 14 | _MUXSEL8(b) 27768de959fSMauro Carvalho Chehab #define _MUXSEL6(a, b...) 0##a << 12 | _MUXSEL7(b) 27868de959fSMauro Carvalho Chehab #define _MUXSEL5(a, b...) 0##a << 10 | _MUXSEL6(b) 27968de959fSMauro Carvalho Chehab #define _MUXSEL4(a, b...) 0##a << 8 | _MUXSEL5(b) 28068de959fSMauro Carvalho Chehab #define _MUXSEL3(a, b...) 0##a << 6 | _MUXSEL4(b) 28168de959fSMauro Carvalho Chehab #define _MUXSEL2(a, b...) 0##a << 4 | _MUXSEL3(b) 28268de959fSMauro Carvalho Chehab #define _MUXSEL1(a, b...) 0##a << 2 | _MUXSEL2(b) 28368de959fSMauro Carvalho Chehab #define MUXSEL(a, b...) (a | _MUXSEL1(b)) 28468de959fSMauro Carvalho Chehab 28568de959fSMauro Carvalho Chehab /* identification / initialization of the card */ 28668de959fSMauro Carvalho Chehab extern void bttv_idcard(struct bttv *btv); 28768de959fSMauro Carvalho Chehab extern void bttv_init_card1(struct bttv *btv); 28868de959fSMauro Carvalho Chehab extern void bttv_init_card2(struct bttv *btv); 28968de959fSMauro Carvalho Chehab extern void bttv_init_tuner(struct bttv *btv); 29068de959fSMauro Carvalho Chehab 29116790554SMauro Carvalho Chehab /* card-specific functions */ 29268de959fSMauro Carvalho Chehab extern u32 bttv_tda9880_setnorm(struct bttv *btv, u32 gpiobits); 29368de959fSMauro Carvalho Chehab 29468de959fSMauro Carvalho Chehab /* extra tweaks for some chipsets */ 29568de959fSMauro Carvalho Chehab extern void bttv_check_chipset(void); 29668de959fSMauro Carvalho Chehab extern int bttv_handle_chipset(struct bttv *btv); 29768de959fSMauro Carvalho Chehab 29868de959fSMauro Carvalho Chehab /* ---------------------------------------------------------- */ 29968de959fSMauro Carvalho Chehab /* exported by bttv-if.c */ 30068de959fSMauro Carvalho Chehab 30168de959fSMauro Carvalho Chehab /* this obsolete -- please use the sysfs-based 30268de959fSMauro Carvalho Chehab interface below for new code */ 30368de959fSMauro Carvalho Chehab 30468de959fSMauro Carvalho Chehab extern struct pci_dev* bttv_get_pcidev(unsigned int card); 30568de959fSMauro Carvalho Chehab 30668de959fSMauro Carvalho Chehab /* sets GPOE register (BT848_GPIO_OUT_EN) to new value: 30768de959fSMauro Carvalho Chehab data | (current_GPOE_value & ~mask) 30868de959fSMauro Carvalho Chehab returns negative value if error occurred 30968de959fSMauro Carvalho Chehab */ 31068de959fSMauro Carvalho Chehab extern int bttv_gpio_enable(unsigned int card, 31168de959fSMauro Carvalho Chehab unsigned long mask, unsigned long data); 31268de959fSMauro Carvalho Chehab 31368de959fSMauro Carvalho Chehab /* fills data with GPDATA register contents 31468de959fSMauro Carvalho Chehab returns negative value if error occurred 31568de959fSMauro Carvalho Chehab */ 31668de959fSMauro Carvalho Chehab extern int bttv_read_gpio(unsigned int card, unsigned long *data); 31768de959fSMauro Carvalho Chehab 31868de959fSMauro Carvalho Chehab /* sets GPDATA register to new value: 31968de959fSMauro Carvalho Chehab (data & mask) | (current_GPDATA_value & ~mask) 32068de959fSMauro Carvalho Chehab returns negative value if error occurred 32168de959fSMauro Carvalho Chehab */ 32268de959fSMauro Carvalho Chehab extern int bttv_write_gpio(unsigned int card, 32368de959fSMauro Carvalho Chehab unsigned long mask, unsigned long data); 32468de959fSMauro Carvalho Chehab 32568de959fSMauro Carvalho Chehab 32668de959fSMauro Carvalho Chehab 32768de959fSMauro Carvalho Chehab 32868de959fSMauro Carvalho Chehab /* ---------------------------------------------------------- */ 32968de959fSMauro Carvalho Chehab /* sysfs/driver-moded based gpio access interface */ 33068de959fSMauro Carvalho Chehab 33168de959fSMauro Carvalho Chehab struct bttv_sub_device { 33268de959fSMauro Carvalho Chehab struct device dev; 33368de959fSMauro Carvalho Chehab struct bttv_core *core; 33468de959fSMauro Carvalho Chehab struct list_head list; 33568de959fSMauro Carvalho Chehab }; 33668de959fSMauro Carvalho Chehab #define to_bttv_sub_dev(x) container_of((x), struct bttv_sub_device, dev) 33768de959fSMauro Carvalho Chehab 33868de959fSMauro Carvalho Chehab struct bttv_sub_driver { 33968de959fSMauro Carvalho Chehab struct device_driver drv; 34068de959fSMauro Carvalho Chehab char wanted[20]; 34168de959fSMauro Carvalho Chehab int (*probe)(struct bttv_sub_device *sub); 34268de959fSMauro Carvalho Chehab void (*remove)(struct bttv_sub_device *sub); 34368de959fSMauro Carvalho Chehab }; 344*d69d8048SGreg Kroah-Hartman #define to_bttv_sub_drv(x) container_of_const((x), struct bttv_sub_driver, drv) 34568de959fSMauro Carvalho Chehab 34668de959fSMauro Carvalho Chehab int bttv_sub_register(struct bttv_sub_driver *drv, char *wanted); 34768de959fSMauro Carvalho Chehab int bttv_sub_unregister(struct bttv_sub_driver *drv); 34868de959fSMauro Carvalho Chehab 34968de959fSMauro Carvalho Chehab /* gpio access functions */ 35068de959fSMauro Carvalho Chehab void bttv_gpio_inout(struct bttv_core *core, u32 mask, u32 outbits); 35168de959fSMauro Carvalho Chehab u32 bttv_gpio_read(struct bttv_core *core); 35268de959fSMauro Carvalho Chehab void bttv_gpio_write(struct bttv_core *core, u32 value); 35368de959fSMauro Carvalho Chehab void bttv_gpio_bits(struct bttv_core *core, u32 mask, u32 bits); 35468de959fSMauro Carvalho Chehab 35568de959fSMauro Carvalho Chehab #define gpio_inout(mask,bits) bttv_gpio_inout(&btv->c, mask, bits) 35668de959fSMauro Carvalho Chehab #define gpio_read() bttv_gpio_read(&btv->c) 35768de959fSMauro Carvalho Chehab #define gpio_write(value) bttv_gpio_write(&btv->c, value) 35868de959fSMauro Carvalho Chehab #define gpio_bits(mask,bits) bttv_gpio_bits(&btv->c, mask, bits) 35968de959fSMauro Carvalho Chehab 36068de959fSMauro Carvalho Chehab 36168de959fSMauro Carvalho Chehab /* ---------------------------------------------------------- */ 36268de959fSMauro Carvalho Chehab /* i2c */ 36368de959fSMauro Carvalho Chehab 36468de959fSMauro Carvalho Chehab #define bttv_call_all(btv, o, f, args...) \ 36568de959fSMauro Carvalho Chehab v4l2_device_call_all(&btv->c.v4l2_dev, 0, o, f, ##args) 36668de959fSMauro Carvalho Chehab 3671b9e94dcSHans Verkuil #define bttv_call_all_err(btv, o, f, args...) \ 3681b9e94dcSHans Verkuil v4l2_device_call_until_err(&btv->c.v4l2_dev, 0, o, f, ##args) 3691b9e94dcSHans Verkuil 37068de959fSMauro Carvalho Chehab extern int bttv_I2CRead(struct bttv *btv, unsigned char addr, char *probe_for); 37168de959fSMauro Carvalho Chehab extern int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1, 37268de959fSMauro Carvalho Chehab unsigned char b2, int both); 37368de959fSMauro Carvalho Chehab extern void bttv_readee(struct bttv *btv, unsigned char *eedata, int addr); 37468de959fSMauro Carvalho Chehab 37568de959fSMauro Carvalho Chehab extern int bttv_input_init(struct bttv *dev); 37668de959fSMauro Carvalho Chehab extern void bttv_input_fini(struct bttv *dev); 37768de959fSMauro Carvalho Chehab extern void bttv_input_irq(struct bttv *dev); 37868de959fSMauro Carvalho Chehab 37968de959fSMauro Carvalho Chehab #endif /* _BTTV_H_ */ 380