diff options
author | roger <roger@FreeBSD.org> | 2000-10-31 13:09:56 +0000 |
---|---|---|
committer | roger <roger@FreeBSD.org> | 2000-10-31 13:09:56 +0000 |
commit | c1ee5a7c6575ae3df85a6111665ef44b37eaee8e (patch) | |
tree | c30c7313eae85d99859c488400f56bb3aa4fd2ff /sys/dev | |
parent | eab5bada7501d3f89cca4d4ab173b64dd4ef4f5d (diff) | |
download | FreeBSD-src-c1ee5a7c6575ae3df85a6111665ef44b37eaee8e.zip FreeBSD-src-c1ee5a7c6575ae3df85a6111665ef44b37eaee8e.tar.gz |
Upgrade to driver 2.18
Support for new Hauppauge Model 44xxx WinTV Cards
(the ones with no audio mux)
Submitted by: Christian Gusenbauer <Christian.Gusenbauer@netway.at>
Diffstat (limited to 'sys/dev')
-rwxr-xr-x | sys/dev/bktr/CHANGELOG.TXT | 9 | ||||
-rw-r--r-- | sys/dev/bktr/bktr_audio.c | 62 | ||||
-rw-r--r-- | sys/dev/bktr/bktr_card.c | 52 | ||||
-rw-r--r-- | sys/dev/bktr/bktr_core.c | 28 | ||||
-rw-r--r-- | sys/dev/bktr/bktr_reg.h | 4 |
5 files changed, 140 insertions, 15 deletions
diff --git a/sys/dev/bktr/CHANGELOG.TXT b/sys/dev/bktr/CHANGELOG.TXT index 887cdc1..e1640c3 100755 --- a/sys/dev/bktr/CHANGELOG.TXT +++ b/sys/dev/bktr/CHANGELOG.TXT @@ -510,3 +510,12 @@ Fix PHK's commit so we only include machine/clock.h in FreeBSD 2.x, 3.x and 4.x systems +2.18 30 Oct 2000 Roger Hardiman - Add new ioctls to allow userland programs + fuller access to the I2C bus, BT848_MSP_READ BT848_MSP_WRITE + and BT848_MSP_RESET. + Add tuner type 0x2a. Remove 0x2c which was incorrect. + Christian Gusenbauer <Christian.Gusenbauer@netway.at> added + support for audio on Hauppauge cards without the audio mux. + The MSP is used for audio selection. (the 44xxx models) + + diff --git a/sys/dev/bktr/bktr_audio.c b/sys/dev/bktr/bktr_audio.c index b093b8c..8508eb1 100644 --- a/sys/dev/bktr/bktr_audio.c +++ b/sys/dev/bktr/bktr_audio.c @@ -202,15 +202,55 @@ set_audio( bktr_ptr_t bktr, int cmd ) else idx = bktr->audio_mux_select; + temp = INL(bktr, BKTR_GPIO_DATA) & ~bktr->card.gpio_mux_bits; #if defined( AUDIOMUX_DISCOVER ) OUTL(bktr, BKTR_GPIO_DATA, temp | (cmd & 0xff)); printf("%s: cmd: %d audio mux %x temp %x \n", bktr_name(bktr), - cmd, bktr->card.audiomuxs[ idx ], temp ); + cmd, bktr->card.audiomuxs[ idx ], temp ); #else OUTL(bktr, BKTR_GPIO_DATA, temp | bktr->card.audiomuxs[ idx ]); #endif /* AUDIOMUX_DISCOVER */ + + + /* Some new Hauppauge cards do not have an audio mux */ + /* Instead we use the MSP34xx chip to select TV audio, Line-In */ + /* FM Radio and Mute */ + /* Examples of this are the Hauppauge 44xxx MSP34xx models */ + /* It is ok to drive both the mux and the MSP34xx chip. */ + /* If there is no mux, the MSP does the switching of the audio source */ + /* If there is a mux, it does the switching of the audio source */ + + if ((bktr->card.msp3400c) && (bktr->audio_mux_present == 0)) { + + if (bktr->audio_mute_state == TRUE ) { + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x0000); /* volume to MUTE */ + } else { + if(bktr->audio_mux_select == 0) { /* TV Tuner */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */ + if (bktr->msp_source_selected != 0) msp_autodetect(bktr); /* setup TV audio mode */ + bktr->msp_source_selected = 0; + } + if(bktr->audio_mux_select == 1) { /* Line In */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000d, 0x1900); /* scart prescale */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008, 0x0220); /* SCART | STEREO */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0013, 0x0000); /* DSP In = SC1_IN_L/R */ + bktr->msp_source_selected = 1; + } + + if(bktr->audio_mux_select == 2) { /* FM Radio */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000d, 0x1900); /* scart prescale */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008, 0x0220); /* SCART | STEREO */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0013, 0x0200); /* DSP In = SC2_IN_L/R */ + bktr->msp_source_selected = 2; + } + } + } + + return( 0 ); } @@ -449,11 +489,24 @@ void msp_autodetect( bktr_ptr_t bktr ) { } + /* MSP3415D SPECIAL CASE Use the Tuner's Mono audio ouput for the MSP */ + /* (for Hauppauge 44xxx card with Tuner Type 0x2a) */ + else if ( ( (strncmp("3415D", bktr->msp_version_string, 5) == 0) + &&(bktr->msp_use_mono_source == 1) + ) + || (bktr->slow_msp_audio == 2) ){ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000d, 0x1900); /* scart prescale */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008, 0x0220); /* SCART | STEREO */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0013, 0x0100); /* DSP In = MONO IN */ + } + + /* MSP3410/MSP3415 - countries with mono, stereo using 2 FM channels and NICAM */ /* FAST sound scheme */ - if ( (strncmp("3430G", bktr->msp_version_string, 5) != 0) - && (bktr->slow_msp_audio == 0) ){ + else if (bktr->slow_msp_audio == 0) { msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */ + msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0000);/* Spkr Source = default(FM/AM) */ msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0020,0x0001);/* Enable Auto format detection */ msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0021,0x0001);/* Auto selection of NICAM/MONO mode */ } @@ -461,8 +514,7 @@ void msp_autodetect( bktr_ptr_t bktr ) { /* MSP3410/MSP3415 - European Countries where the fast MSP3410/3415 programming fails */ /* SLOW sound scheme */ - if ( (strncmp("3430G", bktr->msp_version_string, 5) != 0) - && (bktr->slow_msp_audio == 1) ){ + else if ( bktr->slow_msp_audio == 1) { msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */ msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0020,0x0001);/* Enable Auto format detection */ diff --git a/sys/dev/bktr/bktr_card.c b/sys/dev/bktr/bktr_card.c index 2ef02ed..830e668 100644 --- a/sys/dev/bktr/bktr_card.c +++ b/sys/dev/bktr/bktr_card.c @@ -550,7 +550,6 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit ) u_char probe_signature[128], *probe_temp; int any_i2c_devices; u_char eeprom[256]; - u_char tuner_code = 0; int tuner_i2c_address = -1; int eeprom_i2c_address = -1; @@ -894,23 +893,52 @@ checkTuner: 0x27 Philips FI1256MP B/G, D/K 0x28 Samsung TCPQ9091P BG/I/DK, L/L' 0x29 Temic 4006FN5 BG/I/DK - 0x2a Temic 4009FR5 BG FM + 0x2a Temic 4009FR5 BG FM PHILIPS_FR1216_PAL 0x2b Temic 4046FM5 B/G, I, D/K, L/L' - 0x2c Temic 4009FN5 B/G, I, D/K, FM (no demod) PHILIPS_PALI + 0x2c Temic 4009FN5 B/G, I, D/K, FM (no demod) 0x2d Philips TD1536D_FH_44 MN/ATSCDigital DUAL INPUT */ - /* Determine the model number from the eeprom */ if (bktr->card.eepromAddr != 0) { - u_int model; - u_int revision; + /* eeprom data block structure */ + unsigned char *block_1, *block_2, *block_3, *block_4; + int block_1_data_size, block_2_data_size, block_3_data_size; + int block_1_total_size, block_2_total_size, block_3_total_size; + int block_4_header_size; + + unsigned int model,revision; + unsigned char tuner_code; + unsigned char no_audio_mux; readEEProm(bktr, 0, 128, (u_char *) &eeprom ); - model = (eeprom[12] << 8 | eeprom[11]); - revision = (eeprom[15] << 16 | eeprom[14] << 8 | eeprom[13]); + /* LOCATE THE EEPROM DATA BLOCKS */ + block_1 = &eeprom[0]; + block_1_data_size = (block_1[2] << 8 | block_1[1]); + block_1_total_size = block_1_data_size + 3; /* Header bytes */ + + block_2 = &eeprom[block_1_total_size]; + block_2_data_size = (block_2[2] << 8 | block_2[1]); + block_2_total_size = block_2_data_size + 3; /* Header bytes */ + + block_3 = &eeprom[block_1_total_size + block_2_total_size]; + block_3_data_size = (block_3[0] &0x07); + block_3_total_size = block_3_data_size + 1; /* Header size */ + + block_4 = &eeprom[block_1_total_size +block_2_total_size +block_3_total_size]; + block_4_header_size = 1; + + model = (block_1[12] << 8 | block_1[11]); + revision = (block_1[15] << 16 | block_1[14] << 8 | block_1[13]); + + tuner_code = block_1[9]; + + no_audio_mux = ((block_3[3] >> 7) &0x01); + + if (no_audio_mux) bktr->audio_mux_present = 0; + if (verbose) printf("%s: Hauppauge Model %d %c%c%c%c\n", bktr_name(bktr), @@ -921,7 +949,7 @@ checkTuner: ((revision >> 0) & 0x3f) + 32 ); /* Determine the tuner type from the eeprom */ - tuner_code = eeprom[9]; + switch (tuner_code) { case 0x5: @@ -950,7 +978,6 @@ checkTuner: case 0xb: case 0x1d: case 0x23: - case 0x2c: select_tuner( bktr, PHILIPS_PALI ); goto checkDBX; @@ -970,6 +997,11 @@ checkTuner: select_tuner( bktr, PHILIPS_FR1216_PAL ); goto checkDBX; + case 0x2a: + bktr->msp_use_mono_source = 1; + select_tuner( bktr, PHILIPS_FR1216_PAL ); + goto checkDBX; + default : printf("%s: Warning - Unknown Hauppauge Tuner 0x%x\n", bktr_name(bktr), tuner_code); diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c index 694b344..d0402e4 100644 --- a/sys/dev/bktr/bktr_core.c +++ b/sys/dev/bktr/bktr_core.c @@ -604,6 +604,9 @@ bktr_store_address(unit, BKTR_MEM_BUF, buf); bktr->bt848_tuner = -1; bktr->reverse_mute = -1; bktr->slow_msp_audio = 0; + bktr->msp_use_mono_source = 0; + bktr->msp_source_selected = -1; + bktr->audio_mux_present = 1; probeCard( bktr, TRUE, unit ); @@ -2253,6 +2256,31 @@ tuner_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro break; +#ifdef BT848_MSP_READ + /* I2C ioctls to allow userland access to the MSP chip */ + case BT848_MSP_READ: + { + struct bktr_msp_control *msp; + msp = (struct bktr_msp_control *) arg; + msp->data = msp_dpl_read(bktr, bktr->msp_addr, + msp->function, msp->address); + break; + } + + case BT848_MSP_WRITE: + { + struct bktr_msp_control *msp; + msp = (struct bktr_msp_control *) arg; + msp_dpl_write(bktr, bktr->msp_addr, msp->function, + msp->address, msp->data ); + break; + } + + case BT848_MSP_RESET: + msp_dpl_reset(bktr, bktr->msp_addr); + break; +#endif + default: return common_ioctl( bktr, cmd, arg ); } diff --git a/sys/dev/bktr/bktr_reg.h b/sys/dev/bktr/bktr_reg.h index 6d869d4..ab9bd6e 100644 --- a/sys/dev/bktr/bktr_reg.h +++ b/sys/dev/bktr/bktr_reg.h @@ -699,6 +699,10 @@ struct bktr_softc { int dpl_addr; /* DPL i2c address */ int slow_msp_audio; /* 0 = use fast MSP3410/3415 programming sequence */ /* 1 = use slow MSP3410/3415 programming sequence */ + /* 2 = use Tuner's Mono audio output via the MSP chip */ + int msp_use_mono_source; /* use Tuner's Mono audio output via the MSP chip */ + int audio_mux_present; /* 1 = has audio mux on GPIO lines, 0 = no audio mux */ + int msp_source_selected; /* 0 = TV source, 1 = Line In source, 2 = FM Radio Source */ }; |