[PATCH] drm/amd/pm: Use one level table if dpm not enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For SMU v13.0.6 variants, if dpm is disabled for a clock, fill current
frequency as the only level in frequency table. Also, drop Lclk table as
it is not used.

Signed-off-by: Lijo Lazar <lijo.lazar@xxxxxxx>
---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 33 +++++++++++--------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
index de533076e157..7f0b4cc1141b 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
@@ -279,6 +279,20 @@ struct PPTable_t {
 				   sizeof(MetricsTableV1_t),\
 				   sizeof(MetricsTableV2_t)))
 
+#define METRICS_CURR_FREQ_F0(clk) \
+	SMUQ10_ROUND(GET_METRIC_FIELD(clk##Frequency, version))
+#define METRICS_CURR_FREQ_F1(clk) \
+	SMUQ10_ROUND(GET_METRIC_FIELD(clk##Frequency, version)[0])
+
+#define INIT_FREQ_TABLE(type, clk, levels, f)                           \
+	if (!smu_cmn_clk_dpm_is_enabled(smu, type))                     \
+		pptable->clk##FrequencyTable[0] = f(clk);               \
+	else                                                            \
+		for (i = 0; i < levels; i++)                            \
+			pptable->clk##FrequencyTable[i] = SMUQ10_ROUND( \
+				GET_METRIC_FIELD(clk##FrequencyTable,   \
+						 version)[i]);
+
 struct smu_v13_0_6_dpm_map {
 	enum smu_clk_type clk_type;
 	uint32_t feature_num;
@@ -806,20 +820,11 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu)
 		pptable->MinGfxclkFrequency =
 			SMUQ10_ROUND(GET_METRIC_FIELD(MinGfxclkFrequency, version));
 
-		for (i = 0; i < 4; ++i) {
-			pptable->FclkFrequencyTable[i] =
-				SMUQ10_ROUND(GET_METRIC_FIELD(FclkFrequencyTable, version)[i]);
-			pptable->UclkFrequencyTable[i] =
-				SMUQ10_ROUND(GET_METRIC_FIELD(UclkFrequencyTable, version)[i]);
-			pptable->SocclkFrequencyTable[i] = SMUQ10_ROUND(
-				GET_METRIC_FIELD(SocclkFrequencyTable, version)[i]);
-			pptable->VclkFrequencyTable[i] =
-				SMUQ10_ROUND(GET_METRIC_FIELD(VclkFrequencyTable, version)[i]);
-			pptable->DclkFrequencyTable[i] =
-				SMUQ10_ROUND(GET_METRIC_FIELD(DclkFrequencyTable, version)[i]);
-			pptable->LclkFrequencyTable[i] =
-				SMUQ10_ROUND(GET_METRIC_FIELD(LclkFrequencyTable, version)[i]);
-		}
+		INIT_FREQ_TABLE(SMU_FCLK, Fclk, 4, METRICS_CURR_FREQ_F0);
+		INIT_FREQ_TABLE(SMU_UCLK, Uclk, 4, METRICS_CURR_FREQ_F0);
+		INIT_FREQ_TABLE(SMU_SOCCLK, Socclk, 4, METRICS_CURR_FREQ_F1);
+		INIT_FREQ_TABLE(SMU_VCLK, Vclk, 4, METRICS_CURR_FREQ_F1);
+		INIT_FREQ_TABLE(SMU_DCLK, Dclk, 4, METRICS_CURR_FREQ_F1);
 
 		/* use AID0 serial number by default */
 		pptable->PublicSerialNumber_AID =
-- 
2.25.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux