AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: amd-gfx@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 4/5] drm/amdgpu/swsmu/vangogh: use metrics table for voltages
Date: Tue,  1 Dec 2020 12:44:12 -0500	[thread overview]
Message-ID: <20201201174413.643254-4-alexander.deucher@amd.com> (raw)
In-Reply-To: <20201201174413.643254-1-alexander.deucher@amd.com>

Fixes voltage reading for vddgfx and adds support for vddsoc.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 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 1645509cdab8..3bc7395c5fb7 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -265,6 +265,12 @@ static int vangogh_get_smu_metrics_data(struct smu_context *smu,
 	case METRICS_THROTTLER_STATUS:
 		*value = metrics->ThrottlerStatus;
 		break;
+	case METRICS_TEMPERATURE_VRGFX:
+		*value = metrics->Voltage[2];
+		break;
+	case METRICS_TEMPERATURE_VRSOC:
+		*value = metrics->Voltage[1];
+		break;
 	default:
 		*value = UINT_MAX;
 		break;
@@ -469,13 +475,21 @@ static int vangogh_read_sensor(struct smu_context *smu,
 		break;
 	case AMDGPU_PP_SENSOR_GFX_SCLK:
 		ret = vangogh_get_smu_metrics_data(smu,
-						    METRICS_AVERAGE_GFXCLK,
-						    (uint32_t *)data);
+						   METRICS_AVERAGE_GFXCLK,
+						   (uint32_t *)data);
 		*(uint32_t *)data *= 100;
 		*size = 4;
 		break;
 	case AMDGPU_PP_SENSOR_VDDGFX:
-		ret = smu_v11_0_get_gfx_vdd(smu, (uint32_t *)data);
+		ret = vangogh_get_smu_metrics_data(smu,
+						   METRICS_TEMPERATURE_VRGFX,
+						   (uint32_t *)data);
+		*size = 4;
+		break;
+	case AMDGPU_PP_SENSOR_VDDNB:
+		ret = vangogh_get_smu_metrics_data(smu,
+						   METRICS_TEMPERATURE_VRSOC,
+						   (uint32_t *)data);
 		*size = 4;
 		break;
 	default:
-- 
2.25.4

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

  parent reply	other threads:[~2020-12-01 17:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 17:44 [PATCH 1/5] drm/amdgpu/powerplay/vega10: handle error in getting pptable Alex Deucher
2020-12-01 17:44 ` [PATCH 2/5] drm/amdgpu/powerplay/psm: return an error in power state init Alex Deucher
2020-12-02  2:09   ` Quan, Evan
2020-12-01 17:44 ` [PATCH 3/5] drm/amdgpu/swsmu/vangogh: simplify sensor handling Alex Deucher
2020-12-02  2:09   ` Quan, Evan
2020-12-01 17:44 ` Alex Deucher [this message]
2020-12-02  2:13   ` [PATCH 4/5] drm/amdgpu/swsmu/vangogh: use metrics table for voltages Quan, Evan
2020-12-01 17:44 ` [PATCH 5/5] drm/amdgpu/swsmu/renoir: simplify sensor handling Alex Deucher
2020-12-02  2:14   ` Quan, Evan
2020-12-02  2:09 ` [PATCH 1/5] drm/amdgpu/powerplay/vega10: handle error in getting pptable Quan, Evan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201201174413.643254-4-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox