Add BCTV3/PCI entry.

Rename functions bctv_* to bctv2_* and macros BCTV_* to BCTV2_* for
coexistance of BCTV2 and BCTV3.

Rename CARD_IO_GV to CARD_TO_BCTV2.

Add auto recognition of BCTV3/PCI.

PR:             i386/43879
Submitted by:   MOROHOSHI Akihiko <moro@remus.dti.ne.jp>
Approved by:    roger
MFC after:      6 days
This commit is contained in:
orion 2003-02-02 17:46:00 +00:00
parent 9b500bf3eb
commit 72a5c5c443
3 changed files with 95 additions and 67 deletions

View File

@ -85,13 +85,11 @@
#endif #endif
/* /*
* Prototypes for the GV_BCTV specific functions. * Prototypes for the GV_BCTV2 specific functions.
*/ */
void set_bctv_audio( bktr_ptr_t bktr ); void set_bctv2_audio( bktr_ptr_t bktr );
void bctv_gpio_write( bktr_ptr_t bktr, int port, int val ); void bctv2_gpio_write( bktr_ptr_t bktr, int port, int val );
/*int bctv_gpio_read( bktr_ptr_t bktr, int port );*/ /* Not used */ /*int bctv2_gpio_read( bktr_ptr_t bktr, int port );*/ /* Not used */
/* /*
* init_audio_devices * init_audio_devices
@ -171,8 +169,8 @@ set_audio( bktr_ptr_t bktr, int cmd )
* audio source. The I/O_GV card has a more advanced multiplexer * audio source. The I/O_GV card has a more advanced multiplexer
* and requires special handling. * and requires special handling.
*/ */
if ( bktr->bt848_card == CARD_IO_GV ) { if ( bktr->bt848_card == CARD_IO_BCTV2 ) {
set_bctv_audio( bktr ); set_bctv2_audio( bktr );
return( 0 ); return( 0 );
} }
@ -315,87 +313,87 @@ set_BTSC( bktr_ptr_t bktr, int control )
} }
/* /*
* CARD_GV_BCTV specific functions. * CARD_GV_BCTV2 specific functions.
*/ */
#define BCTV_AUDIO_MAIN 0x10 /* main audio program */ #define BCTV2_AUDIO_MAIN 0x10 /* main audio program */
#define BCTV_AUDIO_SUB 0x20 /* sub audio program */ #define BCTV2_AUDIO_SUB 0x20 /* sub audio program */
#define BCTV_AUDIO_BOTH 0x30 /* main(L) + sub(R) program */ #define BCTV2_AUDIO_BOTH 0x30 /* main(L) + sub(R) program */
#define BCTV_GPIO_REG0 1 #define BCTV2_GPIO_REG0 1
#define BCTV_GPIO_REG1 3 #define BCTV2_GPIO_REG1 3
#define BCTV_GR0_AUDIO_MODE 3 #define BCTV2_GR0_AUDIO_MODE 3
#define BCTV_GR0_AUDIO_MAIN 0 /* main program */ #define BCTV2_GR0_AUDIO_MAIN 0 /* main program */
#define BCTV_GR0_AUDIO_SUB 3 /* sub program */ #define BCTV2_GR0_AUDIO_SUB 3 /* sub program */
#define BCTV_GR0_AUDIO_BOTH 1 /* main(L) + sub(R) */ #define BCTV2_GR0_AUDIO_BOTH 1 /* main(L) + sub(R) */
#define BCTV_GR0_AUDIO_MUTE 4 /* audio mute */ #define BCTV2_GR0_AUDIO_MUTE 4 /* audio mute */
#define BCTV_GR0_AUDIO_MONO 8 /* force mono */ #define BCTV2_GR0_AUDIO_MONO 8 /* force mono */
void void
set_bctv_audio( bktr_ptr_t bktr ) set_bctv2_audio( bktr_ptr_t bktr )
{ {
int data; int data;
switch (bktr->audio_mux_select) { switch (bktr->audio_mux_select) {
case 1: /* external */ case 1: /* external */
case 2: /* internal */ case 2: /* internal */
bctv_gpio_write(bktr, BCTV_GPIO_REG1, 0); bctv2_gpio_write(bktr, BCTV2_GPIO_REG1, 0);
break; break;
default: /* tuner */ default: /* tuner */
bctv_gpio_write(bktr, BCTV_GPIO_REG1, 1); bctv2_gpio_write(bktr, BCTV2_GPIO_REG1, 1);
break; break;
} }
/* switch (bktr->audio_sap_select) { */ /* switch (bktr->audio_sap_select) { */
switch (BCTV_AUDIO_BOTH) { switch (BCTV2_AUDIO_BOTH) {
case BCTV_AUDIO_SUB: case BCTV2_AUDIO_SUB:
data = BCTV_GR0_AUDIO_SUB; data = BCTV2_GR0_AUDIO_SUB;
break; break;
case BCTV_AUDIO_BOTH: case BCTV2_AUDIO_BOTH:
data = BCTV_GR0_AUDIO_BOTH; data = BCTV2_GR0_AUDIO_BOTH;
break; break;
case BCTV_AUDIO_MAIN: case BCTV2_AUDIO_MAIN:
default: default:
data = BCTV_GR0_AUDIO_MAIN; data = BCTV2_GR0_AUDIO_MAIN;
break; break;
} }
if (bktr->audio_mute_state == TRUE) if (bktr->audio_mute_state == TRUE)
data |= BCTV_GR0_AUDIO_MUTE; data |= BCTV2_GR0_AUDIO_MUTE;
bctv_gpio_write(bktr, BCTV_GPIO_REG0, data); bctv2_gpio_write(bktr, BCTV2_GPIO_REG0, data);
return; return;
} }
/* gpio_data bit assignment */ /* gpio_data bit assignment */
#define BCTV_GPIO_ADDR_MASK 0x000300 #define BCTV2_GPIO_ADDR_MASK 0x000300
#define BCTV_GPIO_WE 0x000400 #define BCTV2_GPIO_WE 0x000400
#define BCTV_GPIO_OE 0x000800 #define BCTV2_GPIO_OE 0x000800
#define BCTV_GPIO_VAL_MASK 0x00f000 #define BCTV2_GPIO_VAL_MASK 0x00f000
#define BCTV_GPIO_PORT_MASK 3 #define BCTV2_GPIO_PORT_MASK 3
#define BCTV_GPIO_ADDR_SHIFT 8 #define BCTV2_GPIO_ADDR_SHIFT 8
#define BCTV_GPIO_VAL_SHIFT 12 #define BCTV2_GPIO_VAL_SHIFT 12
/* gpio_out_en value for read/write */ /* gpio_out_en value for read/write */
#define BCTV_GPIO_OUT_RMASK 0x000f00 #define BCTV2_GPIO_OUT_RMASK 0x000f00
#define BCTV_GPIO_OUT_WMASK 0x00ff00 #define BCTV2_GPIO_OUT_WMASK 0x00ff00
#define BCTV_BITS 100 #define BCTV2_BITS 100
void void
bctv_gpio_write( bktr_ptr_t bktr, int port, int val ) bctv2_gpio_write( bktr_ptr_t bktr, int port, int val )
{ {
u_long data, outbits; u_long data, outbits;
port &= BCTV_GPIO_PORT_MASK; port &= BCTV2_GPIO_PORT_MASK;
switch (port) { switch (port) {
case 1: case 1:
case 3: case 3:
data = ((val << BCTV_GPIO_VAL_SHIFT) & BCTV_GPIO_VAL_MASK) | data = ((val << BCTV2_GPIO_VAL_SHIFT) & BCTV2_GPIO_VAL_MASK) |
((port << BCTV_GPIO_ADDR_SHIFT) & BCTV_GPIO_ADDR_MASK) | ((port << BCTV2_GPIO_ADDR_SHIFT) & BCTV2_GPIO_ADDR_MASK) |
BCTV_GPIO_WE | BCTV_GPIO_OE; BCTV2_GPIO_WE | BCTV2_GPIO_OE;
outbits = BCTV_GPIO_OUT_WMASK; outbits = BCTV2_GPIO_OUT_WMASK;
break; break;
default: default:
return; return;
@ -403,28 +401,28 @@ bctv_gpio_write( bktr_ptr_t bktr, int port, int val )
OUTL(bktr, BKTR_GPIO_OUT_EN, 0); OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
OUTL(bktr, BKTR_GPIO_DATA, data); OUTL(bktr, BKTR_GPIO_DATA, data);
OUTL(bktr, BKTR_GPIO_OUT_EN, outbits); OUTL(bktr, BKTR_GPIO_OUT_EN, outbits);
DELAY(BCTV_BITS); DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV_GPIO_WE); OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV2_GPIO_WE);
DELAY(BCTV_BITS); DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, data); OUTL(bktr, BKTR_GPIO_DATA, data);
DELAY(BCTV_BITS); DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, ~0); OUTL(bktr, BKTR_GPIO_DATA, ~0);
OUTL(bktr, BKTR_GPIO_OUT_EN, 0); OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
} }
/* Not yet used /* Not yet used
int int
bctv_gpio_read( bktr_ptr_t bktr, int port ) bctv2_gpio_read( bktr_ptr_t bktr, int port )
{ {
u_long data, outbits, ret; u_long data, outbits, ret;
port &= BCTV_GPIO_PORT_MASK; port &= BCTV2_GPIO_PORT_MASK;
switch (port) { switch (port) {
case 1: case 1:
case 3: case 3:
data = ((port << BCTV_GPIO_ADDR_SHIFT) & BCTV_GPIO_ADDR_MASK) | data = ((port << BCTV2_GPIO_ADDR_SHIFT) & BCTV2_GPIO_ADDR_MASK) |
BCTV_GPIO_WE | BCTV_GPIO_OE; BCTV2_GPIO_WE | BCTV2_GPIO_OE;
outbits = BCTV_GPIO_OUT_RMASK; outbits = BCTV2_GPIO_OUT_RMASK;
break; break;
default: default:
return( -1 ); return( -1 );
@ -432,16 +430,16 @@ bctv_gpio_read( bktr_ptr_t bktr, int port )
OUTL(bktr, BKTR_GPIO_OUT_EN, 0); OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
OUTL(bktr, BKTR_GPIO_DATA, data); OUTL(bktr, BKTR_GPIO_DATA, data);
OUTL(bktr, BKTR_GPIO_OUT_EN, outbits); OUTL(bktr, BKTR_GPIO_OUT_EN, outbits);
DELAY(BCTV_BITS); DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV_GPIO_OE); OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV2_GPIO_OE);
DELAY(BCTV_BITS); DELAY(BCTV2_BITS);
ret = INL(bktr, BKTR_GPIO_DATA); ret = INL(bktr, BKTR_GPIO_DATA);
DELAY(BCTV_BITS); DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, data); OUTL(bktr, BKTR_GPIO_DATA, data);
DELAY(BCTV_BITS); DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, ~0); OUTL(bktr, BKTR_GPIO_DATA, ~0);
OUTL(bktr, BKTR_GPIO_OUT_EN, 0); OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
return( (ret & BCTV_GPIO_VAL_MASK) >> BCTV_GPIO_VAL_SHIFT ); return( (ret & BCTV2_GPIO_VAL_MASK) >> BCTV2_GPIO_VAL_SHIFT );
} }
*/ */

View File

@ -245,7 +245,7 @@ static const struct CARDTYPE cards[] = {
{ 0x01, 0x02, 0x01, 0x00, 1 }, /* audio MUX values */ { 0x01, 0x02, 0x01, 0x00, 1 }, /* audio MUX values */
0x0f }, /* GPIO mask */ 0x0f }, /* GPIO mask */
{ CARD_IO_GV, /* the card id */ { CARD_IO_BCTV2, /* the card id */
"I/O DATA GV-BCTV2/PCI", /* the 'name' */ "I/O DATA GV-BCTV2/PCI", /* the 'name' */
NULL, /* the tuner */ NULL, /* the tuner */
0, /* the tuner i2c address */ 0, /* the tuner i2c address */
@ -342,11 +342,24 @@ static const struct CARDTYPE cards[] = {
{ 0x20000, 0x00000, 0x30000, 0x40000, 1 }, /* audio MUX values*/ { 0x20000, 0x00000, 0x30000, 0x40000, 1 }, /* audio MUX values*/
0x70000 }, /* GPIO mask */ 0x70000 }, /* GPIO mask */
{ CARD_IO_BCTV3, /* the card id */
"I/O DATA GV-BCTV3/PCI", /* the 'name' */
NULL, /* the tuner */
0, /* the tuner i2c address */
0, /* dbx is optional */
0,
0,
0, /* EEProm type */
0, /* EEProm size */
/* Tuner, Extern, Intern, Mute, Enabled */
{ 0x10000, 0, 0x10000, 0, 1 }, /* audio MUX values */
0x10f00 }, /* GPIO mask */
}; };
struct bt848_card_sig bt848_card_signature[1]= { struct bt848_card_sig bt848_card_signature[1]= {
/* IMS TURBO TV : card 5 */ /* IMS TURBO TV : card 5 */
{ 5,9, {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 00, 00}} { 5,9, {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 02, 00, 00, 00, 00}}
}; };
@ -540,7 +553,9 @@ static int locate_eeprom_address( bktr_ptr_t bktr) {
#define PCI_VENDOR_FLYVIDEO 0x1851 #define PCI_VENDOR_FLYVIDEO 0x1851
#define PCI_VENDOR_FLYVIDEO_2 0x1852 #define PCI_VENDOR_FLYVIDEO_2 0x1852
#define PCI_VENDOR_PINNACLE_ALT 0xBD11 #define PCI_VENDOR_PINNACLE_ALT 0xBD11
#define PCI_VENDOR_IODATA 0x10fc
#define MODEL_IODATA_GV_BCTV3_PCI 0x4020
void void
probeCard( bktr_ptr_t bktr, int verbose, int unit ) probeCard( bktr_ptr_t bktr, int verbose, int unit )
@ -674,6 +689,14 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit )
goto checkTuner; goto checkTuner;
} }
if (subsystem_vendor_id == 0x10fc &&
subsystem_id == 0x4020) {
bktr->card = cards[ (card = CARD_IO_BCTV3) ];
bktr->card.eepromAddr = eeprom_i2c_address;
bktr->card.eepromSize = (u_char)(256 / EEPROMBLOCKSIZE);
goto checkTuner;
}
/* Vendor is unknown. We will use the standard probe code */ /* Vendor is unknown. We will use the standard probe code */
/* which may not give best results */ /* which may not give best results */
printf("%s: Warning - card vendor 0x%04x (model 0x%04x) unknown.\n", printf("%s: Warning - card vendor 0x%04x (model 0x%04x) unknown.\n",
@ -1086,6 +1109,11 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit )
goto checkDBX; goto checkDBX;
break; break;
case CARD_IO_BCTV3:
select_tuner( bktr, ALPS_TSCH5 ); /* ALPS_TSCH6, in fact. */
goto checkDBX;
break;
} /* end switch(card) */ } /* end switch(card) */

View File

@ -68,7 +68,7 @@
#define CARD_AVER_MEDIA 6 #define CARD_AVER_MEDIA 6
#define CARD_OSPREY 7 #define CARD_OSPREY 7
#define CARD_NEC_PK 8 #define CARD_NEC_PK 8
#define CARD_IO_GV 9 #define CARD_IO_BCTV2 9
#define CARD_FLYVIDEO 10 #define CARD_FLYVIDEO 10
#define CARD_ZOLTRIX 11 #define CARD_ZOLTRIX 11
#define CARD_KISS 12 #define CARD_KISS 12
@ -76,8 +76,10 @@
#define CARD_ASKEY_DYNALINK_MAGIC_TVIEW 14 #define CARD_ASKEY_DYNALINK_MAGIC_TVIEW 14
#define CARD_LEADTEK 15 #define CARD_LEADTEK 15
#define CARD_TERRATVPLUS 16 #define CARD_TERRATVPLUS 16
#define Bt848_MAX_CARD 17 #define CARD_IO_BCTV3 17
#define Bt848_MAX_CARD 18
#define CARD_IO_GV CARD_IO_BCTV2
int signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig ); int signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig );
void probeCard( bktr_ptr_t bktr, int verbose, int unit); void probeCard( bktr_ptr_t bktr, int verbose, int unit);