All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evan Quan <evan.quan-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Alexander.Deucher-5C7GfCeVMHo@public.gmane.org,
	Jerry.Zhang-5C7GfCeVMHo@public.gmane.org,
	Evan Quan <evan.quan-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 3/4] drm/amd/powerplay: get raven current sclk and mclk
Date: Sat, 30 Sep 2017 09:10:17 +0800	[thread overview]
Message-ID: <1506733818-4712-3-git-send-email-evan.quan@amd.com> (raw)
In-Reply-To: <1506733818-4712-1-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>

Change-Id: I17120a53bc3cebd8cc7eb9f3d83124905632a409
Signed-off-by: Evan Quan <evan.quan@amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 28 ++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
index e2ad41d..a20a6fe 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
@@ -850,13 +850,37 @@ static int rv_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int rv_read_sensor(struct pp_hwmgr *hwmgr, int idx,
 			  void *value, int *size)
 {
+	uint32_t sclk, mclk;
+	int ret = 0;
+
 	switch (idx) {
+	case AMDGPU_PP_SENSOR_GFX_SCLK:
+		ret = smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_GetGfxclkFrequency);
+		if (!ret) {
+			rv_read_arg_from_smc(hwmgr->smumgr, &sclk);
+			/* in units of 10KHZ */
+			*((uint32_t *)value) = sclk * 100;
+			*size = 4;
+		}
+		break;
+	case AMDGPU_PP_SENSOR_GFX_MCLK:
+		ret = smum_send_msg_to_smc(hwmgr->smumgr, PPSMC_MSG_GetFclkFrequency);
+		if (!ret) {
+			rv_read_arg_from_smc(hwmgr->smumgr, &mclk);
+			/* in units of 10KHZ */
+			*((uint32_t *)value) = mclk * 100;
+			*size = 4;
+		}
+		break;
 	case AMDGPU_PP_SENSOR_GPU_TEMP:
 		*((uint32_t *)value) = rv_thermal_get_temperature(hwmgr);
-		return 0;
+		break;
 	default:
-		return -EINVAL;
+		ret = -EINVAL;
+		break;
 	}
+
+	return ret;
 }
 
 static const struct pp_hwmgr_func rv_hwmgr_funcs = {
-- 
2.7.4

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

  parent reply	other threads:[~2017-09-30  1:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-30  1:10 [PATCH 1/4] drm/amd/powerplay: added new raven ppsmc messages Evan Quan
     [not found] ` <1506733818-4712-1-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>
2017-09-30  1:10   ` [PATCH 2/4] drm/amd/powerplay: get raven max/min gfx clocks Evan Quan
     [not found]     ` <1506733818-4712-2-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>
2017-09-30  1:28       ` Deucher, Alexander
2017-09-30  1:10   ` Evan Quan [this message]
     [not found]     ` <1506733818-4712-3-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>
2017-09-30  1:32       ` [PATCH 3/4] drm/amd/powerplay: get raven current sclk and mclk Deucher, Alexander
2017-09-30  1:10   ` [PATCH 4/4] drm/amd/powerplay: get raven sclk and mclk levels Evan Quan
     [not found]     ` <1506733818-4712-4-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>
2017-09-30  1:35       ` Deucher, Alexander
2017-09-30  1:28   ` [PATCH 1/4] drm/amd/powerplay: added new raven ppsmc messages Zhang, Jerry (Junwei)
2017-09-30  1:30   ` Deucher, Alexander

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=1506733818-4712-3-git-send-email-evan.quan@amd.com \
    --to=evan.quan-5c7gfcevmho@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=Jerry.Zhang-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.