drm/amdgpu: introduce an interface to get clock gating status dynamically
authorHuang Rui <ray.huang@amd.com>
Thu, 5 Jan 2017 10:44:41 +0000 (18:44 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 27 Jan 2017 16:13:06 +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/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
drivers/gpu/drm/amd/include/amd_shared.h

index 842e1d30074564163d82a7def727a793be320ea6..c2372902f7226d50582d5cc04a81484f9b40dba9 100644 (file)
@@ -194,6 +194,7 @@ int amdgpu_set_clockgating_state(struct amdgpu_device *adev,
 int amdgpu_set_powergating_state(struct amdgpu_device *adev,
                                  enum amd_ip_block_type block_type,
                                  enum amd_powergating_state state);
+void amdgpu_get_clockgating_state(struct amdgpu_device *adev, u32 *flags);
 int amdgpu_wait_for_idle(struct amdgpu_device *adev,
                         enum amd_ip_block_type block_type);
 bool amdgpu_is_idle(struct amdgpu_device *adev,
index eb66cc526950e613eb5ee13c8cd492ee4419e1ef..85b36edbdd61536ebff6cf731841abd3758e2e39 100644 (file)
@@ -1131,6 +1131,18 @@ int amdgpu_set_powergating_state(struct amdgpu_device *adev,
        return r;
 }
 
+void amdgpu_get_clockgating_state(struct amdgpu_device *adev, u32 *flags)
+{
+       int i;
+
+       for (i = 0; i < adev->num_ip_blocks; i++) {
+               if (!adev->ip_blocks[i].status.valid)
+                       continue;
+               if (adev->ip_blocks[i].version->funcs->get_clockgating_state)
+                       adev->ip_blocks[i].version->funcs->get_clockgating_state((void *)adev, flags);
+       }
+}
+
 int amdgpu_wait_for_idle(struct amdgpu_device *adev,
                         enum amd_ip_block_type block_type)
 {
index 0345fbbfff4e6f72236c2b4c1ef8f1c9640da145..c63e5d3a902cf59fdbe822f3238dfa57f3e2a5d0 100644 (file)
@@ -1365,6 +1365,10 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
        struct drm_device *dev = node->minor->dev;
        struct amdgpu_device *adev = dev->dev_private;
        struct drm_device *ddev = adev->ddev;
+       u32 flags = 0;
+
+       amdgpu_get_clockgating_state(adev, &flags);
+       seq_printf(m, "Clock Gating Flags Mask: 0x%x\n", flags);
 
        if (!adev->pm.dpm_enabled) {
                seq_printf(m, "dpm not enabled\n");
index 92138a9f6f933d4177c6fd359975e2d063ab5bbf..5fffe6f72640e50a69ddd4b3ba13545e9f86b068 100644 (file)
@@ -214,6 +214,8 @@ struct amd_ip_funcs {
        /* enable/disable pg for the IP block */
        int (*set_powergating_state)(void *handle,
                                     enum amd_powergating_state state);
+       /* get current clockgating status */
+       void (*get_clockgating_state)(void *handle, u32 *flags);
 };
 
 #endif /* __AMD_SHARED_H__ */