[PATCH 184/459] drm/amd/powerplay: move getting MAX_FAN_RPM value to asic level

Alex Deucher alexdeucher at gmail.com
Mon Jun 17 19:26:49 UTC 2019


From: Huang Rui <ray.huang at amd.com>

Getting MAX_FAN_RPM value needs to be read by pptable, so it should be moved to
asic level.

Signed-off-by: Huang Rui <ray.huang at amd.com>
Reviewed-by: Kevin Wang <kevin1.wang at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c  | 6 ------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 243f0ea9259f..e4fbf8dd57b2 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -1302,8 +1302,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,
 				 enum amd_pp_sensors sensor,
 				 void *data, uint32_t *size)
 {
-	struct smu_table_context *table_context = &smu->smu_table;
-	PPTable_t *pptable = table_context->driver_pptable;
 	int ret = 0;
 	switch (sensor) {
 	case AMDGPU_PP_SENSOR_GPU_LOAD:
@@ -1339,10 +1337,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,
 		*(uint32_t *)data = 0;
 		*size = 4;
 		break;
-	case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
-		*(uint32_t *)data = pptable->FanMaximumRpm;
-		*size = 4;
-		break;
 	default:
 		ret = smu_common_read_sensor(smu, sensor, data, size);
 		break;
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
index 57efe145e6fe..e9f0230fc274 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -2950,6 +2950,8 @@ static int vega20_read_sensor(struct smu_context *smu,
 			      void *data, uint32_t *size)
 {
 	int ret = 0;
+	struct smu_table_context *table_context = &smu->smu_table;
+	PPTable_t *pptable = table_context->driver_pptable;
 
 	switch (sensor) {
 	case AMDGPU_PP_SENSOR_UVD_POWER:
@@ -2960,6 +2962,10 @@ static int vega20_read_sensor(struct smu_context *smu,
 		*(uint32_t *)data = smu_feature_is_enabled(smu, SMU_FEATURE_DPM_VCE_BIT) ? 1 : 0;
 		*size = 4;
 		break;
+	case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
+		*(uint32_t *)data = pptable->FanMaximumRpm;
+		*size = 4;
+		break;
 	default:
 		return -EINVAL;
 	}
-- 
2.20.1



More information about the amd-gfx mailing list