drm/amdgpu: add dpm helper function for DF Cstate control
authorHawking Zhang <Hawking.Zhang@amd.com>
Mon, 24 Feb 2020 06:19:56 +0000 (14:19 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 26 Feb 2020 19:17:32 +0000 (14:17 -0500)
The helper function hides software smu and legacy powerplay
implementation for DF Cstate control.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h

index a2e8c3dfb4f158760c6fda0a8eddf37ad85be58b..ba1bb95a3cf93c7864cb18a6f00b898999836980 100644 (file)
@@ -1171,3 +1171,20 @@ int amdgpu_dpm_set_xgmi_pstate(struct amdgpu_device *adev,
 
        return ret;
 }
+
+int amdgpu_dpm_set_df_cstate(struct amdgpu_device *adev,
+                            uint32_t cstate)
+{
+       int ret = 0;
+       const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
+       void *pp_handle = adev->powerplay.pp_handle;
+       struct smu_context *smu = &adev->smu;
+
+       if (is_support_sw_smu(adev))
+               ret = smu_set_df_cstate(smu, cstate);
+       else if (pp_funcs &&
+                pp_funcs->set_df_cstate)
+               ret = pp_funcs->set_df_cstate(pp_handle, cstate);
+
+       return ret;
+}
index 902ca6c00cca4508016471a9239456204bf3d5a2..168579492a5579dd60177b01cda0a321d034b38d 100644 (file)
@@ -533,4 +533,7 @@ int amdgpu_dpm_baco_exit(struct amdgpu_device *adev);
 
 int amdgpu_dpm_baco_enter(struct amdgpu_device *adev);
 
+int amdgpu_dpm_set_df_cstate(struct amdgpu_device *adev,
+                            uint32_t cstate);
+
 #endif