mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Update to driver release 2.04
Update AverMedia GPIO values Submitted by: AverMedia Add support for WinTV Theater Dolby Surround Sound DPL3518A chip Submitted by: Frank Nobis <fn@radio-do.de> Make PLL mode the default for Bt878s. You no longer need options BKTR_USE_PLL
This commit is contained in:
parent
2d7a9a2efd
commit
56597309fa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52593
@ -1,4 +1,7 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* MAINTAINER = Roger Hardiman <roger@freebsd.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is part of the Driver for Video Capture Cards (Frame grabbers)
|
||||
@ -414,3 +417,11 @@
|
||||
2.03 5 Oct 1999 Thomas Runge <runge@rostock.zgdv.de>
|
||||
Found FM radio bug mute introduced in release 2.00
|
||||
|
||||
2.04 20 Oct 1999 Roger Hardiman <roger@freebsd.org>
|
||||
Updated AverMedia audio sources to support FM and Line In
|
||||
sources properly. (Based on info supplied by AverMedia)
|
||||
Make PLL mode the default for Bt878 chips. This means PAL
|
||||
Bt878 users no longer need the BKTR_USE_PLL kernel option.
|
||||
Detect and auto-configure Dolby Surround Sound DPL3518A chip
|
||||
on Hauppauge WinTV Theater. From Frank Nobis <fn@radio-do.de>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
* bktr_audio : This deals with controlling the audio on TV cards,
|
||||
* controlling the Audio Multiplexer (audio source selector).
|
||||
* controlling any MSP34xx stereo audio decoders.
|
||||
* controlling any DPL35xx dolby surroud sound audio decoders.
|
||||
* initialising TDA98xx audio devices.
|
||||
*
|
||||
*/
|
||||
@ -84,7 +85,11 @@ void init_audio_devices( bktr_ptr_t bktr ) {
|
||||
|
||||
/* reset the MSP34xx stereo audio chip */
|
||||
if ( bktr->card.msp3400c )
|
||||
msp_reset( bktr );
|
||||
msp_dpl_reset( bktr, bktr->msp_addr );
|
||||
|
||||
/* reset the DPL35xx dolby audio chip */
|
||||
if ( bktr->card.dpl3518a )
|
||||
msp_dpl_reset( bktr, bktr->dpl_addr );
|
||||
|
||||
}
|
||||
|
||||
@ -395,8 +400,8 @@ bctv_gpio_read( bktr_ptr_t bktr, int port )
|
||||
/* Read the MSP version string */
|
||||
void msp_read_id( bktr_ptr_t bktr ){
|
||||
int rev1=0, rev2=0;
|
||||
rev1 = msp_read(bktr, 0x12, 0x001e);
|
||||
rev2 = msp_read(bktr, 0x12, 0x001f);
|
||||
rev1 = msp_dpl_read(bktr, bktr->msp_addr, 0x12, 0x001e);
|
||||
rev2 = msp_dpl_read(bktr, bktr->msp_addr, 0x12, 0x001f);
|
||||
|
||||
sprintf(bktr->msp_version_string, "34%02d%c-%c%d",
|
||||
(rev2>>8)&0xff, (rev1&0xff)+'@', ((rev1>>8)&0xff)+'@', rev2&0x1f);
|
||||
@ -410,23 +415,55 @@ void msp_autodetect( bktr_ptr_t bktr ) {
|
||||
if (strncmp("3430G", bktr->msp_version_string, 5) == 0){
|
||||
|
||||
/* For MSP3430G - countries with mono and DBX stereo */
|
||||
msp_write(bktr, 0x10, 0x0030,0x2003);/* Enable Auto format detection */
|
||||
msp_write(bktr, 0x10, 0x0020,0x0020);/* Standard Select Reg. = BTSC-Stereo*/
|
||||
msp_write(bktr, 0x12, 0x000E,0x2403);/* darned if I know */
|
||||
msp_write(bktr, 0x12, 0x0008,0x0320);/* Source select = (St or A) */
|
||||
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0030,0x2003);/* Enable Auto format detection */
|
||||
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0020,0x0020);/* Standard Select Reg. = BTSC-Stereo*/
|
||||
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000E,0x2403);/* darned if I know */
|
||||
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0320);/* Source select = (St or A) */
|
||||
/* & Ch. Matrix = St */
|
||||
msp_write(bktr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */
|
||||
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */
|
||||
|
||||
} else {
|
||||
|
||||
/* For MSP3410 / 3415 - countries with mono, stereo using 2 FM channels
|
||||
and NICAM */
|
||||
msp_write(bktr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */
|
||||
msp_write(bktr, 0x10, 0x0020,0x0001);/* Enable Auto format detection */
|
||||
msp_write(bktr, 0x10, 0x0021,0x0001);/* Auto selection of NICAM/MONO mode */
|
||||
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 */
|
||||
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0021,0x0001);/* Auto selection of NICAM/MONO mode */
|
||||
}
|
||||
|
||||
/* uncomment the following line to enable the MSP34xx 1Khz Tone Generator */
|
||||
/* turn your speaker volume down low before trying this */
|
||||
/* msp_write(bktr, 0x12, 0x0014, 0x7f40); */
|
||||
/* msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0014, 0x7f40); */
|
||||
}
|
||||
|
||||
/* Read the DPL version string */
|
||||
void dpl_read_id( bktr_ptr_t bktr ){
|
||||
int rev1=0, rev2=0;
|
||||
rev1 = msp_dpl_read(bktr, bktr->dpl_addr, 0x12, 0x001e);
|
||||
rev2 = msp_dpl_read(bktr, bktr->dpl_addr, 0x12, 0x001f);
|
||||
|
||||
sprintf(bktr->dpl_version_string, "34%02d%c-%c%d",
|
||||
((rev2>>8)&0xff)-1, (rev1&0xff)+'@', ((rev1>>8)&0xff)+'@', rev2&0x1f);
|
||||
}
|
||||
|
||||
/* Configure the DPL chip to Auto-detect the audio format */
|
||||
void dpl_autodetect( bktr_ptr_t bktr ) {
|
||||
|
||||
/* The following are empiric values tried from the DPL35xx data sheet */
|
||||
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x000c,0x0320); /* quasi peak detector source dolby
|
||||
lr 0x03xx; quasi peak detector matrix
|
||||
stereo 0xXX20 */
|
||||
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0040,0x0060); /* Surround decoder mode;
|
||||
ADAPTIVE/3D-PANORAMA, that means two
|
||||
speakers and no center speaker, all
|
||||
channels L/R/C/S mixed to L and R */
|
||||
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0041,0x0620); /* surround source matrix;I2S2/STEREO*/
|
||||
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0042,0x1F00); /* surround delay 31ms max */
|
||||
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0043,0x0000); /* automatic surround input balance */
|
||||
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0044,0x4000); /* surround spatial effect 50%
|
||||
recommended*/
|
||||
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0045,0x5400); /* surround panorama effect 66%
|
||||
recommended with PANORAMA mode
|
||||
in 0x0040 set to panorama */
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
* bktr_audio : This deals with controlling the audio on TV cards,
|
||||
* controlling the Audio Multiplexer (audio source selector).
|
||||
* controlling any MSP34xx stereo audio decoders.
|
||||
* controlling any DPL35xx dolby surroud sound audio decoders.
|
||||
* initialising TDA98xx audio devices.
|
||||
*
|
||||
*/
|
||||
@ -66,6 +67,13 @@ void msp_autodetect( bktr_ptr_t bktr );
|
||||
void msp_read_id( bktr_ptr_t bktr );
|
||||
|
||||
|
||||
/*
|
||||
* DPL35xx Audio Chip functions.
|
||||
*/
|
||||
void dpl_autodetect( bktr_ptr_t bktr );
|
||||
void dpl_read_id( bktr_ptr_t bktr );
|
||||
|
||||
|
||||
/*
|
||||
* TDA98xx Audio Chip functions.
|
||||
*/
|
||||
|
@ -80,6 +80,9 @@
|
||||
#define MSP3400C_WADDR 0x80
|
||||
#define MSP3400C_RADDR 0x81
|
||||
|
||||
/* address of DPL3518A chip */
|
||||
#define DPL3518A_WADDR 0x84
|
||||
#define DPL3518A_RADDR 0x85
|
||||
|
||||
/* EEProm (128 * 8) on an STB card */
|
||||
#define X24C01_WADDR 0xae
|
||||
@ -114,6 +117,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx unknown */
|
||||
0,
|
||||
0,
|
||||
0, /* EEProm unknown */
|
||||
0, /* EEProm unknown */
|
||||
{ 0, 0, 0, 0, 0 },
|
||||
@ -125,6 +129,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx unknown */
|
||||
0,
|
||||
0,
|
||||
0, /* EEProm unknown */
|
||||
0, /* size unknown */
|
||||
{ 0x02, 0x01, 0x00, 0x0a, 1 }, /* audio MUX values */
|
||||
@ -136,6 +141,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0,
|
||||
0,
|
||||
PFC8582_WADDR, /* EEProm type */
|
||||
(u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
|
||||
{ 0x00, 0x02, 0x01, 0x04, 1 }, /* audio MUX values */
|
||||
@ -147,6 +153,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0,
|
||||
0,
|
||||
X24C01_WADDR, /* EEProm type */
|
||||
(u_char)(128 / EEPROMBLOCKSIZE), /* 128 bytes */
|
||||
{ 0x00, 0x01, 0x02, 0x02, 1 }, /* audio MUX values */
|
||||
@ -160,6 +167,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{ 0, 0, 0, 0, 0 }, /* audio MUX values */
|
||||
0x00 }, /* GPIO mask */
|
||||
|
||||
@ -169,6 +177,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0,
|
||||
0,
|
||||
PFC8582_WADDR, /* EEProm type */
|
||||
(u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
|
||||
{ 0x01, 0x02, 0x01, 0x00, 1 }, /* audio MUX values */
|
||||
@ -180,16 +189,18 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0,
|
||||
0,
|
||||
0, /* EEProm type */
|
||||
0, /* EEProm size */
|
||||
{ 0x0c, 0x00, 0x0b, 0x0b, 1 }, /* audio MUX values */
|
||||
0x0f }, /* GPIO mask */
|
||||
{ 0x0c, 0x08, 0x04, 0x00, 1 }, /* audio MUX values */
|
||||
0x1f }, /* GPIO mask */
|
||||
|
||||
{ CARD_OSPREY, /* the card id */
|
||||
"MMAC Osprey", /* the 'name' */
|
||||
NULL, /* the tuner */
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0,
|
||||
0,
|
||||
PFC8582_WADDR, /* EEProm type */
|
||||
(u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
|
||||
@ -201,6 +212,7 @@ static const struct CARDTYPE cards[] = {
|
||||
NULL, /* the tuner */
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0,
|
||||
0,
|
||||
0, /* EEProm type */
|
||||
0, /* EEProm size */
|
||||
@ -213,6 +225,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0,
|
||||
0,
|
||||
0, /* EEProm type */
|
||||
0, /* EEProm size */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 1 }, /* Has special MUX handler */
|
||||
@ -224,6 +237,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0, /* msp34xx is optional */
|
||||
0, /* dpl3518a is optional */
|
||||
0xac, /* EEProm type */
|
||||
(u_char)(256 / EEPROMBLOCKSIZE), /* 256 bytes */
|
||||
{ 0x000, 0x800, 0x400, 0x8dff00, 1 },/* audio MUX values */
|
||||
@ -235,6 +249,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0, /* msp34xx is optional */
|
||||
0, /* dpl3518a is optional */
|
||||
0, /* EEProm type */
|
||||
0, /* EEProm size */
|
||||
{ 0x04, 0x01, 0x00, 0x0a, 1 }, /* audio MUX values */
|
||||
@ -246,6 +261,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0, /* the tuner i2c address */
|
||||
0, /* dbx is optional */
|
||||
0, /* msp34xx is optional */
|
||||
0, /* dpl3518a is optional */
|
||||
0, /* EEProm type */
|
||||
0, /* EEProm size */
|
||||
{ 0x0c, 0x00, 0x0b, 0x0b, 1 }, /* audio MUX values */
|
||||
@ -257,6 +273,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, /* EEProm type */
|
||||
0, /* EEProm size */
|
||||
{ 0x00, 0x02, 0x01, 0x04, 1 }, /* audio MUX values */
|
||||
@ -268,6 +285,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, /* EEProm type */
|
||||
0, /* EEProm size */
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0 }, /* audio MUX values */
|
||||
@ -279,6 +297,7 @@ static const struct CARDTYPE cards[] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, /* EEProm type */
|
||||
0, /* EEProm size */
|
||||
/* Tuner, Extern, Intern, Mute, Enabled */
|
||||
@ -1035,6 +1054,20 @@ checkMSPEnd:
|
||||
|
||||
}
|
||||
|
||||
/* Check for Dolby Surround Sound DPL3518A sound chip */
|
||||
if ( i2cRead( bktr, DPL3518A_RADDR ) != ABSENT ) {
|
||||
bktr->card.dpl3518a = 1;
|
||||
}
|
||||
|
||||
if (bktr->card.dpl3518a) {
|
||||
bktr->dpl_addr = DPL3518A_WADDR;
|
||||
/* dpl_read_id( bktr );
|
||||
printf("bktr%d: Detected a DPL%s at 0x%x\n", unit,
|
||||
bktr->dpl_version_string,
|
||||
bktr->dpl_addr);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/* Start of Check Remote */
|
||||
/* Check for the Hauppauge IR Remote Control */
|
||||
@ -1081,25 +1114,9 @@ checkMSPEnd:
|
||||
|
||||
/* Most (perhaps all) Bt878 cards need to be switched to PLL mode */
|
||||
/* as they only fit the NTSC crystal to their cards */
|
||||
/* Default to enabling PLL mode for all Bt878/879 cards */
|
||||
|
||||
/* Enable PLL mode for PAL/SECAM users on Hauppauge 878 cards */
|
||||
if ((card == CARD_HAUPPAUGE) &&
|
||||
(bktr->id==BROOKTREE_878 || bktr->id==BROOKTREE_879) )
|
||||
bktr->xtal_pll_mode = BT848_USE_PLL;
|
||||
|
||||
/* Enable PLL mode for PAL/SECAM users on FlyVideo 878 cards */
|
||||
if ((card == CARD_FLYVIDEO) &&
|
||||
(bktr->id==BROOKTREE_878 || bktr->id==BROOKTREE_879) )
|
||||
bktr->xtal_pll_mode = BT848_USE_PLL;
|
||||
|
||||
/* Enable PLL mode for Askey Dynalink users */
|
||||
if ((card == CARD_ASKEY_DYNALINK_MAGIC_TVIEW) &&
|
||||
(bktr->id==BROOKTREE_878 || bktr->id==BROOKTREE_879) )
|
||||
bktr->xtal_pll_mode = BT848_USE_PLL;
|
||||
|
||||
/* Enable PLL mode for Leadtek users */
|
||||
if ((card == CARD_LEADTEK) &&
|
||||
(bktr->id==BROOKTREE_878 || bktr->id==BROOKTREE_879) )
|
||||
if ((bktr->id==BROOKTREE_878 || bktr->id==BROOKTREE_879) )
|
||||
bktr->xtal_pll_mode = BT848_USE_PLL;
|
||||
|
||||
|
||||
@ -1118,6 +1135,8 @@ checkPLLEnd:
|
||||
printf( ", dbx stereo" );
|
||||
if ( bktr->card.msp3400c )
|
||||
printf( ", msp3400c stereo" );
|
||||
if ( bktr->card.dpl3518a )
|
||||
printf( ", dpl3518a dolby" );
|
||||
if ( bktr->remote_control )
|
||||
printf( ", remote control" );
|
||||
printf( ".\n" );
|
||||
|
@ -1847,6 +1847,10 @@ tuner_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr )
|
||||
if ( bktr->card.msp3400c )
|
||||
msp_autodetect( bktr );
|
||||
|
||||
/* after every channel change, we must restart the DPL35xx */
|
||||
if ( bktr->card.dpl3518a )
|
||||
dpl_autodetect( bktr );
|
||||
|
||||
temp_mute( bktr, FALSE );
|
||||
break;
|
||||
|
||||
@ -1885,6 +1889,10 @@ tuner_ioctl( bktr_ptr_t bktr, int unit, int cmd, caddr_t arg, struct proc* pr )
|
||||
if ( bktr->card.msp3400c )
|
||||
msp_autodetect( bktr );
|
||||
|
||||
/* after every channel change, we must restart the DPL35xx */
|
||||
if ( bktr->card.dpl3518a )
|
||||
dpl_autodetect( bktr );
|
||||
|
||||
temp_mute( bktr, FALSE );
|
||||
break;
|
||||
|
||||
@ -3736,13 +3744,13 @@ i2cRead( bktr_ptr_t bktr, int addr )
|
||||
|
||||
#define IICBUS(bktr) ((bktr)->i2c_sc.iicbus)
|
||||
|
||||
/* The MSP34xx Audio chip require i2c bus writes of up to 5 bytes which the */
|
||||
/* bt848 automated i2c bus controller cannot handle */
|
||||
/* The MSP34xx and DPL35xx Audio chip require i2c bus writes of up */
|
||||
/* to 5 bytes which the bt848 automated i2c bus controller cannot handle */
|
||||
/* Therefore we need low level control of the i2c bus hardware */
|
||||
|
||||
/* Write to the MSP registers */
|
||||
/* Write to the MSP or DPL registers */
|
||||
void
|
||||
msp_write(bktr_ptr_t bktr, unsigned char dev, unsigned int addr, unsigned int data)
|
||||
msp_dpl_write(bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr, unsigned int data)
|
||||
{
|
||||
unsigned char addr_l, addr_h, data_h, data_l ;
|
||||
|
||||
@ -3751,7 +3759,7 @@ msp_write(bktr_ptr_t bktr, unsigned char dev, unsigned int addr, unsigned int da
|
||||
data_h = (data >>8) & 0xff;
|
||||
data_l = data & 0xff;
|
||||
|
||||
iicbus_start(IICBUS(bktr), bktr->msp_addr, 0 /* no timeout? */);
|
||||
iicbus_start(IICBUS(bktr), i2c_addr, 0 /* no timeout? */);
|
||||
|
||||
iicbus_write_byte(IICBUS(bktr), dev, 0);
|
||||
iicbus_write_byte(IICBUS(bktr), addr_h, 0);
|
||||
@ -3764,9 +3772,9 @@ msp_write(bktr_ptr_t bktr, unsigned char dev, unsigned int addr, unsigned int da
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write to the MSP registers */
|
||||
/* Read from the MSP or DPL registers */
|
||||
unsigned int
|
||||
msp_read(bktr_ptr_t bktr, unsigned char dev, unsigned int addr)
|
||||
msp_dpl_read(bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr)
|
||||
{
|
||||
unsigned int data;
|
||||
unsigned char addr_l, addr_h, dev_r;
|
||||
@ -3778,13 +3786,13 @@ msp_read(bktr_ptr_t bktr, unsigned char dev, unsigned int addr)
|
||||
dev_r = dev+1;
|
||||
|
||||
/* XXX errors ignored */
|
||||
iicbus_start(IICBUS(bktr), bktr->msp_addr, 0 /* no timeout? */);
|
||||
iicbus_start(IICBUS(bktr), i2c_addr, 0 /* no timeout? */);
|
||||
|
||||
iicbus_write_byte(IICBUS(bktr), dev_r, 0);
|
||||
iicbus_write_byte(IICBUS(bktr), addr_h, 0);
|
||||
iicbus_write_byte(IICBUS(bktr), addr_l, 0);
|
||||
|
||||
iicbus_repeated_start(IICBUS(bktr), bktr->msp_addr +1, 0 /* no timeout? */);
|
||||
iicbus_repeated_start(IICBUS(bktr), i2c_addr +1, 0 /* no timeout? */);
|
||||
iicbus_read(IICBUS(bktr), data_read, 2, &read, IIC_LAST_READ, 0);
|
||||
iicbus_stop(IICBUS(bktr));
|
||||
|
||||
@ -3793,24 +3801,24 @@ msp_read(bktr_ptr_t bktr, unsigned char dev, unsigned int addr)
|
||||
return (data);
|
||||
}
|
||||
|
||||
/* Reset the MSP chip */
|
||||
/* Reset the MSP or DPL chip */
|
||||
/* The user can block the reset (which is handy if you initialise the
|
||||
* MSP audio in another operating system first (eg in Windows)
|
||||
* MSP and/or DPL audio in another operating system first (eg in Windows)
|
||||
*/
|
||||
void
|
||||
msp_reset( bktr_ptr_t bktr )
|
||||
msp_dpl_reset( bktr_ptr_t bktr, int i2c_addr )
|
||||
{
|
||||
|
||||
#ifndef BKTR_NO_MSP_RESET
|
||||
/* put into reset mode */
|
||||
iicbus_start(IICBUS(bktr), bktr->msp_addr, 0 /* no timeout? */);
|
||||
iicbus_start(IICBUS(bktr), i2c_addr, 0 /* no timeout? */);
|
||||
iicbus_write_byte(IICBUS(bktr), 0x00, 0);
|
||||
iicbus_write_byte(IICBUS(bktr), 0x80, 0);
|
||||
iicbus_write_byte(IICBUS(bktr), 0x00, 0);
|
||||
iicbus_stop(IICBUS(bktr));
|
||||
|
||||
/* put back to operational mode */
|
||||
iicbus_start(IICBUS(bktr), bktr->msp_addr, 0 /* no timeout? */);
|
||||
iicbus_start(IICBUS(bktr), i2c_addr, 0 /* no timeout? */);
|
||||
iicbus_write_byte(IICBUS(bktr), 0x00, 0);
|
||||
iicbus_write_byte(IICBUS(bktr), 0x00, 0);
|
||||
iicbus_write_byte(IICBUS(bktr), 0x00, 0);
|
||||
@ -4019,9 +4027,10 @@ static int i2c_read_byte( bktr_ptr_t bktr, unsigned char *data, int last ) {
|
||||
}
|
||||
#undef BITD
|
||||
|
||||
/* Write to the MSP registers */
|
||||
void msp_write( bktr_ptr_t bktr, unsigned char dev, unsigned int addr, unsigned int data){
|
||||
unsigned int msp_w_addr = bktr->msp_addr;
|
||||
/* Write to the MSP or DPL registers */
|
||||
void msp_dpl_write( bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr,
|
||||
unsigned int data){
|
||||
unsigned int msp_w_addr = i2c_addr;
|
||||
unsigned char addr_l, addr_h, data_h, data_l ;
|
||||
addr_h = (addr >>8) & 0xff;
|
||||
addr_l = addr & 0xff;
|
||||
@ -4038,8 +4047,8 @@ void msp_write( bktr_ptr_t bktr, unsigned char dev, unsigned int addr, unsigned
|
||||
i2c_stop(bktr);
|
||||
}
|
||||
|
||||
/* Write to the MSP registers */
|
||||
unsigned int msp_read(bktr_ptr_t bktr, unsigned char dev, unsigned int addr){
|
||||
/* Read from the MSP or DPL registers */
|
||||
unsigned int msp_dpl_read(bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr){
|
||||
unsigned int data;
|
||||
unsigned char addr_l, addr_h, data_1, data_2, dev_r ;
|
||||
addr_h = (addr >>8) & 0xff;
|
||||
@ -4047,13 +4056,13 @@ unsigned int msp_read(bktr_ptr_t bktr, unsigned char dev, unsigned int addr){
|
||||
dev_r = dev+1;
|
||||
|
||||
i2c_start(bktr);
|
||||
i2c_write_byte(bktr,bktr->msp_addr);
|
||||
i2c_write_byte(bktr,i2c_addr);
|
||||
i2c_write_byte(bktr,dev_r);
|
||||
i2c_write_byte(bktr,addr_h);
|
||||
i2c_write_byte(bktr,addr_l);
|
||||
|
||||
i2c_start(bktr);
|
||||
i2c_write_byte(bktr,bktr->msp_addr+1);
|
||||
i2c_write_byte(bktr,i2c_addr+1);
|
||||
i2c_read_byte(bktr,&data_1, 0);
|
||||
i2c_read_byte(bktr,&data_2, 1);
|
||||
i2c_stop(bktr);
|
||||
@ -4061,16 +4070,16 @@ unsigned int msp_read(bktr_ptr_t bktr, unsigned char dev, unsigned int addr){
|
||||
return data;
|
||||
}
|
||||
|
||||
/* Reset the MSP chip */
|
||||
/* Reset the MSP or DPL chip */
|
||||
/* The user can block the reset (which is handy if you initialise the
|
||||
* MSP audio in another operating system first (eg in Windows)
|
||||
*/
|
||||
void msp_reset( bktr_ptr_t bktr ) {
|
||||
void msp_dpl_reset( bktr_ptr_t bktr, int i2c_addr ) {
|
||||
|
||||
#ifndef BKTR_NO_MSP_RESET
|
||||
/* put into reset mode */
|
||||
i2c_start(bktr);
|
||||
i2c_write_byte(bktr, bktr->msp_addr);
|
||||
i2c_write_byte(bktr, i2c_addr);
|
||||
i2c_write_byte(bktr, 0x00);
|
||||
i2c_write_byte(bktr, 0x80);
|
||||
i2c_write_byte(bktr, 0x00);
|
||||
@ -4078,7 +4087,7 @@ void msp_reset( bktr_ptr_t bktr ) {
|
||||
|
||||
/* put back to operational mode */
|
||||
i2c_start(bktr);
|
||||
i2c_write_byte(bktr, bktr->msp_addr);
|
||||
i2c_write_byte(bktr, i2c_addr);
|
||||
i2c_write_byte(bktr, 0x00);
|
||||
i2c_write_byte(bktr, 0x00);
|
||||
i2c_write_byte(bktr, 0x00);
|
||||
|
@ -52,10 +52,10 @@
|
||||
int i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 );
|
||||
int i2cRead( bktr_ptr_t bktr, int addr );
|
||||
|
||||
void msp_reset( bktr_ptr_t bktr );
|
||||
unsigned int msp_read(bktr_ptr_t bktr, unsigned char dev, unsigned int addr);
|
||||
void msp_write( bktr_ptr_t bktr, unsigned char dev,
|
||||
unsigned int addr, unsigned int data);
|
||||
void msp_dpl_reset( bktr_ptr_t bktr, int i2d_addr );
|
||||
unsigned int msp_dpl_read( bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr );
|
||||
void msp_dpl_write( bktr_ptr_t bktr, int i2c_addr, unsigned char dev,
|
||||
unsigned int addr, unsigned int data );
|
||||
|
||||
|
||||
/*
|
||||
|
@ -128,11 +128,23 @@ static device_method_t bti2c_methods[] = {
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
#if (__FreeBSD_version < 400000)
|
||||
/* FreeBSD 3.x needs DRIVER_TYPE_MISC */
|
||||
static driver_t bti2c_driver = {
|
||||
"bti2c",
|
||||
bti2c_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
sizeof(struct bti2c_softc),
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (__FreeBSD_version >=400000)
|
||||
static driver_t bti2c_driver = {
|
||||
"bti2c",
|
||||
bti2c_methods,
|
||||
sizeof(struct bti2c_softc),
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Call this to pass the base address of the bktr device to the
|
||||
|
@ -1117,7 +1117,7 @@ bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr )
|
||||
/*
|
||||
* bktr_mmap.
|
||||
* Note: 2.2.5/2.2.6/2.2.7/3.0 users must manually
|
||||
* edit the following line and change "vm_offset_t" to "int""
|
||||
* edit the line below and change "vm_offset_t" to "int"
|
||||
*/
|
||||
int bktr_mmap( dev_t dev, vm_offset_t offset, int nprot )
|
||||
|
||||
|
@ -367,6 +367,7 @@ struct CARDTYPE {
|
||||
u_char tuner_pllAddr; /* Tuner i2c address */
|
||||
u_char dbx; /* Has DBX chip? */
|
||||
u_char msp3400c; /* Has msp3400c chip? */
|
||||
u_char dpl3518a; /* Has dpl3518a chip? */
|
||||
u_char eepromAddr;
|
||||
u_char eepromSize; /* bytes / EEPROMBLOCKSIZE */
|
||||
u_int audiomuxs[ 5 ]; /* tuner, ext (line-in) */
|
||||
@ -590,11 +591,13 @@ struct bktr_softc {
|
||||
u_long id;
|
||||
#define BT848_USE_XTALS 0
|
||||
#define BT848_USE_PLL 1
|
||||
int xtal_pll_mode; /* Use XTAL or PLL mode for PAL/SECAM */ int remote_control; /* remote control detected */
|
||||
int remote_control_addr; /* remote control i2c address */
|
||||
int xtal_pll_mode; /* Use XTAL or PLL mode for PAL/SECAM */
|
||||
int remote_control; /* remote control detected */
|
||||
int remote_control_addr; /* remote control i2c address */
|
||||
char msp_version_string[9]; /* MSP version string 34xxx-xx */
|
||||
int msp_addr; /* MSP i2c address */
|
||||
|
||||
char dpl_version_string[9]; /* DPL version string 35xxx-xx */
|
||||
int dpl_addr; /* DPL i2c address */
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user