aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2017-01-05 07:48:06 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-01-27 11:13:09 -0500
commitabd2c2fe1212698ed326d5746e487abecb2ed325 (patch)
tree1c4cc02c0fb456a86c5758a58557f67ae7f5779e /drivers/gpu
parent41c360f6a6ccd477481a3309608e9b3388bdd83d (diff)
drm/amdgpu: add get clockgating_state method for vi common
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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vi.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index 0e1b2fd5cf38..45b7edd2c969 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -1369,6 +1369,32 @@ static int vi_common_set_powergating_state(void *handle,
1369 return 0; 1369 return 0;
1370} 1370}
1371 1371
1372static void vi_common_get_clockgating_state(void *handle, u32 *flags)
1373{
1374 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1375 int data;
1376
1377 /* AMD_CG_SUPPORT_BIF_LS */
1378 data = RREG32_PCIE(ixPCIE_CNTL2);
1379 if (data & PCIE_CNTL2__SLV_MEM_LS_EN_MASK)
1380 *flags |= AMD_CG_SUPPORT_BIF_LS;
1381
1382 /* AMD_CG_SUPPORT_HDP_LS */
1383 data = RREG32(mmHDP_MEM_POWER_LS);
1384 if (data & HDP_MEM_POWER_LS__LS_ENABLE_MASK)
1385 *flags |= AMD_CG_SUPPORT_HDP_LS;
1386
1387 /* AMD_CG_SUPPORT_HDP_MGCG */
1388 data = RREG32(mmHDP_HOST_PATH_CNTL);
1389 if (!(data & HDP_HOST_PATH_CNTL__CLOCK_GATING_DIS_MASK))
1390 *flags |= AMD_CG_SUPPORT_HDP_MGCG;
1391
1392 /* AMD_CG_SUPPORT_ROM_MGCG */
1393 data = RREG32_SMC(ixCGTT_ROM_CLK_CTRL0);
1394 if (!(data & CGTT_ROM_CLK_CTRL0__SOFT_OVERRIDE0_MASK))
1395 *flags |= AMD_CG_SUPPORT_ROM_MGCG;
1396}
1397
1372static const struct amd_ip_funcs vi_common_ip_funcs = { 1398static const struct amd_ip_funcs vi_common_ip_funcs = {
1373 .name = "vi_common", 1399 .name = "vi_common",
1374 .early_init = vi_common_early_init, 1400 .early_init = vi_common_early_init,
@@ -1384,6 +1410,7 @@ static const struct amd_ip_funcs vi_common_ip_funcs = {
1384 .soft_reset = vi_common_soft_reset, 1410 .soft_reset = vi_common_soft_reset,
1385 .set_clockgating_state = vi_common_set_clockgating_state, 1411 .set_clockgating_state = vi_common_set_clockgating_state,
1386 .set_powergating_state = vi_common_set_powergating_state, 1412 .set_powergating_state = vi_common_set_powergating_state,
1413 .get_clockgating_state = vi_common_get_clockgating_state,
1387}; 1414};
1388 1415
1389static const struct amdgpu_ip_block_version vi_common_ip_block = 1416static const struct amdgpu_ip_block_version vi_common_ip_block =