diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-12-08 14:30:49 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-08 22:31:10 -0500 |
commit | d3f420d1089169fb48366e1aa750bdd92db0a04b (patch) | |
tree | 9b25c8bfcf2aa5db2ae8b8479f999b711830ec18 /drivers/gpu | |
parent | 279b215ecb8acc735c01ac89b1aa28c4a27dcafa (diff) |
drm/radeon/kms: make sure i2c id matches
Entries in the i2c table aren't always ordered
by id. This allows us to remove some quirks
that are no longer needed.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 91 |
1 files changed, 43 insertions, 48 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 6cac0651d0f1..8737adf6d386 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -70,6 +70,7 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
70 | int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); | 70 | int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); |
71 | struct _ATOM_GPIO_I2C_INFO *i2c_info; | 71 | struct _ATOM_GPIO_I2C_INFO *i2c_info; |
72 | uint16_t data_offset; | 72 | uint16_t data_offset; |
73 | int i; | ||
73 | 74 | ||
74 | memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec)); | 75 | memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec)); |
75 | i2c.valid = false; | 76 | i2c.valid = false; |
@@ -78,38 +79,43 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
78 | 79 | ||
79 | i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); | 80 | i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); |
80 | 81 | ||
81 | gpio = &i2c_info->asGPIO_Info[id]; | ||
82 | |||
83 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | ||
84 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
85 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
86 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
87 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
88 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
89 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
90 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
91 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
92 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
93 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
94 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
95 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
96 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
97 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
98 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
99 | |||
100 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
101 | i2c.hw_capable = true; | ||
102 | else | ||
103 | i2c.hw_capable = false; | ||
104 | 82 | ||
105 | if (gpio->sucI2cId.ucAccess == 0xa0) | 83 | for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { |
106 | i2c.mm_i2c = true; | 84 | gpio = &i2c_info->asGPIO_Info[i]; |
107 | else | 85 | |
108 | i2c.mm_i2c = false; | 86 | if (gpio->sucI2cId.ucAccess == id) { |
87 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | ||
88 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
89 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
90 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
91 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
92 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
93 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
94 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
95 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
96 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
97 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
98 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
99 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
100 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
101 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
102 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
103 | |||
104 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
105 | i2c.hw_capable = true; | ||
106 | else | ||
107 | i2c.hw_capable = false; | ||
108 | |||
109 | if (gpio->sucI2cId.ucAccess == 0xa0) | ||
110 | i2c.mm_i2c = true; | ||
111 | else | ||
112 | i2c.mm_i2c = false; | ||
109 | 113 | ||
110 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | 114 | i2c.i2c_id = gpio->sucI2cId.ucAccess; |
111 | 115 | ||
112 | i2c.valid = true; | 116 | i2c.valid = true; |
117 | } | ||
118 | } | ||
113 | 119 | ||
114 | return i2c; | 120 | return i2c; |
115 | } | 121 | } |
@@ -503,6 +509,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
503 | usRecordOffset)); | 509 | usRecordOffset)); |
504 | ATOM_I2C_RECORD *i2c_record; | 510 | ATOM_I2C_RECORD *i2c_record; |
505 | ATOM_HPD_INT_RECORD *hpd_record; | 511 | ATOM_HPD_INT_RECORD *hpd_record; |
512 | ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; | ||
506 | hpd.hpd = RADEON_HPD_NONE; | 513 | hpd.hpd = RADEON_HPD_NONE; |
507 | 514 | ||
508 | while (record->ucRecordType > 0 | 515 | while (record->ucRecordType > 0 |
@@ -514,10 +521,12 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
514 | i2c_record = | 521 | i2c_record = |
515 | (ATOM_I2C_RECORD *) | 522 | (ATOM_I2C_RECORD *) |
516 | record; | 523 | record; |
524 | i2c_config = | ||
525 | (ATOM_I2C_ID_CONFIG_ACCESS *) | ||
526 | &i2c_record->sucI2cId; | ||
517 | ddc_bus = radeon_lookup_i2c_gpio(rdev, | 527 | ddc_bus = radeon_lookup_i2c_gpio(rdev, |
518 | i2c_record-> | 528 | i2c_config-> |
519 | sucI2cId. | 529 | ucAccess); |
520 | bfI2C_LineMux); | ||
521 | break; | 530 | break; |
522 | case ATOM_HPD_INT_RECORD_TYPE: | 531 | case ATOM_HPD_INT_RECORD_TYPE: |
523 | hpd_record = | 532 | hpd_record = |
@@ -670,22 +679,8 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
670 | 679 | ||
671 | dac = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC; | 680 | dac = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC; |
672 | 681 | ||
673 | if ((rdev->family == CHIP_RS690) || | 682 | bios_connectors[i].line_mux = |
674 | (rdev->family == CHIP_RS740)) { | 683 | ci.sucI2cId.ucAccess; |
675 | if ((i == ATOM_DEVICE_DFP2_INDEX) | ||
676 | && (ci.sucI2cId.sbfAccess.bfI2C_LineMux == 2)) | ||
677 | bios_connectors[i].line_mux = | ||
678 | ci.sucI2cId.sbfAccess.bfI2C_LineMux + 1; | ||
679 | else if ((i == ATOM_DEVICE_DFP3_INDEX) | ||
680 | && (ci.sucI2cId.sbfAccess.bfI2C_LineMux == 1)) | ||
681 | bios_connectors[i].line_mux = | ||
682 | ci.sucI2cId.sbfAccess.bfI2C_LineMux + 1; | ||
683 | else | ||
684 | bios_connectors[i].line_mux = | ||
685 | ci.sucI2cId.sbfAccess.bfI2C_LineMux; | ||
686 | } else | ||
687 | bios_connectors[i].line_mux = | ||
688 | ci.sucI2cId.sbfAccess.bfI2C_LineMux; | ||
689 | 684 | ||
690 | /* give tv unique connector ids */ | 685 | /* give tv unique connector ids */ |
691 | if (i == ATOM_DEVICE_TV1_INDEX) { | 686 | if (i == ATOM_DEVICE_TV1_INDEX) { |