[PATCH] drm/amd/powerplay: add temperature sensor support for navi10
Wang, Kevin(Yang)
Kevin1.Wang at amd.com
Mon Jul 8 06:05:32 UTC 2019
________________________________
From: Alex Deucher <alexdeucher at gmail.com>
Sent: Saturday, July 6, 2019 5:06 AM
To: Wang, Kevin(Yang)
Cc: amd-gfx at lists.freedesktop.org; Xiao, Jack; Kenenth.Feng at amd.com; Zhang, Hawking
Subject: Re: [PATCH] drm/amd/powerplay: add temperature sensor support for navi10
On Wed, Jul 3, 2019 at 11:02 PM Wang, Kevin(Yang) <Kevin1.Wang at amd.com> wrote:
>
> the hwmon interface need temperature sensor type support.
> 1. SENSOR_HOTSPOT_TEMP
> 2. SENSOR_EDGE_TEMP(SENSOR_GPU_TEMP)
> 3. SENSOR_MEM_TEMP
>
> Change-Id: I3db762e4032072fae67c95b7ba6d62e20ae5bead
> Signed-off-by: Kevin Wang <kevin1.wang at amd.com>
> ---
> 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 7574a02350c6..d5876c2393e7 100644
> --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> @@ -1255,6 +1255,42 @@ static int navi10_set_watermarks_table(struct smu_context *smu,
> return 0;
> }
>
> +static int navi10_thermal_get_temperature(struct smu_context *smu,
> + enum amd_pp_sensors sensor,
> + uint32_t *value)
> +{
> + SmuMetrics_t metrics;
> + int ret = 0;
> +
> + 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_GPU_TEMP:
> + case AMDGPU_PP_SENSOR_EDGE_TEMP:
> + *value = metrics.TemperatureEdge *
> + SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
> + break;
> + case AMDGPU_PP_SENSOR_MEM_TEMP:
> + *value = metrics.TemperatureVrMem0 *
We should check with the SMU team. this might be the memory voltage
regulator rather than the memory itself.
Alex
[kevin]:
sure, you are right, we should use TemperatureMem, the TemperatureVrMem0 is memory voltage regular temperature.
thanks.
> + SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
> + break;
> + default:
> + pr_err("Invalid sensor for retrieving temp\n");
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> static int navi10_read_sensor(struct smu_context *smu,
> enum amd_pp_sensors sensor,
> void *data, uint32_t *size)
> @@ -1276,6 +1312,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.22.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190708/b68b1fad/attachment.html>
More information about the amd-gfx
mailing list