diff options
author | Alex Deucher <alex@samba.(none)> | 2007-12-01 00:58:51 -0500 |
---|---|---|
committer | Alex Deucher <alex@samba.(none)> | 2007-12-01 00:58:51 -0500 |
commit | 1e029fef5fe264f2ced445b80bf6070abcb84b82 (patch) | |
tree | e6e947c96f0d492e5713cf8f955b095cff4646a4 /src/radeon_atombios.c | |
parent | dcbef1ba9dfcf35c28e058832a55adf00afb472e (diff) |
RADEON: move GPIO lookup to a separate function
Diffstat (limited to 'src/radeon_atombios.c')
-rw-r--r-- | src/radeon_atombios.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c index aa25ed3f..9d17e474 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; |