From: James Zhu <[email protected]>

Enable vcn doorbell for vcn4.0.3.

Signed-off-by: James Zhu <[email protected]>
Reviewed-by: Leo Liu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c 
b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
index 98bff162f453..4418c9f05ec4 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
@@ -109,7 +109,8 @@ static int vcn_v4_0_3_sw_init(void *handle)
                return r;
 
        ring = &adev->vcn.inst->ring_dec;
-       ring->use_doorbell = false;
+       ring->use_doorbell = true;
+       ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 5;
        ring->vm_hub = AMDGPU_MMHUB0(0);
        sprintf(ring->name, "vcn_dec");
        r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst->irq, 0,
@@ -174,6 +175,13 @@ static int vcn_v4_0_3_hw_init(void *handle)
        struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
        int r;
 
+       adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
+                               ring->doorbell_index, ring->me);
+       if (ring->use_doorbell)
+               WREG32_SOC15(VCN, ring->me, regVCN_RB4_DB_CTRL,
+                       ring->doorbell_index << VCN_RB4_DB_CTRL__OFFSET__SHIFT |
+                       VCN_RB4_DB_CTRL__EN_MASK);
+
        r = amdgpu_ring_test_helper(ring);
 
        if (!r)
-- 
2.39.2

Reply via email to