]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/pm: retain the fine grain tuning parameters after resume
authorXiaojian Du <Xiaojian.Du@amd.com>
Tue, 25 May 2021 10:29:53 +0000 (18:29 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 2 Jun 2021 02:46:05 +0000 (22:46 -0400)
This patch is to retain the fine grain tuning parameters after resume for
legacy APU, it will cover Raven/Raven2/Picasso.

Signed-off-by: Xiaojian Du <Xiaojian.Du@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/powerplay/hwmgr/hardwaremanager.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c

index 25b5831a15cd2913310f097caf9bf0d280538391..981dc8c7112d697f101ad449e136f2db86cd9e04 100644 (file)
@@ -82,7 +82,8 @@ int phm_enable_dynamic_state_management(struct pp_hwmgr *hwmgr)
 
        /* Skip for suspend/resume case */
        if (!hwmgr->pp_one_vf && smum_is_dpm_running(hwmgr)
-           && !amdgpu_passthrough(adev) && adev->in_suspend) {
+           && !amdgpu_passthrough(adev) && adev->in_suspend
+               && adev->asic_type != CHIP_RAVEN) {
                pr_info("dpm has been enabled\n");
                return 0;
        }
index f5fe540cd5366b4cbf619b33207e08470f6239ba..8f71f6a4bb4974636382254268f23439eec2391f 100644 (file)
@@ -377,6 +377,27 @@ static int smu10_enable_gfx_off(struct pp_hwmgr *hwmgr)
 
 static int smu10_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
 {
+       struct amdgpu_device *adev = hwmgr->adev;
+       struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
+       int ret = -EINVAL;
+
+       if (adev->in_suspend) {
+               pr_info("restore the fine grain parameters\n");
+
+               ret = smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_SetHardMinGfxClk,
+                                       smu10_data->gfx_actual_soft_min_freq,
+                                       NULL);
+               if (ret)
+                       return ret;
+               ret = smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_SetSoftMaxGfxClk,
+                                       smu10_data->gfx_actual_soft_max_freq,
+                                       NULL);
+               if (ret)
+                       return ret;
+       }
+
        return 0;
 }