summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
diff options
context:
space:
mode:
authorBoyuan Zhang <boyuan.zhang@amd.com>2024-10-02 23:25:45 -0400
committerAlex Deucher <alexander.deucher@amd.com>2024-12-10 10:26:47 -0500
commit697cb5cc2549c5aa8da541ec5d815500edc35f88 (patch)
tree197febc6ba4c52d7e83eb90a5547c1387442ec13 /drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
parent15df736afe009856a40baf93df3fd10f4a32a88b (diff)
drm/amd/pm: add inst to set_powergating_by_smu
Add an instance parameter to set_powergating_by_smu() function, and re-write all amd_pm functions accordingly. Then use the instance to call smu_dpm_set_vcn_enable(). v2: remove duplicated functions. remove for-loop in smu_dpm_set_power_gate(), and temporarily move it to to amdgpu_dpm_set_powergating_by_smu(), in order to keep the exact same logic as before, until further separation in next patch. v3: add instance number in error message. Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 2fd7909dac18..dc372d39cb8d 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -358,11 +358,11 @@ static int smu_set_mall_enable(struct smu_context *smu)
*/
static int smu_dpm_set_power_gate(void *handle,
uint32_t block_type,
- bool gate)
+ bool gate,
+ int inst)
{
struct smu_context *smu = handle;
- struct amdgpu_device *adev = smu->adev;
- int i, ret = 0;
+ int ret = 0;
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled) {
dev_WARN(smu->adev->dev,
@@ -378,12 +378,10 @@ static int smu_dpm_set_power_gate(void *handle,
*/
case AMD_IP_BLOCK_TYPE_UVD:
case AMD_IP_BLOCK_TYPE_VCN:
- for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
- ret = smu_dpm_set_vcn_enable(smu, !gate, i);
- if (ret)
- dev_err(smu->adev->dev, "Failed to power %s VCN instance %d!\n",
- gate ? "gate" : "ungate", i);
- }
+ ret = smu_dpm_set_vcn_enable(smu, !gate, inst);
+ if (ret)
+ dev_err(smu->adev->dev, "Failed to power %s VCN instance %d!\n",
+ gate ? "gate" : "ungate", inst);
break;
case AMD_IP_BLOCK_TYPE_GFX:
ret = smu_gfx_off_control(smu, gate);