aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2017-01-05 05:44:41 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-01-27 11:13:06 -0500
commit6cb2d4e4f3b1f0857c720ab8c41a764f18995377 (patch)
treedd43467632c3b7866232440822dda2eb7c363328
parentc8394f38fa2362385fd34f7034a2276b458c640e (diff)
drm/amdgpu: introduce an interface to get clock gating status dynamically
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>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c12
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c4
-rw-r--r--drivers/gpu/drm/amd/include/amd_shared.h2
4 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 842e1d300745..c2372902f722 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -194,6 +194,7 @@ int amdgpu_set_clockgating_state(struct amdgpu_device *adev,
194int amdgpu_set_powergating_state(struct amdgpu_device *adev, 194int amdgpu_set_powergating_state(struct amdgpu_device *adev,
195 enum amd_ip_block_type block_type, 195 enum amd_ip_block_type block_type,
196 enum amd_powergating_state state); 196 enum amd_powergating_state state);
197void amdgpu_get_clockgating_state(struct amdgpu_device *adev, u32 *flags);
197int amdgpu_wait_for_idle(struct amdgpu_device *adev, 198int amdgpu_wait_for_idle(struct amdgpu_device *adev,
198 enum amd_ip_block_type block_type); 199 enum amd_ip_block_type block_type);
199bool amdgpu_is_idle(struct amdgpu_device *adev, 200bool amdgpu_is_idle(struct amdgpu_device *adev,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index eb66cc526950..85b36edbdd61 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1131,6 +1131,18 @@ int amdgpu_set_powergating_state(struct amdgpu_device *adev,
1131 return r; 1131 return r;
1132} 1132}
1133 1133
1134void amdgpu_get_clockgating_state(struct amdgpu_device *adev, u32 *flags)
1135{
1136 int i;
1137
1138 for (i = 0; i < adev->num_ip_blocks; i++) {
1139 if (!adev->ip_blocks[i].status.valid)
1140 continue;
1141 if (adev->ip_blocks[i].version->funcs->get_clockgating_state)
1142 adev->ip_blocks[i].version->funcs->get_clockgating_state((void *)adev, flags);
1143 }
1144}
1145
1134int amdgpu_wait_for_idle(struct amdgpu_device *adev, 1146int amdgpu_wait_for_idle(struct amdgpu_device *adev,
1135 enum amd_ip_block_type block_type) 1147 enum amd_ip_block_type block_type)
1136{ 1148{
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 0345fbbfff4e..c63e5d3a902c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1365,6 +1365,10 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
1365 struct drm_device *dev = node->minor->dev; 1365 struct drm_device *dev = node->minor->dev;
1366 struct amdgpu_device *adev = dev->dev_private; 1366 struct amdgpu_device *adev = dev->dev_private;
1367 struct drm_device *ddev = adev->ddev; 1367 struct drm_device *ddev = adev->ddev;
1368 u32 flags = 0;
1369
1370 amdgpu_get_clockgating_state(adev, &flags);
1371 seq_printf(m, "Clock Gating Flags Mask: 0x%x\n", flags);
1368 1372
1369 if (!adev->pm.dpm_enabled) { 1373 if (!adev->pm.dpm_enabled) {
1370 seq_printf(m, "dpm not enabled\n"); 1374 seq_printf(m, "dpm not enabled\n");
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index 92138a9f6f93..5fffe6f72640 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -214,6 +214,8 @@ struct amd_ip_funcs {
214 /* enable/disable pg for the IP block */ 214 /* enable/disable pg for the IP block */
215 int (*set_powergating_state)(void *handle, 215 int (*set_powergating_state)(void *handle,
216 enum amd_powergating_state state); 216 enum amd_powergating_state state);
217 /* get current clockgating status */
218 void (*get_clockgating_state)(void *handle, u32 *flags);
217}; 219};
218 220
219#endif /* __AMD_SHARED_H__ */ 221#endif /* __AMD_SHARED_H__ */