drm/amdgpu: add get clockgating_state method for sdma v3
authorHuang Rui <ray.huang@amd.com>
Thu, 5 Jan 2017 12:18:43 +0000 (20:18 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 27 Jan 2017 16:13:09 +0000 (11:13 -0500)
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c

index 034ace79ed492951d1ed06b9dc1543419b1948bf..4bb8bec13c47a9853f6894a0e3de2b4765f62770 100644 (file)
@@ -1533,6 +1533,22 @@ static int sdma_v3_0_set_powergating_state(void *handle,
        return 0;
 }
 
+static void sdma_v3_0_get_clockgating_state(void *handle, u32 *flags)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       int data;
+
+       /* AMD_CG_SUPPORT_SDMA_MGCG */
+       data = RREG32(mmSDMA0_CLK_CTRL + sdma_offsets[0]);
+       if (!(data & SDMA0_CLK_CTRL__SOFT_OVERRIDE0_MASK))
+               *flags |= AMD_CG_SUPPORT_SDMA_MGCG;
+
+       /* AMD_CG_SUPPORT_SDMA_LS */
+       data = RREG32(mmSDMA0_POWER_CNTL + sdma_offsets[0]);
+       if (data & SDMA0_POWER_CNTL__MEM_POWER_OVERRIDE_MASK)
+               *flags |= AMD_CG_SUPPORT_SDMA_LS;
+}
+
 static const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
        .name = "sdma_v3_0",
        .early_init = sdma_v3_0_early_init,
@@ -1551,6 +1567,7 @@ static const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
        .soft_reset = sdma_v3_0_soft_reset,
        .set_clockgating_state = sdma_v3_0_set_clockgating_state,
        .set_powergating_state = sdma_v3_0_set_powergating_state,
+       .get_clockgating_state = sdma_v3_0_get_clockgating_state,
 };
 
 static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {