drm/amd/powerplay: correct fine grained dpm force level setting
authorEvan Quan <evan.quan@amd.com>
Thu, 14 Nov 2019 08:58:31 +0000 (16:58 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 22 Nov 2019 19:35:10 +0000 (14:35 -0500)
For fine grained dpm, there is only two levels supported. However
to reflect correctly the current clock frequency, there is an
intermediate level faked. Thus on forcing level setting, we
need to treat level 2 correctly as level 1.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/navi10_ppt.c

index 2631def303d4b0ad2d6e7e673d5dbe07a16e6bdf..aaec884d63ed2ac5b64c831a6fa6c0295534dcd6 100644 (file)
@@ -859,6 +859,12 @@ static int navi10_force_clk_levels(struct smu_context *smu,
        case SMU_UCLK:
        case SMU_DCEFCLK:
        case SMU_FCLK:
+               /* There is only 2 levels for fine grained DPM */
+               if (navi10_is_support_fine_grained_dpm(smu, clk_type)) {
+                       soft_max_level = (soft_max_level >= 1 ? 1 : 0);
+                       soft_min_level = (soft_min_level >= 1 ? 1 : 0);
+               }
+
                ret = smu_get_dpm_freq_by_index(smu, clk_type, soft_min_level, &min_freq);
                if (ret)
                        return size;