diff options
-rw-r--r-- | src/radeon.h | 2 | ||||
-rw-r--r-- | src/radeon_atombios.c | 25 | ||||
-rw-r--r-- | src/radeon_output.c | 47 |
3 files changed, 61 insertions, 13 deletions
diff --git a/src/radeon.h b/src/radeon.h index ec952b5a..ac536b98 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -872,6 +872,8 @@ RADEONInitExtTMDSInfoFromBIOS (xf86OutputPtr output); extern RADEONI2CBusRec legacy_setup_i2c_bus(int ddc_line); +extern RADEONI2CBusRec +atom_setup_i2c_bus(int ddc_line); extern void radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y); diff --git a/src/radeon_atombios.c b/src/radeon_atombios.c index e8f9e912..913fafb0 100644 --- a/src/radeon_atombios.c +++ b/src/radeon_atombios.c @@ -1404,7 +1404,7 @@ const int object_connector_convert[] = static void rhdAtomParseI2CRecord(atomBiosHandlePtr handle, - ATOM_I2C_RECORD *Record, int *line) + ATOM_I2C_RECORD *Record, int *ddc_line) { ErrorF(" %s: I2C Record: %s[%x] EngineID: %x I2CAddr: %x\n", __func__, @@ -1414,13 +1414,22 @@ rhdAtomParseI2CRecord(atomBiosHandlePtr handle, Record->ucI2CAddr); if (!*(unsigned char *)&(Record->sucI2cId)) - *line = 0; + *ddc_line = 0; else { - if (Record->ucI2CAddr != 0) return; - *line = Record->sucI2cId.bfI2C_LineMux; - return; + + if (Record->sucI2cId.bfHW_Capable) { + switch(Record->sucI2cId.bfI2C_LineMux) { + case 0: *ddc_line = 0x7e40; break; + case 1: *ddc_line = 0x7e50; break; + case 2: *ddc_line = 0x7e30; break; + default: break; + } + return; + } else { + /* add GPIO pin parsing */ + } } } @@ -1470,7 +1479,7 @@ RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn) unsigned short size; atomDataTablesPtr atomDataPtr; ATOM_CONNECTOR_OBJECT_TABLE *con_obj; - int i, j, line = 0; + int i, j, ddc_line; atomDataPtr = info->atomBIOS->atomDataPtr; if (!rhdAtomGetTableRevisionAndSize((ATOM_COMMON_TABLE_HEADER *)(atomDataPtr->Object_Header), &crev, &frev, &size)) @@ -1558,8 +1567,8 @@ RADEONGetATOMConnectorInfoFromBIOSObject (ScrnInfoPtr pScrn) case ATOM_I2C_RECORD_TYPE: rhdAtomParseI2CRecord(info->atomBIOS, (ATOM_I2C_RECORD *)Record, - &line); - info->BiosConnector[i].ddc_i2c = RADEONLookupGPIOLineForDDC(pScrn, line); + &ddc_line); + info->BiosConnector[i].ddc_i2c = atom_setup_i2c_bus(ddc_line); break; case ATOM_HPD_INT_RECORD_TYPE: break; diff --git a/src/radeon_output.c b/src/radeon_output.c index 5ef864e8..248f94aa 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -1382,7 +1382,44 @@ legacy_setup_i2c_bus(int ddc_line) i2c.put_data_reg = ddc_line; i2c.get_clk_reg = ddc_line; i2c.get_data_reg = ddc_line; - i2c.valid = TRUE; + if (ddc_line) + i2c.valid = TRUE; + else + i2c.valid = FALSE; + + return i2c; +} + +RADEONI2CBusRec +atom_setup_i2c_bus(int ddc_line) +{ + RADEONI2CBusRec i2c; + + if (ddc_line == AVIVO_GPIO_0) { + i2c.put_clk_mask = (1 << 19); + i2c.put_data_mask = (1 << 18); + i2c.get_clk_mask = (1 << 19); + i2c.get_data_mask = (1 << 18); + i2c.mask_clk_mask = (1 << 19); + i2c.mask_data_mask = (1 << 18); + } else { + i2c.put_clk_mask = (1 << 0); + i2c.put_data_mask = (1 << 8); + i2c.get_clk_mask = (1 << 0); + i2c.get_data_mask = (1 << 8); + i2c.mask_clk_mask = (1 << 0); + i2c.mask_data_mask = (1 << 8); + } + i2c.mask_clk_reg = ddc_line; + i2c.mask_data_reg = ddc_line; + i2c.put_clk_reg = ddc_line + 0x8; + i2c.put_data_reg = ddc_line + 0x8; + i2c.get_clk_reg = ddc_line + 0xc; + i2c.get_data_reg = ddc_line + 0xc; + if (ddc_line) + i2c.valid = TRUE; + else + i2c.valid = FALSE; return i2c; } @@ -1920,28 +1957,28 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn) if (IS_AVIVO_VARIANT) { if (info->IsMobility) { - info->BiosConnector[0].ddc_i2c = legacy_setup_i2c_bus(0x7e60); + info->BiosConnector[0].ddc_i2c = atom_setup_i2c_bus(0x7e60); info->BiosConnector[0].DACType = DAC_NONE; info->BiosConnector[0].TMDSType = TMDS_NONE; info->BiosConnector[0].ConnectorType = CONNECTOR_LVDS; info->BiosConnector[0].devices = ATOM_DEVICE_LCD1_SUPPORT; info->BiosConnector[0].valid = TRUE; - info->BiosConnector[1].ddc_i2c = legacy_setup_i2c_bus(0x7e40); + info->BiosConnector[1].ddc_i2c = atom_setup_i2c_bus(0x7e40); info->BiosConnector[1].DACType = DAC_PRIMARY; info->BiosConnector[1].TMDSType = TMDS_NONE; info->BiosConnector[1].ConnectorType = CONNECTOR_VGA; info->BiosConnector[1].devices = ATOM_DEVICE_CRT1_SUPPORT; info->BiosConnector[1].valid = TRUE; } else { - info->BiosConnector[0].ddc_i2c = legacy_setup_i2c_bus(0x7e50); + info->BiosConnector[0].ddc_i2c = atom_setup_i2c_bus(0x7e50); info->BiosConnector[0].DACType = DAC_TVDAC; info->BiosConnector[0].TMDSType = TMDS_INT; info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_I; info->BiosConnector[0].devices = ATOM_DEVICE_CRT2_SUPPORT | ATOM_DEVICE_DFP1_SUPPORT; info->BiosConnector[0].valid = TRUE; - info->BiosConnector[1].ddc_i2c = legacy_setup_i2c_bus(0x7e40); + info->BiosConnector[1].ddc_i2c = atom_setup_i2c_bus(0x7e40); info->BiosConnector[1].DACType = DAC_PRIMARY; info->BiosConnector[1].TMDSType = TMDS_NONE; info->BiosConnector[1].ConnectorType = CONNECTOR_VGA; |