]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/amdgpu: add IP helpers for wait_for_idle and is_idle
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 23 Jun 2016 15:41:04 +0000 (11:41 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 19:02:02 +0000 (15:02 -0400)
Helpers to to call the IP functions for the selected IP.

Reviewed-by: Chunming zhou <david1.zhou@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

index 0068955ae37f732601ba164d5e359d840f72fea2..7df1f486f1fbf766a80bd2e04ca8867c2fc8e57b 100644 (file)
@@ -187,6 +187,10 @@ 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);
+int amdgpu_wait_for_idle(struct amdgpu_device *adev,
+                        enum amd_ip_block_type block_type);
+bool amdgpu_is_idle(struct amdgpu_device *adev,
+                   enum amd_ip_block_type block_type);
 
 struct amdgpu_ip_block_version {
        enum amd_ip_block_type type;
index 9757a85e78d6a790ec359ed4226dc34cb37da18a..c281cfd65337bd0ce81249de41f72ce5bde64860 100644 (file)
@@ -1102,6 +1102,36 @@ int amdgpu_set_powergating_state(struct amdgpu_device *adev,
        return r;
 }
 
+int amdgpu_wait_for_idle(struct amdgpu_device *adev,
+                        enum amd_ip_block_type block_type)
+{
+       int i, r;
+
+       for (i = 0; i < adev->num_ip_blocks; i++) {
+               if (adev->ip_blocks[i].type == block_type) {
+                       r = adev->ip_blocks[i].funcs->wait_for_idle((void *)adev);
+                       if (r)
+                               return r;
+                       break;
+               }
+       }
+       return 0;
+
+}
+
+bool amdgpu_is_idle(struct amdgpu_device *adev,
+                   enum amd_ip_block_type block_type)
+{
+       int i;
+
+       for (i = 0; i < adev->num_ip_blocks; i++) {
+               if (adev->ip_blocks[i].type == block_type)
+                       return adev->ip_blocks[i].funcs->is_idle((void *)adev);
+       }
+       return true;
+
+}
+
 const struct amdgpu_ip_block_version * amdgpu_get_ip_block(
                                        struct amdgpu_device *adev,
                                        enum amd_ip_block_type type)