All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs
Date: Fri, 21 Jan 2022 15:22:19 -0500	[thread overview]
Message-ID: <20220121202220.5557-4-alexander.deucher@amd.com> (raw)
In-Reply-To: <20220121202220.5557-1-alexander.deucher@amd.com>

Extend secondary function handling for runtime pm beyond audio
to USB and UCSI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 30 +++++++++++++++----------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 89c3578bc818..119a5798623e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1968,19 +1968,25 @@ static bool amdgpu_is_fw_framebuffer(resource_size_t base,
 	return found;
 }
 
-static void amdgpu_get_audio_func(struct amdgpu_device *adev)
+static void amdgpu_get_secondary_funcs(struct amdgpu_device *adev)
 {
 	struct pci_dev *p = NULL;
+	int i;
 
-	p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
-			adev->pdev->bus->number, 1);
-	if (p) {
-		pm_runtime_get_sync(&p->dev);
-
-		pm_runtime_mark_last_busy(&p->dev);
-		pm_runtime_put_autosuspend(&p->dev);
-
-		pci_dev_put(p);
+	/* 0 - GPU
+	 * 1 - audio
+	 * 2 - USB
+	 * 3 - UCSI
+	 */
+	for (i = 1; i < 4; i++) {
+		p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
+						adev->pdev->bus->number, i);
+		if (p) {
+			pm_runtime_get_sync(&p->dev);
+			pm_runtime_mark_last_busy(&p->dev);
+			pm_runtime_put_autosuspend(&p->dev);
+			pci_dev_put(p);
+		}
 	}
 }
 
@@ -2148,14 +2154,14 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 		 * be no PMFW-aware D-state transition(D0->D3) on runpm
 		 * suspend. Thus the BACO will be not correctly kicked in.
 		 *
-		 * Via amdgpu_get_audio_func(), the audio dev is put
+		 * Via amdgpu_get_secondary_funcs(), the audio dev is put
 		 * into D0 state. Then there will be a PMFW-aware D-state
 		 * transition(D0->D3) on runpm suspend.
 		 */
 		if (amdgpu_device_supports_baco(ddev) &&
 		    !(adev->flags & AMD_IS_APU) &&
 		    (adev->asic_type >= CHIP_NAVI10))
-			amdgpu_get_audio_func(adev);
+			amdgpu_get_secondary_funcs(adev);
 	}
 
 	return 0;
-- 
2.34.1


  parent reply	other threads:[~2022-01-21 20:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 20:22 [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Alex Deucher
2022-01-21 20:22 ` [PATCH 2/5] drm/amdgpu: move PX checking into amdgpu_device_ip_early_init Alex Deucher
2022-01-21 20:22 ` [PATCH 3/5] drm/amdgpu: move runtime pm init after drm and fbdev init Alex Deucher
2022-01-21 20:22 ` Alex Deucher [this message]
2022-01-24  3:50   ` [PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs Quan, Evan
2022-01-21 20:22 ` [PATCH 5/5] drm/amdgpu: convert amdgpu_display_supported_domains() to IP versions Alex Deucher
2022-01-24  5:42 ` [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Liu, Aaron

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=20220121202220.5557-4-alexander.deucher@amd.com \
    --to=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 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.