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 */
420 { CARD_LEADTEK_WINFAST_2000_XP, /* the card id */
421 "Leadtek Winfast 2000 XP", /* the 'name' */
422 NULL, /* the tuner */
423 0, /* the tuner i2c address */
424 0, /* dbx is optional */
427 0, /* EEProm unknown */
428 0, /* size unknown */
429 { 0x122000, 0x1000, 0x620000, 0x0000, 1 }, /* audio MUX values */
430 0xb33000 }, /* GPIO mask */
434 struct bt848_card_sig bt848_card_signature[1]= {
435 /* IMS TURBO TV : card 5 */
436 { 5,9, {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 00, 00}}
443 * Write to the configuration EEPROM on the card.
444 * This is dangerous and will mess up your card. Therefore it is not
448 writeEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data )
454 * Read the contents of the configuration EEPROM on the card.
455 * (This is not fitted to all makes of card. All Hauppauge cards have them
456 * and so do newer Bt878 based cards.
459 readEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data )
466 /* get the address of the EEProm */
467 addr = (int)(bktr->card.eepromAddr & 0xff);
471 max = (int)(bktr->card.eepromSize * EEPROMBLOCKSIZE);
472 if ( (offset + count) > max )
475 /* set the start address */
476 if ( i2cWrite( bktr, addr, offset, -1 ) == -1 )
480 for ( x = 0; x < count; ++x ) {
481 if ( (byte = i2cRead( bktr, (addr | 1) )) == -1 )
493 * get a signature of the card
494 * read all 128 possible i2c read addresses from 0x01 thru 0xff
495 * build a bit array with a 1 bit for each i2c device that responds
497 * XXX FIXME: use offset & count args
500 signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig )
504 for ( x = 0; x < 16; ++x )
507 for ( x = 0; x < count; ++x ) {
508 if ( i2cRead( bktr, (2 * x) + 1 ) != ABSENT ) {
509 sig[ x / 8 ] |= (1 << (x % 8) );
518 * check_for_i2c_devices.
519 * Some BT848 cards have no tuner and no additional i2c devices
520 * eg stereo decoder. These are used for video conferencing or capture from
521 * a video camera. (eg VideoLogic Captivator PCI, Intel SmartCapture card).
523 * Determine if there are any i2c devices present. There are none present if
524 * a) reading from all 128 devices returns ABSENT (-1) for each one
525 * (eg VideoLogic Captivator PCI with BT848)
526 * b) reading from all 128 devices returns 0 for each one
527 * (eg VideoLogic Captivator PCI rev. 2F with BT848A)
529 static int check_for_i2c_devices( bktr_ptr_t bktr ){
532 int i2c_all_absent = 1;
533 for ( x = 0; x < 128; ++x ) {
534 temp_read = i2cRead( bktr, (2 * x) + 1 );
535 if (temp_read != 0) i2c_all_0 = 0;
536 if (temp_read != ABSENT) i2c_all_absent = 0;
539 if ((i2c_all_0) || (i2c_all_absent)) return 0;
545 * Temic/Philips datasheets say tuners can be at i2c addresses 0xc0, 0xc2,
546 * 0xc4 or 0xc6, settable by links on the tuner.
547 * Determine the actual address used on the TV card by probing read addresses.
549 static int locate_tuner_address( bktr_ptr_t bktr) {
550 if (i2cRead( bktr, 0xc1) != ABSENT) return 0xc0;
551 if (i2cRead( bktr, 0xc3) != ABSENT) return 0xc2;
552 if (i2cRead( bktr, 0xc5) != ABSENT) return 0xc4;
553 if (i2cRead( bktr, 0xc7) != ABSENT) return 0xc6;
554 return -1; /* no tuner found */
559 * Search for a configuration EEPROM on the i2c bus by looking at i2c addresses
560 * where EEPROMs are usually found.
561 * On some cards, the EEPROM appears in several locations, but all in the
562 * range 0xa0 to 0xae.
564 static int locate_eeprom_address( bktr_ptr_t bktr) {
565 if (i2cRead( bktr, 0xa0) != ABSENT) return 0xa0;
566 if (i2cRead( bktr, 0xac) != ABSENT) return 0xac;
567 if (i2cRead( bktr, 0xae) != ABSENT) return 0xae;
568 return -1; /* no eeprom found */
573 * determine the card brand/model
574 * BKTR_OVERRIDE_CARD, BKTR_OVERRIDE_TUNER, BKTR_OVERRIDE_DBX and
575 * BKTR_OVERRIDE_MSP can be used to select a specific device,
576 * regardless of the autodetection and i2c device checks.
578 * The scheme used for probing cards faces these problems:
579 * It is impossible to work out which type of tuner is actually fitted,
580 * (the driver cannot tell if the Tuner is PAL or NTSC, Temic or Philips)
581 * It is impossible to determine what audio-mux hardware is connected.
582 * It is impossible to determine if there is extra hardware connected to the
583 * GPIO pins (eg radio chips or MSP34xx reset logic)
585 * However some makes of card (eg Hauppauge) come with a configuration eeprom
586 * which tells us the make of the card. Most eeproms also tell us the
587 * tuner type and other features of the cards.
589 * The current probe code works as follows
590 * A) If the card uses a Bt878/879:
591 * 1) Read the sub-system vendor id from the configuration EEPROM.
592 * Select the required tuner, audio mux arrangement and any other
593 * onboard features. If this fails, move to step B.
594 * B) If it card uses a Bt848, 848A, 849A or an unknown Bt878/879:
595 * 1) Look for I2C devices. If there are none fitted, it is an Intel or
597 * 2) Look for a configuration EEPROM.
598 * 2a) If there is one at I2C address 0xa0 it may be
599 * a Hauppauge or an Osprey. Check the EEPROM contents to determine which
600 * one it is. For Hauppauge, select the tuner type and audio hardware.
601 * 2b) If there is an EEPROM at I2C address 0xa8 it will be an STB card.
602 * We still have to guess on the tuner type.
604 * C) If we do not know the card type from (A) or (B), guess at the tuner
605 * type based on the I2C address of the tuner.
607 * D) After determining the Tuner Type, we probe the i2c bus for other
608 * devices at known locations, eg IR-Remote Control, MSP34xx and TDA
614 * These are the sub-system vendor ID codes stored in the
615 * configuration EEPROM used on Bt878/879 cards. They should match the
616 * number assigned to the company by the PCI Special Interest Group
619 #define PCI_VENDOR_HAUPPAUGE 0x0070
620 #define PCI_VENDOR_AVERMEDIA 0x1461
621 #define PCI_VENDOR_STB 0x10B4
622 #define PCI_VENDOR_ASKEY 0x144F
623 #define PCI_VENDOR_TERRATEC 0x153B
625 /* Following not confirmed with http://members.hyperlink.net.au/~chart,
626 so not added to NetBSD's pcidevs */
627 #define PCI_VENDOR_LEADTEK_ALT 0x6606
628 #define PCI_VENDOR_LEADTEK_ALT_2 0x6607
629 #define PCI_VENDOR_LEADTEK_ALT_3 0x107d
630 #define PCI_VENDOR_FLYVIDEO 0x1851
631 #define PCI_VENDOR_FLYVIDEO_2 0x1852
632 #define PCI_VENDOR_IODATA 0x10fc
633 #define PCI_VENDOR_PINNACLE_ALT 0xBD11 /* They got their own ID backwards? */
634 #define PCI_VENDOR_PINNACLE_NEW 0x11BD
636 #define MODEL_IODATA_GV_BCTV3_PCI 0x4020
637 #define MODEL_TERRATVALUE_1117 0x1117
638 #define MODEL_TERRATVALUE_1118 0x1118
639 #define MODEL_TERRATVALUE_1119 0x1119
640 #define MODEL_TERRATVALUE_111A 0x111a
641 #define MODEL_TERRATVALUE_1134 0x1134
644 probeCard( bktr_ptr_t bktr, int verbose, int unit )
646 int card, i,j, card_found;
648 u_char probe_signature[128], *probe_temp;
651 int tuner_i2c_address = -1;
652 int eeprom_i2c_address = -1;
654 /* Select all GPIO bits as inputs */
655 OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
657 printf("%s: GPIO is 0x%08x\n", bktr_name(bktr),
658 INL(bktr, BKTR_GPIO_DATA));
660 #ifdef HAUPPAUGE_MSP_RESET
661 /* Reset the MSP34xx audio chip. This resolves bootup card
662 * detection problems with old Bt848 based Hauppauge cards with
663 * MSP34xx stereo audio chips. This must be user enabled because
664 * at this point the probe function does not know the card type. */
665 OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) | (1<<5));
666 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */
667 DELAY(2500); /* wait 2.5ms */
668 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) & ~(1<<5)); /* write '0' */
669 DELAY(2500); /* wait 2.5ms */
670 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */
671 DELAY(2500); /* wait 2.5ms */
674 /* Check for the presence of i2c devices */
675 any_i2c_devices = check_for_i2c_devices( bktr );
678 /* Check for a user specified override on the card selection */
679 #if defined( BKTR_OVERRIDE_CARD )
680 bktr->card = cards[ (card = BKTR_OVERRIDE_CARD) ];
683 if (bktr->bt848_card != -1 ) {
684 bktr->card = cards[ (card = bktr->bt848_card) ];
689 /* No override, so try and determine the make of the card */
691 /* On BT878/879 cards, read the sub-system vendor id */
692 /* This identifies the manufacturer of the card and the model */
693 /* In theory this can be read from PCI registers but this does not */
694 /* appear to work on the FlyVideo 98. Hauppauge also warned that */
695 /* the PCI registers are sometimes not loaded correctly. */
696 /* Therefore, I will read the sub-system vendor ID from the EEPROM */
697 /* (just like the Bt878 does during power up initialisation) */
699 if ((bktr->id==BROOKTREE_878) || (bktr->id==BROOKTREE_879)) {
700 /* Try and locate the EEPROM */
701 eeprom_i2c_address = locate_eeprom_address( bktr );
702 if (eeprom_i2c_address != -1) {
704 unsigned int subsystem_vendor_id; /* vendors PCI-SIG ID */
705 unsigned int subsystem_id; /* board model number */
706 unsigned int byte_252, byte_253, byte_254, byte_255;
708 bktr->card = cards[ (card = CARD_UNKNOWN) ];
709 bktr->card.eepromAddr = eeprom_i2c_address;
710 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
712 readEEProm(bktr, 0, 256, (u_char *) &eeprom );
713 byte_252 = (unsigned int)eeprom[252];
714 byte_253 = (unsigned int)eeprom[253];
715 byte_254 = (unsigned int)eeprom[254];
716 byte_255 = (unsigned int)eeprom[255];
718 subsystem_id = (byte_252 << 8) | byte_253;
719 subsystem_vendor_id = (byte_254 << 8) | byte_255;
722 printf("%s: subsystem 0x%04x 0x%04x\n", bktr_name(bktr),
723 subsystem_vendor_id, subsystem_id);
725 if (subsystem_vendor_id == PCI_VENDOR_AVERMEDIA) {
726 bktr->card = cards[ (card = CARD_AVER_MEDIA) ];
727 bktr->card.eepromAddr = eeprom_i2c_address;
728 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
732 if (subsystem_vendor_id == PCI_VENDOR_HAUPPAUGE) {
733 bktr->card = cards[ (card = CARD_HAUPPAUGE) ];
734 bktr->card.eepromAddr = eeprom_i2c_address;
735 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
739 if ((subsystem_vendor_id == PCI_VENDOR_FLYVIDEO)
740 || (subsystem_vendor_id == PCI_VENDOR_FLYVIDEO_2) ) {
741 bktr->card = cards[ (card = CARD_FLYVIDEO) ];
742 bktr->card.eepromAddr = eeprom_i2c_address;
743 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
747 if (subsystem_vendor_id == PCI_VENDOR_STB) {
748 bktr->card = cards[ (card = CARD_STB) ];
749 bktr->card.eepromAddr = eeprom_i2c_address;
750 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
754 if (subsystem_vendor_id == PCI_VENDOR_ASKEY) {
755 bktr->card = cards[ (card = CARD_ASKEY_DYNALINK_MAGIC_TVIEW) ];
756 bktr->card.eepromAddr = eeprom_i2c_address;
757 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
761 if ((subsystem_vendor_id == PCI_VENDOR_LEADTEK_ALT)
762 || (subsystem_vendor_id == PCI_VENDOR_LEADTEK_ALT_2)
763 || (subsystem_vendor_id == PCI_VENDOR_LEADTEK_ALT_3)) {
764 bktr->card = cards[ (card = CARD_LEADTEK) ];
765 bktr->card.eepromAddr = eeprom_i2c_address;
766 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
770 if (subsystem_vendor_id == PCI_VENDOR_PINNACLE_ALT ||
771 subsystem_vendor_id == PCI_VENDOR_PINNACLE_NEW) {
772 bktr->card = cards[ (card = CARD_MIRO) ];
773 bktr->card.eepromAddr = eeprom_i2c_address;
774 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
778 if (subsystem_vendor_id == PCI_VENDOR_IODATA &&
779 subsystem_id == MODEL_IODATA_GV_BCTV3_PCI) {
780 bktr->card = cards[ (card = CARD_IO_BCTV3) ];
781 bktr->card.eepromAddr = eeprom_i2c_address;
782 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
786 if (subsystem_vendor_id == PCI_VENDOR_TERRATEC) {
787 switch (subsystem_id) {
788 case MODEL_TERRATVALUE_1117:
789 case MODEL_TERRATVALUE_1118:
790 case MODEL_TERRATVALUE_1119:
791 case MODEL_TERRATVALUE_111A:
792 case MODEL_TERRATVALUE_1134:
793 bktr->card = cards[ (card = CARD_TERRATVALUE) ];
794 bktr->card.eepromAddr = eeprom_i2c_address;
795 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
800 /* Vendor is unknown. We will use the standard probe code */
801 /* which may not give best results */
802 printf("%s: Warning - card vendor 0x%04x (model 0x%04x) unknown.\n",
803 bktr_name(bktr), subsystem_vendor_id, subsystem_id);
807 printf("%s: Card has no configuration EEPROM. Cannot determine card make.\n",
810 } /* end of bt878/bt879 card detection code */
812 /* If we get to this point, we must have a Bt848/848A/849A card */
813 /* or a Bt878/879 with an unknown subsystem vendor id */
814 /* Try and determine the make of card by clever i2c probing */
816 /* Check for i2c devices. If none, move on */
817 if (!any_i2c_devices) {
818 bktr->card = cards[ (card = CARD_INTEL) ];
819 bktr->card.eepromAddr = 0;
820 bktr->card.eepromSize = 0;
824 /* Look for Hauppauge, STB and Osprey cards by the presence */
826 /* Note: Bt878 based cards also use EEPROMs so we can only do this */
827 /* test on BT848/848A and 849A based cards. */
828 if ((bktr->id==BROOKTREE_848) ||
829 (bktr->id==BROOKTREE_848A) ||
830 (bktr->id==BROOKTREE_849A)) {
832 /* At i2c address 0xa0, look for Hauppauge and Osprey cards */
833 if ( (status = i2cRead( bktr, PFC8582_RADDR )) != ABSENT ) {
835 /* Read the eeprom contents */
836 bktr->card = cards[ (card = CARD_UNKNOWN) ];
837 bktr->card.eepromAddr = PFC8582_WADDR;
838 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
839 readEEProm(bktr, 0, 128, (u_char *) &eeprom );
841 /* For Hauppauge, check the EEPROM begins with 0x84 */
842 if (eeprom[0] == 0x84) {
843 bktr->card = cards[ (card = CARD_HAUPPAUGE) ];
844 bktr->card.eepromAddr = PFC8582_WADDR;
845 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
849 /* For Osprey, check the EEPROM begins with "MMAC" */
850 if ( (eeprom[0] == 'M') &&(eeprom[1] == 'M')
851 &&(eeprom[2] == 'A') &&(eeprom[3] == 'C')) {
852 bktr->card = cards[ (card = CARD_OSPREY) ];
853 bktr->card.eepromAddr = PFC8582_WADDR;
854 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
857 printf("%s: Warning: Unknown card type. EEPROM data not recognised\n",
859 printf("%s: %x %x %x %x\n", bktr_name(bktr),
860 eeprom[0],eeprom[1],eeprom[2],eeprom[3]);
863 /* look for an STB card */
864 if ( (status = i2cRead( bktr, X24C01_RADDR )) != ABSENT ) {
865 bktr->card = cards[ (card = CARD_STB) ];
866 bktr->card.eepromAddr = X24C01_WADDR;
867 bktr->card.eepromSize = (u_char)(128 / EEPROMBLOCKSIZE);
873 signCard( bktr, 1, 128, (u_char *) &probe_signature );
876 printf("%s: card signature: ", bktr_name(bktr));
877 for (j = 0; j < Bt848_MAX_SIGN; j++) {
878 printf(" %02x ", probe_signature[j]);
883 i < (sizeof bt848_card_signature)/ sizeof (struct bt848_card_sig);
887 probe_temp = (u_char *) &bt848_card_signature[i].signature;
889 for (j = 0; j < Bt848_MAX_SIGN; j++) {
890 if ((probe_temp[j] & 0xf) != (probe_signature[j] & 0xf)) {
897 bktr->card = cards[ card = bt848_card_signature[i].card];
898 eeprom_i2c_address = locate_eeprom_address( bktr );
899 if (eeprom_i2c_address != -1) {
900 bktr->card.eepromAddr = eeprom_i2c_address;
901 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
903 bktr->card.eepromAddr = 0;
904 bktr->card.eepromSize = 0;
906 tuner_i2c_address = locate_tuner_address( bktr );
907 select_tuner( bktr, bt848_card_signature[i].tuner );
912 /* We do not know the card type. Default to Miro */
913 bktr->card = cards[ (card = CARD_MIRO) ];
917 /* look for a configuration eeprom */
918 eeprom_i2c_address = locate_eeprom_address( bktr );
919 if (eeprom_i2c_address != -1) {
920 bktr->card.eepromAddr = eeprom_i2c_address;
921 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
923 bktr->card.eepromAddr = 0;
924 bktr->card.eepromSize = 0;
930 #if !defined( BKTR_OVERRIDE_TUNER )
931 if (card == CARD_MIRO && mt2032_init(bktr) == 0 &&
932 bktr->bt848_tuner == -1) {
933 bktr->card = cards[ (card = CARD_PINNACLE_PCTV_RAVE) ];
934 select_tuner( bktr, TUNER_MT2032 );
939 /* look for a tuner */
940 tuner_i2c_address = locate_tuner_address( bktr );
941 if ( tuner_i2c_address == -1 ) {
942 select_tuner( bktr, NO_TUNER );
946 #if defined( BKTR_OVERRIDE_TUNER )
947 select_tuner( bktr, BKTR_OVERRIDE_TUNER );
950 if (bktr->bt848_tuner != -1 ) {
951 select_tuner( bktr, bktr->bt848_tuner & 0xff );
955 /* Check for i2c devices */
956 if (!any_i2c_devices) {
957 select_tuner( bktr, NO_TUNER );
961 /* differentiate type of tuner */
965 switch (((INL(bktr, BKTR_GPIO_DATA) >> 10)-1)&7) {
966 case 0: select_tuner( bktr, TEMIC_PAL ); break;
967 case 1: select_tuner( bktr, PHILIPS_PAL ); break;
968 case 2: select_tuner( bktr, PHILIPS_NTSC ); break;
969 case 3: select_tuner( bktr, PHILIPS_SECAM ); break;
970 case 4: select_tuner( bktr, NO_TUNER ); break;
971 case 5: select_tuner( bktr, PHILIPS_PALI ); break;
972 case 6: select_tuner( bktr, TEMIC_NTSC ); break;
973 case 7: select_tuner( bktr, TEMIC_PALI ); break;
979 /* Hauppauge kindly supplied the following Tuner Table */
980 /* FIXME: I think the tuners the driver selects for types */
981 /* 0x08 and 0x15 may be incorrect but no one has complained. */
982 /* Old Temic tuners had their own API, but newer Temic tuners */
983 /* have the same API as Philips tuners */
985 ID Tuner Model Format We select Format
989 0x03 Philips FI1216 BG
990 0x04 Philips FI1216MF BGLL' PHILIPS_SECAM
991 0x05 Philips FI1236 MN PHILIPS_NTSC
992 0x06 Philips FI1246 I PHILIPS_PALI
993 0x07 Philips FI1256 DK
994 0x08 Philips FI1216 MK2 BG PHILIPS_PALI
995 0x09 Philips FI1216MF MK2 BGLL' PHILIPS_SECAM
996 0x0a Philips FI1236 MK2 MN PHILIPS_NTSC
997 0x0b Philips FI1246 MK2 I PHILIPS_PALI
998 0x0c Philips FI1256 MK2 DK
999 0x0d Temic 4032FY5 NTSC TEMIC_NTSC
1000 0x0e Temic 4002FH5 BG TEMIC_PAL
1001 0x0f Temic 4062FY5 I TEMIC_PALI
1002 0x10 Philips FR1216 MK2 BG
1003 0x11 Philips FR1216MF MK2 BGLL' PHILIPS_FR1236_SECAM
1004 0x12 Philips FR1236 MK2 MN PHILIPS_FR1236_NTSC
1005 0x13 Philips FR1246 MK2 I
1006 0x14 Philips FR1256 MK2 DK
1007 0x15 Philips FM1216 BG PHILIPS_FR1216_PAL
1008 0x16 Philips FM1216MF BGLL' PHILIPS_FR1236_SECAM
1009 0x17 Philips FM1236 MN PHILIPS_FR1236_NTSC
1010 0x18 Philips FM1246 I
1011 0x19 Philips FM1256 DK
1012 0x1a Temic 4036FY5 MN (FI1236 MK2 clone) PHILIPS_NTSC
1013 0x1b Samsung TCPN9082D MN
1014 0x1c Samsung TCPM9092P Pal BG/I/DK
1015 0x1d Temic 4006FH5 BG PHILIPS_PALI
1016 0x1e Samsung TCPN9085D MN/Radio
1017 0x1f Samsung TCPB9085P Pal BG/I/DK / Radio
1018 0x20 Samsung TCPL9091P Pal BG & Secam L/L'
1019 0x21 Temic 4039FY5 NTSC Radio
1020 0x22 Philips FQ1216ME Pal BGIDK & Secam L/L'
1021 0x23 Temic 4066FY5 Pal I (FI1246 MK2 clone) PHILIPS_PALI
1022 0x24 Philips TD1536 MN/ATSCDigital
1023 0x25 Philips TD1536D MN/ATSCDigital DUAL INPUT
1024 0x26 Philips FMR1236 M/N FM(no demod)
1025 0x27 Philips FI1256MP B/G, D/K
1026 0x28 Samsung TCPQ9091P BG/I/DK, L/L'
1027 0x29 Temic 4006FN5 BG/I/DK
1028 0x2a Temic 4009FR5 BG FM PHILIPS_FR1216_PAL
1029 0x2b Temic 4046FM5 B/G, I, D/K, L/L'
1030 0x2c Temic 4009FN5 B/G, I, D/K, FM (no demod)
1031 0x2d Philips TD1536D_FH_44 MN/ATSCDigital DUAL INPUT
1035 /* Determine the model number from the eeprom */
1036 if (bktr->card.eepromAddr != 0) {
1037 /* eeprom data block structure */
1038 unsigned char *block_1, *block_2, *block_3, *block_4;
1039 int block_1_data_size, block_2_data_size, block_3_data_size;
1040 int block_1_total_size, block_2_total_size, block_3_total_size;
1041 int block_4_header_size;
1043 unsigned int model,revision;
1044 unsigned char tuner_code;
1045 unsigned char no_audio_mux;
1047 readEEProm(bktr, 0, 128, (u_char *) &eeprom );
1049 /* LOCATE THE EEPROM DATA BLOCKS */
1050 block_1 = &eeprom[0];
1051 block_1_data_size = (block_1[2] << 8 | block_1[1]);
1052 block_1_total_size = block_1_data_size + 3; /* Header bytes */
1054 block_2 = &eeprom[block_1_total_size];
1055 block_2_data_size = (block_2[2] << 8 | block_2[1]);
1056 block_2_total_size = block_2_data_size + 3; /* Header bytes */
1058 block_3 = &eeprom[block_1_total_size + block_2_total_size];
1059 block_3_data_size = (block_3[0] &0x07);
1060 block_3_total_size = block_3_data_size + 1; /* Header size */
1062 block_4 = &eeprom[block_1_total_size +block_2_total_size +block_3_total_size];
1063 block_4_header_size = 1;
1065 model = (block_1[12] << 8 | block_1[11]);
1066 revision = (block_1[15] << 16 | block_1[14] << 8 | block_1[13]);
1068 tuner_code = block_1[9];
1070 no_audio_mux = ((block_3[3] >> 7) &0x01);
1072 if (no_audio_mux) bktr->audio_mux_present = 0;
1075 printf("%s: Hauppauge Model %d %c%c%c%c\n",
1078 ((revision >> 18) & 0x3f) + 32,
1079 ((revision >> 12) & 0x3f) + 32,
1080 ((revision >> 6) & 0x3f) + 32,
1081 ((revision >> 0) & 0x3f) + 32 );
1083 /* Determine the tuner type from the eeprom */
1085 switch (tuner_code) {
1090 select_tuner( bktr, PHILIPS_NTSC );
1095 select_tuner( bktr, PHILIPS_SECAM );
1100 select_tuner( bktr, PHILIPS_FR1236_SECAM );
1106 select_tuner( bktr, PHILIPS_FR1236_NTSC );
1114 select_tuner( bktr, PHILIPS_PALI );
1118 select_tuner( bktr, TEMIC_NTSC );
1122 select_tuner( bktr, TEMIC_PAL );
1126 select_tuner( bktr, TEMIC_PALI );
1130 select_tuner( bktr, PHILIPS_FR1216_PAL );
1134 bktr->msp_use_mono_source = 1;
1135 select_tuner( bktr, PHILIPS_FR1216_PAL );
1139 printf("%s: Warning - Unknown Hauppauge Tuner 0x%x\n",
1140 bktr_name(bktr), tuner_code);
1146 case CARD_AVER_MEDIA:
1147 /* AVerMedia kindly supplied some details of their EEPROM contents
1148 * which allow us to auto select the Tuner Type.
1149 * Only the newer AVerMedia cards actually have an EEPROM.
1151 if (bktr->card.eepromAddr != 0) {
1153 u_char tuner_make; /* Eg Philips, Temic */
1154 u_char tuner_tv_fm; /* TV or TV with FM Radio */
1155 u_char tuner_format; /* Eg NTSC, PAL, SECAM */
1158 int tuner_0_table[] = {
1159 PHILIPS_NTSC, PHILIPS_PAL,
1160 PHILIPS_PAL, PHILIPS_PAL,
1161 PHILIPS_PAL, PHILIPS_PAL,
1162 PHILIPS_SECAM, PHILIPS_SECAM,
1163 PHILIPS_SECAM, PHILIPS_PAL};
1165 int tuner_0_fm_table[] = {
1166 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL,
1167 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
1168 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL,
1169 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
1170 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
1172 int tuner_1_table[] = {
1173 TEMIC_NTSC, TEMIC_PAL, TEMIC_PAL,
1174 TEMIC_PAL, TEMIC_PAL, TEMIC_PAL,
1175 TEMIC_SECAM, TEMIC_SECAM, TEMIC_SECAM,
1179 /* Extract information from the EEPROM data */
1180 readEEProm(bktr, 0, 128, (u_char *) &eeprom );
1182 tuner_make = (eeprom[0x41] & 0x7);
1183 tuner_tv_fm = (eeprom[0x41] & 0x18) >> 3;
1184 tuner_format = (eeprom[0x42] & 0xf0) >> 4;
1186 /* Treat tuner make 0 (Philips) and make 2 (LG) the same */
1187 if ( ((tuner_make == 0) || (tuner_make == 2))
1188 && (tuner_format <= 9) && (tuner_tv_fm == 0) ) {
1189 tuner = tuner_0_table[tuner_format];
1190 select_tuner( bktr, tuner );
1194 if ( ((tuner_make == 0) || (tuner_make == 2))
1195 && (tuner_format <= 9) && (tuner_tv_fm == 1) ) {
1196 tuner = tuner_0_fm_table[tuner_format];
1197 select_tuner( bktr, tuner );
1201 if ( (tuner_make == 1) && (tuner_format <= 9) ) {
1202 tuner = tuner_1_table[tuner_format];
1203 select_tuner( bktr, tuner );
1207 printf("%s: Warning - Unknown AVerMedia Tuner Make %d Format %d\n",
1208 bktr_name(bktr), tuner_make, tuner_format);
1213 #if defined(BKTR_SYSTEM_DEFAULT) && BKTR_SYSTEM_DEFAULT == BROOKTREE_PAL
1214 select_tuner( bktr, PHILIPS_FR1216_PAL );
1216 select_tuner( bktr, PHILIPS_FR1236_NTSC );
1222 select_tuner( bktr, ALPS_TSCH5 ); /* ALPS_TSCH6, in fact. */
1226 case CARD_TERRATVALUE:
1227 select_tuner( bktr, PHILIPS_PAL); /* Phlips PAL tuner */
1231 } /* end switch(card) */
1234 /* At this point, a goto checkDBX has not occurred */
1235 /* We have not been able to select a Tuner */
1236 /* Some cards make use of the tuner address to */
1237 /* identify the make/model of tuner */
1239 /* At address 0xc0/0xc1 we often find a TEMIC NTSC */
1240 if ( i2cRead( bktr, 0xc1 ) != ABSENT ) {
1241 select_tuner( bktr, TEMIC_NTSC );
1245 /* At address 0xc6/0xc7 we often find a PHILIPS NTSC Tuner */
1246 if ( i2cRead( bktr, 0xc7 ) != ABSENT ) {
1247 select_tuner( bktr, PHILIPS_NTSC );
1251 /* Address 0xc2/0xc3 is default (or common address) for several */
1252 /* tuners and we cannot tell which is which. */
1253 /* And for all other tuner i2c addresses, select the default */
1254 select_tuner( bktr, DEFAULT_TUNER );
1258 #if defined( BKTR_OVERRIDE_DBX )
1259 bktr->card.dbx = BKTR_OVERRIDE_DBX;
1262 /* Check for i2c devices */
1263 if (!any_i2c_devices) {
1267 /* probe for BTSC (dbx) chip */
1268 if ( i2cRead( bktr, TDA9850_RADDR ) != ABSENT )
1272 /* If this is a Hauppauge Bt878 card, we need to enable the
1273 * MSP 34xx audio chip.
1274 * If this is a Hauppauge Bt848 card, reset the MSP device.
1275 * The MSP reset line is wired to GPIO pin 5. On Bt878 cards a pulldown
1276 * resistor holds the device in reset until we set GPIO pin 5.
1279 /* Optionally skip the MSP reset. This is handy if you initialise the
1280 * MSP audio in another operating system (eg Windows) first and then
1284 #ifndef BKTR_NO_MSP_RESET
1285 if (card == CARD_HAUPPAUGE) {
1286 OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) | (1<<5));
1287 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */
1288 DELAY(2500); /* wait 2.5ms */
1289 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) & ~(1<<5)); /* write '0' */
1290 DELAY(2500); /* wait 2.5ms */
1291 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */
1292 DELAY(2500); /* wait 2.5ms */
1296 #if defined( BKTR_OVERRIDE_MSP )
1297 bktr->card.msp3400c = BKTR_OVERRIDE_MSP;
1301 /* Check for i2c devices */
1302 if (!any_i2c_devices) {
1306 if ( i2cRead( bktr, MSP3400C_RADDR ) != ABSENT ) {
1307 bktr->card.msp3400c = 1;
1312 if (bktr->card.msp3400c) {
1313 bktr->msp_addr = MSP3400C_WADDR;
1314 msp_read_id( bktr );
1315 printf("%s: Detected a MSP%s at 0x%x\n", bktr_name(bktr),
1316 bktr->msp_version_string,
1321 /* Check for Dolby Surround Sound DPL3518A sound chip */
1322 if ( i2cRead( bktr, DPL3518A_RADDR ) != ABSENT ) {
1323 bktr->card.dpl3518a = 1;
1326 if (bktr->card.dpl3518a) {
1327 bktr->dpl_addr = DPL3518A_WADDR;
1328 dpl_read_id( bktr );
1329 printf("%s: Detected a DPL%s at 0x%x\n", bktr_name(bktr),
1330 bktr->dpl_version_string,
1334 /* Start of Check Remote */
1335 /* Check for the Hauppauge IR Remote Control */
1336 /* If there is an external unit, the internal will be ignored */
1338 bktr->remote_control = 0; /* initial value */
1340 if (any_i2c_devices) {
1341 if (i2cRead( bktr, HAUP_REMOTE_EXT_RADDR ) != ABSENT )
1343 bktr->remote_control = 1;
1344 bktr->remote_control_addr = HAUP_REMOTE_EXT_RADDR;
1346 else if (i2cRead( bktr, HAUP_REMOTE_INT_RADDR ) != ABSENT )
1348 bktr->remote_control = 1;
1349 bktr->remote_control_addr = HAUP_REMOTE_INT_RADDR;
1353 /* If a remote control is found, poll it 5 times to turn off the LED */
1354 if (bktr->remote_control) {
1357 i2cRead( bktr, bktr->remote_control_addr );
1359 /* End of Check Remote */
1361 #if defined( BKTR_USE_PLL )
1362 bktr->xtal_pll_mode = BT848_USE_PLL;
1365 /* Default is to use XTALS and not PLL mode */
1366 bktr->xtal_pll_mode = BT848_USE_XTALS;
1368 /* Enable PLL mode for OSPREY users */
1369 if (card == CARD_OSPREY)
1370 bktr->xtal_pll_mode = BT848_USE_PLL;
1372 /* Enable PLL mode for Video Highway Xtreme users */
1373 if (card == CARD_VIDEO_HIGHWAY_XTREME)
1374 bktr->xtal_pll_mode = BT848_USE_PLL;
1377 /* Most (perhaps all) Bt878 cards need to be switched to PLL mode */
1378 /* as they only fit the NTSC crystal to their cards */
1379 /* Default to enabling PLL mode for all Bt878/879 cards */
1381 if ((bktr->id==BROOKTREE_878 || bktr->id==BROOKTREE_879) )
1382 bktr->xtal_pll_mode = BT848_USE_PLL;
1385 #if defined( BKTR_USE_PLL )
1390 bktr->card.tuner_pllAddr = tuner_i2c_address;
1393 printf( "%s: %s", bktr_name(bktr), bktr->card.name );
1394 if ( bktr->card.tuner )
1395 printf( ", %s tuner", bktr->card.tuner->name );
1396 if ( bktr->card.dbx )
1397 printf( ", dbx stereo" );
1398 if ( bktr->card.msp3400c )
1399 printf( ", msp3400c stereo" );
1400 if ( bktr->card.dpl3518a )
1401 printf( ", dpl3518a dolby" );
1402 if ( bktr->remote_control )
1403 printf( ", remote control" );