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>
This commit is contained in:
Roger Hardiman 2000-10-31 13:09:56 +00:00
parent bc3a71005f
commit 51c5172097
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=68071
5 changed files with 140 additions and 15 deletions

View File

@ -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)

View File

@ -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 */

View File

@ -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 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit )
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 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit )
((revision >> 0) & 0x3f) + 32 );
/* Determine the tuner type from the eeprom */
tuner_code = eeprom[9];
switch (tuner_code) {
case 0x5:
@ -950,7 +978,6 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit )
case 0xb:
case 0x1d:
case 0x23:
case 0x2c:
select_tuner( bktr, PHILIPS_PALI );
goto checkDBX;
@ -970,6 +997,11 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit )
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);

View File

@ -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 );
}

View File

@ -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 */
};