diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_atombios.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 66 |
1 files changed, 49 insertions, 17 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 6d30868744ee..ebae14c4b768 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -32,11 +32,11 @@ | |||
32 | 32 | ||
33 | /* from radeon_encoder.c */ | 33 | /* from radeon_encoder.c */ |
34 | extern uint32_t | 34 | extern uint32_t |
35 | radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device, | 35 | radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, |
36 | uint8_t dac); | 36 | uint8_t dac); |
37 | extern void radeon_link_encoder_connector(struct drm_device *dev); | 37 | extern void radeon_link_encoder_connector(struct drm_device *dev); |
38 | extern void | 38 | extern void |
39 | radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id, | 39 | radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum, |
40 | uint32_t supported_device); | 40 | uint32_t supported_device); |
41 | 41 | ||
42 | /* from radeon_connector.c */ | 42 | /* from radeon_connector.c */ |
@@ -46,14 +46,14 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
46 | uint32_t supported_device, | 46 | uint32_t supported_device, |
47 | int connector_type, | 47 | int connector_type, |
48 | struct radeon_i2c_bus_rec *i2c_bus, | 48 | struct radeon_i2c_bus_rec *i2c_bus, |
49 | bool linkb, uint32_t igp_lane_info, | 49 | uint32_t igp_lane_info, |
50 | uint16_t connector_object_id, | 50 | uint16_t connector_object_id, |
51 | struct radeon_hpd *hpd, | 51 | struct radeon_hpd *hpd, |
52 | struct radeon_router *router); | 52 | struct radeon_router *router); |
53 | 53 | ||
54 | /* from radeon_legacy_encoder.c */ | 54 | /* from radeon_legacy_encoder.c */ |
55 | extern void | 55 | extern void |
56 | radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, | 56 | radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum, |
57 | uint32_t supported_device); | 57 | uint32_t supported_device); |
58 | 58 | ||
59 | union atom_supported_devices { | 59 | union atom_supported_devices { |
@@ -85,6 +85,19 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
85 | for (i = 0; i < num_indices; i++) { | 85 | for (i = 0; i < num_indices; i++) { |
86 | gpio = &i2c_info->asGPIO_Info[i]; | 86 | gpio = &i2c_info->asGPIO_Info[i]; |
87 | 87 | ||
88 | /* some evergreen boards have bad data for this entry */ | ||
89 | if (ASIC_IS_DCE4(rdev)) { | ||
90 | if ((i == 7) && | ||
91 | (gpio->usClkMaskRegisterIndex == 0x1936) && | ||
92 | (gpio->sucI2cId.ucAccess == 0)) { | ||
93 | gpio->sucI2cId.ucAccess = 0x97; | ||
94 | gpio->ucDataMaskShift = 8; | ||
95 | gpio->ucDataEnShift = 8; | ||
96 | gpio->ucDataY_Shift = 8; | ||
97 | gpio->ucDataA_Shift = 8; | ||
98 | } | ||
99 | } | ||
100 | |||
88 | if (gpio->sucI2cId.ucAccess == id) { | 101 | if (gpio->sucI2cId.ucAccess == id) { |
89 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 102 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
90 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | 103 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
@@ -147,6 +160,20 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
147 | for (i = 0; i < num_indices; i++) { | 160 | for (i = 0; i < num_indices; i++) { |
148 | gpio = &i2c_info->asGPIO_Info[i]; | 161 | gpio = &i2c_info->asGPIO_Info[i]; |
149 | i2c.valid = false; | 162 | i2c.valid = false; |
163 | |||
164 | /* some evergreen boards have bad data for this entry */ | ||
165 | if (ASIC_IS_DCE4(rdev)) { | ||
166 | if ((i == 7) && | ||
167 | (gpio->usClkMaskRegisterIndex == 0x1936) && | ||
168 | (gpio->sucI2cId.ucAccess == 0)) { | ||
169 | gpio->sucI2cId.ucAccess = 0x97; | ||
170 | gpio->ucDataMaskShift = 8; | ||
171 | gpio->ucDataEnShift = 8; | ||
172 | gpio->ucDataY_Shift = 8; | ||
173 | gpio->ucDataA_Shift = 8; | ||
174 | } | ||
175 | } | ||
176 | |||
150 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 177 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
151 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | 178 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
152 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | 179 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; |
@@ -226,6 +253,8 @@ static struct radeon_hpd radeon_atom_get_hpd_info_from_gpio(struct radeon_device | |||
226 | struct radeon_hpd hpd; | 253 | struct radeon_hpd hpd; |
227 | u32 reg; | 254 | u32 reg; |
228 | 255 | ||
256 | memset(&hpd, 0, sizeof(struct radeon_hpd)); | ||
257 | |||
229 | if (ASIC_IS_DCE4(rdev)) | 258 | if (ASIC_IS_DCE4(rdev)) |
230 | reg = EVERGREEN_DC_GPIO_HPD_A; | 259 | reg = EVERGREEN_DC_GPIO_HPD_A; |
231 | else | 260 | else |
@@ -477,7 +506,6 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
477 | int i, j, k, path_size, device_support; | 506 | int i, j, k, path_size, device_support; |
478 | int connector_type; | 507 | int connector_type; |
479 | u16 igp_lane_info, conn_id, connector_object_id; | 508 | u16 igp_lane_info, conn_id, connector_object_id; |
480 | bool linkb; | ||
481 | struct radeon_i2c_bus_rec ddc_bus; | 509 | struct radeon_i2c_bus_rec ddc_bus; |
482 | struct radeon_router router; | 510 | struct radeon_router router; |
483 | struct radeon_gpio_rec gpio; | 511 | struct radeon_gpio_rec gpio; |
@@ -510,7 +538,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
510 | addr += path_size; | 538 | addr += path_size; |
511 | path = (ATOM_DISPLAY_OBJECT_PATH *) addr; | 539 | path = (ATOM_DISPLAY_OBJECT_PATH *) addr; |
512 | path_size += le16_to_cpu(path->usSize); | 540 | path_size += le16_to_cpu(path->usSize); |
513 | linkb = false; | 541 | |
514 | if (device_support & le16_to_cpu(path->usDeviceTag)) { | 542 | if (device_support & le16_to_cpu(path->usDeviceTag)) { |
515 | uint8_t con_obj_id, con_obj_num, con_obj_type; | 543 | uint8_t con_obj_id, con_obj_num, con_obj_type; |
516 | 544 | ||
@@ -601,13 +629,10 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
601 | OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; | 629 | OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; |
602 | 630 | ||
603 | if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { | 631 | if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { |
604 | if (grph_obj_num == 2) | 632 | u16 encoder_obj = le16_to_cpu(path->usGraphicObjIds[j]); |
605 | linkb = true; | ||
606 | else | ||
607 | linkb = false; | ||
608 | 633 | ||
609 | radeon_add_atom_encoder(dev, | 634 | radeon_add_atom_encoder(dev, |
610 | grph_obj_id, | 635 | encoder_obj, |
611 | le16_to_cpu | 636 | le16_to_cpu |
612 | (path-> | 637 | (path-> |
613 | usDeviceTag)); | 638 | usDeviceTag)); |
@@ -744,7 +769,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
744 | le16_to_cpu(path-> | 769 | le16_to_cpu(path-> |
745 | usDeviceTag), | 770 | usDeviceTag), |
746 | connector_type, &ddc_bus, | 771 | connector_type, &ddc_bus, |
747 | linkb, igp_lane_info, | 772 | igp_lane_info, |
748 | connector_object_id, | 773 | connector_object_id, |
749 | &hpd, | 774 | &hpd, |
750 | &router); | 775 | &router); |
@@ -933,13 +958,13 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
933 | 958 | ||
934 | if (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom) | 959 | if (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom) |
935 | radeon_add_atom_encoder(dev, | 960 | radeon_add_atom_encoder(dev, |
936 | radeon_get_encoder_id(dev, | 961 | radeon_get_encoder_enum(dev, |
937 | (1 << i), | 962 | (1 << i), |
938 | dac), | 963 | dac), |
939 | (1 << i)); | 964 | (1 << i)); |
940 | else | 965 | else |
941 | radeon_add_legacy_encoder(dev, | 966 | radeon_add_legacy_encoder(dev, |
942 | radeon_get_encoder_id(dev, | 967 | radeon_get_encoder_enum(dev, |
943 | (1 << i), | 968 | (1 << i), |
944 | dac), | 969 | dac), |
945 | (1 << i)); | 970 | (1 << i)); |
@@ -996,7 +1021,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
996 | bios_connectors[i]. | 1021 | bios_connectors[i]. |
997 | connector_type, | 1022 | connector_type, |
998 | &bios_connectors[i].ddc_bus, | 1023 | &bios_connectors[i].ddc_bus, |
999 | false, 0, | 1024 | 0, |
1000 | connector_object_id, | 1025 | connector_object_id, |
1001 | &bios_connectors[i].hpd, | 1026 | &bios_connectors[i].hpd, |
1002 | &router); | 1027 | &router); |
@@ -1183,7 +1208,7 @@ bool radeon_atombios_sideport_present(struct radeon_device *rdev) | |||
1183 | return true; | 1208 | return true; |
1184 | break; | 1209 | break; |
1185 | case 2: | 1210 | case 2: |
1186 | if (igp_info->info_2.ucMemoryType & 0x0f) | 1211 | if (igp_info->info_2.ulBootUpSidePortClock) |
1187 | return true; | 1212 | return true; |
1188 | break; | 1213 | break; |
1189 | default: | 1214 | default: |
@@ -1305,6 +1330,7 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct | |||
1305 | union lvds_info *lvds_info; | 1330 | union lvds_info *lvds_info; |
1306 | uint8_t frev, crev; | 1331 | uint8_t frev, crev; |
1307 | struct radeon_encoder_atom_dig *lvds = NULL; | 1332 | struct radeon_encoder_atom_dig *lvds = NULL; |
1333 | int encoder_enum = (encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT; | ||
1308 | 1334 | ||
1309 | if (atom_parse_data_header(mode_info->atom_context, index, NULL, | 1335 | if (atom_parse_data_header(mode_info->atom_context, index, NULL, |
1310 | &frev, &crev, &data_offset)) { | 1336 | &frev, &crev, &data_offset)) { |
@@ -1368,6 +1394,12 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct | |||
1368 | } | 1394 | } |
1369 | 1395 | ||
1370 | encoder->native_mode = lvds->native_mode; | 1396 | encoder->native_mode = lvds->native_mode; |
1397 | |||
1398 | if (encoder_enum == 2) | ||
1399 | lvds->linkb = true; | ||
1400 | else | ||
1401 | lvds->linkb = false; | ||
1402 | |||
1371 | } | 1403 | } |
1372 | return lvds; | 1404 | return lvds; |
1373 | } | 1405 | } |