bttv-cards.c 149.2 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8
/*

    bttv-cards.c

    this file has configuration informations - card-specific stuff
    like the big tvcards array for the most part

    Copyright (C) 1996,97,98 Ralph  Metzler (rjkm@thp.uni-koeln.de)
9
			   & Marcus Metzler (mocm@thp.uni-koeln.de)
L
Linus Torvalds 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#include <linux/delay.h>
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/vmalloc.h>
#include <linux/firmware.h>
35
#include <net/checksum.h>
L
Linus Torvalds 已提交
36 37 38 39

#include <asm/io.h>

#include "bttvp.h"
40
#include <media/v4l2-common.h>
41
#include <media/tvaudio.h>
L
Linus Torvalds 已提交
42 43 44 45 46 47

/* fwd decl */
static void boot_msp34xx(struct bttv *btv, int pin);
static void boot_bt832(struct bttv *btv);
static void hauppauge_eeprom(struct bttv *btv);
static void avermedia_eeprom(struct bttv *btv);
48
static void osprey_eeprom(struct bttv *btv, const u8 ee[256]);
L
Linus Torvalds 已提交
49 50
static void modtec_eeprom(struct bttv *btv);
static void init_PXC200(struct bttv *btv);
51
static void init_RTV24(struct bttv *btv);
L
Linus Torvalds 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94

static void winview_audio(struct bttv *btv, struct video_audio *v, int set);
static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set);
static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v,
				    int set);
static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v,
				      int set);
static void terratv_audio(struct bttv *btv, struct video_audio *v, int set);
static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set);
static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set);
static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set);
static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set);
static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set);
static void windvr_audio(struct bttv *btv, struct video_audio *v, int set);
static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set);
static void rv605_muxsel(struct bttv *btv, unsigned int input);
static void eagle_muxsel(struct bttv *btv, unsigned int input);
static void xguard_muxsel(struct bttv *btv, unsigned int input);
static void ivc120_muxsel(struct bttv *btv, unsigned int input);
static void gvc1100_muxsel(struct bttv *btv, unsigned int input);

static void PXC200_muxsel(struct bttv *btv, unsigned int input);

static void picolo_tetra_muxsel(struct bttv *btv, unsigned int input);
static void picolo_tetra_init(struct bttv *btv);

static void tibetCS16_muxsel(struct bttv *btv, unsigned int input);
static void tibetCS16_init(struct bttv *btv);

static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input);
static void kodicom4400r_init(struct bttv *btv);

static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);

static int terratec_active_radio_upgrade(struct bttv *btv);
static int tea5757_read(struct bttv *btv);
static int tea5757_write(struct bttv *btv, int value);
static void identify_by_eeprom(struct bttv *btv,
			       unsigned char eeprom_data[256]);
static int __devinit pvr_boot(struct bttv *btv);

/* config variables */
95 96
static unsigned int triton1;
static unsigned int vsfx;
L
Linus Torvalds 已提交
97
static unsigned int latency = UNSET;
98
int no_overlay=-1;
L
Linus Torvalds 已提交
99 100 101 102 103 104 105 106 107 108

static unsigned int card[BTTV_MAX]   = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int pll[BTTV_MAX]    = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int tuner[BTTV_MAX]  = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int svhs[BTTV_MAX]   = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
static struct bttv  *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL };
#ifdef MODULE
static unsigned int autoload = 1;
#else
109
static unsigned int autoload;
L
Linus Torvalds 已提交
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
#endif
static unsigned int gpiomask = UNSET;
static unsigned int audioall = UNSET;
static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };

/* insmod options */
module_param(triton1,    int, 0444);
module_param(vsfx,       int, 0444);
module_param(no_overlay, int, 0444);
module_param(latency,    int, 0444);
module_param(gpiomask,   int, 0444);
module_param(audioall,   int, 0444);
module_param(autoload,   int, 0444);

module_param_array(card,     int, NULL, 0444);
module_param_array(pll,      int, NULL, 0444);
module_param_array(tuner,    int, NULL, 0444);
module_param_array(svhs,     int, NULL, 0444);
module_param_array(remote,   int, NULL, 0444);
module_param_array(audiomux, int, NULL, 0444);

MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
		 "[enable bug compatibility for triton1 + others]");
MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
		 "[yet another chipset flaw workaround]");
MODULE_PARM_DESC(latency,"pci latency timer");
MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
MODULE_PARM_DESC(tuner,"specify installed tuner type");
MODULE_PARM_DESC(autoload,"automatically load i2c modules like tuner.o, default is 1 (yes)");
140 141
MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)"
		" [some VIA/SIS chipsets are known to have problem with overlay]");
L
Linus Torvalds 已提交
142 143 144 145 146 147 148 149 150

/* ----------------------------------------------------------------------- */
/* list of card IDs for bt878+ cards                                       */

static struct CARD {
	unsigned id;
	int cardnr;
	char *name;
} cards[] __devinitdata = {
151 152 153 154 155 156 157 158
	{ 0x13eb0070, BTTV_BOARD_HAUPPAUGE878,  "Hauppauge WinTV" },
	{ 0x39000070, BTTV_BOARD_HAUPPAUGE878,  "Hauppauge WinTV-D" },
	{ 0x45000070, BTTV_BOARD_HAUPPAUGEPVR,  "Hauppauge WinTV/PVR" },
	{ 0xff000070, BTTV_BOARD_OSPREY1x0,     "Osprey-100" },
	{ 0xff010070, BTTV_BOARD_OSPREY2x0_SVID,"Osprey-200" },
	{ 0xff020070, BTTV_BOARD_OSPREY500,     "Osprey-500" },
	{ 0xff030070, BTTV_BOARD_OSPREY2000,    "Osprey-2000" },
	{ 0xff040070, BTTV_BOARD_OSPREY540,     "Osprey-540" },
159
	{ 0xff070070, BTTV_BOARD_OSPREY440,     "Osprey-440" },
160 161 162 163 164 165 166 167 168

	{ 0x00011002, BTTV_BOARD_ATI_TVWONDER,  "ATI TV Wonder" },
	{ 0x00031002, BTTV_BOARD_ATI_TVWONDERVE,"ATI TV Wonder/VE" },

	{ 0x6606107d, BTTV_BOARD_WINFAST2000,   "Leadtek WinFast TV 2000" },
	{ 0x6607107d, BTTV_BOARD_WINFASTVC100,  "Leadtek WinFast VC 100" },
	{ 0x6609107d, BTTV_BOARD_WINFAST2000,   "Leadtek TV 2000 XP" },
	{ 0x263610b4, BTTV_BOARD_STB2,          "STB TV PCI FM, Gateway P/N 6000704" },
	{ 0x264510b4, BTTV_BOARD_STB2,          "STB TV PCI FM, Gateway P/N 6000704" },
169
	{ 0x402010fc, BTTV_BOARD_GVBCTV3PCI,    "I-O Data Co. GV-BCTV3/PCI" },
170 171
	{ 0x405010fc, BTTV_BOARD_GVBCTV4PCI,    "I-O Data Co. GV-BCTV4/PCI" },
	{ 0x407010fc, BTTV_BOARD_GVBCTV5PCI,    "I-O Data Co. GV-BCTV5/PCI" },
172
	{ 0xd01810fc, BTTV_BOARD_GVBCTV5PCI,    "I-O Data Co. GV-BCTV5/PCI" },
173 174

	{ 0x001211bd, BTTV_BOARD_PINNACLE,      "Pinnacle PCTV" },
175
	/* some cards ship with byteswapped IDs ... */
176 177
	{ 0x1200bd11, BTTV_BOARD_PINNACLE,      "Pinnacle PCTV [bswap]" },
	{ 0xff00bd11, BTTV_BOARD_PINNACLE,      "Pinnacle PCTV [bswap]" },
178
	/* this seems to happen as well ... */
179 180
	{ 0xff1211bd, BTTV_BOARD_PINNACLE,      "Pinnacle PCTV" },

181 182
	{ 0x3000121a, BTTV_BOARD_VOODOOTV_200,  "3Dfx VoodooTV 200" },
	{ 0x263710b4, BTTV_BOARD_VOODOOTV_FM,   "3Dfx VoodooTV FM" },
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
	{ 0x3060121a, BTTV_BOARD_STB2,	  "3Dfx VoodooTV 100/ STB OEM" },

	{ 0x3000144f, BTTV_BOARD_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
	{ 0xa005144f, BTTV_BOARD_MAGICTVIEW063, "CPH06X TView99-Card" },
	{ 0x3002144f, BTTV_BOARD_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
	{ 0x3005144f, BTTV_BOARD_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
	{ 0x5000144f, BTTV_BOARD_MAGICTVIEW061, "Askey CPH050" },
	{ 0x300014ff, BTTV_BOARD_MAGICTVIEW061, "TView 99 (CPH061)" },
	{ 0x300214ff, BTTV_BOARD_PHOEBE_TVMAS,  "Phoebe TV Master (CPH060)" },

	{ 0x00011461, BTTV_BOARD_AVPHONE98,     "AVerMedia TVPhone98" },
	{ 0x00021461, BTTV_BOARD_AVERMEDIA98,   "AVermedia TVCapture 98" },
	{ 0x00031461, BTTV_BOARD_AVPHONE98,     "AVerMedia TVPhone98" },
	{ 0x00041461, BTTV_BOARD_AVERMEDIA98,   "AVerMedia TVCapture 98" },
	{ 0x03001461, BTTV_BOARD_AVERMEDIA98,   "VDOMATE TV TUNER CARD" },

	{ 0x1117153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (Philips PAL B/G)" },
	{ 0x1118153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (Temic PAL B/G)" },
	{ 0x1119153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (Philips PAL I)" },
	{ 0x111a153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (Temic PAL I)" },

	{ 0x1123153b, BTTV_BOARD_TERRATVRADIO,  "Terratec TV Radio+" },
	{ 0x1127153b, BTTV_BOARD_TERRATV,       "Terratec TV+ (V1.05)"    },
206
	/* clashes with FlyVideo
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
	 *{ 0x18521852, BTTV_BOARD_TERRATV,     "Terratec TV+ (V1.10)"    }, */
	{ 0x1134153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (LR102)" },
	{ 0x1135153b, BTTV_BOARD_TERRATVALUER,  "Terratec TValue Radio" }, /* LR102 */
	{ 0x5018153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue" },       /* ?? */
	{ 0xff3b153b, BTTV_BOARD_TERRATVALUER,  "Terratec TValue Radio" }, /* ?? */

	{ 0x400015b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
	{ 0x400a15b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
	{ 0x400d15b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
	{ 0x401015b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
	{ 0x401615b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },

	{ 0x1430aa00, BTTV_BOARD_PV143,         "Provideo PV143A" },
	{ 0x1431aa00, BTTV_BOARD_PV143,         "Provideo PV143B" },
	{ 0x1432aa00, BTTV_BOARD_PV143,         "Provideo PV143C" },
	{ 0x1433aa00, BTTV_BOARD_PV143,         "Provideo PV143D" },
	{ 0x1433aa03, BTTV_BOARD_PV143,         "Security Eyes" },

	{ 0x1460aa00, BTTV_BOARD_PV150,         "Provideo PV150A-1" },
	{ 0x1461aa01, BTTV_BOARD_PV150,         "Provideo PV150A-2" },
	{ 0x1462aa02, BTTV_BOARD_PV150,         "Provideo PV150A-3" },
	{ 0x1463aa03, BTTV_BOARD_PV150,         "Provideo PV150A-4" },

	{ 0x1464aa04, BTTV_BOARD_PV150,         "Provideo PV150B-1" },
	{ 0x1465aa05, BTTV_BOARD_PV150,         "Provideo PV150B-2" },
	{ 0x1466aa06, BTTV_BOARD_PV150,         "Provideo PV150B-3" },
	{ 0x1467aa07, BTTV_BOARD_PV150,         "Provideo PV150B-4" },

	{ 0xa132ff00, BTTV_BOARD_IVC100,        "IVC-100"  },
	{ 0xa1550000, BTTV_BOARD_IVC200,        "IVC-200"  },
	{ 0xa1550001, BTTV_BOARD_IVC200,        "IVC-200"  },
	{ 0xa1550002, BTTV_BOARD_IVC200,        "IVC-200"  },
	{ 0xa1550003, BTTV_BOARD_IVC200,        "IVC-200"  },
	{ 0xa1550100, BTTV_BOARD_IVC200,        "IVC-200G" },
	{ 0xa1550101, BTTV_BOARD_IVC200,        "IVC-200G" },
	{ 0xa1550102, BTTV_BOARD_IVC200,        "IVC-200G" },
	{ 0xa1550103, BTTV_BOARD_IVC200,        "IVC-200G" },
	{ 0xa182ff00, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff01, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff02, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff03, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff04, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff05, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff06, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff07, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff08, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff09, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff0a, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff0b, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff0c, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff0d, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff0e, BTTV_BOARD_IVC120,        "IVC-120G" },
	{ 0xa182ff0f, BTTV_BOARD_IVC120,        "IVC-120G" },

	{ 0x41424344, BTTV_BOARD_GRANDTEC,      "GrandTec Multi Capture" },
	{ 0x01020304, BTTV_BOARD_XGUARD,        "Grandtec Grand X-Guard" },

	{ 0x18501851, BTTV_BOARD_CHRONOS_VS2,   "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
	{ 0xa0501851, BTTV_BOARD_CHRONOS_VS2,   "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
	{ 0x18511851, BTTV_BOARD_FLYVIDEO98EZ,  "FlyVideo 98EZ (LR51)/ CyberMail AV" },
	{ 0x18521852, BTTV_BOARD_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
	{ 0x41a0a051, BTTV_BOARD_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
	{ 0x18501f7f, BTTV_BOARD_FLYVIDEO_98,   "Lifeview Flyvideo 98" },

271
	{ 0x010115cb, BTTV_BOARD_GMV1,          "AG GMV1" },
272 273 274 275 276 277 278 279 280 281
	{ 0x010114c7, BTTV_BOARD_MODTEC_205,    "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },

	{ 0x10b42636, BTTV_BOARD_HAUPPAUGE878,  "STB ???" },
	{ 0x217d6606, BTTV_BOARD_WINFAST2000,   "Leadtek WinFast TV 2000" },
	{ 0xfff6f6ff, BTTV_BOARD_WINFAST2000,   "Leadtek WinFast TV 2000" },
	{ 0x03116000, BTTV_BOARD_SENSORAY311,   "Sensoray 311" },
	{ 0x00790e11, BTTV_BOARD_WINDVR,        "Canopus WinDVR PCI" },
	{ 0xa0fca1a0, BTTV_BOARD_ZOLTRIX,       "Face to Face Tvmax" },
	{ 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, "SIMUS GVC1100" },
	{ 0x146caa0c, BTTV_BOARD_PV951,         "ituner spectra8" },
282
	{ 0x200a1295, BTTV_BOARD_PXC200,        "ImageNation PXC200A" },
283 284 285 286 287 288 289 290 291 292

	{ 0x40111554, BTTV_BOARD_PV_BT878P_9B,  "Prolink Pixelview PV-BT" },
	{ 0x17de0a01, BTTV_BOARD_KWORLD,        "Mecer TV/FM/Video Tuner" },

	{ 0x01051805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" },
	{ 0x01061805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" },
	{ 0x01071805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" },
	{ 0x01081805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" },

	{ 0x15409511, BTTV_BOARD_ACORP_Y878F, "Acorp Y878F" },
L
Linus Torvalds 已提交
293

294 295 296
	{ 0x53534149, BTTV_BOARD_SSAI_SECURITY, "SSAI Security Video Interface" },
	{ 0x5353414a, BTTV_BOARD_SSAI_ULTRASOUND, "SSAI Ultrasound Video Interface" },

297
	/* likely broken, vendor id doesn't match the other magic views ...
298
	 * { 0xa0fca04f, BTTV_BOARD_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, */
299

300 301 302
	/* Duplicate PCI ID, reconfigure for this board during the eeprom read.
	* { 0x13eb0070, BTTV_BOARD_HAUPPAUGE_IMPACTVCB,  "Hauppauge ImpactVCB" }, */

303
	/* DVB cards (using pci function .1 for mpeg data xfer) */
304
	{ 0x001c11bd, BTTV_BOARD_PINNACLESAT,   "Pinnacle PCTV Sat" },
305 306
	{ 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
	{ 0x20007063, BTTV_BOARD_PC_HDTV,       "pcHDTV HD-2000 TV"},
307 308 309 310
	{ 0x002611bd, BTTV_BOARD_TWINHAN_DST,   "Pinnacle PCTV SAT CI" },
	{ 0x00011822, BTTV_BOARD_TWINHAN_DST,   "Twinhan VisionPlus DVB" },
	{ 0xfc00270f, BTTV_BOARD_TWINHAN_DST,   "ChainTech digitop DST-1000 DVB-S" },
	{ 0x07711461, BTTV_BOARD_AVDVBT_771,    "AVermedia AverTV DVB-T 771" },
311
	{ 0x07611461, BTTV_BOARD_AVDVBT_761,    "AverMedia AverTV DVB-T 761" },
312
	{ 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE,    "DViCO FusionHDTV DVB-T Lite" },
313
	{ 0xdb1118ac, BTTV_BOARD_DVICO_DVBT_LITE,    "Ultraview DVB-T Lite" },
314
	{ 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE,    "DViCO FusionHDTV 5 Lite" },
315
	{ 0x00261822, BTTV_BOARD_TWINHAN_DST,	"DNTV Live! Mini "},
316
	{ 0xd200dbc0, BTTV_BOARD_DVICO_FUSIONHDTV_2,	"DViCO FusionHDTV 2" },
L
Linus Torvalds 已提交
317 318 319 320 321 322 323 324

	{ 0, -1, NULL }
};

/* ----------------------------------------------------------------------- */
/* array with description for bt848 / bt878 tv/grabber cards               */

struct tvcard bttv_tvcards[] = {
325
	/* ---- card 0x00 ---------------------------------- */
326
	[BTTV_BOARD_UNKNOWN] = {
327 328 329 330 331
		.name		= " *** UNKNOWN/GENERIC *** ",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
M
 
Michael Krufky 已提交
332
		.muxsel		= { 2, 3, 1, 0 },
333
		.tuner_type	= UNSET,
334
		.tuner_addr	= ADDR_UNSET,
335
		.radio_addr     = ADDR_UNSET,
336
	},
337
	[BTTV_BOARD_MIRO] = {
338 339 340 341 342 343
		.name		= "MIRO PCTV",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 15,
M
 
Michael Krufky 已提交
344
		.muxsel		= { 2, 3, 1, 1 },
345 346
		.gpiomux 	= { 2, 0, 0, 0 },
		.gpiomute 	= 10,
347
		.needs_tvaudio	= 1,
348
		.tuner_type	= UNSET,
349
		.tuner_addr	= ADDR_UNSET,
350
		.radio_addr     = ADDR_UNSET,
351
	},
352
	[BTTV_BOARD_HAUPPAUGE] = {
353 354 355 356 357 358
		.name		= "Hauppauge (bt848)",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 7,
M
 
Michael Krufky 已提交
359
		.muxsel		= { 2, 3, 1, 1 },
360 361
		.gpiomux 	= { 0, 1, 2, 3 },
		.gpiomute 	= 4,
362
		.needs_tvaudio	= 1,
363
		.tuner_type	= UNSET,
364
		.tuner_addr	= ADDR_UNSET,
365
		.radio_addr     = ADDR_UNSET,
366
	},
367
	[BTTV_BOARD_STB] = {
368 369 370 371 372 373
		.name		= "STB, Gateway P/N 6000699 (bt848)",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 7,
M
 
Michael Krufky 已提交
374
		.muxsel		= { 2, 3, 1, 1 },
375 376
		.gpiomux 	= { 4, 0, 2, 3 },
		.gpiomute 	= 1,
377 378 379 380
		.no_msp34xx	= 1,
		.needs_tvaudio	= 1,
		.tuner_type     = TUNER_PHILIPS_NTSC,
		.tuner_addr	= ADDR_UNSET,
381
		.radio_addr     = ADDR_UNSET,
382 383 384 385 386
		.pll            = PLL_28,
		.has_radio      = 1,
	},

	/* ---- card 0x04 ---------------------------------- */
387
	[BTTV_BOARD_INTEL] = {
388 389 390
		.name		= "Intel Create and Share PCI/ Smart Video Recorder III",
		.video_inputs	= 4,
		.audio_inputs	= 0,
391
		.tuner		= UNSET,
392 393
		.svhs		= 2,
		.gpiomask	= 0,
M
 
Michael Krufky 已提交
394
		.muxsel		= { 2, 3, 1, 1 },
395
		.gpiomux 	= { 0 },
396
		.needs_tvaudio	= 0,
397
		.tuner_type	= TUNER_ABSENT,
398
		.tuner_addr	= ADDR_UNSET,
399
		.radio_addr     = ADDR_UNSET,
400
	},
401
	[BTTV_BOARD_DIAMOND] = {
402 403 404 405 406 407
		.name		= "Diamond DTV2000",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 3,
M
 
Michael Krufky 已提交
408
		.muxsel		= { 2, 3, 1, 0 },
409 410
		.gpiomux 	= { 0, 1, 0, 1 },
		.gpiomute 	= 3,
411
		.needs_tvaudio	= 1,
412
		.tuner_type	= UNSET,
413
		.tuner_addr	= ADDR_UNSET,
414
		.radio_addr     = ADDR_UNSET,
415
	},
416
	[BTTV_BOARD_AVERMEDIA] = {
417 418 419 420 421
		.name		= "AVerMedia TVPhone",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 3,
M
 
Michael Krufky 已提交
422
		.muxsel		= { 2, 3, 1, 1 },
423
		.gpiomask	= 0x0f,
424
		.gpiomux 	= { 0x0c, 0x04, 0x08, 0x04 },
425 426
		/*                0x04 for some cards ?? */
		.needs_tvaudio	= 1,
427
		.tuner_type	= UNSET,
428
		.tuner_addr	= ADDR_UNSET,
429
		.radio_addr     = ADDR_UNSET,
430 431 432
		.audio_hook	= avermedia_tvphone_audio,
		.has_remote     = 1,
	},
433
	[BTTV_BOARD_MATRIX_VISION] = {
434 435 436
		.name		= "MATRIX-Vision MV-Delta",
		.video_inputs	= 5,
		.audio_inputs	= 1,
437
		.tuner		= UNSET,
438 439
		.svhs		= 3,
		.gpiomask	= 0,
M
 
Michael Krufky 已提交
440
		.muxsel		= { 2, 3, 1, 0, 0 },
441
		.gpiomux 	= { 0 },
442
		.needs_tvaudio	= 1,
443
		.tuner_type	= UNSET,
444
		.tuner_addr	= ADDR_UNSET,
445
		.radio_addr     = ADDR_UNSET,
446 447 448
	},

	/* ---- card 0x08 ---------------------------------- */
449
	[BTTV_BOARD_FLYVIDEO] = {
450 451 452 453 454 455
		.name		= "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xc00,
M
 
Michael Krufky 已提交
456
		.muxsel		= { 2, 3, 1, 1 },
457 458
		.gpiomux 	= { 0, 0xc00, 0x800, 0x400 },
		.gpiomute 	= 0xc00,
459 460
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
461
		.tuner_type	= UNSET,
462
		.tuner_addr	= ADDR_UNSET,
463
		.radio_addr     = ADDR_UNSET,
464
	},
465
	[BTTV_BOARD_TURBOTV] = {
466 467 468 469 470 471
		.name		= "IMS/IXmicro TurboTV",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 3,
M
 
Michael Krufky 已提交
472
		.muxsel		= { 2, 3, 1, 1 },
473
		.gpiomux 	= { 1, 1, 2, 3 },
474 475 476 477
		.needs_tvaudio	= 0,
		.pll		= PLL_28,
		.tuner_type	= TUNER_TEMIC_PAL,
		.tuner_addr	= ADDR_UNSET,
478
		.radio_addr     = ADDR_UNSET,
479
	},
480
	[BTTV_BOARD_HAUPPAUGE878] = {
481 482 483 484 485 486
		.name		= "Hauppauge (bt878)",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x0f, /* old: 7 */
M
 
Michael Krufky 已提交
487
		.muxsel		= { 2, 0, 1, 1 },
488 489
		.gpiomux 	= { 0, 1, 2, 3 },
		.gpiomute 	= 4,
490 491
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
492
		.tuner_type	= UNSET,
493
		.tuner_addr	= ADDR_UNSET,
494
		.radio_addr     = ADDR_UNSET,
495
	},
496
	[BTTV_BOARD_MIROPRO] = {
497 498 499 500 501 502
		.name		= "MIRO PCTV pro",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x3014f,
M
 
Michael Krufky 已提交
503
		.muxsel		= { 2, 3, 1, 1 },
504 505
		.gpiomux 	= { 0x20001,0x10001, 0, 0 },
		.gpiomute 	= 10,
506
		.needs_tvaudio	= 1,
507
		.tuner_type	= UNSET,
508
		.tuner_addr	= ADDR_UNSET,
509
		.radio_addr     = ADDR_UNSET,
510 511 512
	},

	/* ---- card 0x0c ---------------------------------- */
513
	[BTTV_BOARD_ADSTECH_TV] = {
514 515 516 517 518 519
		.name		= "ADS Technologies Channel Surfer TV (bt848)",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 15,
M
 
Michael Krufky 已提交
520
		.muxsel		= { 2, 3, 1, 1 },
521
		.gpiomux 	= { 13, 14, 11, 7 },
522
		.needs_tvaudio	= 1,
523
		.tuner_type	= UNSET,
524
		.tuner_addr	= ADDR_UNSET,
525
		.radio_addr     = ADDR_UNSET,
526
	},
527
	[BTTV_BOARD_AVERMEDIA98] = {
528 529 530 531 532 533
		.name		= "AVerMedia TVCapture 98",
		.video_inputs	= 3,
		.audio_inputs	= 4,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 15,
M
 
Michael Krufky 已提交
534
		.muxsel		= { 2, 3, 1, 1 },
535
		.gpiomux 	= { 13, 14, 11, 7 },
536 537 538 539 540
		.needs_tvaudio	= 1,
		.msp34xx_alt    = 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
541
		.radio_addr     = ADDR_UNSET,
542
		.audio_hook     = avermedia_tv_stereo_audio,
543
		.no_gpioirq     = 1,
544
	},
545
	[BTTV_BOARD_VHX] = {
546 547 548 549 550 551
		.name		= "Aimslab Video Highway Xtreme (VHX)",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 7,
M
 
Michael Krufky 已提交
552
		.muxsel		= { 2, 3, 1, 1 },
553 554
		.gpiomux 	= { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */
		.gpiomute 	= 4,
555 556
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
557
		.tuner_type	= UNSET,
558
		.tuner_addr	= ADDR_UNSET,
559
		.radio_addr     = ADDR_UNSET,
560
	},
561
	[BTTV_BOARD_ZOLTRIX] = {
562 563 564 565 566 567
		.name		= "Zoltrix TV-Max",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 15,
M
 
Michael Krufky 已提交
568
		.muxsel		= { 2, 3, 1, 1 },
569 570
		.gpiomux 	= { 0, 0, 1, 0 },
		.gpiomute 	= 10,
571
		.needs_tvaudio	= 1,
572
		.tuner_type	= UNSET,
573
		.tuner_addr	= ADDR_UNSET,
574
		.radio_addr     = ADDR_UNSET,
575 576 577
	},

	/* ---- card 0x10 ---------------------------------- */
578
	[BTTV_BOARD_PIXVIEWPLAYTV] = {
579 580 581 582 583 584
		.name		= "Prolink Pixelview PlayTV (bt878)",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x01fe00,
M
 
Michael Krufky 已提交
585
		.muxsel		= { 2, 3, 1, 1 },
586
		/* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */
587 588
		.gpiomux        = { 0x001e00, 0, 0x018000, 0x014000 },
		.gpiomute 	= 0x002000,
589 590
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
591
		.tuner_type	= UNSET,
592
	},
593
	[BTTV_BOARD_WINVIEW_601] = {
594 595 596 597 598 599
		.name		= "Leadtek WinView 601",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x8300f8,
M
 
Michael Krufky 已提交
600
		.muxsel		= { 2, 3, 1, 1,0 },
601 602
		.gpiomux 	= { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 },
		.gpiomute 	= 0xcfa007,
603
		.needs_tvaudio	= 1,
604
		.tuner_type	= UNSET,
605
		.tuner_addr	= ADDR_UNSET,
606
		.radio_addr     = ADDR_UNSET,
607 608 609
		.audio_hook	= winview_audio,
		.has_radio	= 1,
	},
610
	[BTTV_BOARD_AVEC_INTERCAP] = {
611 612 613 614 615 616
		.name		= "AVEC Intercapture",
		.video_inputs	= 3,
		.audio_inputs	= 2,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0,
M
 
Michael Krufky 已提交
617
		.muxsel		= { 2, 3, 1, 1 },
618
		.gpiomux 	= { 1, 0, 0, 0 },
619
		.needs_tvaudio	= 1,
620
		.tuner_type	= UNSET,
621
		.tuner_addr	= ADDR_UNSET,
622
		.radio_addr     = ADDR_UNSET,
623
	},
624
	[BTTV_BOARD_LIFE_FLYKIT] = {
625 626 627
		.name		= "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
		.video_inputs	= 4,
		.audio_inputs	= 1,
628 629
		.tuner		= UNSET,
		.svhs		= UNSET,
630
		.gpiomask	= 0x8dff00,
M
 
Michael Krufky 已提交
631
		.muxsel		= { 2, 3, 1, 1 },
632
		.gpiomux 	= { 0 },
633
		.no_msp34xx	= 1,
634
		.tuner_type	= UNSET,
635
		.tuner_addr	= ADDR_UNSET,
636
		.radio_addr     = ADDR_UNSET,
637 638 639
	},

	/* ---- card 0x14 ---------------------------------- */
640
	[BTTV_BOARD_CEI_RAFFLES] = {
641 642 643 644 645
		.name		= "CEI Raffles Card",
		.video_inputs	= 3,
		.audio_inputs	= 3,
		.tuner		= 0,
		.svhs		= 2,
M
 
Michael Krufky 已提交
646
		.muxsel		= { 2, 3, 1, 1 },
647
		.tuner_type	= UNSET,
648
		.tuner_addr	= ADDR_UNSET,
649
		.radio_addr     = ADDR_UNSET,
650
	},
651
	[BTTV_BOARD_CONFERENCETV] = {
652 653 654 655 656 657
		.name		= "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
		.video_inputs	= 4,
		.audio_inputs	= 2,  /* tuner, line in */
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x1800,
M
 
Michael Krufky 已提交
658
		.muxsel		= { 2, 3, 1, 1 },
659 660
		.gpiomux 	= { 0, 0x800, 0x1000, 0x1000 },
		.gpiomute 	= 0x1800,
661 662 663
		.pll		= PLL_28,
		.tuner_type	= TUNER_PHILIPS_PAL_I,
		.tuner_addr	= ADDR_UNSET,
664
		.radio_addr     = ADDR_UNSET,
665
	},
666
	[BTTV_BOARD_PHOEBE_TVMAS] = {
667 668 669 670 671 672
		.name		= "Askey CPH050/ Phoebe Tv Master + FM",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xc00,
M
 
Michael Krufky 已提交
673
		.muxsel		= { 2, 3, 1, 1 },
674 675
		.gpiomux 	= { 0, 1, 0x800, 0x400 },
		.gpiomute 	= 0xc00,
676 677
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
678
		.tuner_type	= UNSET,
679
		.tuner_addr	= ADDR_UNSET,
680
		.radio_addr     = ADDR_UNSET,
681
	},
682
	[BTTV_BOARD_MODTEC_205] = {
683 684 685 686
		.name		= "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
687
		.svhs		= UNSET,
688 689 690
		.gpiomask	= 7,
		.muxsel		= { 2, 3, -1 },
		.digital_mode   = DIGITAL_MODE_CAMERA,
691
		.gpiomux 	= { 0, 0, 0, 0 },
692 693 694 695
		.no_msp34xx	= 1,
		.pll            = PLL_28,
		.tuner_type     = TUNER_ALPS_TSBB5_PAL_I,
		.tuner_addr	= ADDR_UNSET,
696
		.radio_addr     = ADDR_UNSET,
697 698 699
	},

	/* ---- card 0x18 ---------------------------------- */
700
	[BTTV_BOARD_MAGICTVIEW061] = {
701 702 703 704 705 706
		.name		= "Askey CPH05X/06X (bt878) [many vendors]",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xe00,
M
 
Michael Krufky 已提交
707
		.muxsel		= { 2, 3, 1, 1 },
708 709
		.gpiomux 	= {0x400, 0x400, 0x400, 0x400 },
		.gpiomute 	= 0xc00,
710 711
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
712
		.tuner_type	= UNSET,
713
		.tuner_addr	= ADDR_UNSET,
714
		.radio_addr     = ADDR_UNSET,
715 716
		.has_remote     = 1,
	},
717
	[BTTV_BOARD_VOBIS_BOOSTAR] = {
718 719 720 721 722 723
		.name           = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask       = 0x1f0fff,
M
 
Michael Krufky 已提交
724
		.muxsel		= { 2, 3, 1, 1 },
725 726
		.gpiomux        = { 0x20000, 0x30000, 0x10000, 0 },
		.gpiomute 	= 0x40000,
727 728 729
		.needs_tvaudio	= 0,
		.tuner_type	= TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
730
		.radio_addr     = ADDR_UNSET,
731 732
		.audio_hook     = terratv_audio,
	},
733
	[BTTV_BOARD_HAUPPAUG_WCAM] = {
734 735 736 737 738 739
		.name		= "Hauppauge WinCam newer (bt878)",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 3,
		.gpiomask	= 7,
M
 
Michael Krufky 已提交
740
		.muxsel		= { 2, 0, 1, 1 },
741 742
		.gpiomux 	= { 0, 1, 2, 3 },
		.gpiomute 	= 4,
743
		.needs_tvaudio	= 1,
744
		.tuner_type	= UNSET,
745
		.tuner_addr	= ADDR_UNSET,
746
		.radio_addr     = ADDR_UNSET,
747
	},
748
	[BTTV_BOARD_MAXI] = {
749 750 751 752 753 754
		.name		= "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
		.video_inputs	= 4,
		.audio_inputs	= 2,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x1800,
M
 
Michael Krufky 已提交
755
		.muxsel		= { 2, 3, 1, 1 },
756 757
		.gpiomux 	= { 0, 0x800, 0x1000, 0x1000 },
		.gpiomute 	= 0x1800,
758 759 760
		.pll            = PLL_28,
		.tuner_type	= TUNER_PHILIPS_SECAM,
		.tuner_addr	= ADDR_UNSET,
761
		.radio_addr     = ADDR_UNSET,
762 763 764
	},

	/* ---- card 0x1c ---------------------------------- */
765
	[BTTV_BOARD_TERRATV] = {
766 767 768 769 770 771
		.name           = "Terratec TerraTV+ Version 1.1 (bt878)",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x1f0fff,
M
 
Michael Krufky 已提交
772
		.muxsel		= { 2, 3, 1, 1 },
773 774
		.gpiomux 	= { 0x20000, 0x30000, 0x10000, 0x00000 },
		.gpiomute 	= 0x40000,
775 776 777
		.needs_tvaudio	= 0,
		.tuner_type	= TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
778
		.radio_addr     = ADDR_UNSET,
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808
		.audio_hook	= terratv_audio,
		/* GPIO wiring:
		External 20 pin connector (for Active Radio Upgrade board)
		gpio00: i2c-sda
		gpio01: i2c-scl
		gpio02: om5610-data
		gpio03: om5610-clk
		gpio04: om5610-wre
		gpio05: om5610-stereo
		gpio06: rds6588-davn
		gpio07: Pin 7 n.c.
		gpio08: nIOW
		gpio09+10: nIOR, nSEL ?? (bt878)
			gpio09: nIOR (bt848)
			gpio10: nSEL (bt848)
		Sound Routing:
		gpio16: u2-A0 (1st 4052bt)
		gpio17: u2-A1
		gpio18: u2-nEN
		gpio19: u4-A0 (2nd 4052)
		gpio20: u4-A1
			u4-nEN - GND
		Btspy:
			00000 : Cdrom (internal audio input)
			10000 : ext. Video audio input
			20000 : TV Mono
			a0000 : TV Mono/2
		1a0000 : TV Stereo
			30000 : Radio
			40000 : Mute
809
	*/
810 811

	},
812
	[BTTV_BOARD_PXC200] = {
813 814 815 816
		/* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
		.name		= "Imagenation PXC200",
		.video_inputs	= 5,
		.audio_inputs	= 1,
817
		.tuner		= UNSET,
818 819 820
		.svhs		= 1, /* was: 4 */
		.gpiomask	= 0,
		.muxsel		= { 2, 3, 1, 0, 0},
821
		.gpiomux 	= { 0 },
822
		.needs_tvaudio	= 1,
823
		.tuner_type	= UNSET,
824
		.tuner_addr	= ADDR_UNSET,
825
		.radio_addr     = ADDR_UNSET,
826 827 828
		.muxsel_hook    = PXC200_muxsel,

	},
829
	[BTTV_BOARD_FLYVIDEO_98] = {
830 831 832 833 834 835
		.name		= "Lifeview FlyVideo 98 LR50",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x1800,  /* 0x8dfe00 */
M
 
Michael Krufky 已提交
836
		.muxsel		= { 2, 3, 1, 1 },
837 838
		.gpiomux 	= { 0, 0x0800, 0x1000, 0x1000 },
		.gpiomute 	= 0x1800,
839
		.pll            = PLL_28,
840
		.tuner_type	= UNSET,
841
		.tuner_addr	= ADDR_UNSET,
842
		.radio_addr     = ADDR_UNSET,
843
	},
844
	[BTTV_BOARD_IPROTV] = {
845 846 847 848 849 850
		.name		= "Formac iProTV, Formac ProTV I (bt848)",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 3,
		.gpiomask	= 1,
M
 
Michael Krufky 已提交
851
		.muxsel		= { 2, 3, 1, 1 },
852
		.gpiomux 	= { 1, 0, 0, 0 },
853 854 855
		.pll            = PLL_28,
		.tuner_type	= TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
856
		.radio_addr     = ADDR_UNSET,
857 858 859
	},

	/* ---- card 0x20 ---------------------------------- */
860
	[BTTV_BOARD_INTEL_C_S_PCI] = {
861 862 863
		.name		= "Intel Create and Share PCI/ Smart Video Recorder III",
		.video_inputs	= 4,
		.audio_inputs	= 0,
864
		.tuner		= UNSET,
865 866
		.svhs		= 2,
		.gpiomask	= 0,
M
 
Michael Krufky 已提交
867
		.muxsel		= { 2, 3, 1, 1 },
868
		.gpiomux 	= { 0 },
869
		.needs_tvaudio	= 0,
870
		.tuner_type	= TUNER_ABSENT,
871
		.tuner_addr	= ADDR_UNSET,
872
		.radio_addr     = ADDR_UNSET,
873
	},
874
	[BTTV_BOARD_TERRATVALUE] = {
875 876 877 878 879 880
		.name           = "Terratec TerraTValue Version Bt878",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xffff00,
M
 
Michael Krufky 已提交
881
		.muxsel		= { 2, 3, 1, 1 },
882 883
		.gpiomux 	= { 0x500, 0, 0x300, 0x900 },
		.gpiomute 	= 0x900,
884 885 886 887
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
888
		.radio_addr     = ADDR_UNSET,
889
	},
890
	[BTTV_BOARD_WINFAST2000] = {
891 892 893 894 895
		.name		= "Leadtek WinFast 2000/ WinFast 2000 XP",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
M
 
Michael Krufky 已提交
896
		.muxsel		= { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */
897 898
		/* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
		.gpiomask	= 0xb33000,
899 900
		.gpiomux 	= { 0x122000,0x1000,0x0000,0x620000 },
		.gpiomute 	= 0x800000,
901 902 903 904 905 906 907 908 909 910 911 912 913 914
		/* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
			gpio23 -- hef4052:nEnable (0x800000)
			gpio12 -- hef4052:A1
			gpio13 -- hef4052:A0
		0x0000: external audio
		0x1000: FM
		0x2000: TV
		0x3000: n.c.
		Note: There exists another variant "Winfast 2000" with tv stereo !?
		Note: eeprom only contains FF and pci subsystem id 107d:6606
		*/
		.needs_tvaudio	= 0,
		.pll		= PLL_28,
		.has_radio	= 1,
915
		.tuner_type	= TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */
916
		.tuner_addr	= ADDR_UNSET,
917
		.radio_addr     = ADDR_UNSET,
918 919 920
		.audio_hook	= winfast2000_audio,
		.has_remote     = 1,
	},
921
	[BTTV_BOARD_CHRONOS_VS2] = {
922 923 924 925 926 927
		.name		= "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
		.video_inputs	= 4,
		.audio_inputs	= 3,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x1800,
M
 
Michael Krufky 已提交
928
		.muxsel		= { 2, 3, 1, 1 },
929 930
		.gpiomux 	= { 0, 0x800, 0x1000, 0x1000 },
		.gpiomute 	= 0x1800,
931
		.pll		= PLL_28,
932
		.tuner_type	= UNSET,
933
		.tuner_addr	= ADDR_UNSET,
934
		.radio_addr     = ADDR_UNSET,
935 936 937
	},

	/* ---- card 0x24 ---------------------------------- */
938
	[BTTV_BOARD_TYPHOON_TVIEW] = {
939 940 941 942 943 944
		.name		= "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
		.video_inputs	= 4,
		.audio_inputs	= 3,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x1800,
M
 
Michael Krufky 已提交
945
		.muxsel		= { 2, 3, 1, 1 },
946 947
		.gpiomux 	= { 0, 0x800, 0x1000, 0x1000 },
		.gpiomute 	= 0x1800,
948
		.pll		= PLL_28,
949
		.tuner_type	= UNSET,
950
		.tuner_addr	= ADDR_UNSET,
951
		.radio_addr     = ADDR_UNSET,
952 953
		.has_radio	= 1,
	},
954
	[BTTV_BOARD_PXELVWPLTVPRO] = {
955 956 957 958 959 960 961
		.name		= "Prolink PixelView PlayTV pro",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xff,
		.muxsel		= { 2, 3, 1, 1 },
962 963
		.gpiomux 	= { 0x21, 0x20, 0x24, 0x2c },
		.gpiomute 	= 0x29,
964 965
		.no_msp34xx	= 1,
		.pll		= PLL_28,
966
		.tuner_type	= UNSET,
967
		.tuner_addr	= ADDR_UNSET,
968
		.radio_addr     = ADDR_UNSET,
969
	},
970
	[BTTV_BOARD_MAGICTVIEW063] = {
971 972 973 974 975 976
		.name		= "Askey CPH06X TView99",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x551e00,
M
 
Michael Krufky 已提交
977
		.muxsel		= { 2, 3, 1, 0 },
978 979
		.gpiomux 	= { 0x551400, 0x551200, 0, 0 },
		.gpiomute 	= 0x551c00,
980 981
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
982
		.tuner_type	= TUNER_PHILIPS_PAL_I,
983
		.tuner_addr	= ADDR_UNSET,
984
		.radio_addr     = ADDR_UNSET,
985 986
		.has_remote     = 1,
	},
987
	[BTTV_BOARD_PINNACLE] = {
988 989 990 991 992 993
		.name		= "Pinnacle PCTV Studio/Rave",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x03000F,
M
 
Michael Krufky 已提交
994
		.muxsel		= { 2, 3, 1, 1 },
995 996
		.gpiomux 	= { 2, 0xd0001, 0, 0 },
		.gpiomute 	= 1,
997 998
		.needs_tvaudio	= 0,
		.pll		= PLL_28,
999
		.tuner_type	= UNSET,
1000
		.tuner_addr	= ADDR_UNSET,
1001
		.radio_addr     = ADDR_UNSET,
1002 1003 1004
	},

	/* ---- card 0x28 ---------------------------------- */
1005
	[BTTV_BOARD_STB2] = {
1006 1007 1008 1009 1010 1011
		.name		= "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 7,
M
 
Michael Krufky 已提交
1012
		.muxsel		= { 2, 3, 1, 1 },
1013 1014
		.gpiomux 	= { 4, 0, 2, 3 },
		.gpiomute 	= 1,
1015 1016 1017 1018
		.no_msp34xx	= 1,
		.needs_tvaudio	= 1,
		.tuner_type     = TUNER_PHILIPS_NTSC,
		.tuner_addr	= ADDR_UNSET,
1019
		.radio_addr     = ADDR_UNSET,
1020 1021 1022
		.pll            = PLL_28,
		.has_radio      = 1,
	},
1023
	[BTTV_BOARD_AVPHONE98] = {
1024 1025 1026 1027 1028 1029
		.name		= "AVerMedia TVPhone 98",
		.video_inputs	= 3,
		.audio_inputs	= 4,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 15,
M
 
Michael Krufky 已提交
1030
		.muxsel		= { 2, 3, 1, 1 },
1031
		.gpiomux 	= { 13, 4, 11, 7 },
1032 1033
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
1034
		.tuner_type	= UNSET,
1035
		.tuner_addr	= ADDR_UNSET,
1036
		.radio_addr     = ADDR_UNSET,
1037 1038 1039
		.has_radio	= 1,
		.audio_hook	= avermedia_tvphone_audio,
	},
1040
	[BTTV_BOARD_PV951] = {
1041 1042 1043 1044 1045 1046 1047
		.name		= "ProVideo PV951", /* pic16c54 */
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0,
		.muxsel		= { 2, 3, 1, 1},
1048
		.gpiomux 	= { 0, 0, 0, 0},
1049 1050 1051
		.needs_tvaudio	= 1,
		.no_msp34xx	= 1,
		.pll		= PLL_28,
1052
		.tuner_type	= TUNER_PHILIPS_PAL_I,
1053
		.tuner_addr	= ADDR_UNSET,
1054
		.radio_addr     = ADDR_UNSET,
1055
	},
1056
	[BTTV_BOARD_ONAIR_TV] = {
1057 1058 1059 1060 1061 1062
		.name		= "Little OnAir TV",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xe00b,
M
 
Michael Krufky 已提交
1063
		.muxsel		= { 2, 3, 1, 1 },
1064 1065
		.gpiomux 	= { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 },
		.gpiomute 	= 0xff3ffc,
1066
		.no_msp34xx	= 1,
1067
		.tuner_type	= UNSET,
1068
		.tuner_addr	= ADDR_UNSET,
1069
		.radio_addr     = ADDR_UNSET,
1070 1071 1072
	},

	/* ---- card 0x2c ---------------------------------- */
1073
	[BTTV_BOARD_SIGMA_TVII_FM] = {
1074 1075 1076 1077
		.name		= "Sigma TVII-FM",
		.video_inputs	= 2,
		.audio_inputs	= 1,
		.tuner		= 0,
1078
		.svhs		= UNSET,
1079
		.gpiomask	= 3,
M
 
Michael Krufky 已提交
1080
		.muxsel		= { 2, 3, 1, 1 },
1081 1082
		.gpiomux 	= { 1, 1, 0, 2 },
		.gpiomute 	= 3,
1083 1084
		.no_msp34xx	= 1,
		.pll		= PLL_NONE,
1085
		.tuner_type	= UNSET,
1086
		.tuner_addr	= ADDR_UNSET,
1087
		.radio_addr     = ADDR_UNSET,
1088
	},
1089
	[BTTV_BOARD_MATRIX_VISION2] = {
1090 1091 1092
		.name		= "MATRIX-Vision MV-Delta 2",
		.video_inputs	= 5,
		.audio_inputs	= 1,
1093
		.tuner		= UNSET,
1094 1095
		.svhs		= 3,
		.gpiomask	= 0,
M
 
Michael Krufky 已提交
1096
		.muxsel		= { 2, 3, 1, 0, 0 },
1097
		.gpiomux 	= { 0 },
1098 1099
		.no_msp34xx	= 1,
		.pll		= PLL_28,
1100
		.tuner_type	= UNSET,
1101
		.tuner_addr	= ADDR_UNSET,
1102
		.radio_addr     = ADDR_UNSET,
1103
	},
1104
	[BTTV_BOARD_ZOLTRIX_GENIE] = {
1105 1106 1107 1108 1109 1110
		.name		= "Zoltrix Genie TV/FM",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xbcf03f,
M
 
Michael Krufky 已提交
1111
		.muxsel		= { 2, 3, 1, 1 },
1112 1113
		.gpiomux 	= { 0xbc803f, 0xbc903f, 0xbcb03f, 0 },
		.gpiomute 	= 0xbcb03f,
1114 1115
		.no_msp34xx	= 1,
		.pll		= PLL_28,
1116
		.tuner_type	= TUNER_TEMIC_4039FR5_NTSC,
1117
		.tuner_addr	= ADDR_UNSET,
1118
		.radio_addr     = ADDR_UNSET,
1119
	},
1120
	[BTTV_BOARD_TERRATVRADIO] = {
1121 1122 1123 1124 1125 1126
		.name		= "Terratec TV/Radio+",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x70000,
M
 
Michael Krufky 已提交
1127
		.muxsel		= { 2, 3, 1, 1 },
1128 1129
		.gpiomux 	= { 0x20000, 0x30000, 0x10000, 0 },
		.gpiomute 	= 0x40000,
1130 1131 1132
		.needs_tvaudio	= 1,
		.no_msp34xx	= 1,
		.pll		= PLL_35,
1133
		.tuner_type	= TUNER_PHILIPS_PAL_I,
1134
		.tuner_addr	= ADDR_UNSET,
1135
		.radio_addr     = ADDR_UNSET,
1136 1137 1138 1139
		.has_radio	= 1,
	},

	/* ---- card 0x30 ---------------------------------- */
1140
	[BTTV_BOARD_DYNALINK] = {
1141 1142 1143 1144 1145 1146
		.name		= "Askey CPH03x/ Dynalink Magic TView",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 15,
M
 
Michael Krufky 已提交
1147
		.muxsel		= { 2, 3, 1, 1 },
1148 1149
		.gpiomux 	= {2,0,0,0 },
		.gpiomute 	= 1,
1150 1151
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
1152
		.tuner_type	= UNSET,
1153
		.tuner_addr	= ADDR_UNSET,
1154
		.radio_addr     = ADDR_UNSET,
1155
	},
1156
	[BTTV_BOARD_GVBCTV3PCI] = {
1157 1158 1159 1160 1161 1162
		.name		= "IODATA GV-BCTV3/PCI",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x010f00,
M
 
Michael Krufky 已提交
1163
		.muxsel		= {2, 3, 0, 0 },
1164
		.gpiomux 	= {0x10000, 0, 0x10000, 0 },
1165 1166 1167 1168
		.no_msp34xx	= 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_ALPS_TSHC6_NTSC,
		.tuner_addr	= ADDR_UNSET,
1169
		.radio_addr     = ADDR_UNSET,
1170 1171
		.audio_hook	= gvbctv3pci_audio,
	},
1172
	[BTTV_BOARD_PXELVWPLTVPAK] = {
1173 1174 1175 1176 1177 1178 1179 1180
		.name		= "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
		.video_inputs	= 5,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 3,
		.gpiomask	= 0xAA0000,
		.muxsel		= { 2,3,1,1,-1 },
		.digital_mode   = DIGITAL_MODE_CAMERA,
1181 1182
		.gpiomux 	= { 0x20000, 0, 0x80000, 0x80000 },
		.gpiomute 	= 0xa8000,
1183 1184 1185 1186
		.no_msp34xx	= 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_PHILIPS_PAL_I,
		.tuner_addr	= ADDR_UNSET,
1187
		.radio_addr     = ADDR_UNSET,
1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198
		.has_remote	= 1,
		/* GPIO wiring: (different from Rev.4C !)
			GPIO17: U4.A0 (first hef4052bt)
			GPIO19: U4.A1
			GPIO20: U5.A1 (second hef4052bt)
			GPIO21: U4.nEN
			GPIO22: BT832 Reset Line
			GPIO23: A5,A0, U5,nEN
		Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
		*/
	},
1199
	[BTTV_BOARD_EAGLE] = {
1200 1201 1202 1203 1204 1205
		.name           = "Eagle Wireless Capricorn2 (bt878A)",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 7,
M
 
Michael Krufky 已提交
1206
		.muxsel         = { 2, 0, 1, 1 },
1207 1208
		.gpiomux        = { 0, 1, 2, 3 },
		.gpiomute 	= 4,
1209
		.pll            = PLL_28,
1210
		.tuner_type     = UNSET /* TUNER_ALPS_TMDH2_NTSC */,
1211
		.tuner_addr	= ADDR_UNSET,
1212
		.radio_addr     = ADDR_UNSET,
1213 1214 1215
	},

	/* ---- card 0x34 ---------------------------------- */
1216
	[BTTV_BOARD_PINNACLEPRO] = {
1217 1218 1219 1220 1221 1222 1223
		/* David Härdeman <david@2gen.com> */
		.name           = "Pinnacle PCTV Studio Pro",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 3,
		.gpiomask       = 0x03000F,
M
 
Michael Krufky 已提交
1224
		.muxsel		= { 2, 3, 1, 1 },
1225 1226
		.gpiomux 	= { 1, 0xd0001, 0, 0 },
		.gpiomute 	= 10,
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237
				/* sound path (5 sources):
				MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
					0= ext. Audio IN
					1= from MUX2
					2= Mono TV sound from Tuner
					3= not connected
				MUX2 (mask 0x30000):
					0,2,3= from MSP34xx
					1= FM stereo Radio from Tuner */
		.needs_tvaudio  = 0,
		.pll            = PLL_28,
1238
		.tuner_type     = UNSET,
1239
		.tuner_addr	= ADDR_UNSET,
1240
		.radio_addr     = ADDR_UNSET,
1241
	},
1242
	[BTTV_BOARD_TVIEW_RDS_FM] = {
1243 1244 1245 1246 1247 1248 1249 1250
		/* Claas Langbehn <claas@bigfoot.com>,
		Sven Grothklags <sven@upb.de> */
		.name		= "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
		.video_inputs	= 4,
		.audio_inputs	= 3,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x1c,
M
 
Michael Krufky 已提交
1251
		.muxsel		= { 2, 3, 1, 1 },
1252 1253
		.gpiomux 	= { 0, 0, 0x10, 8 },
		.gpiomute 	= 4,
1254 1255 1256 1257
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
1258
		.radio_addr     = ADDR_UNSET,
1259 1260
		.has_radio	= 1,
	},
1261
	[BTTV_BOARD_LIFETEC_9415] = {
1262 1263 1264
		/* Tim Rstermundt <rosterm@uni-muenster.de>
		in de.comp.os.unix.linux.hardware:
			options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1265
			gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1266 1267 1268 1269 1270 1271 1272
			options tuner type=5 */
		.name		= "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x18e0,
M
 
Michael Krufky 已提交
1273
		.muxsel		= { 2, 3, 1, 1 },
1274 1275
		.gpiomux 	= { 0x0000,0x0800,0x1000,0x1000 },
		.gpiomute 	= 0x18e0,
1276 1277 1278 1279 1280
			/* For cards with tda9820/tda9821:
				0x0000: Tuner normal stereo
				0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
				0x0880: Tuner A2 stereo */
		.pll		= PLL_28,
1281
		.tuner_type	= UNSET,
1282
		.tuner_addr	= ADDR_UNSET,
1283
		.radio_addr     = ADDR_UNSET,
1284
	},
1285
	[BTTV_BOARD_BESTBUY_EASYTV] = {
1286 1287 1288 1289 1290 1291 1292 1293
		/* Miguel Angel Alvarez <maacruz@navegalia.com>
		old Easy TV BT848 version (model CPH031) */
		.name           = "Askey CPH031/ BESTBUY Easy TV",
		.video_inputs	= 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0xF,
M
 
Michael Krufky 已提交
1294
		.muxsel         = { 2, 3, 1, 0 },
1295 1296
		.gpiomux        = { 2, 0, 0, 0 },
		.gpiomute 	= 10,
1297 1298 1299 1300
		.needs_tvaudio  = 0,
		.pll		= PLL_28,
		.tuner_type	= TUNER_TEMIC_PAL,
		.tuner_addr	= ADDR_UNSET,
1301
		.radio_addr     = ADDR_UNSET,
1302 1303 1304
	},

	/* ---- card 0x38 ---------------------------------- */
1305
	[BTTV_BOARD_FLYVIDEO_98FM] = {
1306 1307 1308 1309 1310 1311 1312
		/* Gordon Heydon <gjheydon@bigfoot.com ('98) */
		.name           = "Lifeview FlyVideo 98FM LR50",
		.video_inputs   = 4,
		.audio_inputs   = 3,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x1800,
M
 
Michael Krufky 已提交
1313
		.muxsel         = { 2, 3, 1, 1 },
1314 1315
		.gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
		.gpiomute 	= 0x1800,
1316
		.pll            = PLL_28,
1317
		.tuner_type     = TUNER_PHILIPS_PAL,
1318
		.tuner_addr	= ADDR_UNSET,
1319
		.radio_addr     = ADDR_UNSET,
1320 1321 1322 1323
	},
		/* This is the ultimate cheapo capture card
		* just a BT848A on a small PCB!
		* Steve Hosgood <steve@equiinet.com> */
1324
	[BTTV_BOARD_GRANDTEC] = {
1325 1326 1327
		.name           = "GrandTec 'Grand Video Capture' (Bt848)",
		.video_inputs   = 2,
		.audio_inputs   = 0,
1328
		.tuner          = UNSET,
1329 1330 1331
		.svhs           = 1,
		.gpiomask       = 0,
		.muxsel         = { 3, 1 },
1332
		.gpiomux        = { 0 },
1333 1334 1335
		.needs_tvaudio  = 0,
		.no_msp34xx     = 1,
		.pll            = PLL_35,
1336
		.tuner_type     = UNSET,
1337
		.tuner_addr	= ADDR_UNSET,
1338
		.radio_addr     = ADDR_UNSET,
1339
	},
1340
	[BTTV_BOARD_ASKEY_CPH060] = {
1341 1342 1343 1344 1345 1346 1347 1348
		/* Daniel Herrington <daniel.herrington@home.com> */
		.name           = "Askey CPH060/ Phoebe TV Master Only (No FM)",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0xe00,
		.muxsel         = { 2, 3, 1, 1},
1349 1350
		.gpiomux        = { 0x400, 0x400, 0x400, 0x400 },
		.gpiomute 	= 0x800,
1351 1352 1353 1354
		.needs_tvaudio  = 1,
		.pll            = PLL_28,
		.tuner_type     = TUNER_TEMIC_4036FY5_NTSC,
		.tuner_addr	= ADDR_UNSET,
1355
		.radio_addr     = ADDR_UNSET,
1356
	},
1357
	[BTTV_BOARD_ASKEY_CPH03X] = {
1358 1359 1360 1361 1362 1363 1364
		/* Matti Mottus <mottus@physic.ut.ee> */
		.name		= "Askey CPH03x TV Capturer",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask       = 0x03000F,
M
 
Michael Krufky 已提交
1365
		.muxsel		= { 2, 3, 1, 0 },
1366 1367
		.gpiomux        = { 2, 0, 0, 0 },
		.gpiomute 	= 1,
1368
		.pll            = PLL_28,
1369
		.tuner_type	= TUNER_TEMIC_PAL,
1370
		.tuner_addr	= ADDR_UNSET,
1371
		.radio_addr     = ADDR_UNSET,
1372 1373 1374
	},

	/* ---- card 0x3c ---------------------------------- */
1375
	[BTTV_BOARD_MM100PCTV] = {
1376 1377 1378 1379 1380
		/* Philip Blundell <philb@gnu.org> */
		.name           = "Modular Technology MM100PCTV",
		.video_inputs   = 2,
		.audio_inputs   = 2,
		.tuner		= 0,
1381
		.svhs		= UNSET,
1382
		.gpiomask       = 11,
M
 
Michael Krufky 已提交
1383
		.muxsel         = { 2, 3, 1, 1 },
1384 1385
		.gpiomux        = { 2, 0, 0, 1 },
		.gpiomute 	= 8,
1386 1387 1388
		.pll            = PLL_35,
		.tuner_type     = TUNER_TEMIC_PAL,
		.tuner_addr	= ADDR_UNSET,
1389
		.radio_addr     = ADDR_UNSET,
1390
	},
1391
	[BTTV_BOARD_GMV1] = {
1392
		/* Adrian Cox <adrian@humboldt.co.uk */
1393
		.name		= "AG Electronics GMV1",
1394 1395
		.video_inputs   = 2,
		.audio_inputs   = 0,
1396
		.tuner		= UNSET,
1397
		.svhs		= 1,
1398
		.gpiomask       = 0xF,
M
 
Michael Krufky 已提交
1399
		.muxsel		= { 2, 2 },
1400
		.gpiomux        = { },
1401 1402
		.no_msp34xx     = 1,
		.needs_tvaudio  = 0,
1403
		.pll		= PLL_28,
1404
		.tuner_type     = UNSET,
1405
		.tuner_addr	= ADDR_UNSET,
1406
		.radio_addr     = ADDR_UNSET,
1407
	},
1408
	[BTTV_BOARD_BESTBUY_EASYTV2] = {
1409 1410 1411 1412 1413 1414 1415 1416 1417
		/* Miguel Angel Alvarez <maacruz@navegalia.com>
		new Easy TV BT878 version (model CPH061)
		special thanks to Informatica Mieres for providing the card */
		.name           = "Askey CPH061/ BESTBUY Easy TV (bt878)",
		.video_inputs	= 3,
		.audio_inputs   = 2,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0xFF,
M
 
Michael Krufky 已提交
1418
		.muxsel         = { 2, 3, 1, 0 },
1419 1420
		.gpiomux        = { 1, 0, 4, 4 },
		.gpiomute 	= 9,
1421 1422 1423 1424
		.needs_tvaudio  = 0,
		.pll		= PLL_28,
		.tuner_type	= TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
1425
		.radio_addr     = ADDR_UNSET,
1426
	},
1427
	[BTTV_BOARD_ATI_TVWONDER] = {
1428 1429 1430 1431 1432 1433 1434 1435
		/* Lukas Gebauer <geby@volny.cz> */
		.name		= "ATI TV-Wonder",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xf03f,
		.muxsel		= { 2, 3, 1, 0 },
1436 1437
		.gpiomux 	= { 0xbffe, 0, 0xbfff, 0 },
		.gpiomute 	= 0xbffe,
1438 1439 1440
		.pll		= PLL_28,
		.tuner_type	= TUNER_TEMIC_4006FN5_MULTI_PAL,
		.tuner_addr	= ADDR_UNSET,
1441
		.radio_addr     = ADDR_UNSET,
1442 1443 1444
	},

	/* ---- card 0x40 ---------------------------------- */
1445
	[BTTV_BOARD_ATI_TVWONDERVE] = {
1446 1447 1448 1449 1450
		/* Lukas Gebauer <geby@volny.cz> */
		.name		= "ATI TV-Wonder VE",
		.video_inputs	= 2,
		.audio_inputs	= 1,
		.tuner		= 0,
1451
		.svhs		= UNSET,
1452
		.gpiomask	= 1,
M
 
Michael Krufky 已提交
1453
		.muxsel		= { 2, 3, 0, 1 },
1454
		.gpiomux 	= { 0, 0, 1, 0 },
1455 1456 1457 1458
		.no_msp34xx	= 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_TEMIC_4006FN5_MULTI_PAL,
		.tuner_addr	= ADDR_UNSET,
1459
		.radio_addr     = ADDR_UNSET,
1460
	},
1461
	[BTTV_BOARD_FLYVIDEO2000] = {
1462 1463 1464 1465 1466 1467 1468
		/* DeeJay <deejay@westel900.net (2000S) */
		.name           = "Lifeview FlyVideo 2000S LR90",
		.video_inputs   = 3,
		.audio_inputs   = 3,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask	= 0x18e0,
M
 
Michael Krufky 已提交
1469
		.muxsel		= { 2, 3, 0, 1 },
1470 1471 1472
				/* Radio changed from 1e80 to 0x800 to make
				FlyVideo2000S in .hu happy (gm)*/
				/* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1473 1474
		.gpiomux 	= { 0x0000,0x0800,0x1000,0x1000 },
		.gpiomute 	= 0x1800,
1475 1476 1477 1478 1479
		.audio_hook	= fv2000s_audio,
		.no_msp34xx	= 1,
		.no_tda9875	= 1,
		.needs_tvaudio  = 1,
		.pll            = PLL_28,
1480
		.tuner_type     = TUNER_PHILIPS_PAL,
1481
		.tuner_addr	= ADDR_UNSET,
1482
		.radio_addr     = ADDR_UNSET,
1483
	},
1484
	[BTTV_BOARD_TERRATVALUER] = {
1485 1486 1487 1488 1489 1490
		.name		= "Terratec TValueRadio",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0xffff00,
M
 
Michael Krufky 已提交
1491
		.muxsel		= { 2, 3, 1, 1 },
1492 1493
		.gpiomux 	= { 0x500, 0x500, 0x300, 0x900 },
		.gpiomute 	= 0x900,
1494 1495 1496 1497
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
1498
		.radio_addr     = ADDR_UNSET,
1499 1500
		.has_radio	= 1,
	},
1501
	[BTTV_BOARD_GVBCTV4PCI] = {
1502 1503 1504 1505 1506 1507 1508
		/* TANAKA Kei <peg00625@nifty.com> */
		.name           = "IODATA GV-BCTV4/PCI",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x010f00,
M
 
Michael Krufky 已提交
1509
		.muxsel         = {2, 3, 0, 0 },
1510
		.gpiomux        = {0x10000, 0, 0x10000, 0 },
1511 1512 1513 1514
		.no_msp34xx     = 1,
		.pll            = PLL_28,
		.tuner_type     = TUNER_SHARP_2U5JF5540_NTSC,
		.tuner_addr	= ADDR_UNSET,
1515
		.radio_addr     = ADDR_UNSET,
1516 1517 1518 1519
		.audio_hook     = gvbctv3pci_audio,
	},

	/* ---- card 0x44 ---------------------------------- */
1520
	[BTTV_BOARD_VOODOOTV_FM] = {
1521 1522 1523 1524 1525 1526
		.name           = "3Dfx VoodooTV FM (Euro)",
		/* try "insmod msp3400 simple=0" if you have
		* sound problems with this card. */
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
1527
		.svhs           = UNSET,
1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543
		.gpiomask       = 0x4f8a00,
		/* 0x100000: 1=MSP enabled (0=disable again)
		* 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */
		.gpiomux        = {0x947fff, 0x987fff,0x947fff,0x947fff },
		.gpiomute 	= 0x947fff,
		/* tvtuner, radio,   external,internal, mute,  stereo
		* tuner, Composit, SVid, Composit-on-Svid-adapter */
		.muxsel         = { 2, 3 ,0 ,1 },
		.tuner_type     = TUNER_MT2032,
		.tuner_addr	= ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
		.pll		= PLL_28,
		.has_radio	= 1,
	},
	[BTTV_BOARD_VOODOOTV_200] = {
		.name           = "VoodooTV 200 (USA)",
1544 1545 1546 1547 1548
		/* try "insmod msp3400 simple=0" if you have
		* sound problems with this card. */
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
1549
		.svhs           = UNSET,
1550 1551 1552
		.gpiomask       = 0x4f8a00,
		/* 0x100000: 1=MSP enabled (0=disable again)
		* 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */
1553 1554
		.gpiomux        = {0x947fff, 0x987fff,0x947fff,0x947fff },
		.gpiomute 	= 0x947fff,
1555 1556
		/* tvtuner, radio,   external,internal, mute,  stereo
		* tuner, Composit, SVid, Composit-on-Svid-adapter */
M
 
Michael Krufky 已提交
1557
		.muxsel         = { 2, 3 ,0 ,1 },
1558 1559
		.tuner_type     = TUNER_MT2032,
		.tuner_addr	= ADDR_UNSET,
1560
		.radio_addr     = ADDR_UNSET,
1561 1562 1563
		.pll		= PLL_28,
		.has_radio	= 1,
	},
1564
	[BTTV_BOARD_AIMMS] = {
1565 1566 1567 1568
		/* Philip Blundell <pb@nexus.co.uk> */
		.name           = "Active Imaging AIMMS",
		.video_inputs   = 1,
		.audio_inputs   = 0,
1569 1570
		.tuner          = UNSET,
		.tuner_type     = UNSET,
1571
		.tuner_addr	= ADDR_UNSET,
1572
		.radio_addr     = ADDR_UNSET,
1573 1574 1575 1576
		.pll            = PLL_28,
		.muxsel         = { 2 },
		.gpiomask       = 0
	},
1577
	[BTTV_BOARD_PV_BT878P_PLUS] = {
1578 1579 1580 1581 1582 1583 1584
		/* Tomasz Pyra <hellfire@sedez.iq.pl> */
		.name           = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
		.video_inputs   = 3,
		.audio_inputs   = 4,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 15,
M
 
Michael Krufky 已提交
1585
		.muxsel         = { 2, 3, 1, 1 },
1586 1587
		.gpiomux        = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */
		.gpiomute 	= 13,
1588 1589
		.needs_tvaudio  = 1,
		.pll            = PLL_28,
1590
		.tuner_type     = TUNER_LG_PAL_I_FM,
1591
		.tuner_addr	= ADDR_UNSET,
1592
		.radio_addr     = ADDR_UNSET,
1593 1594 1595 1596 1597 1598 1599 1600 1601
		.has_remote     = 1,
		/* GPIO wiring:
			GPIO0: U4.A0 (hef4052bt)
			GPIO1: U4.A1
			GPIO2: U4.A1 (second hef4052bt)
			GPIO3: U4.nEN, U5.A0, A5.nEN
			GPIO8-15: vrd866b ?
		*/
	},
1602
	[BTTV_BOARD_FLYVIDEO98EZ] = {
1603 1604 1605
		.name		= "Lifeview FlyVideo 98EZ (capture only) LR51",
		.video_inputs	= 4,
		.audio_inputs   = 0,
1606
		.tuner		= UNSET,
1607
		.svhs		= 2,
M
 
Michael Krufky 已提交
1608
		.muxsel		= { 2, 3, 1, 1 }, /* AV1, AV2, SVHS, CVid adapter on SVHS */
1609 1610 1611 1612
		.pll		= PLL_28,
		.no_msp34xx	= 1,
		.tuner_type	= UNSET,
		.tuner_addr	= ADDR_UNSET,
1613
		.radio_addr     = ADDR_UNSET,
1614 1615 1616
	},

	/* ---- card 0x48 ---------------------------------- */
1617
	[BTTV_BOARD_PV_BT878P_9B] = {
1618 1619 1620 1621 1622 1623 1624 1625
		/* Dariusz Kowalewski <darekk@automex.pl> */
		.name		= "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
		.video_inputs	= 4,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x3f,
		.muxsel		= { 2, 3, 1, 1 },
1626 1627
		.gpiomux 	= { 0x01, 0x00, 0x03, 0x03 },
		.gpiomute 	= 0x09,
1628 1629 1630 1631
		.needs_tvaudio  = 1,
		.no_msp34xx	= 1,
		.no_tda9875	= 1,
		.pll		= PLL_28,
1632
		.tuner_type	= TUNER_PHILIPS_PAL,
1633
		.tuner_addr	= ADDR_UNSET,
1634
		.radio_addr     = ADDR_UNSET,
1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645
		.audio_hook	= pvbt878p9b_audio, /* Note: not all cards have stereo */
		.has_radio	= 1,  /* Note: not all cards have radio */
		.has_remote     = 1,
		/* GPIO wiring:
			GPIO0: A0 hef4052
			GPIO1: A1 hef4052
			GPIO3: nEN hef4052
			GPIO8-15: vrd866b
			GPIO20,22,23: R30,R29,R28
		*/
	},
1646
	[BTTV_BOARD_SENSORAY311] = {
1647 1648 1649 1650 1651
		/* Clay Kunz <ckunz@mail.arc.nasa.gov> */
		/* you must jumper JP5 for the card to work */
		.name           = "Sensoray 311",
		.video_inputs   = 5,
		.audio_inputs   = 0,
1652
		.tuner          = UNSET,
1653 1654
		.svhs           = 4,
		.gpiomask       = 0,
M
 
Michael Krufky 已提交
1655
		.muxsel         = { 2, 3, 1, 0, 0 },
1656
		.gpiomux        = { 0 },
1657
		.needs_tvaudio  = 0,
1658
		.tuner_type     = UNSET,
1659
		.tuner_addr	= ADDR_UNSET,
1660
		.radio_addr     = ADDR_UNSET,
1661
	},
1662
	[BTTV_BOARD_RV605] = {
1663 1664 1665 1666
		/* Miguel Freitas <miguel@cetuc.puc-rio.br> */
		.name           = "RemoteVision MX (RV605)",
		.video_inputs   = 16,
		.audio_inputs   = 0,
1667 1668
		.tuner          = UNSET,
		.svhs           = UNSET,
1669 1670 1671 1672 1673 1674
		.gpiomask       = 0x00,
		.gpiomask2      = 0x07ff,
		.muxsel         = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03,
				0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 },
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
1675
		.tuner_type     = UNSET,
1676
		.tuner_addr	= ADDR_UNSET,
1677
		.radio_addr     = ADDR_UNSET,
1678 1679
		.muxsel_hook    = rv605_muxsel,
	},
1680
	[BTTV_BOARD_POWERCLR_MTV878] = {
1681 1682 1683 1684 1685 1686 1687
		.name           = "Powercolor MTV878/ MTV878R/ MTV878F",
		.video_inputs   = 3,
		.audio_inputs   = 2,
		.tuner		= 0,
		.svhs           = 2,
		.gpiomask       = 0x1C800F,  /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */
		.muxsel         = { 2, 1, 1, },
1688 1689
		.gpiomux        = { 0, 1, 2, 2 },
		.gpiomute 	= 4,
1690 1691 1692
		.needs_tvaudio  = 0,
		.tuner_type     = TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
1693
		.radio_addr     = ADDR_UNSET,
1694 1695 1696 1697 1698
		.pll		= PLL_28,
		.has_radio	= 1,
	},

	/* ---- card 0x4c ---------------------------------- */
1699
	[BTTV_BOARD_WINDVR] = {
1700 1701 1702 1703 1704 1705 1706 1707
		/* Masaki Suzuki <masaki@btree.org> */
		.name           = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x140007,
		.muxsel         = { 2, 3, 1, 1 },
1708 1709
		.gpiomux        = { 0, 1, 2, 3 },
		.gpiomute 	= 4,
1710 1711
		.tuner_type     = TUNER_PHILIPS_NTSC,
		.tuner_addr	= ADDR_UNSET,
1712
		.radio_addr     = ADDR_UNSET,
1713 1714
		.audio_hook     = windvr_audio,
	},
1715
	[BTTV_BOARD_GRANDTEC_MULTI] = {
1716 1717 1718
		.name           = "GrandTec Multi Capture Card (Bt878)",
		.video_inputs   = 4,
		.audio_inputs   = 0,
1719 1720
		.tuner          = UNSET,
		.svhs           = UNSET,
1721 1722
		.gpiomask       = 0,
		.muxsel         = { 2, 3, 1, 0 },
1723
		.gpiomux        = { 0 },
1724 1725 1726
		.needs_tvaudio  = 0,
		.no_msp34xx     = 1,
		.pll            = PLL_28,
1727
		.tuner_type     = UNSET,
1728
		.tuner_addr	= ADDR_UNSET,
1729
		.radio_addr     = ADDR_UNSET,
1730
	},
1731
	[BTTV_BOARD_KWORLD] = {
1732 1733 1734 1735 1736 1737 1738
		.name           = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
		.video_inputs   = 4,
		.audio_inputs   = 3,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 7,
		.muxsel         = { 2, 3, 1, 1 },   /* Tuner, SVid, SVHS, SVid to SVHS connector */
1739
		.gpiomux        = { 0, 0, 4, 4 },/* Yes, this tuner uses the same audio output for TV and FM radio!
1740 1741 1742
						* This card lacks external Audio In, so we mute it on Ext. & Int.
						* The PCB can take a sbx1637/sbx1673, wiring unknown.
						* This card lacks PCI subsystem ID, sigh.
1743
						* gpiomux =1: lower volume, 2+3: mute
1744 1745
						* btwincap uses 0x80000/0x80003
						*/
1746
		.gpiomute 	= 4,
1747 1748 1749
		.needs_tvaudio  = 0,
		.no_msp34xx     = 1,
		.pll            = PLL_28,
1750
		.tuner_type     = TUNER_PHILIPS_PAL,
1751
		.tuner_addr	= ADDR_UNSET,
1752
		.radio_addr     = ADDR_UNSET,
1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765
		/* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
		radio signal strength indicators work fine. */
		.has_radio	= 1,
		/* GPIO Info:
			GPIO0,1:   HEF4052 A0,A1
			GPIO2:     HEF4052 nENABLE
			GPIO3-7:   n.c.
			GPIO8-13:  IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
			GPIO14,15: ??
			GPIO16-21: n.c.
			GPIO22,23: ??
			??       : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
	},
1766
	[BTTV_BOARD_DSP_TCVIDEO] = {
1767 1768 1769
		/* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
		.name           = "DSP Design TCVIDEO",
		.video_inputs   = 4,
1770
		.svhs           = UNSET,
M
 
Michael Krufky 已提交
1771
		.muxsel         = { 2, 3, 1, 0 },
1772
		.pll            = PLL_28,
1773
		.tuner_type     = UNSET,
1774
		.tuner_addr	= ADDR_UNSET,
1775
		.radio_addr     = ADDR_UNSET,
1776 1777 1778
	},

		/* ---- card 0x50 ---------------------------------- */
1779
	[BTTV_BOARD_HAUPPAUGEPVR] = {
1780 1781 1782 1783 1784
		.name           = "Hauppauge WinTV PVR",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
M
 
Michael Krufky 已提交
1785
		.muxsel         = { 2, 0, 1, 1 },
1786 1787
		.needs_tvaudio  = 1,
		.pll            = PLL_28,
1788
		.tuner_type     = UNSET,
1789
		.tuner_addr	= ADDR_UNSET,
1790
		.radio_addr     = ADDR_UNSET,
1791 1792

		.gpiomask       = 7,
1793
		.gpiomux        = {7},
1794
	},
1795
	[BTTV_BOARD_GVBCTV5PCI] = {
1796 1797 1798 1799 1800 1801
		.name           = "IODATA GV-BCTV5/PCI",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x0f0f80,
M
 
Michael Krufky 已提交
1802
		.muxsel         = {2, 3, 1, 0 },
1803 1804
		.gpiomux        = {0x030000, 0x010000, 0, 0 },
		.gpiomute 	= 0x020000,
1805 1806 1807 1808
		.no_msp34xx     = 1,
		.pll            = PLL_28,
		.tuner_type     = TUNER_PHILIPS_NTSC_M,
		.tuner_addr	= ADDR_UNSET,
1809
		.radio_addr     = ADDR_UNSET,
1810 1811 1812
		.audio_hook     = gvbctv5pci_audio,
		.has_radio      = 1,
	},
1813
	[BTTV_BOARD_OSPREY1x0] = {
1814 1815 1816
		.name           = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
		.video_inputs   = 4,                  /* id-inputs-clock */
		.audio_inputs   = 0,
1817
		.tuner          = UNSET,
1818 1819 1820
		.svhs           = 3,
		.muxsel         = { 3, 2, 0, 1 },
		.pll            = PLL_28,
1821
		.tuner_type     = UNSET,
1822
		.tuner_addr	= ADDR_UNSET,
1823
		.radio_addr     = ADDR_UNSET,
1824 1825 1826 1827
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
1828
	[BTTV_BOARD_OSPREY1x0_848] = {
1829 1830 1831
		.name           = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
		.video_inputs   = 3,
		.audio_inputs   = 0,
1832
		.tuner          = UNSET,
1833 1834 1835
		.svhs           = 2,
		.muxsel         = { 2, 3, 1 },
		.pll            = PLL_28,
1836
		.tuner_type     = UNSET,
1837
		.tuner_addr	= ADDR_UNSET,
1838
		.radio_addr     = ADDR_UNSET,
1839 1840 1841 1842 1843 1844
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},

		/* ---- card 0x54 ---------------------------------- */
1845
	[BTTV_BOARD_OSPREY101_848] = {
1846 1847 1848
		.name           = "Osprey 101 (848)", /* 0x05-40C0-C1 */
		.video_inputs   = 2,
		.audio_inputs   = 0,
1849
		.tuner          = UNSET,
1850 1851 1852
		.svhs           = 1,
		.muxsel         = { 3, 1 },
		.pll            = PLL_28,
1853
		.tuner_type     = UNSET,
1854
		.tuner_addr	= ADDR_UNSET,
1855
		.radio_addr     = ADDR_UNSET,
1856 1857 1858 1859
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
1860
	[BTTV_BOARD_OSPREY1x1] = {
1861 1862 1863
		.name           = "Osprey 101/151",       /* 0x1(4|5)-0004-C4 */
		.video_inputs   = 1,
		.audio_inputs   = 0,
1864 1865
		.tuner          = UNSET,
		.svhs           = UNSET,
1866 1867
		.muxsel         = { 0 },
		.pll            = PLL_28,
1868
		.tuner_type     = UNSET,
1869
		.tuner_addr	= ADDR_UNSET,
1870
		.radio_addr     = ADDR_UNSET,
1871 1872 1873 1874
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
1875
	[BTTV_BOARD_OSPREY1x1_SVID] = {
1876 1877 1878
		.name           = "Osprey 101/151 w/ svid",  /* 0x(16|17|20)-00C4-C1 */
		.video_inputs   = 2,
		.audio_inputs   = 0,
1879
		.tuner          = UNSET,
1880 1881 1882
		.svhs           = 1,
		.muxsel         = { 0, 1 },
		.pll            = PLL_28,
1883
		.tuner_type     = UNSET,
1884
		.tuner_addr	= ADDR_UNSET,
1885
		.radio_addr     = ADDR_UNSET,
1886 1887 1888 1889
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
1890
	[BTTV_BOARD_OSPREY2xx] = {
1891 1892 1893
		.name           = "Osprey 200/201/250/251",  /* 0x1(8|9|E|F)-0004-C4 */
		.video_inputs   = 1,
		.audio_inputs   = 1,
1894 1895
		.tuner          = UNSET,
		.svhs           = UNSET,
1896 1897 1898 1899
		.muxsel         = { 0 },
		.pll            = PLL_28,
		.tuner_type	= UNSET,
		.tuner_addr	= ADDR_UNSET,
1900
		.radio_addr     = ADDR_UNSET,
1901 1902 1903 1904 1905 1906
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},

		/* ---- card 0x58 ---------------------------------- */
1907
	[BTTV_BOARD_OSPREY2x0_SVID] = {
1908 1909 1910
		.name           = "Osprey 200/250",   /* 0x1(A|B)-00C4-C1 */
		.video_inputs   = 2,
		.audio_inputs   = 1,
1911
		.tuner          = UNSET,
1912 1913 1914 1915 1916
		.svhs           = 1,
		.muxsel         = { 0, 1 },
		.pll            = PLL_28,
		.tuner_type	= UNSET,
		.tuner_addr	= ADDR_UNSET,
1917
		.radio_addr     = ADDR_UNSET,
1918 1919 1920 1921
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
1922
	[BTTV_BOARD_OSPREY2x0] = {
1923
		.name           = "Osprey 210/220/230",   /* 0x1(A|B)-04C0-C1 */
1924 1925
		.video_inputs   = 2,
		.audio_inputs   = 1,
1926
		.tuner          = UNSET,
1927 1928 1929 1930 1931
		.svhs           = 1,
		.muxsel         = { 2, 3 },
		.pll            = PLL_28,
		.tuner_type	= UNSET,
		.tuner_addr	= ADDR_UNSET,
1932
		.radio_addr     = ADDR_UNSET,
1933 1934 1935 1936
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
1937
	[BTTV_BOARD_OSPREY500] = {
1938 1939 1940
		.name           = "Osprey 500",   /* 500 */
		.video_inputs   = 2,
		.audio_inputs   = 1,
1941
		.tuner          = UNSET,
1942 1943 1944
		.svhs           = 1,
		.muxsel         = { 2, 3 },
		.pll            = PLL_28,
1945
		.tuner_type     = UNSET,
1946
		.tuner_addr	= ADDR_UNSET,
1947
		.radio_addr     = ADDR_UNSET,
1948 1949 1950 1951
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
1952
	[BTTV_BOARD_OSPREY540] = {
1953 1954 1955
		.name           = "Osprey 540",   /* 540 */
		.video_inputs   = 4,
		.audio_inputs   = 1,
1956
		.tuner          = UNSET,
1957
		.pll            = PLL_28,
1958
		.tuner_type     = UNSET,
1959
		.tuner_addr	= ADDR_UNSET,
1960
		.radio_addr     = ADDR_UNSET,
1961 1962 1963 1964 1965 1966
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},

		/* ---- card 0x5C ---------------------------------- */
1967
	[BTTV_BOARD_OSPREY2000] = {
1968 1969 1970
		.name           = "Osprey 2000",  /* 2000 */
		.video_inputs   = 2,
		.audio_inputs   = 1,
1971
		.tuner          = UNSET,
1972 1973 1974 1975 1976
		.svhs           = 1,
		.muxsel         = { 2, 3 },
		.pll            = PLL_28,
		.tuner_type	= UNSET,
		.tuner_addr	= ADDR_UNSET,
1977
		.radio_addr     = ADDR_UNSET,
1978 1979 1980 1981
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,      /* must avoid, conflicts with the bt860 */
	},
1982
	[BTTV_BOARD_IDS_EAGLE] = {
1983 1984 1985 1986
		/* M G Berberich <berberic@forwiss.uni-passau.de> */
		.name           = "IDS Eagle",
		.video_inputs   = 4,
		.audio_inputs   = 0,
1987 1988
		.tuner          = UNSET,
		.tuner_type     = UNSET,
1989
		.tuner_addr	= ADDR_UNSET,
1990
		.radio_addr     = ADDR_UNSET,
1991
		.svhs           = UNSET,
1992 1993 1994 1995 1996 1997 1998
		.gpiomask       = 0,
		.muxsel         = { 0, 1, 2, 3 },
		.muxsel_hook    = eagle_muxsel,
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.pll            = PLL_28,
	},
1999
	[BTTV_BOARD_PINNACLESAT] = {
2000 2001 2002 2003
		.name           = "Pinnacle PCTV Sat",
		.video_inputs   = 2,
		.audio_inputs   = 0,
		.svhs           = 1,
2004 2005
		.tuner          = UNSET,
		.tuner_type     = UNSET,
2006
		.tuner_addr	= ADDR_UNSET,
2007
		.radio_addr     = ADDR_UNSET,
2008 2009 2010
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
2011
		.muxsel         = { 3, 1 },
2012 2013 2014 2015
		.pll            = PLL_28,
		.no_gpioirq     = 1,
		.has_dvb        = 1,
	},
2016
	[BTTV_BOARD_FORMAC_PROTV] = {
2017 2018 2019 2020 2021 2022 2023
		.name           = "Formac ProTV II (bt878)",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 3,
		.gpiomask       = 2,
		/* TV, Comp1, Composite over SVID con, SVID */
M
 
Michael Krufky 已提交
2024
		.muxsel         = { 2, 3, 1, 1 },
2025
		.gpiomux        = { 2, 2, 0, 0 },
2026 2027 2028 2029
		.pll            = PLL_28,
		.has_radio      = 1,
		.tuner_type     = TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
2030
		.radio_addr     = ADDR_UNSET,
2031 2032 2033 2034 2035 2036
	/* sound routing:
		GPIO=0x00,0x01,0x03: mute (?)
		0x02: both TV and radio (tuner: FM1216/I)
		The card has onboard audio connectors labeled "cdrom" and "board",
		not soldered here, though unknown wiring.
		Card lacks: external audio in, pci subsystem id.
2037
	*/
2038 2039 2040
	},

		/* ---- card 0x60 ---------------------------------- */
2041
	[BTTV_BOARD_MACHTV] = {
2042 2043 2044 2045
		.name           = "MachTV",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
2046
		.svhs           = UNSET,
2047 2048
		.gpiomask       = 7,
		.muxsel         = { 2, 3, 1, 1},
2049 2050
		.gpiomux        = { 0, 1, 2, 3},
		.gpiomute 	= 4,
2051
		.needs_tvaudio  = 1,
2052
		.tuner_type     = TUNER_PHILIPS_PAL,
2053
		.tuner_addr	= ADDR_UNSET,
2054
		.radio_addr     = ADDR_UNSET,
2055
		.pll            = PLL_28,
2056
	},
2057
	[BTTV_BOARD_EURESYS_PICOLO] = {
2058 2059 2060
		.name           = "Euresys Picolo",
		.video_inputs   = 3,
		.audio_inputs   = 0,
2061
		.tuner          = UNSET,
2062 2063 2064 2065 2066 2067 2068 2069 2070
		.svhs           = 2,
		.gpiomask       = 0,
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.muxsel         = { 2, 0, 1},
		.pll            = PLL_28,
		.tuner_type     = UNSET,
		.tuner_addr	= ADDR_UNSET,
2071
		.radio_addr     = ADDR_UNSET,
2072
	},
2073
	[BTTV_BOARD_PV150] = {
2074 2075 2076 2077
		/* Luc Van Hoeylandt <luc@e-magic.be> */
		.name           = "ProVideo PV150", /* 0x4f */
		.video_inputs   = 2,
		.audio_inputs   = 0,
2078 2079
		.tuner          = UNSET,
		.svhs           = UNSET,
2080 2081
		.gpiomask       = 0,
		.muxsel         = { 2, 3 },
2082
		.gpiomux        = { 0 },
2083 2084 2085 2086 2087
		.needs_tvaudio  = 0,
		.no_msp34xx     = 1,
		.pll            = PLL_28,
		.tuner_type     = UNSET,
		.tuner_addr	= ADDR_UNSET,
2088
		.radio_addr     = ADDR_UNSET,
2089
	},
2090
	[BTTV_BOARD_AD_TVK503] = {
2091 2092 2093 2094 2095 2096 2097 2098 2099 2100
		/* Hiroshi Takekawa <sian@big.or.jp> */
		/* This card lacks subsystem ID */
		.name           = "AD-TVK503", /* 0x63 */
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x001e8007,
		.muxsel         = { 2, 3, 1, 0 },
		/*                  Tuner, Radio, external, internal, off,  on */
2101 2102
		.gpiomux        = { 0x08,  0x0f,  0x0a,     0x08 },
		.gpiomute 	= 0x0f,
2103 2104 2105
		.needs_tvaudio  = 0,
		.no_msp34xx     = 1,
		.pll            = PLL_28,
2106
		.tuner_type     = TUNER_PHILIPS_NTSC,
2107
		.tuner_addr	= ADDR_UNSET,
2108
		.radio_addr     = ADDR_UNSET,
2109 2110 2111 2112
		.audio_hook	= adtvk503_audio,
	},

		/* ---- card 0x64 ---------------------------------- */
2113
	[BTTV_BOARD_HERCULES_SM_TV] = {
2114 2115 2116 2117 2118 2119 2120 2121 2122 2123
		.name           = "Hercules Smart TV Stereo",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x00,
		.muxsel         = { 2, 3, 1, 1 },
		.needs_tvaudio  = 1,
		.no_msp34xx     = 1,
		.pll            = PLL_28,
2124
		.tuner_type     = TUNER_PHILIPS_PAL,
2125
		.tuner_addr	= ADDR_UNSET,
2126
		.radio_addr     = ADDR_UNSET,
2127 2128 2129 2130 2131 2132 2133 2134 2135 2136
		/* Notes:
		- card lacks subsystem ID
		- stereo variant w/ daughter board with tda9874a @0xb0
		- Audio Routing:
			always from tda9874 independent of GPIO (?)
			external line in: unknown
		- Other chips: em78p156elp @ 0x96 (probably IR remote control)
			hef4053 (instead 4052) for unknown function
		*/
	},
2137
	[BTTV_BOARD_PACETV] = {
2138 2139 2140 2141 2142
		.name           = "Pace TV & Radio Card",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
M
 
Michael Krufky 已提交
2143
		.muxsel         = { 2, 3, 1, 1 }, /* Tuner, CVid, SVid, CVid over SVid connector */
2144 2145 2146
		.gpiomask       = 0,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
2147
		.tuner_type     = TUNER_PHILIPS_PAL_I,
2148
		.tuner_addr	= ADDR_UNSET,
2149
		.radio_addr     = ADDR_UNSET,
2150 2151 2152 2153 2154 2155 2156 2157 2158
		.has_radio      = 1,
		.pll            = PLL_28,
		/* Bt878, Bt832, FI1246 tuner; no pci subsystem id
		only internal line out: (4pin header) RGGL
		Radio must be decoded by msp3410d (not routed through)*/
		/*
		.digital_mode   = DIGITAL_MODE_CAMERA,  todo!
		*/
	},
2159
	[BTTV_BOARD_IVC200] = {
2160 2161 2162 2163
		/* Chris Willing <chris@vislab.usyd.edu.au> */
		.name           = "IVC-200",
		.video_inputs   = 1,
		.audio_inputs   = 0,
2164 2165
		.tuner          = UNSET,
		.tuner_type     = UNSET,
2166
		.tuner_addr	= ADDR_UNSET,
2167
		.radio_addr     = ADDR_UNSET,
2168
		.svhs           = UNSET,
2169 2170 2171 2172
		.gpiomask       = 0xdf,
		.muxsel         = { 2 },
		.pll            = PLL_28,
	},
2173
	[BTTV_BOARD_XGUARD] = {
2174 2175 2176
		.name           = "Grand X-Guard / Trust 814PCI",
		.video_inputs   = 16,
		.audio_inputs   = 0,
2177 2178 2179
		.tuner          = UNSET,
		.svhs           = UNSET,
		.tuner_type     = TUNER_ABSENT,
2180
		.tuner_addr	= ADDR_UNSET,
2181
		.radio_addr     = ADDR_UNSET,
2182 2183 2184 2185 2186 2187 2188 2189 2190 2191
		.gpiomask2      = 0xff,
		.muxsel         = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 },
		.muxsel_hook    = xguard_muxsel,
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.pll            = PLL_28,
	},

		/* ---- card 0x68 ---------------------------------- */
2192
	[BTTV_BOARD_NEBULA_DIGITV] = {
2193 2194
		.name           = "Nebula Electronics DigiTV",
		.video_inputs   = 1,
2195 2196
		.tuner          = UNSET,
		.svhs           = UNSET,
M
 
Michael Krufky 已提交
2197
		.muxsel         = { 2, 3, 1, 0 },
2198 2199 2200 2201
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.pll            = PLL_28,
2202
		.tuner_type     = UNSET,
2203
		.tuner_addr	= ADDR_UNSET,
2204
		.radio_addr     = ADDR_UNSET,
2205
		.has_dvb        = 1,
2206 2207
		.has_remote	= 1,
		.gpiomask	= 0x1b,
2208 2209
		.no_gpioirq     = 1,
	},
2210
	[BTTV_BOARD_PV143] = {
2211 2212 2213 2214
		/* Jorge Boncompte - DTI2 <jorge@dti2.net> */
		.name           = "ProVideo PV143",
		.video_inputs   = 4,
		.audio_inputs   = 0,
2215 2216
		.tuner          = UNSET,
		.svhs           = UNSET,
2217 2218
		.gpiomask       = 0,
		.muxsel         = { 2, 3, 1, 0 },
2219
		.gpiomux        = { 0 },
2220 2221 2222
		.needs_tvaudio  = 0,
		.no_msp34xx     = 1,
		.pll            = PLL_28,
2223
		.tuner_type     = UNSET,
2224
		.tuner_addr	= ADDR_UNSET,
2225
		.radio_addr     = ADDR_UNSET,
2226
	},
2227
	[BTTV_BOARD_VD009X1_MINIDIN] = {
2228 2229 2230 2231
		/* M.Klahr@phytec.de */
		.name           = "PHYTEC VD-009-X1 MiniDIN (bt878)",
		.video_inputs   = 4,
		.audio_inputs   = 0,
2232
		.tuner          = UNSET, /* card has no tuner */
2233 2234
		.svhs           = 3,
		.gpiomask       = 0x00,
M
 
Michael Krufky 已提交
2235
		.muxsel         = { 2, 3, 1, 0 },
2236
		.gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2237 2238
		.needs_tvaudio  = 1,
		.pll            = PLL_28,
2239
		.tuner_type     = UNSET,
2240
		.tuner_addr	= ADDR_UNSET,
2241
		.radio_addr     = ADDR_UNSET,
2242
	},
2243
	[BTTV_BOARD_VD009X1_COMBI] = {
2244 2245 2246
		.name           = "PHYTEC VD-009-X1 Combi (bt878)",
		.video_inputs   = 4,
		.audio_inputs   = 0,
2247
		.tuner          = UNSET, /* card has no tuner */
2248 2249
		.svhs           = 3,
		.gpiomask       = 0x00,
M
 
Michael Krufky 已提交
2250
		.muxsel         = { 2, 3, 1, 1 },
2251
		.gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2252 2253
		.needs_tvaudio  = 1,
		.pll            = PLL_28,
2254
		.tuner_type     = UNSET,
2255
		.tuner_addr	= ADDR_UNSET,
2256
		.radio_addr     = ADDR_UNSET,
2257 2258 2259
	},

		/* ---- card 0x6c ---------------------------------- */
2260
	[BTTV_BOARD_VD009_MINIDIN] = {
2261 2262 2263
		.name           = "PHYTEC VD-009 MiniDIN (bt878)",
		.video_inputs   = 10,
		.audio_inputs   = 0,
2264
		.tuner          = UNSET, /* card has no tuner */
2265 2266 2267 2268 2269 2270
		.svhs           = 9,
		.gpiomask       = 0x00,
		.gpiomask2      = 0x03, /* gpiomask2 defines the bits used to switch audio
					via the upper nibble of muxsel. here: used for
					xternal video-mux */
		.muxsel         = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 },
2271
		.gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2272 2273
		.needs_tvaudio  = 1,
		.pll            = PLL_28,
2274
		.tuner_type     = UNSET,
2275
		.tuner_addr	= ADDR_UNSET,
2276
		.radio_addr     = ADDR_UNSET,
2277
	},
2278
	[BTTV_BOARD_VD009_COMBI] = {
2279 2280 2281
		.name           = "PHYTEC VD-009 Combi (bt878)",
		.video_inputs   = 10,
		.audio_inputs   = 0,
2282
		.tuner          = UNSET, /* card has no tuner */
2283 2284 2285 2286 2287 2288
		.svhs           = 9,
		.gpiomask       = 0x00,
		.gpiomask2      = 0x03, /* gpiomask2 defines the bits used to switch audio
					via the upper nibble of muxsel. here: used for
					xternal video-mux */
		.muxsel         = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 },
2289
		.gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2290 2291
		.needs_tvaudio  = 1,
		.pll            = PLL_28,
2292
		.tuner_type     = UNSET,
2293
		.tuner_addr	= ADDR_UNSET,
2294
		.radio_addr     = ADDR_UNSET,
2295
	},
2296
	[BTTV_BOARD_IVC100] = {
2297 2298 2299
		.name           = "IVC-100",
		.video_inputs   = 4,
		.audio_inputs   = 0,
2300 2301
		.tuner          = UNSET,
		.tuner_type     = UNSET,
2302
		.tuner_addr	= ADDR_UNSET,
2303
		.radio_addr     = ADDR_UNSET,
2304
		.svhs           = UNSET,
2305 2306 2307 2308
		.gpiomask       = 0xdf,
		.muxsel         = { 2, 3, 1, 0 },
		.pll            = PLL_28,
	},
2309
	[BTTV_BOARD_IVC120] = {
2310 2311 2312 2313
		/* IVC-120G - Alan Garfield <alan@fromorbit.com> */
		.name           = "IVC-120G",
		.video_inputs   = 16,
		.audio_inputs   = 0,    /* card has no audio */
2314 2315
		.tuner          = UNSET,   /* card has no tuner */
		.tuner_type     = UNSET,
2316
		.tuner_addr	= ADDR_UNSET,
2317
		.radio_addr     = ADDR_UNSET,
2318
		.svhs           = UNSET,   /* card has no svhs */
2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330
		.needs_tvaudio  = 0,
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.gpiomask       = 0x00,
		.muxsel         = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
				0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 },
		.muxsel_hook    = ivc120_muxsel,
		.pll            = PLL_28,
	},

		/* ---- card 0x70 ---------------------------------- */
2331
	[BTTV_BOARD_PC_HDTV] = {
2332 2333 2334 2335 2336
		.name           = "pcHDTV HD-2000 TV",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
M
 
Michael Krufky 已提交
2337
		.muxsel         = { 2, 3, 1, 0 },
2338 2339
		.tuner_type     = TUNER_PHILIPS_ATSC,
		.tuner_addr	= ADDR_UNSET,
2340
		.radio_addr     = ADDR_UNSET,
2341 2342
		.has_dvb        = 1,
	},
2343
	[BTTV_BOARD_TWINHAN_DST] = {
2344 2345 2346 2347 2348 2349
		.name           = "Twinhan DST + clones",
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.tuner_type     = TUNER_ABSENT,
		.tuner_addr	= ADDR_UNSET,
2350
		.radio_addr     = ADDR_UNSET,
2351 2352 2353
		.no_video       = 1,
		.has_dvb        = 1,
	},
2354
	[BTTV_BOARD_WINFASTVC100] = {
2355 2356 2357 2358
		.name           = "Winfast VC100",
		.video_inputs   = 3,
		.audio_inputs   = 0,
		.svhs           = 1,
2359
		.tuner          = UNSET,
M
 
Michael Krufky 已提交
2360
		.muxsel         = { 3, 1, 1, 3 }, /* Vid In, SVid In, Vid over SVid in connector */
2361 2362 2363 2364 2365
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.tuner_type     = TUNER_ABSENT,
		.tuner_addr	= ADDR_UNSET,
2366
		.radio_addr     = ADDR_UNSET,
2367 2368
		.pll            = PLL_28,
	},
2369
	[BTTV_BOARD_TEV560] = {
2370 2371 2372 2373 2374 2375
		.name           = "Teppro TEV-560/InterVision IV-560",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 3,
M
 
Michael Krufky 已提交
2376
		.muxsel         = { 2, 3, 1, 1 },
2377
		.gpiomux        = { 1, 1, 1, 1 },
2378 2379 2380
		.needs_tvaudio  = 1,
		.tuner_type     = TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
2381
		.radio_addr     = ADDR_UNSET,
2382 2383 2384 2385
		.pll            = PLL_35,
	},

		/* ---- card 0x74 ---------------------------------- */
2386
	[BTTV_BOARD_SIMUS_GVC1100] = {
2387 2388 2389
		.name           = "SIMUS GVC1100",
		.video_inputs   = 4,
		.audio_inputs   = 0,
2390 2391 2392
		.tuner          = UNSET,
		.svhs           = UNSET,
		.tuner_type     = UNSET,
2393
		.tuner_addr	= ADDR_UNSET,
2394
		.radio_addr     = ADDR_UNSET,
2395
		.pll            = PLL_28,
M
 
Michael Krufky 已提交
2396
		.muxsel         = { 2, 2, 2, 2 },
2397 2398 2399
		.gpiomask       = 0x3F,
		.muxsel_hook    = gvc1100_muxsel,
	},
2400
	[BTTV_BOARD_NGSTV_PLUS] = {
2401 2402 2403 2404 2405 2406
		/* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
		.name           = "NGS NGSTV+",
		.video_inputs   = 3,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x008007,
M
 
Michael Krufky 已提交
2407
		.muxsel         = { 2, 3, 0, 0 },
2408 2409
		.gpiomux        = { 0, 0, 0, 0 },
		.gpiomute 	= 0x000003,
2410 2411 2412
		.pll            = PLL_28,
		.tuner_type     = TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
2413
		.radio_addr     = ADDR_UNSET,
2414 2415
		.has_remote     = 1,
	},
2416
	[BTTV_BOARD_LMLBT4] = {
2417 2418 2419 2420
		/* http://linuxmedialabs.com */
		.name           = "LMLBT4",
		.video_inputs   = 4, /* IN1,IN2,IN3,IN4 */
		.audio_inputs   = 0,
2421 2422
		.tuner          = UNSET,
		.svhs           = UNSET,
2423 2424 2425 2426 2427
		.muxsel         = { 2, 3, 1, 0 },
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.needs_tvaudio  = 0,
2428
		.tuner_type     = UNSET,
2429
		.tuner_addr	= ADDR_UNSET,
2430
		.radio_addr     = ADDR_UNSET,
2431
	},
2432
	[BTTV_BOARD_TEKRAM_M205] = {
2433 2434 2435 2436 2437 2438 2439
		/* Helmroos Harri <harri.helmroos@pp.inet.fi> */
		.name           = "Tekram M205 PRO",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.tuner_type     = TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
2440
		.radio_addr     = ADDR_UNSET,
2441 2442 2443
		.svhs           = 2,
		.needs_tvaudio  = 0,
		.gpiomask       = 0x68,
M
 
Michael Krufky 已提交
2444
		.muxsel         = { 2, 3, 1 },
2445
		.gpiomux        = { 0x68, 0x68, 0x61, 0x61 },
2446 2447 2448 2449
		.pll            = PLL_28,
	},

		/* ---- card 0x78 ---------------------------------- */
2450
	[BTTV_BOARD_CONTVFMI] = {
2451 2452 2453 2454 2455 2456 2457 2458 2459
		/* Javier Cendan Ares <jcendan@lycos.es> */
		/* bt878 TV + FM without subsystem ID */
		.name           = "Conceptronic CONTVFMi",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x008007,
		.muxsel         = { 2, 3, 1, 1 },
2460 2461
		.gpiomux        = { 0, 1, 2, 2 },
		.gpiomute 	= 3,
2462 2463 2464 2465
		.needs_tvaudio  = 0,
		.pll            = PLL_28,
		.tuner_type     = TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
2466
		.radio_addr     = ADDR_UNSET,
2467 2468 2469
		.has_remote     = 1,
		.has_radio      = 1,
	},
2470
	[BTTV_BOARD_PICOLO_TETRA_CHIP] = {
2471 2472
		/*Eric DEBIEF <debief@telemsa.com>*/
		/*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2473
		/* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_BOARD_PICOLO_TETRA_CHIP*/
2474 2475 2476 2477
		/*0x79 in bttv.h*/
		.name           = "Euresys Picolo Tetra",
		.video_inputs   = 4,
		.audio_inputs   = 0,
2478 2479
		.tuner          = UNSET,
		.svhs           = UNSET,
2480 2481 2482 2483 2484 2485
		.gpiomask       = 0,
		.gpiomask2      = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.muxsel         = {2,2,2,2},/*878A input is always MUX0, see above.*/
2486
		.gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2487 2488 2489
		.pll            = PLL_28,
		.needs_tvaudio  = 0,
		.muxsel_hook    = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2490
		.tuner_type     = UNSET,
2491
		.tuner_addr	= ADDR_UNSET,
2492
		.radio_addr     = ADDR_UNSET,
2493
	},
2494
	[BTTV_BOARD_SPIRIT_TV] = {
2495 2496 2497 2498 2499 2500 2501 2502 2503
		/* Spirit TV Tuner from http://spiritmodems.com.au */
		/* Stafford Goodsell <surge@goliath.homeunix.org> */
		.name           = "Spirit TV Tuner",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x0000000f,
		.muxsel         = { 2, 1, 1 },
2504
		.gpiomux        = { 0x02, 0x00, 0x00, 0x00 },
2505 2506
		.tuner_type     = TUNER_TEMIC_PAL,
		.tuner_addr	= ADDR_UNSET,
2507
		.radio_addr     = ADDR_UNSET,
2508 2509 2510
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
	},
2511
	[BTTV_BOARD_AVDVBT_771] = {
2512 2513 2514 2515
		/* Wolfram Joost <wojo@frokaschwei.de> */
		.name           = "AVerMedia AVerTV DVB-T 771",
		.video_inputs   = 2,
		.svhs           = 1,
2516
		.tuner          = UNSET,
2517 2518
		.tuner_type     = TUNER_ABSENT,
		.tuner_addr	= ADDR_UNSET,
2519
		.radio_addr     = ADDR_UNSET,
2520 2521 2522 2523 2524 2525 2526 2527 2528 2529
		.muxsel         = { 3 , 3 },
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.pll            = PLL_28,
		.has_dvb        = 1,
		.no_gpioirq     = 1,
		.has_remote     = 1,
	},
		/* ---- card 0x7c ---------------------------------- */
2530
	[BTTV_BOARD_AVDVBT_761] = {
2531
		/* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2532
		/* Based on the Nebula card data - added remote and new card number - BTTV_BOARD_AVDVBT_761, see also ir-kbd-gpio.c */
2533 2534
		.name           = "AverMedia AverTV DVB-T 761",
		.video_inputs   = 2,
2535
		.tuner          = UNSET,
2536
		.svhs           = 1,
M
 
Michael Krufky 已提交
2537
		.muxsel         = { 3, 1, 2, 0 }, /* Comp0, S-Video, ?, ? */
2538 2539 2540 2541
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.pll            = PLL_28,
2542
		.tuner_type     = UNSET,
2543
		.tuner_addr	= ADDR_UNSET,
2544
		.radio_addr     = ADDR_UNSET,
2545 2546 2547 2548
		.has_dvb        = 1,
		.no_gpioirq     = 1,
		.has_remote     = 1,
	},
2549
	[BTTV_BOARD_MATRIX_VISIONSQ] = {
2550 2551 2552 2553
		/* andre.schwarz@matrix-vision.de */
		.name             = "MATRIX Vision Sigma-SQ",
		.video_inputs     = 16,
		.audio_inputs     = 0,
2554 2555
		.tuner            = UNSET,
		.svhs             = UNSET,
2556 2557 2558 2559
		.gpiomask         = 0x0,
		.muxsel           = { 2, 2, 2, 2, 2, 2, 2, 2,
				3, 3, 3, 3, 3, 3, 3, 3 },
		.muxsel_hook      = sigmaSQ_muxsel,
2560
		.gpiomux          = { 0 },
2561 2562
		.no_msp34xx       = 1,
		.pll              = PLL_28,
2563
		.tuner_type       = UNSET,
2564
		.tuner_addr	  = ADDR_UNSET,
2565
		.radio_addr     = ADDR_UNSET,
2566
	},
2567
	[BTTV_BOARD_MATRIX_VISIONSLC] = {
2568 2569 2570 2571
		/* andre.schwarz@matrix-vision.de */
		.name             = "MATRIX Vision Sigma-SLC",
		.video_inputs     = 4,
		.audio_inputs     = 0,
2572 2573
		.tuner            = UNSET,
		.svhs             = UNSET,
2574 2575 2576
		.gpiomask         = 0x0,
		.muxsel           = { 2, 2, 2, 2 },
		.muxsel_hook      = sigmaSLC_muxsel,
2577
		.gpiomux          = { 0 },
2578 2579
		.no_msp34xx       = 1,
		.pll              = PLL_28,
2580
		.tuner_type       = UNSET,
2581
		.tuner_addr	  = ADDR_UNSET,
2582
		.radio_addr     = ADDR_UNSET,
2583
	},
2584 2585
		/* BTTV_BOARD_APAC_VIEWCOMP */
	[BTTV_BOARD_APAC_VIEWCOMP] = {
2586 2587 2588 2589 2590 2591
		/* Attila Kondoros <attila.kondoros@chello.hu> */
		/* bt878 TV + FM 0x00000000 subsystem ID */
		.name           = "APAC Viewcomp 878(AMAX)",
		.video_inputs   = 2,
		.audio_inputs   = 1,
		.tuner          = 0,
2592
		.svhs           = UNSET,
2593
		.gpiomask       = 0xFF,
M
 
Michael Krufky 已提交
2594
		.muxsel         = { 2, 3, 1, 1 },
2595 2596
		.gpiomux        = { 2, 0, 0, 0 },
		.gpiomute 	= 10,
2597 2598 2599 2600
		.needs_tvaudio  = 0,
		.pll            = PLL_28,
		.tuner_type     = TUNER_PHILIPS_PAL,
		.tuner_addr	= ADDR_UNSET,
2601
		.radio_addr     = ADDR_UNSET,
2602 2603 2604 2605 2606
		.has_remote     = 1,   /* miniremote works, see ir-kbd-gpio.c */
		.has_radio      = 1,   /* not every card has radio */
	},

		/* ---- card 0x80 ---------------------------------- */
2607
	[BTTV_BOARD_DVICO_DVBT_LITE] = {
2608 2609
		/* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
		.name           = "DViCO FusionHDTV DVB-T Lite",
2610
		.tuner          = UNSET,
2611 2612 2613 2614 2615 2616
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.pll            = PLL_28,
		.no_video       = 1,
		.has_dvb        = 1,
2617
		.tuner_type     = UNSET,
2618
		.tuner_addr	= ADDR_UNSET,
2619
		.radio_addr     = ADDR_UNSET,
2620
	},
2621
	[BTTV_BOARD_VGEAR_MYVCD] = {
2622 2623 2624 2625 2626 2627 2628
		/* Steven <photon38@pchome.com.tw> */
		.name           = "V-Gear MyVCD",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x3f,
M
 
Michael Krufky 已提交
2629
		.muxsel         = {2, 3, 1, 0 },
2630 2631
		.gpiomux        = {0x31, 0x31, 0x31, 0x31 },
		.gpiomute 	= 0x31,
2632 2633 2634 2635
		.no_msp34xx     = 1,
		.pll            = PLL_28,
		.tuner_type     = TUNER_PHILIPS_NTSC_M,
		.tuner_addr	= ADDR_UNSET,
2636
		.radio_addr     = ADDR_UNSET,
2637 2638
		.has_radio      = 0,
	},
2639
	[BTTV_BOARD_SUPER_TV] = {
2640 2641 2642 2643 2644 2645
		/* Rick C <cryptdragoon@gmail.com> */
		.name           = "Super TV Tuner",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
M
 
Michael Krufky 已提交
2646
		.muxsel         = { 2, 3, 1, 0 },
2647 2648
		.tuner_type     = TUNER_PHILIPS_NTSC,
		.tuner_addr	= ADDR_UNSET,
2649
		.radio_addr     = ADDR_UNSET,
2650
		.gpiomask       = 0x008007,
2651
		.gpiomux        = { 0, 0x000001,0,0 },
2652 2653 2654
		.needs_tvaudio  = 1,
		.has_radio      = 1,
	},
2655
	[BTTV_BOARD_TIBET_CS16] = {
2656 2657 2658 2659
		/* Chris Fanning <video4linux@haydon.net> */
		.name           = "Tibet Systems 'Progress DVR' CS16",
		.video_inputs   = 16,
		.audio_inputs   = 0,
2660 2661
		.tuner          = UNSET,
		.svhs           = UNSET,
2662 2663 2664 2665 2666
		.muxsel         = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
		.pll		= PLL_28,
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432	= 1,
2667
		.tuner_type     = UNSET,
2668
		.tuner_addr	= ADDR_UNSET,
2669
		.radio_addr     = ADDR_UNSET,
2670 2671
		.muxsel_hook    = tibetCS16_muxsel,
	},
2672
	[BTTV_BOARD_KODICOM_4400R] = {
2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686
		/* Bill Brack <wbrack@mmm.com.hk> */
		/*
		* Note that, because of the card's wiring, the "master"
		* BT878A chip (i.e. the one which controls the analog switch
		* and must use this card type) is the 2nd one detected.  The
		* other 3 chips should use card type 0x85, whose description
		* follows this one.  There is a EEPROM on the card (which is
		* connected to the I2C of one of those other chips), but is
		* not currently handled.  There is also a facility for a
		* "monitor", which is also not currently implemented.
		*/
		.name           = "Kodicom 4400R (master)",
		.video_inputs	= 16,
		.audio_inputs	= 0,
2687 2688
		.tuner		= UNSET,
		.tuner_type	= UNSET,
2689
		.tuner_addr	= ADDR_UNSET,
2690
		.radio_addr     = ADDR_UNSET,
2691
		.svhs		= UNSET,
2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708
		/* GPIO bits 0-9 used for analog switch:
		*   00 - 03:	camera selector
		*   04 - 06:	channel (controller) selector
		*   07:	data (1->on, 0->off)
		*   08:	strobe
		*   09:	reset
		* bit 16 is input from sync separator for the channel
		*/
		.gpiomask	= 0x0003ff,
		.no_gpioirq     = 1,
		.muxsel		= { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
		.pll		= PLL_28,
		.no_msp34xx	= 1,
		.no_tda7432	= 1,
		.no_tda9875	= 1,
		.muxsel_hook	= kodicom4400r_muxsel,
	},
2709
	[BTTV_BOARD_KODICOM_4400R_SL] = {
2710 2711 2712 2713 2714 2715 2716 2717 2718
		/* Bill Brack <wbrack@mmm.com.hk> */
		/* Note that, for reasons unknown, the "master" BT878A chip (i.e. the
		* one which controls the analog switch, and must use the card type)
		* is the 2nd one detected.  The other 3 chips should use this card
		* type
		*/
		.name		= "Kodicom 4400R (slave)",
		.video_inputs	= 16,
		.audio_inputs	= 0,
2719 2720
		.tuner		= UNSET,
		.tuner_type	= UNSET,
2721
		.tuner_addr	= ADDR_UNSET,
2722
		.radio_addr     = ADDR_UNSET,
2723
		.svhs		= UNSET,
2724 2725 2726 2727 2728 2729 2730 2731 2732 2733
		.gpiomask	= 0x010000,
		.no_gpioirq     = 1,
		.muxsel		= { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
		.pll		= PLL_28,
		.no_msp34xx	= 1,
		.no_tda7432	= 1,
		.no_tda9875	= 1,
		.muxsel_hook	= kodicom4400r_muxsel,
	},
		/* ---- card 0x86---------------------------------- */
2734
	[BTTV_BOARD_ADLINK_RTV24] = {
2735 2736 2737 2738 2739 2740 2741
		/* Michael Henson <mhenson@clarityvi.com> */
		/* Adlink RTV24 with special unlock codes */
		.name           = "Adlink RTV24",
		.video_inputs   = 4,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
M
 
Michael Krufky 已提交
2742
		.muxsel         = { 2, 3, 1, 0 },
2743
		.tuner_type     = UNSET,
2744
		.tuner_addr	= ADDR_UNSET,
2745
		.radio_addr     = ADDR_UNSET,
2746 2747 2748
		.pll            = PLL_28,
	},
		/* ---- card 0x87---------------------------------- */
2749
	[BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE] = {
2750 2751 2752
		/* Michael Krufky <mkrufky@m1k.net> */
		.name           = "DViCO FusionHDTV 5 Lite",
		.tuner          = 0,
2753
		.tuner_type     = TUNER_LG_TDVS_H06XF, /* TDVS-H064F */
2754
		.tuner_addr	= ADDR_UNSET,
2755
		.radio_addr     = ADDR_UNSET,
2756
		.video_inputs   = 3,
2757 2758
		.audio_inputs   = 1,
		.svhs           = 2,
2759
		.muxsel		= { 2, 3, 1 },
2760
		.gpiomask       = 0x00e00007,
2761 2762
		.gpiomux        = { 0x00400005, 0, 0x00000001, 0 },
		.gpiomute 	= 0x00c00007,
2763 2764 2765 2766 2767 2768
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.has_dvb        = 1,
	},
		/* ---- card 0x88---------------------------------- */
2769
	[BTTV_BOARD_ACORP_Y878F] = {
2770
		/* Mauro Carvalho Chehab <mchehab@infradead.org> */
2771 2772 2773 2774 2775 2776
		.name		= "Acorp Y878F",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x01fe00,
M
 
Michael Krufky 已提交
2777
		.muxsel		= { 2, 3, 1, 1 },
2778 2779
		.gpiomux        = { 0x001e00, 0, 0x018000, 0x014000 },
		.gpiomute 	= 0x002000,
2780 2781 2782 2783
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_YMEC_TVF66T5_B_DFF,
		.tuner_addr	= 0xc1 >>1,
2784
		.radio_addr     = 0xc1 >>1,
2785 2786 2787
		.has_radio	= 1,
	},
		/* ---- card 0x89 ---------------------------------- */
2788
	[BTTV_BOARD_CONCEPTRONIC_CTVFMI2] = {
2789 2790 2791 2792 2793 2794 2795
		.name           = "Conceptronic CTVFMi v2",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x001c0007,
		.muxsel         = { 2, 3, 1, 1 },
2796 2797
		.gpiomux        = { 0, 1, 2, 2 },
		.gpiomute 	= 3,
2798 2799
		.needs_tvaudio  = 0,
		.pll            = PLL_28,
2800
		.tuner_type     = TUNER_TENA_9533_DI,
2801
		.tuner_addr	= ADDR_UNSET,
2802
		.radio_addr     = ADDR_UNSET,
2803 2804 2805
		.has_remote     = 1,
		.has_radio      = 1,
	},
2806
		/* ---- card 0x8a ---------------------------------- */
2807
	[BTTV_BOARD_PV_BT878P_2E] = {
2808 2809 2810 2811 2812 2813 2814 2815
		.name          = "Prolink Pixelview PV-BT878P+ (Rev.2E)",
		.video_inputs  = 5,
		.audio_inputs  = 1,
		.tuner         = 0,
		.svhs          = 3,
		.gpiomask      = 0x01fe00,
		.muxsel        = { 2,3,1,1,-1 },
		.digital_mode  = DIGITAL_MODE_CAMERA,
2816 2817
		.gpiomux       = { 0x00400, 0x10400, 0x04400, 0x80000 },
		.gpiomute      = 0x12400,
2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834
		.no_msp34xx    = 1,
		.pll           = PLL_28,
		.tuner_type    = TUNER_LG_PAL_FM,
		.tuner_addr	= ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
		.has_remote    = 1,
	},
		/* ---- card 0x8b ---------------------------------- */
	[BTTV_BOARD_PV_M4900] = {
		/* Srgio Fortier <sergiofortier@yahoo.com.br> */
		.name           = "Prolink PixelView PlayTV MPEG2 PV-M4900",
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 0x3f,
		.muxsel         = { 2, 3, 1, 1 },
2835 2836
		.gpiomux        = { 0x21, 0x20, 0x24, 0x2c },
		.gpiomute 	= 0x29,
2837 2838 2839 2840 2841 2842 2843
		.no_msp34xx     = 1,
		.pll            = PLL_28,
		.tuner_type     = TUNER_YMEC_TVF_5533MF,
		.tuner_addr     = ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
		.has_radio      = 1,
		.has_remote     = 1,
2844
	},
2845
		/* ---- card 0x8c ---------------------------------- */
2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857
	/* Has four Bt878 chips behind a PCI bridge, each chip has:
	     one external BNC composite input (mux 2)
	     three internal composite inputs (unknown muxes)
	     an 18-bit stereo A/D (CS5331A), which has:
	       one external stereo unblanced (RCA) audio connection
	       one (or 3?) internal stereo balanced (XLR) audio connection
	       input is selected via gpio to a 14052B mux
		 (mask=0x300, unbal=0x000, bal=0x100, ??=0x200,0x300)
	       gain is controlled via an X9221A chip on the I2C bus @0x28
	       sample rate is controlled via gpio to an MK1413S
		 (mask=0x3, 32kHz=0x0, 44.1kHz=0x1, 48kHz=0x2, ??=0x3)
	     There is neither a tuner nor an svideo input. */
2858 2859
	[BTTV_BOARD_OSPREY440]  = {
		.name           = "Osprey 440",
2860 2861
		.video_inputs   = 4,
		.audio_inputs   = 2, /* this is meaningless */
2862
		.tuner          = UNSET,
2863 2864 2865 2866 2867
		.svhs           = UNSET,
		.muxsel         = { 2, 3, 0, 1 }, /* 3,0,1 are guesses */
		.gpiomask	= 0x303,
		.gpiomute	= 0x000, /* int + 32kHz */
		.gpiomux	= { 0, 0, 0x000, 0x100},
2868 2869 2870 2871 2872 2873 2874 2875
		.pll            = PLL_28,
		.tuner_type     = UNSET,
		.tuner_addr     = ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
2876 2877 2878 2879 2880 2881 2882 2883
		/* ---- card 0x8d ---------------------------------- */
	[BTTV_BOARD_ASOUND_SKYEYE] = {
		.name		= "Asound Skyeye PCTV",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 15,
M
 
Michael Krufky 已提交
2884
		.muxsel		= { 2, 3, 1, 1 },
2885 2886
		.gpiomux 	= { 2, 0, 0, 0 },
		.gpiomute 	= 1,
2887 2888
		.needs_tvaudio	= 1,
		.pll		= PLL_28,
2889
		.tuner_type	= TUNER_PHILIPS_NTSC,
2890 2891 2892
		.tuner_addr	= ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
	},
2893 2894 2895 2896 2897 2898 2899 2900
		/* ---- card 0x8e ---------------------------------- */
	[BTTV_BOARD_SABRENT_TVFM] = {
		.name		= "Sabrent TV-FM (bttv version)",
		.video_inputs	= 3,
		.audio_inputs	= 1,
		.tuner		= 0,
		.svhs		= 2,
		.gpiomask	= 0x108007,
M
 
Michael Krufky 已提交
2901
		.muxsel		= { 2, 3, 1, 1 },
2902
		.gpiomux 	= { 100000, 100002, 100002, 100000 },
2903 2904 2905 2906 2907 2908 2909 2910
		.no_msp34xx	= 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
		.pll		= PLL_28,
		.tuner_type	= TUNER_TNF_5335MF,
		.tuner_addr	= ADDR_UNSET,
		.has_radio      = 1,
	},
2911 2912 2913 2914 2915
	/* ---- card 0x8f ---------------------------------- */
	[BTTV_BOARD_HAUPPAUGE_IMPACTVCB] = {
		.name		= "Hauppauge ImpactVCB (bt878)",
		.video_inputs	= 4,
		.audio_inputs	= 0,
2916 2917
		.tuner		= UNSET,
		.svhs		= UNSET,
2918
		.gpiomask	= 0x0f, /* old: 7 */
M
 
Michael Krufky 已提交
2919
		.muxsel		= { 0, 1, 3, 2 }, /* Composite 0-3 */
2920 2921 2922
		.no_msp34xx	= 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
2923
		.tuner_type	= UNSET,
2924 2925 2926
		.tuner_addr	= ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
	},
J
 
Julian Calaby 已提交
2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941
	[BTTV_BOARD_MACHTV_MAGICTV] = {
		/* Julian Calaby <julian.calaby@gmail.com>
		 * Slightly different from original MachTV definition (0x60)

		 * FIXME: RegSpy says gpiomask should be "0x001c800f", but it
		 * stuffs up remote chip. Bug is a pin on the jaecs is not set
		 * properly (methinks) causing no keyup bits being set */

		.name           = "MagicTV", /* rebranded MachTV */
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.tuner          = 0,
		.svhs           = 2,
		.gpiomask       = 7,
		.muxsel         = { 2, 3, 1, 1 },
2942 2943
		.gpiomux        = { 0, 1, 2, 3 },
		.gpiomute 	= 4,
J
 
Julian Calaby 已提交
2944 2945 2946 2947 2948 2949 2950
		.tuner_type     = TUNER_TEMIC_4009FR5_PAL,
		.tuner_addr     = ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
		.pll            = PLL_28,
		.has_radio      = 1,
		.has_remote     = 1,
	},
2951 2952 2953 2954
	[BTTV_BOARD_SSAI_SECURITY] = {
		.name		= "SSAI Security Video Interface",
		.video_inputs	= 4,
		.audio_inputs	= 0,
2955 2956
		.tuner		= UNSET,
		.svhs		= UNSET,
2957
		.muxsel		= { 0, 1, 2, 3 },
2958
		.tuner_type	= UNSET,
2959 2960 2961 2962 2963 2964 2965
		.tuner_addr	= ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
	},
	[BTTV_BOARD_SSAI_ULTRASOUND] = {
		.name		= "SSAI Ultrasound Video Interface",
		.video_inputs	= 2,
		.audio_inputs	= 0,
2966
		.tuner		= UNSET,
2967 2968
		.svhs		= 1,
		.muxsel		= { 2, 0, 1, 3 },
2969
		.tuner_type	= UNSET,
2970 2971 2972
		.tuner_addr	= ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
	},
2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990
	/* ---- card 0x94---------------------------------- */
	[BTTV_BOARD_DVICO_FUSIONHDTV_2] = {
		.name           = "DViCO FusionHDTV 2",
		.tuner          = 0,
		.tuner_type     = TUNER_PHILIPS_ATSC, /* FCV1236D */
		.tuner_addr	= ADDR_UNSET,
		.radio_addr     = ADDR_UNSET,
		.video_inputs   = 3,
		.audio_inputs   = 1,
		.svhs           = 2,
		.muxsel		= { 2, 3, 1 },
		.gpiomask       = 0x00e00007,
		.gpiomux        = { 0x00400005, 0, 0x00000001, 0 },
		.gpiomute 	= 0x00c00007,
		.no_msp34xx     = 1,
		.no_tda9875     = 1,
		.no_tda7432     = 1,
	},
2991
};
L
Linus Torvalds 已提交
2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033

static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);

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

static unsigned char eeprom_data[256];

/*
 * identify card
 */
void __devinit bttv_idcard(struct bttv *btv)
{
	unsigned int gpiobits;
	int i,type;
	unsigned short tmp;

	/* read PCI subsystem ID */
	pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
	btv->cardid = tmp << 16;
	pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
	btv->cardid |= tmp;

	if (0 != btv->cardid && 0xffffffff != btv->cardid) {
		/* look for the card */
		for (type = -1, i = 0; cards[i].id != 0; i++)
			if (cards[i].id  == btv->cardid)
				type = i;

		if (type != -1) {
			/* found it */
			printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
			       "PCI subsystem ID is %04x:%04x\n",
			       btv->c.nr,cards[type].name,cards[type].cardnr,
			       btv->cardid & 0xffff,
			       (btv->cardid >> 16) & 0xffff);
			btv->c.type = cards[type].cardnr;
		} else {
			/* 404 */
			printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
			       btv->c.nr, btv->cardid & 0xffff,
			       (btv->cardid >> 16) & 0xffff);
			printk(KERN_DEBUG "please mail id, board name and "
3034
			       "the correct card= insmod option to video4linux-list@redhat.com\n");
L
Linus Torvalds 已提交
3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053
		}
	}

	/* let the user override the autodetected type */
	if (card[btv->c.nr] < bttv_num_tvcards)
		btv->c.type=card[btv->c.nr];

	/* print which card config we are using */
	printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
	       bttv_tvcards[btv->c.type].name, btv->c.type,
	       card[btv->c.nr] < bttv_num_tvcards
	       ? "insmod option" : "autodetected");

	/* overwrite gpio stuff ?? */
	if (UNSET == audioall && UNSET == audiomux[0])
		return;

	if (UNSET != audiomux[0]) {
		gpiobits = 0;
3054
		for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
3055
			bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];
L
Linus Torvalds 已提交
3056 3057 3058 3059
			gpiobits |= audiomux[i];
		}
	} else {
		gpiobits = audioall;
3060
		for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
3061
			bttv_tvcards[btv->c.type].gpiomux[i] = audioall;
L
Linus Torvalds 已提交
3062 3063 3064 3065 3066
		}
	}
	bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
	printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
	       btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
3067
	for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
3068
		printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]);
L
Linus Torvalds 已提交
3069 3070 3071 3072 3073 3074 3075 3076 3077
	}
	printk("\n");
}

/*
 * (most) board specific initialisations goes here
 */

/* Some Modular Technology cards have an eeprom, but no subsystem ID */
3078
static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
L
Linus Torvalds 已提交
3079 3080 3081 3082
{
	int type = -1;

	if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
3083
		type = BTTV_BOARD_MODTEC_205;
L
Linus Torvalds 已提交
3084
	else if (0 == strncmp(eeprom_data+20,"Picolo",7))
3085
		type = BTTV_BOARD_EURESYS_PICOLO;
L
Linus Torvalds 已提交
3086
	else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
3087
		type = BTTV_BOARD_HAUPPAUGE; /* old bt848 */
L
Linus Torvalds 已提交
3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098

	if (-1 != type) {
		btv->c.type = type;
		printk("bttv%d: detected by eeprom: %s [card=%d]\n",
		       btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
	}
}

static void flyvideo_gpio(struct bttv *btv)
{
	int gpio,has_remote,has_radio,is_capture_only,is_lr90,has_tda9820_tda9821;
3099
	int tuner=UNSET,ttype;
L
Linus Torvalds 已提交
3100 3101

	gpio_inout(0xffffff, 0);
3102
	udelay(8);  /* without this we would see the 0x1800 mask */
L
Linus Torvalds 已提交
3103 3104 3105
	gpio = gpio_read();
	/* FIXME: must restore OUR_EN ??? */

3106 3107 3108 3109 3110
	/* all cards provide GPIO info, some have an additional eeprom
	 * LR50: GPIO coding can be found lower right CP1 .. CP9
	 *       CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
	 *       GPIO14-12: n.c.
	 * LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
L
Linus Torvalds 已提交
3111

3112 3113 3114 3115 3116
	 * lowest 3 bytes are remote control codes (no handshake needed)
	 * xxxFFF: No remote control chip soldered
	 * xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
	 * Note: Some bits are Audio_Mask !
	 */
L
Linus Torvalds 已提交
3117 3118
	ttype=(gpio&0x0f0000)>>16;
	switch(ttype) {
3119
	case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */
L
Linus Torvalds 已提交
3120
		break;
3121
	case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */
L
Linus Torvalds 已提交
3122
		break;
3123
	case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */
L
Linus Torvalds 已提交
3124
		break;
3125
	case 0x6: tuner=37;/* LG PAL (newer TAPC series) TAPC-G702P */
L
Linus Torvalds 已提交
3126
		break;
3127
		case 0xC: tuner=3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */
L
Linus Torvalds 已提交
3128 3129 3130 3131 3132 3133 3134
		break;
	default:
		printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
	}

	has_remote          =   gpio & 0x800000;
	has_radio	    =   gpio & 0x400000;
3135 3136
	/*   unknown                   0x200000;
	 *   unknown2                  0x100000; */
3137
	is_capture_only     = !(gpio & 0x008000); /* GPIO15 */
L
Linus Torvalds 已提交
3138
	has_tda9820_tda9821 = !(gpio & 0x004000);
3139 3140 3141
	is_lr90             = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */
	/*
	 * gpio & 0x001000    output bit for audio routing */
L
Linus Torvalds 已提交
3142 3143

	if(is_capture_only)
3144
		tuner = TUNER_ABSENT; /* No tuner present */
L
Linus Torvalds 已提交
3145 3146 3147 3148 3149 3150 3151

	printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
	       btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio);
	printk(KERN_INFO "bttv%d: FlyVideo  LR90=%s tda9821/tda9820=%s capture_only=%s\n",
		btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ",
		is_capture_only?"yes":"no ");

3152
	if (tuner != UNSET) /* only set if known tuner autodetected, else let insmod option through */
L
Linus Torvalds 已提交
3153 3154 3155
		btv->tuner_type = tuner;
	btv->has_radio = has_radio;

3156 3157 3158
	/* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
	 * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
	 * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
L
Linus Torvalds 已提交
3159
	if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio;
3160
	/* todo: if(has_tda9874) btv->audio_hook = fv2000s_audio; */
L
Linus Torvalds 已提交
3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173
}

static int miro_tunermap[] = { 0,6,2,3,   4,5,6,0,  3,0,4,5,  5,2,16,1,
			       14,2,17,1, 4,1,4,3,  1,2,16,1, 4,4,4,4 };
static int miro_fmtuner[]  = { 0,0,0,0,   0,0,0,0,  0,0,0,0,  0,0,0,1,
			       1,1,1,1,   1,1,1,0,  0,0,0,0,  0,1,0,0 };

static void miro_pinnacle_gpio(struct bttv *btv)
{
	int id,msp,gpio;
	char *info;

	gpio_inout(0xffffff, 0);
3174
	gpio = gpio_read();
L
Linus Torvalds 已提交
3175
	id   = ((gpio>>10) & 63) -1;
3176
	msp  = bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx");
L
Linus Torvalds 已提交
3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192
	if (id < 32) {
		btv->tuner_type = miro_tunermap[id];
		if (0 == (gpio & 0x20)) {
			btv->has_radio = 1;
			if (!miro_fmtuner[id]) {
				btv->has_matchbox = 1;
				btv->mbox_we    = (1<<6);
				btv->mbox_most  = (1<<7);
				btv->mbox_clk   = (1<<8);
				btv->mbox_data  = (1<<9);
				btv->mbox_mask  = (1<<6)|(1<<7)|(1<<8)|(1<<9);
			}
		} else {
			btv->has_radio = 0;
		}
		if (-1 != msp) {
3193 3194 3195 3196
			if (btv->c.type == BTTV_BOARD_MIRO)
				btv->c.type = BTTV_BOARD_MIROPRO;
			if (btv->c.type == BTTV_BOARD_PINNACLE)
				btv->c.type = BTTV_BOARD_PINNACLEPRO;
L
Linus Torvalds 已提交
3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210
		}
		printk(KERN_INFO
		       "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
		       btv->c.nr, id+1, btv->tuner_type,
		       !btv->has_radio ? "no" :
		       (btv->has_matchbox ? "matchbox" : "fmtuner"),
		       (-1 == msp) ? "no" : "yes");
	} else {
		/* new cards with microtune tuner */
		id = 63 - id;
		btv->has_radio = 0;
		switch (id) {
		case 1:
			info = "PAL / mono";
3211
			btv->tda9887_conf = TDA9887_INTERCARRIER;
L
Linus Torvalds 已提交
3212 3213 3214 3215
			break;
		case 2:
			info = "PAL+SECAM / stereo";
			btv->has_radio = 1;
3216
			btv->tda9887_conf = TDA9887_QSS;
L
Linus Torvalds 已提交
3217 3218 3219 3220
			break;
		case 3:
			info = "NTSC / stereo";
			btv->has_radio = 1;
3221
			btv->tda9887_conf = TDA9887_QSS;
L
Linus Torvalds 已提交
3222 3223 3224
			break;
		case 4:
			info = "PAL+SECAM / mono";
3225
			btv->tda9887_conf = TDA9887_QSS;
L
Linus Torvalds 已提交
3226 3227 3228
			break;
		case 5:
			info = "NTSC / mono";
3229
			btv->tda9887_conf = TDA9887_INTERCARRIER;
L
Linus Torvalds 已提交
3230 3231 3232
			break;
		case 6:
			info = "NTSC / stereo";
3233
			btv->tda9887_conf = TDA9887_INTERCARRIER;
L
Linus Torvalds 已提交
3234 3235 3236
			break;
		case 7:
			info = "PAL / stereo";
3237
			btv->tda9887_conf = TDA9887_INTERCARRIER;
L
Linus Torvalds 已提交
3238 3239 3240 3241 3242 3243
			break;
		default:
			info = "oops: unknown card";
			break;
		}
		if (-1 != msp)
3244
			btv->c.type = BTTV_BOARD_PINNACLEPRO;
L
Linus Torvalds 已提交
3245 3246 3247
		printk(KERN_INFO
		       "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
		       btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
3248
		btv->tuner_type = TUNER_MT2032;
L
Linus Torvalds 已提交
3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290
	}
}

/* GPIO21   L: Buffer aktiv, H: Buffer inaktiv */
#define LM1882_SYNC_DRIVE     0x200000L

static void init_ids_eagle(struct bttv *btv)
{
	gpio_inout(0xffffff,0xFFFF37);
	gpio_write(0x200020);

	/* flash strobe inverter ?! */
	gpio_write(0x200024);

	/* switch sync drive off */
	gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);

	/* set BT848 muxel to 2 */
	btaor((2)<<5, ~(2<<5), BT848_IFORM);
}

/* Muxsel helper for the IDS Eagle.
 * the eagles does not use the standard muxsel-bits but
 * has its own multiplexer */
static void eagle_muxsel(struct bttv *btv, unsigned int input)
{
	btaor((2)<<5, ~(3<<5), BT848_IFORM);
	gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);

       /* composite */
       /* set chroma ADC to sleep */
       btor(BT848_ADC_C_SLEEP, BT848_ADC);
       /* set to composite video */
       btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
       btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);

       /* switch sync drive off */
       gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
}

static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
{
3291
	static const int masks[] = {0x30, 0x01, 0x12, 0x23};
L
Linus Torvalds 已提交
3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356
	gpio_write(masks[input%4]);
}

/* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
   alarms output

   GPIObit    | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
   assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1|   |   |

   IN - sensor inputs, INx - sensor inputs and TI XORed together
   O1,O2,O3 - alarm outputs (relays)

   OUT ENABLE   1    1   0  . 1  1   0   0 . 0   0   0    0   = 0x6C0

*/

static void init_lmlbt4x(struct bttv *btv)
{
	printk(KERN_DEBUG "LMLBT4x init\n");
	btwrite(0x000000, BT848_GPIO_REG_INP);
	gpio_inout(0xffffff, 0x0006C0);
	gpio_write(0x000000);
}

static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
{
	unsigned int inmux = input % 8;
	gpio_inout( 0xf, 0xf );
	gpio_bits( 0xf, inmux );
}

static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
{
	unsigned int inmux = input % 4;
	gpio_inout( 3<<9, 3<<9 );
	gpio_bits( 3<<9, inmux<<9 );
}

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

static void bttv_reset_audio(struct bttv *btv)
{
	/*
	 * BT878A has a audio-reset register.
	 * 1. This register is an audio reset function but it is in
	 *    function-0 (video capture) address space.
	 * 2. It is enough to do this once per power-up of the card.
	 * 3. There is a typo in the Conexant doc -- it is not at
	 *    0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
	 * --//Shrikumar 030609
	 */
	if (btv->id != 878)
		return;

	if (bttv_debug)
		printk("bttv%d: BT878A ARESET\n",btv->c.nr);
	btwrite((1<<7), 0x058);
	udelay(10);
	btwrite(     0, 0x058);
}

/* initialization part one -- before registering i2c bus */
void __devinit bttv_init_card1(struct bttv *btv)
{
	switch (btv->c.type) {
3357 3358
	case BTTV_BOARD_HAUPPAUGE:
	case BTTV_BOARD_HAUPPAUGE878:
3359
		boot_msp34xx(btv,5);
L
Linus Torvalds 已提交
3360
		break;
3361
	case BTTV_BOARD_VOODOOTV_200:
3362
	case BTTV_BOARD_VOODOOTV_FM:
3363
		boot_msp34xx(btv,20);
L
Linus Torvalds 已提交
3364
		break;
3365
	case BTTV_BOARD_AVERMEDIA98:
L
Linus Torvalds 已提交
3366 3367
		boot_msp34xx(btv,11);
		break;
3368
	case BTTV_BOARD_HAUPPAUGEPVR:
L
Linus Torvalds 已提交
3369 3370
		pvr_boot(btv);
		break;
3371 3372 3373
	case BTTV_BOARD_TWINHAN_DST:
	case BTTV_BOARD_AVDVBT_771:
	case BTTV_BOARD_PINNACLESAT:
L
Linus Torvalds 已提交
3374 3375
		btv->use_i2c_hw = 1;
		break;
3376
	case BTTV_BOARD_ADLINK_RTV24:
3377 3378
		init_RTV24( btv );
		break;
M
Mauro Carvalho Chehab 已提交
3379

L
Linus Torvalds 已提交
3380 3381 3382 3383 3384 3385 3386 3387
	}
	if (!bttv_tvcards[btv->c.type].has_dvb)
		bttv_reset_audio(btv);
}

/* initialization part two -- after registering i2c bus */
void __devinit bttv_init_card2(struct bttv *btv)
{
3388
	int addr=ADDR_UNSET;
3389

3390
	btv->tuner_type = UNSET;
L
Linus Torvalds 已提交
3391

3392
	if (BTTV_BOARD_UNKNOWN == btv->c.type) {
L
Linus Torvalds 已提交
3393 3394 3395 3396 3397
		bttv_readee(btv,eeprom_data,0xa0);
		identify_by_eeprom(btv,eeprom_data);
	}

	switch (btv->c.type) {
3398 3399 3400 3401
	case BTTV_BOARD_MIRO:
	case BTTV_BOARD_MIROPRO:
	case BTTV_BOARD_PINNACLE:
	case BTTV_BOARD_PINNACLEPRO:
L
Linus Torvalds 已提交
3402 3403 3404
		/* miro/pinnacle */
		miro_pinnacle_gpio(btv);
		break;
3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415
	case BTTV_BOARD_FLYVIDEO_98:
	case BTTV_BOARD_MAXI:
	case BTTV_BOARD_LIFE_FLYKIT:
	case BTTV_BOARD_FLYVIDEO:
	case BTTV_BOARD_TYPHOON_TVIEW:
	case BTTV_BOARD_CHRONOS_VS2:
	case BTTV_BOARD_FLYVIDEO_98FM:
	case BTTV_BOARD_FLYVIDEO2000:
	case BTTV_BOARD_FLYVIDEO98EZ:
	case BTTV_BOARD_CONFERENCETV:
	case BTTV_BOARD_LIFETEC_9415:
L
Linus Torvalds 已提交
3416 3417
		flyvideo_gpio(btv);
		break;
3418 3419 3420
	case BTTV_BOARD_HAUPPAUGE:
	case BTTV_BOARD_HAUPPAUGE878:
	case BTTV_BOARD_HAUPPAUGEPVR:
L
Linus Torvalds 已提交
3421 3422
		/* pick up some config infos from the eeprom */
		bttv_readee(btv,eeprom_data,0xa0);
3423
		hauppauge_eeprom(btv);
L
Linus Torvalds 已提交
3424
		break;
3425 3426
	case BTTV_BOARD_AVERMEDIA98:
	case BTTV_BOARD_AVPHONE98:
L
Linus Torvalds 已提交
3427 3428 3429
		bttv_readee(btv,eeprom_data,0xa0);
		avermedia_eeprom(btv);
		break;
3430
	case BTTV_BOARD_PXC200:
L
Linus Torvalds 已提交
3431 3432
		init_PXC200(btv);
		break;
3433
	case BTTV_BOARD_PICOLO_TETRA_CHIP:
L
Linus Torvalds 已提交
3434 3435
		picolo_tetra_init(btv);
		break;
3436
	case BTTV_BOARD_VHX:
L
Linus Torvalds 已提交
3437 3438 3439 3440 3441 3442 3443 3444
		btv->has_radio    = 1;
		btv->has_matchbox = 1;
		btv->mbox_we      = 0x20;
		btv->mbox_most    = 0;
		btv->mbox_clk     = 0x08;
		btv->mbox_data    = 0x10;
		btv->mbox_mask    = 0x38;
		break;
3445 3446
	case BTTV_BOARD_VOBIS_BOOSTAR:
	case BTTV_BOARD_TERRATV:
L
Linus Torvalds 已提交
3447 3448
		terratec_active_radio_upgrade(btv);
		break;
3449
	case BTTV_BOARD_MAGICTVIEW061:
L
Linus Torvalds 已提交
3450 3451 3452 3453 3454
		if (btv->cardid == 0x3002144f) {
			btv->has_radio=1;
			printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
		}
		break;
3455
       case BTTV_BOARD_STB2:
3456
		if (btv->cardid == 0x3060121a) {
L
Linus Torvalds 已提交
3457 3458 3459 3460 3461 3462
			/* Fix up entry for 3DFX VoodooTV 100,
			   which is an OEM STB card variant. */
			btv->has_radio=0;
			btv->tuner_type=TUNER_TEMIC_NTSC;
		}
		break;
3463 3464 3465 3466 3467 3468 3469 3470
	case BTTV_BOARD_OSPREY1x0:
	case BTTV_BOARD_OSPREY1x0_848:
	case BTTV_BOARD_OSPREY101_848:
	case BTTV_BOARD_OSPREY1x1:
	case BTTV_BOARD_OSPREY1x1_SVID:
	case BTTV_BOARD_OSPREY2xx:
	case BTTV_BOARD_OSPREY2x0_SVID:
	case BTTV_BOARD_OSPREY2x0:
3471
	case BTTV_BOARD_OSPREY440:
3472 3473 3474
	case BTTV_BOARD_OSPREY500:
	case BTTV_BOARD_OSPREY540:
	case BTTV_BOARD_OSPREY2000:
L
Linus Torvalds 已提交
3475
		bttv_readee(btv,eeprom_data,0xa0);
3476
		osprey_eeprom(btv, eeprom_data);
L
Linus Torvalds 已提交
3477
		break;
3478
	case BTTV_BOARD_IDS_EAGLE:
L
Linus Torvalds 已提交
3479 3480
		init_ids_eagle(btv);
		break;
3481
	case BTTV_BOARD_MODTEC_205:
L
Linus Torvalds 已提交
3482 3483 3484
		bttv_readee(btv,eeprom_data,0xa0);
		modtec_eeprom(btv);
		break;
3485
	case BTTV_BOARD_LMLBT4:
L
Linus Torvalds 已提交
3486 3487
		init_lmlbt4x(btv);
		break;
3488
	case BTTV_BOARD_TIBET_CS16:
L
Linus Torvalds 已提交
3489 3490
		tibetCS16_init(btv);
		break;
3491
	case BTTV_BOARD_KODICOM_4400R:
L
Linus Torvalds 已提交
3492 3493 3494 3495 3496
		kodicom4400r_init(btv);
		break;
	}

	/* pll configuration */
3497
	if (!(btv->id==848 && btv->revision==0x11)) {
L
Linus Torvalds 已提交
3498 3499 3500 3501 3502 3503 3504 3505 3506 3507
		/* defaults from card list */
		if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
			btv->pll.pll_ifreq=28636363;
			btv->pll.pll_crystal=BT848_IFORM_XT0;
		}
		if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
			btv->pll.pll_ifreq=35468950;
			btv->pll.pll_crystal=BT848_IFORM_XT1;
		}
		/* insmod options can override */
3508 3509
		switch (pll[btv->c.nr]) {
		case 0: /* none */
L
Linus Torvalds 已提交
3510 3511 3512
			btv->pll.pll_crystal = 0;
			btv->pll.pll_ifreq   = 0;
			btv->pll.pll_ofreq   = 0;
3513 3514
			break;
		case 1: /* 28 MHz */
L
Linus Torvalds 已提交
3515
		case 28:
3516
			btv->pll.pll_ifreq   = 28636363;
L
Linus Torvalds 已提交
3517
			btv->pll.pll_ofreq   = 0;
3518 3519 3520
			btv->pll.pll_crystal = BT848_IFORM_XT0;
			break;
		case 2: /* 35 MHz */
L
Linus Torvalds 已提交
3521
		case 35:
3522
			btv->pll.pll_ifreq   = 35468950;
L
Linus Torvalds 已提交
3523
			btv->pll.pll_ofreq   = 0;
3524 3525 3526 3527
			btv->pll.pll_crystal = BT848_IFORM_XT1;
			break;
		}
	}
L
Linus Torvalds 已提交
3528 3529 3530
	btv->pll.pll_current = -1;

	/* tuner configuration (from card list / autodetect / insmod option) */
3531 3532 3533 3534
	if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
		addr = bttv_tvcards[btv->c.type].tuner_addr;

	if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
L
Linus Torvalds 已提交
3535
		if(UNSET == btv->tuner_type)
3536
			btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
L
Linus Torvalds 已提交
3537 3538
	if (UNSET != tuner[btv->c.nr])
		btv->tuner_type = tuner[btv->c.nr];
3539 3540 3541 3542 3543 3544 3545 3546 3547

	if (btv->tuner_type == TUNER_ABSENT ||
	    bttv_tvcards[btv->c.type].tuner == UNSET)
		printk(KERN_INFO "bttv%d: tuner absent\n", btv->c.nr);
	else if(btv->tuner_type == UNSET)
		printk(KERN_WARNING "bttv%d: tuner type unset\n", btv->c.nr);
	else
		printk(KERN_INFO "bttv%d: tuner type=%d\n", btv->c.nr,
		       btv->tuner_type);
3548

M
Mauro Carvalho Chehab 已提交
3549
	if (btv->tuner_type != UNSET) {
3550
		struct tuner_setup tun_setup;
M
Mauro Carvalho Chehab 已提交
3551

3552
		tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
M
Mauro Carvalho Chehab 已提交
3553
		tun_setup.type = btv->tuner_type;
3554
		tun_setup.addr = addr;
M
Mauro Carvalho Chehab 已提交
3555 3556 3557 3558

		bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
	}

3559 3560 3561
	if (btv->tda9887_conf) {
		bttv_call_i2c_clients(btv, TDA9887_SET_CONFIG,
							&btv->tda9887_conf);
3562 3563
	}

L
Linus Torvalds 已提交
3564 3565 3566 3567 3568 3569 3570 3571 3572 3573
	btv->svhs = bttv_tvcards[btv->c.type].svhs;
	if (svhs[btv->c.nr] != UNSET)
		btv->svhs = svhs[btv->c.nr];
	if (remote[btv->c.nr] != UNSET)
		btv->has_remote = remote[btv->c.nr];

	if (bttv_tvcards[btv->c.type].has_radio)
		btv->has_radio=1;
	if (bttv_tvcards[btv->c.type].has_remote)
		btv->has_remote=1;
3574 3575
	if (!bttv_tvcards[btv->c.type].no_gpioirq)
		btv->gpioirq=1;
L
Linus Torvalds 已提交
3576 3577 3578 3579 3580
	if (bttv_tvcards[btv->c.type].audio_hook)
		btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook;

	if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
		/* detect Bt832 chip for quartzsight digital camera */
3581 3582
		if ((bttv_I2CRead(btv, I2C_ADDR_BT832_ALT1, "Bt832") >=0) ||
		    (bttv_I2CRead(btv, I2C_ADDR_BT832_ALT2, "Bt832") >=0))
L
Linus Torvalds 已提交
3583 3584 3585 3586 3587 3588
			boot_bt832(btv);
	}

	if (!autoload)
		return;

3589 3590 3591
	if (bttv_tvcards[btv->c.type].tuner == UNSET)
		return;  /* no tuner or related drivers to load */

L
Linus Torvalds 已提交
3592 3593
	/* try to detect audio/fader chips */
	if (!bttv_tvcards[btv->c.type].no_msp34xx &&
3594
	    bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx") >=0)
L
Linus Torvalds 已提交
3595 3596 3597
		request_module("msp3400");

	if (bttv_tvcards[btv->c.type].msp34xx_alt &&
3598
	    bttv_I2CRead(btv, I2C_ADDR_MSP3400_ALT, "MSP34xx (alternate address)") >=0)
L
Linus Torvalds 已提交
3599 3600 3601
		request_module("msp3400");

	if (!bttv_tvcards[btv->c.type].no_tda9875 &&
3602
	    bttv_I2CRead(btv, I2C_ADDR_TDA9875, "TDA9875") >=0)
L
Linus Torvalds 已提交
3603 3604 3605
		request_module("tda9875");

	if (!bttv_tvcards[btv->c.type].no_tda7432 &&
3606
	    bttv_I2CRead(btv, I2C_ADDR_TDA7432, "TDA7432") >=0)
L
Linus Torvalds 已提交
3607 3608 3609 3610 3611
		request_module("tda7432");

	if (bttv_tvcards[btv->c.type].needs_tvaudio)
		request_module("tvaudio");

3612
	if (btv->tuner_type != UNSET && btv->tuner_type != TUNER_ABSENT)
L
Linus Torvalds 已提交
3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627
		request_module("tuner");
}


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

static void modtec_eeprom(struct bttv *btv)
{
	if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
		btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
		printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
		       btv->c.nr,&eeprom_data[0x1e]);
	} else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
		btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
		printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3628 3629 3630 3631 3632
		       btv->c.nr,&eeprom_data[0x1e]);
	} else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
		btv->tuner_type=TUNER_PHILIPS_NTSC;
		printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
		       btv->c.nr,&eeprom_data[0x1e]);
L
Linus Torvalds 已提交
3633 3634 3635 3636 3637 3638 3639 3640 3641 3642
	} else {
		printk("bttv%d: Modtec: Unknown TunerString: %s\n",
		       btv->c.nr,&eeprom_data[0x1e]);
	}
}

static void __devinit hauppauge_eeprom(struct bttv *btv)
{
	struct tveeprom tv;

3643
	tveeprom_hauppauge_analog(&btv->i2c_client, &tv, eeprom_data);
L
Linus Torvalds 已提交
3644 3645
	btv->tuner_type = tv.tuner_type;
	btv->has_radio  = tv.has_radio;
3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660

	printk("bttv%d: Hauppauge eeprom indicates model#%d\n",
		btv->c.nr, tv.model);

	/*
	 * Some of the 878 boards have duplicate PCI IDs. Switch the board
	 * type based on model #.
	 */
	if(tv.model == 64900) {
		printk("bttv%d: Switching board type from %s to %s\n",
			btv->c.nr,
			bttv_tvcards[btv->c.type].name,
			bttv_tvcards[BTTV_BOARD_HAUPPAUGE_IMPACTVCB].name);
		btv->c.type = BTTV_BOARD_HAUPPAUGE_IMPACTVCB;
	}
L
Linus Torvalds 已提交
3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679
}

static int terratec_active_radio_upgrade(struct bttv *btv)
{
	int freq;

	btv->has_radio    = 1;
	btv->has_matchbox = 1;
	btv->mbox_we      = 0x10;
	btv->mbox_most    = 0x20;
	btv->mbox_clk     = 0x08;
	btv->mbox_data    = 0x04;
	btv->mbox_mask    = 0x3c;

	btv->mbox_iow     = 1 <<  8;
	btv->mbox_ior     = 1 <<  9;
	btv->mbox_csel    = 1 << 10;

	freq=88000/62.5;
3680
	tea5757_write(btv, 5 * freq + 0x358); /* write 0x1ed8 */
L
Linus Torvalds 已提交
3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711
	if (0x1ed8 == tea5757_read(btv)) {
		printk("bttv%d: Terratec Active Radio Upgrade found.\n",
		       btv->c.nr);
		btv->has_radio    = 1;
		btv->has_matchbox = 1;
	} else {
		btv->has_radio    = 0;
		btv->has_matchbox = 0;
	}
	return 0;
}


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

/*
 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
 *
 * The hcwamc.rbf firmware file is on the Hauppauge driver CD.  Have
 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
 * unpacked with unzip).
 */
#define PVR_GPIO_DELAY		10

#define BTTV_ALT_DATA		0x000001
#define BTTV_ALT_DCLK		0x100000
#define BTTV_ALT_NCONFIG	0x800000

static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen)
{
	u32 n;
3712
	u8 bits;
L
Linus Torvalds 已提交
3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723
	int i;

	gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
	gpio_write(0);
	udelay(PVR_GPIO_DELAY);

	gpio_write(BTTV_ALT_NCONFIG);
	udelay(PVR_GPIO_DELAY);

	for (n = 0; n < microlen; n++) {
		bits = micro[n];
3724
		for (i = 0 ; i < 8 ; i++) {
L
Linus Torvalds 已提交
3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747
			gpio_bits(BTTV_ALT_DCLK,0);
			if (bits & 0x01)
				gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
			else
				gpio_bits(BTTV_ALT_DATA,0);
			gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
			bits >>= 1;
		}
	}
	gpio_bits(BTTV_ALT_DCLK,0);
	udelay(PVR_GPIO_DELAY);

	/* begin Altera init loop (Not necessary,but doesn't hurt) */
	for (i = 0 ; i < 30 ; i++) {
		gpio_bits(BTTV_ALT_DCLK,0);
		gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
	}
	gpio_bits(BTTV_ALT_DCLK,0);
	return 0;
}

static int __devinit pvr_boot(struct bttv *btv)
{
3748
	const struct firmware *fw_entry;
L
Linus Torvalds 已提交
3749 3750 3751 3752 3753 3754
	int rc;

	rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
	if (rc != 0) {
		printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
		       btv->c.nr);
3755 3756
		return rc;
	}
L
Linus Torvalds 已提交
3757 3758 3759
	rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
	printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
	       btv->c.nr, (rc < 0) ? "failed" : "ok");
3760
	release_firmware(fw_entry);
L
Linus Torvalds 已提交
3761 3762 3763 3764 3765 3766
	return rc;
}

/* ----------------------------------------------------------------------- */
/* some osprey specific stuff                                              */

3767
static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
L
Linus Torvalds 已提交
3768
{
3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785
	int i;
	u32 serial = 0;
	int cardid = -1;

	/* This code will nevery actually get called in this case.... */
	if (btv->c.type == BTTV_BOARD_UNKNOWN) {
		/* this might be an antique... check for MMAC label in eeprom */
		if (!strncmp(ee, "MMAC", 4)) {
			u8 checksum = 0;
			for (i = 0; i < 21; i++)
				checksum += ee[i];
			if (checksum != ee[21])
				return;
			cardid = BTTV_BOARD_OSPREY1x0_848;
			for (i = 12; i < 21; i++)
				serial *= 10, serial += ee[i] - '0';
		}
L
Linus Torvalds 已提交
3786
       } else {
3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879
		unsigned short type;

		for (i = 4*16; i < 8*16; i += 16) {
			u16 checksum = ip_compute_csum(ee + i, 16);

			if ((checksum&0xff) + (checksum>>8) == 0xff)
				break;
		}
		if (i >= 8*16)
			return;
		ee += i;

		/* found a valid descriptor */
		type = be16_to_cpup((u16*)(ee+4));

		switch(type) {
		/* 848 based */
		case 0x0004:
			cardid = BTTV_BOARD_OSPREY1x0_848;
			break;
		case 0x0005:
			cardid = BTTV_BOARD_OSPREY101_848;
			break;

		/* 878 based */
		case 0x0012:
		case 0x0013:
			cardid = BTTV_BOARD_OSPREY1x0;
			break;
		case 0x0014:
		case 0x0015:
			cardid = BTTV_BOARD_OSPREY1x1;
			break;
		case 0x0016:
		case 0x0017:
		case 0x0020:
			cardid = BTTV_BOARD_OSPREY1x1_SVID;
			break;
		case 0x0018:
		case 0x0019:
		case 0x001E:
		case 0x001F:
			cardid = BTTV_BOARD_OSPREY2xx;
			break;
		case 0x001A:
		case 0x001B:
			cardid = BTTV_BOARD_OSPREY2x0_SVID;
			break;
		case 0x0040:
			cardid = BTTV_BOARD_OSPREY500;
			break;
		case 0x0050:
		case 0x0056:
			cardid = BTTV_BOARD_OSPREY540;
			/* bttv_osprey_540_init(btv); */
			break;
		case 0x0060:
		case 0x0070:
		case 0x00A0:
			cardid = BTTV_BOARD_OSPREY2x0;
			/* enable output on select control lines */
			gpio_inout(0xffffff,0x000303);
			break;
		case 0x00D8:
			cardid = BTTV_BOARD_OSPREY440;
			break;
		default:
			/* unknown...leave generic, but get serial # */
			printk(KERN_INFO "bttv%d: "
			       "osprey eeprom: unknown card type 0x%04x\n",
			       btv->c.nr, type);
			break;
		}
		serial = be32_to_cpup((u32*)(ee+6));
	}

	printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n",
	       btv->c.nr, cardid,
	       cardid>0 ? bttv_tvcards[cardid].name : "Unknown", serial);

	if (cardid<0 || btv->c.type == cardid)
		return;

	/* card type isn't set correctly */
	if (card[btv->c.nr] < bttv_num_tvcards) {
		printk(KERN_WARNING "bttv%d: osprey eeprom: "
		       "Not overriding user specified card type\n", btv->c.nr);
	} else {
		printk(KERN_INFO "bttv%d: osprey eeprom: "
		       "Changing card type from %d to %d\n", btv->c.nr,
		       btv->c.type, cardid);
		btv->c.type = cardid;
	}
L
Linus Torvalds 已提交
3880 3881 3882 3883 3884 3885
}

/* ----------------------------------------------------------------------- */
/* AVermedia specific stuff, from  bktr_card.c                             */

static int tuner_0_table[] = {
3886 3887 3888 3889 3890
	TUNER_PHILIPS_NTSC,  TUNER_PHILIPS_PAL /* PAL-BG*/,
	TUNER_PHILIPS_PAL,   TUNER_PHILIPS_PAL /* PAL-I*/,
	TUNER_PHILIPS_PAL,   TUNER_PHILIPS_PAL,
	TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
	TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
L
Linus Torvalds 已提交
3891 3892 3893
	TUNER_PHILIPS_FM1216ME_MK3 };

static int tuner_1_table[] = {
3894
	TUNER_TEMIC_NTSC,  TUNER_TEMIC_PAL,
L
Linus Torvalds 已提交
3895 3896
	TUNER_TEMIC_PAL,   TUNER_TEMIC_PAL,
	TUNER_TEMIC_PAL,   TUNER_TEMIC_PAL,
3897 3898
	TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */
	TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
L
Linus Torvalds 已提交
3899 3900 3901

static void __devinit avermedia_eeprom(struct bttv *btv)
{
3902
	int tuner_make,tuner_tv_fm,tuner_format,tuner=0;
L
Linus Torvalds 已提交
3903 3904

	tuner_make      = (eeprom_data[0x41] & 0x7);
3905 3906
	tuner_tv_fm     = (eeprom_data[0x41] & 0x18) >> 3;
	tuner_format    = (eeprom_data[0x42] & 0xf0) >> 4;
L
Linus Torvalds 已提交
3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917
	btv->has_remote = (eeprom_data[0x42] & 0x01);

	if (tuner_make == 0 || tuner_make == 2)
		if(tuner_format <=0x0a)
			tuner = tuner_0_table[tuner_format];
	if (tuner_make == 1)
		if(tuner_format <=9)
			tuner = tuner_1_table[tuner_format];

	if (tuner_make == 4)
		if(tuner_format == 0x09)
3918
			tuner = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */
L
Linus Torvalds 已提交
3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934

	printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
		btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]);
	if(tuner) {
		btv->tuner_type=tuner;
		printk("%d",tuner);
	} else
		printk("Unknown type");
	printk(" radio:%s remote control:%s\n",
	       tuner_tv_fm     ? "yes" : "no",
	       btv->has_remote ? "yes" : "no");
}

/* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */
void bttv_tda9880_setnorm(struct bttv *btv, int norm)
{
3935
	/* fix up our card entry */
L
Linus Torvalds 已提交
3936
	if(norm==VIDEO_MODE_NTSC) {
3937 3938
		bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff;
		bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff;
3939 3940
		bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff;
		bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomute=0x957fff;
L
Linus Torvalds 已提交
3941 3942 3943
		dprintk("bttv_tda9880_setnorm to NTSC\n");
	}
	else {
3944 3945
		bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff;
		bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x947fff;
3946 3947
		bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff;
		bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomute=0x947fff;
L
Linus Torvalds 已提交
3948 3949
		dprintk("bttv_tda9880_setnorm to PAL\n");
	}
3950
	/* set GPIO according */
L
Linus Torvalds 已提交
3951
	gpio_bits(bttv_tvcards[btv->c.type].gpiomask,
3952
		  bttv_tvcards[btv->c.type].gpiomux[btv->audio]);
L
Linus Torvalds 已提交
3953 3954 3955 3956 3957
}


/*
 * reset/enable the MSP on some Hauppauge cards
3958
 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
L
Linus Torvalds 已提交
3959 3960 3961 3962 3963 3964 3965 3966 3967 3968
 *
 * Hauppauge:  pin  5
 * Voodoo:     pin 20
 */
static void __devinit boot_msp34xx(struct bttv *btv, int pin)
{
	int mask = (1 << pin);

	gpio_inout(mask,mask);
	gpio_bits(mask,0);
3969
	udelay(2500);
L
Linus Torvalds 已提交
3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044
	gpio_bits(mask,mask);

	if (bttv_gpio)
		bttv_gpio_tracking(btv,"msp34xx");
	if (bttv_verbose)
		printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
		       "init [%d]\n", btv->c.nr, pin);
}

static void __devinit boot_bt832(struct bttv *btv)
{
}

/* ----------------------------------------------------------------------- */
/*  Imagenation L-Model PXC200 Framegrabber */
/*  This is basically the same procedure as
 *  used by Alessandro Rubini in his pxc200
 *  driver, but using BTTV functions */

static void __devinit init_PXC200(struct bttv *btv)
{
	static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
					    0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
					    0x00 };
	unsigned int i;
	int tmp;
	u32 val;

	/* Initialise GPIO-connevted stuff */
	gpio_inout(0xffffff, (1<<13));
	gpio_write(0);
	udelay(3);
	gpio_write(1<<13);
	/* GPIO inputs are pulled up, so no need to drive
	 * reset pin any longer */
	gpio_bits(0xffffff, 0);
	if (bttv_gpio)
		bttv_gpio_tracking(btv,"pxc200");

	/*  we could/should try and reset/control the AD pots? but
	    right now  we simply  turned off the crushing.  Without
	    this the AGC drifts drifts
	    remember the EN is reverse logic -->
	    setting BT848_ADC_AGC_EN disable the AGC
	    tboult@eecs.lehigh.edu
	*/

	btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);

	/*	Initialise MAX517 DAC */
	printk(KERN_INFO "Setting DAC reference voltage level ...\n");
	bttv_I2CWrite(btv,0x5E,0,0x80,1);

	/*	Initialise 12C508 PIC */
	/*	The I2CWrite and I2CRead commmands are actually to the
	 *	same chips - but the R/W bit is included in the address
	 *	argument so the numbers are different */


	printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");

	/* First of all, enable the clock line. This is used in the PXC200-F */
	val = btread(BT848_GPIO_DMA_CTL);
	val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
	btwrite(val, BT848_GPIO_DMA_CTL);

	/* Then, push to 0 the reset pin long enough to reset the *
	 * device same as above for the reset line, but not the same
	 * value sent to the GPIO-connected stuff
	 * which one is the good one? */
	gpio_inout(0xffffff,(1<<2));
	gpio_write(0);
	udelay(10);
	gpio_write(1<<2);

4045
	for (i = 0; i < ARRAY_SIZE(vals); i++) {
L
Linus Torvalds 已提交
4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056
		tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
		if (tmp != -1) {
			printk(KERN_INFO
			       "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
			       vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
		}
	}

	printk(KERN_INFO "PXC200 Initialised.\n");
}

M
Mauro Carvalho Chehab 已提交
4057 4058


4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082
/* ----------------------------------------------------------------------- */
/*
 *  The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock
 *  it. This apparently involves the following procedure for each 878 chip:
 *
 *  1) write 0x00C3FEFF to the GPIO_OUT_EN register
 *
 *  2)  write to GPIO_DATA
 *      - 0x0E
 *      - sleep 1ms
 *      - 0x10 + 0x0E
 *      - sleep 10ms
 *      - 0x0E
 *     read from GPIO_DATA into buf (uint_32)
 *      - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 )
 *                 error. ERROR_CPLD_Check_Failed stop.
 *
 *  3) write to GPIO_DATA
 *      - write 0x4400 + 0x0E
 *      - sleep 10ms
 *      - write 0x4410 + 0x0E
 *      - sleep 1ms
 *      - write 0x0E
 *     read from GPIO_DATA into buf (uint_32)
4083
 *      - if ( buf>>18 & 0x01 ) || ( buf>>19 & 0x01 != 0 )
4084 4085 4086
 *                error. ERROR_CPLD_Check_Failed.
 */
/* ----------------------------------------------------------------------- */
4087
static void
M
Mauro Carvalho Chehab 已提交
4088
init_RTV24 (struct bttv *btv)
4089
{
M
Mauro Carvalho Chehab 已提交
4090 4091
	uint32_t dataRead = 0;
	long watchdog_value = 0x0E;
4092

M
Mauro Carvalho Chehab 已提交
4093 4094
	printk (KERN_INFO
		"bttv%d: Adlink RTV-24 initialisation in progress ...\n",
4095 4096
		btv->c.nr);

M
Mauro Carvalho Chehab 已提交
4097
	btwrite (0x00c3feff, BT848_GPIO_OUT_EN);
4098

M
Mauro Carvalho Chehab 已提交
4099 4100 4101 4102 4103
	btwrite (0 + watchdog_value, BT848_GPIO_DATA);
	msleep (1);
	btwrite (0x10 + watchdog_value, BT848_GPIO_DATA);
	msleep (10);
	btwrite (0 + watchdog_value, BT848_GPIO_DATA);
4104

M
Mauro Carvalho Chehab 已提交
4105
	dataRead = btread (BT848_GPIO_DATA);
4106

M
Mauro Carvalho Chehab 已提交
4107 4108 4109 4110
	if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) {
		printk (KERN_INFO
			"bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n",
			btv->c.nr, dataRead);
4111 4112
	}

M
Mauro Carvalho Chehab 已提交
4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125
	btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA);
	msleep (10);
	btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA);
	msleep (1);
	btwrite (watchdog_value, BT848_GPIO_DATA);
	msleep (1);
	dataRead = btread (BT848_GPIO_DATA);

	if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) {
		printk (KERN_INFO
			"bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n",
			btv->c.nr, dataRead);

4126 4127 4128
		return;
	}

M
Mauro Carvalho Chehab 已提交
4129 4130
	printk (KERN_INFO
		"bttv%d: Adlink RTV-24 initialisation complete.\n", btv->c.nr);
4131
}
L
Linus Torvalds 已提交
4132

M
Mauro Carvalho Chehab 已提交
4133 4134


L
Linus Torvalds 已提交
4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240
/* ----------------------------------------------------------------------- */
/* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports     */
/*
 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
 * This code is placed under the terms of the GNU General Public License
 *
 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
 */

static void bus_low(struct bttv *btv, int bit)
{
	if (btv->mbox_ior) {
		gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
			  btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
		udelay(5);
	}

	gpio_bits(bit,0);
	udelay(5);

	if (btv->mbox_ior) {
		gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
		udelay(5);
	}
}

static void bus_high(struct bttv *btv, int bit)
{
	if (btv->mbox_ior) {
		gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
			  btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
		udelay(5);
	}

	gpio_bits(bit,bit);
	udelay(5);

	if (btv->mbox_ior) {
		gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
		udelay(5);
	}
}

static int bus_in(struct bttv *btv, int bit)
{
	if (btv->mbox_ior) {
		gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
			  btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
		udelay(5);

		gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
		udelay(5);
	}
	return gpio_read() & (bit);
}

/* TEA5757 register bits */
#define TEA_FREQ		0:14
#define TEA_BUFFER		15:15

#define TEA_SIGNAL_STRENGTH	16:17

#define TEA_PORT1		18:18
#define TEA_PORT0		19:19

#define TEA_BAND		20:21
#define TEA_BAND_FM		0
#define TEA_BAND_MW		1
#define TEA_BAND_LW		2
#define TEA_BAND_SW		3

#define TEA_MONO		22:22
#define TEA_ALLOW_STEREO	0
#define TEA_FORCE_MONO		1

#define TEA_SEARCH_DIRECTION	23:23
#define TEA_SEARCH_DOWN		0
#define TEA_SEARCH_UP		1

#define TEA_STATUS		24:24
#define TEA_STATUS_TUNED	0
#define TEA_STATUS_SEARCHING	1

/* Low-level stuff */
static int tea5757_read(struct bttv *btv)
{
	unsigned long timeout;
	int value = 0;
	int i;

	/* better safe than sorry */
	gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);

	if (btv->mbox_ior) {
		gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
			  btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
		udelay(5);
	}

	if (bttv_gpio)
		bttv_gpio_tracking(btv,"tea5757 read");

	bus_low(btv,btv->mbox_we);
	bus_low(btv,btv->mbox_clk);

	udelay(10);
4241
	timeout= jiffies + msecs_to_jiffies(1000);
L
Linus Torvalds 已提交
4242

4243
	/* wait for DATA line to go low; error if it doesn't */
L
Linus Torvalds 已提交
4244 4245 4246 4247 4248 4249 4250 4251
	while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
		schedule();
	if (bus_in(btv,btv->mbox_data)) {
		printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
		return -1;
	}

	dprintk("bttv%d: tea5757:",btv->c.nr);
4252
	for (i = 0; i < 24; i++) {
L
Linus Torvalds 已提交
4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283
		udelay(5);
		bus_high(btv,btv->mbox_clk);
		udelay(5);
		dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
		bus_low(btv,btv->mbox_clk);
		value <<= 1;
		value |= (bus_in(btv,btv->mbox_data) == 0)?0:1;  /* MSB first */
		dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
	}
	dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
	return value;
}

static int tea5757_write(struct bttv *btv, int value)
{
	int i;
	int reg = value;

	gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);

	if (btv->mbox_ior) {
		gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
			  btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
		udelay(5);
	}
	if (bttv_gpio)
		bttv_gpio_tracking(btv,"tea5757 write");

	dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
	bus_low(btv,btv->mbox_clk);
	bus_high(btv,btv->mbox_we);
4284
	for (i = 0; i < 25; i++) {
L
Linus Torvalds 已提交
4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308
		if (reg & 0x1000000)
			bus_high(btv,btv->mbox_data);
		else
			bus_low(btv,btv->mbox_data);
		reg <<= 1;
		bus_high(btv,btv->mbox_clk);
		udelay(10);
		bus_low(btv,btv->mbox_clk);
		udelay(10);
	}
	bus_low(btv,btv->mbox_we);  /* unmute !!! */
	return 0;
}

void tea5757_set_freq(struct bttv *btv, unsigned short freq)
{
	dprintk("tea5757_set_freq %d\n",freq);
	tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
}


/* ----------------------------------------------------------------------- */
/* winview                                                                 */

4309
static void winview_audio(struct bttv *btv, struct video_audio *v, int set)
L
Linus Torvalds 已提交
4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367
{
	/* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
	int bits_out, loops, vol, data;

	if (!set) {
		/* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
		v->flags |= VIDEO_AUDIO_VOLUME;
		return;
	}

	/* 32 levels logarithmic */
	vol = 32 - ((v->volume>>11));
	/* units */
	bits_out = (PT2254_DBS_IN_2>>(vol%5));
	/* tens */
	bits_out |= (PT2254_DBS_IN_10>>(vol/5));
	bits_out |= PT2254_L_CHANNEL | PT2254_R_CHANNEL;
	data = gpio_read();
	data &= ~(WINVIEW_PT2254_CLK| WINVIEW_PT2254_DATA|
		  WINVIEW_PT2254_STROBE);
	for (loops = 17; loops >= 0 ; loops--) {
		if (bits_out & (1<<loops))
			data |=  WINVIEW_PT2254_DATA;
		else
			data &= ~WINVIEW_PT2254_DATA;
		gpio_write(data);
		udelay(5);
		data |= WINVIEW_PT2254_CLK;
		gpio_write(data);
		udelay(5);
		data &= ~WINVIEW_PT2254_CLK;
		gpio_write(data);
	}
	data |=  WINVIEW_PT2254_STROBE;
	data &= ~WINVIEW_PT2254_DATA;
	gpio_write(data);
	udelay(10);
	data &= ~WINVIEW_PT2254_STROBE;
	gpio_write(data);
}

/* ----------------------------------------------------------------------- */
/* mono/stereo control for various cards (which don't use i2c chips but    */
/* connect something to the GPIO pins                                      */

static void
gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
{
	unsigned int con = 0;

	if (set) {
		gpio_inout(0x300, 0x300);
		if (v->mode & VIDEO_SOUND_LANG1)
			con = 0x000;
		if (v->mode & VIDEO_SOUND_LANG2)
			con = 0x300;
		if (v->mode & VIDEO_SOUND_STEREO)
			con = 0x200;
4368 4369
/*		if (v->mode & VIDEO_SOUND_MONO)
 *			con = 0x100; */
L
Linus Torvalds 已提交
4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485
		gpio_bits(0x300, con);
	} else {
		v->mode = VIDEO_SOUND_STEREO |
			  VIDEO_SOUND_LANG1  | VIDEO_SOUND_LANG2;
	}
}

static void
gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
{
	unsigned int val, con;

	if (btv->radio_user)
		return;

	val = gpio_read();
	if (set) {
		con = 0x000;
		if (v->mode & VIDEO_SOUND_LANG2) {
			if (v->mode & VIDEO_SOUND_LANG1) {
				/* LANG1 + LANG2 */
				con = 0x100;
			}
			else {
				/* LANG2 */
				con = 0x300;
			}
		}
		if (con != (val & 0x300)) {
			gpio_bits(0x300, con);
			if (bttv_gpio)
				bttv_gpio_tracking(btv,"gvbctv5pci");
		}
	} else {
		switch (val & 0x70) {
		  case 0x10:
			v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
			break;
		  case 0x30:
			v->mode = VIDEO_SOUND_LANG2;
			break;
		  case 0x50:
			v->mode = VIDEO_SOUND_LANG1;
			break;
		  case 0x60:
			v->mode = VIDEO_SOUND_STEREO;
			break;
		  case 0x70:
			v->mode = VIDEO_SOUND_MONO;
			break;
		  default:
			v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
				  VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
		}
	}
}

/*
 * Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
 *  I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
 *  0xdde enables mono and 0xccd enables sap
 *
 * Petr Vandrovec <VANDROVE@vc.cvut.cz>
 *  P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
 *  input/output sound connection, so both must be set for output mode.
 *
 * Looks like it's needed only for the "tvphone", the "tvphone 98"
 * handles this with a tda9840
 *
 */
static void
avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
{
	int val = 0;

	if (set) {
		if (v->mode & VIDEO_SOUND_LANG2)   /* SAP */
			val = 0x02;
		if (v->mode & VIDEO_SOUND_STEREO)
			val = 0x01;
		if (val) {
			gpio_bits(0x03,val);
			if (bttv_gpio)
				bttv_gpio_tracking(btv,"avermedia");
		}
	} else {
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
			VIDEO_SOUND_LANG1;
		return;
	}
}

static void
avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set)
{
	int val = 0;

	if (set) {
		if (v->mode & VIDEO_SOUND_LANG2)   /* SAP */
			val = 0x01;
		if (v->mode & VIDEO_SOUND_STEREO)  /* STEREO */
			val = 0x02;
		btaor(val, ~0x03, BT848_GPIO_DATA);
		if (bttv_gpio)
			bttv_gpio_tracking(btv,"avermedia");
	} else {
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
			VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
		return;
	}
}

/* Lifetec 9415 handling */
static void
lt9415_audio(struct bttv *btv, struct video_audio *v, int set)
{
4486
	int val = 0;
L
Linus Torvalds 已提交
4487

4488
	if (gpio_read() & 0x4000) {
L
Linus Torvalds 已提交
4489 4490 4491 4492
		v->mode = VIDEO_SOUND_MONO;
		return;
	}

4493 4494 4495
	if (set) {
		if (v->mode & VIDEO_SOUND_LANG2)  /* A2 SAP */
			val = 0x0080;
L
Linus Torvalds 已提交
4496
		if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */
4497 4498
			val = 0x0880;
		if ((v->mode & VIDEO_SOUND_LANG1) ||
L
Linus Torvalds 已提交
4499 4500 4501
		    (v->mode & VIDEO_SOUND_MONO))
			val = 0;
		gpio_bits(0x0880, val);
4502 4503 4504
		if (bttv_gpio)
			bttv_gpio_tracking(btv,"lt9415");
	} else {
L
Linus Torvalds 已提交
4505
		/* autodetect doesn't work with this card :-( */
4506
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
L
Linus Torvalds 已提交
4507
			VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
4508 4509
		return;
	}
L
Linus Torvalds 已提交
4510 4511
}

4512
/* TDA9821 on TerraTV+ Bt848, Bt878 */
L
Linus Torvalds 已提交
4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611
static void
terratv_audio(struct bttv *btv, struct video_audio *v, int set)
{
	unsigned int con = 0;

	if (set) {
		gpio_inout(0x180000,0x180000);
		if (v->mode & VIDEO_SOUND_LANG2)
			con = 0x080000;
		if (v->mode & VIDEO_SOUND_STEREO)
			con = 0x180000;
		gpio_bits(0x180000, con);
		if (bttv_gpio)
			bttv_gpio_tracking(btv,"terratv");
	} else {
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
			VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
	}
}

static void
winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
{
	unsigned long val = 0;

	if (set) {
		/*btor (0xc32000, BT848_GPIO_OUT_EN);*/
		if (v->mode & VIDEO_SOUND_MONO)		/* Mono */
			val = 0x420000;
		if (v->mode & VIDEO_SOUND_LANG1)	/* Mono */
			val = 0x420000;
		if (v->mode & VIDEO_SOUND_LANG2)	/* SAP */
			val = 0x410000;
		if (v->mode & VIDEO_SOUND_STEREO)	/* Stereo */
			val = 0x020000;
		if (val) {
			gpio_bits(0x430000, val);
			if (bttv_gpio)
				bttv_gpio_tracking(btv,"winfast2000");
		}
	} else {
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
			  VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
	}
}

/*
 * Dariusz Kowalewski <darekk@automex.pl>
 * sound control for Prolink PV-BT878P+9B (PixelView PlayTV Pro FM+NICAM
 * revision 9B has on-board TDA9874A sound decoder).
 *
 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
 *       will mute this cards.
 */
static void
pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
{
	unsigned int val = 0;

	if (btv->radio_user)
		return;

	if (set) {
		if (v->mode & VIDEO_SOUND_MONO)	{
			val = 0x01;
		}
		if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
		    || (v->mode & VIDEO_SOUND_STEREO)) {
			val = 0x02;
		}
		if (val) {
			gpio_bits(0x03,val);
			if (bttv_gpio)
				bttv_gpio_tracking(btv,"pvbt878p9b");
		}
	} else {
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
			VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
	}
}

/*
 * Dariusz Kowalewski <darekk@automex.pl>
 * sound control for FlyVideo 2000S (with tda9874 decoder)
 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
 */
static void
fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
{
	unsigned int val = 0xffff;

	if (btv->radio_user)
		return;
	if (set) {
		if (v->mode & VIDEO_SOUND_MONO)	{
			val = 0x0000;
		}
		if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2))
		    || (v->mode & VIDEO_SOUND_STEREO)) {
4612
			val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */
L
Linus Torvalds 已提交
4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631
		}
		if (val != 0xffff) {
			gpio_bits(0x1800, val);
			if (bttv_gpio)
				bttv_gpio_tracking(btv,"fv2000s");
		}
	} else {
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
			VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
	}
}

/*
 * sound control for Canopus WinDVR PCI
 * Masaki Suzuki <masaki@btree.org>
 */
static void
windvr_audio(struct bttv *btv, struct video_audio *v, int set)
{
4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643
	unsigned long val = 0;

	if (set) {
		if (v->mode & VIDEO_SOUND_MONO)
			val = 0x040000;
		if (v->mode & VIDEO_SOUND_LANG1)
			val = 0;
		if (v->mode & VIDEO_SOUND_LANG2)
			val = 0x100000;
		if (v->mode & VIDEO_SOUND_STEREO)
			val = 0;
		if (val) {
L
Linus Torvalds 已提交
4644
			gpio_bits(0x140000, val);
4645
			if (bttv_gpio)
4646
				bttv_gpio_tracking(btv,"windvr");
4647 4648 4649 4650 4651
		}
	} else {
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
			  VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
	}
L
Linus Torvalds 已提交
4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662
}

/*
 * sound control for AD-TVK503
 * Hiroshi Takekawa <sian@big.or.jp>
 */
static void
adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
{
	unsigned int con = 0xffffff;

4663
	/* btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN); */
L
Linus Torvalds 已提交
4664 4665

	if (set) {
4666
		/* btor(***, BT848_GPIO_OUT_EN); */
L
Linus Torvalds 已提交
4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855
		if (v->mode & VIDEO_SOUND_LANG1)
			con = 0x00000000;
		if (v->mode & VIDEO_SOUND_LANG2)
			con = 0x00180000;
		if (v->mode & VIDEO_SOUND_STEREO)
			con = 0x00000000;
		if (v->mode & VIDEO_SOUND_MONO)
			con = 0x00060000;
		if (con != 0xffffff) {
			gpio_bits(0x1e0000,con);
			if (bttv_gpio)
				bttv_gpio_tracking(btv, "adtvk503");
		}
	} else {
		v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO |
			  VIDEO_SOUND_LANG1  | VIDEO_SOUND_LANG2;
	}
}

/* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
 *
 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
 * switch instead (CD22M3494E). This IC can have multiple active connections
 * between Xn (input) and Yn (output) pins. We need to clear any existing
 * connection prior to establish a new one, pulsing the STROBE pin.
 *
 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
 * GPIO pins are wired as:
 *  GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
 *  GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
 *  GPIO[7]   - DATA (xpoint)    - P1[7] (microcontroler)
 *  GPIO[8]   -                  - P3[5] (microcontroler)
 *  GPIO[9]   - RESET (xpoint)   - P3[6] (microcontroler)
 *  GPIO[10]  - STROBE (xpoint)  - P3[7] (microcontroler)
 *  GPINTR    -                  - P3[4] (microcontroler)
 *
 * The microcontroler is a 80C32 like. It should be possible to change xpoint
 * configuration either directly (as we are doing) or using the microcontroler
 * which is also wired to I2C interface. I have no further info on the
 * microcontroler features, one would need to disassembly the firmware.
 * note: the vendor refused to give any information on this product, all
 *       that stuff was found using a multimeter! :)
 */
static void rv605_muxsel(struct bttv *btv, unsigned int input)
{
	/* reset all conections */
	gpio_bits(0x200,0x200);
	mdelay(1);
	gpio_bits(0x200,0x000);
	mdelay(1);

	/* create a new conection */
	gpio_bits(0x480,0x080);
	gpio_bits(0x480,0x480);
	mdelay(1);
	gpio_bits(0x480,0x080);
	mdelay(1);
}

/* Tibet Systems 'Progress DVR' CS16 muxsel helper [Chris Fanning]
 *
 * The CS16 (available on eBay cheap) is a PCI board with four Fusion
 * 878A chips, a PCI bridge, an Atmel microcontroller, four sync seperator
 * chips, ten eight input analog multiplexors, a not chip and a few
 * other components.
 *
 * 16 inputs on a secondary bracket are provided and can be selected
 * from each of the four capture chips.  Two of the eight input
 * multiplexors are used to select from any of the 16 input signals.
 *
 * Unsupported hardware capabilities:
 *  . A video output monitor on the secondary bracket can be selected from
 *    one of the 878A chips.
 *  . Another passthrough but I haven't spent any time investigating it.
 *  . Digital I/O (logic level connected to GPIO) is available from an
 *    onboard header.
 *
 * The on chip input mux should always be set to 2.
 * GPIO[16:19] - Video input selection
 * GPIO[0:3]   - Video output monitor select (only available from one 878A)
 * GPIO[?:?]   - Digital I/O.
 *
 * There is an ATMEL microcontroller with an 8031 core on board.  I have not
 * determined what function (if any) it provides.  With the microcontroller
 * and sync seperator chips a guess is that it might have to do with video
 * switching and maybe some digital I/O.
 */
static void tibetCS16_muxsel(struct bttv *btv, unsigned int input)
{
	/* video mux */
	gpio_bits(0x0f0000, input << 16);
}

static void tibetCS16_init(struct bttv *btv)
{
	/* enable gpio bits, mask obtained via btSpy */
	gpio_inout(0xffffff, 0x0f7fff);
	gpio_write(0x0f7fff);
}

/*
 * The following routines for the Kodicom-4400r get a little mind-twisting.
 * There is a "master" controller and three "slave" controllers, together
 * an analog switch which connects any of 16 cameras to any of the BT87A's.
 * The analog switch is controlled by the "master", but the detection order
 * of the four BT878A chips is in an order which I just don't understand.
 * The "master" is actually the second controller to be detected.  The
 * logic on the board uses logical numbers for the 4 controlers, but
 * those numbers are different from the detection sequence.  When working
 * with the analog switch, we need to "map" from the detection sequence
 * over to the board's logical controller number.  This mapping sequence
 * is {3, 0, 2, 1}, i.e. the first controller to be detected is logical
 * unit 3, the second (which is the master) is logical unit 0, etc.
 * We need to maintain the status of the analog switch (which of the 16
 * cameras is connected to which of the 4 controllers).  Rather than
 * add to the bttv structure for this, we use the data reserved for
 * the mbox (unused for this card type).
 */

/*
 * First a routine to set the analog switch, which controls which camera
 * is routed to which controller.  The switch comprises an X-address
 * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
 * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
 * A data value (gpio bit 7) of '1' enables the switch, and '0' disables
 * the switch.  A STROBE bit (gpio bit 8) latches the data value into the
 * specified address.  The idea is to set the address and data, then bring
 * STROBE high, and finally bring STROBE back to low.
 */
static void kodicom4400r_write(struct bttv *btv,
			       unsigned char xaddr,
			       unsigned char yaddr,
			       unsigned char data) {
	unsigned int udata;

	udata = (data << 7) | ((yaddr&3) << 4) | (xaddr&0xf);
	gpio_bits(0x1ff, udata);		/* write ADDR and DAT */
	gpio_bits(0x1ff, udata | (1 << 8));	/* strobe high */
	gpio_bits(0x1ff, udata);		/* strobe low */
}

/*
 * Next the mux select.  Both the "master" and "slave" 'cards' (controllers)
 * use this routine.  The routine finds the "master" for the card, maps
 * the controller number from the detected position over to the logical
 * number, writes the appropriate data to the analog switch, and housekeeps
 * the local copy of the switch information.  The parameter 'input' is the
 * requested camera number (0 - 15).
 */
static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input)
{
	char *sw_status;
	int xaddr, yaddr;
	struct bttv *mctlr;
	static unsigned char map[4] = {3, 0, 2, 1};

	mctlr = master[btv->c.nr];
	if (mctlr == NULL) {	/* ignore if master not yet detected */
		return;
	}
	yaddr = (btv->c.nr - mctlr->c.nr + 1) & 3; /* the '&' is for safety */
	yaddr = map[yaddr];
	sw_status = (char *)(&mctlr->mbox_we);
	xaddr = input & 0xf;
	/* Check if the controller/camera pair has changed, else ignore */
	if (sw_status[yaddr] != xaddr)
	{
		/* "open" the old switch, "close" the new one, save the new */
		kodicom4400r_write(mctlr, sw_status[yaddr], yaddr, 0);
		sw_status[yaddr] = xaddr;
		kodicom4400r_write(mctlr, xaddr, yaddr, 1);
	}
}

/*
 * During initialisation, we need to reset the analog switch.  We
 * also preset the switch to map the 4 connectors on the card to the
 * *user's* (see above description of kodicom4400r_muxsel) channels
 * 0 through 3
 */
static void kodicom4400r_init(struct bttv *btv)
{
	char *sw_status = (char *)(&btv->mbox_we);
	int ix;

	gpio_inout(0x0003ff, 0x0003ff);
	gpio_write(1 << 9);	/* reset MUX */
	gpio_write(0);
	/* Preset camera 0 to the 4 controllers */
4856
	for (ix = 0; ix < 4; ix++) {
L
Linus Torvalds 已提交
4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872
		sw_status[ix] = ix;
		kodicom4400r_write(btv, ix, ix, 1);
	}
	/*
	 * Since this is the "master", we need to set up the
	 * other three controller chips' pointers to this structure
	 * for later use in the muxsel routine.
	 */
	if ((btv->c.nr<1) || (btv->c.nr>BTTV_MAX-3))
	    return;
	master[btv->c.nr-1] = btv;
	master[btv->c.nr]   = btv;
	master[btv->c.nr+1] = btv;
	master[btv->c.nr+2] = btv;
}

4873 4874 4875 4876
/* The Grandtec X-Guard framegrabber card uses two Dual 4-channel
 * video multiplexers to provide up to 16 video inputs. These
 * multiplexers are controlled by the lower 8 GPIO pins of the
 * bt878. The multiplexers probably Pericom PI5V331Q or similar.
L
Linus Torvalds 已提交
4877

4878 4879 4880
 * xxx0 is pin xxx of multiplexer U5,
 * yyy1 is pin yyy of multiplexer U2
 */
L
Linus Torvalds 已提交
4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893
#define ENA0    0x01
#define ENB0    0x02
#define ENA1    0x04
#define ENB1    0x08

#define IN10    0x10
#define IN00    0x20
#define IN11    0x40
#define IN01    0x80

static void xguard_muxsel(struct bttv *btv, unsigned int input)
{
	static const int masks[] = {
4894 4895 4896 4897
		ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
		ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
		ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
		ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
L
Linus Torvalds 已提交
4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921
	};
	gpio_write(masks[input%16]);
}
static void picolo_tetra_init(struct bttv *btv)
{
	/*This is the video input redirection fonctionality : I DID NOT USED IT. */
	btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
	btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A]  set to 1*/
}
static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
{

	dprintk (KERN_DEBUG "bttv%d : picolo_tetra_muxsel =>  input = %d\n",btv->c.nr,input);
	/*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
	/*GPIO[20]&GPIO[21] used to choose the right input*/
	btwrite (input<<20,BT848_GPIO_DATA);

}

/*
 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
 *
 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
 * swichers to provide 16 channels to MUX0. The TDA8540's have
A
Andreas Mohr 已提交
4922
 * 4 independent outputs and as such the IVC120G also has the
L
Linus Torvalds 已提交
4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950
 * optional "Monitor Out" bus. This allows the card to be looking
 * at one input while the monitor is looking at another.
 *
 * Since I've couldn't be bothered figuring out how to add an
 * independant muxsel for the monitor bus, I've just set it to
 * whatever the card is looking at.
 *
 *  OUT0 of the TDA8540's is connected to MUX0         (0x03)
 *  OUT1 of the TDA8540's is connected to "Monitor Out"        (0x0C)
 *
 *  TDA8540_ALT3 IN0-3 = Channel 13 - 16       (0x03)
 *  TDA8540_ALT4 IN0-3 = Channel 1 - 4         (0x03)
 *  TDA8540_ALT5 IN0-3 = Channel 5 - 8         (0x03)
 *  TDA8540_ALT6 IN0-3 = Channel 9 - 12                (0x03)
 *
 */

/* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
#define I2C_TDA8540        0x90
#define I2C_TDA8540_ALT1   0x92
#define I2C_TDA8540_ALT2   0x94
#define I2C_TDA8540_ALT3   0x96
#define I2C_TDA8540_ALT4   0x98
#define I2C_TDA8540_ALT5   0x9a
#define I2C_TDA8540_ALT6   0x9c

static void ivc120_muxsel(struct bttv *btv, unsigned int input)
{
4951
	/* Simple maths */
L
Linus Torvalds 已提交
4952 4953 4954 4955 4956 4957
	int key = input % 4;
	int matrix = input / 4;

	dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
		btv->c.nr, input, matrix, key);

4958
	/* Handles the input selection on the TDA8540's */
L
Linus Torvalds 已提交
4959 4960 4961 4962 4963 4964 4965 4966 4967
	bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
		      ((matrix == 3) ? (key | key << 2) : 0x00), 1);
	bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
		      ((matrix == 0) ? (key | key << 2) : 0x00), 1);
	bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
		      ((matrix == 1) ? (key | key << 2) : 0x00), 1);
	bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
		      ((matrix == 2) ? (key | key << 2) : 0x00), 1);

4968
	/* Handles the output enables on the TDA8540's */
L
Linus Torvalds 已提交
4969
	bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
4970
		      ((matrix == 3) ? 0x03 : 0x00), 1);  /* 13 - 16 */
L
Linus Torvalds 已提交
4971
	bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
4972
		      ((matrix == 0) ? 0x03 : 0x00), 1);  /* 1-4 */
L
Linus Torvalds 已提交
4973
	bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
4974
		      ((matrix == 1) ? 0x03 : 0x00), 1);  /* 5-8 */
L
Linus Torvalds 已提交
4975
	bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
4976
		      ((matrix == 2) ? 0x03 : 0x00), 1);  /* 9-12 */
L
Linus Torvalds 已提交
4977

4978
	/* Selects MUX0 for input on the 878 */
L
Linus Torvalds 已提交
4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001
	btaor((0)<<5, ~(3<<5), BT848_IFORM);
}


/* PXC200 muxsel helper
 * luke@syseng.anu.edu.au
 * another transplant
 * from Alessandro Rubini (rubini@linux.it)
 *
 * There are 4 kinds of cards:
 * PXC200L which is bt848
 * PXC200F which is bt848 with PIC controlling mux
 * PXC200AL which is bt878
 * PXC200AF which is bt878 with PIC controlling mux
 */
#define PX_CFG_PXC200F 0x01
#define PX_FLAG_PXC200A  0x00001000 /* a pxc200A is bt-878 based */
#define PX_I2C_PIC       0x0f
#define PX_PXC200A_CARDID 0x200a1295
#define PX_I2C_CMD_CFG   0x00

static void PXC200_muxsel(struct bttv *btv, unsigned int input)
{
5002
	int rc;
L
Linus Torvalds 已提交
5003 5004
	long mux;
	int bitmask;
5005
	unsigned char buf[2];
L
Linus Torvalds 已提交
5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034

	/* Read PIC config to determine if this is a PXC200F */
	/* PX_I2C_CMD_CFG*/
	buf[0]=0;
	buf[1]=0;
	rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
	if (rc) {
	  printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
	  /* not PXC ? do nothing */
	  return;
	}

	rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
	if (!(rc & PX_CFG_PXC200F)) {
	  printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
	  return;
	}


	/* The multiplexer in the 200F is handled by the GPIO port */
	/* get correct mapping between inputs  */
	/*  mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
	/* ** not needed!?   */
	mux = input;

	/* make sure output pins are enabled */
	/* bitmask=0x30f; */
	bitmask=0x302;
	/* check whether we have a PXC200A */
5035
	if (btv->cardid == PX_PXC200A_CARDID)  {
L
Linus Torvalds 已提交
5036 5037 5038 5039 5040 5041
	   bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
	   bitmask |= 7<<4; /* the DAC */
	}
	btwrite(bitmask, BT848_GPIO_OUT_EN);

	bitmask = btread(BT848_GPIO_DATA);
5042
	if (btv->cardid == PX_PXC200A_CARDID)
L
Linus Torvalds 已提交
5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054
	  bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
	else /* older device */
	  bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
	btwrite(bitmask,BT848_GPIO_DATA);

	/*
	 * Was "to be safe, set the bt848 to input 0"
	 * Actually, since it's ok at load time, better not messing
	 * with these bits (on PXC200AF you need to set mux 2 here)
	 *
	 * needed because bttv-driver sets mux before calling this function
	 */
5055
	if (btv->cardid == PX_PXC200A_CARDID)
L
Linus Torvalds 已提交
5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070
	  btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
	else /* older device */
	  btand(~BT848_IFORM_MUXSEL,BT848_IFORM);

	printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);
}

/* ----------------------------------------------------------------------- */
/* motherboard chipset specific stuff                                      */

void __devinit bttv_check_chipset(void)
{
	int pcipci_fail = 0;
	struct pci_dev *dev = NULL;

5071
	if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) 	/* should check if target is AGP */
L
Linus Torvalds 已提交
5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088
		pcipci_fail = 1;
	if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
		triton1 = 1;
	if (pci_pci_problems & PCIPCI_VSFX)
		vsfx = 1;
#ifdef PCIPCI_ALIMAGIK
	if (pci_pci_problems & PCIPCI_ALIMAGIK)
		latency = 0x0A;
#endif


	/* print warnings about any quirks found */
	if (triton1)
		printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
	if (vsfx)
		printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
	if (pcipci_fail) {
5089 5090
		printk(KERN_INFO "bttv: bttv and your chipset may not work "
							"together.\n");
5091
		if (!no_overlay) {
5092
			printk(KERN_INFO "bttv: overlay will be disabled.\n");
L
Linus Torvalds 已提交
5093
			no_overlay = 1;
5094
		} else {
5095 5096
			printk(KERN_INFO "bttv: overlay forced. Use this "
						"option at your own risk.\n");
L
Linus Torvalds 已提交
5097 5098 5099 5100
		}
	}
	if (UNSET != latency)
		printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
5101
	while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL,
L
Linus Torvalds 已提交
5102
				      PCI_DEVICE_ID_INTEL_82441, dev))) {
5103
		unsigned char b;
L
Linus Torvalds 已提交
5104 5105 5106 5107 5108 5109 5110 5111 5112
		pci_read_config_byte(dev, 0x53, &b);
		if (bttv_debug)
			printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
			       "bufcon=0x%02x\n",b);
	}
}

int __devinit bttv_handle_chipset(struct bttv *btv)
{
5113
	unsigned char command;
L
Linus Torvalds 已提交
5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133

	if (!triton1 && !vsfx && UNSET == latency)
		return 0;

	if (bttv_verbose) {
		if (triton1)
			printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
		if (vsfx && btv->id >= 878)
			printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
		if (UNSET != latency)
			printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
			       btv->c.nr,latency);
	}

	if (btv->id < 878) {
		/* bt848 (mis)uses a bit in the irq mask for etbf */
		if (triton1)
			btv->triton1 = BT848_INT_ETBF;
	} else {
		/* bt878 has a bit in the pci config space for it */
5134
		pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
L
Linus Torvalds 已提交
5135 5136 5137 5138
		if (triton1)
			command |= BT878_EN_TBFX;
		if (vsfx)
			command |= BT878_EN_VSFX;
5139 5140
		pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
	}
L
Linus Torvalds 已提交
5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151
	if (UNSET != latency)
		pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
	return 0;
}


/*
 * Local variables:
 * c-basic-offset: 8
 * End:
 */