drm/amd/display: Adding Get static clocks for dm_pp interface
authorMikita Lipski <mikita.lipski@amd.com>
Wed, 18 Apr 2018 21:19:23 +0000 (17:19 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 5 Jul 2018 21:38:29 +0000 (16:38 -0500)
Adding a call to powerplay to get system clocks and translate to dm structure

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c

index 2eef154accf9ea7b4eca31fe27c3684668eb235d..dbd714d0936e95b7a69813f277ec61a697446115 100644 (file)
@@ -451,8 +451,22 @@ bool dm_pp_get_static_clocks(
        const struct dc_context *ctx,
        struct dm_pp_static_clock_info *static_clk_info)
 {
-       /* TODO: to be implemented */
-       return false;
+       struct amdgpu_device *adev = ctx->driver_context;
+       struct amd_pp_clock_info *pp_clk_info = {0};
+       int ret = 0;
+
+       if (adev->powerplay.pp_funcs->get_current_clocks)
+               ret = adev->powerplay.pp_funcs->get_current_clocks(
+                       adev->powerplay.pp_handle,
+                       pp_clk_info);
+       if (ret)
+               return false;
+
+       static_clk_info->max_clocks_state = pp_clk_info->max_clocks_state;
+       static_clk_info->max_mclk_khz = pp_clk_info->max_memory_clock;
+       static_clk_info->max_sclk_khz = pp_clk_info->max_engine_clock;
+
+       return true;
 }
 
 void dm_pp_get_funcs_rv(