aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2015-11-03 22:21:35 -0500
committerAlex Deucher <alexander.deucher@amd.com>2015-12-21 16:42:28 -0500
commite829ecdb15671d8c1a106f608aa419f7fd4d7366 (patch)
treebd22054cca91b6485e814fae792ae6b7d1c8f428
parent09b4c872fe16d5e396de8636f5810078014dbd3f (diff)
drm/amd/powerplay: implement new funcs to check current states for tonga.
Implement the new callbacks for tonga. Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
index 088b5bf91251..9a1e8bf41b8e 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
@@ -5935,6 +5935,66 @@ int tonga_register_internal_thermal_interrupt(struct pp_hwmgr *hwmgr,
5935 return 0; 5935 return 0;
5936} 5936}
5937 5937
5938bool tonga_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr)
5939{
5940 struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
5941 bool is_update_required = false;
5942 struct cgs_display_info info = {0,0,NULL};
5943
5944 cgs_get_active_displays_info(hwmgr->device, &info);
5945
5946 if (data->display_timing.num_existing_displays != info.display_count)
5947 is_update_required = true;
5948/* TO DO NEED TO GET DEEP SLEEP CLOCK FROM DAL
5949 if (phm_cap_enabled(hwmgr->hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) {
5950 cgs_get_min_clock_settings(hwmgr->device, &min_clocks);
5951 if(min_clocks.engineClockInSR != data->display_timing.minClockInSR)
5952 is_update_required = true;
5953*/
5954 return is_update_required;
5955}
5956
5957static inline bool tonga_are_power_levels_equal(const struct tonga_performance_level *pl1,
5958 const struct tonga_performance_level *pl2)
5959{
5960 return ((pl1->memory_clock == pl2->memory_clock) &&
5961 (pl1->engine_clock == pl2->engine_clock) &&
5962 (pl1->pcie_gen == pl2->pcie_gen) &&
5963 (pl1->pcie_lane == pl2->pcie_lane));
5964}
5965
5966int tonga_check_states_equal(struct pp_hwmgr *hwmgr, const struct pp_hw_power_state *pstate1, const struct pp_hw_power_state *pstate2, bool *equal)
5967{
5968 const struct tonga_power_state *psa = cast_const_phw_tonga_power_state(pstate1);
5969 const struct tonga_power_state *psb = cast_const_phw_tonga_power_state(pstate2);
5970 int i;
5971
5972 if (pstate1 == NULL || pstate2 == NULL || equal == NULL)
5973 return -EINVAL;
5974
5975 /* If the two states don't even have the same number of performance levels they cannot be the same state. */
5976 if (psa->performance_level_count != psb->performance_level_count) {
5977 *equal = false;
5978 return 0;
5979 }
5980
5981 for (i = 0; i < psa->performance_level_count; i++) {
5982 if (!tonga_are_power_levels_equal(&(psa->performance_levels[i]), &(psb->performance_levels[i]))) {
5983 /* If we have found even one performance level pair that is different the states are different. */
5984 *equal = false;
5985 return 0;
5986 }
5987 }
5988
5989 /* If all performance levels are the same try to use the UVD clocks to break the tie.*/
5990 *equal = ((psa->uvd_clocks.VCLK == psb->uvd_clocks.VCLK) && (psa->uvd_clocks.DCLK == psb->uvd_clocks.DCLK));
5991 *equal &= ((psa->vce_clocks.EVCLK == psb->vce_clocks.EVCLK) && (psa->vce_clocks.ECCLK == psb->vce_clocks.ECCLK));
5992 *equal &= (psa->sclk_threshold == psb->sclk_threshold);
5993 *equal &= (psa->acp_clk == psb->acp_clk);
5994
5995 return 0;
5996}
5997
5938static const struct pp_hwmgr_func tonga_hwmgr_funcs = { 5998static const struct pp_hwmgr_func tonga_hwmgr_funcs = {
5939 .backend_init = &tonga_hwmgr_backend_init, 5999 .backend_init = &tonga_hwmgr_backend_init,
5940 .backend_fini = &tonga_hwmgr_backend_fini, 6000 .backend_fini = &tonga_hwmgr_backend_fini,
@@ -5968,6 +6028,8 @@ static const struct pp_hwmgr_func tonga_hwmgr_funcs = {
5968 .set_fan_speed_rpm = tonga_fan_ctrl_set_fan_speed_rpm, 6028 .set_fan_speed_rpm = tonga_fan_ctrl_set_fan_speed_rpm,
5969 .uninitialize_thermal_controller = tonga_thermal_ctrl_uninitialize_thermal_controller, 6029 .uninitialize_thermal_controller = tonga_thermal_ctrl_uninitialize_thermal_controller,
5970 .register_internal_thermal_interrupt = tonga_register_internal_thermal_interrupt, 6030 .register_internal_thermal_interrupt = tonga_register_internal_thermal_interrupt,
6031 .check_smc_update_required_for_display_configuration = tonga_check_smc_update_required_for_display_configuration,
6032 .check_states_equal = tonga_check_states_equal,
5971}; 6033};
5972 6034
5973int tonga_hwmgr_init(struct pp_hwmgr *hwmgr) 6035int tonga_hwmgr_init(struct pp_hwmgr *hwmgr)