diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/ci_dpm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/ci_dpm.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 899627443030..51e947a97edf 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
@@ -146,6 +146,8 @@ static const struct ci_pt_config_reg didt_config_ci[] = | |||
146 | }; | 146 | }; |
147 | 147 | ||
148 | extern u8 rv770_get_memory_module_index(struct radeon_device *rdev); | 148 | extern u8 rv770_get_memory_module_index(struct radeon_device *rdev); |
149 | extern void btc_get_max_clock_from_voltage_dependency_table(struct radeon_clock_voltage_dependency_table *table, | ||
150 | u32 *max_clock); | ||
149 | extern int ni_copy_and_switch_arb_sets(struct radeon_device *rdev, | 151 | extern int ni_copy_and_switch_arb_sets(struct radeon_device *rdev, |
150 | u32 arb_freq_src, u32 arb_freq_dest); | 152 | u32 arb_freq_src, u32 arb_freq_dest); |
151 | extern u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock); | 153 | extern u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock); |
@@ -712,6 +714,7 @@ static void ci_apply_state_adjust_rules(struct radeon_device *rdev, | |||
712 | struct radeon_clock_and_voltage_limits *max_limits; | 714 | struct radeon_clock_and_voltage_limits *max_limits; |
713 | bool disable_mclk_switching; | 715 | bool disable_mclk_switching; |
714 | u32 sclk, mclk; | 716 | u32 sclk, mclk; |
717 | u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc; | ||
715 | int i; | 718 | int i; |
716 | 719 | ||
717 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || | 720 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || |
@@ -739,6 +742,29 @@ static void ci_apply_state_adjust_rules(struct radeon_device *rdev, | |||
739 | } | 742 | } |
740 | } | 743 | } |
741 | 744 | ||
745 | /* limit clocks to max supported clocks based on voltage dependency tables */ | ||
746 | btc_get_max_clock_from_voltage_dependency_table(&rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk, | ||
747 | &max_sclk_vddc); | ||
748 | btc_get_max_clock_from_voltage_dependency_table(&rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk, | ||
749 | &max_mclk_vddci); | ||
750 | btc_get_max_clock_from_voltage_dependency_table(&rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk, | ||
751 | &max_mclk_vddc); | ||
752 | |||
753 | for (i = 0; i < ps->performance_level_count; i++) { | ||
754 | if (max_sclk_vddc) { | ||
755 | if (ps->performance_levels[i].sclk > max_sclk_vddc) | ||
756 | ps->performance_levels[i].sclk = max_sclk_vddc; | ||
757 | } | ||
758 | if (max_mclk_vddci) { | ||
759 | if (ps->performance_levels[i].mclk > max_mclk_vddci) | ||
760 | ps->performance_levels[i].mclk = max_mclk_vddci; | ||
761 | } | ||
762 | if (max_mclk_vddc) { | ||
763 | if (ps->performance_levels[i].mclk > max_mclk_vddc) | ||
764 | ps->performance_levels[i].mclk = max_mclk_vddc; | ||
765 | } | ||
766 | } | ||
767 | |||
742 | /* XXX validate the min clocks required for display */ | 768 | /* XXX validate the min clocks required for display */ |
743 | 769 | ||
744 | if (disable_mclk_switching) { | 770 | if (disable_mclk_switching) { |