alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: amd-gfx@lists.freedesktop.org, alsa-devel@alsa-project.org,
	tiwai@suse.de, lukas@wunner.de
Cc: Alex Deucher <alexander.deucher@amd.com>, Evan Quan <evan.quan@amd.com>
Subject: [alsa-devel] [PATCH 14/20] drm/amdgpu: disentangle runtime pm and vga_switcheroo
Date: Fri, 15 Nov 2019 11:50:32 -0500	[thread overview]
Message-ID: <20191115165038.56646-15-alexander.deucher@amd.com> (raw)
In-Reply-To: <20191115165038.56646-1-alexander.deucher@amd.com>

Originally we only supported runtime pm on PX/HG laptops
so vga_switcheroo and runtime pm are sort of entangled.

Attempt to logically separate them.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 7195ef83ddba..f48c4898e31a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2744,7 +2744,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		       uint32_t flags)
 {
 	int r, i;
-	bool runtime = false;
+	bool boco = false;
 	u32 max_MBps;
 
 	adev->shutdown = false;
@@ -2915,11 +2915,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	vga_client_register(adev->pdev, adev, NULL, amdgpu_device_vga_set_decode);
 
 	if (amdgpu_device_supports_boco(ddev))
-		runtime = true;
-	if (!pci_is_thunderbolt_attached(adev->pdev))
+		boco = true;
+	if (amdgpu_has_atpx() &&
+	    (amdgpu_is_atpx_hybrid() ||
+	     amdgpu_has_atpx_dgpu_power_cntl()) &&
+	    !pci_is_thunderbolt_attached(adev->pdev))
 		vga_switcheroo_register_client(adev->pdev,
-					       &amdgpu_switcheroo_ops, runtime);
-	if (runtime)
+					       &amdgpu_switcheroo_ops, boco);
+	if (boco)
 		vga_switcheroo_init_domain_pm_ops(adev->dev, &adev->vga_pm_domain);
 
 	if (amdgpu_emu_mode == 1) {
@@ -3103,7 +3106,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 
 failed:
 	amdgpu_vf_error_trans_all(adev);
-	if (runtime)
+	if (boco)
 		vga_switcheroo_fini_domain_pm_ops(adev->dev);
 
 	return r;
@@ -3153,9 +3156,12 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 
 	kfree(adev->bios);
 	adev->bios = NULL;
-	if (!pci_is_thunderbolt_attached(adev->pdev))
+	if (amdgpu_has_atpx() &&
+	    (amdgpu_is_atpx_hybrid() ||
+	     amdgpu_has_atpx_dgpu_power_cntl()) &&
+	    !pci_is_thunderbolt_attached(adev->pdev))
 		vga_switcheroo_unregister_client(adev->pdev);
-	if (adev->flags & AMD_IS_PX)
+	if (amdgpu_device_supports_boco(adev->ddev))
 		vga_switcheroo_fini_domain_pm_ops(adev->dev);
 	vga_client_register(adev->pdev, NULL, NULL, NULL);
 	if (adev->rio_mem)
-- 
2.23.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-11-15 17:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 16:50 [alsa-devel] [PATCH 00/20] Enable BACO for power savings (v3) Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 01/20] drm/amdgpu: add asic callback for BACO support Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 02/20] drm/amdgpu: add supports_baco callback for soc15 asics. (v2) Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 03/20] drm/amdgpu: add supports_baco callback for SI asics Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 04/20] drm/amdgpu: add supports_baco callback for CIK asics Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 05/20] drm/amdgpu: add supports_baco callback for VI asics Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 06/20] drm/amdgpu: add supports_baco callback for NV asics Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 07/20] drm/amdgpu: add a amdgpu_device_supports_baco helper Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 08/20] drm/amdgpu: rename amdgpu_device_is_px to amdgpu_device_supports_boco (v2) Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 09/20] drm/amdgpu: add additional boco checks to runtime suspend/resume (v2) Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 10/20] drm/amdgpu: split swSMU baco_reset into enter and exit Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 11/20] drm/amdgpu: add helpers for baco entry " Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 12/20] drm/amdgpu: add baco support to runtime suspend/resume Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 13/20] drm/amdgpu: start to disentangle boco from runtime pm Alex Deucher
2019-11-15 16:50 ` Alex Deucher [this message]
2019-11-15 16:50 ` [alsa-devel] [PATCH 15/20] drm/amdgpu: enable runtime pm on BACO capable boards if runpm=1 Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 16/20] drm/amdgpu/runpm: enable runpm on baco capable VI+ asics (v2) Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 17/20] ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 18/20] ALSA: hda/hdmi - Add new pci ids for AMD GPU display audio Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 19/20] ALSA: hda/hdmi - enable runtime pm for newer AMD " Alex Deucher
2019-11-15 16:50 ` [alsa-devel] [PATCH 20/20] ALSA: hda/hdmi - enable automatic runtime pm for AMD HDMI codecs by default 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=20191115165038.56646-15-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=evan.quan@amd.com \
    --cc=lukas@wunner.de \
    --cc=tiwai@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).