diff options
author | Lijo Lazar <lijo.lazar@amd.com> | 2023-09-29 10:51:02 +0530 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2023-11-29 16:23:46 -0500 |
commit | 12c2d3b5f5bc4ecb470a4bc06424914c145e8c03 (patch) | |
tree | 31cbbbb564a0d9bb1651fd9138cde6483ef70405 /drivers/gpu/drm/amd/pm/amdgpu_dpm.c | |
parent | 534eee82356c220649dc9c2ea90099f39fb1cb62 (diff) | |
download | lwn-12c2d3b5f5bc4ecb470a4bc06424914c145e8c03.tar.gz lwn-12c2d3b5f5bc4ecb470a4bc06424914c145e8c03.zip |
drm/amd/pm: Add support to fetch pm metrics sample
Add API support to fetch a snapshot of power management metrics from PMFW.
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/amdgpu_dpm.c')
-rw-r--r-- | drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c index 1ae3b81548fa..4717884a2bc4 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c @@ -1299,6 +1299,23 @@ int amdgpu_dpm_get_gpu_metrics(struct amdgpu_device *adev, void **table) return ret; } +ssize_t amdgpu_dpm_get_pm_metrics(struct amdgpu_device *adev, void *pm_metrics, + size_t size) +{ + const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; + int ret = 0; + + if (!pp_funcs->get_pm_metrics) + return -EOPNOTSUPP; + + mutex_lock(&adev->pm.mutex); + ret = pp_funcs->get_pm_metrics(adev->powerplay.pp_handle, pm_metrics, + size); + mutex_unlock(&adev->pm.mutex); + + return ret; +} + int amdgpu_dpm_get_fan_control_mode(struct amdgpu_device *adev, uint32_t *fan_mode) { |