]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/pm: Skip redundant UCLK restore in smu_v13_0_6
authorAsad Kamal <asad.kamal@amd.com>
Wed, 18 Mar 2026 05:48:30 +0000 (13:48 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 23 Mar 2026 18:48:45 +0000 (14:48 -0400)
Only reapply UCLK soft limits during PP_OD_RESTORE_DEFAULT when the
current max differs from the DPM table max. This avoids redundant
SMC updates and prevents -EINVAL on restore when no change is needed.

Fixes: b7a900344546 ("drm/amd/pm: Allow setting max UCLK on SMU v13.0.6")
Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 17f11bbbc76c8e83c8474ea708316b1e3631d927)

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c

index 896b51c8a9a7347a39e3371b6597c43f837c265a..b44a85697a30adfbf1b2af23ea88e317574a2fcc 100644 (file)
@@ -2122,6 +2122,7 @@ static int smu_v13_0_6_usr_edit_dpm_table(struct smu_context *smu,
 {
        struct smu_dpm_context *smu_dpm = &(smu->smu_dpm);
        struct smu_13_0_dpm_context *dpm_context = smu_dpm->dpm_context;
+       struct smu_dpm_table *uclk_table = &dpm_context->dpm_tables.uclk_table;
        struct smu_umd_pstate_table *pstate_table = &smu->pstate_table;
        uint32_t min_clk;
        uint32_t max_clk;
@@ -2221,14 +2222,16 @@ static int smu_v13_0_6_usr_edit_dpm_table(struct smu_context *smu,
                        if (ret)
                                return ret;
 
-                       min_clk = SMU_DPM_TABLE_MIN(
-                               &dpm_context->dpm_tables.uclk_table);
-                       max_clk = SMU_DPM_TABLE_MAX(
-                               &dpm_context->dpm_tables.uclk_table);
-                       ret = smu_v13_0_6_set_soft_freq_limited_range(
-                               smu, SMU_UCLK, min_clk, max_clk, false);
-                       if (ret)
-                               return ret;
+                       if (SMU_DPM_TABLE_MAX(uclk_table) !=
+                           pstate_table->uclk_pstate.curr.max) {
+                               min_clk = SMU_DPM_TABLE_MIN(&dpm_context->dpm_tables.uclk_table);
+                               max_clk = SMU_DPM_TABLE_MAX(&dpm_context->dpm_tables.uclk_table);
+                               ret = smu_v13_0_6_set_soft_freq_limited_range(smu,
+                                                                             SMU_UCLK, min_clk,
+                                                                             max_clk, false);
+                               if (ret)
+                                       return ret;
+                       }
                        smu_v13_0_reset_custom_level(smu);
                }
                break;