mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
drm/amdgpu/vcn1.0: add set_pg_state callback
Rework the code as a vcn instance callback. Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
55945f08d9
commit
c5ed3655cd
|
|
@ -85,6 +85,8 @@ static int vcn_v1_0_stop(struct amdgpu_vcn_inst *vinst);
|
|||
static void vcn_v1_0_set_dec_ring_funcs(struct amdgpu_device *adev);
|
||||
static void vcn_v1_0_set_enc_ring_funcs(struct amdgpu_device *adev);
|
||||
static void vcn_v1_0_set_irq_funcs(struct amdgpu_device *adev);
|
||||
static int vcn_v1_0_set_pg_state(struct amdgpu_vcn_inst *vinst,
|
||||
enum amd_powergating_state state);
|
||||
static int vcn_v1_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state);
|
||||
static int vcn_v1_0_pause_dpg_mode(struct amdgpu_vcn_inst *vinst,
|
||||
|
|
@ -106,6 +108,7 @@ static int vcn_v1_0_early_init(struct amdgpu_ip_block *ip_block)
|
|||
struct amdgpu_device *adev = ip_block->adev;
|
||||
|
||||
adev->vcn.inst[0].num_enc_rings = 2;
|
||||
adev->vcn.inst[0].set_pg_state = vcn_v1_0_set_pg_state;
|
||||
|
||||
vcn_v1_0_set_dec_ring_funcs(adev);
|
||||
vcn_v1_0_set_enc_ring_funcs(adev);
|
||||
|
|
@ -276,13 +279,14 @@ static int vcn_v1_0_hw_init(struct amdgpu_ip_block *ip_block)
|
|||
static int vcn_v1_0_hw_fini(struct amdgpu_ip_block *ip_block)
|
||||
{
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
struct amdgpu_vcn_inst *vinst = adev->vcn.inst;
|
||||
|
||||
cancel_delayed_work_sync(&adev->vcn.inst[0].idle_work);
|
||||
cancel_delayed_work_sync(&vinst->idle_work);
|
||||
|
||||
if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) ||
|
||||
(adev->vcn.inst[0].cur_state != AMD_PG_STATE_GATE &&
|
||||
RREG32_SOC15(VCN, 0, mmUVD_STATUS))) {
|
||||
vcn_v1_0_set_powergating_state(ip_block, AMD_PG_STATE_GATE);
|
||||
(vinst->cur_state != AMD_PG_STATE_GATE &&
|
||||
RREG32_SOC15(VCN, 0, mmUVD_STATUS))) {
|
||||
vinst->set_pg_state(vinst, AMD_PG_STATE_GATE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -1818,8 +1822,8 @@ static void vcn_v1_0_dec_ring_insert_nop(struct amdgpu_ring *ring, uint32_t coun
|
|||
}
|
||||
}
|
||||
|
||||
static int vcn_v1_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
static int vcn_v1_0_set_pg_state(struct amdgpu_vcn_inst *vinst,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
/* This doesn't actually powergate the VCN block.
|
||||
* That's done in the dpm code via the SMC. This
|
||||
|
|
@ -1829,10 +1833,8 @@ static int vcn_v1_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
|||
* the smc and the hw blocks
|
||||
*/
|
||||
int ret;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
struct amdgpu_vcn_inst *vinst = adev->vcn.inst;
|
||||
|
||||
if (state == adev->vcn.inst[0].cur_state)
|
||||
if (state == vinst->cur_state)
|
||||
return 0;
|
||||
|
||||
if (state == AMD_PG_STATE_GATE)
|
||||
|
|
@ -1841,10 +1843,20 @@ static int vcn_v1_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
|||
ret = vcn_v1_0_start(vinst);
|
||||
|
||||
if (!ret)
|
||||
adev->vcn.inst[0].cur_state = state;
|
||||
vinst->cur_state = state;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vcn_v1_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
struct amdgpu_vcn_inst *vinst = adev->vcn.inst;
|
||||
|
||||
return vinst->set_pg_state(vinst, state);
|
||||
}
|
||||
|
||||
static void vcn_v1_0_idle_work_handler(struct work_struct *work)
|
||||
{
|
||||
struct amdgpu_vcn_inst *vcn_inst =
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user