diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-08-01 21:46:10 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-08-01 22:11:08 +0200 |
commit | 71c5c6de8c1fa39cfd668348ad0c02b913eb205e (patch) | |
tree | 82de6f20467075f888d0251022f855d015d164c3 | |
parent | 370c1d36f9e3025870f41e39c06b12689d51e688 (diff) |
Added output detection based on PInS data.
-rw-r--r-- | src/mga.h | 13 | ||||
-rw-r--r-- | src/mga_bios.c | 10 | ||||
-rw-r--r-- | src/mga_driver.c | 43 |
3 files changed, 53 insertions, 13 deletions
@@ -301,6 +301,14 @@ typedef enum { MGA_HOST_AGP_4x = 7 /**< AGP 4x capable. */ } mga_host_t; +typedef enum { + MGA_CONNECTOR_NONE = 0, + MGA_CONNECTOR_HD15, + MGA_CONNECTOR_DVI, + MGA_CONNECTOR_TV, + MGA_CONNECTOR_LAST = MGA_CONNECTOR_TV +} mga_connector_t; + /** * Card information derrived from BIOS PInS data. */ @@ -341,6 +349,11 @@ struct mga_bios_values { * Type of physical interface used for the card. */ mga_host_t host_interface; + + /** + * On G450 and G550 PInS lists the available connectors. + */ + mga_connector_t connector[2]; }; diff --git a/src/mga_bios.c b/src/mga_bios.c index dd75f3f..bf70b84 100644 --- a/src/mga_bios.c +++ b/src/mga_bios.c @@ -118,6 +118,7 @@ static void mga_initialize_bios_values( MGAPtr pMga, (void) memset( bios, 0, sizeof( *bios ) ); bios->pixel.min_freq = 50000; + bios->connector[0] = bios->connector[1] = MGA_CONNECTOR_NONE; switch( pMga->Chipset ) { case PCI_CHIP_MGA2064: @@ -341,6 +342,7 @@ static void mga_parse_bios_ver_5( struct mga_bios_values * bios, const CARD8 * bios_data ) { const unsigned scale = (bios_data[4] != 0) ? 8000 : 6000; + mga_connector_t connector; if ( bios_data[38] != 0xff ) { @@ -397,6 +399,14 @@ static void mga_parse_bios_ver_5( struct mga_bios_values * bios, } bios->host_interface = (bios_data[113] >> 3) & 0x07; + + connector = bios_data[116] & 0x0f; + if (connector <= MGA_CONNECTOR_LAST) + bios->connector[0] = connector; + + connector = (bios_data[116] >> 4) & 0x0f; + if (connector <= MGA_CONNECTOR_LAST) + bios->connector[1] = connector; } diff --git a/src/mga_driver.c b/src/mga_driver.c index ed923e8..71b9857 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -1078,24 +1078,41 @@ MGAMavenRead(ScrnInfoPtr pScrn, I2CByte reg, I2CByte *val) static void setup_outputs(ScrnInfoPtr scrn) { + MGAPtr pMga; xf86OutputPtr output; - /* FIXME: - * Create outputs depending on the hardware. - */ - output = MgaGOutputPanelInit (scrn); + pMga = MGAPTR(scrn); + + /* first output */ + switch (pMga->bios.connector[0]) { + case MGA_CONNECTOR_DVI: + output = MgaGOutputPanelInit (scrn); + break; + default: + /* in case PInS doesn't contain connector info + * or it claims there's no primary output + * we just assume it's VGA. + */ + output = MgaGOutputDac1Init (scrn); + break; + } + + /* the first output can be mapped to any crtc */ output->possible_crtcs = 1 | 2; - output->possible_clones = 1 | 2; -#if 0 - output = MgaGOutputDac1Init (scrn); - output->possible_crtcs = 1 | 2; - output->possible_clones = 1 | 2; -#endif + /* second output */ + switch (pMga->bios.connector[1]) { + case MGA_CONNECTOR_HD15: + output = MgaGOutputDac2Init (scrn); + break; + default: + output = NULL; + break; + } - output = MgaGOutputDac2Init (scrn); - output->possible_crtcs = 2; - output->possible_clones = 2; + /* the second output can only be mapped to crtc 2 */ + if (output) + output->possible_crtcs = 2; } /* Mandatory */ |