drm/amd/pp: implement dpm_get_sclk/mclk for RV
authorRex Zhu <Rex.Zhu@amd.com>
Tue, 12 Dec 2017 07:06:10 +0000 (15:06 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 13 Dec 2017 22:31:01 +0000 (17:31 -0500)
RV implementation was missing these callbacks.  Used
to fetch the clock values for other components.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c

index 3e0b267c74a88991fde93055f7e3460d2a985379..027fd630355a4d8954caa6cb1092c6c8d26a08eb 100644 (file)
@@ -523,12 +523,33 @@ static int rv_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
 
 static uint32_t rv_dpm_get_mclk(struct pp_hwmgr *hwmgr, bool low)
 {
-       return 0;
+       struct rv_hwmgr *data;
+
+       if (hwmgr == NULL)
+               return -EINVAL;
+
+       data = (struct rv_hwmgr *)(hwmgr->backend);
+
+       if (low)
+               return data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk;
+       else
+               return data->clock_vol_info.vdd_dep_on_fclk->entries[
+                       data->clock_vol_info.vdd_dep_on_fclk->count - 1].clk;
 }
 
 static uint32_t rv_dpm_get_sclk(struct pp_hwmgr *hwmgr, bool low)
 {
-       return 0;
+       struct rv_hwmgr *data;
+
+       if (hwmgr == NULL)
+               return -EINVAL;
+
+       data = (struct rv_hwmgr *)(hwmgr->backend);
+
+       if (low)
+               return data->gfx_min_freq_limit;
+       else
+               return data->gfx_max_freq_limit;
 }
 
 static int rv_dpm_patch_boot_state(struct pp_hwmgr *hwmgr,