[PATCH 31/48] drm/amdgpu/vcn5.0.1: add set_pg_state callback
Alex Deucher
alexander.deucher at amd.com
Tue Dec 10 22:53:20 UTC 2024
Rework the code as a vcn instance callback.
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c b/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c
index 6ac6049cb9f68..586cdef6f663e 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c
@@ -40,9 +40,8 @@
static void vcn_v5_0_1_set_unified_ring_funcs(struct amdgpu_device *adev);
static void vcn_v5_0_1_set_irq_funcs(struct amdgpu_device *adev);
-static int vcn_v5_0_1_set_powergating_state_inst(struct amdgpu_ip_block *ip_block,
- enum amd_powergating_state state,
- int i);
+static int vcn_v5_0_1_set_pg_state(struct amdgpu_vcn_inst *vinst,
+ enum amd_powergating_state state);
static int vcn_v5_0_1_set_powergating_state(struct amdgpu_ip_block *ip_block,
enum amd_powergating_state state);
static void vcn_v5_0_1_unified_ring_set_wptr(struct amdgpu_ring *ring);
@@ -68,6 +67,8 @@ static int vcn_v5_0_1_early_init(struct amdgpu_ip_block *ip_block)
vcn_v5_0_1_set_irq_funcs(adev);
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
+ adev->vcn.inst[i].set_pg_state = vcn_v5_0_1_set_pg_state;
+
r = amdgpu_vcn_early_init(adev, i);
if (r)
return r;
@@ -1031,15 +1032,12 @@ static int vcn_v5_0_1_set_clockgating_state(struct amdgpu_ip_block *ip_block,
return 0;
}
-static int vcn_v5_0_1_set_powergating_state_inst(struct amdgpu_ip_block *ip_block,
- enum amd_powergating_state state,
- int i)
+static int vcn_v5_0_1_set_pg_state(struct amdgpu_vcn_inst *vinst,
+ enum amd_powergating_state state)
{
- struct amdgpu_device *adev = ip_block->adev;
- struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[i];
int ret = 0;
- if (state == adev->vcn.inst[i].cur_state)
+ if (state == vinst->cur_state)
return 0;
if (state == AMD_PG_STATE_GATE)
@@ -1048,7 +1046,7 @@ static int vcn_v5_0_1_set_powergating_state_inst(struct amdgpu_ip_block *ip_bloc
ret = vcn_v5_0_1_start(vinst);
if (!ret)
- adev->vcn.inst[i].cur_state = state;
+ vinst->cur_state = state;
return ret;
}
@@ -1067,8 +1065,11 @@ static int vcn_v5_0_1_set_powergating_state(struct amdgpu_ip_block *ip_block,
struct amdgpu_device *adev = ip_block->adev;
int ret = 0, i;
- for (i = 0; i < adev->vcn.num_vcn_inst; ++i)
- vcn_v5_0_1_set_powergating_state_inst(ip_block, state, i);
+ for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
+ struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[i];
+
+ ret |= vinst->set_pg_state(vinst, state);
+ }
return ret;
}
--
2.47.1
More information about the amd-gfx
mailing list