From: jsg Date: Mon, 19 Jun 2023 00:41:10 +0000 (+0000) Subject: drm/amd/pm: reverse mclk and fclk clocks levels for vangogh X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9a63ca6b39094256ff40e82695f362a199002cde;p=openbsd drm/amd/pm: reverse mclk and fclk clocks levels for vangogh From Tim Huang e0a0f5d2ba593bbf155a41890f675390fd312e2c in linux-6.1.y/6.1.33 bfc03568d9d81332382c73a1985a90c4506bd36c in mainline linux --- diff --git a/sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c index d6353157889..5bc1eba779c 100644 --- a/sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +++ b/sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c @@ -588,7 +588,7 @@ static int vangogh_print_legacy_clk_levels(struct smu_context *smu, DpmClocks_t *clk_table = smu->smu_table.clocks_table; SmuMetrics_legacy_t metrics; struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); - int i, size = 0, ret = 0; + int i, idx, size = 0, ret = 0; uint32_t cur_value = 0, value = 0, count = 0; bool cur_value_match_level = false; @@ -662,7 +662,8 @@ static int vangogh_print_legacy_clk_levels(struct smu_context *smu, case SMU_MCLK: case SMU_FCLK: for (i = 0; i < count; i++) { - ret = vangogh_get_dpm_clk_limited(smu, clk_type, i, &value); + idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i; + ret = vangogh_get_dpm_clk_limited(smu, clk_type, idx, &value); if (ret) return ret; if (!value) @@ -689,7 +690,7 @@ static int vangogh_print_clk_levels(struct smu_context *smu, DpmClocks_t *clk_table = smu->smu_table.clocks_table; SmuMetrics_t metrics; struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); - int i, size = 0, ret = 0; + int i, idx, size = 0, ret = 0; uint32_t cur_value = 0, value = 0, count = 0; bool cur_value_match_level = false; uint32_t min, max; @@ -771,7 +772,8 @@ static int vangogh_print_clk_levels(struct smu_context *smu, case SMU_MCLK: case SMU_FCLK: for (i = 0; i < count; i++) { - ret = vangogh_get_dpm_clk_limited(smu, clk_type, i, &value); + idx = (clk_type == SMU_FCLK || clk_type == SMU_MCLK) ? (count - i - 1) : i; + ret = vangogh_get_dpm_clk_limited(smu, clk_type, idx, &value); if (ret) return ret; if (!value)