diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/si_dpm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/si_dpm.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 73aaa2e4c312..41825575b403 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -37,8 +37,6 @@ | |||
37 | 37 | ||
38 | #define SMC_RAM_END 0x20000 | 38 | #define SMC_RAM_END 0x20000 |
39 | 39 | ||
40 | #define DDR3_DRAM_ROWS 0x2000 | ||
41 | |||
42 | #define SCLK_MIN_DEEPSLEEP_FREQ 1350 | 40 | #define SCLK_MIN_DEEPSLEEP_FREQ 1350 |
43 | 41 | ||
44 | static const struct si_cac_config_reg cac_weights_tahiti[] = | 42 | static const struct si_cac_config_reg cac_weights_tahiti[] = |
@@ -1767,8 +1765,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe | |||
1767 | { | 1765 | { |
1768 | s64 kt, kv, leakage_w, i_leakage, vddc; | 1766 | s64 kt, kv, leakage_w, i_leakage, vddc; |
1769 | s64 temperature, t_slope, t_intercept, av, bv, t_ref; | 1767 | s64 temperature, t_slope, t_intercept, av, bv, t_ref; |
1768 | s64 tmp; | ||
1770 | 1769 | ||
1771 | i_leakage = drm_int2fixp(ileakage / 100); | 1770 | i_leakage = div64_s64(drm_int2fixp(ileakage), 100); |
1772 | vddc = div64_s64(drm_int2fixp(v), 1000); | 1771 | vddc = div64_s64(drm_int2fixp(v), 1000); |
1773 | temperature = div64_s64(drm_int2fixp(t), 1000); | 1772 | temperature = div64_s64(drm_int2fixp(t), 1000); |
1774 | 1773 | ||
@@ -1778,8 +1777,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe | |||
1778 | bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); | 1777 | bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); |
1779 | t_ref = drm_int2fixp(coeff->t_ref); | 1778 | t_ref = drm_int2fixp(coeff->t_ref); |
1780 | 1779 | ||
1781 | kt = drm_fixp_div(drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, temperature)), | 1780 | tmp = drm_fixp_mul(t_slope, vddc) + t_intercept; |
1782 | drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, t_ref))); | 1781 | kt = drm_fixp_exp(drm_fixp_mul(tmp, temperature)); |
1782 | kt = drm_fixp_div(kt, drm_fixp_exp(drm_fixp_mul(tmp, t_ref))); | ||
1783 | kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); | 1783 | kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); |
1784 | 1784 | ||
1785 | leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); | 1785 | leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); |
@@ -1931,6 +1931,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) | |||
1931 | si_pi->cac_override = cac_override_pitcairn; | 1931 | si_pi->cac_override = cac_override_pitcairn; |
1932 | si_pi->powertune_data = &powertune_data_pitcairn; | 1932 | si_pi->powertune_data = &powertune_data_pitcairn; |
1933 | si_pi->dte_data = dte_data_pitcairn; | 1933 | si_pi->dte_data = dte_data_pitcairn; |
1934 | break; | ||
1934 | } | 1935 | } |
1935 | } else if (rdev->family == CHIP_VERDE) { | 1936 | } else if (rdev->family == CHIP_VERDE) { |
1936 | si_pi->lcac_config = lcac_cape_verde; | 1937 | si_pi->lcac_config = lcac_cape_verde; |
@@ -1941,6 +1942,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) | |||
1941 | case 0x683B: | 1942 | case 0x683B: |
1942 | case 0x683F: | 1943 | case 0x683F: |
1943 | case 0x6829: | 1944 | case 0x6829: |
1945 | case 0x6835: | ||
1944 | si_pi->cac_weights = cac_weights_cape_verde_pro; | 1946 | si_pi->cac_weights = cac_weights_cape_verde_pro; |
1945 | si_pi->dte_data = dte_data_cape_verde; | 1947 | si_pi->dte_data = dte_data_cape_verde; |
1946 | break; | 1948 | break; |
@@ -3237,10 +3239,10 @@ int si_dpm_force_performance_level(struct radeon_device *rdev, | |||
3237 | { | 3239 | { |
3238 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; | 3240 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; |
3239 | struct ni_ps *ps = ni_get_ps(rps); | 3241 | struct ni_ps *ps = ni_get_ps(rps); |
3240 | u32 levels; | 3242 | u32 levels = ps->performance_level_count; |
3241 | 3243 | ||
3242 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { | 3244 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { |
3243 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) | 3245 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) |
3244 | return -EINVAL; | 3246 | return -EINVAL; |
3245 | 3247 | ||
3246 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK) | 3248 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK) |
@@ -3249,14 +3251,13 @@ int si_dpm_force_performance_level(struct radeon_device *rdev, | |||
3249 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 3251 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
3250 | return -EINVAL; | 3252 | return -EINVAL; |
3251 | 3253 | ||
3252 | levels = ps->performance_level_count - 1; | 3254 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) != PPSMC_Result_OK) |
3253 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) | ||
3254 | return -EINVAL; | 3255 | return -EINVAL; |
3255 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { | 3256 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { |
3256 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 3257 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
3257 | return -EINVAL; | 3258 | return -EINVAL; |
3258 | 3259 | ||
3259 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) | 3260 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) |
3260 | return -EINVAL; | 3261 | return -EINVAL; |
3261 | } | 3262 | } |
3262 | 3263 | ||
@@ -3620,8 +3621,12 @@ static void si_enable_display_gap(struct radeon_device *rdev) | |||
3620 | { | 3621 | { |
3621 | u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); | 3622 | u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); |
3622 | 3623 | ||
3624 | tmp &= ~(DISP1_GAP_MASK | DISP2_GAP_MASK); | ||
3625 | tmp |= (DISP1_GAP(R600_PM_DISPLAY_GAP_IGNORE) | | ||
3626 | DISP2_GAP(R600_PM_DISPLAY_GAP_IGNORE)); | ||
3627 | |||
3623 | tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); | 3628 | tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); |
3624 | tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE) | | 3629 | tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK) | |
3625 | DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE)); | 3630 | DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE)); |
3626 | WREG32(CG_DISPLAY_GAP_CNTL, tmp); | 3631 | WREG32(CG_DISPLAY_GAP_CNTL, tmp); |
3627 | } | 3632 | } |
@@ -4036,16 +4041,15 @@ static int si_force_switch_to_arb_f0(struct radeon_device *rdev) | |||
4036 | static u32 si_calculate_memory_refresh_rate(struct radeon_device *rdev, | 4041 | static u32 si_calculate_memory_refresh_rate(struct radeon_device *rdev, |
4037 | u32 engine_clock) | 4042 | u32 engine_clock) |
4038 | { | 4043 | { |
4039 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | ||
4040 | u32 dram_rows; | 4044 | u32 dram_rows; |
4041 | u32 dram_refresh_rate; | 4045 | u32 dram_refresh_rate; |
4042 | u32 mc_arb_rfsh_rate; | 4046 | u32 mc_arb_rfsh_rate; |
4043 | u32 tmp = (RREG32(MC_ARB_RAMCFG) & NOOFROWS_MASK) >> NOOFROWS_SHIFT; | 4047 | u32 tmp = (RREG32(MC_ARB_RAMCFG) & NOOFROWS_MASK) >> NOOFROWS_SHIFT; |
4044 | 4048 | ||
4045 | if (pi->mem_gddr5) | 4049 | if (tmp >= 4) |
4046 | dram_rows = 1 << (tmp + 10); | 4050 | dram_rows = 16384; |
4047 | else | 4051 | else |
4048 | dram_rows = DDR3_DRAM_ROWS; | 4052 | dram_rows = 1 << (tmp + 10); |
4049 | 4053 | ||
4050 | dram_refresh_rate = 1 << ((RREG32(MC_SEQ_MISC0) & 0x3) + 3); | 4054 | dram_refresh_rate = 1 << ((RREG32(MC_SEQ_MISC0) & 0x3) + 3); |
4051 | mc_arb_rfsh_rate = ((engine_clock * 10) * dram_refresh_rate / dram_rows - 32) / 64; | 4055 | mc_arb_rfsh_rate = ((engine_clock * 10) * dram_refresh_rate / dram_rows - 32) / 64; |
@@ -6013,16 +6017,11 @@ int si_dpm_set_power_state(struct radeon_device *rdev) | |||
6013 | return ret; | 6017 | return ret; |
6014 | } | 6018 | } |
6015 | 6019 | ||
6016 | #if 0 | ||
6017 | /* XXX */ | ||
6018 | ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | 6020 | ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); |
6019 | if (ret) { | 6021 | if (ret) { |
6020 | DRM_ERROR("si_dpm_force_performance_level failed\n"); | 6022 | DRM_ERROR("si_dpm_force_performance_level failed\n"); |
6021 | return ret; | 6023 | return ret; |
6022 | } | 6024 | } |
6023 | #else | ||
6024 | rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; | ||
6025 | #endif | ||
6026 | 6025 | ||
6027 | return 0; | 6026 | return 0; |
6028 | } | 6027 | } |