Re: [PATCH 1/4] drm/amd/powerplay: implement interface to retrieve gpu temperature for renoir

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

 



[AMD Official Use Only - Internal Distribution Only]


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

Best Regards,
Kevin

From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of Xiaomeng Hou <Xiaomeng.Hou@xxxxxxx>
Sent: Thursday, December 5, 2019 7:50 PM
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>
Cc: Hou, Xiaomeng (Matthew) <Xiaomeng.Hou@xxxxxxx>
Subject: [PATCH 1/4] drm/amd/powerplay: implement interface to retrieve gpu temperature for renoir
 
add sensor interface of get gpu temperature for debugfs.

Change-Id: I2499b6652fad6d5d776b6ed4cd5157636583ed39
Signed-off-by: Xiaomeng Hou <Xiaomeng.Hou@xxxxxxx>
---
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
index 3788047bd704..3f6f0ebf1fbe 100644
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
@@ -429,6 +429,24 @@ static int renoir_get_gpu_power(struct smu_context *smu, uint32_t *value)
         return 0;
 }
 
+static int renoir_get_gpu_temperature(struct smu_context *smu, uint32_t *value)
+{
+       int ret = 0;
+       SmuMetrics_t metrics;
+
+       if (!value)
+               return -EINVAL;
+
+       ret = renoir_get_metrics_table(smu, &metrics);
+       if (ret)
+               return ret;
+
+       *value = (metrics.GfxTemperature / 100) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+
+       return 0;
+}
+
 static int renoir_get_current_activity_percent(struct smu_context *smu,
                                                enum amd_pp_sensors sensor,
                                                uint32_t *value)
@@ -787,6 +805,10 @@ static int renoir_read_sensor(struct smu_context *smu,
                 ret = renoir_get_gpu_power(smu, (uint32_t *)data);
                 *size = 4;
                 break;
+       case AMDGPU_PP_SENSOR_GPU_TEMP:
+               ret = renoir_get_gpu_temperature(smu, (uint32_t *)data);
+               *size = 4;
+               break;
         default:
                 ret = smu_v12_0_read_sensor(smu, sensor, data, size);
         }
--
2.24.0

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://nam11.safelinks.protection.outlook.com/?url="">
_______________________________________________
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