[PATCH 07/51] drm/amd/display: Adding Get static clocks for dm_pp interface

Harry Wentland harry.wentland at amd.com
Tue Jun 19 21:10:14 UTC 2018


From: Mikita Lipski <mikita.lipski at amd.com>

Adding a call to powerplay to get system clocks and translate to dm structure

Change-Id: Ic6892857a16cce24d9ac9485b5507d97a67fca37
Signed-off-by: Mikita Lipski <mikita.lipski at amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_services.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
index 0dc7a791c216..3dcd5f9af6e5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c
@@ -459,8 +459,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(
-- 
2.17.1



More information about the amd-gfx mailing list