diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_display.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 113 |
1 files changed, 93 insertions, 20 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 0a1d4bd65edc..64a008d14493 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -573,24 +573,6 @@ static const char *encoder_names[37] = { | |||
573 | "INTERNAL_VCE" | 573 | "INTERNAL_VCE" |
574 | }; | 574 | }; |
575 | 575 | ||
576 | static const char *connector_names[15] = { | ||
577 | "Unknown", | ||
578 | "VGA", | ||
579 | "DVI-I", | ||
580 | "DVI-D", | ||
581 | "DVI-A", | ||
582 | "Composite", | ||
583 | "S-video", | ||
584 | "LVDS", | ||
585 | "Component", | ||
586 | "DIN", | ||
587 | "DisplayPort", | ||
588 | "HDMI-A", | ||
589 | "HDMI-B", | ||
590 | "TV", | ||
591 | "eDP", | ||
592 | }; | ||
593 | |||
594 | static const char *hpd_names[6] = { | 576 | static const char *hpd_names[6] = { |
595 | "HPD1", | 577 | "HPD1", |
596 | "HPD2", | 578 | "HPD2", |
@@ -613,7 +595,7 @@ static void radeon_print_display_setup(struct drm_device *dev) | |||
613 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 595 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
614 | radeon_connector = to_radeon_connector(connector); | 596 | radeon_connector = to_radeon_connector(connector); |
615 | DRM_INFO("Connector %d:\n", i); | 597 | DRM_INFO("Connector %d:\n", i); |
616 | DRM_INFO(" %s\n", connector_names[connector->connector_type]); | 598 | DRM_INFO(" %s\n", drm_get_connector_name(connector)); |
617 | if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) | 599 | if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) |
618 | DRM_INFO(" %s\n", hpd_names[radeon_connector->hpd.hpd]); | 600 | DRM_INFO(" %s\n", hpd_names[radeon_connector->hpd.hpd]); |
619 | if (radeon_connector->ddc_bus) { | 601 | if (radeon_connector->ddc_bus) { |
@@ -1243,6 +1225,93 @@ void radeon_update_display_priority(struct radeon_device *rdev) | |||
1243 | 1225 | ||
1244 | } | 1226 | } |
1245 | 1227 | ||
1228 | /* | ||
1229 | * Allocate hdmi structs and determine register offsets | ||
1230 | */ | ||
1231 | static void radeon_afmt_init(struct radeon_device *rdev) | ||
1232 | { | ||
1233 | int i; | ||
1234 | |||
1235 | for (i = 0; i < RADEON_MAX_AFMT_BLOCKS; i++) | ||
1236 | rdev->mode_info.afmt[i] = NULL; | ||
1237 | |||
1238 | if (ASIC_IS_DCE6(rdev)) { | ||
1239 | /* todo */ | ||
1240 | } else if (ASIC_IS_DCE4(rdev)) { | ||
1241 | /* DCE4/5 has 6 audio blocks tied to DIG encoders */ | ||
1242 | /* DCE4.1 has 2 audio blocks tied to DIG encoders */ | ||
1243 | rdev->mode_info.afmt[0] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1244 | if (rdev->mode_info.afmt[0]) { | ||
1245 | rdev->mode_info.afmt[0]->offset = EVERGREEN_CRTC0_REGISTER_OFFSET; | ||
1246 | rdev->mode_info.afmt[0]->id = 0; | ||
1247 | } | ||
1248 | rdev->mode_info.afmt[1] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1249 | if (rdev->mode_info.afmt[1]) { | ||
1250 | rdev->mode_info.afmt[1]->offset = EVERGREEN_CRTC1_REGISTER_OFFSET; | ||
1251 | rdev->mode_info.afmt[1]->id = 1; | ||
1252 | } | ||
1253 | if (!ASIC_IS_DCE41(rdev)) { | ||
1254 | rdev->mode_info.afmt[2] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1255 | if (rdev->mode_info.afmt[2]) { | ||
1256 | rdev->mode_info.afmt[2]->offset = EVERGREEN_CRTC2_REGISTER_OFFSET; | ||
1257 | rdev->mode_info.afmt[2]->id = 2; | ||
1258 | } | ||
1259 | rdev->mode_info.afmt[3] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1260 | if (rdev->mode_info.afmt[3]) { | ||
1261 | rdev->mode_info.afmt[3]->offset = EVERGREEN_CRTC3_REGISTER_OFFSET; | ||
1262 | rdev->mode_info.afmt[3]->id = 3; | ||
1263 | } | ||
1264 | rdev->mode_info.afmt[4] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1265 | if (rdev->mode_info.afmt[4]) { | ||
1266 | rdev->mode_info.afmt[4]->offset = EVERGREEN_CRTC4_REGISTER_OFFSET; | ||
1267 | rdev->mode_info.afmt[4]->id = 4; | ||
1268 | } | ||
1269 | rdev->mode_info.afmt[5] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1270 | if (rdev->mode_info.afmt[5]) { | ||
1271 | rdev->mode_info.afmt[5]->offset = EVERGREEN_CRTC5_REGISTER_OFFSET; | ||
1272 | rdev->mode_info.afmt[5]->id = 5; | ||
1273 | } | ||
1274 | } | ||
1275 | } else if (ASIC_IS_DCE3(rdev)) { | ||
1276 | /* DCE3.x has 2 audio blocks tied to DIG encoders */ | ||
1277 | rdev->mode_info.afmt[0] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1278 | if (rdev->mode_info.afmt[0]) { | ||
1279 | rdev->mode_info.afmt[0]->offset = DCE3_HDMI_OFFSET0; | ||
1280 | rdev->mode_info.afmt[0]->id = 0; | ||
1281 | } | ||
1282 | rdev->mode_info.afmt[1] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1283 | if (rdev->mode_info.afmt[1]) { | ||
1284 | rdev->mode_info.afmt[1]->offset = DCE3_HDMI_OFFSET1; | ||
1285 | rdev->mode_info.afmt[1]->id = 1; | ||
1286 | } | ||
1287 | } else if (ASIC_IS_DCE2(rdev)) { | ||
1288 | /* DCE2 has at least 1 routable audio block */ | ||
1289 | rdev->mode_info.afmt[0] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1290 | if (rdev->mode_info.afmt[0]) { | ||
1291 | rdev->mode_info.afmt[0]->offset = DCE2_HDMI_OFFSET0; | ||
1292 | rdev->mode_info.afmt[0]->id = 0; | ||
1293 | } | ||
1294 | /* r6xx has 2 routable audio blocks */ | ||
1295 | if (rdev->family >= CHIP_R600) { | ||
1296 | rdev->mode_info.afmt[1] = kzalloc(sizeof(struct radeon_afmt), GFP_KERNEL); | ||
1297 | if (rdev->mode_info.afmt[1]) { | ||
1298 | rdev->mode_info.afmt[1]->offset = DCE2_HDMI_OFFSET1; | ||
1299 | rdev->mode_info.afmt[1]->id = 1; | ||
1300 | } | ||
1301 | } | ||
1302 | } | ||
1303 | } | ||
1304 | |||
1305 | static void radeon_afmt_fini(struct radeon_device *rdev) | ||
1306 | { | ||
1307 | int i; | ||
1308 | |||
1309 | for (i = 0; i < RADEON_MAX_AFMT_BLOCKS; i++) { | ||
1310 | kfree(rdev->mode_info.afmt[i]); | ||
1311 | rdev->mode_info.afmt[i] = NULL; | ||
1312 | } | ||
1313 | } | ||
1314 | |||
1246 | int radeon_modeset_init(struct radeon_device *rdev) | 1315 | int radeon_modeset_init(struct radeon_device *rdev) |
1247 | { | 1316 | { |
1248 | int i; | 1317 | int i; |
@@ -1251,7 +1320,7 @@ int radeon_modeset_init(struct radeon_device *rdev) | |||
1251 | drm_mode_config_init(rdev->ddev); | 1320 | drm_mode_config_init(rdev->ddev); |
1252 | rdev->mode_info.mode_config_initialized = true; | 1321 | rdev->mode_info.mode_config_initialized = true; |
1253 | 1322 | ||
1254 | rdev->ddev->mode_config.funcs = (void *)&radeon_mode_funcs; | 1323 | rdev->ddev->mode_config.funcs = &radeon_mode_funcs; |
1255 | 1324 | ||
1256 | if (ASIC_IS_DCE5(rdev)) { | 1325 | if (ASIC_IS_DCE5(rdev)) { |
1257 | rdev->ddev->mode_config.max_width = 16384; | 1326 | rdev->ddev->mode_config.max_width = 16384; |
@@ -1303,6 +1372,9 @@ int radeon_modeset_init(struct radeon_device *rdev) | |||
1303 | /* initialize hpd */ | 1372 | /* initialize hpd */ |
1304 | radeon_hpd_init(rdev); | 1373 | radeon_hpd_init(rdev); |
1305 | 1374 | ||
1375 | /* setup afmt */ | ||
1376 | radeon_afmt_init(rdev); | ||
1377 | |||
1306 | /* Initialize power management */ | 1378 | /* Initialize power management */ |
1307 | radeon_pm_init(rdev); | 1379 | radeon_pm_init(rdev); |
1308 | 1380 | ||
@@ -1319,6 +1391,7 @@ void radeon_modeset_fini(struct radeon_device *rdev) | |||
1319 | radeon_pm_fini(rdev); | 1391 | radeon_pm_fini(rdev); |
1320 | 1392 | ||
1321 | if (rdev->mode_info.mode_config_initialized) { | 1393 | if (rdev->mode_info.mode_config_initialized) { |
1394 | radeon_afmt_fini(rdev); | ||
1322 | drm_kms_helper_poll_fini(rdev->ddev); | 1395 | drm_kms_helper_poll_fini(rdev->ddev); |
1323 | radeon_hpd_fini(rdev); | 1396 | radeon_hpd_fini(rdev); |
1324 | drm_mode_config_cleanup(rdev->ddev); | 1397 | drm_mode_config_cleanup(rdev->ddev); |