[PATCH 5/6] drm/amd/pm: Add vangogh throttler translation

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

 



Perform dependent to independent throttle status translation for
vangogh.
---
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 41 +++++++++++++++++--
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index 77f532a49e37..6e3cfb4bda1d 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -251,6 +251,37 @@ static int vangogh_tables_init(struct smu_context *smu)
 	return -ENOMEM;
 }
 
+static uint32_t vangogh_get_indep_throttler_status(
+					unsigned long dep_throttler_status)
+{
+	unsigned long indep_throttler_status = 0;
+
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_SPL, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_SPL, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_FPPT, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_FPPT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_SPPT, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_SPPT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_SPPT_APU, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_SPPT_APU, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_THM_CORE, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_THM_CORE, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_THM_GFX, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_THM_GFX, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_THM_SOC, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_THM_SOC, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_TDC_VDD, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_TDC_VDD, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_TDC_SOC, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_TDC_SOC, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_TDC_GFX, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_TDC_GFX, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_STATUS_BIT_TDC_CVIP, &indep_throttler_status,
+		  test_bit(THROTTLER_STATUS_BIT_TDC_CVIP, &dep_throttler_status));
+
+	return (uint32_t)indep_throttler_status;
+}
+
 static int vangogh_get_legacy_smu_metrics_data(struct smu_context *smu,
 				       MetricsMember_t member,
 				       uint32_t *value)
@@ -304,7 +335,7 @@ static int vangogh_get_legacy_smu_metrics_data(struct smu_context *smu,
 		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 		break;
 	case METRICS_THROTTLER_STATUS:
-		*value = metrics->ThrottlerStatus;
+		*value = vangogh_get_indep_throttler_status(metrics->ThrottlerStatus);
 		break;
 	case METRICS_VOLTAGE_VDDGFX:
 		*value = metrics->Voltage[2];
@@ -379,7 +410,7 @@ static int vangogh_get_smu_metrics_data(struct smu_context *smu,
 		SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 		break;
 	case METRICS_THROTTLER_STATUS:
-		*value = metrics->Current.ThrottlerStatus;
+		*value = vangogh_get_indep_throttler_status(metrics->Current.ThrottlerStatus);
 		break;
 	case METRICS_VOLTAGE_VDDGFX:
 		*value = metrics->Current.Voltage[2];
@@ -1673,7 +1704,8 @@ static ssize_t vangogh_get_legacy_gpu_metrics(struct smu_context *smu,
 		sizeof(uint16_t) * 4);
 	gpu_metrics->current_l3clk[0] = metrics.L3Frequency[0];
 
-	gpu_metrics->throttle_status = metrics.ThrottlerStatus;
+	gpu_metrics->throttle_status =
+			vangogh_get_indep_throttler_status(metrics.ThrottlerStatus);
 
 	gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
 
@@ -1734,7 +1766,8 @@ static ssize_t vangogh_get_gpu_metrics(struct smu_context *smu,
 		sizeof(uint16_t) * 4);
 	gpu_metrics->current_l3clk[0] = metrics.Current.L3Frequency[0];
 
-	gpu_metrics->throttle_status = metrics.Current.ThrottlerStatus;
+	gpu_metrics->throttle_status =
+			vangogh_get_indep_throttler_status(metrics.Current.ThrottlerStatus);
 
 	gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
 
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



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

  Powered by Linux