AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Evan Quan <evan.quan@amd.com>
To: amd-gfx@lists.freedesktop.org
Cc: alexander.deucher@amd.com, Evan Quan <evan.quan@amd.com>
Subject: [PATCH 7/7] drm/amd/powerplay: add check for power limit OD support
Date: Mon,  8 Jun 2020 18:52:34 +0800	[thread overview]
Message-ID: <20200608105234.29864-7-evan.quan@amd.com> (raw)
In-Reply-To: <20200608105234.29864-1-evan.quan@amd.com>

Before counting the OD percent into max power limit margin.

Change-Id: I83b24d614e07fbc5eac41ff7cd668a1c2f33c6b2
Signed-off-by: Evan Quan <evan.quan@amd.com>
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 186cdf6696f8..115794557190 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -1920,6 +1920,7 @@ static int navi10_get_power_limit(struct smu_context *smu)
 {
 	struct smu_11_0_powerplay_table *powerplay_table =
 		(struct smu_11_0_powerplay_table *)smu->smu_table.power_play_table;
+	struct smu_11_0_overdrive_table *od_settings = smu->od_settings;
 	PPTable_t *pptable = smu->smu_table.driver_pptable;
 	uint32_t power_limit, od_percent;
 
@@ -1934,7 +1935,8 @@ static int navi10_get_power_limit(struct smu_context *smu)
 	}
 	smu->current_power_limit = power_limit;
 
-	if (smu->od_enabled) {
+	if (smu->od_enabled &&
+	    navi10_od_feature_is_supported(od_settings, SMU_11_0_ODCAP_POWER_LIMIT)) {
 		od_percent = le32_to_cpu(powerplay_table->overdrive_table.max[SMU_11_0_ODSETTING_POWERPERCENTAGE]);
 
 		dev_dbg(smu->adev->dev, "ODSETTING_POWERPERCENTAGE: %d (default: %d)\n", od_percent, power_limit);
-- 
2.27.0

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

  parent reply	other threads:[~2020-06-08 10:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 10:52 [PATCH 1/7] drm/amd/powerplay: drop unnecessary get_pptable_power_limit wrappers Evan Quan
2020-06-08 10:52 ` [PATCH 2/7] drm/amd/powerplay: maximize code sharing around power limit Evan Quan
2020-06-08 10:52 ` [PATCH 3/7] drm/amd/powerplay: simplify the code around retrieving " Evan Quan
2020-06-08 10:52 ` [PATCH 4/7] drm/amd/powerplay: simplify the code around setting " Evan Quan
2020-06-08 10:52 ` [PATCH 5/7] drm/amd/powerplay: drop unused code around " Evan Quan
2020-06-08 10:52 ` [PATCH 6/7] drm/amd/powerplay: correct power limit retrieving based on current power source Evan Quan
2020-06-08 10:52 ` Evan Quan [this message]
2020-06-08 22:22   ` [PATCH 7/7] drm/amd/powerplay: add check for power limit OD support Alex Deucher

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=20200608105234.29864-7-evan.quan@amd.com \
    --to=evan.quan@amd.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