diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/atombios_crtc.c')
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 0fda830ef806..742f17f009a9 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -355,15 +355,12 @@ static void atombios_crtc_set_timing(struct drm_crtc *crtc, | |||
355 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 355 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
356 | } | 356 | } |
357 | 357 | ||
358 | static void atombios_disable_ss(struct drm_crtc *crtc) | 358 | static void atombios_disable_ss(struct radeon_device *rdev, int pll_id) |
359 | { | 359 | { |
360 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
361 | struct drm_device *dev = crtc->dev; | ||
362 | struct radeon_device *rdev = dev->dev_private; | ||
363 | u32 ss_cntl; | 360 | u32 ss_cntl; |
364 | 361 | ||
365 | if (ASIC_IS_DCE4(rdev)) { | 362 | if (ASIC_IS_DCE4(rdev)) { |
366 | switch (radeon_crtc->pll_id) { | 363 | switch (pll_id) { |
367 | case ATOM_PPLL1: | 364 | case ATOM_PPLL1: |
368 | ss_cntl = RREG32(EVERGREEN_P1PLL_SS_CNTL); | 365 | ss_cntl = RREG32(EVERGREEN_P1PLL_SS_CNTL); |
369 | ss_cntl &= ~EVERGREEN_PxPLL_SS_EN; | 366 | ss_cntl &= ~EVERGREEN_PxPLL_SS_EN; |
@@ -379,7 +376,7 @@ static void atombios_disable_ss(struct drm_crtc *crtc) | |||
379 | return; | 376 | return; |
380 | } | 377 | } |
381 | } else if (ASIC_IS_AVIVO(rdev)) { | 378 | } else if (ASIC_IS_AVIVO(rdev)) { |
382 | switch (radeon_crtc->pll_id) { | 379 | switch (pll_id) { |
383 | case ATOM_PPLL1: | 380 | case ATOM_PPLL1: |
384 | ss_cntl = RREG32(AVIVO_P1PLL_INT_SS_CNTL); | 381 | ss_cntl = RREG32(AVIVO_P1PLL_INT_SS_CNTL); |
385 | ss_cntl &= ~1; | 382 | ss_cntl &= ~1; |
@@ -406,13 +403,11 @@ union atom_enable_ss { | |||
406 | ENABLE_SPREAD_SPECTRUM_ON_PPLL_V3 v3; | 403 | ENABLE_SPREAD_SPECTRUM_ON_PPLL_V3 v3; |
407 | }; | 404 | }; |
408 | 405 | ||
409 | static void atombios_crtc_program_ss(struct drm_crtc *crtc, | 406 | static void atombios_crtc_program_ss(struct radeon_device *rdev, |
410 | int enable, | 407 | int enable, |
411 | int pll_id, | 408 | int pll_id, |
412 | struct radeon_atom_ss *ss) | 409 | struct radeon_atom_ss *ss) |
413 | { | 410 | { |
414 | struct drm_device *dev = crtc->dev; | ||
415 | struct radeon_device *rdev = dev->dev_private; | ||
416 | int index = GetIndexIntoMasterTable(COMMAND, EnableSpreadSpectrumOnPPLL); | 411 | int index = GetIndexIntoMasterTable(COMMAND, EnableSpreadSpectrumOnPPLL); |
417 | union atom_enable_ss args; | 412 | union atom_enable_ss args; |
418 | 413 | ||
@@ -479,7 +474,7 @@ static void atombios_crtc_program_ss(struct drm_crtc *crtc, | |||
479 | } else if (ASIC_IS_AVIVO(rdev)) { | 474 | } else if (ASIC_IS_AVIVO(rdev)) { |
480 | if ((enable == ATOM_DISABLE) || (ss->percentage == 0) || | 475 | if ((enable == ATOM_DISABLE) || (ss->percentage == 0) || |
481 | (ss->type & ATOM_EXTERNAL_SS_MASK)) { | 476 | (ss->type & ATOM_EXTERNAL_SS_MASK)) { |
482 | atombios_disable_ss(crtc); | 477 | atombios_disable_ss(rdev, pll_id); |
483 | return; | 478 | return; |
484 | } | 479 | } |
485 | args.lvds_ss_2.usSpreadSpectrumPercentage = cpu_to_le16(ss->percentage); | 480 | args.lvds_ss_2.usSpreadSpectrumPercentage = cpu_to_le16(ss->percentage); |
@@ -491,7 +486,7 @@ static void atombios_crtc_program_ss(struct drm_crtc *crtc, | |||
491 | } else { | 486 | } else { |
492 | if ((enable == ATOM_DISABLE) || (ss->percentage == 0) || | 487 | if ((enable == ATOM_DISABLE) || (ss->percentage == 0) || |
493 | (ss->type & ATOM_EXTERNAL_SS_MASK)) { | 488 | (ss->type & ATOM_EXTERNAL_SS_MASK)) { |
494 | atombios_disable_ss(crtc); | 489 | atombios_disable_ss(rdev, pll_id); |
495 | return; | 490 | return; |
496 | } | 491 | } |
497 | args.lvds_ss.usSpreadSpectrumPercentage = cpu_to_le16(ss->percentage); | 492 | args.lvds_ss.usSpreadSpectrumPercentage = cpu_to_le16(ss->percentage); |
@@ -523,6 +518,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
523 | int encoder_mode = 0; | 518 | int encoder_mode = 0; |
524 | u32 dp_clock = mode->clock; | 519 | u32 dp_clock = mode->clock; |
525 | int bpc = 8; | 520 | int bpc = 8; |
521 | bool is_duallink = false; | ||
526 | 522 | ||
527 | /* reset the pll flags */ | 523 | /* reset the pll flags */ |
528 | pll->flags = 0; | 524 | pll->flags = 0; |
@@ -557,6 +553,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
557 | if (connector && connector->display_info.bpc) | 553 | if (connector && connector->display_info.bpc) |
558 | bpc = connector->display_info.bpc; | 554 | bpc = connector->display_info.bpc; |
559 | encoder_mode = atombios_get_encoder_mode(encoder); | 555 | encoder_mode = atombios_get_encoder_mode(encoder); |
556 | is_duallink = radeon_dig_monitor_is_duallink(encoder, mode->clock); | ||
560 | if ((radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) || | 557 | if ((radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) || |
561 | (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) { | 558 | (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) { |
562 | if (connector) { | 559 | if (connector) { |
@@ -652,7 +649,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
652 | if (dig->coherent_mode) | 649 | if (dig->coherent_mode) |
653 | args.v3.sInput.ucDispPllConfig |= | 650 | args.v3.sInput.ucDispPllConfig |= |
654 | DISPPLL_CONFIG_COHERENT_MODE; | 651 | DISPPLL_CONFIG_COHERENT_MODE; |
655 | if (mode->clock > 165000) | 652 | if (is_duallink) |
656 | args.v3.sInput.ucDispPllConfig |= | 653 | args.v3.sInput.ucDispPllConfig |= |
657 | DISPPLL_CONFIG_DUAL_LINK; | 654 | DISPPLL_CONFIG_DUAL_LINK; |
658 | } | 655 | } |
@@ -702,11 +699,9 @@ union set_pixel_clock { | |||
702 | /* on DCE5, make sure the voltage is high enough to support the | 699 | /* on DCE5, make sure the voltage is high enough to support the |
703 | * required disp clk. | 700 | * required disp clk. |
704 | */ | 701 | */ |
705 | static void atombios_crtc_set_dcpll(struct drm_crtc *crtc, | 702 | static void atombios_crtc_set_dcpll(struct radeon_device *rdev, |
706 | u32 dispclk) | 703 | u32 dispclk) |
707 | { | 704 | { |
708 | struct drm_device *dev = crtc->dev; | ||
709 | struct radeon_device *rdev = dev->dev_private; | ||
710 | u8 frev, crev; | 705 | u8 frev, crev; |
711 | int index; | 706 | int index; |
712 | union set_pixel_clock args; | 707 | union set_pixel_clock args; |
@@ -996,7 +991,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
996 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | 991 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
997 | &ref_div, &post_div); | 992 | &ref_div, &post_div); |
998 | 993 | ||
999 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); | 994 | atombios_crtc_program_ss(rdev, ATOM_DISABLE, radeon_crtc->pll_id, &ss); |
1000 | 995 | ||
1001 | atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, | 996 | atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, |
1002 | encoder_mode, radeon_encoder->encoder_id, mode->clock, | 997 | encoder_mode, radeon_encoder->encoder_id, mode->clock, |
@@ -1019,7 +1014,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
1019 | ss.step = step_size; | 1014 | ss.step = step_size; |
1020 | } | 1015 | } |
1021 | 1016 | ||
1022 | atombios_crtc_program_ss(crtc, ATOM_ENABLE, radeon_crtc->pll_id, &ss); | 1017 | atombios_crtc_program_ss(rdev, ATOM_ENABLE, radeon_crtc->pll_id, &ss); |
1023 | } | 1018 | } |
1024 | } | 1019 | } |
1025 | 1020 | ||
@@ -1189,7 +1184,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1189 | WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1); | 1184 | WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1); |
1190 | 1185 | ||
1191 | WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, | 1186 | WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, |
1192 | crtc->mode.vdisplay); | 1187 | target_fb->height); |
1193 | x &= ~3; | 1188 | x &= ~3; |
1194 | y &= ~1; | 1189 | y &= ~1; |
1195 | WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, | 1190 | WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, |
@@ -1358,7 +1353,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1358 | WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1); | 1353 | WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1); |
1359 | 1354 | ||
1360 | WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, | 1355 | WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, |
1361 | crtc->mode.vdisplay); | 1356 | target_fb->height); |
1362 | x &= ~3; | 1357 | x &= ~3; |
1363 | y &= ~1; | 1358 | y &= ~1; |
1364 | WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, | 1359 | WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, |
@@ -1494,6 +1489,24 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1494 | 1489 | ||
1495 | } | 1490 | } |
1496 | 1491 | ||
1492 | void radeon_atom_dcpll_init(struct radeon_device *rdev) | ||
1493 | { | ||
1494 | /* always set DCPLL */ | ||
1495 | if (ASIC_IS_DCE4(rdev)) { | ||
1496 | struct radeon_atom_ss ss; | ||
1497 | bool ss_enabled = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
1498 | ASIC_INTERNAL_SS_ON_DCPLL, | ||
1499 | rdev->clock.default_dispclk); | ||
1500 | if (ss_enabled) | ||
1501 | atombios_crtc_program_ss(rdev, ATOM_DISABLE, ATOM_DCPLL, &ss); | ||
1502 | /* XXX: DCE5, make sure voltage, dispclk is high enough */ | ||
1503 | atombios_crtc_set_dcpll(rdev, rdev->clock.default_dispclk); | ||
1504 | if (ss_enabled) | ||
1505 | atombios_crtc_program_ss(rdev, ATOM_ENABLE, ATOM_DCPLL, &ss); | ||
1506 | } | ||
1507 | |||
1508 | } | ||
1509 | |||
1497 | int atombios_crtc_mode_set(struct drm_crtc *crtc, | 1510 | int atombios_crtc_mode_set(struct drm_crtc *crtc, |
1498 | struct drm_display_mode *mode, | 1511 | struct drm_display_mode *mode, |
1499 | struct drm_display_mode *adjusted_mode, | 1512 | struct drm_display_mode *adjusted_mode, |
@@ -1515,19 +1528,6 @@ int atombios_crtc_mode_set(struct drm_crtc *crtc, | |||
1515 | } | 1528 | } |
1516 | } | 1529 | } |
1517 | 1530 | ||
1518 | /* always set DCPLL */ | ||
1519 | if (ASIC_IS_DCE4(rdev)) { | ||
1520 | struct radeon_atom_ss ss; | ||
1521 | bool ss_enabled = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
1522 | ASIC_INTERNAL_SS_ON_DCPLL, | ||
1523 | rdev->clock.default_dispclk); | ||
1524 | if (ss_enabled) | ||
1525 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, ATOM_DCPLL, &ss); | ||
1526 | /* XXX: DCE5, make sure voltage, dispclk is high enough */ | ||
1527 | atombios_crtc_set_dcpll(crtc, rdev->clock.default_dispclk); | ||
1528 | if (ss_enabled) | ||
1529 | atombios_crtc_program_ss(crtc, ATOM_ENABLE, ATOM_DCPLL, &ss); | ||
1530 | } | ||
1531 | atombios_crtc_set_pll(crtc, adjusted_mode); | 1531 | atombios_crtc_set_pll(crtc, adjusted_mode); |
1532 | 1532 | ||
1533 | if (ASIC_IS_DCE4(rdev)) | 1533 | if (ASIC_IS_DCE4(rdev)) |