2 * SPDX-License-Identifier: BSD-4-Clause
4 * 1. Redistributions of source code must retain the
5 * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Amancio Hasty and
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
36 #include <sys/cdefs.h>
37 __FBSDID("$FreeBSD$");
40 * This is part of the Driver for Video Capture Cards (Frame grabbers)
41 * and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
43 * Copyright Roger Hardiman and Amancio Hasty.
45 * bktr_card : This deals with identifying TV cards.
46 * trying to find the card make and model of card.
47 * trying to find the type of tuner fitted.
48 * reading the configuration EEPROM.
49 * locating i2c devices.
52 #include "opt_bktr.h" /* Include any kernel config options */
54 #include <sys/param.h>
55 #include <sys/systm.h>
59 #if (__FreeBSD_version < 500000)
60 #include <machine/clock.h> /* for DELAY */
61 #include <pci/pcivar.h>
64 #include <sys/mutex.h>
65 #include <sys/selinfo.h>
66 #include <dev/pci/pcivar.h>
69 #include <machine/bus.h>
74 #include <dev/ic/bt8xx.h> /* NetBSD location for .h files */
75 #include <dev/pci/bktr/bktr_reg.h>
76 #include <dev/pci/bktr/bktr_core.h>
77 #include <dev/pci/bktr/bktr_tuner.h>
78 #include <dev/pci/bktr/bktr_card.h>
79 #include <dev/pci/bktr/bktr_audio.h>
81 #include <dev/bktr/ioctl_meteor.h>
82 #include <dev/bktr/ioctl_bt848.h> /* extensions to ioctl_meteor.h */
83 #include <dev/bktr/bktr_reg.h>
84 #include <dev/bktr/bktr_core.h>
85 #include <dev/bktr/bktr_tuner.h>
86 #include <dev/bktr/bktr_card.h>
87 #include <dev/bktr/bktr_audio.h>
90 /* Include the PCI Vendor definitions */
92 #include <dev/pci/pcidevs.h>
93 #include <dev/pci/pcireg.h>
97 #define HAUP_REMOTE_INT_WADDR 0x30
98 #define HAUP_REMOTE_INT_RADDR 0x31
100 #define HAUP_REMOTE_EXT_WADDR 0x34
101 #define HAUP_REMOTE_EXT_RADDR 0x35
103 /* address of BTSC/SAP decoder chip */
104 #define TDA9850_WADDR 0xb6
105 #define TDA9850_RADDR 0xb7
107 /* address of MSP3400C chip */
108 #define MSP3400C_WADDR 0x80
109 #define MSP3400C_RADDR 0x81
111 /* address of DPL3518A chip */
112 #define DPL3518A_WADDR 0x84
113 #define DPL3518A_RADDR 0x85
115 /* EEProm (128 * 8) on an STB card */
116 #define X24C01_WADDR 0xae
117 #define X24C01_RADDR 0xaf
120 /* EEProm (256 * 8) on a Hauppauge card */
121 /* and on most BT878s cards to store the sub-system vendor id */
122 #define PFC8582_WADDR 0xa0
123 #define PFC8582_RADDR 0xa1
125 #if defined(BKTR_SYSTEM_DEFAULT) && BKTR_SYSTEM_DEFAULT == BROOKTREE_PAL
126 #define DEFAULT_TUNER PHILIPS_PALI
128 #define DEFAULT_TUNER PHILIPS_NTSC
135 * the data for each type of card
138 * these entried MUST be kept in the order defined by the CARD_XXX defines!
140 static const struct CARDTYPE cards[] = {
142 { CARD_UNKNOWN, /* the card id */
143 "Unknown", /* the 'name' */
144 NULL, /* the tuner */
145 0, /* the tuner i2c address */
149 0, /* EEProm unknown */
150 0, /* EEProm unknown */
154 { CARD_MIRO, /* the card id */
155 "Pinnacle/Miro TV", /* the 'name' */
156 NULL, /* the tuner */
157 0, /* the tuner i2c address */
161 0, /* EEProm unknown */
162 0, /* size unknown */
163 { 0x02, 0x01, 0x00, 0x0a, 1 }, /* audio MUX values */
164 0x0f }, /* GPIO mask */
166 { CARD_HAUPPAUGE, /* the card id */
167 "Hauppauge WinCast/TV", /* the 'name' */
168 NULL, /* the tuner */
169 0, /* the tuner i2c address */
170 0, /* dbx is optional */
173 PFC8582_WADDR, /* EEProm type */
174 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
175 { 0x00, 0x02, 0x01, 0x04, 1 }, /* audio MUX values */
176 0x0f }, /* GPIO mask */
178 { CARD_STB, /* the card id */
179 "STB TV/PCI", /* the 'name' */
180 NULL, /* the tuner */
181 0, /* the tuner i2c address */
182 0, /* dbx is optional */
185 X24C01_WADDR, /* EEProm type */
186 (u_char)(128 / EEPROMBLOCKSIZE), /* 128 bytes */
187 { 0x00, 0x01, 0x02, 0x02, 1 }, /* audio MUX values */
188 0x0f }, /* GPIO mask */
190 { CARD_INTEL, /* the card id */
191 "Intel Smart Video III/VideoLogic Captivator PCI", /* the 'name' */
192 NULL, /* the tuner */
193 0, /* the tuner i2c address */
199 { 0, 0, 0, 0, 0 }, /* audio MUX values */
200 0x00 }, /* GPIO mask */
202 { CARD_IMS_TURBO, /* the card id */
203 "IMS TV Turbo", /* the 'name' */
204 NULL, /* the tuner */
205 0, /* the tuner i2c address */
206 0, /* dbx is optional */
209 PFC8582_WADDR, /* EEProm type */
210 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
211 { 0x01, 0x02, 0x01, 0x00, 1 }, /* audio MUX values */
212 0x0f }, /* GPIO mask */
214 { CARD_AVER_MEDIA, /* the card id */
215 "AVer Media TV/FM", /* the 'name' */
216 NULL, /* the tuner */
217 0, /* the tuner i2c address */
218 0, /* dbx is optional */
223 { 0x0c, 0x08, 0x04, 0x00, 1 }, /* audio MUX values */
224 0x1f }, /* GPIO mask */
226 { CARD_OSPREY, /* the card id */
227 "MMAC Osprey", /* the 'name' */
228 NULL, /* the tuner */
229 0, /* the tuner i2c address */
230 0, /* dbx is optional */
233 PFC8582_WADDR, /* EEProm type */
234 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
235 { 0x00, 0x00, 0x00, 0x00, 0 }, /* audio MUX values */
238 { CARD_NEC_PK, /* the card id */
239 "NEC PK-UG-X017", /* the 'name' */
240 NULL, /* the tuner */
241 0, /* the tuner i2c address */
242 0, /* dbx is optional */
247 { 0x01, 0x02, 0x01, 0x00, 1 }, /* audio MUX values */
248 0x0f }, /* GPIO mask */
250 { CARD_IO_BCTV2, /* the card id */
251 "I/O DATA GV-BCTV2/PCI", /* the 'name' */
252 NULL, /* the tuner */
253 0, /* the tuner i2c address */
254 0, /* dbx is optional */
259 { 0x00, 0x00, 0x00, 0x00, 1 }, /* Has special MUX handler */
260 0x0f }, /* GPIO mask */
262 { CARD_FLYVIDEO, /* the card id */
263 "FlyVideo", /* the 'name' */
264 NULL, /* the tuner */
265 0, /* the tuner i2c address */
266 0, /* dbx is optional */
267 0, /* msp34xx is optional */
268 0, /* dpl3518a is optional */
269 0xac, /* EEProm type */
270 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
271 { 0x000, 0x800, 0x400, 0x8dff00, 1 },/* audio MUX values */
272 0x8dff00 }, /* GPIO mask */
274 { CARD_ZOLTRIX, /* the card id */
275 "Zoltrix", /* the 'name' */
276 NULL, /* the tuner */
277 0, /* the tuner i2c address */
278 0, /* dbx is optional */
279 0, /* msp34xx is optional */
280 0, /* dpl3518a is optional */
283 { 0x04, 0x01, 0x00, 0x0a, 1 }, /* audio MUX values */
284 0x0f }, /* GPIO mask */
286 { CARD_KISS, /* the card id */
287 "KISS TV/FM PCI", /* the 'name' */
288 NULL, /* the tuner */
289 0, /* the tuner i2c address */
290 0, /* dbx is optional */
291 0, /* msp34xx is optional */
292 0, /* dpl3518a is optional */
295 { 0x0c, 0x00, 0x0b, 0x0b, 1 }, /* audio MUX values */
296 0x0f }, /* GPIO mask */
298 { CARD_VIDEO_HIGHWAY_XTREME, /* the card id */
299 "Video Highway Xtreme", /* the 'name' */
300 NULL, /* the tuner */
307 { 0x00, 0x02, 0x01, 0x04, 1 }, /* audio MUX values */
308 0x0f }, /* GPIO mask */
310 { CARD_ASKEY_DYNALINK_MAGIC_TVIEW, /* the card id */
311 "Askey/Dynalink Magic TView", /* the 'name' */
312 NULL, /* the tuner */
319 { 0x400, 0xE00, 0x400, 0xC00, 1 }, /* audio MUX values */
320 0xE00 }, /* GPIO mask */
322 { CARD_LEADTEK, /* the card id */
323 "Leadtek Winfast TV 2000", /* the 'name' */
324 NULL, /* the tuner */
331 /* Tuner, Extern, Intern, Mute, Enabled */
332 { 0x621000, 0x621000, 0x621000, 0xE21000, 1 }, /* audio MUX values */
333 0xfff000 }, /* GPIO mask */
335 { CARD_TERRATVPLUS, /* the card id */
336 "TerraTVplus", /* the 'name' */
337 NULL, /* the tuner */
344 { 0x20000, 0x00000, 0x30000, 0x40000, 1 }, /* audio MUX values*/
345 0x70000 }, /* GPIO mask */
347 { CARD_IO_BCTV3, /* the card id */
348 "I/O DATA GV-BCTV3/PCI", /* the 'name' */
349 NULL, /* the tuner */
350 0, /* the tuner i2c address */
351 0, /* dbx is optional */
356 /* Tuner, Extern, Intern, Mute, Enabled */
357 { 0x10000, 0, 0x10000, 0, 1 }, /* audio MUX values */
358 0x10f00 }, /* GPIO mask */
360 { CARD_AOPEN_VA1000, /* the card id */
361 "AOpen VA1000", /* the 'name' */
362 NULL, /* the tuner */
363 0, /* the tuner i2c address */
364 0, /* dbx is optional */
367 0, /* EEProm unknown */
368 0, /* size unknown */
369 { 0x02, 0x00, 0x00, 0x00, 1 }, /* audio MUX values */
370 0x18e0 }, /* GPIO mask */
372 { CARD_PINNACLE_PCTV_RAVE, /* the card id */
373 "Pinnacle PCTV Rave", /* the 'name' */
374 NULL, /* the tuner */
375 0, /* the tuner i2c address */
379 0, /* EEProm unknown */
380 0, /* size unknown */
381 { 0x02, 0x01, 0x00, 0x0a, 1 }, /* audio MUX values */
382 0x03000F }, /* GPIO mask */
384 { CARD_PIXELVIEW_PLAYTV_PAK, /* the card id */
385 "PixelView PlayTV Pak", /* the 'name' */
386 NULL, /* the tuner */
387 0, /* the tuner i2c address */
388 0, /* dbx is optional */
391 PFC8582_WADDR, /* EEProm type */
392 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
393 { 0x20000, 0x80000, 0, 0xa8000, 1 }, /* audio MUX values */
394 0xAA0000 }, /* GPIO mask */
396 { CARD_TERRATVALUE, /* the card id */
397 "TerraTec TValue", /* the 'name' */
398 NULL, /* the tuner */
399 0, /* the tuner i2c address */
400 0, /* dbx is optional */
405 /* Tuner, Extern, Intern, Mute, Enabled */
406 { 0x500, 0x900, 0x300, 0x900, 1 }, /* audio MUX values */
407 0xffff00 }, /* GPIO mask */
409 { CARD_PIXELVIEW_PLAYTV_PRO_REV_4C, /* the card id */
410 "PixelView PlayTV Pro REV-4C ", /* the 'name' */
411 NULL, /* the tuner */
412 0, /* the tuner i2c address */
413 0, /* dbx is optional */
418 { 0x01, 0x04, 0x01, 0x03, 1 }, /* audio MUX values */
422 struct bt848_card_sig bt848_card_signature[1]= {
423 /* IMS TURBO TV : card 5 */
424 { 5,9, {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 00, 00}}
431 * Write to the configuration EEPROM on the card.
432 * This is dangerous and will mess up your card. Therefore it is not
436 writeEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data )
442 * Read the contents of the configuration EEPROM on the card.
443 * (This is not fitted to all makes of card. All Hauppauge cards have them
444 * and so do newer Bt878 based cards.
447 readEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data )
454 /* get the address of the EEProm */
455 addr = (int)(bktr->card.eepromAddr & 0xff);
459 max = (int)(bktr->card.eepromSize * EEPROMBLOCKSIZE);
460 if ( (offset + count) > max )
463 /* set the start address */
464 if ( i2cWrite( bktr, addr, offset, -1 ) == -1 )
468 for ( x = 0; x < count; ++x ) {
469 if ( (byte = i2cRead( bktr, (addr | 1) )) == -1 )
481 * get a signature of the card
482 * read all 128 possible i2c read addresses from 0x01 thru 0xff
483 * build a bit array with a 1 bit for each i2c device that responds
485 * XXX FIXME: use offset & count args
488 signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig )
492 for ( x = 0; x < 16; ++x )
495 for ( x = 0; x < count; ++x ) {
496 if ( i2cRead( bktr, (2 * x) + 1 ) != ABSENT ) {
497 sig[ x / 8 ] |= (1 << (x % 8) );
506 * check_for_i2c_devices.
507 * Some BT848 cards have no tuner and no additional i2c devices
508 * eg stereo decoder. These are used for video conferencing or capture from
509 * a video camera. (eg VideoLogic Captivator PCI, Intel SmartCapture card).
511 * Determine if there are any i2c devices present. There are none present if
512 * a) reading from all 128 devices returns ABSENT (-1) for each one
513 * (eg VideoLogic Captivator PCI with BT848)
514 * b) reading from all 128 devices returns 0 for each one
515 * (eg VideoLogic Captivator PCI rev. 2F with BT848A)
517 static int check_for_i2c_devices( bktr_ptr_t bktr ){
520 int i2c_all_absent = 1;
521 for ( x = 0; x < 128; ++x ) {
522 temp_read = i2cRead( bktr, (2 * x) + 1 );
523 if (temp_read != 0) i2c_all_0 = 0;
524 if (temp_read != ABSENT) i2c_all_absent = 0;
527 if ((i2c_all_0) || (i2c_all_absent)) return 0;
533 * Temic/Philips datasheets say tuners can be at i2c addresses 0xc0, 0xc2,
534 * 0xc4 or 0xc6, settable by links on the tuner.
535 * Determine the actual address used on the TV card by probing read addresses.
537 static int locate_tuner_address( bktr_ptr_t bktr) {
538 if (i2cRead( bktr, 0xc1) != ABSENT) return 0xc0;
539 if (i2cRead( bktr, 0xc3) != ABSENT) return 0xc2;
540 if (i2cRead( bktr, 0xc5) != ABSENT) return 0xc4;
541 if (i2cRead( bktr, 0xc7) != ABSENT) return 0xc6;
542 return -1; /* no tuner found */
547 * Search for a configuration EEPROM on the i2c bus by looking at i2c addresses
548 * where EEPROMs are usually found.
549 * On some cards, the EEPROM appears in several locations, but all in the
550 * range 0xa0 to 0xae.
552 static int locate_eeprom_address( bktr_ptr_t bktr) {
553 if (i2cRead( bktr, 0xa0) != ABSENT) return 0xa0;
554 if (i2cRead( bktr, 0xac) != ABSENT) return 0xac;
555 if (i2cRead( bktr, 0xae) != ABSENT) return 0xae;
556 return -1; /* no eeprom found */
561 * determine the card brand/model
562 * BKTR_OVERRIDE_CARD, BKTR_OVERRIDE_TUNER, BKTR_OVERRIDE_DBX and
563 * BKTR_OVERRIDE_MSP can be used to select a specific device,
564 * regardless of the autodetection and i2c device checks.
566 * The scheme used for probing cards faces these problems:
567 * It is impossible to work out which type of tuner is actually fitted,
568 * (the driver cannot tell if the Tuner is PAL or NTSC, Temic or Philips)
569 * It is impossible to determine what audio-mux hardware is connected.
570 * It is impossible to determine if there is extra hardware connected to the
571 * GPIO pins (eg radio chips or MSP34xx reset logic)
573 * However some makes of card (eg Hauppauge) come with a configuration eeprom
574 * which tells us the make of the card. Most eeproms also tell us the
575 * tuner type and other features of the cards.
577 * The current probe code works as follows
578 * A) If the card uses a Bt878/879:
579 * 1) Read the sub-system vendor id from the configuration EEPROM.
580 * Select the required tuner, audio mux arrangement and any other
581 * onboard features. If this fails, move to step B.
582 * B) If it card uses a Bt848, 848A, 849A or an unknown Bt878/879:
583 * 1) Look for I2C devices. If there are none fitted, it is an Intel or
585 * 2) Look for a configuration EEPROM.
586 * 2a) If there is one at I2C address 0xa0 it may be
587 * a Hauppauge or an Osprey. Check the EEPROM contents to determine which
588 * one it is. For Hauppauge, select the tuner type and audio hardware.
589 * 2b) If there is an EEPROM at I2C address 0xa8 it will be an STB card.
590 * We still have to guess on the tuner type.
592 * C) If we do not know the card type from (A) or (B), guess at the tuner
593 * type based on the I2C address of the tuner.
595 * D) After determining the Tuner Type, we probe the i2c bus for other
596 * devices at known locations, eg IR-Remote Control, MSP34xx and TDA
602 * These are the sub-system vendor ID codes stored in the
603 * configuration EEPROM used on Bt878/879 cards. They should match the
604 * number assigned to the company by the PCI Special Interest Group
607 #define PCI_VENDOR_HAUPPAUGE 0x0070
608 #define PCI_VENDOR_AVERMEDIA 0x1461
609 #define PCI_VENDOR_STB 0x10B4
610 #define PCI_VENDOR_ASKEY 0x144F
611 #define PCI_VENDOR_TERRATEC 0x153B
613 /* Following not confirmed with http://members.hyperlink.net.au/~chart,
614 so not added to NetBSD's pcidevs */
615 #define PCI_VENDOR_LEADTEK_ALT 0x6606
616 #define PCI_VENDOR_LEADTEK_ALT_2 0x6607
617 #define PCI_VENDOR_LEADTEK_ALT_3 0x107d
618 #define PCI_VENDOR_FLYVIDEO 0x1851
619 #define PCI_VENDOR_FLYVIDEO_2 0x1852
620 #define PCI_VENDOR_IODATA 0x10fc
621 #define PCI_VENDOR_PINNACLE_ALT 0xBD11 /* They got their own ID backwards? */
622 #define PCI_VENDOR_PINNACLE_NEW 0x11BD
624 #define MODEL_IODATA_GV_BCTV3_PCI 0x4020
625 #define MODEL_TERRATVALUE_1117 0x1117
626 #define MODEL_TERRATVALUE_1118 0x1118
627 #define MODEL_TERRATVALUE_1119 0x1119
628 #define MODEL_TERRATVALUE_111A 0x111a
629 #define MODEL_TERRATVALUE_1134 0x1134
632 probeCard( bktr_ptr_t bktr, int verbose, int unit )
634 int card, i,j, card_found;
636 u_char probe_signature[128], *probe_temp;
639 int tuner_i2c_address = -1;
640 int eeprom_i2c_address = -1;
642 /* Select all GPIO bits as inputs */
643 OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
645 printf("%s: GPIO is 0x%08x\n", bktr_name(bktr),
646 INL(bktr, BKTR_GPIO_DATA));
648 #ifdef HAUPPAUGE_MSP_RESET
649 /* Reset the MSP34xx audio chip. This resolves bootup card
650 * detection problems with old Bt848 based Hauppauge cards with
651 * MSP34xx stereo audio chips. This must be user enabled because
652 * at this point the probe function does not know the card type. */
653 OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) | (1<<5));
654 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */
655 DELAY(2500); /* wait 2.5ms */
656 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) & ~(1<<5)); /* write '0' */
657 DELAY(2500); /* wait 2.5ms */
658 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */
659 DELAY(2500); /* wait 2.5ms */
662 /* Check for the presence of i2c devices */
663 any_i2c_devices = check_for_i2c_devices( bktr );
666 /* Check for a user specified override on the card selection */
667 #if defined( BKTR_OVERRIDE_CARD )
668 bktr->card = cards[ (card = BKTR_OVERRIDE_CARD) ];
671 if (bktr->bt848_card != -1 ) {
672 bktr->card = cards[ (card = bktr->bt848_card) ];
677 /* No override, so try and determine the make of the card */
679 /* On BT878/879 cards, read the sub-system vendor id */
680 /* This identifies the manufacturer of the card and the model */
681 /* In theory this can be read from PCI registers but this does not */
682 /* appear to work on the FlyVideo 98. Hauppauge also warned that */
683 /* the PCI registers are sometimes not loaded correctly. */
684 /* Therefore, I will read the sub-system vendor ID from the EEPROM */
685 /* (just like the Bt878 does during power up initialisation) */
687 if ((bktr->id==BROOKTREE_878) || (bktr->id==BROOKTREE_879)) {
688 /* Try and locate the EEPROM */
689 eeprom_i2c_address = locate_eeprom_address( bktr );
690 if (eeprom_i2c_address != -1) {
692 unsigned int subsystem_vendor_id; /* vendors PCI-SIG ID */
693 unsigned int subsystem_id; /* board model number */
694 unsigned int byte_252, byte_253, byte_254, byte_255;
696 bktr->card = cards[ (card = CARD_UNKNOWN) ];
697 bktr->card.eepromAddr = eeprom_i2c_address;
698 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
700 readEEProm(bktr, 0, 256, (u_char *) &eeprom );
701 byte_252 = (unsigned int)eeprom[252];
702 byte_253 = (unsigned int)eeprom[253];
703 byte_254 = (unsigned int)eeprom[254];
704 byte_255 = (unsigned int)eeprom[255];
706 subsystem_id = (byte_252 << 8) | byte_253;
707 subsystem_vendor_id = (byte_254 << 8) | byte_255;
710 printf("%s: subsystem 0x%04x 0x%04x\n", bktr_name(bktr),
711 subsystem_vendor_id, subsystem_id);
713 if (subsystem_vendor_id == PCI_VENDOR_AVERMEDIA) {
714 bktr->card = cards[ (card = CARD_AVER_MEDIA) ];
715 bktr->card.eepromAddr = eeprom_i2c_address;
716 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
720 if (subsystem_vendor_id == PCI_VENDOR_HAUPPAUGE) {
721 bktr->card = cards[ (card = CARD_HAUPPAUGE) ];
722 bktr->card.eepromAddr = eeprom_i2c_address;
723 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
727 if ((subsystem_vendor_id == PCI_VENDOR_FLYVIDEO)
728 || (subsystem_vendor_id == PCI_VENDOR_FLYVIDEO_2) ) {
729 bktr->card = cards[ (card = CARD_FLYVIDEO) ];
730 bktr->card.eepromAddr = eeprom_i2c_address;
731 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
735 if (subsystem_vendor_id == PCI_VENDOR_STB) {
736 bktr->card = cards[ (card = CARD_STB) ];
737 bktr->card.eepromAddr = eeprom_i2c_address;
738 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
742 if (subsystem_vendor_id == PCI_VENDOR_ASKEY) {
743 bktr->card = cards[ (card = CARD_ASKEY_DYNALINK_MAGIC_TVIEW) ];
744 bktr->card.eepromAddr = eeprom_i2c_address;
745 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
749 if ((subsystem_vendor_id == PCI_VENDOR_LEADTEK_ALT)
750 || (subsystem_vendor_id == PCI_VENDOR_LEADTEK_ALT_2)
751 || (subsystem_vendor_id == PCI_VENDOR_LEADTEK_ALT_3)) {
752 bktr->card = cards[ (card = CARD_LEADTEK) ];
753 bktr->card.eepromAddr = eeprom_i2c_address;
754 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
758 if (subsystem_vendor_id == PCI_VENDOR_PINNACLE_ALT ||
759 subsystem_vendor_id == PCI_VENDOR_PINNACLE_NEW) {
760 bktr->card = cards[ (card = CARD_MIRO) ];
761 bktr->card.eepromAddr = eeprom_i2c_address;
762 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
766 if (subsystem_vendor_id == PCI_VENDOR_IODATA &&
767 subsystem_id == MODEL_IODATA_GV_BCTV3_PCI) {
768 bktr->card = cards[ (card = CARD_IO_BCTV3) ];
769 bktr->card.eepromAddr = eeprom_i2c_address;
770 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
774 if (subsystem_vendor_id == PCI_VENDOR_TERRATEC) {
775 switch (subsystem_id) {
776 case MODEL_TERRATVALUE_1117:
777 case MODEL_TERRATVALUE_1118:
778 case MODEL_TERRATVALUE_1119:
779 case MODEL_TERRATVALUE_111A:
780 case MODEL_TERRATVALUE_1134:
781 bktr->card = cards[ (card = CARD_TERRATVALUE) ];
782 bktr->card.eepromAddr = eeprom_i2c_address;
783 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
788 /* Vendor is unknown. We will use the standard probe code */
789 /* which may not give best results */
790 printf("%s: Warning - card vendor 0x%04x (model 0x%04x) unknown.\n",
791 bktr_name(bktr), subsystem_vendor_id, subsystem_id);
795 printf("%s: Card has no configuration EEPROM. Cannot determine card make.\n",
798 } /* end of bt878/bt879 card detection code */
800 /* If we get to this point, we must have a Bt848/848A/849A card */
801 /* or a Bt878/879 with an unknown subsystem vendor id */
802 /* Try and determine the make of card by clever i2c probing */
804 /* Check for i2c devices. If none, move on */
805 if (!any_i2c_devices) {
806 bktr->card = cards[ (card = CARD_INTEL) ];
807 bktr->card.eepromAddr = 0;
808 bktr->card.eepromSize = 0;
812 /* Look for Hauppauge, STB and Osprey cards by the presence */
814 /* Note: Bt878 based cards also use EEPROMs so we can only do this */
815 /* test on BT848/848A and 849A based cards. */
816 if ((bktr->id==BROOKTREE_848) ||
817 (bktr->id==BROOKTREE_848A) ||
818 (bktr->id==BROOKTREE_849A)) {
820 /* At i2c address 0xa0, look for Hauppauge and Osprey cards */
821 if ( (status = i2cRead( bktr, PFC8582_RADDR )) != ABSENT ) {
823 /* Read the eeprom contents */
824 bktr->card = cards[ (card = CARD_UNKNOWN) ];
825 bktr->card.eepromAddr = PFC8582_WADDR;
826 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
827 readEEProm(bktr, 0, 128, (u_char *) &eeprom );
829 /* For Hauppauge, check the EEPROM begins with 0x84 */
830 if (eeprom[0] == 0x84) {
831 bktr->card = cards[ (card = CARD_HAUPPAUGE) ];
832 bktr->card.eepromAddr = PFC8582_WADDR;
833 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
837 /* For Osprey, check the EEPROM begins with "MMAC" */
838 if ( (eeprom[0] == 'M') &&(eeprom[1] == 'M')
839 &&(eeprom[2] == 'A') &&(eeprom[3] == 'C')) {
840 bktr->card = cards[ (card = CARD_OSPREY) ];
841 bktr->card.eepromAddr = PFC8582_WADDR;
842 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
845 printf("%s: Warning: Unknown card type. EEPROM data not recognised\n",
847 printf("%s: %x %x %x %x\n", bktr_name(bktr),
848 eeprom[0],eeprom[1],eeprom[2],eeprom[3]);
851 /* look for an STB card */
852 if ( (status = i2cRead( bktr, X24C01_RADDR )) != ABSENT ) {
853 bktr->card = cards[ (card = CARD_STB) ];
854 bktr->card.eepromAddr = X24C01_WADDR;
855 bktr->card.eepromSize = (u_char)(128 / EEPROMBLOCKSIZE);
861 signCard( bktr, 1, 128, (u_char *) &probe_signature );
864 printf("%s: card signature: ", bktr_name(bktr));
865 for (j = 0; j < Bt848_MAX_SIGN; j++) {
866 printf(" %02x ", probe_signature[j]);
871 i < (sizeof bt848_card_signature)/ sizeof (struct bt848_card_sig);
875 probe_temp = (u_char *) &bt848_card_signature[i].signature;
877 for (j = 0; j < Bt848_MAX_SIGN; j++) {
878 if ((probe_temp[j] & 0xf) != (probe_signature[j] & 0xf)) {
885 bktr->card = cards[ card = bt848_card_signature[i].card];
886 eeprom_i2c_address = locate_eeprom_address( bktr );
887 if (eeprom_i2c_address != -1) {
888 bktr->card.eepromAddr = eeprom_i2c_address;
889 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
891 bktr->card.eepromAddr = 0;
892 bktr->card.eepromSize = 0;
894 tuner_i2c_address = locate_tuner_address( bktr );
895 select_tuner( bktr, bt848_card_signature[i].tuner );
900 /* We do not know the card type. Default to Miro */
901 bktr->card = cards[ (card = CARD_MIRO) ];
905 /* look for a configuration eeprom */
906 eeprom_i2c_address = locate_eeprom_address( bktr );
907 if (eeprom_i2c_address != -1) {
908 bktr->card.eepromAddr = eeprom_i2c_address;
909 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
911 bktr->card.eepromAddr = 0;
912 bktr->card.eepromSize = 0;
918 #if !defined( BKTR_OVERRIDE_TUNER )
919 if (card == CARD_MIRO && mt2032_init(bktr) == 0 &&
920 bktr->bt848_tuner == -1) {
921 bktr->card = cards[ (card = CARD_PINNACLE_PCTV_RAVE) ];
922 select_tuner( bktr, TUNER_MT2032 );
927 /* look for a tuner */
928 tuner_i2c_address = locate_tuner_address( bktr );
929 if ( tuner_i2c_address == -1 ) {
930 select_tuner( bktr, NO_TUNER );
934 #if defined( BKTR_OVERRIDE_TUNER )
935 select_tuner( bktr, BKTR_OVERRIDE_TUNER );
938 if (bktr->bt848_tuner != -1 ) {
939 select_tuner( bktr, bktr->bt848_tuner & 0xff );
943 /* Check for i2c devices */
944 if (!any_i2c_devices) {
945 select_tuner( bktr, NO_TUNER );
949 /* differentiate type of tuner */
953 switch (((INL(bktr, BKTR_GPIO_DATA) >> 10)-1)&7) {
954 case 0: select_tuner( bktr, TEMIC_PAL ); break;
955 case 1: select_tuner( bktr, PHILIPS_PAL ); break;
956 case 2: select_tuner( bktr, PHILIPS_NTSC ); break;
957 case 3: select_tuner( bktr, PHILIPS_SECAM ); break;
958 case 4: select_tuner( bktr, NO_TUNER ); break;
959 case 5: select_tuner( bktr, PHILIPS_PALI ); break;
960 case 6: select_tuner( bktr, TEMIC_NTSC ); break;
961 case 7: select_tuner( bktr, TEMIC_PALI ); break;
967 /* Hauppauge kindly supplied the following Tuner Table */
968 /* FIXME: I think the tuners the driver selects for types */
969 /* 0x08 and 0x15 may be incorrect but no one has complained. */
970 /* Old Temic tuners had their own API, but newer Temic tuners */
971 /* have the same API as Philips tuners */
973 ID Tuner Model Format We select Format
977 0x03 Philips FI1216 BG
978 0x04 Philips FI1216MF BGLL' PHILIPS_SECAM
979 0x05 Philips FI1236 MN PHILIPS_NTSC
980 0x06 Philips FI1246 I PHILIPS_PALI
981 0x07 Philips FI1256 DK
982 0x08 Philips FI1216 MK2 BG PHILIPS_PALI
983 0x09 Philips FI1216MF MK2 BGLL' PHILIPS_SECAM
984 0x0a Philips FI1236 MK2 MN PHILIPS_NTSC
985 0x0b Philips FI1246 MK2 I PHILIPS_PALI
986 0x0c Philips FI1256 MK2 DK
987 0x0d Temic 4032FY5 NTSC TEMIC_NTSC
988 0x0e Temic 4002FH5 BG TEMIC_PAL
989 0x0f Temic 4062FY5 I TEMIC_PALI
990 0x10 Philips FR1216 MK2 BG
991 0x11 Philips FR1216MF MK2 BGLL' PHILIPS_FR1236_SECAM
992 0x12 Philips FR1236 MK2 MN PHILIPS_FR1236_NTSC
993 0x13 Philips FR1246 MK2 I
994 0x14 Philips FR1256 MK2 DK
995 0x15 Philips FM1216 BG PHILIPS_FR1216_PAL
996 0x16 Philips FM1216MF BGLL' PHILIPS_FR1236_SECAM
997 0x17 Philips FM1236 MN PHILIPS_FR1236_NTSC
998 0x18 Philips FM1246 I
999 0x19 Philips FM1256 DK
1000 0x1a Temic 4036FY5 MN (FI1236 MK2 clone) PHILIPS_NTSC
1001 0x1b Samsung TCPN9082D MN
1002 0x1c Samsung TCPM9092P Pal BG/I/DK
1003 0x1d Temic 4006FH5 BG PHILIPS_PALI
1004 0x1e Samsung TCPN9085D MN/Radio
1005 0x1f Samsung TCPB9085P Pal BG/I/DK / Radio
1006 0x20 Samsung TCPL9091P Pal BG & Secam L/L'
1007 0x21 Temic 4039FY5 NTSC Radio
1008 0x22 Philips FQ1216ME Pal BGIDK & Secam L/L'
1009 0x23 Temic 4066FY5 Pal I (FI1246 MK2 clone) PHILIPS_PALI
1010 0x24 Philips TD1536 MN/ATSCDigital
1011 0x25 Philips TD1536D MN/ATSCDigital DUAL INPUT
1012 0x26 Philips FMR1236 M/N FM(no demod)
1013 0x27 Philips FI1256MP B/G, D/K
1014 0x28 Samsung TCPQ9091P BG/I/DK, L/L'
1015 0x29 Temic 4006FN5 BG/I/DK
1016 0x2a Temic 4009FR5 BG FM PHILIPS_FR1216_PAL
1017 0x2b Temic 4046FM5 B/G, I, D/K, L/L'
1018 0x2c Temic 4009FN5 B/G, I, D/K, FM (no demod)
1019 0x2d Philips TD1536D_FH_44 MN/ATSCDigital DUAL INPUT
1023 /* Determine the model number from the eeprom */
1024 if (bktr->card.eepromAddr != 0) {
1025 /* eeprom data block structure */
1026 unsigned char *block_1, *block_2, *block_3, *block_4;
1027 int block_1_data_size, block_2_data_size, block_3_data_size;
1028 int block_1_total_size, block_2_total_size, block_3_total_size;
1029 int block_4_header_size;
1031 unsigned int model,revision;
1032 unsigned char tuner_code;
1033 unsigned char no_audio_mux;
1035 readEEProm(bktr, 0, 128, (u_char *) &eeprom );
1037 /* LOCATE THE EEPROM DATA BLOCKS */
1038 block_1 = &eeprom[0];
1039 block_1_data_size = (block_1[2] << 8 | block_1[1]);
1040 block_1_total_size = block_1_data_size + 3; /* Header bytes */
1042 block_2 = &eeprom[block_1_total_size];
1043 block_2_data_size = (block_2[2] << 8 | block_2[1]);
1044 block_2_total_size = block_2_data_size + 3; /* Header bytes */
1046 block_3 = &eeprom[block_1_total_size + block_2_total_size];
1047 block_3_data_size = (block_3[0] &0x07);
1048 block_3_total_size = block_3_data_size + 1; /* Header size */
1050 block_4 = &eeprom[block_1_total_size +block_2_total_size +block_3_total_size];
1051 block_4_header_size = 1;
1053 model = (block_1[12] << 8 | block_1[11]);
1054 revision = (block_1[15] << 16 | block_1[14] << 8 | block_1[13]);
1056 tuner_code = block_1[9];
1058 no_audio_mux = ((block_3[3] >> 7) &0x01);
1060 if (no_audio_mux) bktr->audio_mux_present = 0;
1063 printf("%s: Hauppauge Model %d %c%c%c%c\n",
1066 ((revision >> 18) & 0x3f) + 32,
1067 ((revision >> 12) & 0x3f) + 32,
1068 ((revision >> 6) & 0x3f) + 32,
1069 ((revision >> 0) & 0x3f) + 32 );
1071 /* Determine the tuner type from the eeprom */
1073 switch (tuner_code) {
1078 select_tuner( bktr, PHILIPS_NTSC );
1083 select_tuner( bktr, PHILIPS_SECAM );
1088 select_tuner( bktr, PHILIPS_FR1236_SECAM );
1094 select_tuner( bktr, PHILIPS_FR1236_NTSC );
1102 select_tuner( bktr, PHILIPS_PALI );
1106 select_tuner( bktr, TEMIC_NTSC );
1110 select_tuner( bktr, TEMIC_PAL );
1114 select_tuner( bktr, TEMIC_PALI );
1118 select_tuner( bktr, PHILIPS_FR1216_PAL );
1122 bktr->msp_use_mono_source = 1;
1123 select_tuner( bktr, PHILIPS_FR1216_PAL );
1127 printf("%s: Warning - Unknown Hauppauge Tuner 0x%x\n",
1128 bktr_name(bktr), tuner_code);
1134 case CARD_AVER_MEDIA:
1135 /* AVerMedia kindly supplied some details of their EEPROM contents
1136 * which allow us to auto select the Tuner Type.
1137 * Only the newer AVerMedia cards actually have an EEPROM.
1139 if (bktr->card.eepromAddr != 0) {
1141 u_char tuner_make; /* Eg Philips, Temic */
1142 u_char tuner_tv_fm; /* TV or TV with FM Radio */
1143 u_char tuner_format; /* Eg NTSC, PAL, SECAM */
1146 int tuner_0_table[] = {
1147 PHILIPS_NTSC, PHILIPS_PAL,
1148 PHILIPS_PAL, PHILIPS_PAL,
1149 PHILIPS_PAL, PHILIPS_PAL,
1150 PHILIPS_SECAM, PHILIPS_SECAM,
1151 PHILIPS_SECAM, PHILIPS_PAL};
1153 int tuner_0_fm_table[] = {
1154 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL,
1155 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
1156 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
1157 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
1158 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
1160 int tuner_1_table[] = {
1161 TEMIC_NTSC, TEMIC_PAL, TEMIC_PAL,
1162 TEMIC_PAL, TEMIC_PAL, TEMIC_PAL,
1163 TEMIC_SECAM, TEMIC_SECAM, TEMIC_SECAM,
1167 /* Extract information from the EEPROM data */
1168 readEEProm(bktr, 0, 128, (u_char *) &eeprom );
1170 tuner_make = (eeprom[0x41] & 0x7);
1171 tuner_tv_fm = (eeprom[0x41] & 0x18) >> 3;
1172 tuner_format = (eeprom[0x42] & 0xf0) >> 4;
1174 /* Treat tuner make 0 (Philips) and make 2 (LG) the same */
1175 if ( ((tuner_make == 0) || (tuner_make == 2))
1176 && (tuner_format <= 9) && (tuner_tv_fm == 0) ) {
1177 tuner = tuner_0_table[tuner_format];
1178 select_tuner( bktr, tuner );
1182 if ( ((tuner_make == 0) || (tuner_make == 2))
1183 && (tuner_format <= 9) && (tuner_tv_fm == 1) ) {
1184 tuner = tuner_0_fm_table[tuner_format];
1185 select_tuner( bktr, tuner );
1189 if ( (tuner_make == 1) && (tuner_format <= 9) ) {
1190 tuner = tuner_1_table[tuner_format];
1191 select_tuner( bktr, tuner );
1195 printf("%s: Warning - Unknown AVerMedia Tuner Make %d Format %d\n",
1196 bktr_name(bktr), tuner_make, tuner_format);
1201 #if defined(BKTR_SYSTEM_DEFAULT) && BKTR_SYSTEM_DEFAULT == BROOKTREE_PAL
1202 select_tuner( bktr, PHILIPS_FR1216_PAL );
1204 select_tuner( bktr, PHILIPS_FR1236_NTSC );
1210 select_tuner( bktr, ALPS_TSCH5 ); /* ALPS_TSCH6, in fact. */
1214 case CARD_TERRATVALUE:
1215 select_tuner( bktr, PHILIPS_PAL); /* Phlips PAL tuner */
1219 } /* end switch(card) */
1222 /* At this point, a goto checkDBX has not occurred */
1223 /* We have not been able to select a Tuner */
1224 /* Some cards make use of the tuner address to */
1225 /* identify the make/model of tuner */
1227 /* At address 0xc0/0xc1 we often find a TEMIC NTSC */
1228 if ( i2cRead( bktr, 0xc1 ) != ABSENT ) {
1229 select_tuner( bktr, TEMIC_NTSC );
1233 /* At address 0xc6/0xc7 we often find a PHILIPS NTSC Tuner */
1234 if ( i2cRead( bktr, 0xc7 ) != ABSENT ) {
1235 select_tuner( bktr, PHILIPS_NTSC );
1239 /* Address 0xc2/0xc3 is default (or common address) for several */
1240 /* tuners and we cannot tell which is which. */
1241 /* And for all other tuner i2c addresses, select the default */
1242 select_tuner( bktr, DEFAULT_TUNER );
1246 #if defined( BKTR_OVERRIDE_DBX )
1247 bktr->card.dbx = BKTR_OVERRIDE_DBX;
1250 /* Check for i2c devices */
1251 if (!any_i2c_devices) {
1255 /* probe for BTSC (dbx) chip */
1256 if ( i2cRead( bktr, TDA9850_RADDR ) != ABSENT )
1260 /* If this is a Hauppauge Bt878 card, we need to enable the
1261 * MSP 34xx audio chip.
1262 * If this is a Hauppauge Bt848 card, reset the MSP device.
1263 * The MSP reset line is wired to GPIO pin 5. On Bt878 cards a pulldown
1264 * resistor holds the device in reset until we set GPIO pin 5.
1267 /* Optionally skip the MSP reset. This is handy if you initialise the
1268 * MSP audio in another operating system (eg Windows) first and then
1272 #ifndef BKTR_NO_MSP_RESET
1273 if (card == CARD_HAUPPAUGE) {
1274 OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) | (1<<5));
1275 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */
1276 DELAY(2500); /* wait 2.5ms */
1277 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) & ~(1<<5)); /* write '0' */
1278 DELAY(2500); /* wait 2.5ms */
1279 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */
1280 DELAY(2500); /* wait 2.5ms */
1284 #if defined( BKTR_OVERRIDE_MSP )
1285 bktr->card.msp3400c = BKTR_OVERRIDE_MSP;
1289 /* Check for i2c devices */
1290 if (!any_i2c_devices) {
1294 if ( i2cRead( bktr, MSP3400C_RADDR ) != ABSENT ) {
1295 bktr->card.msp3400c = 1;
1300 if (bktr->card.msp3400c) {
1301 bktr->msp_addr = MSP3400C_WADDR;
1302 msp_read_id( bktr );
1303 printf("%s: Detected a MSP%s at 0x%x\n", bktr_name(bktr),
1304 bktr->msp_version_string,
1309 /* Check for Dolby Surround Sound DPL3518A sound chip */
1310 if ( i2cRead( bktr, DPL3518A_RADDR ) != ABSENT ) {
1311 bktr->card.dpl3518a = 1;
1314 if (bktr->card.dpl3518a) {
1315 bktr->dpl_addr = DPL3518A_WADDR;
1316 dpl_read_id( bktr );
1317 printf("%s: Detected a DPL%s at 0x%x\n", bktr_name(bktr),
1318 bktr->dpl_version_string,
1322 /* Start of Check Remote */
1323 /* Check for the Hauppauge IR Remote Control */
1324 /* If there is an external unit, the internal will be ignored */
1326 bktr->remote_control = 0; /* initial value */
1328 if (any_i2c_devices) {
1329 if (i2cRead( bktr, HAUP_REMOTE_EXT_RADDR ) != ABSENT )
1331 bktr->remote_control = 1;
1332 bktr->remote_control_addr = HAUP_REMOTE_EXT_RADDR;
1334 else if (i2cRead( bktr, HAUP_REMOTE_INT_RADDR ) != ABSENT )
1336 bktr->remote_control = 1;
1337 bktr->remote_control_addr = HAUP_REMOTE_INT_RADDR;
1341 /* If a remote control is found, poll it 5 times to turn off the LED */
1342 if (bktr->remote_control) {
1345 i2cRead( bktr, bktr->remote_control_addr );
1347 /* End of Check Remote */
1349 #if defined( BKTR_USE_PLL )
1350 bktr->xtal_pll_mode = BT848_USE_PLL;
1353 /* Default is to use XTALS and not PLL mode */
1354 bktr->xtal_pll_mode = BT848_USE_XTALS;
1356 /* Enable PLL mode for OSPREY users */
1357 if (card == CARD_OSPREY)
1358 bktr->xtal_pll_mode = BT848_USE_PLL;
1360 /* Enable PLL mode for Video Highway Xtreme users */
1361 if (card == CARD_VIDEO_HIGHWAY_XTREME)
1362 bktr->xtal_pll_mode = BT848_USE_PLL;
1365 /* Most (perhaps all) Bt878 cards need to be switched to PLL mode */
1366 /* as they only fit the NTSC crystal to their cards */
1367 /* Default to enabling PLL mode for all Bt878/879 cards */
1369 if ((bktr->id==BROOKTREE_878 || bktr->id==BROOKTREE_879) )
1370 bktr->xtal_pll_mode = BT848_USE_PLL;
1373 #if defined( BKTR_USE_PLL )
1378 bktr->card.tuner_pllAddr = tuner_i2c_address;
1381 printf( "%s: %s", bktr_name(bktr), bktr->card.name );
1382 if ( bktr->card.tuner )
1383 printf( ", %s tuner", bktr->card.tuner->name );
1384 if ( bktr->card.dbx )
1385 printf( ", dbx stereo" );
1386 if ( bktr->card.msp3400c )
1387 printf( ", msp3400c stereo" );
1388 if ( bktr->card.dpl3518a )
1389 printf( ", dpl3518a dolby" );
1390 if ( bktr->remote_control )
1391 printf( ", remote control" );