linux/drivers/media/video/bt8xx/bttv-cards.c
<<
>>
Prefs
   1/*
   2
   3    bttv-cards.c
   4
   5    this file has configuration informations - card-specific stuff
   6    like the big tvcards array for the most part
   7
   8    Copyright (C) 1996,97,98 Ralph  Metzler (rjkm@thp.uni-koeln.de)
   9                           & Marcus Metzler (mocm@thp.uni-koeln.de)
  10    (c) 1999-2001 Gerd Knorr <kraxel@goldbach.in-berlin.de>
  11
  12    This program is free software; you can redistribute it and/or modify
  13    it under the terms of the GNU General Public License as published by
  14    the Free Software Foundation; either version 2 of the License, or
  15    (at your option) any later version.
  16
  17    This program is distributed in the hope that it will be useful,
  18    but WITHOUT ANY WARRANTY; without even the implied warranty of
  19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20    GNU General Public License for more details.
  21
  22    You should have received a copy of the GNU General Public License
  23    along with this program; if not, write to the Free Software
  24    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25
  26*/
  27
  28#include <linux/delay.h>
  29#include <linux/module.h>
  30#include <linux/kmod.h>
  31#include <linux/init.h>
  32#include <linux/pci.h>
  33#include <linux/vmalloc.h>
  34#include <linux/firmware.h>
  35#include <net/checksum.h>
  36
  37#include <asm/unaligned.h>
  38#include <asm/io.h>
  39
  40#include "bttvp.h"
  41#include <media/v4l2-common.h>
  42#include <media/tvaudio.h>
  43#include "bttv-audio-hook.h"
  44
  45/* fwd decl */
  46static void boot_msp34xx(struct bttv *btv, int pin);
  47static void hauppauge_eeprom(struct bttv *btv);
  48static void avermedia_eeprom(struct bttv *btv);
  49static void osprey_eeprom(struct bttv *btv, const u8 ee[256]);
  50static void modtec_eeprom(struct bttv *btv);
  51static void init_PXC200(struct bttv *btv);
  52static void init_RTV24(struct bttv *btv);
  53
  54static void rv605_muxsel(struct bttv *btv, unsigned int input);
  55static void eagle_muxsel(struct bttv *btv, unsigned int input);
  56static void xguard_muxsel(struct bttv *btv, unsigned int input);
  57static void ivc120_muxsel(struct bttv *btv, unsigned int input);
  58static void gvc1100_muxsel(struct bttv *btv, unsigned int input);
  59
  60static void PXC200_muxsel(struct bttv *btv, unsigned int input);
  61
  62static void picolo_tetra_muxsel(struct bttv *btv, unsigned int input);
  63static void picolo_tetra_init(struct bttv *btv);
  64
  65static void tibetCS16_muxsel(struct bttv *btv, unsigned int input);
  66static void tibetCS16_init(struct bttv *btv);
  67
  68static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input);
  69static void kodicom4400r_init(struct bttv *btv);
  70
  71static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input);
  72static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input);
  73
  74static void geovision_muxsel(struct bttv *btv, unsigned int input);
  75
  76static void phytec_muxsel(struct bttv *btv, unsigned int input);
  77
  78static void gv800s_muxsel(struct bttv *btv, unsigned int input);
  79static void gv800s_init(struct bttv *btv);
  80
  81static int terratec_active_radio_upgrade(struct bttv *btv);
  82static int tea5757_read(struct bttv *btv);
  83static int tea5757_write(struct bttv *btv, int value);
  84static void identify_by_eeprom(struct bttv *btv,
  85                               unsigned char eeprom_data[256]);
  86static int __devinit pvr_boot(struct bttv *btv);
  87
  88/* config variables */
  89static unsigned int triton1;
  90static unsigned int vsfx;
  91static unsigned int latency = UNSET;
  92int no_overlay=-1;
  93
  94static unsigned int card[BTTV_MAX]   = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  95static unsigned int pll[BTTV_MAX]    = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  96static unsigned int tuner[BTTV_MAX]  = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  97static unsigned int svhs[BTTV_MAX]   = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  98static unsigned int remote[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = UNSET };
  99static unsigned int audiodev[BTTV_MAX];
 100static unsigned int saa6588[BTTV_MAX];
 101static struct bttv  *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL };
 102static unsigned int autoload = UNSET;
 103static unsigned int gpiomask = UNSET;
 104static unsigned int audioall = UNSET;
 105static unsigned int audiomux[5] = { [ 0 ... 4 ] = UNSET };
 106
 107/* insmod options */
 108module_param(triton1,    int, 0444);
 109module_param(vsfx,       int, 0444);
 110module_param(no_overlay, int, 0444);
 111module_param(latency,    int, 0444);
 112module_param(gpiomask,   int, 0444);
 113module_param(audioall,   int, 0444);
 114module_param(autoload,   int, 0444);
 115
 116module_param_array(card,     int, NULL, 0444);
 117module_param_array(pll,      int, NULL, 0444);
 118module_param_array(tuner,    int, NULL, 0444);
 119module_param_array(svhs,     int, NULL, 0444);
 120module_param_array(remote,   int, NULL, 0444);
 121module_param_array(audiodev, int, NULL, 0444);
 122module_param_array(audiomux, int, NULL, 0444);
 123
 124MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
 125                 "[enable bug compatibility for triton1 + others]");
 126MODULE_PARM_DESC(vsfx,"set VSFX pci config bit "
 127                 "[yet another chipset flaw workaround]");
 128MODULE_PARM_DESC(latency,"pci latency timer");
 129MODULE_PARM_DESC(card,"specify TV/grabber card model, see CARDLIST file for a list");
 130MODULE_PARM_DESC(pll,"specify installed crystal (0=none, 28=28 MHz, 35=35 MHz)");
 131MODULE_PARM_DESC(tuner,"specify installed tuner type");
 132MODULE_PARM_DESC(autoload, "obsolete option, please do not use anymore");
 133MODULE_PARM_DESC(audiodev, "specify audio device:\n"
 134                "\t\t-1 = no audio\n"
 135                "\t\t 0 = autodetect (default)\n"
 136                "\t\t 1 = msp3400\n"
 137                "\t\t 2 = tda7432\n"
 138                "\t\t 3 = tvaudio");
 139MODULE_PARM_DESC(saa6588, "if 1, then load the saa6588 RDS module, default (0) is to use the card definition.");
 140MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)"
 141                " [some VIA/SIS chipsets are known to have problem with overlay]");
 142
 143/* ----------------------------------------------------------------------- */
 144/* list of card IDs for bt878+ cards                                       */
 145
 146static struct CARD {
 147        unsigned id;
 148        int cardnr;
 149        char *name;
 150} cards[] __devinitdata = {
 151        { 0x13eb0070, BTTV_BOARD_HAUPPAUGE878,  "Hauppauge WinTV" },
 152        { 0x39000070, BTTV_BOARD_HAUPPAUGE878,  "Hauppauge WinTV-D" },
 153        { 0x45000070, BTTV_BOARD_HAUPPAUGEPVR,  "Hauppauge WinTV/PVR" },
 154        { 0xff000070, BTTV_BOARD_OSPREY1x0,     "Osprey-100" },
 155        { 0xff010070, BTTV_BOARD_OSPREY2x0_SVID,"Osprey-200" },
 156        { 0xff020070, BTTV_BOARD_OSPREY500,     "Osprey-500" },
 157        { 0xff030070, BTTV_BOARD_OSPREY2000,    "Osprey-2000" },
 158        { 0xff040070, BTTV_BOARD_OSPREY540,     "Osprey-540" },
 159        { 0xff070070, BTTV_BOARD_OSPREY440,     "Osprey-440" },
 160
 161        { 0x00011002, BTTV_BOARD_ATI_TVWONDER,  "ATI TV Wonder" },
 162        { 0x00031002, BTTV_BOARD_ATI_TVWONDERVE,"ATI TV Wonder/VE" },
 163
 164        { 0x6606107d, BTTV_BOARD_WINFAST2000,   "Leadtek WinFast TV 2000" },
 165        { 0x6607107d, BTTV_BOARD_WINFASTVC100,  "Leadtek WinFast VC 100" },
 166        { 0x6609107d, BTTV_BOARD_WINFAST2000,   "Leadtek TV 2000 XP" },
 167        { 0x263610b4, BTTV_BOARD_STB2,          "STB TV PCI FM, Gateway P/N 6000704" },
 168        { 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        { 0x405010fc, BTTV_BOARD_GVBCTV4PCI,    "I-O Data Co. GV-BCTV4/PCI" },
 171        { 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        { 0x1200bd11, BTTV_BOARD_PINNACLE,      "Pinnacle PCTV [bswap]" },
 177        { 0xff00bd11, BTTV_BOARD_PINNACLE,      "Pinnacle PCTV [bswap]" },
 178        /* this seems to happen as well ... */
 179        { 0xff1211bd, BTTV_BOARD_PINNACLE,      "Pinnacle PCTV" },
 180
 181        { 0x3000121a, BTTV_BOARD_VOODOOTV_200,  "3Dfx VoodooTV 200" },
 182        { 0x263710b4, BTTV_BOARD_VOODOOTV_FM,   "3Dfx VoodooTV FM" },
 183        { 0x3060121a, BTTV_BOARD_STB2,    "3Dfx VoodooTV 100/ STB OEM" },
 184
 185        { 0x3000144f, BTTV_BOARD_MAGICTVIEW063, "(Askey Magic/others) TView99 CPH06x" },
 186        { 0xa005144f, BTTV_BOARD_MAGICTVIEW063, "CPH06X TView99-Card" },
 187        { 0x3002144f, BTTV_BOARD_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH05x" },
 188        { 0x3005144f, BTTV_BOARD_MAGICTVIEW061, "(Askey Magic/others) TView99 CPH061/06L (T1/LC)" },
 189        { 0x5000144f, BTTV_BOARD_MAGICTVIEW061, "Askey CPH050" },
 190        { 0x300014ff, BTTV_BOARD_MAGICTVIEW061, "TView 99 (CPH061)" },
 191        { 0x300214ff, BTTV_BOARD_PHOEBE_TVMAS,  "Phoebe TV Master (CPH060)" },
 192
 193        { 0x00011461, BTTV_BOARD_AVPHONE98,     "AVerMedia TVPhone98" },
 194        { 0x00021461, BTTV_BOARD_AVERMEDIA98,   "AVermedia TVCapture 98" },
 195        { 0x00031461, BTTV_BOARD_AVPHONE98,     "AVerMedia TVPhone98" },
 196        { 0x00041461, BTTV_BOARD_AVERMEDIA98,   "AVerMedia TVCapture 98" },
 197        { 0x03001461, BTTV_BOARD_AVERMEDIA98,   "VDOMATE TV TUNER CARD" },
 198
 199        { 0x1117153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (Philips PAL B/G)" },
 200        { 0x1118153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (Temic PAL B/G)" },
 201        { 0x1119153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (Philips PAL I)" },
 202        { 0x111a153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (Temic PAL I)" },
 203
 204        { 0x1123153b, BTTV_BOARD_TERRATVRADIO,  "Terratec TV Radio+" },
 205        { 0x1127153b, BTTV_BOARD_TERRATV,       "Terratec TV+ (V1.05)"    },
 206        /* clashes with FlyVideo
 207         *{ 0x18521852, BTTV_BOARD_TERRATV,     "Terratec TV+ (V1.10)"    }, */
 208        { 0x1134153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue (LR102)" },
 209        { 0x1135153b, BTTV_BOARD_TERRATVALUER,  "Terratec TValue Radio" }, /* LR102 */
 210        { 0x5018153b, BTTV_BOARD_TERRATVALUE,   "Terratec TValue" },       /* ?? */
 211        { 0xff3b153b, BTTV_BOARD_TERRATVALUER,  "Terratec TValue Radio" }, /* ?? */
 212
 213        { 0x400015b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
 214        { 0x400a15b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV" },
 215        { 0x400d15b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
 216        { 0x401015b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
 217        { 0x401615b0, BTTV_BOARD_ZOLTRIX_GENIE, "Zoltrix Genie TV / Radio" },
 218
 219        { 0x1430aa00, BTTV_BOARD_PV143,         "Provideo PV143A" },
 220        { 0x1431aa00, BTTV_BOARD_PV143,         "Provideo PV143B" },
 221        { 0x1432aa00, BTTV_BOARD_PV143,         "Provideo PV143C" },
 222        { 0x1433aa00, BTTV_BOARD_PV143,         "Provideo PV143D" },
 223        { 0x1433aa03, BTTV_BOARD_PV143,         "Security Eyes" },
 224
 225        { 0x1460aa00, BTTV_BOARD_PV150,         "Provideo PV150A-1" },
 226        { 0x1461aa01, BTTV_BOARD_PV150,         "Provideo PV150A-2" },
 227        { 0x1462aa02, BTTV_BOARD_PV150,         "Provideo PV150A-3" },
 228        { 0x1463aa03, BTTV_BOARD_PV150,         "Provideo PV150A-4" },
 229
 230        { 0x1464aa04, BTTV_BOARD_PV150,         "Provideo PV150B-1" },
 231        { 0x1465aa05, BTTV_BOARD_PV150,         "Provideo PV150B-2" },
 232        { 0x1466aa06, BTTV_BOARD_PV150,         "Provideo PV150B-3" },
 233        { 0x1467aa07, BTTV_BOARD_PV150,         "Provideo PV150B-4" },
 234
 235        { 0xa132ff00, BTTV_BOARD_IVC100,        "IVC-100"  },
 236        { 0xa1550000, BTTV_BOARD_IVC200,        "IVC-200"  },
 237        { 0xa1550001, BTTV_BOARD_IVC200,        "IVC-200"  },
 238        { 0xa1550002, BTTV_BOARD_IVC200,        "IVC-200"  },
 239        { 0xa1550003, BTTV_BOARD_IVC200,        "IVC-200"  },
 240        { 0xa1550100, BTTV_BOARD_IVC200,        "IVC-200G" },
 241        { 0xa1550101, BTTV_BOARD_IVC200,        "IVC-200G" },
 242        { 0xa1550102, BTTV_BOARD_IVC200,        "IVC-200G" },
 243        { 0xa1550103, BTTV_BOARD_IVC200,        "IVC-200G" },
 244        { 0xa182ff00, BTTV_BOARD_IVC120,        "IVC-120G" },
 245        { 0xa182ff01, BTTV_BOARD_IVC120,        "IVC-120G" },
 246        { 0xa182ff02, BTTV_BOARD_IVC120,        "IVC-120G" },
 247        { 0xa182ff03, BTTV_BOARD_IVC120,        "IVC-120G" },
 248        { 0xa182ff04, BTTV_BOARD_IVC120,        "IVC-120G" },
 249        { 0xa182ff05, BTTV_BOARD_IVC120,        "IVC-120G" },
 250        { 0xa182ff06, BTTV_BOARD_IVC120,        "IVC-120G" },
 251        { 0xa182ff07, BTTV_BOARD_IVC120,        "IVC-120G" },
 252        { 0xa182ff08, BTTV_BOARD_IVC120,        "IVC-120G" },
 253        { 0xa182ff09, BTTV_BOARD_IVC120,        "IVC-120G" },
 254        { 0xa182ff0a, BTTV_BOARD_IVC120,        "IVC-120G" },
 255        { 0xa182ff0b, BTTV_BOARD_IVC120,        "IVC-120G" },
 256        { 0xa182ff0c, BTTV_BOARD_IVC120,        "IVC-120G" },
 257        { 0xa182ff0d, BTTV_BOARD_IVC120,        "IVC-120G" },
 258        { 0xa182ff0e, BTTV_BOARD_IVC120,        "IVC-120G" },
 259        { 0xa182ff0f, BTTV_BOARD_IVC120,        "IVC-120G" },
 260        { 0xf0500000, BTTV_BOARD_IVCE8784,      "IVCE-8784" },
 261        { 0xf0500001, BTTV_BOARD_IVCE8784,      "IVCE-8784" },
 262        { 0xf0500002, BTTV_BOARD_IVCE8784,      "IVCE-8784" },
 263        { 0xf0500003, BTTV_BOARD_IVCE8784,      "IVCE-8784" },
 264
 265        { 0x41424344, BTTV_BOARD_GRANDTEC,      "GrandTec Multi Capture" },
 266        { 0x01020304, BTTV_BOARD_XGUARD,        "Grandtec Grand X-Guard" },
 267
 268        { 0x18501851, BTTV_BOARD_CHRONOS_VS2,   "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
 269        { 0xa0501851, BTTV_BOARD_CHRONOS_VS2,   "FlyVideo 98 (LR50)/ Chronos Video Shuttle II" },
 270        { 0x18511851, BTTV_BOARD_FLYVIDEO98EZ,  "FlyVideo 98EZ (LR51)/ CyberMail AV" },
 271        { 0x18521852, BTTV_BOARD_TYPHOON_TVIEW, "FlyVideo 98FM (LR50)/ Typhoon TView TV/FM Tuner" },
 272        { 0x41a0a051, BTTV_BOARD_FLYVIDEO_98FM, "Lifeview FlyVideo 98 LR50 Rev Q" },
 273        { 0x18501f7f, BTTV_BOARD_FLYVIDEO_98,   "Lifeview Flyvideo 98" },
 274
 275        { 0x010115cb, BTTV_BOARD_GMV1,          "AG GMV1" },
 276        { 0x010114c7, BTTV_BOARD_MODTEC_205,    "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV" },
 277
 278        { 0x10b42636, BTTV_BOARD_HAUPPAUGE878,  "STB ???" },
 279        { 0x217d6606, BTTV_BOARD_WINFAST2000,   "Leadtek WinFast TV 2000" },
 280        { 0xfff6f6ff, BTTV_BOARD_WINFAST2000,   "Leadtek WinFast TV 2000" },
 281        { 0x03116000, BTTV_BOARD_SENSORAY311,   "Sensoray 311" },
 282        { 0x00790e11, BTTV_BOARD_WINDVR,        "Canopus WinDVR PCI" },
 283        { 0xa0fca1a0, BTTV_BOARD_ZOLTRIX,       "Face to Face Tvmax" },
 284        { 0x82b2aa6a, BTTV_BOARD_SIMUS_GVC1100, "SIMUS GVC1100" },
 285        { 0x146caa0c, BTTV_BOARD_PV951,         "ituner spectra8" },
 286        { 0x200a1295, BTTV_BOARD_PXC200,        "ImageNation PXC200A" },
 287
 288        { 0x40111554, BTTV_BOARD_PV_BT878P_9B,  "Prolink Pixelview PV-BT" },
 289        { 0x17de0a01, BTTV_BOARD_KWORLD,        "Mecer TV/FM/Video Tuner" },
 290
 291        { 0x01051805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #1" },
 292        { 0x01061805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #2" },
 293        { 0x01071805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" },
 294        { 0x01081805, BTTV_BOARD_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" },
 295
 296        { 0x15409511, BTTV_BOARD_ACORP_Y878F, "Acorp Y878F" },
 297
 298        { 0x53534149, BTTV_BOARD_SSAI_SECURITY, "SSAI Security Video Interface" },
 299        { 0x5353414a, BTTV_BOARD_SSAI_ULTRASOUND, "SSAI Ultrasound Video Interface" },
 300
 301        /* likely broken, vendor id doesn't match the other magic views ...
 302         * { 0xa0fca04f, BTTV_BOARD_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, */
 303
 304        /* Duplicate PCI ID, reconfigure for this board during the eeprom read.
 305        * { 0x13eb0070, BTTV_BOARD_HAUPPAUGE_IMPACTVCB,  "Hauppauge ImpactVCB" }, */
 306
 307        { 0x109e036e, BTTV_BOARD_CONCEPTRONIC_CTVFMI2,  "Conceptronic CTVFMi v2"},
 308
 309        /* DVB cards (using pci function .1 for mpeg data xfer) */
 310        { 0x001c11bd, BTTV_BOARD_PINNACLESAT,   "Pinnacle PCTV Sat" },
 311        { 0x01010071, BTTV_BOARD_NEBULA_DIGITV, "Nebula Electronics DigiTV" },
 312        { 0x20007063, BTTV_BOARD_PC_HDTV,       "pcHDTV HD-2000 TV"},
 313        { 0x002611bd, BTTV_BOARD_TWINHAN_DST,   "Pinnacle PCTV SAT CI" },
 314        { 0x00011822, BTTV_BOARD_TWINHAN_DST,   "Twinhan VisionPlus DVB" },
 315        { 0xfc00270f, BTTV_BOARD_TWINHAN_DST,   "ChainTech digitop DST-1000 DVB-S" },
 316        { 0x07711461, BTTV_BOARD_AVDVBT_771,    "AVermedia AverTV DVB-T 771" },
 317        { 0x07611461, BTTV_BOARD_AVDVBT_761,    "AverMedia AverTV DVB-T 761" },
 318        { 0xdb1018ac, BTTV_BOARD_DVICO_DVBT_LITE,    "DViCO FusionHDTV DVB-T Lite" },
 319        { 0xdb1118ac, BTTV_BOARD_DVICO_DVBT_LITE,    "Ultraview DVB-T Lite" },
 320        { 0xd50018ac, BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE,    "DViCO FusionHDTV 5 Lite" },
 321        { 0x00261822, BTTV_BOARD_TWINHAN_DST,   "DNTV Live! Mini "},
 322        { 0xd200dbc0, BTTV_BOARD_DVICO_FUSIONHDTV_2,    "DViCO FusionHDTV 2" },
 323        { 0x763c008a, BTTV_BOARD_GEOVISION_GV600,       "GeoVision GV-600" },
 324        { 0x18011000, BTTV_BOARD_ENLTV_FM_2,    "Encore ENL TV-FM-2" },
 325        { 0x763d800a, BTTV_BOARD_GEOVISION_GV800S, "GeoVision GV-800(S) (master)" },
 326        { 0x763d800b, BTTV_BOARD_GEOVISION_GV800S_SL,   "GeoVision GV-800(S) (slave)" },
 327        { 0x763d800c, BTTV_BOARD_GEOVISION_GV800S_SL,   "GeoVision GV-800(S) (slave)" },
 328        { 0x763d800d, BTTV_BOARD_GEOVISION_GV800S_SL,   "GeoVision GV-800(S) (slave)" },
 329
 330        { 0x15401830, BTTV_BOARD_PV183,         "Provideo PV183-1" },
 331        { 0x15401831, BTTV_BOARD_PV183,         "Provideo PV183-2" },
 332        { 0x15401832, BTTV_BOARD_PV183,         "Provideo PV183-3" },
 333        { 0x15401833, BTTV_BOARD_PV183,         "Provideo PV183-4" },
 334        { 0x15401834, BTTV_BOARD_PV183,         "Provideo PV183-5" },
 335        { 0x15401835, BTTV_BOARD_PV183,         "Provideo PV183-6" },
 336        { 0x15401836, BTTV_BOARD_PV183,         "Provideo PV183-7" },
 337        { 0x15401837, BTTV_BOARD_PV183,         "Provideo PV183-8" },
 338
 339        { 0, -1, NULL }
 340};
 341
 342/* ----------------------------------------------------------------------- */
 343/* array with description for bt848 / bt878 tv/grabber cards               */
 344
 345struct tvcard bttv_tvcards[] = {
 346        /* ---- card 0x00 ---------------------------------- */
 347        [BTTV_BOARD_UNKNOWN] = {
 348                .name           = " *** UNKNOWN/GENERIC *** ",
 349                .video_inputs   = 4,
 350                .svhs           = 2,
 351                .muxsel         = MUXSEL(2, 3, 1, 0),
 352                .tuner_type     = UNSET,
 353                .tuner_addr     = ADDR_UNSET,
 354        },
 355        [BTTV_BOARD_MIRO] = {
 356                .name           = "MIRO PCTV",
 357                .video_inputs   = 4,
 358                /* .audio_inputs= 1, */
 359                .svhs           = 2,
 360                .gpiomask       = 15,
 361                .muxsel         = MUXSEL(2, 3, 1, 1),
 362                .gpiomux        = { 2, 0, 0, 0 },
 363                .gpiomute       = 10,
 364                .needs_tvaudio  = 1,
 365                .tuner_type     = UNSET,
 366                .tuner_addr     = ADDR_UNSET,
 367        },
 368        [BTTV_BOARD_HAUPPAUGE] = {
 369                .name           = "Hauppauge (bt848)",
 370                .video_inputs   = 4,
 371                /* .audio_inputs= 1, */
 372                .svhs           = 2,
 373                .gpiomask       = 7,
 374                .muxsel         = MUXSEL(2, 3, 1, 1),
 375                .gpiomux        = { 0, 1, 2, 3 },
 376                .gpiomute       = 4,
 377                .needs_tvaudio  = 1,
 378                .tuner_type     = UNSET,
 379                .tuner_addr     = ADDR_UNSET,
 380        },
 381        [BTTV_BOARD_STB] = {
 382                .name           = "STB, Gateway P/N 6000699 (bt848)",
 383                .video_inputs   = 3,
 384                /* .audio_inputs= 1, */
 385                .svhs           = 2,
 386                .gpiomask       = 7,
 387                .muxsel         = MUXSEL(2, 3, 1, 1),
 388                .gpiomux        = { 4, 0, 2, 3 },
 389                .gpiomute       = 1,
 390                .no_msp34xx     = 1,
 391                .needs_tvaudio  = 1,
 392                .tuner_type     = TUNER_PHILIPS_NTSC,
 393                .tuner_addr     = ADDR_UNSET,
 394                .pll            = PLL_28,
 395                .has_radio      = 1,
 396        },
 397
 398        /* ---- card 0x04 ---------------------------------- */
 399        [BTTV_BOARD_INTEL] = {
 400                .name           = "Intel Create and Share PCI/ Smart Video Recorder III",
 401                .video_inputs   = 4,
 402                /* .audio_inputs= 0, */
 403                .svhs           = 2,
 404                .gpiomask       = 0,
 405                .muxsel         = MUXSEL(2, 3, 1, 1),
 406                .gpiomux        = { 0 },
 407                .needs_tvaudio  = 0,
 408                .tuner_type     = TUNER_ABSENT,
 409                .tuner_addr     = ADDR_UNSET,
 410        },
 411        [BTTV_BOARD_DIAMOND] = {
 412                .name           = "Diamond DTV2000",
 413                .video_inputs   = 4,
 414                /* .audio_inputs= 1, */
 415                .svhs           = 2,
 416                .gpiomask       = 3,
 417                .muxsel         = MUXSEL(2, 3, 1, 0),
 418                .gpiomux        = { 0, 1, 0, 1 },
 419                .gpiomute       = 3,
 420                .needs_tvaudio  = 1,
 421                .tuner_type     = UNSET,
 422                .tuner_addr     = ADDR_UNSET,
 423        },
 424        [BTTV_BOARD_AVERMEDIA] = {
 425                .name           = "AVerMedia TVPhone",
 426                .video_inputs   = 3,
 427                /* .audio_inputs= 1, */
 428                .svhs           = 3,
 429                .muxsel         = MUXSEL(2, 3, 1, 1),
 430                .gpiomask       = 0x0f,
 431                .gpiomux        = { 0x0c, 0x04, 0x08, 0x04 },
 432                /*                0x04 for some cards ?? */
 433                .needs_tvaudio  = 1,
 434                .tuner_type     = UNSET,
 435                .tuner_addr     = ADDR_UNSET,
 436                .audio_mode_gpio= avermedia_tvphone_audio,
 437                .has_remote     = 1,
 438        },
 439        [BTTV_BOARD_MATRIX_VISION] = {
 440                .name           = "MATRIX-Vision MV-Delta",
 441                .video_inputs   = 5,
 442                /* .audio_inputs= 1, */
 443                .svhs           = 3,
 444                .gpiomask       = 0,
 445                .muxsel         = MUXSEL(2, 3, 1, 0, 0),
 446                .gpiomux        = { 0 },
 447                .needs_tvaudio  = 1,
 448                .tuner_type     = TUNER_ABSENT,
 449                .tuner_addr     = ADDR_UNSET,
 450        },
 451
 452        /* ---- card 0x08 ---------------------------------- */
 453        [BTTV_BOARD_FLYVIDEO] = {
 454                .name           = "Lifeview FlyVideo II (Bt848) LR26 / MAXI TV Video PCI2 LR26",
 455                .video_inputs   = 4,
 456                /* .audio_inputs= 1, */
 457                .svhs           = 2,
 458                .gpiomask       = 0xc00,
 459                .muxsel         = MUXSEL(2, 3, 1, 1),
 460                .gpiomux        = { 0, 0xc00, 0x800, 0x400 },
 461                .gpiomute       = 0xc00,
 462                .needs_tvaudio  = 1,
 463                .pll            = PLL_28,
 464                .tuner_type     = UNSET,
 465                .tuner_addr     = ADDR_UNSET,
 466        },
 467        [BTTV_BOARD_TURBOTV] = {
 468                .name           = "IMS/IXmicro TurboTV",
 469                .video_inputs   = 3,
 470                /* .audio_inputs= 1, */
 471                .svhs           = 2,
 472                .gpiomask       = 3,
 473                .muxsel         = MUXSEL(2, 3, 1, 1),
 474                .gpiomux        = { 1, 1, 2, 3 },
 475                .needs_tvaudio  = 0,
 476                .pll            = PLL_28,
 477                .tuner_type     = TUNER_TEMIC_PAL,
 478                .tuner_addr     = ADDR_UNSET,
 479        },
 480        [BTTV_BOARD_HAUPPAUGE878] = {
 481                .name           = "Hauppauge (bt878)",
 482                .video_inputs   = 4,
 483                /* .audio_inputs= 1, */
 484                .svhs           = 2,
 485                .gpiomask       = 0x0f, /* old: 7 */
 486                .muxsel         = MUXSEL(2, 0, 1, 1),
 487                .gpiomux        = { 0, 1, 2, 3 },
 488                .gpiomute       = 4,
 489                .needs_tvaudio  = 1,
 490                .pll            = PLL_28,
 491                .tuner_type     = UNSET,
 492                .tuner_addr     = ADDR_UNSET,
 493        },
 494        [BTTV_BOARD_MIROPRO] = {
 495                .name           = "MIRO PCTV pro",
 496                .video_inputs   = 3,
 497                /* .audio_inputs= 1, */
 498                .svhs           = 2,
 499                .gpiomask       = 0x3014f,
 500                .muxsel         = MUXSEL(2, 3, 1, 1),
 501                .gpiomux        = { 0x20001,0x10001, 0, 0 },
 502                .gpiomute       = 10,
 503                .needs_tvaudio  = 1,
 504                .tuner_type     = UNSET,
 505                .tuner_addr     = ADDR_UNSET,
 506        },
 507
 508        /* ---- card 0x0c ---------------------------------- */
 509        [BTTV_BOARD_ADSTECH_TV] = {
 510                .name           = "ADS Technologies Channel Surfer TV (bt848)",
 511                .video_inputs   = 3,
 512                /* .audio_inputs= 1, */
 513                .svhs           = 2,
 514                .gpiomask       = 15,
 515                .muxsel         = MUXSEL(2, 3, 1, 1),
 516                .gpiomux        = { 13, 14, 11, 7 },
 517                .needs_tvaudio  = 1,
 518                .tuner_type     = UNSET,
 519                .tuner_addr     = ADDR_UNSET,
 520        },
 521        [BTTV_BOARD_AVERMEDIA98] = {
 522                .name           = "AVerMedia TVCapture 98",
 523                .video_inputs   = 3,
 524                /* .audio_inputs= 4, */
 525                .svhs           = 2,
 526                .gpiomask       = 15,
 527                .muxsel         = MUXSEL(2, 3, 1, 1),
 528                .gpiomux        = { 13, 14, 11, 7 },
 529                .needs_tvaudio  = 1,
 530                .msp34xx_alt    = 1,
 531                .pll            = PLL_28,
 532                .tuner_type     = TUNER_PHILIPS_PAL,
 533                .tuner_addr     = ADDR_UNSET,
 534                .audio_mode_gpio= avermedia_tv_stereo_audio,
 535                .no_gpioirq     = 1,
 536        },
 537        [BTTV_BOARD_VHX] = {
 538                .name           = "Aimslab Video Highway Xtreme (VHX)",
 539                .video_inputs   = 3,
 540                /* .audio_inputs= 1, */
 541                .svhs           = 2,
 542                .gpiomask       = 7,
 543                .muxsel         = MUXSEL(2, 3, 1, 1),
 544                .gpiomux        = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */
 545                .gpiomute       = 4,
 546                .needs_tvaudio  = 1,
 547                .pll            = PLL_28,
 548                .tuner_type     = UNSET,
 549                .tuner_addr     = ADDR_UNSET,
 550        },
 551        [BTTV_BOARD_ZOLTRIX] = {
 552                .name           = "Zoltrix TV-Max",
 553                .video_inputs   = 3,
 554                /* .audio_inputs= 1, */
 555                .svhs           = 2,
 556                .gpiomask       = 15,
 557                .muxsel         = MUXSEL(2, 3, 1, 1),
 558                .gpiomux        = { 0, 0, 1, 0 },
 559                .gpiomute       = 10,
 560                .needs_tvaudio  = 1,
 561                .tuner_type     = UNSET,
 562                .tuner_addr     = ADDR_UNSET,
 563        },
 564
 565        /* ---- card 0x10 ---------------------------------- */
 566        [BTTV_BOARD_PIXVIEWPLAYTV] = {
 567                .name           = "Prolink Pixelview PlayTV (bt878)",
 568                .video_inputs   = 3,
 569                /* .audio_inputs= 1, */
 570                .svhs           = 2,
 571                .gpiomask       = 0x01fe00,
 572                .muxsel         = MUXSEL(2, 3, 1, 1),
 573                /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */
 574                .gpiomux        = { 0x001e00, 0, 0x018000, 0x014000 },
 575                .gpiomute       = 0x002000,
 576                .needs_tvaudio  = 1,
 577                .pll            = PLL_28,
 578                .tuner_type     = UNSET,
 579                .tuner_addr     = ADDR_UNSET,
 580        },
 581        [BTTV_BOARD_WINVIEW_601] = {
 582                .name           = "Leadtek WinView 601",
 583                .video_inputs   = 3,
 584                /* .audio_inputs= 1, */
 585                .svhs           = 2,
 586                .gpiomask       = 0x8300f8,
 587                .muxsel         = MUXSEL(2, 3, 1, 1, 0),
 588                .gpiomux        = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 },
 589                .gpiomute       = 0xcfa007,
 590                .needs_tvaudio  = 1,
 591                .tuner_type     = UNSET,
 592                .tuner_addr     = ADDR_UNSET,
 593                .volume_gpio    = winview_volume,
 594                .has_radio      = 1,
 595        },
 596        [BTTV_BOARD_AVEC_INTERCAP] = {
 597                .name           = "AVEC Intercapture",
 598                .video_inputs   = 3,
 599                /* .audio_inputs= 2, */
 600                .svhs           = 2,
 601                .gpiomask       = 0,
 602                .muxsel         = MUXSEL(2, 3, 1, 1),
 603                .gpiomux        = { 1, 0, 0, 0 },
 604                .needs_tvaudio  = 1,
 605                .tuner_type     = UNSET,
 606                .tuner_addr     = ADDR_UNSET,
 607        },
 608        [BTTV_BOARD_LIFE_FLYKIT] = {
 609                .name           = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)",
 610                .video_inputs   = 4,
 611                /* .audio_inputs= 1, */
 612                .svhs           = NO_SVHS,
 613                .gpiomask       = 0x8dff00,
 614                .muxsel         = MUXSEL(2, 3, 1, 1),
 615                .gpiomux        = { 0 },
 616                .no_msp34xx     = 1,
 617                .tuner_type     = TUNER_ABSENT,
 618                .tuner_addr     = ADDR_UNSET,
 619        },
 620
 621        /* ---- card 0x14 ---------------------------------- */
 622        [BTTV_BOARD_CEI_RAFFLES] = {
 623                .name           = "CEI Raffles Card",
 624                .video_inputs   = 3,
 625                /* .audio_inputs= 3, */
 626                .svhs           = 2,
 627                .muxsel         = MUXSEL(2, 3, 1, 1),
 628                .tuner_type     = UNSET,
 629                .tuner_addr     = ADDR_UNSET,
 630        },
 631        [BTTV_BOARD_CONFERENCETV] = {
 632                .name           = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50",
 633                .video_inputs   = 4,
 634                /* .audio_inputs= 2,  tuner, line in */
 635                .svhs           = 2,
 636                .gpiomask       = 0x1800,
 637                .muxsel         = MUXSEL(2, 3, 1, 1),
 638                .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
 639                .gpiomute       = 0x1800,
 640                .pll            = PLL_28,
 641                .tuner_type     = TUNER_PHILIPS_PAL_I,
 642                .tuner_addr     = ADDR_UNSET,
 643        },
 644        [BTTV_BOARD_PHOEBE_TVMAS] = {
 645                .name           = "Askey CPH050/ Phoebe Tv Master + FM",
 646                .video_inputs   = 3,
 647                /* .audio_inputs= 1, */
 648                .svhs           = 2,
 649                .gpiomask       = 0xc00,
 650                .muxsel         = MUXSEL(2, 3, 1, 1),
 651                .gpiomux        = { 0, 1, 0x800, 0x400 },
 652                .gpiomute       = 0xc00,
 653                .needs_tvaudio  = 1,
 654                .pll            = PLL_28,
 655                .tuner_type     = UNSET,
 656                .tuner_addr     = ADDR_UNSET,
 657        },
 658        [BTTV_BOARD_MODTEC_205] = {
 659                .name           = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878",
 660                .video_inputs   = 3,
 661                /* .audio_inputs= 1, */
 662                .svhs           = NO_SVHS,
 663                .has_dig_in     = 1,
 664                .gpiomask       = 7,
 665                .muxsel         = MUXSEL(2, 3, 0), /* input 2 is digital */
 666                /* .digital_mode= DIGITAL_MODE_CAMERA, */
 667                .gpiomux        = { 0, 0, 0, 0 },
 668                .no_msp34xx     = 1,
 669                .pll            = PLL_28,
 670                .tuner_type     = TUNER_ALPS_TSBB5_PAL_I,
 671                .tuner_addr     = ADDR_UNSET,
 672        },
 673
 674        /* ---- card 0x18 ---------------------------------- */
 675        [BTTV_BOARD_MAGICTVIEW061] = {
 676                .name           = "Askey CPH05X/06X (bt878) [many vendors]",
 677                .video_inputs   = 3,
 678                /* .audio_inputs= 1, */
 679                .svhs           = 2,
 680                .gpiomask       = 0xe00,
 681                .muxsel         = MUXSEL(2, 3, 1, 1),
 682                .gpiomux        = {0x400, 0x400, 0x400, 0x400 },
 683                .gpiomute       = 0xc00,
 684                .needs_tvaudio  = 1,
 685                .pll            = PLL_28,
 686                .tuner_type     = UNSET,
 687                .tuner_addr     = ADDR_UNSET,
 688                .has_remote     = 1,
 689        },
 690        [BTTV_BOARD_VOBIS_BOOSTAR] = {
 691                .name           = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar",
 692                .video_inputs   = 3,
 693                /* .audio_inputs= 1, */
 694                .svhs           = 2,
 695                .gpiomask       = 0x1f0fff,
 696                .muxsel         = MUXSEL(2, 3, 1, 1),
 697                .gpiomux        = { 0x20000, 0x30000, 0x10000, 0 },
 698                .gpiomute       = 0x40000,
 699                .needs_tvaudio  = 0,
 700                .tuner_type     = TUNER_PHILIPS_PAL,
 701                .tuner_addr     = ADDR_UNSET,
 702                .audio_mode_gpio= terratv_audio,
 703        },
 704        [BTTV_BOARD_HAUPPAUG_WCAM] = {
 705                .name           = "Hauppauge WinCam newer (bt878)",
 706                .video_inputs   = 4,
 707                /* .audio_inputs= 1, */
 708                .svhs           = 3,
 709                .gpiomask       = 7,
 710                .muxsel         = MUXSEL(2, 0, 1, 1),
 711                .gpiomux        = { 0, 1, 2, 3 },
 712                .gpiomute       = 4,
 713                .needs_tvaudio  = 1,
 714                .tuner_type     = UNSET,
 715                .tuner_addr     = ADDR_UNSET,
 716        },
 717        [BTTV_BOARD_MAXI] = {
 718                .name           = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50",
 719                .video_inputs   = 4,
 720                /* .audio_inputs= 2, */
 721                .svhs           = 2,
 722                .gpiomask       = 0x1800,
 723                .muxsel         = MUXSEL(2, 3, 1, 1),
 724                .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
 725                .gpiomute       = 0x1800,
 726                .pll            = PLL_28,
 727                .tuner_type     = TUNER_PHILIPS_SECAM,
 728                .tuner_addr     = ADDR_UNSET,
 729        },
 730
 731        /* ---- card 0x1c ---------------------------------- */
 732        [BTTV_BOARD_TERRATV] = {
 733                .name           = "Terratec TerraTV+ Version 1.1 (bt878)",
 734                .video_inputs   = 3,
 735                /* .audio_inputs= 1, */
 736                .svhs           = 2,
 737                .gpiomask       = 0x1f0fff,
 738                .muxsel         = MUXSEL(2, 3, 1, 1),
 739                .gpiomux        = { 0x20000, 0x30000, 0x10000, 0x00000 },
 740                .gpiomute       = 0x40000,
 741                .needs_tvaudio  = 0,
 742                .tuner_type     = TUNER_PHILIPS_PAL,
 743                .tuner_addr     = ADDR_UNSET,
 744                .audio_mode_gpio= terratv_audio,
 745                /* GPIO wiring:
 746                External 20 pin connector (for Active Radio Upgrade board)
 747                gpio00: i2c-sda
 748                gpio01: i2c-scl
 749                gpio02: om5610-data
 750                gpio03: om5610-clk
 751                gpio04: om5610-wre
 752                gpio05: om5610-stereo
 753                gpio06: rds6588-davn
 754                gpio07: Pin 7 n.c.
 755                gpio08: nIOW
 756                gpio09+10: nIOR, nSEL ?? (bt878)
 757                        gpio09: nIOR (bt848)
 758                        gpio10: nSEL (bt848)
 759                Sound Routing:
 760                gpio16: u2-A0 (1st 4052bt)
 761                gpio17: u2-A1
 762                gpio18: u2-nEN
 763                gpio19: u4-A0 (2nd 4052)
 764                gpio20: u4-A1
 765                        u4-nEN - GND
 766                Btspy:
 767                        00000 : Cdrom (internal audio input)
 768                        10000 : ext. Video audio input
 769                        20000 : TV Mono
 770                        a0000 : TV Mono/2
 771                1a0000 : TV Stereo
 772                        30000 : Radio
 773                        40000 : Mute
 774        */
 775
 776        },
 777        [BTTV_BOARD_PXC200] = {
 778                /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */
 779                .name           = "Imagenation PXC200",
 780                .video_inputs   = 5,
 781                /* .audio_inputs= 1, */
 782                .svhs           = 1, /* was: 4 */
 783                .gpiomask       = 0,
 784                .muxsel         = MUXSEL(2, 3, 1, 0, 0),
 785                .gpiomux        = { 0 },
 786                .needs_tvaudio  = 1,
 787                .tuner_type     = TUNER_ABSENT,
 788                .tuner_addr     = ADDR_UNSET,
 789                .muxsel_hook    = PXC200_muxsel,
 790
 791        },
 792        [BTTV_BOARD_FLYVIDEO_98] = {
 793                .name           = "Lifeview FlyVideo 98 LR50",
 794                .video_inputs   = 4,
 795                /* .audio_inputs= 1, */
 796                .svhs           = 2,
 797                .gpiomask       = 0x1800,  /* 0x8dfe00 */
 798                .muxsel         = MUXSEL(2, 3, 1, 1),
 799                .gpiomux        = { 0, 0x0800, 0x1000, 0x1000 },
 800                .gpiomute       = 0x1800,
 801                .pll            = PLL_28,
 802                .tuner_type     = UNSET,
 803                .tuner_addr     = ADDR_UNSET,
 804        },
 805        [BTTV_BOARD_IPROTV] = {
 806                .name           = "Formac iProTV, Formac ProTV I (bt848)",
 807                .video_inputs   = 4,
 808                /* .audio_inputs= 1, */
 809                .svhs           = 3,
 810                .gpiomask       = 1,
 811                .muxsel         = MUXSEL(2, 3, 1, 1),
 812                .gpiomux        = { 1, 0, 0, 0 },
 813                .pll            = PLL_28,
 814                .tuner_type     = TUNER_PHILIPS_PAL,
 815                .tuner_addr     = ADDR_UNSET,
 816        },
 817
 818        /* ---- card 0x20 ---------------------------------- */
 819        [BTTV_BOARD_INTEL_C_S_PCI] = {
 820                .name           = "Intel Create and Share PCI/ Smart Video Recorder III",
 821                .video_inputs   = 4,
 822                /* .audio_inputs= 0, */
 823                .svhs           = 2,
 824                .gpiomask       = 0,
 825                .muxsel         = MUXSEL(2, 3, 1, 1),
 826                .gpiomux        = { 0 },
 827                .needs_tvaudio  = 0,
 828                .tuner_type     = TUNER_ABSENT,
 829                .tuner_addr     = ADDR_UNSET,
 830        },
 831        [BTTV_BOARD_TERRATVALUE] = {
 832                .name           = "Terratec TerraTValue Version Bt878",
 833                .video_inputs   = 3,
 834                /* .audio_inputs= 1, */
 835                .svhs           = 2,
 836                .gpiomask       = 0xffff00,
 837                .muxsel         = MUXSEL(2, 3, 1, 1),
 838                .gpiomux        = { 0x500, 0, 0x300, 0x900 },
 839                .gpiomute       = 0x900,
 840                .needs_tvaudio  = 1,
 841                .pll            = PLL_28,
 842                .tuner_type     = TUNER_PHILIPS_PAL,
 843                .tuner_addr     = ADDR_UNSET,
 844        },
 845        [BTTV_BOARD_WINFAST2000] = {
 846                .name           = "Leadtek WinFast 2000/ WinFast 2000 XP",
 847                .video_inputs   = 4,
 848                /* .audio_inputs= 1, */
 849                .svhs           = 2,
 850                /* TV, CVid, SVid, CVid over SVid connector */
 851                .muxsel         = MUXSEL(2, 3, 1, 1, 0),
 852                /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
 853                .gpiomask       = 0xb33000,
 854                .gpiomux        = { 0x122000,0x1000,0x0000,0x620000 },
 855                .gpiomute       = 0x800000,
 856                /* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
 857                        gpio23 -- hef4052:nEnable (0x800000)
 858                        gpio12 -- hef4052:A1
 859                        gpio13 -- hef4052:A0
 860                0x0000: external audio
 861                0x1000: FM
 862                0x2000: TV
 863                0x3000: n.c.
 864                Note: There exists another variant "Winfast 2000" with tv stereo !?
 865                Note: eeprom only contains FF and pci subsystem id 107d:6606
 866                */
 867                .needs_tvaudio  = 0,
 868                .pll            = PLL_28,
 869                .has_radio      = 1,
 870                .tuner_type     = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */
 871                .tuner_addr     = ADDR_UNSET,
 872                .audio_mode_gpio= winfast2000_audio,
 873                .has_remote     = 1,
 874        },
 875        [BTTV_BOARD_CHRONOS_VS2] = {
 876                .name           = "Lifeview FlyVideo 98 LR50 / Chronos Video Shuttle II",
 877                .video_inputs   = 4,
 878                /* .audio_inputs= 3, */
 879                .svhs           = 2,
 880                .gpiomask       = 0x1800,
 881                .muxsel         = MUXSEL(2, 3, 1, 1),
 882                .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
 883                .gpiomute       = 0x1800,
 884                .pll            = PLL_28,
 885                .tuner_type     = UNSET,
 886                .tuner_addr     = ADDR_UNSET,
 887        },
 888
 889        /* ---- card 0x24 ---------------------------------- */
 890        [BTTV_BOARD_TYPHOON_TVIEW] = {
 891                .name           = "Lifeview FlyVideo 98FM LR50 / Typhoon TView TV/FM Tuner",
 892                .video_inputs   = 4,
 893                /* .audio_inputs= 3, */
 894                .svhs           = 2,
 895                .gpiomask       = 0x1800,
 896                .muxsel         = MUXSEL(2, 3, 1, 1),
 897                .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
 898                .gpiomute       = 0x1800,
 899                .pll            = PLL_28,
 900                .tuner_type     = UNSET,
 901                .tuner_addr     = ADDR_UNSET,
 902                .has_radio      = 1,
 903        },
 904        [BTTV_BOARD_PXELVWPLTVPRO] = {
 905                .name           = "Prolink PixelView PlayTV pro",
 906                .video_inputs   = 3,
 907                /* .audio_inputs= 1, */
 908                .svhs           = 2,
 909                .gpiomask       = 0xff,
 910                .muxsel         = MUXSEL(2, 3, 1, 1),
 911                .gpiomux        = { 0x21, 0x20, 0x24, 0x2c },
 912                .gpiomute       = 0x29,
 913                .no_msp34xx     = 1,
 914                .pll            = PLL_28,
 915                .tuner_type     = UNSET,
 916                .tuner_addr     = ADDR_UNSET,
 917        },
 918        [BTTV_BOARD_MAGICTVIEW063] = {
 919                .name           = "Askey CPH06X TView99",
 920                .video_inputs   = 4,
 921                /* .audio_inputs= 1, */
 922                .svhs           = 2,
 923                .gpiomask       = 0x551e00,
 924                .muxsel         = MUXSEL(2, 3, 1, 0),
 925                .gpiomux        = { 0x551400, 0x551200, 0, 0 },
 926                .gpiomute       = 0x551c00,
 927                .needs_tvaudio  = 1,
 928                .pll            = PLL_28,
 929                .tuner_type     = TUNER_PHILIPS_PAL_I,
 930                .tuner_addr     = ADDR_UNSET,
 931                .has_remote     = 1,
 932        },
 933        [BTTV_BOARD_PINNACLE] = {
 934                .name           = "Pinnacle PCTV Studio/Rave",
 935                .video_inputs   = 3,
 936                /* .audio_inputs= 1, */
 937                .svhs           = 2,
 938                .gpiomask       = 0x03000F,
 939                .muxsel         = MUXSEL(2, 3, 1, 1),
 940                .gpiomux        = { 2, 0xd0001, 0, 0 },
 941                .gpiomute       = 1,
 942                .needs_tvaudio  = 0,
 943                .pll            = PLL_28,
 944                .tuner_type     = UNSET,
 945                .tuner_addr     = ADDR_UNSET,
 946        },
 947
 948        /* ---- card 0x28 ---------------------------------- */
 949        [BTTV_BOARD_STB2] = {
 950                .name           = "STB TV PCI FM, Gateway P/N 6000704 (bt878), 3Dfx VoodooTV 100",
 951                .video_inputs   = 3,
 952                /* .audio_inputs= 1, */
 953                .svhs           = 2,
 954                .gpiomask       = 7,
 955                .muxsel         = MUXSEL(2, 3, 1, 1),
 956                .gpiomux        = { 4, 0, 2, 3 },
 957                .gpiomute       = 1,
 958                .no_msp34xx     = 1,
 959                .needs_tvaudio  = 1,
 960                .tuner_type     = TUNER_PHILIPS_NTSC,
 961                .tuner_addr     = ADDR_UNSET,
 962                .pll            = PLL_28,
 963                .has_radio      = 1,
 964        },
 965        [BTTV_BOARD_AVPHONE98] = {
 966                .name           = "AVerMedia TVPhone 98",
 967                .video_inputs   = 3,
 968                /* .audio_inputs= 4, */
 969                .svhs           = 2,
 970                .gpiomask       = 15,
 971                .muxsel         = MUXSEL(2, 3, 1, 1),
 972                .gpiomux        = { 13, 4, 11, 7 },
 973                .needs_tvaudio  = 1,
 974                .pll            = PLL_28,
 975                .tuner_type     = UNSET,
 976                .tuner_addr     = ADDR_UNSET,
 977                .has_radio      = 1,
 978                .audio_mode_gpio= avermedia_tvphone_audio,
 979        },
 980        [BTTV_BOARD_PV951] = {
 981                .name           = "ProVideo PV951", /* pic16c54 */
 982                .video_inputs   = 3,
 983                /* .audio_inputs= 1, */
 984                .svhs           = 2,
 985                .gpiomask       = 0,
 986                .muxsel         = MUXSEL(2, 3, 1, 1),
 987                .gpiomux        = { 0, 0, 0, 0},
 988                .needs_tvaudio  = 1,
 989                .no_msp34xx     = 1,
 990                .pll            = PLL_28,
 991                .tuner_type     = TUNER_PHILIPS_PAL_I,
 992                .tuner_addr     = ADDR_UNSET,
 993        },
 994        [BTTV_BOARD_ONAIR_TV] = {
 995                .name           = "Little OnAir TV",
 996                .video_inputs   = 3,
 997                /* .audio_inputs= 1, */
 998                .svhs           = 2,
 999                .gpiomask       = 0xe00b,
1000                .muxsel         = MUXSEL(2, 3, 1, 1),
1001                .gpiomux        = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 },
1002                .gpiomute       = 0xff3ffc,
1003                .no_msp34xx     = 1,
1004                .tuner_type     = UNSET,
1005                .tuner_addr     = ADDR_UNSET,
1006        },
1007
1008        /* ---- card 0x2c ---------------------------------- */
1009        [BTTV_BOARD_SIGMA_TVII_FM] = {
1010                .name           = "Sigma TVII-FM",
1011                .video_inputs   = 2,
1012                /* .audio_inputs= 1, */
1013                .svhs           = NO_SVHS,
1014                .gpiomask       = 3,
1015                .muxsel         = MUXSEL(2, 3, 1, 1),
1016                .gpiomux        = { 1, 1, 0, 2 },
1017                .gpiomute       = 3,
1018                .no_msp34xx     = 1,
1019                .pll            = PLL_NONE,
1020                .tuner_type     = UNSET,
1021                .tuner_addr     = ADDR_UNSET,
1022        },
1023        [BTTV_BOARD_MATRIX_VISION2] = {
1024                .name           = "MATRIX-Vision MV-Delta 2",
1025                .video_inputs   = 5,
1026                /* .audio_inputs= 1, */
1027                .svhs           = 3,
1028                .gpiomask       = 0,
1029                .muxsel         = MUXSEL(2, 3, 1, 0, 0),
1030                .gpiomux        = { 0 },
1031                .no_msp34xx     = 1,
1032                .pll            = PLL_28,
1033                .tuner_type     = TUNER_ABSENT,
1034                .tuner_addr     = ADDR_UNSET,
1035        },
1036        [BTTV_BOARD_ZOLTRIX_GENIE] = {
1037                .name           = "Zoltrix Genie TV/FM",
1038                .video_inputs   = 3,
1039                /* .audio_inputs= 1, */
1040                .svhs           = 2,
1041                .gpiomask       = 0xbcf03f,
1042                .muxsel         = MUXSEL(2, 3, 1, 1),
1043                .gpiomux        = { 0xbc803f, 0xbc903f, 0xbcb03f, 0 },
1044                .gpiomute       = 0xbcb03f,
1045                .no_msp34xx     = 1,
1046                .pll            = PLL_28,
1047                .tuner_type     = TUNER_TEMIC_4039FR5_NTSC,
1048                .tuner_addr     = ADDR_UNSET,
1049        },
1050        [BTTV_BOARD_TERRATVRADIO] = {
1051                .name           = "Terratec TV/Radio+",
1052                .video_inputs   = 3,
1053                /* .audio_inputs= 1, */
1054                .svhs           = 2,
1055                .gpiomask       = 0x70000,
1056                .muxsel         = MUXSEL(2, 3, 1, 1),
1057                .gpiomux        = { 0x20000, 0x30000, 0x10000, 0 },
1058                .gpiomute       = 0x40000,
1059                .needs_tvaudio  = 1,
1060                .no_msp34xx     = 1,
1061                .pll            = PLL_35,
1062                .tuner_type     = TUNER_PHILIPS_PAL_I,
1063                .tuner_addr     = ADDR_UNSET,
1064                .has_radio      = 1,
1065        },
1066
1067        /* ---- card 0x30 ---------------------------------- */
1068        [BTTV_BOARD_DYNALINK] = {
1069                .name           = "Askey CPH03x/ Dynalink Magic TView",
1070                .video_inputs   = 3,
1071                /* .audio_inputs= 1, */
1072                .svhs           = 2,
1073                .gpiomask       = 15,
1074                .muxsel         = MUXSEL(2, 3, 1, 1),
1075                .gpiomux        = {2,0,0,0 },
1076                .gpiomute       = 1,
1077                .needs_tvaudio  = 1,
1078                .pll            = PLL_28,
1079                .tuner_type     = UNSET,
1080                .tuner_addr     = ADDR_UNSET,
1081        },
1082        [BTTV_BOARD_GVBCTV3PCI] = {
1083                .name           = "IODATA GV-BCTV3/PCI",
1084                .video_inputs   = 3,
1085                /* .audio_inputs= 1, */
1086                .svhs           = 2,
1087                .gpiomask       = 0x010f00,
1088                .muxsel         = MUXSEL(2, 3, 0, 0),
1089                .gpiomux        = {0x10000, 0, 0x10000, 0 },
1090                .no_msp34xx     = 1,
1091                .pll            = PLL_28,
1092                .tuner_type     = TUNER_ALPS_TSHC6_NTSC,
1093                .tuner_addr     = ADDR_UNSET,
1094                .audio_mode_gpio= gvbctv3pci_audio,
1095        },
1096        [BTTV_BOARD_PXELVWPLTVPAK] = {
1097                .name           = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
1098                .video_inputs   = 5,
1099                /* .audio_inputs= 1, */
1100                .svhs           = 3,
1101                .has_dig_in     = 1,
1102                .gpiomask       = 0xAA0000,
1103                .muxsel         = MUXSEL(2, 3, 1, 1, 0), /* in 4 is digital */
1104                /* .digital_mode= DIGITAL_MODE_CAMERA, */
1105                .gpiomux        = { 0x20000, 0, 0x80000, 0x80000 },
1106                .gpiomute       = 0xa8000,
1107                .no_msp34xx     = 1,
1108                .pll            = PLL_28,
1109                .tuner_type     = TUNER_PHILIPS_PAL_I,
1110                .tuner_addr     = ADDR_UNSET,
1111                .has_remote     = 1,
1112                /* GPIO wiring: (different from Rev.4C !)
1113                        GPIO17: U4.A0 (first hef4052bt)
1114                        GPIO19: U4.A1
1115                        GPIO20: U5.A1 (second hef4052bt)
1116                        GPIO21: U4.nEN
1117                        GPIO22: BT832 Reset Line
1118                        GPIO23: A5,A0, U5,nEN
1119                Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22
1120                */
1121        },
1122        [BTTV_BOARD_EAGLE] = {
1123                .name           = "Eagle Wireless Capricorn2 (bt878A)",
1124                .video_inputs   = 4,
1125                /* .audio_inputs= 1, */
1126                .svhs           = 2,
1127                .gpiomask       = 7,
1128                .muxsel         = MUXSEL(2, 0, 1, 1),
1129                .gpiomux        = { 0, 1, 2, 3 },
1130                .gpiomute       = 4,
1131                .pll            = PLL_28,
1132                .tuner_type     = UNSET /* TUNER_ALPS_TMDH2_NTSC */,
1133                .tuner_addr     = ADDR_UNSET,
1134        },
1135
1136        /* ---- card 0x34 ---------------------------------- */
1137        [BTTV_BOARD_PINNACLEPRO] = {
1138                /* David Härdeman <david@2gen.com> */
1139                .name           = "Pinnacle PCTV Studio Pro",
1140                .video_inputs   = 4,
1141                /* .audio_inputs= 1, */
1142                .svhs           = 3,
1143                .gpiomask       = 0x03000F,
1144                .muxsel         = MUXSEL(2, 3, 1, 1),
1145                .gpiomux        = { 1, 0xd0001, 0, 0 },
1146                .gpiomute       = 10,
1147                                /* sound path (5 sources):
1148                                MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
1149                                        0= ext. Audio IN
1150                                        1= from MUX2
1151                                        2= Mono TV sound from Tuner
1152                                        3= not connected
1153                                MUX2 (mask 0x30000):
1154                                        0,2,3= from MSP34xx
1155                                        1= FM stereo Radio from Tuner */
1156                .needs_tvaudio  = 0,
1157                .pll            = PLL_28,
1158                .tuner_type     = UNSET,
1159                .tuner_addr     = ADDR_UNSET,
1160        },
1161        [BTTV_BOARD_TVIEW_RDS_FM] = {
1162                /* Claas Langbehn <claas@bigfoot.com>,
1163                Sven Grothklags <sven@upb.de> */
1164                .name           = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS",
1165                .video_inputs   = 4,
1166                /* .audio_inputs= 3, */
1167                .svhs           = 2,
1168                .gpiomask       = 0x1c,
1169                .muxsel         = MUXSEL(2, 3, 1, 1),
1170                .gpiomux        = { 0, 0, 0x10, 8 },
1171                .gpiomute       = 4,
1172                .needs_tvaudio  = 1,
1173                .pll            = PLL_28,
1174                .tuner_type     = TUNER_PHILIPS_PAL,
1175                .tuner_addr     = ADDR_UNSET,
1176                .has_radio      = 1,
1177        },
1178        [BTTV_BOARD_LIFETEC_9415] = {
1179                /* Tim Röstermundt <rosterm@uni-muenster.de>
1180                in de.comp.os.unix.linux.hardware:
1181                        options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1182                        gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
1183                        options tuner type=5 */
1184                .name           = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]",
1185                .video_inputs   = 4,
1186                /* .audio_inputs= 1, */
1187                .svhs           = 2,
1188                .gpiomask       = 0x18e0,
1189                .muxsel         = MUXSEL(2, 3, 1, 1),
1190                .gpiomux        = { 0x0000,0x0800,0x1000,0x1000 },
1191                .gpiomute       = 0x18e0,
1192                        /* For cards with tda9820/tda9821:
1193                                0x0000: Tuner normal stereo
1194                                0x0080: Tuner A2 SAP (second audio program = Zweikanalton)
1195                                0x0880: Tuner A2 stereo */
1196                .pll            = PLL_28,
1197                .tuner_type     = UNSET,
1198                .tuner_addr     = ADDR_UNSET,
1199        },
1200        [BTTV_BOARD_BESTBUY_EASYTV] = {
1201                /* Miguel Angel Alvarez <maacruz@navegalia.com>
1202                old Easy TV BT848 version (model CPH031) */
1203                .name           = "Askey CPH031/ BESTBUY Easy TV",
1204                .video_inputs   = 4,
1205                /* .audio_inputs= 1, */
1206                .svhs           = 2,
1207                .gpiomask       = 0xF,
1208                .muxsel         = MUXSEL(2, 3, 1, 0),
1209                .gpiomux        = { 2, 0, 0, 0 },
1210                .gpiomute       = 10,
1211                .needs_tvaudio  = 0,
1212                .pll            = PLL_28,
1213                .tuner_type     = TUNER_TEMIC_PAL,
1214                .tuner_addr     = ADDR_UNSET,
1215        },
1216
1217        /* ---- card 0x38 ---------------------------------- */
1218        [BTTV_BOARD_FLYVIDEO_98FM] = {
1219                /* Gordon Heydon <gjheydon@bigfoot.com ('98) */
1220                .name           = "Lifeview FlyVideo 98FM LR50",
1221                .video_inputs   = 4,
1222                /* .audio_inputs= 3, */
1223                .svhs           = 2,
1224                .gpiomask       = 0x1800,
1225                .muxsel         = MUXSEL(2, 3, 1, 1),
1226                .gpiomux        = { 0, 0x800, 0x1000, 0x1000 },
1227                .gpiomute       = 0x1800,
1228                .pll            = PLL_28,
1229                .tuner_type     = TUNER_PHILIPS_PAL,
1230                .tuner_addr     = ADDR_UNSET,
1231        },
1232                /* This is the ultimate cheapo capture card
1233                * just a BT848A on a small PCB!
1234                * Steve Hosgood <steve@equiinet.com> */
1235        [BTTV_BOARD_GRANDTEC] = {
1236                .name           = "GrandTec 'Grand Video Capture' (Bt848)",
1237                .video_inputs   = 2,
1238                /* .audio_inputs= 0, */
1239                .svhs           = 1,
1240                .gpiomask       = 0,
1241                .muxsel         = MUXSEL(3, 1),
1242                .gpiomux        = { 0 },
1243                .needs_tvaudio  = 0,
1244                .no_msp34xx     = 1,
1245                .pll            = PLL_35,
1246                .tuner_type     = TUNER_ABSENT,
1247                .tuner_addr     = ADDR_UNSET,
1248        },
1249        [BTTV_BOARD_ASKEY_CPH060] = {
1250                /* Daniel Herrington <daniel.herrington@home.com> */
1251                .name           = "Askey CPH060/ Phoebe TV Master Only (No FM)",
1252                .video_inputs   = 3,
1253                /* .audio_inputs= 1, */
1254                .svhs           = 2,
1255                .gpiomask       = 0xe00,
1256                .muxsel         = MUXSEL(2, 3, 1, 1),
1257                .gpiomux        = { 0x400, 0x400, 0x400, 0x400 },
1258                .gpiomute       = 0x800,
1259                .needs_tvaudio  = 1,
1260                .pll            = PLL_28,
1261                .tuner_type     = TUNER_TEMIC_4036FY5_NTSC,
1262                .tuner_addr     = ADDR_UNSET,
1263        },
1264        [BTTV_BOARD_ASKEY_CPH03X] = {
1265                /* Matti Mottus <mottus@physic.ut.ee> */
1266                .name           = "Askey CPH03x TV Capturer",
1267                .video_inputs   = 4,
1268                /* .audio_inputs= 1, */
1269                .svhs           = 2,
1270                .gpiomask       = 0x03000F,
1271                .muxsel         = MUXSEL(2, 3, 1, 0),
1272                .gpiomux        = { 2, 0, 0, 0 },
1273                .gpiomute       = 1,
1274                .pll            = PLL_28,
1275                .tuner_type     = TUNER_TEMIC_PAL,
1276                .tuner_addr     = ADDR_UNSET,
1277                .has_remote     = 1,
1278        },
1279
1280        /* ---- card 0x3c ---------------------------------- */
1281        [BTTV_BOARD_MM100PCTV] = {
1282                /* Philip Blundell <philb@gnu.org> */
1283                .name           = "Modular Technology MM100PCTV",
1284                .video_inputs   = 2,
1285                /* .audio_inputs= 2, */
1286                .svhs           = NO_SVHS,
1287                .gpiomask       = 11,
1288                .muxsel         = MUXSEL(2, 3, 1, 1),
1289                .gpiomux        = { 2, 0, 0, 1 },
1290                .gpiomute       = 8,
1291                .pll            = PLL_35,
1292                .tuner_type     = TUNER_TEMIC_PAL,
1293                .tuner_addr     = ADDR_UNSET,
1294        },
1295        [BTTV_BOARD_GMV1] = {
1296                /* Adrian Cox <adrian@humboldt.co.uk */
1297                .name           = "AG Electronics GMV1",
1298                .video_inputs   = 2,
1299                /* .audio_inputs= 0, */
1300                .svhs           = 1,
1301                .gpiomask       = 0xF,
1302                .muxsel         = MUXSEL(2, 2),
1303                .gpiomux        = { },
1304                .no_msp34xx     = 1,
1305                .needs_tvaudio  = 0,
1306                .pll            = PLL_28,
1307                .tuner_type     = TUNER_ABSENT,
1308                .tuner_addr     = ADDR_UNSET,
1309        },
1310        [BTTV_BOARD_BESTBUY_EASYTV2] = {
1311                /* Miguel Angel Alvarez <maacruz@navegalia.com>
1312                new Easy TV BT878 version (model CPH061)
1313                special thanks to Informatica Mieres for providing the card */
1314                .name           = "Askey CPH061/ BESTBUY Easy TV (bt878)",
1315                .video_inputs   = 3,
1316                /* .audio_inputs= 2, */
1317                .svhs           = 2,
1318                .gpiomask       = 0xFF,
1319                .muxsel         = MUXSEL(2, 3, 1, 0),
1320                .gpiomux        = { 1, 0, 4, 4 },
1321                .gpiomute       = 9,
1322                .needs_tvaudio  = 0,
1323                .pll            = PLL_28,
1324                .tuner_type     = TUNER_PHILIPS_PAL,
1325                .tuner_addr     = ADDR_UNSET,
1326        },
1327        [BTTV_BOARD_ATI_TVWONDER] = {
1328                /* Lukas Gebauer <geby@volny.cz> */
1329                .name           = "ATI TV-Wonder",
1330                .video_inputs   = 3,
1331                /* .audio_inputs= 1, */
1332                .svhs           = 2,
1333                .gpiomask       = 0xf03f,
1334                .muxsel         = MUXSEL(2, 3, 1, 0),
1335                .gpiomux        = { 0xbffe, 0, 0xbfff, 0 },
1336                .gpiomute       = 0xbffe,
1337                .pll            = PLL_28,
1338                .tuner_type     = TUNER_TEMIC_4006FN5_MULTI_PAL,
1339                .tuner_addr     = ADDR_UNSET,
1340        },
1341
1342        /* ---- card 0x40 ---------------------------------- */
1343        [BTTV_BOARD_ATI_TVWONDERVE] = {
1344                /* Lukas Gebauer <geby@volny.cz> */
1345                .name           = "ATI TV-Wonder VE",
1346                .video_inputs   = 2,
1347                /* .audio_inputs= 1, */
1348                .svhs           = NO_SVHS,
1349                .gpiomask       = 1,
1350                .muxsel         = MUXSEL(2, 3, 0, 1),
1351                .gpiomux        = { 0, 0, 1, 0 },
1352                .no_msp34xx     = 1,
1353                .pll            = PLL_28,
1354                .tuner_type     = TUNER_TEMIC_4006FN5_MULTI_PAL,
1355                .tuner_addr     = ADDR_UNSET,
1356        },
1357        [BTTV_BOARD_FLYVIDEO2000] = {
1358                /* DeeJay <deejay@westel900.net (2000S) */
1359                .name           = "Lifeview FlyVideo 2000S LR90",
1360                .video_inputs   = 3,
1361                /* .audio_inputs= 3, */
1362                .svhs           = 2,
1363                .gpiomask       = 0x18e0,
1364                .muxsel         = MUXSEL(2, 3, 0, 1),
1365                                /* Radio changed from 1e80 to 0x800 to make
1366                                FlyVideo2000S in .hu happy (gm)*/
1367                                /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1368                .gpiomux        = { 0x0000,0x0800,0x1000,0x1000 },
1369                .gpiomute       = 0x1800,
1370                .audio_mode_gpio= fv2000s_audio,
1371                .no_msp34xx     = 1,
1372                .no_tda9875     = 1,
1373                .needs_tvaudio  = 1,
1374                .pll            = PLL_28,
1375                .tuner_type     = TUNER_PHILIPS_PAL,
1376                .tuner_addr     = ADDR_UNSET,
1377        },
1378        [BTTV_BOARD_TERRATVALUER] = {
1379                .name           = "Terratec TValueRadio",
1380                .video_inputs   = 3,
1381                /* .audio_inputs= 1, */
1382                .svhs           = 2,
1383                .gpiomask       = 0xffff00,
1384                .muxsel         = MUXSEL(2, 3, 1, 1),
1385                .gpiomux        = { 0x500, 0x500, 0x300, 0x900 },
1386                .gpiomute       = 0x900,
1387                .needs_tvaudio  = 1,
1388                .pll            = PLL_28,
1389                .tuner_type     = TUNER_PHILIPS_PAL,
1390                .tuner_addr     = ADDR_UNSET,
1391                .has_radio      = 1,
1392        },
1393        [BTTV_BOARD_GVBCTV4PCI] = {
1394                /* TANAKA Kei <peg00625@nifty.com> */
1395                .name           = "IODATA GV-BCTV4/PCI",
1396                .video_inputs   = 3,
1397                /* .audio_inputs= 1, */
1398                .svhs           = 2,
1399                .gpiomask       = 0x010f00,
1400                .muxsel         = MUXSEL(2, 3, 0, 0),
1401                .gpiomux        = {0x10000, 0, 0x10000, 0 },
1402                .no_msp34xx     = 1,
1403                .pll            = PLL_28,
1404                .tuner_type     = TUNER_SHARP_2U5JF5540_NTSC,
1405                .tuner_addr     = ADDR_UNSET,
1406                .audio_mode_gpio= gvbctv3pci_audio,
1407        },
1408
1409        /* ---- card 0x44 ---------------------------------- */
1410        [BTTV_BOARD_VOODOOTV_FM] = {
1411                .name           = "3Dfx VoodooTV FM (Euro)",
1412                /* try "insmod msp3400 simple=0" if you have
1413                * sound problems with this card. */
1414                .video_inputs   = 4,
1415                /* .audio_inputs= 1, */
1416                .svhs           = NO_SVHS,
1417                .gpiomask       = 0x4f8a00,
1418                /* 0x100000: 1=MSP enabled (0=disable again)
1419                * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */
1420                .gpiomux        = {0x947fff, 0x987fff,0x947fff,0x947fff },
1421                .gpiomute       = 0x947fff,
1422                /* tvtuner, radio,   external,internal, mute,  stereo
1423                * tuner, Composit, SVid, Composit-on-Svid-adapter */
1424                .muxsel         = MUXSEL(2, 3, 0, 1),
1425                .tuner_type     = TUNER_MT2032,
1426                .tuner_addr     = ADDR_UNSET,
1427                .pll            = PLL_28,
1428                .has_radio      = 1,
1429        },
1430        [BTTV_BOARD_VOODOOTV_200] = {
1431                .name           = "VoodooTV 200 (USA)",
1432                /* try "insmod msp3400 simple=0" if you have
1433                * sound problems with this card. */
1434                .video_inputs   = 4,
1435                /* .audio_inputs= 1, */
1436                .svhs           = NO_SVHS,
1437                .gpiomask       = 0x4f8a00,
1438                /* 0x100000: 1=MSP enabled (0=disable again)
1439                * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */
1440                .gpiomux        = {0x947fff, 0x987fff,0x947fff,0x947fff },
1441                .gpiomute       = 0x947fff,
1442                /* tvtuner, radio,   external,internal, mute,  stereo
1443                * tuner, Composit, SVid, Composit-on-Svid-adapter */
1444                .muxsel         = MUXSEL(2, 3, 0, 1),
1445                .tuner_type     = TUNER_MT2032,
1446                .tuner_addr     = ADDR_UNSET,
1447                .pll            = PLL_28,
1448                .has_radio      = 1,
1449        },
1450        [BTTV_BOARD_AIMMS] = {
1451                /* Philip Blundell <pb@nexus.co.uk> */
1452                .name           = "Active Imaging AIMMS",
1453                .video_inputs   = 1,
1454                /* .audio_inputs= 0, */
1455                .tuner_type     = TUNER_ABSENT,
1456                .tuner_addr     = ADDR_UNSET,
1457                .pll            = PLL_28,
1458                .muxsel         = MUXSEL(2),
1459                .gpiomask       = 0
1460        },
1461        [BTTV_BOARD_PV_BT878P_PLUS] = {
1462                /* Tomasz Pyra <hellfire@sedez.iq.pl> */
1463                .name           = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)",
1464                .video_inputs   = 3,
1465                /* .audio_inputs= 4, */
1466                .svhs           = 2,
1467                .gpiomask       = 15,
1468                .muxsel         = MUXSEL(2, 3, 1, 1),
1469                .gpiomux        = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */
1470                .gpiomute       = 13,
1471                .needs_tvaudio  = 1,
1472                .pll            = PLL_28,
1473                .tuner_type     = TUNER_LG_PAL_I_FM,
1474                .tuner_addr     = ADDR_UNSET,
1475                .has_remote     = 1,
1476                /* GPIO wiring:
1477                        GPIO0: U4.A0 (hef4052bt)
1478                        GPIO1: U4.A1
1479                        GPIO2: U4.A1 (second hef4052bt)
1480                        GPIO3: U4.nEN, U5.A0, A5.nEN
1481                        GPIO8-15: vrd866b ?
1482                */
1483        },
1484        [BTTV_BOARD_FLYVIDEO98EZ] = {
1485                .name           = "Lifeview FlyVideo 98EZ (capture only) LR51",
1486                .video_inputs   = 4,
1487                /* .audio_inputs= 0, */
1488                .svhs           = 2,
1489                /* AV1, AV2, SVHS, CVid adapter on SVHS */
1490                .muxsel         = MUXSEL(2, 3, 1, 1),
1491                .pll            = PLL_28,
1492                .no_msp34xx     = 1,
1493                .tuner_type     = TUNER_ABSENT,
1494                .tuner_addr     = ADDR_UNSET,
1495        },
1496
1497        /* ---- card 0x48 ---------------------------------- */
1498        [BTTV_BOARD_PV_BT878P_9B] = {
1499                /* Dariusz Kowalewski <darekk@automex.pl> */
1500                .name           = "Prolink Pixelview PV-BT878P+9B (PlayTV Pro rev.9B FM+NICAM)",
1501                .video_inputs   = 4,
1502                /* .audio_inputs= 1, */
1503                .svhs           = 2,
1504                .gpiomask       = 0x3f,
1505                .muxsel         = MUXSEL(2, 3, 1, 1),
1506                .gpiomux        = { 0x01, 0x00, 0x03, 0x03 },
1507                .gpiomute       = 0x09,
1508                .needs_tvaudio  = 1,
1509                .no_msp34xx     = 1,
1510                .no_tda9875     = 1,
1511                .pll            = PLL_28,
1512                .tuner_type     = TUNER_PHILIPS_PAL,
1513                .tuner_addr     = ADDR_UNSET,
1514                .audio_mode_gpio= pvbt878p9b_audio, /* Note: not all cards have stereo */
1515                .has_radio      = 1,  /* Note: not all cards have radio */
1516                .has_remote     = 1,
1517                /* GPIO wiring:
1518                        GPIO0: A0 hef4052
1519                        GPIO1: A1 hef4052
1520                        GPIO3: nEN hef4052
1521                        GPIO8-15: vrd866b
1522                        GPIO20,22,23: R30,R29,R28
1523                */
1524        },
1525        [BTTV_BOARD_SENSORAY311] = {
1526                /* Clay Kunz <ckunz@mail.arc.nasa.gov> */
1527                /* you must jumper JP5 for the card to work */
1528                .name           = "Sensoray 311",
1529                .video_inputs   = 5,
1530                /* .audio_inputs= 0, */
1531                .svhs           = 4,
1532                .gpiomask       = 0,
1533                .muxsel         = MUXSEL(2, 3, 1, 0, 0),
1534                .gpiomux        = { 0 },
1535                .needs_tvaudio  = 0,
1536                .tuner_type     = TUNER_ABSENT,
1537                .tuner_addr     = ADDR_UNSET,
1538        },
1539        [BTTV_BOARD_RV605] = {
1540                /* Miguel Freitas <miguel@cetuc.puc-rio.br> */
1541                .name           = "RemoteVision MX (RV605)",
1542                .video_inputs   = 16,
1543                /* .audio_inputs= 0, */
1544                .svhs           = NO_SVHS,
1545                .gpiomask       = 0x00,
1546                .gpiomask2      = 0x07ff,
1547                .muxsel         = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
1548                .no_msp34xx     = 1,
1549                .no_tda9875     = 1,
1550                .tuner_type     = TUNER_ABSENT,
1551                .tuner_addr     = ADDR_UNSET,
1552                .muxsel_hook    = rv605_muxsel,
1553        },
1554        [BTTV_BOARD_POWERCLR_MTV878] = {
1555                .name           = "Powercolor MTV878/ MTV878R/ MTV878F",
1556                .video_inputs   = 3,
1557                /* .audio_inputs= 2, */
1558                .svhs           = 2,
1559                .gpiomask       = 0x1C800F,  /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */
1560                .muxsel         = MUXSEL(2, 1, 1),
1561                .gpiomux        = { 0, 1, 2, 2 },
1562                .gpiomute       = 4,
1563                .needs_tvaudio  = 0,
1564                .tuner_type     = TUNER_PHILIPS_PAL,
1565                .tuner_addr     = ADDR_UNSET,
1566                .pll            = PLL_28,
1567                .has_radio      = 1,
1568        },
1569
1570        /* ---- card 0x4c ---------------------------------- */
1571        [BTTV_BOARD_WINDVR] = {
1572                /* Masaki Suzuki <masaki@btree.org> */
1573                .name           = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)",
1574                .video_inputs   = 3,
1575                /* .audio_inputs= 1, */
1576                .svhs           = 2,
1577                .gpiomask       = 0x140007,
1578                .muxsel         = MUXSEL(2, 3, 1, 1),
1579                .gpiomux        = { 0, 1, 2, 3 },
1580                .gpiomute       = 4,
1581                .tuner_type     = TUNER_PHILIPS_NTSC,
1582                .tuner_addr     = ADDR_UNSET,
1583                .audio_mode_gpio= windvr_audio,
1584        },
1585        [BTTV_BOARD_GRANDTEC_MULTI] = {
1586                .name           = "GrandTec Multi Capture Card (Bt878)",
1587                .video_inputs   = 4,
1588                /* .audio_inputs= 0, */
1589                .svhs           = NO_SVHS,
1590                .gpiomask       = 0,
1591                .muxsel         = MUXSEL(2, 3, 1, 0),
1592                .gpiomux        = { 0 },
1593                .needs_tvaudio  = 0,
1594                .no_msp34xx     = 1,
1595                .pll            = PLL_28,
1596                .tuner_type     = TUNER_ABSENT,
1597                .tuner_addr     = ADDR_UNSET,
1598        },
1599        [BTTV_BOARD_KWORLD] = {
1600                .name           = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF",
1601                .video_inputs   = 4,
1602                /* .audio_inputs= 3, */
1603                .svhs           = 2,
1604                .gpiomask       = 7,
1605                /* Tuner, SVid, SVHS, SVid to SVHS connector */
1606                .muxsel         = MUXSEL(2, 3, 1, 1),
1607                .gpiomux        = { 0, 0, 4, 4 },/* Yes, this tuner uses the same audio output for TV and FM radio!
1608                                                * This card lacks external Audio In, so we mute it on Ext. & Int.
1609                                                * The PCB can take a sbx1637/sbx1673, wiring unknown.
1610                                                * This card lacks PCI subsystem ID, sigh.
1611                                                * gpiomux =1: lower volume, 2+3: mute
1612                                                * btwincap uses 0x80000/0x80003
1613                                                */
1614                .gpiomute       = 4,
1615                .needs_tvaudio  = 0,
1616                .no_msp34xx     = 1,
1617                .pll            = PLL_28,
1618                .tuner_type     = TUNER_PHILIPS_PAL,
1619                .tuner_addr     = ADDR_UNSET,
1620                /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and
1621                radio signal strength indicators work fine. */
1622                .has_radio      = 1,
1623                /* GPIO Info:
1624                        GPIO0,1:   HEF4052 A0,A1
1625                        GPIO2:     HEF4052 nENABLE
1626                        GPIO3-7:   n.c.
1627                        GPIO8-13:  IRDC357 data0-5 (data6 n.c. ?) [chip not present on my card]
1628                        GPIO14,15: ??
1629                        GPIO16-21: n.c.
1630                        GPIO22,23: ??
1631                        ??       : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/
1632        },
1633        [BTTV_BOARD_DSP_TCVIDEO] = {
1634                /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */
1635                .name           = "DSP Design TCVIDEO",
1636                .video_inputs   = 4,
1637                .svhs           = NO_SVHS,
1638                .muxsel         = MUXSEL(2, 3, 1, 0),
1639                .pll            = PLL_28,
1640                .tuner_type     = UNSET,
1641                .tuner_addr     = ADDR_UNSET,
1642        },
1643
1644                /* ---- card 0x50 ---------------------------------- */
1645        [BTTV_BOARD_HAUPPAUGEPVR] = {
1646                .name           = "Hauppauge WinTV PVR",
1647                .video_inputs   = 4,
1648                /* .audio_inputs= 1, */
1649                .svhs           = 2,
1650                .muxsel         = MUXSEL(2, 0, 1, 1),
1651                .needs_tvaudio  = 1,
1652                .pll            = PLL_28,
1653                .tuner_type     = UNSET,
1654                .tuner_addr     = ADDR_UNSET,
1655
1656                .gpiomask       = 7,
1657                .gpiomux        = {7},
1658        },
1659        [BTTV_BOARD_GVBCTV5PCI] = {
1660                .name           = "IODATA GV-BCTV5/PCI",
1661                .video_inputs   = 3,
1662                /* .audio_inputs= 1, */
1663                .svhs           = 2,
1664                .gpiomask       = 0x0f0f80,
1665                .muxsel         = MUXSEL(2, 3, 1, 0),
1666                .gpiomux        = {0x030000, 0x010000, 0, 0 },
1667                .gpiomute       = 0x020000,
1668                .no_msp34xx     = 1,
1669                .pll            = PLL_28,
1670                .tuner_type     = TUNER_PHILIPS_NTSC_M,
1671                .tuner_addr     = ADDR_UNSET,
1672                .audio_mode_gpio= gvbctv5pci_audio,
1673                .has_radio      = 1,
1674        },
1675        [BTTV_BOARD_OSPREY1x0] = {
1676                .name           = "Osprey 100/150 (878)", /* 0x1(2|3)-45C6-C1 */
1677                .video_inputs   = 4,                  /* id-inputs-clock */
1678                /* .audio_inputs= 0, */
1679                .svhs           = 3,
1680                .muxsel         = MUXSEL(3, 2, 0, 1),
1681                .pll            = PLL_28,
1682                .tuner_type     = TUNER_ABSENT,
1683                .tuner_addr     = ADDR_UNSET,
1684                .no_msp34xx     = 1,
1685                .no_tda9875     = 1,
1686                .no_tda7432     = 1,
1687        },
1688        [BTTV_BOARD_OSPREY1x0_848] = {
1689                .name           = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */
1690                .video_inputs   = 3,
1691                /* .audio_inputs= 0, */
1692                .svhs           = 2,
1693                .muxsel         = MUXSEL(2, 3, 1),
1694                .pll            = PLL_28,
1695                .tuner_type     = TUNER_ABSENT,
1696                .tuner_addr     = ADDR_UNSET,
1697                .no_msp34xx     = 1,
1698                .no_tda9875     = 1,
1699                .no_tda7432     = 1,
1700        },
1701
1702                /* ---- card 0x54 ---------------------------------- */
1703        [BTTV_BOARD_OSPREY101_848] = {
1704                .name           = "Osprey 101 (848)", /* 0x05-40C0-C1 */
1705                .video_inputs   = 2,
1706                /* .audio_inputs= 0, */
1707                .svhs           = 1,
1708                .muxsel         = MUXSEL(3, 1),
1709                .pll            = PLL_28,
1710                .tuner_type     = TUNER_ABSENT,
1711                .tuner_addr     = ADDR_UNSET,
1712                .no_msp34xx     = 1,
1713                .no_tda9875     = 1,
1714                .no_tda7432     = 1,
1715        },
1716        [BTTV_BOARD_OSPREY1x1] = {
1717                .name           = "Osprey 101/151",       /* 0x1(4|5)-0004-C4 */
1718                .video_inputs   = 1,
1719                /* .audio_inputs= 0, */
1720                .svhs           = NO_SVHS,
1721                .muxsel         = MUXSEL(0),
1722                .pll            = PLL_28,
1723                .tuner_type     = TUNER_ABSENT,
1724                .tuner_addr     = ADDR_UNSET,
1725                .no_msp34xx     = 1,
1726                .no_tda9875     = 1,
1727                .no_tda7432     = 1,
1728        },
1729        [BTTV_BOARD_OSPREY1x1_SVID] = {
1730                .name           = "Osprey 101/151 w/ svid",  /* 0x(16|17|20)-00C4-C1 */
1731                .video_inputs   = 2,
1732                /* .audio_inputs= 0, */
1733                .svhs           = 1,
1734                .muxsel         = MUXSEL(0, 1),
1735                .pll            = PLL_28,
1736                .tuner_type     = TUNER_ABSENT,
1737                .tuner_addr     = ADDR_UNSET,
1738                .no_msp34xx     = 1,
1739                .no_tda9875     = 1,
1740                .no_tda7432     = 1,
1741        },
1742        [BTTV_BOARD_OSPREY2xx] = {
1743                .name           = "Osprey 200/201/250/251",  /* 0x1(8|9|E|F)-0004-C4 */
1744                .video_inputs   = 1,
1745                /* .audio_inputs= 1, */
1746                .svhs           = NO_SVHS,
1747                .muxsel         = MUXSEL(0),
1748                .pll            = PLL_28,
1749                .tuner_type     = TUNER_ABSENT,
1750                .tuner_addr     = ADDR_UNSET,
1751                .no_msp34xx     = 1,
1752                .no_tda9875     = 1,
1753                .no_tda7432     = 1,
1754        },
1755
1756                /* ---- card 0x58 ---------------------------------- */
1757        [BTTV_BOARD_OSPREY2x0_SVID] = {
1758                .name           = "Osprey 200/250",   /* 0x1(A|B)-00C4-C1 */
1759                .video_inputs   = 2,
1760                /* .audio_inputs= 1, */
1761                .svhs           = 1,
1762                .muxsel         = MUXSEL(0, 1),
1763                .pll            = PLL_28,
1764                .tuner_type     = TUNER_ABSENT,
1765                .tuner_addr     = ADDR_UNSET,
1766                .no_msp34xx     = 1,
1767                .no_tda9875     = 1,
1768                .no_tda7432     = 1,
1769        },
1770        [BTTV_BOARD_OSPREY2x0] = {
1771                .name           = "Osprey 210/220/230",   /* 0x1(A|B)-04C0-C1 */
1772                .video_inputs   = 2,
1773                /* .audio_inputs= 1, */
1774                .svhs           = 1,
1775                .muxsel         = MUXSEL(2, 3),
1776                .pll            = PLL_28,
1777                .tuner_type     = TUNER_ABSENT,
1778                .tuner_addr     = ADDR_UNSET,
1779                .no_msp34xx     = 1,
1780                .no_tda9875     = 1,
1781                .no_tda7432     = 1,
1782        },
1783        [BTTV_BOARD_OSPREY500] = {
1784                .name           = "Osprey 500",   /* 500 */
1785                .video_inputs   = 2,
1786                /* .audio_inputs= 1, */
1787                .svhs           = 1,
1788                .muxsel         = MUXSEL(2, 3),
1789                .pll            = PLL_28,
1790                .tuner_type     = TUNER_ABSENT,
1791                .tuner_addr     = ADDR_UNSET,
1792                .no_msp34xx     = 1,
1793                .no_tda9875     = 1,
1794                .no_tda7432     = 1,
1795        },
1796        [BTTV_BOARD_OSPREY540] = {
1797                .name           = "Osprey 540",   /* 540 */
1798                .video_inputs   = 4,
1799                /* .audio_inputs= 1, */
1800                .pll            = PLL_28,
1801                .tuner_type     = TUNER_ABSENT,
1802                .tuner_addr     = ADDR_UNSET,
1803                .no_msp34xx     = 1,
1804                .no_tda9875     = 1,
1805                .no_tda7432     = 1,
1806        },
1807
1808                /* ---- card 0x5C ---------------------------------- */
1809        [BTTV_BOARD_OSPREY2000] = {
1810                .name           = "Osprey 2000",  /* 2000 */
1811                .video_inputs   = 2,
1812                /* .audio_inputs= 1, */
1813                .svhs           = 1,
1814                .muxsel         = MUXSEL(2, 3),
1815                .pll            = PLL_28,
1816                .tuner_type     = TUNER_ABSENT,
1817                .tuner_addr     = ADDR_UNSET,
1818                .no_msp34xx     = 1,
1819                .no_tda9875     = 1,
1820                .no_tda7432     = 1,      /* must avoid, conflicts with the bt860 */
1821        },
1822        [BTTV_BOARD_IDS_EAGLE] = {
1823                /* M G Berberich <berberic@forwiss.uni-passau.de> */
1824                .name           = "IDS Eagle",
1825                .video_inputs   = 4,
1826                /* .audio_inputs= 0, */
1827                .tuner_type     = TUNER_ABSENT,
1828                .tuner_addr     = ADDR_UNSET,
1829                .svhs           = NO_SVHS,
1830                .gpiomask       = 0,
1831                .muxsel         = MUXSEL(2, 2, 2, 2),
1832                .muxsel_hook    = eagle_muxsel,
1833                .no_msp34xx     = 1,
1834                .no_tda9875     = 1,
1835                .pll            = PLL_28,
1836        },
1837        [BTTV_BOARD_PINNACLESAT] = {
1838                .name           = "Pinnacle PCTV Sat",
1839                .video_inputs   = 2,
1840                /* .audio_inputs= 0, */
1841                .svhs           = 1,
1842                .tuner_type     = TUNER_ABSENT,
1843                .tuner_addr     = ADDR_UNSET,
1844                .no_msp34xx     = 1,
1845                .no_tda9875     = 1,
1846                .no_tda7432     = 1,
1847                .muxsel         = MUXSEL(3, 1),
1848                .pll            = PLL_28,
1849                .no_gpioirq     = 1,
1850                .has_dvb        = 1,
1851        },
1852        [BTTV_BOARD_FORMAC_PROTV] = {
1853                .name           = "Formac ProTV II (bt878)",
1854                .video_inputs   = 4,
1855                /* .audio_inputs= 1, */
1856                .svhs           = 3,
1857                .gpiomask       = 2,
1858                /* TV, Comp1, Composite over SVID con, SVID */
1859                .muxsel         = MUXSEL(2, 3, 1, 1),
1860                .gpiomux        = { 2, 2, 0, 0 },
1861                .pll            = PLL_28,
1862                .has_radio      = 1,
1863                .tuner_type     = TUNER_PHILIPS_PAL,
1864                .tuner_addr     = ADDR_UNSET,
1865        /* sound routing:
1866                GPIO=0x00,0x01,0x03: mute (?)
1867                0x02: both TV and radio (tuner: FM1216/I)
1868                The card has onboard audio connectors labeled "cdrom" and "board",
1869                not soldered here, though unknown wiring.
1870                Card lacks: external audio in, pci subsystem id.
1871        */
1872        },
1873
1874                /* ---- card 0x60 ---------------------------------- */
1875        [BTTV_BOARD_MACHTV] = {
1876                .name           = "MachTV",
1877                .video_inputs   = 3,
1878                /* .audio_inputs= 1, */
1879                .svhs           = NO_SVHS,
1880                .gpiomask       = 7,
1881                .muxsel         = MUXSEL(2, 3, 1, 1),
1882                .gpiomux        = { 0, 1, 2, 3},
1883                .gpiomute       = 4,
1884                .needs_tvaudio  = 1,
1885                .tuner_type     = TUNER_PHILIPS_PAL,
1886                .tuner_addr     = ADDR_UNSET,
1887                .pll            = PLL_28,
1888        },
1889        [BTTV_BOARD_EURESYS_PICOLO] = {
1890                .name           = "Euresys Picolo",
1891                .video_inputs   = 3,
1892                /* .audio_inputs= 0, */
1893                .svhs           = 2,
1894                .gpiomask       = 0,
1895                .no_msp34xx     = 1,
1896                .no_tda9875     = 1,
1897                .no_tda7432     = 1,
1898                .muxsel         = MUXSEL(2, 0, 1),
1899                .pll            = PLL_28,
1900                .tuner_type     = TUNER_ABSENT,
1901                .tuner_addr     = ADDR_UNSET,
1902        },
1903        [BTTV_BOARD_PV150] = {
1904                /* Luc Van Hoeylandt <luc@e-magic.be> */
1905                .name           = "ProVideo PV150", /* 0x4f */
1906                .video_inputs   = 2,
1907                /* .audio_inputs= 0, */
1908                .svhs           = NO_SVHS,
1909                .gpiomask       = 0,
1910                .muxsel         = MUXSEL(2, 3),
1911                .gpiomux        = { 0 },
1912                .needs_tvaudio  = 0,
1913                .no_msp34xx     = 1,
1914                .pll            = PLL_28,
1915                .tuner_type     = TUNER_ABSENT,
1916                .tuner_addr     = ADDR_UNSET,
1917        },
1918        [BTTV_BOARD_AD_TVK503] = {
1919                /* Hiroshi Takekawa <sian@big.or.jp> */
1920                /* This card lacks subsystem ID */
1921                .name           = "AD-TVK503", /* 0x63 */
1922                .video_inputs   = 4,
1923                /* .audio_inputs= 1, */
1924                .svhs           = 2,
1925                .gpiomask       = 0x001e8007,
1926                .muxsel         = MUXSEL(2, 3, 1, 0),
1927                /*                  Tuner, Radio, external, internal, off,  on */
1928                .gpiomux        = { 0x08,  0x0f,  0x0a,     0x08 },
1929                .gpiomute       = 0x0f,
1930                .needs_tvaudio  = 0,
1931                .no_msp34xx     = 1,
1932                .pll            = PLL_28,
1933                .tuner_type     = TUNER_PHILIPS_NTSC,
1934                .tuner_addr     = ADDR_UNSET,
1935                .audio_mode_gpio= adtvk503_audio,
1936        },
1937
1938                /* ---- card 0x64 ---------------------------------- */
1939        [BTTV_BOARD_HERCULES_SM_TV] = {
1940                .name           = "Hercules Smart TV Stereo",
1941                .video_inputs   = 4,
1942                /* .audio_inputs= 1, */
1943                .svhs           = 2,
1944                .gpiomask       = 0x00,
1945                .muxsel         = MUXSEL(2, 3, 1, 1),
1946                .needs_tvaudio  = 1,
1947                .no_msp34xx     = 1,
1948                .pll            = PLL_28,
1949                .tuner_type     = TUNER_PHILIPS_PAL,
1950                .tuner_addr     = ADDR_UNSET,
1951                /* Notes:
1952                - card lacks subsystem ID
1953                - stereo variant w/ daughter board with tda9874a @0xb0
1954                - Audio Routing:
1955                        always from tda9874 independent of GPIO (?)
1956                        external line in: unknown
1957                - Other chips: em78p156elp @ 0x96 (probably IR remote control)
1958                        hef4053 (instead 4052) for unknown function
1959                */
1960        },
1961        [BTTV_BOARD_PACETV] = {
1962                .name           = "Pace TV & Radio Card",
1963                .video_inputs   = 4,
1964                /* .audio_inputs= 1, */
1965                .svhs           = 2,
1966                /* Tuner, CVid, SVid, CVid over SVid connector */
1967                .muxsel         = MUXSEL(2, 3, 1, 1),
1968                .gpiomask       = 0,
1969                .no_tda9875     = 1,
1970                .no_tda7432     = 1,
1971                .tuner_type     = TUNER_PHILIPS_PAL_I,
1972                .tuner_addr     = ADDR_UNSET,
1973                .has_radio      = 1,
1974                .pll            = PLL_28,
1975                /* Bt878, Bt832, FI1246 tuner; no pci subsystem id
1976                only internal line out: (4pin header) RGGL
1977                Radio must be decoded by msp3410d (not routed through)*/
1978                /*
1979                .digital_mode   = DIGITAL_MODE_CAMERA,  todo!
1980                */
1981        },
1982        [BTTV_BOARD_IVC200] = {
1983                /* Chris Willing <chris@vislab.usyd.edu.au> */
1984                .name           = "IVC-200",
1985                .video_inputs   = 1,
1986                /* .audio_inputs= 0, */
1987                .tuner_type     = TUNER_ABSENT,
1988                .tuner_addr     = ADDR_UNSET,
1989                .svhs           = NO_SVHS,
1990                .gpiomask       = 0xdf,
1991                .muxsel         = MUXSEL(2),
1992                .pll            = PLL_28,
1993        },
1994        [BTTV_BOARD_IVCE8784] = {
1995                .name           = "IVCE-8784",
1996                .video_inputs   = 1,
1997                /* .audio_inputs= 0, */
1998                .tuner_type     = TUNER_ABSENT,
1999                .tuner_addr     = ADDR_UNSET,
2000                .svhs           = NO_SVHS,
2001                .gpiomask       = 0xdf,
2002                .muxsel         = MUXSEL(2),
2003                .pll            = PLL_28,
2004        },
2005        [BTTV_BOARD_XGUARD] = {
2006                .name           = "Grand X-Guard / Trust 814PCI",
2007                .video_inputs   = 16,
2008                /* .audio_inputs= 0, */
2009                .svhs           = NO_SVHS,
2010                .tuner_type     = TUNER_ABSENT,
2011                .tuner_addr     = ADDR_UNSET,
2012                .gpiomask2      = 0xff,
2013                .muxsel         = MUXSEL(2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0),
2014                .muxsel_hook    = xguard_muxsel,
2015                .no_msp34xx     = 1,
2016                .no_tda9875     = 1,
2017                .no_tda7432     = 1,
2018                .pll            = PLL_28,
2019        },
2020
2021                /* ---- card 0x68 ---------------------------------- */
2022        [BTTV_BOARD_NEBULA_DIGITV] = {
2023                .name           = "Nebula Electronics DigiTV",
2024                .video_inputs   = 1,
2025                .svhs           = NO_SVHS,
2026                .muxsel         = MUXSEL(2, 3, 1, 0),
2027                .no_msp34xx     = 1,
2028                .no_tda9875     = 1,
2029                .no_tda7432     = 1,
2030                .pll            = PLL_28,
2031                .tuner_type     = TUNER_ABSENT,
2032                .tuner_addr     = ADDR_UNSET,
2033                .has_dvb        = 1,
2034                .has_remote     = 1,
2035                .gpiomask       = 0x1b,
2036                .no_gpioirq     = 1,
2037        },
2038        [BTTV_BOARD_PV143] = {
2039                /* Jorge Boncompte - DTI2 <jorge@dti2.net> */
2040                .name           = "ProVideo PV143",
2041                .video_inputs   = 4,
2042                /* .audio_inputs= 0, */
2043                .svhs           = NO_SVHS,
2044                .gpiomask       = 0,
2045                .muxsel         = MUXSEL(2, 3, 1, 0),
2046                .gpiomux        = { 0 },
2047                .needs_tvaudio  = 0,
2048                .no_msp34xx     = 1,
2049                .pll            = PLL_28,
2050                .tuner_type     = TUNER_ABSENT,
2051                .tuner_addr     = ADDR_UNSET,
2052        },
2053        [BTTV_BOARD_VD009X1_VD011_MINIDIN] = {
2054                /* M.Klahr@phytec.de */
2055                .name           = "PHYTEC VD-009-X1 VD-011 MiniDIN (bt878)",
2056                .video_inputs   = 4,
2057                /* .audio_inputs= 0, */
2058                .svhs           = 3,
2059                .gpiomask       = 0x00,
2060                .muxsel         = MUXSEL(2, 3, 1, 0),
2061                .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2062                .needs_tvaudio  = 0,
2063                .pll            = PLL_28,
2064                .tuner_type     = TUNER_ABSENT,
2065                .tuner_addr     = ADDR_UNSET,
2066        },
2067        [BTTV_BOARD_VD009X1_VD011_COMBI] = {
2068                .name           = "PHYTEC VD-009-X1 VD-011 Combi (bt878)",
2069                .video_inputs   = 4,
2070                /* .audio_inputs= 0, */
2071                .svhs           = 3,
2072                .gpiomask       = 0x00,
2073                .muxsel         = MUXSEL(2, 3, 1, 1),
2074                .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2075                .needs_tvaudio  = 0,
2076                .pll            = PLL_28,
2077                .tuner_type     = TUNER_ABSENT,
2078                .tuner_addr     = ADDR_UNSET,
2079        },
2080
2081                /* ---- card 0x6c ---------------------------------- */
2082        [BTTV_BOARD_VD009_MINIDIN] = {
2083                .name           = "PHYTEC VD-009 MiniDIN (bt878)",
2084                .video_inputs   = 10,
2085                /* .audio_inputs= 0, */
2086                .svhs           = 9,
2087                .gpiomask       = 0x00,
2088                .gpiomask2      = 0x03, /* used for external vodeo mux */
2089                .muxsel         = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 0),
2090                .muxsel_hook    = phytec_muxsel,
2091                .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2092                .needs_tvaudio  = 1,
2093                .pll            = PLL_28,
2094                .tuner_type     = TUNER_ABSENT,
2095                .tuner_addr     = ADDR_UNSET,
2096        },
2097        [BTTV_BOARD_VD009_COMBI] = {
2098                .name           = "PHYTEC VD-009 Combi (bt878)",
2099                .video_inputs   = 10,
2100                /* .audio_inputs= 0, */
2101                .svhs           = 9,
2102                .gpiomask       = 0x00,
2103                .gpiomask2      = 0x03, /* used for external vodeo mux */
2104                .muxsel         = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1),
2105                .muxsel_hook    = phytec_muxsel,
2106                .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2107                .needs_tvaudio  = 1,
2108                .pll            = PLL_28,
2109                .tuner_type     = TUNER_ABSENT,
2110                .tuner_addr     = ADDR_UNSET,
2111        },
2112        [BTTV_BOARD_IVC100] = {
2113                .name           = "IVC-100",
2114                .video_inputs   = 4,
2115                /* .audio_inputs= 0, */
2116                .tuner_type     = TUNER_ABSENT,
2117                .tuner_addr     = ADDR_UNSET,
2118                .svhs           = NO_SVHS,
2119                .gpiomask       = 0xdf,
2120                .muxsel         = MUXSEL(2, 3, 1, 0),
2121                .pll            = PLL_28,
2122        },
2123        [BTTV_BOARD_IVC120] = {
2124                /* IVC-120G - Alan Garfield <alan@fromorbit.com> */
2125                .name           = "IVC-120G",
2126                .video_inputs   = 16,
2127                /* .audio_inputs= 0, */
2128                .tuner_type     = TUNER_ABSENT,
2129                .tuner_addr     = ADDR_UNSET,
2130                .svhs           = NO_SVHS,   /* card has no svhs */
2131                .needs_tvaudio  = 0,
2132                .no_msp34xx     = 1,
2133                .no_tda9875     = 1,
2134                .no_tda7432     = 1,
2135                .gpiomask       = 0x00,
2136                .muxsel         = MUXSEL(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
2137                .muxsel_hook    = ivc120_muxsel,
2138                .pll            = PLL_28,
2139        },
2140
2141                /* ---- card 0x70 ---------------------------------- */
2142        [BTTV_BOARD_PC_HDTV] = {
2143                .name           = "pcHDTV HD-2000 TV",
2144                .video_inputs   = 4,
2145                /* .audio_inputs= 1, */
2146                .svhs           = 2,
2147                .muxsel         = MUXSEL(2, 3, 1, 0),
2148                .tuner_type     = TUNER_PHILIPS_FCV1236D,
2149                .tuner_addr     = ADDR_UNSET,
2150                .has_dvb        = 1,
2151        },
2152        [BTTV_BOARD_TWINHAN_DST] = {
2153                .name           = "Twinhan DST + clones",
2154                .no_msp34xx     = 1,
2155                .no_tda9875     = 1,
2156                .no_tda7432     = 1,
2157                .tuner_type     = TUNER_ABSENT,
2158                .tuner_addr     = ADDR_UNSET,
2159                .no_video       = 1,
2160                .has_dvb        = 1,
2161        },
2162        [BTTV_BOARD_WINFASTVC100] = {
2163                .name           = "Winfast VC100",
2164                .video_inputs   = 3,
2165                /* .audio_inputs= 0, */
2166                .svhs           = 1,
2167                /* Vid In, SVid In, Vid over SVid in connector */
2168                .muxsel         = MUXSEL(3, 1, 1, 3),
2169                .no_msp34xx     = 1,
2170                .no_tda9875     = 1,
2171                .no_tda7432     = 1,
2172                .tuner_type     = TUNER_ABSENT,
2173                .tuner_addr     = ADDR_UNSET,
2174                .pll            = PLL_28,
2175        },
2176        [BTTV_BOARD_TEV560] = {
2177                .name           = "Teppro TEV-560/InterVision IV-560",
2178                .video_inputs   = 3,
2179                /* .audio_inputs= 1, */
2180                .svhs           = 2,
2181                .gpiomask       = 3,
2182                .muxsel         = MUXSEL(2, 3, 1, 1),
2183                .gpiomux        = { 1, 1, 1, 1 },
2184                .needs_tvaudio  = 1,
2185                .tuner_type     = TUNER_PHILIPS_PAL,
2186                .tuner_addr     = ADDR_UNSET,
2187                .pll            = PLL_35,
2188        },
2189
2190                /* ---- card 0x74 ---------------------------------- */
2191        [BTTV_BOARD_SIMUS_GVC1100] = {
2192                .name           = "SIMUS GVC1100",
2193                .video_inputs   = 4,
2194                /* .audio_inputs= 0, */
2195                .svhs           = NO_SVHS,
2196                .tuner_type     = TUNER_ABSENT,
2197                .tuner_addr     = ADDR_UNSET,
2198                .pll            = PLL_28,
2199                .muxsel         = MUXSEL(2, 2, 2, 2),
2200                .gpiomask       = 0x3F,
2201                .muxsel_hook    = gvc1100_muxsel,
2202        },
2203        [BTTV_BOARD_NGSTV_PLUS] = {
2204                /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */
2205                .name           = "NGS NGSTV+",
2206                .video_inputs   = 3,
2207                .svhs           = 2,
2208                .gpiomask       = 0x008007,
2209                .muxsel         = MUXSEL(2, 3, 0, 0),
2210                .gpiomux        = { 0, 0, 0, 0 },
2211                .gpiomute       = 0x000003,
2212                .pll            = PLL_28,
2213                .tuner_type     = TUNER_PHILIPS_PAL,
2214                .tuner_addr     = ADDR_UNSET,
2215                .has_remote     = 1,
2216        },
2217        [BTTV_BOARD_LMLBT4] = {
2218                /* http://linuxmedialabs.com */
2219                .name           = "LMLBT4",
2220                .video_inputs   = 4, /* IN1,IN2,IN3,IN4 */
2221                /* .audio_inputs= 0, */
2222                .svhs           = NO_SVHS,
2223                .muxsel         = MUXSEL(2, 3, 1, 0),
2224                .no_msp34xx     = 1,
2225                .no_tda9875     = 1,
2226                .no_tda7432     = 1,
2227                .needs_tvaudio  = 0,
2228                .tuner_type     = TUNER_ABSENT,
2229                .tuner_addr     = ADDR_UNSET,
2230        },
2231        [BTTV_BOARD_TEKRAM_M205] = {
2232                /* Helmroos Harri <harri.helmroos@pp.inet.fi> */
2233                .name           = "Tekram M205 PRO",
2234                .video_inputs   = 3,
2235                /* .audio_inputs= 1, */
2236                .tuner_type     = TUNER_PHILIPS_PAL,
2237                .tuner_addr     = ADDR_UNSET,
2238                .svhs           = 2,
2239                .needs_tvaudio  = 0,
2240                .gpiomask       = 0x68,
2241                .muxsel         = MUXSEL(2, 3, 1),
2242                .gpiomux        = { 0x68, 0x68, 0x61, 0x61 },
2243                .pll            = PLL_28,
2244        },
2245
2246                /* ---- card 0x78 ---------------------------------- */
2247        [BTTV_BOARD_CONTVFMI] = {
2248                /* Javier Cendan Ares <jcendan@lycos.es> */
2249                /* bt878 TV + FM without subsystem ID */
2250                .name           = "Conceptronic CONTVFMi",
2251                .video_inputs   = 3,
2252                /* .audio_inputs= 1, */
2253                .svhs           = 2,
2254                .gpiomask       = 0x008007,
2255                .muxsel         = MUXSEL(2, 3, 1, 1),
2256                .gpiomux        = { 0, 1, 2, 2 },
2257                .gpiomute       = 3,
2258                .needs_tvaudio  = 0,
2259                .pll            = PLL_28,
2260                .tuner_type     = TUNER_PHILIPS_PAL,
2261                .tuner_addr     = ADDR_UNSET,
2262                .has_remote     = 1,
2263                .has_radio      = 1,
2264        },
2265        [BTTV_BOARD_PICOLO_TETRA_CHIP] = {
2266                /*Eric DEBIEF <debief@telemsa.com>*/
2267                /*EURESYS Picolo Tetra : 4 Conexant Fusion 878A, no audio, video input set with analog multiplexers GPIO controled*/
2268                /* adds picolo_tetra_muxsel(), picolo_tetra_init(), the folowing declaration strucure, and #define BTTV_BOARD_PICOLO_TETRA_CHIP*/
2269                /*0x79 in bttv.h*/
2270                .name           = "Euresys Picolo Tetra",
2271                .video_inputs   = 4,
2272                /* .audio_inputs= 0, */
2273                .svhs           = NO_SVHS,
2274                .gpiomask       = 0,
2275                .gpiomask2      = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2276                .no_msp34xx     = 1,
2277                .no_tda9875     = 1,
2278                .no_tda7432     = 1,
2279                /*878A input is always MUX0, see above.*/
2280                .muxsel         = MUXSEL(2, 2, 2, 2),
2281                .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2282                .pll            = PLL_28,
2283                .needs_tvaudio  = 0,
2284                .muxsel_hook    = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/
2285                .tuner_type     = TUNER_ABSENT,
2286                .tuner_addr     = ADDR_UNSET,
2287        },
2288        [BTTV_BOARD_SPIRIT_TV] = {
2289                /* Spirit TV Tuner from http://spiritmodems.com.au */
2290                /* Stafford Goodsell <surge@goliath.homeunix.org> */
2291                .name           = "Spirit TV Tuner",
2292                .video_inputs   = 3,
2293                /* .audio_inputs= 1, */
2294                .svhs           = 2,
2295                .gpiomask       = 0x0000000f,
2296                .muxsel         = MUXSEL(2, 1, 1),
2297                .gpiomux        = { 0x02, 0x00, 0x00, 0x00 },
2298                .tuner_type     = TUNER_TEMIC_PAL,
2299                .tuner_addr     = ADDR_UNSET,
2300                .no_msp34xx     = 1,
2301                .no_tda9875     = 1,
2302        },
2303        [BTTV_BOARD_AVDVBT_771] = {
2304                /* Wolfram Joost <wojo@frokaschwei.de> */
2305                .name           = "AVerMedia AVerTV DVB-T 771",
2306                .video_inputs   = 2,
2307                .svhs           = 1,
2308                .tuner_type     = TUNER_ABSENT,
2309                .tuner_addr     = ADDR_UNSET,
2310                .muxsel         = MUXSEL(3, 3),
2311                .no_msp34xx     = 1,
2312                .no_tda9875     = 1,
2313                .no_tda7432     = 1,
2314                .pll            = PLL_28,
2315                .has_dvb        = 1,
2316                .no_gpioirq     = 1,
2317                .has_remote     = 1,
2318        },
2319                /* ---- card 0x7c ---------------------------------- */
2320        [BTTV_BOARD_AVDVBT_761] = {
2321                /* Matt Jesson <dvb@jesson.eclipse.co.uk> */
2322                /* Based on the Nebula card data - added remote and new card number - BTTV_BOARD_AVDVBT_761, see also ir-kbd-gpio.c */
2323                .name           = "AverMedia AverTV DVB-T 761",
2324                .video_inputs   = 2,
2325                .svhs           = 1,
2326                .muxsel         = MUXSEL(3, 1, 2, 0), /* Comp0, S-Video, ?, ? */
2327                .no_msp34xx     = 1,
2328                .no_tda9875     = 1,
2329                .no_tda7432     = 1,
2330                .pll            = PLL_28,
2331                .tuner_type     = TUNER_ABSENT,
2332                .tuner_addr     = ADDR_UNSET,
2333                .has_dvb        = 1,
2334                .no_gpioirq     = 1,
2335                .has_remote     = 1,
2336        },
2337        [BTTV_BOARD_MATRIX_VISIONSQ] = {
2338                /* andre.schwarz@matrix-vision.de */
2339                .name           = "MATRIX Vision Sigma-SQ",
2340                .video_inputs   = 16,
2341                /* .audio_inputs= 0, */
2342                .svhs           = NO_SVHS,
2343                .gpiomask       = 0x0,
2344                .muxsel         = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3),
2345                .muxsel_hook    = sigmaSQ_muxsel,
2346                .gpiomux        = { 0 },
2347                .no_msp34xx     = 1,
2348                .pll            = PLL_28,
2349                .tuner_type     = TUNER_ABSENT,
2350                .tuner_addr     = ADDR_UNSET,
2351        },
2352        [BTTV_BOARD_MATRIX_VISIONSLC] = {
2353                /* andre.schwarz@matrix-vision.de */
2354                .name           = "MATRIX Vision Sigma-SLC",
2355                .video_inputs   = 4,
2356                /* .audio_inputs= 0, */
2357                .svhs           = NO_SVHS,
2358                .gpiomask       = 0x0,
2359                .muxsel         = MUXSEL(2, 2, 2, 2),
2360                .muxsel_hook    = sigmaSLC_muxsel,
2361                .gpiomux        = { 0 },
2362                .no_msp34xx     = 1,
2363                .pll            = PLL_28,
2364                .tuner_type     = TUNER_ABSENT,
2365                .tuner_addr     = ADDR_UNSET,
2366        },
2367                /* BTTV_BOARD_APAC_VIEWCOMP */
2368        [BTTV_BOARD_APAC_VIEWCOMP] = {
2369                /* Attila Kondoros <attila.kondoros@chello.hu> */
2370                /* bt878 TV + FM 0x00000000 subsystem ID */
2371                .name           = "APAC Viewcomp 878(AMAX)",
2372                .video_inputs   = 2,
2373                /* .audio_inputs= 1, */
2374                .svhs           = NO_SVHS,
2375                .gpiomask       = 0xFF,
2376                .muxsel         = MUXSEL(2, 3, 1, 1),
2377                .gpiomux        = { 2, 0, 0, 0 },
2378                .gpiomute       = 10,
2379                .needs_tvaudio  = 0,
2380                .pll            = PLL_28,
2381                .tuner_type     = TUNER_PHILIPS_PAL,
2382                .tuner_addr     = ADDR_UNSET,
2383                .has_remote     = 1,   /* miniremote works, see ir-kbd-gpio.c */
2384                .has_radio      = 1,   /* not every card has radio */
2385        },
2386
2387                /* ---- card 0x80 ---------------------------------- */
2388        [BTTV_BOARD_DVICO_DVBT_LITE] = {
2389                /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
2390                .name           = "DViCO FusionHDTV DVB-T Lite",
2391                .no_msp34xx     = 1,
2392                .no_tda9875     = 1,
2393                .no_tda7432     = 1,
2394                .pll            = PLL_28,
2395                .no_video       = 1,
2396                .has_dvb        = 1,
2397                .tuner_type     = TUNER_ABSENT,
2398                .tuner_addr     = ADDR_UNSET,
2399        },
2400        [BTTV_BOARD_VGEAR_MYVCD] = {
2401                /* Steven <photon38@pchome.com.tw> */
2402                .name           = "V-Gear MyVCD",
2403                .video_inputs   = 3,
2404                /* .audio_inputs= 1, */
2405                .svhs           = 2,
2406                .gpiomask       = 0x3f,
2407                .muxsel         = MUXSEL(2, 3, 1, 0),
2408                .gpiomux        = {0x31, 0x31, 0x31, 0x31 },
2409                .gpiomute       = 0x31,
2410                .no_msp34xx     = 1,
2411                .pll            = PLL_28,
2412                .tuner_type     = TUNER_PHILIPS_NTSC_M,
2413                .tuner_addr     = ADDR_UNSET,
2414                .has_radio      = 0,
2415        },
2416        [BTTV_BOARD_SUPER_TV] = {
2417                /* Rick C <cryptdragoon@gmail.com> */
2418                .name           = "Super TV Tuner",
2419                .video_inputs   = 4,
2420                /* .audio_inputs= 1, */
2421                .svhs           = 2,
2422                .muxsel         = MUXSEL(2, 3, 1, 0),
2423                .tuner_type     = TUNER_PHILIPS_NTSC,
2424                .tuner_addr     = ADDR_UNSET,
2425                .gpiomask       = 0x008007,
2426                .gpiomux        = { 0, 0x000001,0,0 },
2427                .needs_tvaudio  = 1,
2428                .has_radio      = 1,
2429        },
2430        [BTTV_BOARD_TIBET_CS16] = {
2431                /* Chris Fanning <video4linux@haydon.net> */
2432                .name           = "Tibet Systems 'Progress DVR' CS16",
2433                .video_inputs   = 16,
2434                /* .audio_inputs= 0, */
2435                .svhs           = NO_SVHS,
2436                .muxsel         = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
2437                .pll            = PLL_28,
2438                .no_msp34xx     = 1,
2439                .no_tda9875     = 1,
2440                .no_tda7432     = 1,
2441                .tuner_type     = TUNER_ABSENT,
2442                .tuner_addr     = ADDR_UNSET,
2443                .muxsel_hook    = tibetCS16_muxsel,
2444        },
2445        [BTTV_BOARD_KODICOM_4400R] = {
2446                /* Bill Brack <wbrack@mmm.com.hk> */
2447                /*
2448                * Note that, because of the card's wiring, the "master"
2449                * BT878A chip (i.e. the one which controls the analog switch
2450                * and must use this card type) is the 2nd one detected.  The
2451                * other 3 chips should use card type 0x85, whose description
2452                * follows this one.  There is a EEPROM on the card (which is
2453                * connected to the I2C of one of those other chips), but is
2454                * not currently handled.  There is also a facility for a
2455                * "monitor", which is also not currently implemented.
2456                */
2457                .name           = "Kodicom 4400R (master)",
2458                .video_inputs   = 16,
2459                /* .audio_inputs= 0, */
2460                .tuner_type     = TUNER_ABSENT,
2461                .tuner_addr     = ADDR_UNSET,
2462                .svhs           = NO_SVHS,
2463                /* GPIO bits 0-9 used for analog switch:
2464                *   00 - 03:    camera selector
2465                *   04 - 06:    channel (controller) selector
2466                *   07: data (1->on, 0->off)
2467                *   08: strobe
2468                *   09: reset
2469                * bit 16 is input from sync separator for the channel
2470                */
2471                .gpiomask       = 0x0003ff,
2472                .no_gpioirq     = 1,
2473                .muxsel         = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
2474                .pll            = PLL_28,
2475                .no_msp34xx     = 1,
2476                .no_tda7432     = 1,
2477                .no_tda9875     = 1,
2478                .muxsel_hook    = kodicom4400r_muxsel,
2479        },
2480        [BTTV_BOARD_KODICOM_4400R_SL] = {
2481                /* Bill Brack <wbrack@mmm.com.hk> */
2482                /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the
2483                * one which controls the analog switch, and must use the card type)
2484                * is the 2nd one detected.  The other 3 chips should use this card
2485                * type
2486                */
2487                .name           = "Kodicom 4400R (slave)",
2488                .video_inputs   = 16,
2489                /* .audio_inputs= 0, */
2490                .tuner_type     = TUNER_ABSENT,
2491                .tuner_addr     = ADDR_UNSET,
2492                .svhs           = NO_SVHS,
2493                .gpiomask       = 0x010000,
2494                .no_gpioirq     = 1,
2495                .muxsel         = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
2496                .pll            = PLL_28,
2497                .no_msp34xx     = 1,
2498                .no_tda7432     = 1,
2499                .no_tda9875     = 1,
2500                .muxsel_hook    = kodicom4400r_muxsel,
2501        },
2502                /* ---- card 0x86---------------------------------- */
2503        [BTTV_BOARD_ADLINK_RTV24] = {
2504                /* Michael Henson <mhenson@clarityvi.com> */
2505                /* Adlink RTV24 with special unlock codes */
2506                .name           = "Adlink RTV24",
2507                .video_inputs   = 4,
2508                /* .audio_inputs= 1, */
2509                .svhs           = 2,
2510                .muxsel         = MUXSEL(2, 3, 1, 0),
2511                .tuner_type     = UNSET,
2512                .tuner_addr     = ADDR_UNSET,
2513                .pll            = PLL_28,
2514        },
2515                /* ---- card 0x87---------------------------------- */
2516        [BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE] = {
2517                /* Michael Krufky <mkrufky@m1k.net> */
2518                .name           = "DViCO FusionHDTV 5 Lite",
2519                .tuner_type     = TUNER_LG_TDVS_H06XF, /* TDVS-H064F */
2520                .tuner_addr     = ADDR_UNSET,
2521                .video_inputs   = 3,
2522                /* .audio_inputs= 1, */
2523                .svhs           = 2,
2524                .muxsel         = MUXSEL(2, 3, 1),
2525                .gpiomask       = 0x00e00007,
2526                .gpiomux        = { 0x00400005, 0, 0x00000001, 0 },
2527                .gpiomute       = 0x00c00007,
2528                .no_msp34xx     = 1,
2529                .no_tda9875     = 1,
2530                .no_tda7432     = 1,
2531                .has_dvb        = 1,
2532        },
2533                /* ---- card 0x88---------------------------------- */
2534        [BTTV_BOARD_ACORP_Y878F] = {
2535                /* Mauro Carvalho Chehab <mchehab@infradead.org> */
2536                .name           = "Acorp Y878F",
2537                .video_inputs   = 3,
2538                /* .audio_inputs= 1, */
2539                .svhs           = 2,
2540                .gpiomask       = 0x01fe00,
2541                .muxsel         = MUXSEL(2, 3, 1, 1),
2542                .gpiomux        = { 0x001e00, 0, 0x018000, 0x014000 },
2543                .gpiomute       = 0x002000,
2544                .needs_tvaudio  = 1,
2545                .pll            = PLL_28,
2546                .tuner_type     = TUNER_YMEC_TVF66T5_B_DFF,
2547                .tuner_addr     = 0xc1 >>1,
2548                .has_radio      = 1,
2549        },
2550                /* ---- card 0x89 ---------------------------------- */
2551        [BTTV_BOARD_CONCEPTRONIC_CTVFMI2] = {
2552                .name           = "Conceptronic CTVFMi v2",
2553                .video_inputs   = 3,
2554                /* .audio_inputs= 1, */
2555                .svhs           = 2,
2556                .gpiomask       = 0x001c0007,
2557                .muxsel         = MUXSEL(2, 3, 1, 1),
2558                .gpiomux        = { 0, 1, 2, 2 },
2559                .gpiomute       = 3,
2560                .needs_tvaudio  = 0,
2561                .pll            = PLL_28,
2562                .tuner_type     = TUNER_TENA_9533_DI,
2563                .tuner_addr     = ADDR_UNSET,
2564                .has_remote     = 1,
2565                .has_radio      = 1,
2566        },
2567                /* ---- card 0x8a ---------------------------------- */
2568        [BTTV_BOARD_PV_BT878P_2E] = {
2569                .name           = "Prolink Pixelview PV-BT878P+ (Rev.2E)",
2570                .video_inputs   = 5,
2571                /* .audio_inputs= 1, */
2572                .svhs           = 3,
2573                .has_dig_in     = 1,
2574                .gpiomask       = 0x01fe00,
2575                .muxsel         = MUXSEL(2, 3, 1, 1, 0), /* in 4 is digital */
2576                /* .digital_mode= DIGITAL_MODE_CAMERA, */
2577                .gpiomux        = { 0x00400, 0x10400, 0x04400, 0x80000 },
2578                .gpiomute       = 0x12400,
2579                .no_msp34xx     = 1,
2580                .pll            = PLL_28,
2581                .tuner_type     = TUNER_LG_PAL_FM,
2582                .tuner_addr     = ADDR_UNSET,
2583                .has_remote     = 1,
2584        },
2585                /* ---- card 0x8b ---------------------------------- */
2586        [BTTV_BOARD_PV_M4900] = {
2587                /* Sérgio Fortier <sergiofortier@yahoo.com.br> */
2588                .name           = "Prolink PixelView PlayTV MPEG2 PV-M4900",
2589                .video_inputs   = 3,
2590                /* .audio_inputs= 1, */
2591                .svhs           = 2,
2592                .gpiomask       = 0x3f,
2593                .muxsel         = MUXSEL(2, 3, 1, 1),
2594                .gpiomux        = { 0x21, 0x20, 0x24, 0x2c },
2595                .gpiomute       = 0x29,
2596                .no_msp34xx     = 1,
2597                .pll            = PLL_28,
2598                .tuner_type     = TUNER_YMEC_TVF_5533MF,
2599                .tuner_addr     = ADDR_UNSET,
2600                .has_radio      = 1,
2601                .has_remote     = 1,
2602        },
2603                /* ---- card 0x8c ---------------------------------- */
2604        /* Has four Bt878 chips behind a PCI bridge, each chip has:
2605             one external BNC composite input (mux 2)
2606             three internal composite inputs (unknown muxes)
2607             an 18-bit stereo A/D (CS5331A), which has:
2608               one external stereo unblanced (RCA) audio connection
2609               one (or 3?) internal stereo balanced (XLR) audio connection
2610               input is selected via gpio to a 14052B mux
2611                 (mask=0x300, unbal=0x000, bal=0x100, ??=0x200,0x300)
2612               gain is controlled via an X9221A chip on the I2C bus @0x28
2613               sample rate is controlled via gpio to an MK1413S
2614                 (mask=0x3, 32kHz=0x0, 44.1kHz=0x1, 48kHz=0x2, ??=0x3)
2615             There is neither a tuner nor an svideo input. */
2616        [BTTV_BOARD_OSPREY440]  = {
2617                .name           = "Osprey 440",
2618                .video_inputs   = 4,
2619                /* .audio_inputs= 2, */
2620                .svhs           = NO_SVHS,
2621                .muxsel         = MUXSEL(2, 3, 0, 1), /* 3,0,1 are guesses */
2622                .gpiomask       = 0x303,
2623                .gpiomute       = 0x000, /* int + 32kHz */
2624                .gpiomux        = { 0, 0, 0x000, 0x100},
2625                .pll            = PLL_28,
2626                .tuner_type     = TUNER_ABSENT,
2627                .tuner_addr     = ADDR_UNSET,
2628                .no_msp34xx     = 1,
2629                .no_tda9875     = 1,
2630                .no_tda7432     = 1,
2631        },
2632                /* ---- card 0x8d ---------------------------------- */
2633        [BTTV_BOARD_ASOUND_SKYEYE] = {
2634                .name           = "Asound Skyeye PCTV",
2635                .video_inputs   = 3,
2636                /* .audio_inputs= 1, */
2637                .svhs           = 2,
2638                .gpiomask       = 15,
2639                .muxsel         = MUXSEL(2, 3, 1, 1),
2640                .gpiomux        = { 2, 0, 0, 0 },
2641                .gpiomute       = 1,
2642                .needs_tvaudio  = 1,
2643                .pll            = PLL_28,
2644                .tuner_type     = TUNER_PHILIPS_NTSC,
2645                .tuner_addr     = ADDR_UNSET,
2646        },
2647                /* ---- card 0x8e ---------------------------------- */
2648        [BTTV_BOARD_SABRENT_TVFM] = {
2649                .name           = "Sabrent TV-FM (bttv version)",
2650                .video_inputs   = 3,
2651                /* .audio_inputs= 1, */
2652                .svhs           = 2,
2653                .gpiomask       = 0x108007,
2654                .muxsel         = MUXSEL(2, 3, 1, 1),
2655                .gpiomux        = { 100000, 100002, 100002, 100000 },
2656                .no_msp34xx     = 1,
2657                .no_tda9875     = 1,
2658                .no_tda7432     = 1,
2659                .pll            = PLL_28,
2660                .tuner_type     = TUNER_TNF_5335MF,
2661                .tuner_addr     = ADDR_UNSET,
2662                .has_radio      = 1,
2663        },
2664        /* ---- card 0x8f ---------------------------------- */
2665        [BTTV_BOARD_HAUPPAUGE_IMPACTVCB] = {
2666                .name           = "Hauppauge ImpactVCB (bt878)",
2667                .video_inputs   = 4,
2668                /* .audio_inputs= 0, */
2669                .svhs           = NO_SVHS,
2670                .gpiomask       = 0x0f, /* old: 7 */
2671                .muxsel         = MUXSEL(0, 1, 3, 2), /* Composite 0-3 */
2672                .no_msp34xx     = 1,
2673                .no_tda9875     = 1,
2674                .no_tda7432     = 1,
2675                .tuner_type     = TUNER_ABSENT,
2676                .tuner_addr     = ADDR_UNSET,
2677        },
2678        [BTTV_BOARD_MACHTV_MAGICTV] = {
2679                /* Julian Calaby <julian.calaby@gmail.com>
2680                 * Slightly different from original MachTV definition (0x60)
2681
2682                 * FIXME: RegSpy says gpiomask should be "0x001c800f", but it
2683                 * stuffs up remote chip. Bug is a pin on the jaecs is not set
2684                 * properly (methinks) causing no keyup bits being set */
2685
2686                .name           = "MagicTV", /* rebranded MachTV */
2687                .video_inputs   = 3,
2688                /* .audio_inputs= 1, */
2689                .svhs           = 2,
2690                .gpiomask       = 7,
2691                .muxsel         = MUXSEL(2, 3, 1, 1),
2692                .gpiomux        = { 0, 1, 2, 3 },
2693                .gpiomute       = 4,
2694                .tuner_type     = TUNER_TEMIC_4009FR5_PAL,
2695                .tuner_addr     = ADDR_UNSET,
2696                .pll            = PLL_28,
2697                .has_radio      = 1,
2698                .has_remote     = 1,
2699        },
2700        [BTTV_BOARD_SSAI_SECURITY] = {
2701                .name           = "SSAI Security Video Interface",
2702                .video_inputs   = 4,
2703                /* .audio_inputs= 0, */
2704                .svhs           = NO_SVHS,
2705                .muxsel         = MUXSEL(0, 1, 2, 3),
2706                .tuner_type     = TUNER_ABSENT,
2707                .tuner_addr     = ADDR_UNSET,
2708        },
2709        [BTTV_BOARD_SSAI_ULTRASOUND] = {
2710                .name           = "SSAI Ultrasound Video Interface",
2711                .video_inputs   = 2,
2712                /* .audio_inputs= 0, */
2713                .svhs           = 1,
2714                .muxsel         = MUXSEL(2, 0, 1, 3),
2715                .tuner_type     = TUNER_ABSENT,
2716                .tuner_addr     = ADDR_UNSET,
2717        },
2718        /* ---- card 0x94---------------------------------- */
2719        [BTTV_BOARD_DVICO_FUSIONHDTV_2] = {
2720                .name           = "DViCO FusionHDTV 2",
2721                .tuner_type     = TUNER_PHILIPS_FCV1236D,
2722                .tuner_addr     = ADDR_UNSET,
2723                .video_inputs   = 3,
2724                /* .audio_inputs= 1, */
2725                .svhs           = 2,
2726                .muxsel         = MUXSEL(2, 3, 1),
2727                .gpiomask       = 0x00e00007,
2728                .gpiomux        = { 0x00400005, 0, 0x00000001, 0 },
2729                .gpiomute       = 0x00c00007,
2730                .no_msp34xx     = 1,
2731                .no_tda9875     = 1,
2732                .no_tda7432     = 1,
2733        },
2734        /* ---- card 0x95---------------------------------- */
2735        [BTTV_BOARD_TYPHOON_TVTUNERPCI] = {
2736                .name           = "Typhoon TV-Tuner PCI (50684)",
2737                .video_inputs   = 3,
2738                /* .audio_inputs= 1, */
2739                .svhs           = 2,
2740                .gpiomask       = 0x3014f,
2741                .muxsel         = MUXSEL(2, 3, 1, 1),
2742                .gpiomux        = { 0x20001,0x10001, 0, 0 },
2743                .gpiomute       = 10,
2744                .needs_tvaudio  = 1,
2745                .pll            = PLL_28,
2746                .tuner_type     = TUNER_PHILIPS_PAL_I,
2747                .tuner_addr     = ADDR_UNSET,
2748        },
2749        [BTTV_BOARD_GEOVISION_GV600] = {
2750                /* emhn@usb.ve */
2751                .name           = "Geovision GV-600",
2752                .video_inputs   = 16,
2753                /* .audio_inputs= 0, */
2754                .svhs           = NO_SVHS,
2755                .gpiomask       = 0x0,
2756                .muxsel         = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
2757                .muxsel_hook    = geovision_muxsel,
2758                .gpiomux        = { 0 },
2759                .no_msp34xx     = 1,
2760                .pll            = PLL_28,
2761                .tuner_type     = TUNER_ABSENT,
2762                .tuner_addr     = ADDR_UNSET,
2763        },
2764        [BTTV_BOARD_KOZUMI_KTV_01C] = {
2765                /* Mauro Lacy <mauro@lacy.com.ar>
2766                 * Based on MagicTV and Conceptronic CONTVFMi */
2767
2768                .name           = "Kozumi KTV-01C",
2769                .video_inputs   = 3,
2770                /* .audio_inputs= 1, */
2771                .svhs           = 2,
2772                .gpiomask       = 0x008007,
2773                .muxsel         = MUXSEL(2, 3, 1, 1),
2774                .gpiomux        = { 0, 1, 2, 2 }, /* CONTVFMi */
2775                .gpiomute       = 3, /* CONTVFMi */
2776                .needs_tvaudio  = 0,
2777                .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3, /* TCL MK3 */
2778                .tuner_addr     = ADDR_UNSET,
2779                .pll            = PLL_28,
2780                .has_radio      = 1,
2781                .has_remote     = 1,
2782        },
2783        [BTTV_BOARD_ENLTV_FM_2] = {
2784                /* Encore TV Tuner Pro ENL TV-FM-2
2785                   Mauro Carvalho Chehab <mchehab@infradead.org */
2786                .name           = "Encore ENL TV-FM-2",
2787                .video_inputs   = 3,
2788                /* .audio_inputs= 1, */
2789                .svhs           = 2,
2790                /* bit 6          -> IR disabled
2791                   bit 18/17 = 00 -> mute
2792                               01 -> enable external audio input
2793                               10 -> internal audio input (mono?)
2794                               11 -> internal audio input
2795                 */
2796                .gpiomask       = 0x060040,
2797                .muxsel         = MUXSEL(2, 3, 3),
2798                .gpiomux        = { 0x60000, 0x60000, 0x20000, 0x20000 },
2799                .gpiomute       = 0,
2800                .tuner_type     = TUNER_TCL_MF02GIP_5N,
2801                .tuner_addr     = ADDR_UNSET,
2802                .pll            = PLL_28,
2803                .has_radio      = 1,
2804                .has_remote     = 1,
2805        },
2806                [BTTV_BOARD_VD012] = {
2807                /* D.Heer@Phytec.de */
2808                .name           = "PHYTEC VD-012 (bt878)",
2809                .video_inputs   = 4,
2810                /* .audio_inputs= 0, */
2811                .svhs           = NO_SVHS,
2812                .gpiomask       = 0x00,
2813                .muxsel         = MUXSEL(0, 2, 3, 1),
2814                .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2815                .needs_tvaudio  = 0,
2816                .pll            = PLL_28,
2817                .tuner_type     = TUNER_ABSENT,
2818                .tuner_addr     = ADDR_UNSET,
2819        },
2820                [BTTV_BOARD_VD012_X1] = {
2821                /* D.Heer@Phytec.de */
2822                .name           = "PHYTEC VD-012-X1 (bt878)",
2823                .video_inputs   = 4,
2824                /* .audio_inputs= 0, */
2825                .svhs           = 3,
2826                .gpiomask       = 0x00,
2827                .muxsel         = MUXSEL(2, 3, 1),
2828                .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2829                .needs_tvaudio  = 0,
2830                .pll            = PLL_28,
2831                .tuner_type     = TUNER_ABSENT,
2832                .tuner_addr     = ADDR_UNSET,
2833        },
2834                [BTTV_BOARD_VD012_X2] = {
2835                /* D.Heer@Phytec.de */
2836                .name           = "PHYTEC VD-012-X2 (bt878)",
2837                .video_inputs   = 4,
2838                /* .audio_inputs= 0, */
2839                .svhs           = 3,
2840                .gpiomask       = 0x00,
2841                .muxsel         = MUXSEL(3, 2, 1),
2842                .gpiomux        = { 0, 0, 0, 0 }, /* card has no audio */
2843                .needs_tvaudio  = 0,
2844                .pll            = PLL_28,
2845                .tuner_type     = TUNER_ABSENT,
2846                .tuner_addr     = ADDR_UNSET,
2847        },
2848                [BTTV_BOARD_GEOVISION_GV800S] = {
2849                /* Bruno Christo <bchristo@inf.ufsm.br>
2850                 *
2851                 * GeoVision GV-800(S) has 4 Conexant Fusion 878A:
2852                 *      1 audio input  per BT878A = 4 audio inputs
2853                 *      4 video inputs per BT878A = 16 video inputs
2854                 * This is the first BT878A chip of the GV-800(S). It's the
2855                 * "master" chip and it controls the video inputs through an
2856                 * analog multiplexer (a CD22M3494) via some GPIO pins. The
2857                 * slaves should use card type 0x9e (following this one).
2858                 * There is a EEPROM on the card which is currently not handled.
2859                 * The audio input is not working yet.
2860                 */
2861                .name           = "Geovision GV-800(S) (master)",
2862                .video_inputs   = 4,
2863                /* .audio_inputs= 1, */
2864                .tuner_type     = TUNER_ABSENT,
2865                .tuner_addr     = ADDR_UNSET,
2866                .svhs           = NO_SVHS,
2867                .gpiomask       = 0xf107f,
2868                .no_gpioirq     = 1,
2869                .muxsel         = MUXSEL(2, 2, 2, 2),
2870                .pll            = PLL_28,
2871                .no_msp34xx     = 1,
2872                .no_tda7432     = 1,
2873                .no_tda9875     = 1,
2874                .muxsel_hook    = gv800s_muxsel,
2875        },
2876                [BTTV_BOARD_GEOVISION_GV800S_SL] = {
2877                /* Bruno Christo <bchristo@inf.ufsm.br>
2878                 *
2879                 * GeoVision GV-800(S) has 4 Conexant Fusion 878A:
2880                 *      1 audio input  per BT878A = 4 audio inputs
2881                 *      4 video inputs per BT878A = 16 video inputs
2882                 * The 3 other BT878A chips are "slave" chips of the GV-800(S)
2883                 * and should use this card type.
2884                 * The audio input is not working yet.
2885                 */
2886                .name           = "Geovision GV-800(S) (slave)",
2887                .video_inputs   = 4,
2888                /* .audio_inputs= 1, */
2889                .tuner_type     = TUNER_ABSENT,
2890                .tuner_addr     = ADDR_UNSET,
2891                .svhs           = NO_SVHS,
2892                .gpiomask       = 0x00,
2893                .no_gpioirq     = 1,
2894                .muxsel         = MUXSEL(2, 2, 2, 2),
2895                .pll            = PLL_28,
2896                .no_msp34xx     = 1,
2897                .no_tda7432     = 1,
2898                .no_tda9875     = 1,
2899                .muxsel_hook    = gv800s_muxsel,
2900        },
2901        [BTTV_BOARD_PV183] = {
2902                .name           = "ProVideo PV183", /* 0x9f */
2903                .video_inputs   = 2,
2904                /* .audio_inputs= 0, */
2905                .svhs           = NO_SVHS,
2906                .gpiomask       = 0,
2907                .muxsel         = MUXSEL(2, 3),
2908                .gpiomux        = { 0 },
2909                .needs_tvaudio  = 0,
2910                .no_msp34xx     = 1,
2911                .pll            = PLL_28,
2912                .tuner_type     = TUNER_ABSENT,
2913                .tuner_addr     = ADDR_UNSET,
2914        },
2915};
2916
2917static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
2918
2919/* ----------------------------------------------------------------------- */
2920
2921static unsigned char eeprom_data[256];
2922
2923/*
2924 * identify card
2925 */
2926void __devinit bttv_idcard(struct bttv *btv)
2927{
2928        unsigned int gpiobits;
2929        int i,type;
2930        unsigned short tmp;
2931
2932        /* read PCI subsystem ID */
2933        pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_ID, &tmp);
2934        btv->cardid = tmp << 16;
2935        pci_read_config_word(btv->c.pci, PCI_SUBSYSTEM_VENDOR_ID, &tmp);
2936        btv->cardid |= tmp;
2937
2938        if (0 != btv->cardid && 0xffffffff != btv->cardid) {
2939                /* look for the card */
2940                for (type = -1, i = 0; cards[i].id != 0; i++)
2941                        if (cards[i].id  == btv->cardid)
2942                                type = i;
2943
2944                if (type != -1) {
2945                        /* found it */
2946                        printk(KERN_INFO "bttv%d: detected: %s [card=%d], "
2947                               "PCI subsystem ID is %04x:%04x\n",
2948                               btv->c.nr,cards[type].name,cards[type].cardnr,
2949                               btv->cardid & 0xffff,
2950                               (btv->cardid >> 16) & 0xffff);
2951                        btv->c.type = cards[type].cardnr;
2952                } else {
2953                        /* 404 */
2954                        printk(KERN_INFO "bttv%d: subsystem: %04x:%04x (UNKNOWN)\n",
2955                               btv->c.nr, btv->cardid & 0xffff,
2956                               (btv->cardid >> 16) & 0xffff);
2957                        printk(KERN_DEBUG "please mail id, board name and "
2958                               "the correct card= insmod option to linux-media@vger.kernel.org\n");
2959                }
2960        }
2961
2962        /* let the user override the autodetected type */
2963        if (card[btv->c.nr] < bttv_num_tvcards)
2964                btv->c.type=card[btv->c.nr];
2965
2966        /* print which card config we are using */
2967        printk(KERN_INFO "bttv%d: using: %s [card=%d,%s]\n",btv->c.nr,
2968               bttv_tvcards[btv->c.type].name, btv->c.type,
2969               card[btv->c.nr] < bttv_num_tvcards
2970               ? "insmod option" : "autodetected");
2971
2972        /* overwrite gpio stuff ?? */
2973        if (UNSET == audioall && UNSET == audiomux[0])
2974                return;
2975
2976        if (UNSET != audiomux[0]) {
2977                gpiobits = 0;
2978                for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
2979                        bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];
2980                        gpiobits |= audiomux[i];
2981                }
2982        } else {
2983                gpiobits = audioall;
2984                for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
2985                        bttv_tvcards[btv->c.type].gpiomux[i] = audioall;
2986                }
2987        }
2988        bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
2989        printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=",
2990               btv->c.nr,bttv_tvcards[btv->c.type].gpiomask);
2991        for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
2992                printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]);
2993        }
2994        printk("\n");
2995}
2996
2997/*
2998 * (most) board specific initialisations goes here
2999 */
3000
3001/* Some Modular Technology cards have an eeprom, but no subsystem ID */
3002static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
3003{
3004        int type = -1;
3005
3006        if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
3007                type = BTTV_BOARD_MODTEC_205;
3008        else if (0 == strncmp(eeprom_data+20,"Picolo",7))
3009                type = BTTV_BOARD_EURESYS_PICOLO;
3010        else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
3011                type = BTTV_BOARD_HAUPPAUGE; /* old bt848 */
3012
3013        if (-1 != type) {
3014                btv->c.type = type;
3015                printk("bttv%d: detected by eeprom: %s [card=%d]\n",
3016                       btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
3017        }
3018}
3019
3020static void flyvideo_gpio(struct bttv *btv)
3021{
3022        int gpio, has_remote, has_radio, is_capture_only;
3023        int is_lr90, has_tda9820_tda9821;
3024        int tuner_type = UNSET, ttype;
3025
3026        gpio_inout(0xffffff, 0);
3027        udelay(8);  /* without this we would see the 0x1800 mask */
3028        gpio = gpio_read();
3029        /* FIXME: must restore OUR_EN ??? */
3030
3031        /* all cards provide GPIO info, some have an additional eeprom
3032         * LR50: GPIO coding can be found lower right CP1 .. CP9
3033         *       CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
3034         *       GPIO14-12: n.c.
3035         * LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878)
3036
3037         * lowest 3 bytes are remote control codes (no handshake needed)
3038         * xxxFFF: No remote control chip soldered
3039         * xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered
3040         * Note: Some bits are Audio_Mask !
3041         */
3042        ttype = (gpio & 0x0f0000) >> 16;
3043        switch (ttype) {
3044        case 0x0:
3045                tuner_type = 2;  /* NTSC, e.g. TPI8NSR11P */
3046                break;
3047        case 0x2:
3048                tuner_type = 39; /* LG NTSC (newer TAPC series) TAPC-H701P */
3049                break;
3050        case 0x4:
3051                tuner_type = 5;  /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */
3052                break;
3053        case 0x6:
3054                tuner_type = 37; /* LG PAL (newer TAPC series) TAPC-G702P */
3055                break;
3056        case 0xC:
3057                tuner_type = 3;  /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */
3058                break;
3059        default:
3060                printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr);
3061                break;
3062        }
3063
3064        has_remote          =   gpio & 0x800000;
3065        has_radio           =   gpio & 0x400000;
3066        /*   unknown                   0x200000;
3067         *   unknown2                  0x100000; */
3068        is_capture_only     = !(gpio & 0x008000); /* GPIO15 */
3069        has_tda9820_tda9821 = !(gpio & 0x004000);
3070        is_lr90             = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */
3071        /*
3072         * gpio & 0x001000    output bit for audio routing */
3073
3074        if (is_capture_only)
3075                tuner_type = TUNER_ABSENT; /* No tuner present */
3076
3077        printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n",
3078                btv->c.nr, has_radio ? "yes" : "no ",
3079                has_remote ? "yes" : "no ", tuner_type, gpio);
3080        printk(KERN_INFO "bttv%d: FlyVideo  LR90=%s tda9821/tda9820=%s capture_only=%s\n",
3081                btv->c.nr, is_lr90 ? "yes" : "no ",
3082                has_tda9820_tda9821 ? "yes" : "no ",
3083                is_capture_only ? "yes" : "no ");
3084
3085        if (tuner_type != UNSET) /* only set if known tuner autodetected, else let insmod option through */
3086                btv->tuner_type = tuner_type;
3087        btv->has_radio = has_radio;
3088
3089        /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
3090         * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
3091         * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
3092        if (has_tda9820_tda9821)
3093                btv->audio_mode_gpio = lt9415_audio;
3094        /* todo: if(has_tda9874) btv->audio_mode_gpio = fv2000s_audio; */
3095}
3096
3097static int miro_tunermap[] = { 0,6,2,3,   4,5,6,0,  3,0,4,5,  5,2,16,1,
3098                               14,2,17,1, 4,1,4,3,  1,2,16,1, 4,4,4,4 };
3099static int miro_fmtuner[]  = { 0,0,0,0,   0,0,0,0,  0,0,0,0,  0,0,0,1,
3100                               1,1,1,1,   1,1,1,0,  0,0,0,0,  0,1,0,0 };
3101
3102static void miro_pinnacle_gpio(struct bttv *btv)
3103{
3104        int id,msp,gpio;
3105        char *info;
3106
3107        gpio_inout(0xffffff, 0);
3108        gpio = gpio_read();
3109        id   = ((gpio>>10) & 63) -1;
3110        msp  = bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx");
3111        if (id < 32) {
3112                btv->tuner_type = miro_tunermap[id];
3113                if (0 == (gpio & 0x20)) {
3114                        btv->has_radio = 1;
3115                        if (!miro_fmtuner[id]) {
3116                                btv->has_matchbox = 1;
3117                                btv->mbox_we    = (1<<6);
3118                                btv->mbox_most  = (1<<7);
3119                                btv->mbox_clk   = (1<<8);
3120                                btv->mbox_data  = (1<<9);
3121                                btv->mbox_mask  = (1<<6)|(1<<7)|(1<<8)|(1<<9);
3122                        }
3123                } else {
3124                        btv->has_radio = 0;
3125                }
3126                if (-1 != msp) {
3127                        if (btv->c.type == BTTV_BOARD_MIRO)
3128                                btv->c.type = BTTV_BOARD_MIROPRO;
3129                        if (btv->c.type == BTTV_BOARD_PINNACLE)
3130                                btv->c.type = BTTV_BOARD_PINNACLEPRO;
3131                }
3132                printk(KERN_INFO
3133                       "bttv%d: miro: id=%d tuner=%d radio=%s stereo=%s\n",
3134                       btv->c.nr, id+1, btv->tuner_type,
3135                       !btv->has_radio ? "no" :
3136                       (btv->has_matchbox ? "matchbox" : "fmtuner"),
3137                       (-1 == msp) ? "no" : "yes");
3138        } else {
3139                /* new cards with microtune tuner */
3140                id = 63 - id;
3141                btv->has_radio = 0;
3142                switch (id) {
3143                case 1:
3144                        info = "PAL / mono";
3145                        btv->tda9887_conf = TDA9887_INTERCARRIER;
3146                        break;
3147                case 2:
3148                        info = "PAL+SECAM / stereo";
3149                        btv->has_radio = 1;
3150                        btv->tda9887_conf = TDA9887_QSS;
3151                        break;
3152                case 3:
3153                        info = "NTSC / stereo";
3154                        btv->has_radio = 1;
3155                        btv->tda9887_conf = TDA9887_QSS;
3156                        break;
3157                case 4:
3158                        info = "PAL+SECAM / mono";
3159                        btv->tda9887_conf = TDA9887_QSS;
3160                        break;
3161                case 5:
3162                        info = "NTSC / mono";
3163                        btv->tda9887_conf = TDA9887_INTERCARRIER;
3164                        break;
3165                case 6:
3166                        info = "NTSC / stereo";
3167                        btv->tda9887_conf = TDA9887_INTERCARRIER;
3168                        break;
3169                case 7:
3170                        info = "PAL / stereo";
3171                        btv->tda9887_conf = TDA9887_INTERCARRIER;
3172                        break;
3173                default:
3174                        info = "oops: unknown card";
3175                        break;
3176                }
3177                if (-1 != msp)
3178                        btv->c.type = BTTV_BOARD_PINNACLEPRO;
3179                printk(KERN_INFO
3180                       "bttv%d: pinnacle/mt: id=%d info=\"%s\" radio=%s\n",
3181                       btv->c.nr, id, info, btv->has_radio ? "yes" : "no");
3182                btv->tuner_type = TUNER_MT2032;
3183        }
3184}
3185
3186/* GPIO21   L: Buffer aktiv, H: Buffer inaktiv */
3187#define LM1882_SYNC_DRIVE     0x200000L
3188
3189static void init_ids_eagle(struct bttv *btv)
3190{
3191        gpio_inout(0xffffff,0xFFFF37);
3192        gpio_write(0x200020);
3193
3194        /* flash strobe inverter ?! */
3195        gpio_write(0x200024);
3196
3197        /* switch sync drive off */
3198        gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
3199
3200        /* set BT848 muxel to 2 */
3201        btaor((2)<<5, ~(2<<5), BT848_IFORM);
3202}
3203
3204/* Muxsel helper for the IDS Eagle.
3205 * the eagles does not use the standard muxsel-bits but
3206 * has its own multiplexer */
3207static void eagle_muxsel(struct bttv *btv, unsigned int input)
3208{
3209        gpio_bits(3, input & 3);
3210
3211        /* composite */
3212        /* set chroma ADC to sleep */
3213        btor(BT848_ADC_C_SLEEP, BT848_ADC);
3214        /* set to composite video */
3215        btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
3216        btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
3217
3218        /* switch sync drive off */
3219        gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
3220}
3221
3222static void gvc1100_muxsel(struct bttv *btv, unsigned int input)
3223{
3224        static const int masks[] = {0x30, 0x01, 0x12, 0x23};
3225        gpio_write(masks[input%4]);
3226}
3227
3228/* LMLBT4x initialization - to allow access to GPIO bits for sensors input and
3229   alarms output
3230
3231   GPIObit    | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
3232   assignment | TI | O3|INx| O2| O1|IN4|IN3|IN2|IN1|   |   |
3233
3234   IN - sensor inputs, INx - sensor inputs and TI XORed together
3235   O1,O2,O3 - alarm outputs (relays)
3236
3237   OUT ENABLE   1    1   0  . 1  1   0   0 . 0   0   0    0   = 0x6C0
3238
3239*/
3240
3241static void init_lmlbt4x(struct bttv *btv)
3242{
3243        printk(KERN_DEBUG "LMLBT4x init\n");
3244        btwrite(0x000000, BT848_GPIO_REG_INP);
3245        gpio_inout(0xffffff, 0x0006C0);
3246        gpio_write(0x000000);
3247}
3248
3249static void sigmaSQ_muxsel(struct bttv *btv, unsigned int input)
3250{
3251        unsigned int inmux = input % 8;
3252        gpio_inout( 0xf, 0xf );
3253        gpio_bits( 0xf, inmux );
3254}
3255
3256static void sigmaSLC_muxsel(struct bttv *btv, unsigned int input)
3257{
3258        unsigned int inmux = input % 4;
3259        gpio_inout( 3<<9, 3<<9 );
3260        gpio_bits( 3<<9, inmux<<9 );
3261}
3262
3263static void geovision_muxsel(struct bttv *btv, unsigned int input)
3264{
3265        unsigned int inmux = input % 16;
3266        gpio_inout(0xf, 0xf);
3267        gpio_bits(0xf, inmux);
3268}
3269
3270/* ----------------------------------------------------------------------- */
3271
3272static void bttv_reset_audio(struct bttv *btv)
3273{
3274        /*
3275         * BT878A has a audio-reset register.
3276         * 1. This register is an audio reset function but it is in
3277         *    function-0 (video capture) address space.
3278         * 2. It is enough to do this once per power-up of the card.
3279         * 3. There is a typo in the Conexant doc -- it is not at
3280         *    0x5B, but at 0x058. (B is an odd-number, obviously a typo!).
3281         * --//Shrikumar 030609
3282         */
3283        if (btv->id != 878)
3284                return;
3285
3286        if (bttv_debug)
3287                printk("bttv%d: BT878A ARESET\n",btv->c.nr);
3288        btwrite((1<<7), 0x058);
3289        udelay(10);
3290        btwrite(     0, 0x058);
3291}
3292
3293/* initialization part one -- before registering i2c bus */
3294void __devinit bttv_init_card1(struct bttv *btv)
3295{
3296        switch (btv->c.type) {
3297        case BTTV_BOARD_HAUPPAUGE:
3298        case BTTV_BOARD_HAUPPAUGE878:
3299                boot_msp34xx(btv,5);
3300                break;
3301        case BTTV_BOARD_VOODOOTV_200:
3302        case BTTV_BOARD_VOODOOTV_FM:
3303                boot_msp34xx(btv,20);
3304                break;
3305        case BTTV_BOARD_AVERMEDIA98:
3306                boot_msp34xx(btv,11);
3307                break;
3308        case BTTV_BOARD_HAUPPAUGEPVR:
3309                pvr_boot(btv);
3310                break;
3311        case BTTV_BOARD_TWINHAN_DST:
3312        case BTTV_BOARD_AVDVBT_771:
3313        case BTTV_BOARD_PINNACLESAT:
3314                btv->use_i2c_hw = 1;
3315                break;
3316        case BTTV_BOARD_ADLINK_RTV24:
3317                init_RTV24( btv );
3318                break;
3319
3320        }
3321        if (!bttv_tvcards[btv->c.type].has_dvb)
3322                bttv_reset_audio(btv);
3323}
3324
3325/* initialization part two -- after registering i2c bus */
3326void __devinit bttv_init_card2(struct bttv *btv)
3327{
3328        btv->tuner_type = UNSET;
3329
3330        if (BTTV_BOARD_UNKNOWN == btv->c.type) {
3331                bttv_readee(btv,eeprom_data,0xa0);
3332                identify_by_eeprom(btv,eeprom_data);
3333        }
3334
3335        switch (btv->c.type) {
3336        case BTTV_BOARD_MIRO:
3337        case BTTV_BOARD_MIROPRO:
3338        case BTTV_BOARD_PINNACLE:
3339        case BTTV_BOARD_PINNACLEPRO:
3340                /* miro/pinnacle */
3341                miro_pinnacle_gpio(btv);
3342                break;
3343        case BTTV_BOARD_FLYVIDEO_98:
3344        case BTTV_BOARD_MAXI:
3345        case BTTV_BOARD_LIFE_FLYKIT:
3346        case BTTV_BOARD_FLYVIDEO:
3347        case BTTV_BOARD_TYPHOON_TVIEW:
3348        case BTTV_BOARD_CHRONOS_VS2:
3349        case BTTV_BOARD_FLYVIDEO_98FM:
3350        case BTTV_BOARD_FLYVIDEO2000:
3351        case BTTV_BOARD_FLYVIDEO98EZ:
3352        case BTTV_BOARD_CONFERENCETV:
3353        case BTTV_BOARD_LIFETEC_9415:
3354                flyvideo_gpio(btv);
3355                break;
3356        case BTTV_BOARD_HAUPPAUGE:
3357        case BTTV_BOARD_HAUPPAUGE878:
3358        case BTTV_BOARD_HAUPPAUGEPVR:
3359                /* pick up some config infos from the eeprom */
3360                bttv_readee(btv,eeprom_data,0xa0);
3361                hauppauge_eeprom(btv);
3362                break;
3363        case BTTV_BOARD_AVERMEDIA98:
3364        case BTTV_BOARD_AVPHONE98:
3365                bttv_readee(btv,eeprom_data,0xa0);
3366                avermedia_eeprom(btv);
3367                break;
3368        case BTTV_BOARD_PXC200:
3369                init_PXC200(btv);
3370                break;
3371        case BTTV_BOARD_PICOLO_TETRA_CHIP:
3372                picolo_tetra_init(btv);
3373                break;
3374        case BTTV_BOARD_VHX:
3375                btv->has_radio    = 1;
3376                btv->has_matchbox = 1;
3377                btv->mbox_we      = 0x20;
3378                btv->mbox_most    = 0;
3379                btv->mbox_clk     = 0x08;
3380                btv->mbox_data    = 0x10;
3381                btv->mbox_mask    = 0x38;
3382                break;
3383        case BTTV_BOARD_VOBIS_BOOSTAR:
3384        case BTTV_BOARD_TERRATV:
3385                terratec_active_radio_upgrade(btv);
3386                break;
3387        case BTTV_BOARD_MAGICTVIEW061:
3388                if (btv->cardid == 0x3002144f) {
3389                        btv->has_radio=1;
3390                        printk("bttv%d: radio detected by subsystem id (CPH05x)\n",btv->c.nr);
3391                }
3392                break;
3393        case BTTV_BOARD_STB2:
3394                if (btv->cardid == 0x3060121a) {
3395                        /* Fix up entry for 3DFX VoodooTV 100,
3396                           which is an OEM STB card variant. */
3397                        btv->has_radio=0;
3398                        btv->tuner_type=TUNER_TEMIC_NTSC;
3399                }
3400                break;
3401        case BTTV_BOARD_OSPREY1x0:
3402        case BTTV_BOARD_OSPREY1x0_848:
3403        case BTTV_BOARD_OSPREY101_848:
3404        case BTTV_BOARD_OSPREY1x1:
3405        case BTTV_BOARD_OSPREY1x1_SVID:
3406        case BTTV_BOARD_OSPREY2xx:
3407        case BTTV_BOARD_OSPREY2x0_SVID:
3408        case BTTV_BOARD_OSPREY2x0:
3409        case BTTV_BOARD_OSPREY440:
3410        case BTTV_BOARD_OSPREY500:
3411        case BTTV_BOARD_OSPREY540:
3412        case BTTV_BOARD_OSPREY2000:
3413                bttv_readee(btv,eeprom_data,0xa0);
3414                osprey_eeprom(btv, eeprom_data);
3415                break;
3416        case BTTV_BOARD_IDS_EAGLE:
3417                init_ids_eagle(btv);
3418                break;
3419        case BTTV_BOARD_MODTEC_205:
3420                bttv_readee(btv,eeprom_data,0xa0);
3421                modtec_eeprom(btv);
3422                break;
3423        case BTTV_BOARD_LMLBT4:
3424                init_lmlbt4x(btv);
3425                break;
3426        case BTTV_BOARD_TIBET_CS16:
3427                tibetCS16_init(btv);
3428                break;
3429        case BTTV_BOARD_KODICOM_4400R:
3430                kodicom4400r_init(btv);
3431                break;
3432        case BTTV_BOARD_GEOVISION_GV800S:
3433                gv800s_init(btv);
3434                break;
3435        }
3436
3437        /* pll configuration */
3438        if (!(btv->id==848 && btv->revision==0x11)) {
3439                /* defaults from card list */
3440                if (PLL_28 == bttv_tvcards[btv->c.type].pll) {
3441                        btv->pll.pll_ifreq=28636363;
3442                        btv->pll.pll_crystal=BT848_IFORM_XT0;
3443                }
3444                if (PLL_35 == bttv_tvcards[btv->c.type].pll) {
3445                        btv->pll.pll_ifreq=35468950;
3446                        btv->pll.pll_crystal=BT848_IFORM_XT1;
3447                }
3448                /* insmod options can override */
3449                switch (pll[btv->c.nr]) {
3450                case 0: /* none */
3451                        btv->pll.pll_crystal = 0;
3452                        btv->pll.pll_ifreq   = 0;
3453                        btv->pll.pll_ofreq   = 0;
3454                        break;
3455                case 1: /* 28 MHz */
3456                case 28:
3457                        btv->pll.pll_ifreq   = 28636363;
3458                        btv->pll.pll_ofreq   = 0;
3459                        btv->pll.pll_crystal = BT848_IFORM_XT0;
3460                        break;
3461                case 2: /* 35 MHz */
3462                case 35:
3463                        btv->pll.pll_ifreq   = 35468950;
3464                        btv->pll.pll_ofreq   = 0;
3465                        btv->pll.pll_crystal = BT848_IFORM_XT1;
3466                        break;
3467                }
3468        }
3469        btv->pll.pll_current = -1;
3470
3471        /* tuner configuration (from card list / autodetect / insmod option) */
3472        if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
3473                if (UNSET == btv->tuner_type)
3474                        btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
3475        if (UNSET != tuner[btv->c.nr])
3476                btv->tuner_type = tuner[btv->c.nr];
3477
3478        if (btv->tuner_type == TUNER_ABSENT)
3479                printk(KERN_INFO "bttv%d: tuner absent\n", btv->c.nr);
3480        else if(btv->tuner_type == UNSET)
3481                printk(KERN_WARNING "bttv%d: tuner type unset\n", btv->c.nr);
3482        else
3483                printk(KERN_INFO "bttv%d: tuner type=%d\n", btv->c.nr,
3484                       btv->tuner_type);
3485
3486        if (autoload != UNSET) {
3487                printk(KERN_WARNING "bttv%d: the autoload option is obsolete.\n", btv->c.nr);
3488                printk(KERN_WARNING "bttv%d: use option msp3400, tda7432 or tvaudio to\n", btv->c.nr);
3489                printk(KERN_WARNING "bttv%d: override which audio module should be used.\n", btv->c.nr);
3490        }
3491
3492        if (UNSET == btv->tuner_type)
3493                btv->tuner_type = TUNER_ABSENT;
3494
3495        btv->dig = bttv_tvcards[btv->c.type].has_dig_in ?
3496                   bttv_tvcards[btv->c.type].video_inputs - 1 : UNSET;
3497        btv->svhs = bttv_tvcards[btv->c.type].svhs == NO_SVHS ?
3498                    UNSET : bttv_tvcards[btv->c.type].svhs;
3499        if (svhs[btv->c.nr] != UNSET)
3500                btv->svhs = svhs[btv->c.nr];
3501        if (remote[btv->c.nr] != UNSET)
3502                btv->has_remote = remote[btv->c.nr];
3503
3504        if (bttv_tvcards[btv->c.type].has_radio)
3505                btv->has_radio = 1;
3506        if (bttv_tvcards[btv->c.type].has_remote)
3507                btv->has_remote = 1;
3508        if (!bttv_tvcards[btv->c.type].no_gpioirq)
3509                btv->gpioirq = 1;
3510        if (bttv_tvcards[btv->c.type].volume_gpio)
3511                btv->volume_gpio = bttv_tvcards[btv->c.type].volume_gpio;
3512        if (bttv_tvcards[btv->c.type].audio_mode_gpio)
3513                btv->audio_mode_gpio = bttv_tvcards[btv->c.type].audio_mode_gpio;
3514
3515        if (btv->tuner_type == TUNER_ABSENT)
3516                return;  /* no tuner or related drivers to load */
3517
3518        if (btv->has_saa6588 || saa6588[btv->c.nr]) {
3519                /* Probe for RDS receiver chip */
3520                static const unsigned short addrs[] = {
3521                        0x20 >> 1,
3522                        0x22 >> 1,
3523                        I2C_CLIENT_END
3524                };
3525                struct v4l2_subdev *sd;
3526
3527                sd = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3528                        &btv->c.i2c_adap, "saa6588", "saa6588", 0, addrs);
3529                btv->has_saa6588 = (sd != NULL);
3530        }
3531
3532        /* try to detect audio/fader chips */
3533
3534        /* First check if the user specified the audio chip via a module
3535           option. */
3536
3537        switch (audiodev[btv->c.nr]) {
3538        case -1:
3539                return; /* do not load any audio module */
3540
3541        case 0: /* autodetect */
3542                break;
3543
3544        case 1: {
3545                /* The user specified that we should probe for msp3400 */
3546                static const unsigned short addrs[] = {
3547                        I2C_ADDR_MSP3400 >> 1,
3548                        I2C_ADDR_MSP3400_ALT >> 1,
3549                        I2C_CLIENT_END
3550                };
3551
3552                btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3553                        &btv->c.i2c_adap, "msp3400", "msp3400", 0, addrs);
3554                if (btv->sd_msp34xx)
3555                        return;
3556                goto no_audio;
3557        }
3558
3559        case 2: {
3560                /* The user specified that we should probe for tda7432 */
3561                static const unsigned short addrs[] = {
3562                        I2C_ADDR_TDA7432 >> 1,
3563                        I2C_CLIENT_END
3564                };
3565
3566                if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3567                                &btv->c.i2c_adap, "tda7432", "tda7432", 0, addrs))
3568                        return;
3569                goto no_audio;
3570        }
3571
3572        case 3: {
3573                /* The user specified that we should probe for tvaudio */
3574                btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3575                        &btv->c.i2c_adap, "tvaudio", "tvaudio", 0, tvaudio_addrs());
3576                if (btv->sd_tvaudio)
3577                        return;
3578                goto no_audio;
3579        }
3580
3581        default:
3582                printk(KERN_WARNING "bttv%d: unknown audiodev value!\n",
3583                        btv->c.nr);
3584                return;
3585        }
3586
3587        /* There were no overrides, so now we try to discover this through the
3588           card definition */
3589
3590        /* probe for msp3400 first: this driver can detect whether or not
3591           it really is a msp3400, so it will return NULL when the device
3592           found is really something else (e.g. a tea6300). */
3593        if (!bttv_tvcards[btv->c.type].no_msp34xx) {
3594                btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3595                        &btv->c.i2c_adap, "msp3400", "msp3400",
3596                        0, I2C_ADDRS(I2C_ADDR_MSP3400 >> 1));
3597        } else if (bttv_tvcards[btv->c.type].msp34xx_alt) {
3598                btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3599                        &btv->c.i2c_adap, "msp3400", "msp3400",
3600                        0, I2C_ADDRS(I2C_ADDR_MSP3400_ALT >> 1));
3601        }
3602
3603        /* If we found a msp34xx, then we're done. */
3604        if (btv->sd_msp34xx)
3605                return;
3606
3607        /* it might also be a tda7432. */
3608        if (!bttv_tvcards[btv->c.type].no_tda7432) {
3609                static const unsigned short addrs[] = {
3610                        I2C_ADDR_TDA7432 >> 1,
3611                        I2C_CLIENT_END
3612                };
3613
3614                if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3615                                &btv->c.i2c_adap, "tda7432", "tda7432", 0, addrs))
3616                        return;
3617        }
3618
3619        /* Now see if we can find one of the tvaudio devices. */
3620        btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3621                &btv->c.i2c_adap, "tvaudio", "tvaudio", 0, tvaudio_addrs());
3622        if (btv->sd_tvaudio)
3623                return;
3624
3625no_audio:
3626        printk(KERN_WARNING "bttv%d: audio absent, no audio device found!\n",
3627                        btv->c.nr);
3628}
3629
3630
3631/* initialize the tuner */
3632void __devinit bttv_init_tuner(struct bttv *btv)
3633{
3634        int addr = ADDR_UNSET;
3635
3636        if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
3637                addr = bttv_tvcards[btv->c.type].tuner_addr;
3638
3639        if (btv->tuner_type != TUNER_ABSENT) {
3640                struct tuner_setup tun_setup;
3641
3642                /* Load tuner module before issuing tuner config call! */
3643                if (bttv_tvcards[btv->c.type].has_radio)
3644                        v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3645                                &btv->c.i2c_adap, "tuner", "tuner",
3646                                0, v4l2_i2c_tuner_addrs(ADDRS_RADIO));
3647                v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3648                                &btv->c.i2c_adap, "tuner", "tuner",
3649                                0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
3650                v4l2_i2c_new_subdev(&btv->c.v4l2_dev,
3651                                &btv->c.i2c_adap, "tuner", "tuner",
3652                                0, v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD));
3653
3654                tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
3655                tun_setup.type = btv->tuner_type;
3656                tun_setup.addr = addr;
3657
3658                if (bttv_tvcards[btv->c.type].has_radio)
3659                        tun_setup.mode_mask |= T_RADIO;
3660
3661                bttv_call_all(btv, tuner, s_type_addr, &tun_setup);
3662        }
3663
3664        if (btv->tda9887_conf) {
3665                struct v4l2_priv_tun_config tda9887_cfg;
3666
3667                tda9887_cfg.tuner = TUNER_TDA9887;
3668                tda9887_cfg.priv = &btv->tda9887_conf;
3669
3670                bttv_call_all(btv, tuner, s_config, &tda9887_cfg);
3671        }
3672}
3673
3674/* ----------------------------------------------------------------------- */
3675
3676static void modtec_eeprom(struct bttv *btv)
3677{
3678        if( strncmp(&(eeprom_data[0x1e]),"Temic 4066 FY5",14) ==0) {
3679                btv->tuner_type=TUNER_TEMIC_4066FY5_PAL_I;
3680                printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3681                       btv->c.nr,&eeprom_data[0x1e]);
3682        } else if (strncmp(&(eeprom_data[0x1e]),"Alps TSBB5",10) ==0) {
3683                btv->tuner_type=TUNER_ALPS_TSBB5_PAL_I;
3684                printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3685                       btv->c.nr,&eeprom_data[0x1e]);
3686        } else if (strncmp(&(eeprom_data[0x1e]),"Philips FM1246",14) ==0) {
3687                btv->tuner_type=TUNER_PHILIPS_NTSC;
3688                printk("bttv%d: Modtec: Tuner autodetected by eeprom: %s\n",
3689                       btv->c.nr,&eeprom_data[0x1e]);
3690        } else {
3691                printk("bttv%d: Modtec: Unknown TunerString: %s\n",
3692                       btv->c.nr,&eeprom_data[0x1e]);
3693        }
3694}
3695
3696static void __devinit hauppauge_eeprom(struct bttv *btv)
3697{
3698        struct tveeprom tv;
3699
3700        tveeprom_hauppauge_analog(&btv->i2c_client, &tv, eeprom_data);
3701        btv->tuner_type = tv.tuner_type;
3702        btv->has_radio  = tv.has_radio;
3703
3704        printk("bttv%d: Hauppauge eeprom indicates model#%d\n",
3705                btv->c.nr, tv.model);
3706
3707        /*
3708         * Some of the 878 boards have duplicate PCI IDs. Switch the board
3709         * type based on model #.
3710         */
3711        if(tv.model == 64900) {
3712                printk("bttv%d: Switching board type from %s to %s\n",
3713                        btv->c.nr,
3714                        bttv_tvcards[btv->c.type].name,
3715                        bttv_tvcards[BTTV_BOARD_HAUPPAUGE_IMPACTVCB].name);
3716                btv->c.type = BTTV_BOARD_HAUPPAUGE_IMPACTVCB;
3717        }
3718}
3719
3720static int terratec_active_radio_upgrade(struct bttv *btv)
3721{
3722        int freq;
3723
3724        btv->has_radio    = 1;
3725        btv->has_matchbox = 1;
3726        btv->mbox_we      = 0x10;
3727        btv->mbox_most    = 0x20;
3728        btv->mbox_clk     = 0x08;
3729        btv->mbox_data    = 0x04;
3730        btv->mbox_mask    = 0x3c;
3731
3732        btv->mbox_iow     = 1 <<  8;
3733        btv->mbox_ior     = 1 <<  9;
3734        btv->mbox_csel    = 1 << 10;
3735
3736        freq=88000/62.5;
3737        tea5757_write(btv, 5 * freq + 0x358); /* write 0x1ed8 */
3738        if (0x1ed8 == tea5757_read(btv)) {
3739                printk("bttv%d: Terratec Active Radio Upgrade found.\n",
3740                       btv->c.nr);
3741                btv->has_radio    = 1;
3742                btv->has_saa6588  = 1;
3743                btv->has_matchbox = 1;
3744        } else {
3745                btv->has_radio    = 0;
3746                btv->has_matchbox = 0;
3747        }
3748        return 0;
3749}
3750
3751
3752/* ----------------------------------------------------------------------- */
3753
3754/*
3755 * minimal bootstrap for the WinTV/PVR -- upload altera firmware.
3756 *
3757 * The hcwamc.rbf firmware file is on the Hauppauge driver CD.  Have
3758 * a look at Pvr/pvr45xxx.EXE (self-extracting zip archive, can be
3759 * unpacked with unzip).
3760 */
3761#define PVR_GPIO_DELAY          10
3762
3763#define BTTV_ALT_DATA           0x000001
3764#define BTTV_ALT_DCLK           0x100000
3765#define BTTV_ALT_NCONFIG        0x800000
3766
3767static int __devinit pvr_altera_load(struct bttv *btv, const u8 *micro,
3768                                     u32 microlen)
3769{
3770        u32 n;
3771        u8 bits;
3772        int i;
3773
3774        gpio_inout(0xffffff,BTTV_ALT_DATA|BTTV_ALT_DCLK|BTTV_ALT_NCONFIG);
3775        gpio_write(0);
3776        udelay(PVR_GPIO_DELAY);
3777
3778        gpio_write(BTTV_ALT_NCONFIG);
3779        udelay(PVR_GPIO_DELAY);
3780
3781        for (n = 0; n < microlen; n++) {
3782                bits = micro[n];
3783                for (i = 0 ; i < 8 ; i++) {
3784                        gpio_bits(BTTV_ALT_DCLK,0);
3785                        if (bits & 0x01)
3786                                gpio_bits(BTTV_ALT_DATA,BTTV_ALT_DATA);
3787                        else
3788                                gpio_bits(BTTV_ALT_DATA,0);
3789                        gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
3790                        bits >>= 1;
3791                }
3792        }
3793        gpio_bits(BTTV_ALT_DCLK,0);
3794        udelay(PVR_GPIO_DELAY);
3795
3796        /* begin Altera init loop (Not necessary,but doesn't hurt) */
3797        for (i = 0 ; i < 30 ; i++) {
3798                gpio_bits(BTTV_ALT_DCLK,0);
3799                gpio_bits(BTTV_ALT_DCLK,BTTV_ALT_DCLK);
3800        }
3801        gpio_bits(BTTV_ALT_DCLK,0);
3802        return 0;
3803}
3804
3805static int __devinit pvr_boot(struct bttv *btv)
3806{
3807        const struct firmware *fw_entry;
3808        int rc;
3809
3810        rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
3811        if (rc != 0) {
3812                printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
3813                       btv->c.nr);
3814                return rc;
3815        }
3816        rc = pvr_altera_load(btv, fw_entry->data, fw_entry->size);
3817        printk(KERN_INFO "bttv%d: altera firmware upload %s\n",
3818               btv->c.nr, (rc < 0) ? "failed" : "ok");
3819        release_firmware(fw_entry);
3820        return rc;
3821}
3822
3823/* ----------------------------------------------------------------------- */
3824/* some osprey specific stuff                                              */
3825
3826static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
3827{
3828        int i;
3829        u32 serial = 0;
3830        int cardid = -1;
3831
3832        /* This code will nevery actually get called in this case.... */
3833        if (btv->c.type == BTTV_BOARD_UNKNOWN) {
3834                /* this might be an antique... check for MMAC label in eeprom */
3835                if (!strncmp(ee, "MMAC", 4)) {
3836                        u8 checksum = 0;
3837                        for (i = 0; i < 21; i++)
3838                                checksum += ee[i];
3839                        if (checksum != ee[21])
3840                                return;
3841                        cardid = BTTV_BOARD_OSPREY1x0_848;
3842                        for (i = 12; i < 21; i++)
3843                                serial *= 10, serial += ee[i] - '0';
3844                }
3845        } else {
3846                unsigned short type;
3847
3848                for (i = 4*16; i < 8*16; i += 16) {
3849                        u16 checksum = ip_compute_csum(ee + i, 16);
3850
3851                        if ((checksum&0xff) + (checksum>>8) == 0xff)
3852                                break;
3853                }
3854                if (i >= 8*16)
3855                        return;
3856                ee += i;
3857
3858                /* found a valid descriptor */
3859                type = get_unaligned_be16((__be16 *)(ee+4));
3860
3861                switch(type) {
3862                /* 848 based */
3863                case 0x0004:
3864                        cardid = BTTV_BOARD_OSPREY1x0_848;
3865                        break;
3866                case 0x0005:
3867                        cardid = BTTV_BOARD_OSPREY101_848;
3868                        break;
3869
3870                /* 878 based */
3871                case 0x0012:
3872                case 0x0013:
3873                        cardid = BTTV_BOARD_OSPREY1x0;
3874                        break;
3875                case 0x0014:
3876                case 0x0015:
3877                        cardid = BTTV_BOARD_OSPREY1x1;
3878                        break;
3879                case 0x0016:
3880                case 0x0017:
3881                case 0x0020:
3882                        cardid = BTTV_BOARD_OSPREY1x1_SVID;
3883                        break;
3884                case 0x0018:
3885                case 0x0019:
3886                case 0x001E:
3887                case 0x001F:
3888                        cardid = BTTV_BOARD_OSPREY2xx;
3889                        break;
3890                case 0x001A:
3891                case 0x001B:
3892                        cardid = BTTV_BOARD_OSPREY2x0_SVID;
3893                        break;
3894                case 0x0040:
3895                        cardid = BTTV_BOARD_OSPREY500;
3896                        break;
3897                case 0x0050:
3898                case 0x0056:
3899                        cardid = BTTV_BOARD_OSPREY540;
3900                        /* bttv_osprey_540_init(btv); */
3901                        break;
3902                case 0x0060:
3903                case 0x0070:
3904                case 0x00A0:
3905                        cardid = BTTV_BOARD_OSPREY2x0;
3906                        /* enable output on select control lines */
3907                        gpio_inout(0xffffff,0x000303);
3908                        break;
3909                case 0x00D8:
3910                        cardid = BTTV_BOARD_OSPREY440;
3911                        break;
3912                default:
3913                        /* unknown...leave generic, but get serial # */
3914                        printk(KERN_INFO "bttv%d: "
3915                               "osprey eeprom: unknown card type 0x%04x\n",
3916                               btv->c.nr, type);
3917                        break;
3918                }
3919                serial = get_unaligned_be32((__be32 *)(ee+6));
3920        }
3921
3922        printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n",
3923               btv->c.nr, cardid,
3924               cardid>0 ? bttv_tvcards[cardid].name : "Unknown", serial);
3925
3926        if (cardid<0 || btv->c.type == cardid)
3927                return;
3928
3929        /* card type isn't set correctly */
3930        if (card[btv->c.nr] < bttv_num_tvcards) {
3931                printk(KERN_WARNING "bttv%d: osprey eeprom: "
3932                       "Not overriding user specified card type\n", btv->c.nr);
3933        } else {
3934                printk(KERN_INFO "bttv%d: osprey eeprom: "
3935                       "Changing card type from %d to %d\n", btv->c.nr,
3936                       btv->c.type, cardid);
3937                btv->c.type = cardid;
3938        }
3939}
3940
3941/* ----------------------------------------------------------------------- */
3942/* AVermedia specific stuff, from  bktr_card.c                             */
3943
3944static int tuner_0_table[] = {
3945        TUNER_PHILIPS_NTSC,  TUNER_PHILIPS_PAL /* PAL-BG*/,
3946        TUNER_PHILIPS_PAL,   TUNER_PHILIPS_PAL /* PAL-I*/,
3947        TUNER_PHILIPS_PAL,   TUNER_PHILIPS_PAL,
3948        TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
3949        TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
3950        TUNER_PHILIPS_FM1216ME_MK3 };
3951
3952static int tuner_1_table[] = {
3953        TUNER_TEMIC_NTSC,  TUNER_TEMIC_PAL,
3954        TUNER_TEMIC_PAL,   TUNER_TEMIC_PAL,
3955        TUNER_TEMIC_PAL,   TUNER_TEMIC_PAL,
3956        TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */
3957        TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
3958
3959static void __devinit avermedia_eeprom(struct bttv *btv)
3960{
3961        int tuner_make, tuner_tv_fm, tuner_format, tuner_type = 0;
3962
3963        tuner_make      = (eeprom_data[0x41] & 0x7);
3964        tuner_tv_fm     = (eeprom_data[0x41] & 0x18) >> 3;
3965        tuner_format    = (eeprom_data[0x42] & 0xf0) >> 4;
3966        btv->has_remote = (eeprom_data[0x42] & 0x01);
3967
3968        if (tuner_make == 0 || tuner_make == 2)
3969                if (tuner_format <= 0x0a)
3970                        tuner_type = tuner_0_table[tuner_format];
3971        if (tuner_make == 1)
3972                if (tuner_format <= 9)
3973                        tuner_type = tuner_1_table[tuner_format];
3974
3975        if (tuner_make == 4)
3976                if (tuner_format == 0x09)
3977                        tuner_type = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */
3978
3979        printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=",
3980                btv->c.nr, eeprom_data[0x41], eeprom_data[0x42]);
3981        if (tuner_type) {
3982                btv->tuner_type = tuner_type;
3983                printk(KERN_CONT "%d", tuner_type);
3984        } else
3985                printk(KERN_CONT "Unknown type");
3986        printk(KERN_CONT " radio:%s remote control:%s\n",
3987               tuner_tv_fm     ? "yes" : "no",
3988               btv->has_remote ? "yes" : "no");
3989}
3990
3991/*
3992 * For Voodoo TV/FM and Voodoo 200.  These cards' tuners use a TDA9880
3993 * analog demod, which is not I2C controlled like the newer and more common
3994 * TDA9887 series.  Instead is has two tri-state input pins, S0 and S1,
3995 * that control the IF for the video and audio.  Apparently, bttv GPIO
3996 * 0x10000 is connected to S0.  S0 low selects a 38.9 MHz VIF for B/G/D/K/I
3997 * (i.e., PAL) while high selects 45.75 MHz for M/N (i.e., NTSC).
3998 */
3999u32 bttv_tda9880_setnorm(struct bttv *btv, u32 gpiobits)
4000{
4001
4002        if (btv->audio == TVAUDIO_INPUT_TUNER) {
4003                if (bttv_tvnorms[btv->tvnorm].v4l2_id & V4L2_STD_MN)
4004                        gpiobits |= 0x10000;
4005                else
4006                        gpiobits &= ~0x10000;
4007        }
4008
4009        gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpiobits);
4010        return gpiobits;
4011}
4012
4013
4014/*
4015 * reset/enable the MSP on some Hauppauge cards
4016 * Thanks to Kyösti Mälkki (kmalkki@cc.hut.fi)!
4017 *
4018 * Hauppauge:  pin  5
4019 * Voodoo:     pin 20
4020 */
4021static void __devinit boot_msp34xx(struct bttv *btv, int pin)
4022{
4023        int mask = (1 << pin);
4024
4025        gpio_inout(mask,mask);
4026        gpio_bits(mask,0);
4027        mdelay(2);
4028        udelay(500);
4029        gpio_bits(mask,mask);
4030
4031        if (bttv_gpio)
4032                bttv_gpio_tracking(btv,"msp34xx");
4033        if (bttv_verbose)
4034                printk(KERN_INFO "bttv%d: Hauppauge/Voodoo msp34xx: reset line "
4035                       "init [%d]\n", btv->c.nr, pin);
4036}
4037
4038/* ----------------------------------------------------------------------- */
4039/*  Imagenation L-Model PXC200 Framegrabber */
4040/*  This is basically the same procedure as
4041 *  used by Alessandro Rubini in his pxc200
4042 *  driver, but using BTTV functions */
4043
4044static void __devinit init_PXC200(struct bttv *btv)
4045{
4046        static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d,
4047                                            0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
4048                                            0x00 };
4049        unsigned int i;
4050        int tmp;
4051        u32 val;
4052
4053        /* Initialise GPIO-connevted stuff */
4054        gpio_inout(0xffffff, (1<<13));
4055        gpio_write(0);
4056        udelay(3);
4057        gpio_write(1<<13);
4058        /* GPIO inputs are pulled up, so no need to drive
4059         * reset pin any longer */
4060        gpio_bits(0xffffff, 0);
4061        if (bttv_gpio)
4062                bttv_gpio_tracking(btv,"pxc200");
4063
4064        /*  we could/should try and reset/control the AD pots? but
4065            right now  we simply  turned off the crushing.  Without
4066            this the AGC drifts drifts
4067            remember the EN is reverse logic -->
4068            setting BT848_ADC_AGC_EN disable the AGC
4069            tboult@eecs.lehigh.edu
4070        */
4071
4072        btwrite(BT848_ADC_RESERVED|BT848_ADC_AGC_EN, BT848_ADC);
4073
4074        /*      Initialise MAX517 DAC */
4075        printk(KERN_INFO "Setting DAC reference voltage level ...\n");
4076        bttv_I2CWrite(btv,0x5E,0,0x80,1);
4077
4078        /*      Initialise 12C508 PIC */
4079        /*      The I2CWrite and I2CRead commmands are actually to the
4080         *      same chips - but the R/W bit is included in the address
4081         *      argument so the numbers are different */
4082
4083
4084        printk(KERN_INFO "Initialising 12C508 PIC chip ...\n");
4085
4086        /* First of all, enable the clock line. This is used in the PXC200-F */
4087        val = btread(BT848_GPIO_DMA_CTL);
4088        val |= BT848_GPIO_DMA_CTL_GPCLKMODE;
4089        btwrite(val, BT848_GPIO_DMA_CTL);
4090
4091        /* Then, push to 0 the reset pin long enough to reset the *
4092         * device same as above for the reset line, but not the same
4093         * value sent to the GPIO-connected stuff
4094         * which one is the good one? */
4095        gpio_inout(0xffffff,(1<<2));
4096        gpio_write(0);
4097        udelay(10);
4098        gpio_write(1<<2);
4099
4100        for (i = 0; i < ARRAY_SIZE(vals); i++) {
4101                tmp=bttv_I2CWrite(btv,0x1E,0,vals[i],1);
4102                if (tmp != -1) {
4103                        printk(KERN_INFO
4104                               "I2C Write(%2.2x) = %i\nI2C Read () = %2.2x\n\n",
4105                               vals[i],tmp,bttv_I2CRead(btv,0x1F,NULL));
4106                }
4107        }
4108
4109        printk(KERN_INFO "PXC200 Initialised.\n");
4110}
4111
4112
4113
4114/* ----------------------------------------------------------------------- */
4115/*
4116 *  The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock
4117 *  it. This apparently involves the following procedure for each 878 chip:
4118 *
4119 *  1) write 0x00C3FEFF to the GPIO_OUT_EN register
4120 *
4121 *  2)  write to GPIO_DATA
4122 *      - 0x0E
4123 *      - sleep 1ms
4124 *      - 0x10 + 0x0E
4125 *      - sleep 10ms
4126 *      - 0x0E
4127 *     read from GPIO_DATA into buf (uint_32)
4128 *      - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 )
4129 *                 error. ERROR_CPLD_Check_Failed stop.
4130 *
4131 *  3) write to GPIO_DATA
4132 *      - write 0x4400 + 0x0E
4133 *      - sleep 10ms
4134 *      - write 0x4410 + 0x0E
4135 *      - sleep 1ms
4136 *      - write 0x0E
4137 *     read from GPIO_DATA into buf (uint_32)
4138 *      - if ( buf>>18 & 0x01 ) || ( buf>>19 & 0x01 != 0 )
4139 *                error. ERROR_CPLD_Check_Failed.
4140 */
4141/* ----------------------------------------------------------------------- */
4142static void
4143init_RTV24 (struct bttv *btv)
4144{
4145        uint32_t dataRead = 0;
4146        long watchdog_value = 0x0E;
4147
4148        printk (KERN_INFO
4149                "bttv%d: Adlink RTV-24 initialisation in progress ...\n",
4150                btv->c.nr);
4151
4152        btwrite (0x00c3feff, BT848_GPIO_OUT_EN);
4153
4154        btwrite (0 + watchdog_value, BT848_GPIO_DATA);
4155        msleep (1);
4156        btwrite (0x10 + watchdog_value, BT848_GPIO_DATA);
4157        msleep (10);
4158        btwrite (0 + watchdog_value, BT848_GPIO_DATA);
4159
4160        dataRead = btread (BT848_GPIO_DATA);
4161
4162        if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) {
4163                printk (KERN_INFO
4164                        "bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n",
4165                        btv->c.nr, dataRead);
4166        }
4167
4168        btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA);
4169        msleep (10);
4170        btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA);
4171        msleep (1);
4172        btwrite (watchdog_value, BT848_GPIO_DATA);
4173        msleep (1);
4174        dataRead = btread (BT848_GPIO_DATA);
4175
4176        if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) {
4177                printk (KERN_INFO
4178                        "bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n",
4179                        btv->c.nr, dataRead);
4180
4181                return;
4182        }
4183
4184        printk (KERN_INFO
4185                "bttv%d: Adlink RTV-24 initialisation complete.\n", btv->c.nr);
4186}
4187
4188
4189
4190/* ----------------------------------------------------------------------- */
4191/* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports     */
4192/*
4193 * Copyright (c) 1999 Csaba Halasz <qgehali@uni-miskolc.hu>
4194 * This code is placed under the terms of the GNU General Public License
4195 *
4196 * Brutally hacked by Dan Sheridan <dan.sheridan@contact.org.uk> djs52 8/3/00
4197 */
4198
4199static void bus_low(struct bttv *btv, int bit)
4200{
4201        if (btv->mbox_ior) {
4202                gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
4203                          btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
4204                udelay(5);
4205        }
4206
4207        gpio_bits(bit,0);
4208        udelay(5);
4209
4210        if (btv->mbox_ior) {
4211                gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
4212                udelay(5);
4213        }
4214}
4215
4216static void bus_high(struct bttv *btv, int bit)
4217{
4218        if (btv->mbox_ior) {
4219                gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
4220                          btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
4221                udelay(5);
4222        }
4223
4224        gpio_bits(bit,bit);
4225        udelay(5);
4226
4227        if (btv->mbox_ior) {
4228                gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
4229                udelay(5);
4230        }
4231}
4232
4233static int bus_in(struct bttv *btv, int bit)
4234{
4235        if (btv->mbox_ior) {
4236                gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
4237                          btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
4238                udelay(5);
4239
4240                gpio_bits(btv->mbox_iow | btv->mbox_csel, 0);
4241                udelay(5);
4242        }
4243        return gpio_read() & (bit);
4244}
4245
4246/* TEA5757 register bits */
4247#define TEA_FREQ                0:14
4248#define TEA_BUFFER              15:15
4249
4250#define TEA_SIGNAL_STRENGTH     16:17
4251
4252#define TEA_PORT1               18:18
4253#define TEA_PORT0               19:19
4254
4255#define TEA_BAND                20:21
4256#define TEA_BAND_FM             0
4257#define TEA_BAND_MW             1
4258#define TEA_BAND_LW             2
4259#define TEA_BAND_SW             3
4260
4261#define TEA_MONO                22:22
4262#define TEA_ALLOW_STEREO        0
4263#define TEA_FORCE_MONO          1
4264
4265#define TEA_SEARCH_DIRECTION    23:23
4266#define TEA_SEARCH_DOWN         0
4267#define TEA_SEARCH_UP           1
4268
4269#define TEA_STATUS              24:24
4270#define TEA_STATUS_TUNED        0
4271#define TEA_STATUS_SEARCHING    1
4272
4273/* Low-level stuff */
4274static int tea5757_read(struct bttv *btv)
4275{
4276        unsigned long timeout;
4277        int value = 0;
4278        int i;
4279
4280        /* better safe than sorry */
4281        gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we);
4282
4283        if (btv->mbox_ior) {
4284                gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
4285                          btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
4286                udelay(5);
4287        }
4288
4289        if (bttv_gpio)
4290                bttv_gpio_tracking(btv,"tea5757 read");
4291
4292        bus_low(btv,btv->mbox_we);
4293        bus_low(btv,btv->mbox_clk);
4294
4295        udelay(10);
4296        timeout= jiffies + msecs_to_jiffies(1000);
4297
4298        /* wait for DATA line to go low; error if it doesn't */
4299        while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
4300                schedule();
4301        if (bus_in(btv,btv->mbox_data)) {
4302                printk(KERN_WARNING "bttv%d: tea5757: read timeout\n",btv->c.nr);
4303                return -1;
4304        }
4305
4306        dprintk("bttv%d: tea5757:",btv->c.nr);
4307        for (i = 0; i < 24; i++) {
4308                udelay(5);
4309                bus_high(btv,btv->mbox_clk);
4310                udelay(5);
4311                dprintk("%c",(bus_in(btv,btv->mbox_most) == 0)?'T':'-');
4312                bus_low(btv,btv->mbox_clk);
4313                value <<= 1;
4314                value |= (bus_in(btv,btv->mbox_data) == 0)?0:1;  /* MSB first */
4315                dprintk("%c", (bus_in(btv,btv->mbox_most) == 0)?'S':'M');
4316        }
4317        dprintk("\nbttv%d: tea5757: read 0x%X\n", btv->c.nr, value);
4318        return value;
4319}
4320
4321static int tea5757_write(struct bttv *btv, int value)
4322{
4323        int i;
4324        int reg = value;
4325
4326        gpio_inout(btv->mbox_mask, btv->mbox_clk | btv->mbox_we | btv->mbox_data);
4327
4328        if (btv->mbox_ior) {
4329                gpio_bits(btv->mbox_ior | btv->mbox_iow | btv->mbox_csel,
4330                          btv->mbox_ior | btv->mbox_iow | btv->mbox_csel);
4331                udelay(5);
4332        }
4333        if (bttv_gpio)
4334                bttv_gpio_tracking(btv,"tea5757 write");
4335
4336        dprintk("bttv%d: tea5757: write 0x%X\n", btv->c.nr, value);
4337        bus_low(btv,btv->mbox_clk);
4338        bus_high(btv,btv->mbox_we);
4339        for (i = 0; i < 25; i++) {
4340                if (reg & 0x1000000)
4341                        bus_high(btv,btv->mbox_data);
4342                else
4343                        bus_low(btv,btv->mbox_data);
4344                reg <<= 1;
4345                bus_high(btv,btv->mbox_clk);
4346                udelay(10);
4347                bus_low(btv,btv->mbox_clk);
4348                udelay(10);
4349        }
4350        bus_low(btv,btv->mbox_we);  /* unmute !!! */
4351        return 0;
4352}
4353
4354void tea5757_set_freq(struct bttv *btv, unsigned short freq)
4355{
4356        dprintk("tea5757_set_freq %d\n",freq);
4357        tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
4358}
4359
4360/* RemoteVision MX (rv605) muxsel helper [Miguel Freitas]
4361 *
4362 * This is needed because rv605 don't use a normal multiplex, but a crosspoint
4363 * switch instead (CD22M3494E). This IC can have multiple active connections
4364 * between Xn (input) and Yn (output) pins. We need to clear any existing
4365 * connection prior to establish a new one, pulsing the STROBE pin.
4366 *
4367 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
4368 * GPIO pins are wired as:
4369 *  GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroller)
4370 *  GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroller)
4371 *  GPIO[7]   - DATA (xpoint)    - P1[7] (microcontroller)
4372 *  GPIO[8]   -                  - P3[5] (microcontroller)
4373 *  GPIO[9]   - RESET (xpoint)   - P3[6] (microcontroller)
4374 *  GPIO[10]  - STROBE (xpoint)  - P3[7] (microcontroller)
4375 *  GPINTR    -                  - P3[4] (microcontroller)
4376 *
4377 * The microcontroller is a 80C32 like. It should be possible to change xpoint
4378 * configuration either directly (as we are doing) or using the microcontroller
4379 * which is also wired to I2C interface. I have no further info on the
4380 * microcontroller features, one would need to disassembly the firmware.
4381 * note: the vendor refused to give any information on this product, all
4382 *       that stuff was found using a multimeter! :)
4383 */
4384static void rv605_muxsel(struct bttv *btv, unsigned int input)
4385{
4386        static const u8 muxgpio[] = { 0x3, 0x1, 0x2, 0x4, 0xf, 0x7, 0xe, 0x0,
4387                                      0xd, 0xb, 0xc, 0x6, 0x9, 0x5, 0x8, 0xa };
4388
4389        gpio_bits(0x07f, muxgpio[input]);
4390
4391        /* reset all conections */
4392        gpio_bits(0x200,0x200);
4393        mdelay(1);
4394        gpio_bits(0x200,0x000);
4395        mdelay(1);
4396
4397        /* create a new connection */
4398        gpio_bits(0x480,0x480);
4399        mdelay(1);
4400        gpio_bits(0x480,0x080);
4401        mdelay(1);
4402}
4403
4404/* Tibet Systems 'Progress DVR' CS16 muxsel helper [Chris Fanning]
4405 *
4406 * The CS16 (available on eBay cheap) is a PCI board with four Fusion
4407 * 878A chips, a PCI bridge, an Atmel microcontroller, four sync seperator
4408 * chips, ten eight input analog multiplexors, a not chip and a few
4409 * other components.
4410 *
4411 * 16 inputs on a secondary bracket are provided and can be selected
4412 * from each of the four capture chips.  Two of the eight input
4413 * multiplexors are used to select from any of the 16 input signals.
4414 *
4415 * Unsupported hardware capabilities:
4416 *  . A video output monitor on the secondary bracket can be selected from
4417 *    one of the 878A chips.
4418 *  . Another passthrough but I haven't spent any time investigating it.
4419 *  . Digital I/O (logic level connected to GPIO) is available from an
4420 *    onboard header.
4421 *
4422 * The on chip input mux should always be set to 2.
4423 * GPIO[16:19] - Video input selection
4424 * GPIO[0:3]   - Video output monitor select (only available from one 878A)
4425 * GPIO[?:?]   - Digital I/O.
4426 *
4427 * There is an ATMEL microcontroller with an 8031 core on board.  I have not
4428 * determined what function (if any) it provides.  With the microcontroller
4429 * and sync seperator chips a guess is that it might have to do with video
4430 * switching and maybe some digital I/O.
4431 */
4432static void tibetCS16_muxsel(struct bttv *btv, unsigned int input)
4433{
4434        /* video mux */
4435        gpio_bits(0x0f0000, input << 16);
4436}
4437
4438static void tibetCS16_init(struct bttv *btv)
4439{
4440        /* enable gpio bits, mask obtained via btSpy */
4441        gpio_inout(0xffffff, 0x0f7fff);
4442        gpio_write(0x0f7fff);
4443}
4444
4445/*
4446 * The following routines for the Kodicom-4400r get a little mind-twisting.
4447 * There is a "master" controller and three "slave" controllers, together
4448 * an analog switch which connects any of 16 cameras to any of the BT87A's.
4449 * The analog switch is controlled by the "master", but the detection order
4450 * of the four BT878A chips is in an order which I just don't understand.
4451 * The "master" is actually the second controller to be detected.  The
4452 * logic on the board uses logical numbers for the 4 controllers, but
4453 * those numbers are different from the detection sequence.  When working
4454 * with the analog switch, we need to "map" from the detection sequence
4455 * over to the board's logical controller number.  This mapping sequence
4456 * is {3, 0, 2, 1}, i.e. the first controller to be detected is logical
4457 * unit 3, the second (which is the master) is logical unit 0, etc.
4458 * We need to maintain the status of the analog switch (which of the 16
4459 * cameras is connected to which of the 4 controllers).  Rather than
4460 * add to the bttv structure for this, we use the data reserved for
4461 * the mbox (unused for this card type).
4462 */
4463
4464/*
4465 * First a routine to set the analog switch, which controls which camera
4466 * is routed to which controller.  The switch comprises an X-address
4467 * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
4468 * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
4469 * A data value (gpio bit 7) of '1' enables the switch, and '0' disables
4470 * the switch.  A STROBE bit (gpio bit 8) latches the data value into the
4471 * specified address.  The idea is to set the address and data, then bring
4472 * STROBE high, and finally bring STROBE back to low.
4473 */
4474static void kodicom4400r_write(struct bttv *btv,
4475                               unsigned char xaddr,
4476                               unsigned char yaddr,
4477                               unsigned char data) {
4478        unsigned int udata;
4479
4480        udata = (data << 7) | ((yaddr&3) << 4) | (xaddr&0xf);
4481        gpio_bits(0x1ff, udata);                /* write ADDR and DAT */
4482        gpio_bits(0x1ff, udata | (1 << 8));     /* strobe high */
4483        gpio_bits(0x1ff, udata);                /* strobe low */
4484}
4485
4486/*
4487 * Next the mux select.  Both the "master" and "slave" 'cards' (controllers)
4488 * use this routine.  The routine finds the "master" for the card, maps
4489 * the controller number from the detected position over to the logical
4490 * number, writes the appropriate data to the analog switch, and housekeeps
4491 * the local copy of the switch information.  The parameter 'input' is the
4492 * requested camera number (0 - 15).
4493 */
4494static void kodicom4400r_muxsel(struct bttv *btv, unsigned int input)
4495{
4496        char *sw_status;
4497        int xaddr, yaddr;
4498        struct bttv *mctlr;
4499        static unsigned char map[4] = {3, 0, 2, 1};
4500
4501        mctlr = master[btv->c.nr];
4502        if (mctlr == NULL) {    /* ignore if master not yet detected */
4503                return;
4504        }
4505        yaddr = (btv->c.nr - mctlr->c.nr + 1) & 3; /* the '&' is for safety */
4506        yaddr = map[yaddr];
4507        sw_status = (char *)(&mctlr->mbox_we);
4508        xaddr = input & 0xf;
4509        /* Check if the controller/camera pair has changed, else ignore */
4510        if (sw_status[yaddr] != xaddr)
4511        {
4512                /* "open" the old switch, "close" the new one, save the new */
4513                kodicom4400r_write(mctlr, sw_status[yaddr], yaddr, 0);
4514                sw_status[yaddr] = xaddr;
4515                kodicom4400r_write(mctlr, xaddr, yaddr, 1);
4516        }
4517}
4518
4519/*
4520 * During initialisation, we need to reset the analog switch.  We
4521 * also preset the switch to map the 4 connectors on the card to the
4522 * *user's* (see above description of kodicom4400r_muxsel) channels
4523 * 0 through 3
4524 */
4525static void kodicom4400r_init(struct bttv *btv)
4526{
4527        char *sw_status = (char *)(&btv->mbox_we);
4528        int ix;
4529
4530        gpio_inout(0x0003ff, 0x0003ff);
4531        gpio_write(1 << 9);     /* reset MUX */
4532        gpio_write(0);
4533        /* Preset camera 0 to the 4 controllers */
4534        for (ix = 0; ix < 4; ix++) {
4535                sw_status[ix] = ix;
4536                kodicom4400r_write(btv, ix, ix, 1);
4537        }
4538        /*
4539         * Since this is the "master", we need to set up the
4540         * other three controller chips' pointers to this structure
4541         * for later use in the muxsel routine.
4542         */
4543        if ((btv->c.nr<1) || (btv->c.nr>BTTV_MAX-3))
4544            return;
4545        master[btv->c.nr-1] = btv;
4546        master[btv->c.nr]   = btv;
4547        master[btv->c.nr+1] = btv;
4548        master[btv->c.nr+2] = btv;
4549}
4550
4551/* The Grandtec X-Guard framegrabber card uses two Dual 4-channel
4552 * video multiplexers to provide up to 16 video inputs. These
4553 * multiplexers are controlled by the lower 8 GPIO pins of the
4554 * bt878. The multiplexers probably Pericom PI5V331Q or similar.
4555
4556 * xxx0 is pin xxx of multiplexer U5,
4557 * yyy1 is pin yyy of multiplexer U2
4558 */
4559#define ENA0    0x01
4560#define ENB0    0x02
4561#define ENA1    0x04
4562#define ENB1    0x08
4563
4564#define IN10    0x10
4565#define IN00    0x20
4566#define IN11    0x40
4567#define IN01    0x80
4568
4569static void xguard_muxsel(struct bttv *btv, unsigned int input)
4570{
4571        static const int masks[] = {
4572                ENB0, ENB0|IN00, ENB0|IN10, ENB0|IN00|IN10,
4573                ENA0, ENA0|IN00, ENA0|IN10, ENA0|IN00|IN10,
4574                ENB1, ENB1|IN01, ENB1|IN11, ENB1|IN01|IN11,
4575                ENA1, ENA1|IN01, ENA1|IN11, ENA1|IN01|IN11,
4576        };
4577        gpio_write(masks[input%16]);
4578}
4579static void picolo_tetra_init(struct bttv *btv)
4580{
4581        /*This is the video input redirection fonctionality : I DID NOT USED IT. */
4582        btwrite (0x08<<16,BT848_GPIO_DATA);/*GPIO[19] [==> 4053 B+C] set to 1 */
4583        btwrite (0x04<<16,BT848_GPIO_DATA);/*GPIO[18] [==> 4053 A]  set to 1*/
4584}
4585static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input)
4586{
4587
4588        dprintk (KERN_DEBUG "bttv%d : picolo_tetra_muxsel =>  input = %d\n",btv->c.nr,input);
4589        /*Just set the right path in the analog multiplexers : channel 1 -> 4 ==> Analog Mux ==> MUX0*/
4590        /*GPIO[20]&GPIO[21] used to choose the right input*/
4591        btwrite (input<<20,BT848_GPIO_DATA);
4592
4593}
4594
4595/*
4596 * ivc120_muxsel [Added by Alan Garfield <alan@fromorbit.com>]
4597 *
4598 * The IVC120G security card has 4 i2c controlled TDA8540 matrix
4599 * swichers to provide 16 channels to MUX0. The TDA8540's have
4600 * 4 independent outputs and as such the IVC120G also has the
4601 * optional "Monitor Out" bus. This allows the card to be looking
4602 * at one input while the monitor is looking at another.
4603 *
4604 * Since I've couldn't be bothered figuring out how to add an
4605 * independant muxsel for the monitor bus, I've just set it to
4606 * whatever the card is looking at.
4607 *
4608 *  OUT0 of the TDA8540's is connected to MUX0         (0x03)
4609 *  OUT1 of the TDA8540's is connected to "Monitor Out"        (0x0C)
4610 *
4611 *  TDA8540_ALT3 IN0-3 = Channel 13 - 16       (0x03)
4612 *  TDA8540_ALT4 IN0-3 = Channel 1 - 4         (0x03)
4613 *  TDA8540_ALT5 IN0-3 = Channel 5 - 8         (0x03)
4614 *  TDA8540_ALT6 IN0-3 = Channel 9 - 12                (0x03)
4615 *
4616 */
4617
4618/* All 7 possible sub-ids for the TDA8540 Matrix Switcher */
4619#define I2C_TDA8540        0x90
4620#define I2C_TDA8540_ALT1   0x92
4621#define I2C_TDA8540_ALT2   0x94
4622#define I2C_TDA8540_ALT3   0x96
4623#define I2C_TDA8540_ALT4   0x98
4624#define I2C_TDA8540_ALT5   0x9a
4625#define I2C_TDA8540_ALT6   0x9c
4626
4627static void ivc120_muxsel(struct bttv *btv, unsigned int input)
4628{
4629        /* Simple maths */
4630        int key = input % 4;
4631        int matrix = input / 4;
4632
4633        dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n",
4634                btv->c.nr, input, matrix, key);
4635
4636        /* Handles the input selection on the TDA8540's */
4637        bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00,
4638                      ((matrix == 3) ? (key | key << 2) : 0x00), 1);
4639        bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00,
4640                      ((matrix == 0) ? (key | key << 2) : 0x00), 1);
4641        bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x00,
4642                      ((matrix == 1) ? (key | key << 2) : 0x00), 1);
4643        bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00,
4644                      ((matrix == 2) ? (key | key << 2) : 0x00), 1);
4645
4646        /* Handles the output enables on the TDA8540's */
4647        bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02,
4648                      ((matrix == 3) ? 0x03 : 0x00), 1);  /* 13 - 16 */
4649        bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02,
4650                      ((matrix == 0) ? 0x03 : 0x00), 1);  /* 1-4 */
4651        bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02,
4652                      ((matrix == 1) ? 0x03 : 0x00), 1);  /* 5-8 */
4653        bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02,
4654                      ((matrix == 2) ? 0x03 : 0x00), 1);  /* 9-12 */
4655
4656        /* 878's MUX0 is already selected for input via muxsel values */
4657}
4658
4659
4660/* PXC200 muxsel helper
4661 * luke@syseng.anu.edu.au
4662 * another transplant
4663 * from Alessandro Rubini (rubini@linux.it)
4664 *
4665 * There are 4 kinds of cards:
4666 * PXC200L which is bt848
4667 * PXC200F which is bt848 with PIC controlling mux
4668 * PXC200AL which is bt878
4669 * PXC200AF which is bt878 with PIC controlling mux
4670 */
4671#define PX_CFG_PXC200F 0x01
4672#define PX_FLAG_PXC200A  0x00001000 /* a pxc200A is bt-878 based */
4673#define PX_I2C_PIC       0x0f
4674#define PX_PXC200A_CARDID 0x200a1295
4675#define PX_I2C_CMD_CFG   0x00
4676
4677static void PXC200_muxsel(struct bttv *btv, unsigned int input)
4678{
4679        int rc;
4680        long mux;
4681        int bitmask;
4682        unsigned char buf[2];
4683
4684        /* Read PIC config to determine if this is a PXC200F */
4685        /* PX_I2C_CMD_CFG*/
4686        buf[0]=0;
4687        buf[1]=0;
4688        rc=bttv_I2CWrite(btv,(PX_I2C_PIC<<1),buf[0],buf[1],1);
4689        if (rc) {
4690          printk(KERN_DEBUG "bttv%d: PXC200_muxsel: pic cfg write failed:%d\n", btv->c.nr,rc);
4691          /* not PXC ? do nothing */
4692          return;
4693        }
4694
4695        rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
4696        if (!(rc & PX_CFG_PXC200F)) {
4697          printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
4698          return;
4699        }
4700
4701
4702        /* The multiplexer in the 200F is handled by the GPIO port */
4703        /* get correct mapping between inputs  */
4704        /*  mux = bttv_tvcards[btv->type].muxsel[input] & 3; */
4705        /* ** not needed!?   */
4706        mux = input;
4707
4708        /* make sure output pins are enabled */
4709        /* bitmask=0x30f; */
4710        bitmask=0x302;
4711        /* check whether we have a PXC200A */
4712        if (btv->cardid == PX_PXC200A_CARDID)  {
4713           bitmask ^= 0x180; /* use 7 and 9, not 8 and 9 */
4714           bitmask |= 7<<4; /* the DAC */
4715        }
4716        btwrite(bitmask, BT848_GPIO_OUT_EN);
4717
4718        bitmask = btread(BT848_GPIO_DATA);
4719        if (btv->cardid == PX_PXC200A_CARDID)
4720          bitmask = (bitmask & ~0x280) | ((mux & 2) << 8) | ((mux & 1) << 7);
4721        else /* older device */
4722          bitmask = (bitmask & ~0x300) | ((mux & 3) << 8);
4723        btwrite(bitmask,BT848_GPIO_DATA);
4724
4725        /*
4726         * Was "to be safe, set the bt848 to input 0"
4727         * Actually, since it's ok at load time, better not messing
4728         * with these bits (on PXC200AF you need to set mux 2 here)
4729         *
4730         * needed because bttv-driver sets mux before calling this function
4731         */
4732        if (btv->cardid == PX_PXC200A_CARDID)
4733          btaor(2<<5, ~BT848_IFORM_MUXSEL, BT848_IFORM);
4734        else /* older device */
4735          btand(~BT848_IFORM_MUXSEL,BT848_IFORM);
4736
4737        printk(KERN_DEBUG "bttv%d: setting input channel to:%d\n", btv->c.nr,(int)mux);
4738}
4739
4740static void phytec_muxsel(struct bttv *btv, unsigned int input)
4741{
4742        unsigned int mux = input % 4;
4743
4744        if (input == btv->svhs)
4745                mux = 0;
4746
4747        gpio_bits(0x3, mux);
4748}
4749
4750/*
4751 * GeoVision GV-800(S) functions
4752 * Bruno Christo <bchristo@inf.ufsm.br>
4753*/
4754
4755/* This is a function to control the analog switch, which determines which
4756 * camera is routed to which controller.  The switch comprises an X-address
4757 * (gpio bits 0-3, representing the camera, ranging from 0-15), and a
4758 * Y-address (gpio bits 4-6, representing the controller, ranging from 0-3).
4759 * A data value (gpio bit 18) of '1' enables the switch, and '0' disables
4760 * the switch.  A STROBE bit (gpio bit 17) latches the data value into the
4761 * specified address. There is also a chip select (gpio bit 16).
4762 * The idea is to set the address and chip select together, bring
4763 * STROBE high, write the data, and finally bring STROBE back to low.
4764 */
4765static void gv800s_write(struct bttv *btv,
4766                         unsigned char xaddr,
4767                         unsigned char yaddr,
4768                         unsigned char data) {
4769        /* On the "master" 878A:
4770        * GPIO bits 0-9 are used for the analog switch:
4771        *   00 - 03:    camera selector
4772        *   04 - 06:    878A (controller) selector
4773        *   16:         cselect
4774        *   17:         strobe
4775        *   18:         data (1->on, 0->off)
4776        *   19:         reset
4777        */
4778        const u32 ADDRESS = ((xaddr&0xf) | (yaddr&3)<<4);
4779        const u32 CSELECT = 1<<16;
4780        const u32 STROBE = 1<<17;
4781        const u32 DATA = data<<18;
4782
4783        gpio_bits(0x1007f, ADDRESS | CSELECT);  /* write ADDRESS and CSELECT */
4784        gpio_bits(0x20000, STROBE);             /* STROBE high */
4785        gpio_bits(0x40000, DATA);               /* write DATA */
4786        gpio_bits(0x20000, ~STROBE);            /* STROBE low */
4787}
4788
4789/*
4790 * GeoVision GV-800(S) muxsel
4791 *
4792 * Each of the 4 cards (controllers) use this function.
4793 * The controller using this function selects the input through the GPIO pins
4794 * of the "master" card. A pointer to this card is stored in master[btv->c.nr].
4795 *
4796 * The parameter 'input' is the requested camera number (0-4) on the controller.
4797 * The map array has the address of each input. Note that the addresses in the
4798 * array are in the sequence the original GeoVision driver uses, that is, set
4799 * every controller to input 0, then to input 1, 2, 3, repeat. This means that
4800 * the physical "camera 1" connector corresponds to controller 0 input 0,
4801 * "camera 2" corresponds to controller 1 input 0, and so on.
4802 *
4803 * After getting the input address, the function then writes the appropriate
4804 * data to the analog switch, and housekeeps the local copy of the switch
4805 * information.
4806 */
4807static void gv800s_muxsel(struct bttv *btv, unsigned int input)
4808{
4809        struct bttv *mctlr;
4810        char *sw_status;
4811        int xaddr, yaddr;
4812        static unsigned int map[4][4] = { { 0x0, 0x4, 0xa, 0x6 },
4813                                          { 0x1, 0x5, 0xb, 0x7 },
4814                                          { 0x2, 0x8, 0xc, 0xe },
4815                                          { 0x3, 0x9, 0xd, 0xf } };
4816        input = input%4;
4817        mctlr = master[btv->c.nr];
4818        if (mctlr == NULL) {
4819                /* do nothing until the "master" is detected */
4820                return;
4821        }
4822        yaddr = (btv->c.nr - mctlr->c.nr) & 3;
4823        sw_status = (char *)(&mctlr->mbox_we);
4824        xaddr = map[yaddr][input] & 0xf;
4825
4826        /* Check if the controller/camera pair has changed, ignore otherwise */
4827        if (sw_status[yaddr] != xaddr) {
4828                /* disable the old switch, enable the new one and save status */
4829                gv800s_write(mctlr, sw_status[yaddr], yaddr, 0);
4830                sw_status[yaddr] = xaddr;
4831                gv800s_write(mctlr, xaddr, yaddr, 1);
4832        }
4833}
4834
4835/* GeoVision GV-800(S) "master" chip init */
4836static void gv800s_init(struct bttv *btv)
4837{
4838        char *sw_status = (char *)(&btv->mbox_we);
4839        int ix;
4840
4841        gpio_inout(0xf107f, 0xf107f);
4842        gpio_write(1<<19); /* reset the analog MUX */
4843        gpio_write(0);
4844
4845        /* Preset camera 0 to the 4 controllers */
4846        for (ix = 0; ix < 4; ix++) {
4847                sw_status[ix] = ix;
4848                gv800s_write(btv, ix, ix, 1);
4849        }
4850
4851        /* Inputs on the "master" controller need this brightness fix */
4852        bttv_I2CWrite(btv, 0x18, 0x5, 0x90, 1);
4853
4854        if (btv->c.nr > BTTV_MAX-4)
4855                return;
4856        /*
4857         * Store the "master" controller pointer in the master
4858         * array for later use in the muxsel function.
4859         */
4860        master[btv->c.nr]   = btv;
4861        master[btv->c.nr+1] = btv;
4862        master[btv->c.nr+2] = btv;
4863        master[btv->c.nr+3] = btv;
4864}
4865
4866/* ----------------------------------------------------------------------- */
4867/* motherboard chipset specific stuff                                      */
4868
4869void __init bttv_check_chipset(void)
4870{
4871        int pcipci_fail = 0;
4872        struct pci_dev *dev = NULL;
4873
4874        if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL))       /* should check if target is AGP */
4875                pcipci_fail = 1;
4876        if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
4877                triton1 = 1;
4878        if (pci_pci_problems & PCIPCI_VSFX)
4879                vsfx = 1;
4880#ifdef PCIPCI_ALIMAGIK
4881        if (pci_pci_problems & PCIPCI_ALIMAGIK)
4882                latency = 0x0A;
4883#endif
4884
4885
4886        /* print warnings about any quirks found */
4887        if (triton1)
4888                printk(KERN_INFO "bttv: Host bridge needs ETBF enabled.\n");
4889        if (vsfx)
4890                printk(KERN_INFO "bttv: Host bridge needs VSFX enabled.\n");
4891        if (pcipci_fail) {
4892                printk(KERN_INFO "bttv: bttv and your chipset may not work "
4893                                                        "together.\n");
4894                if (!no_overlay) {
4895                        printk(KERN_INFO "bttv: overlay will be disabled.\n");
4896                        no_overlay = 1;
4897                } else {
4898                        printk(KERN_INFO "bttv: overlay forced. Use this "
4899                                                "option at your own risk.\n");
4900                }
4901        }
4902        if (UNSET != latency)
4903                printk(KERN_INFO "bttv: pci latency fixup [%d]\n",latency);
4904        while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL,
4905                                      PCI_DEVICE_ID_INTEL_82441, dev))) {
4906                unsigned char b;
4907                pci_read_config_byte(dev, 0x53, &b);
4908                if (bttv_debug)
4909                        printk(KERN_INFO "bttv: Host bridge: 82441FX Natoma, "
4910                               "bufcon=0x%02x\n",b);
4911        }
4912}
4913
4914int __devinit bttv_handle_chipset(struct bttv *btv)
4915{
4916        unsigned char command;
4917
4918        if (!triton1 && !vsfx && UNSET == latency)
4919                return 0;
4920
4921        if (bttv_verbose) {
4922                if (triton1)
4923                        printk(KERN_INFO "bttv%d: enabling ETBF (430FX/VP3 compatibilty)\n",btv->c.nr);
4924                if (vsfx && btv->id >= 878)
4925                        printk(KERN_INFO "bttv%d: enabling VSFX\n",btv->c.nr);
4926                if (UNSET != latency)
4927                        printk(KERN_INFO "bttv%d: setting pci timer to %d\n",
4928                               btv->c.nr,latency);
4929        }
4930
4931        if (btv->id < 878) {
4932                /* bt848 (mis)uses a bit in the irq mask for etbf */
4933                if (triton1)
4934                        btv->triton1 = BT848_INT_ETBF;
4935        } else {
4936                /* bt878 has a bit in the pci config space for it */
4937                pci_read_config_byte(btv->c.pci, BT878_DEVCTRL, &command);
4938                if (triton1)
4939                        command |= BT878_EN_TBFX;
4940                if (vsfx)
4941                        command |= BT878_EN_VSFX;
4942                pci_write_config_byte(btv->c.pci, BT878_DEVCTRL, command);
4943        }
4944        if (UNSET != latency)
4945                pci_write_config_byte(btv->c.pci, PCI_LATENCY_TIMER, latency);
4946        return 0;
4947}
4948
4949
4950/*
4951 * Local variables:
4952 * c-basic-offset: 8
4953 * End:
4954 */
4955
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.