From owner-freebsd-multimedia Sun Oct 26 18:02:43 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id SAA05788 for multimedia-outgoing; Sun, 26 Oct 1997 18:02:43 -0800 (PST) (envelope-from owner-freebsd-multimedia) Received: from ns1.yes.no (ns1.yes.no [195.119.24.10]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id SAA05782 for ; Sun, 26 Oct 1997 18:02:37 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [194.198.43.36]) by ns1.yes.no (8.8.7/8.8.7) with ESMTP id CAA11314 for ; Mon, 27 Oct 1997 02:02:34 GMT Received: (from eivind@localhost) by bitbox.follo.net (8.8.6/8.8.6) id DAA00345; Mon, 27 Oct 1997 03:02:30 +0100 (MET) Date: Mon, 27 Oct 1997 03:02:30 +0100 (MET) Message-Id: <199710270202.DAA00345@bitbox.follo.net> From: Eivind Eklund To: multimedia@freebsd.org Subject: Bt848 driver patches Sender: owner-freebsd-multimedia@freebsd.org X-Loop: FreeBSD.org Precedence: bulk The following patches add PAL support, and make some more of the code table-driven than before. Beware that I don't know the correct magic for RSVD - heck, I don't even know what it means :-) I still don't get sound, and haven't looked at the 32-bits color issue yet - I'll look at those issues as soon as these patches (or similar) have been OKed. Could somebody test that it still work OK with NTSC? Should I commit it if it work OK? Eivind. Index: brktree_reg.h =================================================================== RCS file: /home/ncvs/src/sys/pci/brktree_reg.h,v retrieving revision 1.8 diff -u -r1.8 brktree_reg.h --- brktree_reg.h 1997/10/07 06:30:00 1.8 +++ brktree_reg.h 1997/10/27 01:23:02 @@ -337,6 +337,10 @@ int horizontal, vertical; /* frame rate . for ntsc is 30 frames per second */ int frame_rate; +/* A-delay and B-delay */ + u_char adelay, bdelay; +/* Iform XTSEL value */ + int iform_xtsel; }; Index: brooktree848.c =================================================================== RCS file: /home/ncvs/src/sys/pci/brooktree848.c,v retrieving revision 1.16 diff -u -r1.16 brooktree848.c --- brooktree848.c 1997/10/08 06:54:43 1.16 +++ brooktree848.c 1997/10/27 01:59:41 @@ -406,10 +406,22 @@ */ static struct format_params format_params[] = { -#define FORMAT_PARAMS_NTSC525 0 - { 525, 22, 480, 910, 135, 754, 640, 780, 30 }, -#define FORMAT_PARAMS_PAL625 1 - { 625, 32, 576, 1135, 186, 922, 768, 944, 25 } +/* # define BT848_IFORM_F_AUTO (0x0) - don't matter. */ + { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, 0 }, +/* # define BT848_IFORM_F_NTSCM (0x1) */ + { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 }, +/* # define BT848_IFORM_F_NTSCJ (0x2) */ + { 525, 22, 480, 910, 135, 754, 640, 780, 30, 0x68, 0x5d, BT848_IFORM_X_XT0 }, +/* # define BT848_IFORM_F_PALBDGHI (0x3) */ + { 525, 32, 480, 1135, 186, 754, 768, 944, 25, 0x7f, 0x72, BT848_IFORM_X_XT1 }, +/* # define BT848_IFORM_F_PALM (0x4) */ + { 625, 32, 576, 910, 186, 922, 640, 780, 25, 0x68, 0x5d, BT848_IFORM_X_XT0 }, +/* # define BT848_IFORM_F_PALN (0x5) */ + { 625, 32, 576, 1135, 186, 922, 768, 944, 25, 0x7f, 0x72, BT848_IFORM_X_XT1 }, +/* # define BT848_IFORM_F_SECAM (0x6) */ + { 625, 32, 576, 1135, 186, 922, 768, 944, 25, 0x7f, 0x00, BT848_IFORM_X_XT1 }, +/* # define BT848_IFORM_F_RSVD (0x7) - ???? */ + { 625, 32, 576, 1135, 186, 922, 768, 944, 25, 0x7f, 0x72, BT848_IFORM_X_XT0 }, }; /* @@ -1070,7 +1082,7 @@ BT848_IFORM_X_XT0 | BT848_IFORM_F_NTSCM; bktr->flags = (bktr->flags & ~METEOR_DEV_MASK) | METEOR_DEV0; - bktr->format_params = FORMAT_PARAMS_NTSC525; + bktr->format_params = BT848_IFORM_F_NTSCM; bktr->max_clip_node = 0; @@ -1130,7 +1142,7 @@ /* enable drivers on the GPIO port that control the MUXes */ bktr->base->gpio_out_en = GPIO_AUDIOMUX_BITS; - /* unmure the audio stream */ + /* unmute the audio stream */ set_audio( bktr, AUDIO_UNMUTE ); /* enable stereo if appropriate */ @@ -1399,7 +1411,7 @@ case BT848SFMT: /* set input format */ temp = *(unsigned long*)arg & BT848_IFORM_FORMAT; bt848->iform &= ~BT848_IFORM_FORMAT; - bt848->iform |= temp; + bt848->iform |= (temp | format_params[temp].iform_xtsel); switch( temp ) { case BT848_IFORM_F_AUTO: bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | @@ -1408,23 +1420,25 @@ case BT848_IFORM_F_NTSCM: case BT848_IFORM_F_NTSCJ: - case BT848_IFORM_F_PALM: bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | - METEOR_NTSC; - bt848->adelay = 0x68; - bt848->bdelay = 0x5d; - bktr->format_params = FORMAT_PARAMS_NTSC525; + METEOR_NTSC; + bt848->adelay = format_params[temp].adelay; + bt848->bdelay = format_params[temp].bdelay; + bktr->format_params = temp; break; case BT848_IFORM_F_PALBDGHI: case BT848_IFORM_F_PALN: case BT848_IFORM_F_SECAM: case BT848_IFORM_F_RSVD: + case BT848_IFORM_F_PALM: bktr->flags = (bktr->flags & ~METEOR_FORM_MASK) | METEOR_PAL; - bt848->adelay = 0x7f; - bt848->bdelay = 0x72; - bktr->format_params = FORMAT_PARAMS_PAL625; + bt848->adelay = format_params[temp].adelay; + bt848->bdelay = format_params[temp].bdelay; + bktr->format_params = temp; + break; + } break; @@ -1438,7 +1452,7 @@ bt848->iform |= BT848_IFORM_F_NTSCM; bt848->adelay = 0x68; bt848->bdelay = 0x5d; - bktr->format_params = FORMAT_PARAMS_NTSC525; + bktr->format_params = BT848_IFORM_F_NTSCM; break; case METEOR_FMT_PAL: @@ -1448,7 +1462,7 @@ bt848->iform |= BT848_IFORM_F_PALBDGHI; bt848->adelay = 0x7f; bt848->bdelay = 0x72; - bktr->format_params = FORMAT_PARAMS_PAL625; + bktr->format_params = BT848_IFORM_F_PALBDGHI; break; case METEOR_FMT_AUTOMODE: @@ -3410,6 +3424,8 @@ #define PHILIPS_NTSC 4 #define PHILIPS_PAL 5 #define PHILIPS_SECAM 6 +#define TEMIC_PALI 7 +#define PHILIPS_PALI 8 /* XXX FIXME: this list is incomplete */ /* input types */ @@ -3487,7 +3503,23 @@ 0x00, /* PLL write address */ TSA552x_SCONTROL, /* control byte for PLL */ { 0x00, 0x00 }, /* band-switch crosspoints */ - { 0xa0, 0x90, 0x30 } } /* the band-switch values */ + { 0xa0, 0x90, 0x30 } }, /* the band-switch values */ + + /* TEMIC_PAL I */ + { "Temic PAL I", /* the 'name' */ + TTYPE_PAL, /* input type */ + TEMIC_PALI_WADDR, /* PLL write address */ + TSA552x_SCONTROL, /* control byte for PLL */ + { 0x00, 0x00 }, /* band-switch crosspoints */ + { 0x02, 0x04, 0x01 } }, /* the band-switch values */ + + /* PHILIPS_PAL */ + { "Philips PAL I", /* the 'name' */ + TTYPE_PAL, /* input type */ + 0x00, /* PLL write address */ + TSA552x_SCONTROL, /* control byte for PLL */ + { 0x00, 0x00 }, /* band-switch crosspoints */ + { 0xa0, 0x90, 0x30 } }, /* the band-switch values */ }; @@ -3527,12 +3559,19 @@ { int card; int status; + bt848_ptr_t bt848; + + bt848 = bktr->base; #if defined( OVERRIDE_CARD ) bktr->card = cards[ (card = OVERRIDE_CARD) ]; goto checkTuner; #endif + bt848->gpio_out_en = 0; + if (bootverbose) + printf("bktr: GPIO is 0x%08x\n", bt848->gpio_data); + /* look for a tuner */ if ( i2cRead( bktr, TSA552x_RADDR ) == ABSENT ) { bktr->card = cards[ (card = CARD_INTEL) ]; @@ -3562,26 +3601,40 @@ #endif /* differentiate type of tuner */ - if ( i2cRead( bktr, TEMIC_NTSC_RADDR ) != ABSENT ) { + switch (card) { + case CARD_MIRO: + switch (((bt848->gpio_data >> 10)-1)&7) { + case 0: bktr->card.tuner = &tuners[ TEMIC_PAL ]; + case 1: bktr->card.tuner = &tuners[ PHILIPS_PAL ]; + case 2: bktr->card.tuner = &tuners[ PHILIPS_NTSC ]; + case 3: bktr->card.tuner = &tuners[ PHILIPS_SECAM ]; + case 4: bktr->card.tuner = &tuners[ NO_TUNER ]; + case 5: bktr->card.tuner = &tuners[ PHILIPS_PALI ]; + case 6: bktr->card.tuner = &tuners[ TEMIC_NTSC ]; + case 7: bktr->card.tuner = &tuners[ TEMIC_PALI ]; + } + break; + default: + if ( i2cRead( bktr, TEMIC_NTSC_RADDR ) != ABSENT ) { bktr->card.tuner = &tuners[ TEMIC_NTSC ]; goto checkDBX; - } + } - if ( i2cRead( bktr, PHILIPS_NTSC_RADDR ) != ABSENT ) { + if ( i2cRead( bktr, PHILIPS_NTSC_RADDR ) != ABSENT ) { bktr->card.tuner = &tuners[ PHILIPS_NTSC ]; goto checkDBX; - } + } - if ( card == CARD_HAUPPAUGE ) { + if ( card == CARD_HAUPPAUGE ) { if ( i2cRead( bktr, TEMIC_PALI_RADDR ) != ABSENT ) { - bktr->card.tuner = &tuners[ TEMIC_PAL ]; - goto checkDBX; + bktr->card.tuner = &tuners[ TEMIC_PAL ]; + goto checkDBX; } + } + /* no tuner found */ + bktr->card.tuner = &tuners[ NO_TUNER ]; } - /* no tuner found */ - bktr->card.tuner = &tuners[ NO_TUNER ]; - checkDBX: #if defined( OVERRIDE_DBX ) bktr->card.dbx = OVERRIDE_DBX; @@ -4230,4 +4283,5 @@ /* c-label-offset: -8 */ /* c-continued-statement-offset: 8 */ /* c-tab-always-indent: nil */ +/* tab-width: 8 */ /* End: */