mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm/amdgpu: add IP helpers for wait_for_idle and is_idle
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>
This commit is contained in:
		
							parent
							
								
									bfa833558c
								
							
						
					
					
						commit
						5dbbb60ba6
					
				
					 2 changed files with 34 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue