]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/amdgpu: expose VCE 4.0 powergate interface
authorEvan Quan <evan.quan@amd.com>
Thu, 25 Apr 2019 07:35:17 +0000 (15:35 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 29 Apr 2019 19:59:50 +0000 (14:59 -0500)
SMU will use this interface to power down the VCE engine.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

index aadc3e66ebd7c1164c359f8e13afb12deec4c46d..f3f5938430d4fdb9d393bf73cc22dd8b1e419412 100644 (file)
@@ -382,6 +382,7 @@ static int vce_v4_0_start(struct amdgpu_device *adev)
 static int vce_v4_0_stop(struct amdgpu_device *adev)
 {
 
+       /* Disable VCPU */
        WREG32_P(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CNTL), 0, ~0x200001);
 
        /* hold on ECPU */
@@ -389,8 +390,8 @@ static int vce_v4_0_stop(struct amdgpu_device *adev)
                        VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK,
                        ~VCE_SOFT_RESET__ECPU_SOFT_RESET_MASK);
 
-       /* clear BUSY flag */
-       WREG32_P(SOC15_REG_OFFSET(VCE, 0, mmVCE_STATUS), 0, ~VCE_STATUS__JOB_BUSY_MASK);
+       /* clear VCE_STATUS */
+       WREG32(SOC15_REG_OFFSET(VCE, 0, mmVCE_STATUS), 0);
 
        /* Set Clock-Gating off */
        /* if (adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG)
@@ -922,6 +923,7 @@ static int vce_v4_0_set_clockgating_state(void *handle,
 
        return 0;
 }
+#endif
 
 static int vce_v4_0_set_powergating_state(void *handle,
                                          enum amd_powergating_state state)
@@ -935,16 +937,11 @@ static int vce_v4_0_set_powergating_state(void *handle,
         */
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_VCE))
-               return 0;
-
        if (state == AMD_PG_STATE_GATE)
-               /* XXX do we need a vce_v4_0_stop()? */
-               return 0;
+               return vce_v4_0_stop(adev);
        else
                return vce_v4_0_start(adev);
 }
-#endif
 
 static void vce_v4_0_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_job *job,
                                        struct amdgpu_ib *ib, uint32_t flags)
@@ -1059,7 +1056,7 @@ const struct amd_ip_funcs vce_v4_0_ip_funcs = {
        .soft_reset = NULL /* vce_v4_0_soft_reset */,
        .post_soft_reset = NULL /* vce_v4_0_post_soft_reset */,
        .set_clockgating_state = vce_v4_0_set_clockgating_state,
-       .set_powergating_state = NULL /* vce_v4_0_set_powergating_state */,
+       .set_powergating_state = vce_v4_0_set_powergating_state,
 };
 
 static const struct amdgpu_ring_funcs vce_v4_0_ring_vm_funcs = {