summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorAsad Kamal <asad.kamal@amd.com>2024-07-04 12:08:33 +0800
committerAlex Deucher <alexander.deucher@amd.com>2024-09-26 17:06:16 -0400
commitdc443aa4ab7df2d660092be39c790d36ea5fc33e (patch)
tree28316b90800afff0ba08a8331b25f5421e895cb7 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent92c9b3e8e4ca85209e06594c76195a58e5d11be9 (diff)
downloadlinux-dc443aa4ab7df2d660092be39c790d36ea5fc33e.tar.gz
linux-dc443aa4ab7df2d660092be39c790d36ea5fc33e.tar.bz2
linux-dc443aa4ab7df2d660092be39c790d36ea5fc33e.zip
drm/amd/amdgpu: Add helper to get ip block valid
Add helper function to check if ip block is enabled Signed-off-by: Asad Kamal <asad.kamal@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index c2394c8b4d6b..193d1655bd8c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2194,6 +2194,28 @@ bool amdgpu_device_ip_is_idle(struct amdgpu_device *adev,
}
/**
+ * amdgpu_device_ip_is_valid - is the hardware IP enabled
+ *
+ * @adev: amdgpu_device pointer
+ * @block_type: Type of hardware IP (SMU, GFX, UVD, etc.)
+ *
+ * Check if the hardware IP is enable or not.
+ * Returns true if it the IP is enable, false if not.
+ */
+bool amdgpu_device_ip_is_valid(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].version->type == block_type)
+ return adev->ip_blocks[i].status.valid;
+ }
+ return false;
+
+}
+
+/**
* amdgpu_device_ip_get_ip_block - get a hw IP pointer
*
* @adev: amdgpu_device pointer