Re: [PATCH 2/2] drm/amdgpu/navi10: add thermal sensor support for navi10

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

 



From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of Alex Deucher <alexdeucher@xxxxxxxxx>
Sent: Thursday, July 4, 2019 10:58:22 AM
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Cc: Deucher, Alexander
Subject: [PATCH 2/2] drm/amdgpu/navi10: add thermal sensor support for navi10
 
This was dropped when the code was refactored.  Re-add it
for navi10.

Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 5794f7cef1c8..34fbc4be224c 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -900,6 +900,42 @@ static int navi10_get_current_activity_percent(struct smu_context *smu,
         return 0;
 }
 
+static int navi10_thermal_get_temperature(struct smu_context *smu,
+                                         enum amd_pp_sensors sensor,
+                                         uint32_t *value)
+{
+       int ret = 0;
+       SmuMetrics_t metrics;
+
+       if (!value)
+               return -EINVAL;
+
+       ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, (void *)&metrics,
+                              false);
+       if (ret)
+               return ret;
+
+       switch (sensor) {
+       case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:
+               *value = metrics.TemperatureHotspot *
+                       SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+               break;
+       case AMDGPU_PP_SENSOR_EDGE_TEMP:
+               *value = metrics.TemperatureEdge *
+                       SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+               break;
+       case AMDGPU_PP_SENSOR_MEM_TEMP:
+               *value = metrics.TemperatureMem *
+                       SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
[kevin]:
the TemperatureMem is not valid for navi10, (it always return 0, it maybe work on HBM type of Memmory, but navi10 is DDR6), 
and we can use TemperatureVrMem0 to replace it , and it is verify on my local side.

Reviewed-by: Kevin Wang <kevin1.wang@xxxxxxx>

+               break;
+       default:
+               pr_err("Invalid sensor for retrieving temp\n");
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
 static bool navi10_is_dpm_running(struct smu_context *smu)
 {
         int ret = 0;
@@ -1280,6 +1316,12 @@ static int navi10_read_sensor(struct smu_context *smu,
                 ret = navi10_get_gpu_power(smu, (uint32_t *)data);
                 *size = 4;
                 break;
+       case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:
+       case AMDGPU_PP_SENSOR_EDGE_TEMP:
+       case AMDGPU_PP_SENSOR_MEM_TEMP:
+               ret = navi10_thermal_get_temperature(smu, sensor, (uint32_t *)data);
+               *size = 4;
+               break;
         default:
                 return -EINVAL;
         }
--
2.20.1

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

_______________________________________________
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