xf86-video-ati: Branch 'atombios-support' - 3 commits

Alex Deucher agd5f at kemper.freedesktop.org
Fri Nov 30 22:09:51 PST 2007


 src/radeon_atombios.c |  172 +++++++++++++++++++++++++++++++++++++++++++++++++-
 src/radeon_bios.c     |    3 
 src/radeon_probe.h    |    1 
 3 files changed, 174 insertions(+), 2 deletions(-)

New commits:
commit 1e029fef5fe264f2ced445b80bf6070abcb84b82
Author: Alex Deucher <alex at samba.(none)>
Date:   Sat Dec 1 00:58:51 2007 -0500

    RADEON: move GPIO lookup to a separate function

diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index aa25ed3..9d17e47 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -1326,11 +1326,38 @@ rhdAtomParseI2CRecord(atomBiosHandlePtr handle,
     }
 }
 
+static CARD32
+RADEONLookupGPIOLineForDDC(ScrnInfoPtr pScrn, CARD8 id)
+{
+    RADEONInfoPtr info = RADEONPTR (pScrn);
+    atomDataTablesPtr atomDataPtr;
+    ATOM_GPIO_I2C_ASSIGMENT gpio;
+    CARD32 ret = 0;
+    CARD8 crev, frev;
+
+    atomDataPtr = info->atomBIOS->atomDataPtr;
+
+    if (!rhdAtomGetTableRevisionAndSize(
+	    &(atomDataPtr->GPIO_I2C_Info->sHeader),
+	    &crev,&frev,NULL)) {
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No GPIO Info Table found!\n");
+	return ret;
+    }
+
+    /* note clk and data regs can be different!
+     * gpio.usClkMaskRegisterIndex and gpio.usDataMaskRegisterIndex
+     */
+
+    gpio = atomDataPtr->GPIO_I2C_Info->asGPIO_Info[id];
+    ret = gpio.usClkMaskRegisterIndex * 4;
+
+    return ret;
+}
+
 Bool
 RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr info = RADEONPTR (pScrn);
-    int ret;
     CARD8 crev, frev;
     unsigned short size;
     atomDataTablesPtr atomDataPtr;
@@ -1445,13 +1472,6 @@ RADEONGetATOMConnectorInfoFromBIOSConnectorTable (ScrnInfoPtr pScrn)
     atomDataPtr = info->atomBIOS->atomDataPtr;
 
     if (!rhdAtomGetTableRevisionAndSize(
-	    &(atomDataPtr->GPIO_I2C_Info->sHeader),
-	    &crev,&frev,NULL)) {
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No GPIO Info Table found!\n");
-	return FALSE;
-    }
-
-    if (!rhdAtomGetTableRevisionAndSize(
 	    &(atomDataPtr->SupportedDevicesInfo.SupportedDevicesInfo->sHeader),
 	    &crev,&frev,NULL)) {
 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No Device Info Table found!\n");
@@ -1481,26 +1501,18 @@ RADEONGetATOMConnectorInfoFromBIOSConnectorTable (ScrnInfoPtr pScrn)
 	info->BiosConnector[i].DACType = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC - 1;
 
 	if (ci.sucI2cId.sbfAccess.bfHW_Capable) {
-	    ATOM_GPIO_I2C_ASSIGMENT gpio
-		= atomDataPtr->GPIO_I2C_Info->asGPIO_Info[ci.sucI2cId.sbfAccess.bfI2C_LineMux];
-
-	    /* note clk and data regs can be different!
-	     * gpio.usClkMaskRegisterIndex and gpio.usDataMaskRegisterIndex
-	     */
-
 	    /* don't assign a gpio for tv */
 	    if ((i == ATOM_DEVICE_TV1_INDEX) ||
 		(i == ATOM_DEVICE_TV2_INDEX) ||
 		(i == ATOM_DEVICE_CV_INDEX))
 		info->BiosConnector[i].ddc_line = 0;
 	    else
-		info->BiosConnector[i].ddc_line = gpio.usClkMaskRegisterIndex * 4;
+		info->BiosConnector[i].ddc_line =
+		    RADEONLookupGPIOLineForDDC(pScrn, ci.sucI2cId.sbfAccess.bfI2C_LineMux);
 	} else if (ci.sucI2cId.sbfAccess.bfI2C_LineMux) {
-	    ATOM_GPIO_I2C_ASSIGMENT gpio
-		= atomDataPtr->GPIO_I2C_Info->asGPIO_Info[ci.sucI2cId.sbfAccess.bfI2C_LineMux];
-
 	    /* add support for GPIO line */
-	    ErrorF("Unsupported SW GPIO - device %d: gpio line: 0x%x\n", i, gpio.usClkMaskRegisterIndex * 4);
+	    ErrorF("Unsupported SW GPIO - device %d: gpio line: 0x%x\n",
+		   i, RADEONLookupGPIOLineForDDC(pScrn, ci.sucI2cId.sbfAccess.bfI2C_LineMux));
 	    info->BiosConnector[i].ddc_line = 0;
 	} else {
 	    info->BiosConnector[i].ddc_line = 0;
commit dcbef1ba9dfcf35c28e058832a55adf00afb472e
Author: Alex Deucher <alex at samba.(none)>
Date:   Sat Dec 1 00:35:25 2007 -0500

    RADEON: fix typo in previous commit
    
    check gpio table revision before connector table revision

diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index 1670020..aa25ed3 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -1445,16 +1445,16 @@ RADEONGetATOMConnectorInfoFromBIOSConnectorTable (ScrnInfoPtr pScrn)
     atomDataPtr = info->atomBIOS->atomDataPtr;
 
     if (!rhdAtomGetTableRevisionAndSize(
-	    &(atomDataPtr->SupportedDevicesInfo.SupportedDevicesInfo->sHeader),
+	    &(atomDataPtr->GPIO_I2C_Info->sHeader),
 	    &crev,&frev,NULL)) {
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No Device Info Table found!\n");
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No GPIO Info Table found!\n");
 	return FALSE;
     }
 
     if (!rhdAtomGetTableRevisionAndSize(
-	    &(atomDataPtr->GPIO_I2C_Info->sHeader),
+	    &(atomDataPtr->SupportedDevicesInfo.SupportedDevicesInfo->sHeader),
 	    &crev,&frev,NULL)) {
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No GPIO Info Table found!\n");
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No Device Info Table found!\n");
 	return FALSE;
     }
 
commit fdce0598a2228c48c84deae1d7bebb2d7b3e979b
Author: Alex Deucher <alex at samba.(none)>
Date:   Sat Dec 1 00:15:34 2007 -0500

    RADEON: convert atombios connector table parsing to use ATOM structs
    
    convert and add hpd info

diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c
index fc816b2..1670020 100644
--- a/src/radeon_atombios.c
+++ b/src/radeon_atombios.c
@@ -1326,7 +1326,8 @@ rhdAtomParseI2CRecord(atomBiosHandlePtr handle,
     }
 }
 
-Bool RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn)
+Bool
+RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr info = RADEONPTR (pScrn);
     int ret;
@@ -1432,6 +1433,161 @@ Bool RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn)
     return TRUE;
 }
 
+
+Bool
+RADEONGetATOMConnectorInfoFromBIOSConnectorTable (ScrnInfoPtr pScrn)
+{
+    RADEONInfoPtr info = RADEONPTR (pScrn);
+    atomDataTablesPtr atomDataPtr;
+    CARD8 crev, frev;
+    int i, j;
+
+    atomDataPtr = info->atomBIOS->atomDataPtr;
+
+    if (!rhdAtomGetTableRevisionAndSize(
+	    &(atomDataPtr->SupportedDevicesInfo.SupportedDevicesInfo->sHeader),
+	    &crev,&frev,NULL)) {
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No Device Info Table found!\n");
+	return FALSE;
+    }
+
+    if (!rhdAtomGetTableRevisionAndSize(
+	    &(atomDataPtr->GPIO_I2C_Info->sHeader),
+	    &crev,&frev,NULL)) {
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No GPIO Info Table found!\n");
+	return FALSE;
+    }
+
+    for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
+	ATOM_CONNECTOR_INFO_I2C ci
+	    = atomDataPtr->SupportedDevicesInfo.SupportedDevicesInfo->asConnInfo[i];
+
+	if (!(atomDataPtr->SupportedDevicesInfo
+	      .SupportedDevicesInfo->usDeviceSupport & (1 << i))) {
+	    info->BiosConnector[i].valid = FALSE;
+	    continue;
+	}
+
+	if (i == ATOM_DEVICE_CV_INDEX) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Skipping Component Video\n");
+	    info->BiosConnector[i].valid = FALSE;
+	    continue;
+	}
+
+	info->BiosConnector[i].valid = TRUE;
+	info->BiosConnector[i].output_id = ci.sucI2cId.sbfAccess.bfI2C_LineMux;
+	info->BiosConnector[i].devices = (1 << i);
+	info->BiosConnector[i].ConnectorType = ci.sucConnectorInfo.sbfAccess.bfConnectorType;
+	info->BiosConnector[i].DACType = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC - 1;
+
+	if (ci.sucI2cId.sbfAccess.bfHW_Capable) {
+	    ATOM_GPIO_I2C_ASSIGMENT gpio
+		= atomDataPtr->GPIO_I2C_Info->asGPIO_Info[ci.sucI2cId.sbfAccess.bfI2C_LineMux];
+
+	    /* note clk and data regs can be different!
+	     * gpio.usClkMaskRegisterIndex and gpio.usDataMaskRegisterIndex
+	     */
+
+	    /* don't assign a gpio for tv */
+	    if ((i == ATOM_DEVICE_TV1_INDEX) ||
+		(i == ATOM_DEVICE_TV2_INDEX) ||
+		(i == ATOM_DEVICE_CV_INDEX))
+		info->BiosConnector[i].ddc_line = 0;
+	    else
+		info->BiosConnector[i].ddc_line = gpio.usClkMaskRegisterIndex * 4;
+	} else if (ci.sucI2cId.sbfAccess.bfI2C_LineMux) {
+	    ATOM_GPIO_I2C_ASSIGMENT gpio
+		= atomDataPtr->GPIO_I2C_Info->asGPIO_Info[ci.sucI2cId.sbfAccess.bfI2C_LineMux];
+
+	    /* add support for GPIO line */
+	    ErrorF("Unsupported SW GPIO - device %d: gpio line: 0x%x\n", i, gpio.usClkMaskRegisterIndex * 4);
+	    info->BiosConnector[i].ddc_line = 0;
+	} else {
+	    info->BiosConnector[i].ddc_line = 0;
+	}
+
+	if (i == ATOM_DEVICE_DFP1_INDEX)
+	    info->BiosConnector[i].TMDSType = TMDS_INT;
+	else if (i == ATOM_DEVICE_DFP2_INDEX)
+	    info->BiosConnector[i].TMDSType = TMDS_EXT;
+	else if (i == ATOM_DEVICE_DFP3_INDEX)
+	    info->BiosConnector[i].TMDSType = TMDS_EXT;
+	else
+	    info->BiosConnector[i].TMDSType = TMDS_UNKNOWN;
+
+	/* Always set the connector type to VGA for CRT1/CRT2. if they are
+	 * shared with a DVI port, we'll pick up the DVI connector below when we
+	 * merge the outputs
+	 */
+	if ((i == ATOM_DEVICE_CRT1_INDEX || i == ATOM_DEVICE_CRT2_INDEX) &&
+	    (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I ||
+	     info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D ||
+	     info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_A)) {
+	    info->BiosConnector[i].ConnectorType = CONNECTOR_VGA;
+	}
+
+	if (crev > 1) {
+	    ATOM_CONNECTOR_INC_SRC_BITMAP isb
+		= atomDataPtr->SupportedDevicesInfo
+		.SupportedDevicesInfo_HD->asIntSrcInfo[i];
+
+	    switch (isb.ucIntSrcBitmap) {
+		case 0x4:
+		    info->BiosConnector[i].hpd_mask = 0x00000001;
+		    break;
+		case 0xa:
+		    info->BiosConnector[i].hpd_mask = 0x00000100;
+		    break;
+		default:
+		    info->BiosConnector[i].hpd_mask = 0;
+		    break;
+	    }
+	} else {
+	    info->BiosConnector[i].hpd_mask = 0;
+	}
+    }
+
+    /* CRTs/DFPs may share a port */
+    for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
+	if (info->BiosConnector[i].valid) {
+	    for (j = 0; j < ATOM_MAX_SUPPORTED_DEVICE; j++) {
+		if (info->BiosConnector[j].valid && (i != j) ) {
+		    if (info->BiosConnector[i].output_id == info->BiosConnector[j].output_id) {
+			if (((i == ATOM_DEVICE_DFP1_INDEX) ||
+			     (i == ATOM_DEVICE_DFP2_INDEX) ||
+			     (i == ATOM_DEVICE_DFP3_INDEX)) &&
+			    ((j == ATOM_DEVICE_CRT1_INDEX) || (j == ATOM_DEVICE_CRT2_INDEX))) {
+			    info->BiosConnector[i].DACType = info->BiosConnector[j].DACType;
+			    info->BiosConnector[i].devices |= info->BiosConnector[j].devices;
+			    info->BiosConnector[j].valid = FALSE;
+			} else if (((j == ATOM_DEVICE_DFP1_INDEX) ||
+			     (j == ATOM_DEVICE_DFP2_INDEX) ||
+			     (j == ATOM_DEVICE_DFP3_INDEX)) &&
+			    ((i == ATOM_DEVICE_CRT1_INDEX) || (i == ATOM_DEVICE_CRT2_INDEX))) {
+			    info->BiosConnector[j].DACType = info->BiosConnector[i].DACType;
+			    info->BiosConnector[j].devices |= info->BiosConnector[i].devices;
+			    info->BiosConnector[i].valid = FALSE;
+			}
+			/* other possible combos?  */
+		    }
+		}
+	    }
+	}
+    }
+
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bios Connector table: \n");
+    for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
+	if (info->BiosConnector[i].valid) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Port%d: DDCType-0x%x, DACType-%d, TMDSType-%d, ConnectorType-%d, hpd_mask-0x%x\n",
+		       i, info->BiosConnector[i].ddc_line, info->BiosConnector[i].DACType,
+		       info->BiosConnector[i].TMDSType, info->BiosConnector[i].ConnectorType,
+		       info->BiosConnector[i].hpd_mask);
+	}
+    }
+
+    return TRUE;
+}
+
 #if 0
 #define RHD_CONNECTORS_MAX 4
 #define MAX_OUTPUTS_PER_CONNECTOR 2
diff --git a/src/radeon_bios.c b/src/radeon_bios.c
index 293172b..3043de6 100644
--- a/src/radeon_bios.c
+++ b/src/radeon_bios.c
@@ -210,6 +210,9 @@ static Bool RADEONGetATOMConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
     if (RADEONGetATOMConnectorInfoFromBIOSObject(pScrn))
 	return TRUE;
 
+    if (RADEONGetATOMConnectorInfoFromBIOSConnectorTable(pScrn))
+	return TRUE;
+
     offset = RADEON_BIOS16(info->MasterDataStart + 22);
 
     if (offset) {
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 0b4bf55..d01fd8b 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -186,6 +186,7 @@ typedef struct {
     Bool valid;
     int output_id;
     int devices;
+    int hpd_mask;
 } RADEONBIOSConnector;
 
 typedef struct _RADEONOutputPrivateRec {


More information about the xorg-commit mailing list