All of 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>, mcoffin13@gmail.com
Subject: [PATCH 5/8] drm/amdgpu/swSMU: set AC/DC mode based on the current system state
Date: Fri, 20 Mar 2020 14:27:24 -0400	[thread overview]
Message-ID: <20200320182727.3805-5-alexander.deucher@amd.com> (raw)
In-Reply-To: <20200320182727.3805-1-alexander.deucher@amd.com>

Check of the pointer exists and we are actually on AC power.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 2cfb911ab370..54d156bbc0f3 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1155,15 +1155,15 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
 			}
 		}
 
-		if (adev->asic_type >= CHIP_NAVI10 &&
-		    adev->asic_type <= CHIP_NAVI12) {
+		if (smu->ppt_funcs->set_power_source) {
 			/*
 			 * For Navi1X, manually switch it to AC mode as PMFW
 			 * may boot it with DC mode.
-			 * TODO: should check whether we are indeed under AC
-			 * mode before doing this.
 			 */
-			ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
+			if (adev->pm.ac_power)
+				ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
+			else
+				ret = smu_set_power_source(smu, SMU_POWER_SOURCE_DC);
 			if (ret) {
 				pr_err("Failed to switch to AC mode!\n");
 				return ret;
-- 
2.25.1

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

  parent reply	other threads:[~2020-03-20 18:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
2020-03-20 18:27 ` [PATCH 2/8] drm/amdgpu/smu11: add a helper to set the " Alex Deucher
2020-03-20 18:27 ` [PATCH 3/8] drm/amdgpu/swSMU: use the smu11 power source helper for navi1x Alex Deucher
2020-03-20 18:27 ` [PATCH 4/8] drm/amdgpu/swSMU: correct the bootup power source for Navi1X Alex Deucher
2020-03-20 18:27 ` Alex Deucher [this message]
2020-03-20 18:27 ` [PATCH 6/8] drm/amdgpu/swSMU: handle DC controlled by GPIO for navi1x Alex Deucher
2020-03-20 18:27 ` [PATCH 7/8] drm/amdgpu/swSMU: handle manual AC/DC notifications Alex Deucher
2020-03-20 18:27 ` [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts Alex Deucher
2020-03-23  3:54   ` Quan, Evan
2020-03-23 14:46     ` Alex Deucher
2020-03-24  2:53       ` 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=20200320182727.3805-5-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=mcoffin13@gmail.com \
    /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.