diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-01-20 14:56:39 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-01-24 12:35:49 -0500 |
commit | 3fa47d9efa6a0f5123e26e2c3ad54e3e1a1d108d (patch) | |
tree | f6d3f96f4731c7ac0d9bee72e22e811d1f96e452 /drivers | |
parent | 211fa4fc4e13492151e698d92b0dff56b29928ec (diff) |
drm/radeon/kms: move disp eng pll setup to init path
We really only need to set it up once on init or resume
rather than on every mode set.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 56 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 1 |
4 files changed, 36 insertions, 33 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 0fda830ef806..807b89b4933f 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); |
@@ -702,11 +697,9 @@ union set_pixel_clock { | |||
702 | /* on DCE5, make sure the voltage is high enough to support the | 697 | /* on DCE5, make sure the voltage is high enough to support the |
703 | * required disp clk. | 698 | * required disp clk. |
704 | */ | 699 | */ |
705 | static void atombios_crtc_set_dcpll(struct drm_crtc *crtc, | 700 | static void atombios_crtc_set_dcpll(struct radeon_device *rdev, |
706 | u32 dispclk) | 701 | u32 dispclk) |
707 | { | 702 | { |
708 | struct drm_device *dev = crtc->dev; | ||
709 | struct radeon_device *rdev = dev->dev_private; | ||
710 | u8 frev, crev; | 703 | u8 frev, crev; |
711 | int index; | 704 | int index; |
712 | union set_pixel_clock args; | 705 | union set_pixel_clock args; |
@@ -996,7 +989,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, | 989 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
997 | &ref_div, &post_div); | 990 | &ref_div, &post_div); |
998 | 991 | ||
999 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); | 992 | atombios_crtc_program_ss(rdev, ATOM_DISABLE, radeon_crtc->pll_id, &ss); |
1000 | 993 | ||
1001 | atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, | 994 | atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, |
1002 | encoder_mode, radeon_encoder->encoder_id, mode->clock, | 995 | encoder_mode, radeon_encoder->encoder_id, mode->clock, |
@@ -1019,7 +1012,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
1019 | ss.step = step_size; | 1012 | ss.step = step_size; |
1020 | } | 1013 | } |
1021 | 1014 | ||
1022 | atombios_crtc_program_ss(crtc, ATOM_ENABLE, radeon_crtc->pll_id, &ss); | 1015 | atombios_crtc_program_ss(rdev, ATOM_ENABLE, radeon_crtc->pll_id, &ss); |
1023 | } | 1016 | } |
1024 | } | 1017 | } |
1025 | 1018 | ||
@@ -1494,6 +1487,24 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1494 | 1487 | ||
1495 | } | 1488 | } |
1496 | 1489 | ||
1490 | void radeon_atom_dcpll_init(struct radeon_device *rdev) | ||
1491 | { | ||
1492 | /* always set DCPLL */ | ||
1493 | if (ASIC_IS_DCE4(rdev)) { | ||
1494 | struct radeon_atom_ss ss; | ||
1495 | bool ss_enabled = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
1496 | ASIC_INTERNAL_SS_ON_DCPLL, | ||
1497 | rdev->clock.default_dispclk); | ||
1498 | if (ss_enabled) | ||
1499 | atombios_crtc_program_ss(rdev, ATOM_DISABLE, ATOM_DCPLL, &ss); | ||
1500 | /* XXX: DCE5, make sure voltage, dispclk is high enough */ | ||
1501 | atombios_crtc_set_dcpll(rdev, rdev->clock.default_dispclk); | ||
1502 | if (ss_enabled) | ||
1503 | atombios_crtc_program_ss(rdev, ATOM_ENABLE, ATOM_DCPLL, &ss); | ||
1504 | } | ||
1505 | |||
1506 | } | ||
1507 | |||
1497 | int atombios_crtc_mode_set(struct drm_crtc *crtc, | 1508 | int atombios_crtc_mode_set(struct drm_crtc *crtc, |
1498 | struct drm_display_mode *mode, | 1509 | struct drm_display_mode *mode, |
1499 | struct drm_display_mode *adjusted_mode, | 1510 | struct drm_display_mode *adjusted_mode, |
@@ -1515,19 +1526,6 @@ int atombios_crtc_mode_set(struct drm_crtc *crtc, | |||
1515 | } | 1526 | } |
1516 | } | 1527 | } |
1517 | 1528 | ||
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); | 1529 | atombios_crtc_set_pll(crtc, adjusted_mode); |
1532 | 1530 | ||
1533 | if (ASIC_IS_DCE4(rdev)) | 1531 | if (ASIC_IS_DCE4(rdev)) |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 0afb13bd8dca..a811bc64ad5c 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -959,9 +959,11 @@ int radeon_resume_kms(struct drm_device *dev) | |||
959 | radeon_fbdev_set_suspend(rdev, 0); | 959 | radeon_fbdev_set_suspend(rdev, 0); |
960 | console_unlock(); | 960 | console_unlock(); |
961 | 961 | ||
962 | /* init dig PHYs */ | 962 | /* init dig PHYs, disp eng pll */ |
963 | if (rdev->is_atom_bios) | 963 | if (rdev->is_atom_bios) { |
964 | radeon_atom_encoder_init(rdev); | 964 | radeon_atom_encoder_init(rdev); |
965 | radeon_atom_dcpll_init(rdev); | ||
966 | } | ||
965 | /* reset hpd state */ | 967 | /* reset hpd state */ |
966 | radeon_hpd_init(rdev); | 968 | radeon_hpd_init(rdev); |
967 | /* blat the mode back in */ | 969 | /* blat the mode back in */ |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index d3ffc18774a6..8c49fef1ce78 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -1305,9 +1305,11 @@ int radeon_modeset_init(struct radeon_device *rdev) | |||
1305 | return ret; | 1305 | return ret; |
1306 | } | 1306 | } |
1307 | 1307 | ||
1308 | /* init dig PHYs */ | 1308 | /* init dig PHYs, disp eng pll */ |
1309 | if (rdev->is_atom_bios) | 1309 | if (rdev->is_atom_bios) { |
1310 | radeon_atom_encoder_init(rdev); | 1310 | radeon_atom_encoder_init(rdev); |
1311 | radeon_atom_dcpll_init(rdev); | ||
1312 | } | ||
1311 | 1313 | ||
1312 | /* initialize hpd */ | 1314 | /* initialize hpd */ |
1313 | radeon_hpd_init(rdev); | 1315 | radeon_hpd_init(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 08ff857c8fd6..8cb19f38f8da 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -484,6 +484,7 @@ extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector); | |||
484 | extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector); | 484 | extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector); |
485 | extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode); | 485 | extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode); |
486 | extern void radeon_atom_encoder_init(struct radeon_device *rdev); | 486 | extern void radeon_atom_encoder_init(struct radeon_device *rdev); |
487 | extern void radeon_atom_dcpll_init(struct radeon_device *rdev); | ||
487 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, | 488 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, |
488 | int action, uint8_t lane_num, | 489 | int action, uint8_t lane_num, |
489 | uint8_t lane_set); | 490 | uint8_t lane_set); |