drm/amd/amdgpu: Tidy up gfx_v9_0_enable_cp_power_gating()
authorTom St Denis <tom.stdenis@amd.com>
Thu, 31 Aug 2017 13:12:47 +0000 (09:12 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 31 Aug 2017 19:01:02 +0000 (15:01 -0400)
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index 1f95ca8..61b3362 100644 (file)
@@ -1870,16 +1870,11 @@ static void gfx_v9_0_enable_cp_power_gating(struct amdgpu_device *adev,
        uint32_t default_data = 0;
 
        default_data = data = RREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_PG_CNTL));
-
-       if (enable == true) {
-               data &= ~RLC_PG_CNTL__CP_PG_DISABLE_MASK;
-               if(default_data != data)
-                       WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_PG_CNTL), data);
-       } else {
-               data |= RLC_PG_CNTL__CP_PG_DISABLE_MASK;
-               if(default_data != data)
-                       WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_PG_CNTL), data);
-       }
+       data = REG_SET_FIELD(data, RLC_PG_CNTL,
+                            CP_PG_DISABLE,
+                            enable ? 0 : 1);
+       if(default_data != data)
+               WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_PG_CNTL), data);
 }
 
 static void gfx_v9_0_enable_gfx_cg_power_gating(struct amdgpu_device *adev,