bktr_card.c revision 62214
1/* $FreeBSD: head/sys/dev/bktr/bktr_card.c 62214 2000-06-28 15:09:12Z roger $ */ 2 3/* 4 * This is part of the Driver for Video Capture Cards (Frame grabbers) 5 * and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879 6 * chipset. 7 * Copyright Roger Hardiman and Amancio Hasty. 8 * 9 * bktr_card : This deals with identifying TV cards. 10 * trying to find the card make and model of card. 11 * trying to find the type of tuner fitted. 12 * reading the configuration EEPROM. 13 * locating i2c devices. 14 * 15 */ 16 17/* 18 * 1. Redistributions of source code must retain the 19 * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman 20 * All rights reserved. 21 * 22 * Redistribution and use in source and binary forms, with or without 23 * modification, are permitted provided that the following conditions 24 * are met: 25 * 1. Redistributions of source code must retain the above copyright 26 * notice, this list of conditions and the following disclaimer. 27 * 2. Redistributions in binary form must reproduce the above copyright 28 * notice, this list of conditions and the following disclaimer in the 29 * documentation and/or other materials provided with the distribution. 30 * 3. All advertising materials mentioning features or use of this software 31 * must display the following acknowledgement: 32 * This product includes software developed by Amancio Hasty and 33 * Roger Hardiman 34 * 4. The name of the author may not be used to endorse or promote products 35 * derived from this software without specific prior written permission. 36 * 37 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 38 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 39 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 40 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 41 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 42 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 43 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 46 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 47 * POSSIBILITY OF SUCH DAMAGE. 48 */ 49 50#include "opt_bktr.h" /* Include any kernel config options */ 51 52#include <sys/param.h> 53#include <sys/systm.h> 54#include <sys/vnode.h> 55 56#ifdef __FreeBSD__ 57#include <machine/clock.h> /* for DELAY */ 58#include <pci/pcivar.h> 59 60#if (__FreeBSD_version >=300000) 61#include <machine/bus_memio.h> /* for bus space */ 62#include <machine/bus.h> 63#include <sys/bus.h> 64#endif 65#endif 66 67#ifdef __NetBSD__ 68#include <dev/ic/bt8xx.h> /* NetBSD location for .h files */ 69#include <dev/pci/bktr/bktr_reg.h> 70#include <dev/pci/bktr/bktr_core.h> 71#include <dev/pci/bktr/bktr_tuner.h> 72#include <dev/pci/bktr/bktr_card.h> 73#include <dev/pci/bktr/bktr_audio.h> 74#else 75#include <machine/ioctl_meteor.h> /* Traditional location for .h files */ 76#include <machine/ioctl_bt848.h> /* extensions to ioctl_meteor.h */ 77#include <dev/bktr/bktr_reg.h> 78#include <dev/bktr/bktr_core.h> 79#include <dev/bktr/bktr_tuner.h> 80#include <dev/bktr/bktr_card.h> 81#include <dev/bktr/bktr_audio.h> 82#endif 83 84/* Various defines */ 85#define HAUP_REMOTE_INT_WADDR 0x30 86#define HAUP_REMOTE_INT_RADDR 0x31 87 88#define HAUP_REMOTE_EXT_WADDR 0x34 89#define HAUP_REMOTE_EXT_RADDR 0x35 90 91/* address of BTSC/SAP decoder chip */ 92#define TDA9850_WADDR 0xb6 93#define TDA9850_RADDR 0xb7 94 95/* address of MSP3400C chip */ 96#define MSP3400C_WADDR 0x80 97#define MSP3400C_RADDR 0x81 98 99/* address of DPL3518A chip */ 100#define DPL3518A_WADDR 0x84 101#define DPL3518A_RADDR 0x85 102 103/* EEProm (128 * 8) on an STB card */ 104#define X24C01_WADDR 0xae 105#define X24C01_RADDR 0xaf 106 107 108/* EEProm (256 * 8) on a Hauppauge card */ 109/* and on most BT878s cards to store the sub-system vendor id */ 110#define PFC8582_WADDR 0xa0 111#define PFC8582_RADDR 0xa1 112 113#if BKTR_SYSTEM_DEFAULT == BROOKTREE_PAL 114#define DEFAULT_TUNER PHILIPS_PALI 115#else 116#define DEFAULT_TUNER PHILIPS_NTSC 117#endif 118 119 120 121 122/* 123 * the data for each type of card 124 * 125 * Note: 126 * these entried MUST be kept in the order defined by the CARD_XXX defines! 127 */ 128static const struct CARDTYPE cards[] = { 129 130 { CARD_UNKNOWN, /* the card id */ 131 "Unknown", /* the 'name' */ 132 NULL, /* the tuner */ 133 0, /* the tuner i2c address */ 134 0, /* dbx unknown */ 135 0, 136 0, 137 0, /* EEProm unknown */ 138 0, /* EEProm unknown */ 139 { 0, 0, 0, 0, 0 }, 140 0 }, /* GPIO mask */ 141 142 { CARD_MIRO, /* the card id */ 143 "Miro TV", /* the 'name' */ 144 NULL, /* the tuner */ 145 0, /* the tuner i2c address */ 146 0, /* dbx unknown */ 147 0, 148 0, 149 0, /* EEProm unknown */ 150 0, /* size unknown */ 151 { 0x02, 0x01, 0x00, 0x0a, 1 }, /* audio MUX values */ 152 0x0f }, /* GPIO mask */ 153 154 { CARD_HAUPPAUGE, /* the card id */ 155 "Hauppauge WinCast/TV", /* the 'name' */ 156 NULL, /* the tuner */ 157 0, /* the tuner i2c address */ 158 0, /* dbx is optional */ 159 0, 160 0, 161 PFC8582_WADDR, /* EEProm type */ 162 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */ 163 { 0x00, 0x02, 0x01, 0x04, 1 }, /* audio MUX values */ 164 0x0f }, /* GPIO mask */ 165 166 { CARD_STB, /* the card id */ 167 "STB TV/PCI", /* the 'name' */ 168 NULL, /* the tuner */ 169 0, /* the tuner i2c address */ 170 0, /* dbx is optional */ 171 0, 172 0, 173 X24C01_WADDR, /* EEProm type */ 174 (u_char)(128 / EEPROMBLOCKSIZE), /* 128 bytes */ 175 { 0x00, 0x01, 0x02, 0x02, 1 }, /* audio MUX values */ 176 0x0f }, /* GPIO mask */ 177 178 { CARD_INTEL, /* the card id */ 179 "Intel Smart Video III/VideoLogic Captivator PCI", /* the 'name' */ 180 NULL, /* the tuner */ 181 0, /* the tuner i2c address */ 182 0, 183 0, 184 0, 185 0, 186 0, 187 { 0, 0, 0, 0, 0 }, /* audio MUX values */ 188 0x00 }, /* GPIO mask */ 189 190 { CARD_IMS_TURBO, /* the card id */ 191 "IMS TV Turbo", /* the 'name' */ 192 NULL, /* the tuner */ 193 0, /* the tuner i2c address */ 194 0, /* dbx is optional */ 195 0, 196 0, 197 PFC8582_WADDR, /* EEProm type */ 198 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */ 199 { 0x01, 0x02, 0x01, 0x00, 1 }, /* audio MUX values */ 200 0x0f }, /* GPIO mask */ 201 202 { CARD_AVER_MEDIA, /* the card id */ 203 "AVer Media TV/FM", /* the 'name' */ 204 NULL, /* the tuner */ 205 0, /* the tuner i2c address */ 206 0, /* dbx is optional */ 207 0, 208 0, 209 0, /* EEProm type */ 210 0, /* EEProm size */ 211 { 0x0c, 0x08, 0x04, 0x00, 1 }, /* audio MUX values */ 212 0x1f }, /* GPIO mask */ 213 214 { CARD_OSPREY, /* the card id */ 215 "MMAC Osprey", /* the 'name' */ 216 NULL, /* the tuner */ 217 0, /* the tuner i2c address */ 218 0, /* dbx is optional */ 219 0, 220 0, 221 PFC8582_WADDR, /* EEProm type */ 222 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */ 223 { 0x00, 0x00, 0x00, 0x00, 0 }, /* audio MUX values */ 224 0 }, /* GPIO mask */ 225 226 { CARD_NEC_PK, /* the card id */ 227 "NEC PK-UG-X017", /* the 'name' */ 228 NULL, /* the tuner */ 229 0, /* the tuner i2c address */ 230 0, /* dbx is optional */ 231 0, 232 0, 233 0, /* EEProm type */ 234 0, /* EEProm size */ 235 { 0x01, 0x02, 0x01, 0x00, 1 }, /* audio MUX values */ 236 0x0f }, /* GPIO mask */ 237 238 { CARD_IO_GV, /* the card id */ 239 "I/O DATA GV-BCTV2/PCI", /* the 'name' */ 240 NULL, /* the tuner */ 241 0, /* the tuner i2c address */ 242 0, /* dbx is optional */ 243 0, 244 0, 245 0, /* EEProm type */ 246 0, /* EEProm size */ 247 { 0x00, 0x00, 0x00, 0x00, 1 }, /* Has special MUX handler */ 248 0x0f }, /* GPIO mask */ 249 250 { CARD_FLYVIDEO, /* the card id */ 251 "FlyVideo", /* the 'name' */ 252 NULL, /* the tuner */ 253 0, /* the tuner i2c address */ 254 0, /* dbx is optional */ 255 0, /* msp34xx is optional */ 256 0, /* dpl3518a is optional */ 257 0xac, /* EEProm type */ 258 (u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */ 259 { 0x000, 0x800, 0x400, 0x8dff00, 1 },/* audio MUX values */ 260 0x8dff00 }, /* GPIO mask */ 261 262 { CARD_ZOLTRIX, /* the card id */ 263 "Zoltrix", /* 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 0, /* EEProm type */ 270 0, /* EEProm size */ 271 { 0x04, 0x01, 0x00, 0x0a, 1 }, /* audio MUX values */ 272 0x0f }, /* GPIO mask */ 273 274 { CARD_KISS, /* the card id */ 275 "KISS TV/FM PCI", /* 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 */ 281 0, /* EEProm type */ 282 0, /* EEProm size */ 283 { 0x0c, 0x00, 0x0b, 0x0b, 1 }, /* audio MUX values */ 284 0x0f }, /* GPIO mask */ 285 286 { CARD_VIDEO_HIGHWAY_XTREME, /* the card id */ 287 "Video Highway Xtreme", /* the 'name' */ 288 NULL, /* the tuner */ 289 0, 290 0, 291 0, 292 0, 293 0, /* EEProm type */ 294 0, /* EEProm size */ 295 { 0x00, 0x02, 0x01, 0x04, 1 }, /* audio MUX values */ 296 0x0f }, /* GPIO mask */ 297 298 { CARD_ASKEY_DYNALINK_MAGIC_TVIEW, /* the card id */ 299 "Askey/Dynalink Magic TView", /* the 'name' */ 300 NULL, /* the tuner */ 301 0, 302 0, 303 0, 304 0, 305 0, /* EEProm type */ 306 0, /* EEProm size */ 307 { 0x400, 0xE00, 0x400, 0xC00, 1 }, /* audio MUX values */ 308 0xE00 }, /* GPIO mask */ 309 310 { CARD_LEADTEK, /* the card id */ 311 "Leadtek Winfast TV 2000", /* the 'name' */ 312 NULL, /* the tuner */ 313 0, 314 0, 315 0, 316 0, 317 0, /* EEProm type */ 318 0, /* EEProm size */ 319 /* Tuner, Extern, Intern, Mute, Enabled */ 320 { 0x621000, 0x621000, 0x621000, 0xE21000, 1 }, /* audio MUX values */ 321 0xfff000 }, /* GPIO mask */ 322 323 { CARD_TERRATVPLUS, /* the card id */ 324 "TerraTVplus", /* the 'name' */ 325 NULL, /* the tuner */ 326 0, 327 0, 328 0, 329 0, 330 0, /* EEProm type */ 331 0, /* EEProm size */ 332 { 0x20000, 0x00000, 0x30000, 0x40000, 1 }, /* audio MUX values*/ 333 0x70000 }, /* GPIO mask */ 334 335}; 336 337struct bt848_card_sig bt848_card_signature[1]= { 338 /* IMS TURBO TV : card 5 */ 339 { 5,9, {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 00, 00}} 340 341 342}; 343 344 345/* 346 * Write to the configuration EEPROM on the card. 347 * This is dangerous and will mess up your card. Therefore it is not 348 * implemented. 349 */ 350int 351writeEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data ) 352{ 353 return( -1 ); 354} 355 356/* 357 * Read the contents of the configuration EEPROM on the card. 358 * (This is not fitted to all makes of card. All Hauppuage cards have them 359 * and so do newer Bt878 based cards. 360 */ 361int 362readEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data ) 363{ 364 int x; 365 int addr; 366 int max; 367 int byte; 368 369 /* get the address of the EEProm */ 370 addr = (int)(bktr->card.eepromAddr & 0xff); 371 if ( addr == 0 ) 372 return( -1 ); 373 374 max = (int)(bktr->card.eepromSize * EEPROMBLOCKSIZE); 375 if ( (offset + count) > max ) 376 return( -1 ); 377 378 /* set the start address */ 379 if ( i2cWrite( bktr, addr, offset, -1 ) == -1 ) 380 return( -1 ); 381 382 /* the read cycle */ 383 for ( x = 0; x < count; ++x ) { 384 if ( (byte = i2cRead( bktr, (addr | 1) )) == -1 ) 385 return( -1 ); 386 data[ x ] = byte; 387 } 388 389 return( 0 ); 390} 391 392 393#define ABSENT (-1) 394 395/* 396 * get a signature of the card 397 * read all 128 possible i2c read addresses from 0x01 thru 0xff 398 * build a bit array with a 1 bit for each i2c device that responds 399 * 400 * XXX FIXME: use offset & count args 401 */ 402int 403signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig ) 404{ 405 int x; 406 407 for ( x = 0; x < 16; ++x ) 408 sig[ x ] = 0; 409 410 for ( x = 0; x < count; ++x ) { 411 if ( i2cRead( bktr, (2 * x) + 1 ) != ABSENT ) { 412 sig[ x / 8 ] |= (1 << (x % 8) ); 413 } 414 } 415 416 return( 0 ); 417} 418 419 420/* 421 * check_for_i2c_devices. 422 * Some BT848 cards have no tuner and no additional i2c devices 423 * eg stereo decoder. These are used for video conferencing or capture from 424 * a video camera. (eg VideoLogic Captivator PCI, Intel SmartCapture card). 425 * 426 * Determine if there are any i2c devices present. There are none present if 427 * a) reading from all 128 devices returns ABSENT (-1) for each one 428 * (eg VideoLogic Captivator PCI with BT848) 429 * b) reading from all 128 devices returns 0 for each one 430 * (eg VideoLogic Captivator PCI rev. 2F with BT848A) 431 */ 432static int check_for_i2c_devices( bktr_ptr_t bktr ){ 433 int x, temp_read; 434 int i2c_all_0 = 1; 435 int i2c_all_absent = 1; 436 for ( x = 0; x < 128; ++x ) { 437 temp_read = i2cRead( bktr, (2 * x) + 1 ); 438 if (temp_read != 0) i2c_all_0 = 0; 439 if (temp_read != ABSENT) i2c_all_absent = 0; 440 } 441 442 if ((i2c_all_0) || (i2c_all_absent)) return 0; 443 else return 1; 444} 445 446 447/* 448 * Temic/Philips datasheets say tuners can be at i2c addresses 0xc0, 0xc2, 449 * 0xc4 or 0xc6, settable by links on the tuner. 450 * Determine the actual address used on the TV card by probing read addresses. 451 */ 452static int locate_tuner_address( bktr_ptr_t bktr) { 453 if (i2cRead( bktr, 0xc1) != ABSENT) return 0xc0; 454 if (i2cRead( bktr, 0xc3) != ABSENT) return 0xc2; 455 if (i2cRead( bktr, 0xc5) != ABSENT) return 0xc4; 456 if (i2cRead( bktr, 0xc7) != ABSENT) return 0xc6; 457 return -1; /* no tuner found */ 458} 459 460 461/* 462 * Search for a configuration EEPROM on the i2c bus by looking at i2c addresses 463 * where EEPROMs are usually found. 464 * On some cards, the EEPROM appears in several locations, but all in the 465 * range 0xa0 to 0xae. 466 */ 467static int locate_eeprom_address( bktr_ptr_t bktr) { 468 if (i2cRead( bktr, 0xa0) != ABSENT) return 0xa0; 469 if (i2cRead( bktr, 0xac) != ABSENT) return 0xac; 470 if (i2cRead( bktr, 0xae) != ABSENT) return 0xae; 471 return -1; /* no eeprom found */ 472} 473 474 475/* 476 * determine the card brand/model 477 * BKTR_OVERRIDE_CARD, BKTR_OVERRIDE_TUNER, BKTR_OVERRIDE_DBX and 478 * BKTR_OVERRIDE_MSP can be used to select a specific device, 479 * regardless of the autodetection and i2c device checks. 480 * 481 * The scheme used for probing cards faces these problems: 482 * It is impossible to work out which type of tuner is actually fitted, 483 * (the driver cannot tell if the Tuner is PAL or NTSC, Temic or Philips) 484 * It is impossible to determine what audio-mux hardware is connected. 485 * It is impossible to determine if there is extra hardware connected to the 486 * GPIO pins (eg radio chips or MSP34xx reset logic) 487 * 488 * However some makes of card (eg Hauppauge) come with a configuration eeprom 489 * which tells us the make of the card. Most eeproms also tell us the 490 * tuner type and other features of the the cards. 491 * 492 * The current probe code works as follows 493 * A) If the card uses a Bt878/879: 494 * 1) Read the sub-system vendor id from the configuration EEPROM. 495 * Select the required tuner, audio mux arrangement and any other 496 * onboard features. If this fails, move to step B. 497 * B) If it card uses a Bt848, 848A, 849A or an unknown Bt878/879: 498 * 1) Look for I2C devices. If there are none fitted, it is an Intel or 499 * VideoLogic cards. 500 * 2) Look for a configuration EEPROM. 501 * 2a) If there is one at I2C address 0xa0 it may be 502 * a Hauppauge or an Osprey. Check the EEPROM contents to determine which 503 * one it is. For Hauppauge, select the tuner type and audio hardware. 504 * 2b) If there is an EEPROM at I2C address 0xa8 it will be an STB card. 505 * We still have to guess on the tuner type. 506 * 507 * C) If we do not know the card type from (A) or (B), guess at the tuner 508 * type based on the I2C address of the tuner. 509 * 510 * D) After determining the Tuner Type, we probe the i2c bus for other 511 * devices at known locations, eg IR-Remote Control, MSP34xx and TDA 512 * stereo chips. 513 */ 514 515 516/* 517 * These are the sub-system vendor ID codes stored in the 518 * configuration EEPROM used on Bt878/879 cards. They should match the 519 * number assigned to the company by the PCI Special Interest Group 520 */ 521#define VENDOR_AVER_MEDIA 0x1461 522#define VENDOR_HAUPPAUGE 0x0070 523#define VENDOR_FLYVIDEO 0x1851 524#define VENDOR_STB 0x10B4 525#define VENDOR_ASKEY_COMP 0x144F 526#define VENDOR_LEADTEK 0x6606 527 528 529void 530probeCard( bktr_ptr_t bktr, int verbose, int unit ) 531{ 532 int card, i,j, card_found; 533 int status; 534 u_char probe_signature[128], *probe_temp; 535 int any_i2c_devices; 536 u_char eeprom[256]; 537 u_char tuner_code = 0; 538 int tuner_i2c_address = -1; 539 int eeprom_i2c_address = -1; 540 541 /* Select all GPIO bits as inputs */ 542 OUTL(bktr, BKTR_GPIO_OUT_EN, 0); 543 if (bootverbose) 544 printf("%s: GPIO is 0x%08x\n", bktr_name(bktr), 545 INL(bktr, BKTR_GPIO_DATA)); 546 547#ifdef HAUPPAUGE_MSP_RESET 548 /* Reset the MSP34xx audio chip. This resolves bootup card 549 * detection problems with old Bt848 based Hauppauge cards with 550 * MSP34xx stereo audio chips. This must be user enabled because 551 * at this point the probe function does not know the card type. */ 552 OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) | (1<<5)); 553 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */ 554 DELAY(2500); /* wait 2.5ms */ 555 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) & ~(1<<5)); /* write '0' */ 556 DELAY(2500); /* wait 2.5ms */ 557 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */ 558 DELAY(2500); /* wait 2.5ms */ 559#endif 560 561 /* Check for the presence of i2c devices */ 562 any_i2c_devices = check_for_i2c_devices( bktr ); 563 564 565 /* Check for a user specified override on the card selection */ 566#if defined( BKTR_OVERRIDE_CARD ) 567 bktr->card = cards[ (card = BKTR_OVERRIDE_CARD) ]; 568 goto checkEEPROM; 569#endif 570 if (bktr->bt848_card != -1 ) { 571 bktr->card = cards[ (card = bktr->bt848_card) ]; 572 goto checkEEPROM; 573 } 574 575 576 /* No override, so try and determine the make of the card */ 577 578 /* On BT878/879 cards, read the sub-system vendor id */ 579 /* This identifies the manufacturer of the card and the model */ 580 /* In theory this can be read from PCI registers but this does not */ 581 /* appear to work on the FlyVideo 98. Hauppauge also warned that */ 582 /* the PCI registers are sometimes not loaded correctly. */ 583 /* Therefore, I will read the sub-system vendor ID from the EEPROM */ 584 /* (just like the Bt878 does during power up initialisation) */ 585 586 if ((bktr->id==BROOKTREE_878) || (bktr->id==BROOKTREE_879)) { 587 /* Try and locate the EEPROM */ 588 eeprom_i2c_address = locate_eeprom_address( bktr ); 589 if (eeprom_i2c_address != -1) { 590 591 unsigned int subsystem_vendor_id; /* vendors PCI-SIG ID */ 592 unsigned int subsystem_id; /* board model number */ 593 unsigned int byte_252, byte_253, byte_254, byte_255; 594 595 bktr->card = cards[ (card = CARD_UNKNOWN) ]; 596 bktr->card.eepromAddr = eeprom_i2c_address; 597 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 598 599 readEEProm(bktr, 0, 256, (u_char *) &eeprom ); 600 byte_252 = (unsigned int)eeprom[252]; 601 byte_253 = (unsigned int)eeprom[253]; 602 byte_254 = (unsigned int)eeprom[254]; 603 byte_255 = (unsigned int)eeprom[255]; 604 605 subsystem_id = (byte_252 << 8) | byte_253; 606 subsystem_vendor_id = (byte_254 << 8) | byte_255; 607 608 if ( bootverbose ) 609 printf("%s: subsystem 0x%04x 0x%04x\n", bktr_name(bktr), 610 subsystem_vendor_id, subsystem_id); 611 612 if (subsystem_vendor_id == VENDOR_AVER_MEDIA) { 613 bktr->card = cards[ (card = CARD_AVER_MEDIA) ]; 614 bktr->card.eepromAddr = eeprom_i2c_address; 615 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 616 goto checkTuner; 617 } 618 619 if (subsystem_vendor_id == VENDOR_HAUPPAUGE) { 620 bktr->card = cards[ (card = CARD_HAUPPAUGE) ]; 621 bktr->card.eepromAddr = eeprom_i2c_address; 622 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 623 goto checkTuner; 624 } 625 626 if (subsystem_vendor_id == VENDOR_FLYVIDEO) { 627 bktr->card = cards[ (card = CARD_FLYVIDEO) ]; 628 bktr->card.eepromAddr = eeprom_i2c_address; 629 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 630 goto checkTuner; 631 } 632 633 if (subsystem_vendor_id == VENDOR_STB) { 634 bktr->card = cards[ (card = CARD_STB) ]; 635 bktr->card.eepromAddr = eeprom_i2c_address; 636 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 637 goto checkTuner; 638 } 639 640 if (subsystem_vendor_id == VENDOR_ASKEY_COMP) { 641 bktr->card = cards[ (card = CARD_ASKEY_DYNALINK_MAGIC_TVIEW) ]; 642 bktr->card.eepromAddr = eeprom_i2c_address; 643 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 644 goto checkTuner; 645 } 646 647 if (subsystem_vendor_id == VENDOR_LEADTEK) { 648 bktr->card = cards[ (card = CARD_LEADTEK) ]; 649 bktr->card.eepromAddr = eeprom_i2c_address; 650 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 651 goto checkTuner; 652 } 653 654 /* Vendor is unknown. We will use the standard probe code */ 655 /* which may not give best results */ 656 printf("%s: Warning - card vendor 0x%04x (model 0x%04x) unknown.\n", 657 bktr_name(bktr), subsystem_vendor_id, subsystem_id); 658 } 659 else 660 { 661 printf("%s: Card has no configuration EEPROM. Cannot determine card make.\n", 662 bktr_name(bktr)); 663 } 664 } /* end of bt878/bt879 card detection code */ 665 666 /* If we get to this point, we must have a Bt848/848A/849A card */ 667 /* or a Bt878/879 with an unknown subsystem vendor id */ 668 /* Try and determine the make of card by clever i2c probing */ 669 670 /* Check for i2c devices. If none, move on */ 671 if (!any_i2c_devices) { 672 bktr->card = cards[ (card = CARD_INTEL) ]; 673 bktr->card.eepromAddr = 0; 674 bktr->card.eepromSize = 0; 675 goto checkTuner; 676 } 677 678 /* Look for Hauppauge, STB and Osprey cards by the presence */ 679 /* of an EEPROM */ 680 /* Note: Bt878 based cards also use EEPROMs so we can only do this */ 681 /* test on BT848/848A and 849A based cards. */ 682 if ((bktr->id==BROOKTREE_848) || 683 (bktr->id==BROOKTREE_848A) || 684 (bktr->id==BROOKTREE_849A)) { 685 686 /* At i2c address 0xa0, look for Hauppauge and Osprey cards */ 687 if ( (status = i2cRead( bktr, PFC8582_RADDR )) != ABSENT ) { 688 689 /* Read the eeprom contents */ 690 bktr->card = cards[ (card = CARD_UNKNOWN) ]; 691 bktr->card.eepromAddr = PFC8582_WADDR; 692 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 693 readEEProm(bktr, 0, 128, (u_char *) &eeprom ); 694 695 /* For Hauppauge, check the EEPROM begins with 0x84 */ 696 if (eeprom[0] == 0x84) { 697 bktr->card = cards[ (card = CARD_HAUPPAUGE) ]; 698 bktr->card.eepromAddr = PFC8582_WADDR; 699 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 700 goto checkTuner; 701 } 702 703 /* For Osprey, check the EEPROM begins with "MMAC" */ 704 if ( (eeprom[0] == 'M') &&(eeprom[1] == 'M') 705 &&(eeprom[2] == 'A') &&(eeprom[3] == 'C')) { 706 bktr->card = cards[ (card = CARD_OSPREY) ]; 707 bktr->card.eepromAddr = PFC8582_WADDR; 708 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 709 goto checkTuner; 710 } 711 printf("%s: Warning: Unknown card type. EEPROM data not recognised\n", 712 bktr_name(bktr)); 713 printf("%s: %x %x %x %x\n", bktr_name(bktr), 714 eeprom[0],eeprom[1],eeprom[2],eeprom[3]); 715 } 716 717 /* look for an STB card */ 718 if ( (status = i2cRead( bktr, X24C01_RADDR )) != ABSENT ) { 719 bktr->card = cards[ (card = CARD_STB) ]; 720 bktr->card.eepromAddr = X24C01_WADDR; 721 bktr->card.eepromSize = (u_char)(128 / EEPROMBLOCKSIZE); 722 goto checkTuner; 723 } 724 725 } 726 727 signCard( bktr, 1, 128, (u_char *) &probe_signature ); 728 729 if (bootverbose) { 730 printf("%s: card signature: ", bktr_name(bktr)); 731 for (j = 0; j < Bt848_MAX_SIGN; j++) { 732 printf(" %02x ", probe_signature[j]); 733 } 734 printf("\n\n"); 735 } 736 for (i = 0; 737 i < (sizeof bt848_card_signature)/ sizeof (struct bt848_card_sig); 738 i++ ) { 739 740 card_found = 1; 741 probe_temp = (u_char *) &bt848_card_signature[i].signature; 742 743 for (j = 0; j < Bt848_MAX_SIGN; j++) { 744 if ((probe_temp[j] & 0xf) != (probe_signature[j] & 0xf)) { 745 card_found = 0; 746 break; 747 } 748 749 } 750 if (card_found) { 751 bktr->card = cards[ card = bt848_card_signature[i].card]; 752 eeprom_i2c_address = locate_eeprom_address( bktr ); 753 if (eeprom_i2c_address != -1) { 754 bktr->card.eepromAddr = eeprom_i2c_address; 755 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 756 } else { 757 bktr->card.eepromAddr = 0; 758 bktr->card.eepromSize = 0; 759 } 760 tuner_i2c_address = locate_tuner_address( bktr ); 761 select_tuner( bktr, bt848_card_signature[i].tuner ); 762 goto checkDBX; 763 } 764 } 765 766 /* We do not know the card type. Default to Miro */ 767 bktr->card = cards[ (card = CARD_MIRO) ]; 768 769 770checkEEPROM: 771 /* look for a configuration eeprom */ 772 eeprom_i2c_address = locate_eeprom_address( bktr ); 773 if (eeprom_i2c_address != -1) { 774 bktr->card.eepromAddr = eeprom_i2c_address; 775 bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE); 776 } else { 777 bktr->card.eepromAddr = 0; 778 bktr->card.eepromSize = 0; 779 } 780 781 782checkTuner: 783 784 /* look for a tuner */ 785 tuner_i2c_address = locate_tuner_address( bktr ); 786 if ( tuner_i2c_address == -1 ) { 787 select_tuner( bktr, NO_TUNER ); 788 goto checkDBX; 789 } 790 791#if defined( BKTR_OVERRIDE_TUNER ) 792 select_tuner( bktr, BKTR_OVERRIDE_TUNER ); 793 goto checkDBX; 794#endif 795 if (bktr->bt848_tuner != -1 ) { 796 select_tuner( bktr, bktr->bt848_tuner & 0xff ); 797 goto checkDBX; 798 } 799 800 /* Check for i2c devices */ 801 if (!any_i2c_devices) { 802 select_tuner( bktr, NO_TUNER ); 803 goto checkDBX; 804 } 805 806 /* differentiate type of tuner */ 807 808 switch (card) { 809 case CARD_MIRO: 810 switch (((INL(bktr, BKTR_GPIO_DATA) >> 10)-1)&7) { 811 case 0: select_tuner( bktr, TEMIC_PAL ); break; 812 case 1: select_tuner( bktr, PHILIPS_PAL ); break; 813 case 2: select_tuner( bktr, PHILIPS_NTSC ); break; 814 case 3: select_tuner( bktr, PHILIPS_SECAM ); break; 815 case 4: select_tuner( bktr, NO_TUNER ); break; 816 case 5: select_tuner( bktr, PHILIPS_PALI ); break; 817 case 6: select_tuner( bktr, TEMIC_NTSC ); break; 818 case 7: select_tuner( bktr, TEMIC_PALI ); break; 819 } 820 goto checkDBX; 821 break; 822 823 case CARD_HAUPPAUGE: 824 /* Hauppauge kindly supplied the following Tuner Table */ 825 /* FIXME: I think the tuners the driver selects for types */ 826 /* 0x08 and 0x15 may be incorrect but no one has complained. */ 827 /* Old Temic tuners had their own API, but newer Temic tuners */ 828 /* have the same API as Philips tuners */ 829 /* 830 ID Tuner Model Format We select Format 831 0x00 NONE 832 0x01 EXTERNAL 833 0x02 OTHER 834 0x03 Philips FI1216 BG 835 0x04 Philips FI1216MF BGLL' PHILIPS_SECAM 836 0x05 Philips FI1236 MN PHILIPS_NTSC 837 0x06 Philips FI1246 I PHILIPS_PALI 838 0x07 Philips FI1256 DK 839 0x08 Philips FI1216 MK2 BG PHILIPS_PALI 840 0x09 Philips FI1216MF MK2 BGLL' PHILIPS_SECAM 841 0x0a Philips FI1236 MK2 MN PHILIPS_NTSC 842 0x0b Philips FI1246 MK2 I PHILIPS_PALI 843 0x0c Philips FI1256 MK2 DK 844 0x0d Temic 4032FY5 NTSC TEMIC_NTSC 845 0x0e Temic 4002FH5 BG TEMIC_PAL 846 0x0f Temic 4062FY5 I TEMIC_PALI 847 0x10 Philips FR1216 MK2 BG 848 0x11 Philips FR1216MF MK2 BGLL' PHILIPS_FR1236_SECAM 849 0x12 Philips FR1236 MK2 MN PHILIPS_FR1236_NTSC 850 0x13 Philips FR1246 MK2 I 851 0x14 Philips FR1256 MK2 DK 852 0x15 Philips FM1216 BG PHILIPS_FR1216_PAL 853 0x16 Philips FM1216MF BGLL' PHILIPS_FR1236_SECAM 854 0x17 Philips FM1236 MN PHILIPS_FR1236_NTSC 855 0x18 Philips FM1246 I 856 0x19 Philips FM1256 DK 857 0x1a Temic 4036FY5 MN (FI1236 MK2 clone) PHILIPS_NTSC 858 0x1b Samsung TCPN9082D MN 859 0x1c Samsung TCPM9092P Pal BG/I/DK 860 0x1d Temic 4006FH5 BG PHILIPS_PALI 861 0x1e Samsung TCPN9085D MN/Radio 862 0x1f Samsung TCPB9085P Pal BG/I/DK / Radio 863 0x20 Samsung TCPL9091P Pal BG & Secam L/L' 864 0x21 Temic 4039FY5 NTSC Radio 865 0x22 Philips FQ1216ME Pal BGIDK & Secam L/L' 866 0x23 Temic 4066FY5 Pal I (FI1246 MK2 clone) PHILIPS_PALI 867 0x24 Philips TD1536 MN/ATSCDigital 868 0x25 Philips TD1536D MN/ATSCDigital DUAL INPUT 869 0x26 Philips FMR1236 M/N FM(no demod) 870 0x27 Philips FI1256MP B/G, D/K 871 0x28 Samsung TCPQ9091P BG/I/DK, L/L' 872 0x29 Temic 4006FN5 BG/I/DK 873 0x2a Temic 4009FR5 BG FM 874 0x2b Temic 4046FM5 B/G, I, D/K, L/L' 875 0x2c Temic 4009FN5 B/G, I, D/K, FM (no demod) 876 0x2d Philips TD1536D_FH_44 MN/ATSCDigital DUAL INPUT 877 */ 878 879 880 881 /* Determine the model number from the eeprom */ 882 if (bktr->card.eepromAddr != 0) { 883 u_int model; 884 u_int revision; 885 886 readEEProm(bktr, 0, 128, (u_char *) &eeprom ); 887 888 model = (eeprom[12] << 8 | eeprom[11]); 889 revision = (eeprom[15] << 16 | eeprom[14] << 8 | eeprom[13]); 890 if (verbose) 891 printf("%s: Hauppauge Model %d %c%c%c%c\n", 892 bktr_name(bktr), 893 model, 894 ((revision >> 18) & 0x3f) + 32, 895 ((revision >> 12) & 0x3f) + 32, 896 ((revision >> 6) & 0x3f) + 32, 897 ((revision >> 0) & 0x3f) + 32 ); 898 899 /* Determine the tuner type from the eeprom */ 900 tuner_code = eeprom[9]; 901 switch (tuner_code) { 902 903 case 0x5: 904 case 0x0a: 905 case 0x1a: 906 select_tuner( bktr, PHILIPS_NTSC ); 907 goto checkDBX; 908 909 case 0x4: 910 case 0x9: 911 select_tuner( bktr, PHILIPS_SECAM ); 912 goto checkDBX; 913 914 case 0x11: 915 case 0x16: 916 select_tuner( bktr, PHILIPS_FR1236_SECAM ); 917 goto checkDBX; 918 919 case 0x12: 920 case 0x17: 921 select_tuner( bktr, PHILIPS_FR1236_NTSC ); 922 goto checkDBX; 923 924 case 0x6: 925 case 0x8: 926 case 0xb: 927 case 0x1d: 928 case 0x23: 929 select_tuner( bktr, PHILIPS_PALI ); 930 goto checkDBX; 931 932 case 0xd: 933 select_tuner( bktr, TEMIC_NTSC ); 934 goto checkDBX; 935 936 case 0xe: 937 select_tuner( bktr, TEMIC_PAL ); 938 goto checkDBX; 939 940 case 0xf: 941 select_tuner( bktr, TEMIC_PALI ); 942 goto checkDBX; 943 944 case 0x15: 945 select_tuner( bktr, PHILIPS_FR1216_PAL ); 946 goto checkDBX; 947 948 default : 949 printf("%s: Warning - Unknown Hauppauge Tuner 0x%x\n", 950 bktr_name(bktr), tuner_code); 951 } 952 } 953 break; 954 955 956 case CARD_AVER_MEDIA: 957 /* AVerMedia kindly supplied some details of their EEPROM contents 958 * which allow us to auto select the Tuner Type. 959 * Only the newer AVerMedia cards actually have an EEPROM. 960 */ 961 if (bktr->card.eepromAddr != 0) { 962 963 u_char tuner_make; /* Eg Philips, Temic */ 964 u_char tuner_tv_fm; /* TV or TV with FM Radio */ 965 u_char tuner_format; /* Eg NTSC, PAL, SECAM */ 966 int tuner; 967 968 int tuner_0_table[] = { 969 PHILIPS_NTSC, PHILIPS_PAL, 970 PHILIPS_PAL, PHILIPS_PAL, 971 PHILIPS_PAL, PHILIPS_PAL, 972 PHILIPS_SECAM, PHILIPS_SECAM, 973 PHILIPS_SECAM, PHILIPS_PAL}; 974 975 int tuner_0_fm_table[] = { 976 PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL, 977 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, 978 PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, 979 PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM, 980 PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL}; 981 982 int tuner_1_table[] = { 983 TEMIC_NTSC, TEMIC_PAL, TEMIC_PAL, 984 TEMIC_PAL, TEMIC_PAL, TEMIC_PAL, 985 TEMIC_SECAM, TEMIC_SECAM, TEMIC_SECAM, 986 TEMIC_PAL}; 987 988 989 /* Extract information from the EEPROM data */ 990 readEEProm(bktr, 0, 128, (u_char *) &eeprom ); 991 992 tuner_make = (eeprom[0x41] & 0x7); 993 tuner_tv_fm = (eeprom[0x41] & 0x18) >> 3; 994 tuner_format = (eeprom[0x42] & 0xf0) >> 4; 995 996 /* Treat tuner make 0 (Philips) and make 2 (LG) the same */ 997 if ( ((tuner_make == 0) || (tuner_make == 2)) 998 && (tuner_format <= 9) && (tuner_tv_fm == 0) ) { 999 tuner = tuner_0_table[tuner_format]; 1000 select_tuner( bktr, tuner ); 1001 goto checkDBX; 1002 } 1003 1004 if ( ((tuner_make == 0) || (tuner_make == 2)) 1005 && (tuner_format <= 9) && (tuner_tv_fm == 1) ) { 1006 tuner = tuner_0_fm_table[tuner_format]; 1007 select_tuner( bktr, tuner ); 1008 goto checkDBX; 1009 } 1010 1011 if ( (tuner_make == 1) && (tuner_format <= 9) ) { 1012 tuner = tuner_1_table[tuner_format]; 1013 select_tuner( bktr, tuner ); 1014 goto checkDBX; 1015 } 1016 1017 printf("%s: Warning - Unknown AVerMedia Tuner Make %d Format %d\n", 1018 bktr_name(bktr), tuner_make, tuner_format); 1019 } 1020 break; 1021 1022 case CARD_LEADTEK: 1023#if BKTR_SYSTEM_DEFAULT == BROOKTREE_PAL 1024 select_tuner( bktr, PHILIPS_FR1216_PAL ); 1025#else 1026 select_tuner( bktr, PHILIPS_FR1236_NTSC ); 1027#endif 1028 goto checkDBX; 1029 break; 1030 1031 } /* end switch(card) */ 1032 1033 1034 /* At this point, a goto checkDBX has not occured */ 1035 /* We have not been able to select a Tuner */ 1036 /* Some cards make use of the tuner address to */ 1037 /* identify the make/model of tuner */ 1038 1039 /* At address 0xc0/0xc1 we often find a TEMIC NTSC */ 1040 if ( i2cRead( bktr, 0xc1 ) != ABSENT ) { 1041 select_tuner( bktr, TEMIC_NTSC ); 1042 goto checkDBX; 1043 } 1044 1045 /* At address 0xc6/0xc7 we often find a PHILIPS NTSC Tuner */ 1046 if ( i2cRead( bktr, 0xc7 ) != ABSENT ) { 1047 select_tuner( bktr, PHILIPS_NTSC ); 1048 goto checkDBX; 1049 } 1050 1051 /* Address 0xc2/0xc3 is default (or common address) for several */ 1052 /* tuners and we cannot tell which is which. */ 1053 /* And for all other tuner i2c addresses, select the default */ 1054 select_tuner( bktr, DEFAULT_TUNER ); 1055 1056 1057checkDBX: 1058#if defined( BKTR_OVERRIDE_DBX ) 1059 bktr->card.dbx = BKTR_OVERRIDE_DBX; 1060 goto checkMSP; 1061#endif 1062 /* Check for i2c devices */ 1063 if (!any_i2c_devices) { 1064 goto checkMSP; 1065 } 1066 1067 /* probe for BTSC (dbx) chip */ 1068 if ( i2cRead( bktr, TDA9850_RADDR ) != ABSENT ) 1069 bktr->card.dbx = 1; 1070 1071checkMSP: 1072 /* If this is a Hauppauge Bt878 card, we need to enable the 1073 * MSP 34xx audio chip. 1074 * If this is a Hauppauge Bt848 card, reset the MSP device. 1075 * The MSP reset line is wired to GPIO pin 5. On Bt878 cards a pulldown 1076 * resistor holds the device in reset until we set GPIO pin 5. 1077 */ 1078 1079 /* Optionally skip the MSP reset. This is handy if you initialise the 1080 * MSP audio in another operating system (eg Windows) first and then 1081 * do a soft reboot. 1082 */ 1083 1084#ifndef BKTR_NO_MSP_RESET 1085 if (card == CARD_HAUPPAUGE) { 1086 OUTL(bktr, BKTR_GPIO_OUT_EN, INL(bktr, BKTR_GPIO_OUT_EN) | (1<<5)); 1087 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */ 1088 DELAY(2500); /* wait 2.5ms */ 1089 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) & ~(1<<5)); /* write '0' */ 1090 DELAY(2500); /* wait 2.5ms */ 1091 OUTL(bktr, BKTR_GPIO_DATA, INL(bktr, BKTR_GPIO_DATA) | (1<<5)); /* write '1' */ 1092 DELAY(2500); /* wait 2.5ms */ 1093 } 1094#endif 1095 1096#if defined( BKTR_OVERRIDE_MSP ) 1097 bktr->card.msp3400c = BKTR_OVERRIDE_MSP; 1098 goto checkMSPEnd; 1099#endif 1100 1101 /* Check for i2c devices */ 1102 if (!any_i2c_devices) { 1103 goto checkMSPEnd; 1104 } 1105 1106 if ( i2cRead( bktr, MSP3400C_RADDR ) != ABSENT ) { 1107 bktr->card.msp3400c = 1; 1108 } 1109 1110checkMSPEnd: 1111 1112 if (bktr->card.msp3400c) { 1113 bktr->msp_addr = MSP3400C_WADDR; 1114 msp_read_id( bktr ); 1115 printf("%s: Detected a MSP%s at 0x%x\n", bktr_name(bktr), 1116 bktr->msp_version_string, 1117 bktr->msp_addr); 1118 1119 } 1120 1121/* Check for Dolby Surround Sound DPL3518A sound chip */ 1122 if ( i2cRead( bktr, DPL3518A_RADDR ) != ABSENT ) { 1123 bktr->card.dpl3518a = 1; 1124 } 1125 1126 if (bktr->card.dpl3518a) { 1127 bktr->dpl_addr = DPL3518A_WADDR; 1128 dpl_read_id( bktr ); 1129 printf("%s: Detected a DPL%s at 0x%x\n", bktr_name(bktr), 1130 bktr->dpl_version_string, 1131 bktr->dpl_addr); 1132 } 1133 1134/* Start of Check Remote */ 1135 /* Check for the Hauppauge IR Remote Control */ 1136 /* If there is an external unit, the internal will be ignored */ 1137 1138 bktr->remote_control = 0; /* initial value */ 1139 1140 if (any_i2c_devices) { 1141 if (i2cRead( bktr, HAUP_REMOTE_EXT_RADDR ) != ABSENT ) 1142 { 1143 bktr->remote_control = 1; 1144 bktr->remote_control_addr = HAUP_REMOTE_EXT_RADDR; 1145 } 1146 else if (i2cRead( bktr, HAUP_REMOTE_INT_RADDR ) != ABSENT ) 1147 { 1148 bktr->remote_control = 1; 1149 bktr->remote_control_addr = HAUP_REMOTE_INT_RADDR; 1150 } 1151 1152 } 1153 /* If a remote control is found, poll it 5 times to turn off the LED */ 1154 if (bktr->remote_control) { 1155 int i; 1156 for (i=0; i<5; i++) 1157 i2cRead( bktr, bktr->remote_control_addr ); 1158 } 1159/* End of Check Remote */ 1160 1161#if defined( BKTR_USE_PLL ) 1162 bktr->xtal_pll_mode = BT848_USE_PLL; 1163 goto checkPLLEnd; 1164#endif 1165 /* Default is to use XTALS and not PLL mode */ 1166 bktr->xtal_pll_mode = BT848_USE_XTALS; 1167 1168 /* Enable PLL mode for OSPREY users */ 1169 if (card == CARD_OSPREY) 1170 bktr->xtal_pll_mode = BT848_USE_PLL; 1171 1172 /* Enable PLL mode for Video Highway Xtreme users */ 1173 if (card == CARD_VIDEO_HIGHWAY_XTREME) 1174 bktr->xtal_pll_mode = BT848_USE_PLL; 1175 1176 1177 /* Most (perhaps all) Bt878 cards need to be switched to PLL mode */ 1178 /* as they only fit the NTSC crystal to their cards */ 1179 /* Default to enabling PLL mode for all Bt878/879 cards */ 1180 1181 if ((bktr->id==BROOKTREE_878 || bktr->id==BROOKTREE_879) ) 1182 bktr->xtal_pll_mode = BT848_USE_PLL; 1183 1184 1185#if defined( BKTR_USE_PLL ) 1186checkPLLEnd: 1187#endif 1188 1189 1190 bktr->card.tuner_pllAddr = tuner_i2c_address; 1191 1192 if ( verbose ) { 1193 printf( "%s: %s", bktr_name(bktr), bktr->card.name ); 1194 if ( bktr->card.tuner ) 1195 printf( ", %s tuner", bktr->card.tuner->name ); 1196 if ( bktr->card.dbx ) 1197 printf( ", dbx stereo" ); 1198 if ( bktr->card.msp3400c ) 1199 printf( ", msp3400c stereo" ); 1200 if ( bktr->card.dpl3518a ) 1201 printf( ", dpl3518a dolby" ); 1202 if ( bktr->remote_control ) 1203 printf( ", remote control" ); 1204 printf( ".\n" ); 1205 } 1206} 1207 1208#undef ABSENT 1209