summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2022-01-11 10:02:19 +0300
committerAlex Deucher <alexander.deucher@amd.com>2022-01-15 01:51:15 +0300
commit685fae24d94fd615b7058832fcb437eb588f4860 (patch)
tree4228a37a53ab54831d7f6c88238ab12a11ec9753 /drivers/gpu/drm/amd/pm/amdgpu_dpm.c
parent54c73b51df2958f564b144ce86f15a85e227db90 (diff)
downloadlinux-685fae24d94fd615b7058832fcb437eb588f4860.tar.xz
drm/amd/pm: correct the checks for fan attributes support
On functionality unsupported, -EOPNOTSUPP will be returned. And we rely on that to determine the fan attributes support. Fixes: 79c65f3fcbb128 ("drm/amd/pm: do not expose power implementation details to amdgpu_pm.c") Signed-off-by: Evan Quan <evan.quan@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/pm/amdgpu_dpm.c')
-rw-r--r--drivers/gpu/drm/amd/pm/amdgpu_dpm.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
index 728b6e10f302..f0daa66f5b3d 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
@@ -1087,15 +1087,17 @@ int amdgpu_dpm_get_fan_control_mode(struct amdgpu_device *adev,
uint32_t *fan_mode)
{
const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
+ int ret = 0;
if (!pp_funcs->get_fan_control_mode)
return -EOPNOTSUPP;
mutex_lock(&adev->pm.mutex);
- *fan_mode = pp_funcs->get_fan_control_mode(adev->powerplay.pp_handle);
+ ret = pp_funcs->get_fan_control_mode(adev->powerplay.pp_handle,
+ fan_mode);
mutex_unlock(&adev->pm.mutex);
- return 0;
+ return ret;
}
int amdgpu_dpm_set_fan_speed_pwm(struct amdgpu_device *adev,
@@ -1105,7 +1107,7 @@ int amdgpu_dpm_set_fan_speed_pwm(struct amdgpu_device *adev,
int ret = 0;
if (!pp_funcs->set_fan_speed_pwm)
- return -EINVAL;
+ return -EOPNOTSUPP;
mutex_lock(&adev->pm.mutex);
ret = pp_funcs->set_fan_speed_pwm(adev->powerplay.pp_handle,
@@ -1122,7 +1124,7 @@ int amdgpu_dpm_get_fan_speed_pwm(struct amdgpu_device *adev,
int ret = 0;
if (!pp_funcs->get_fan_speed_pwm)
- return -EINVAL;
+ return -EOPNOTSUPP;
mutex_lock(&adev->pm.mutex);
ret = pp_funcs->get_fan_speed_pwm(adev->powerplay.pp_handle,
@@ -1139,7 +1141,7 @@ int amdgpu_dpm_get_fan_speed_rpm(struct amdgpu_device *adev,
int ret = 0;
if (!pp_funcs->get_fan_speed_rpm)
- return -EINVAL;
+ return -EOPNOTSUPP;
mutex_lock(&adev->pm.mutex);
ret = pp_funcs->get_fan_speed_rpm(adev->powerplay.pp_handle,
@@ -1156,7 +1158,7 @@ int amdgpu_dpm_set_fan_speed_rpm(struct amdgpu_device *adev,
int ret = 0;
if (!pp_funcs->set_fan_speed_rpm)
- return -EINVAL;
+ return -EOPNOTSUPP;
mutex_lock(&adev->pm.mutex);
ret = pp_funcs->set_fan_speed_rpm(adev->powerplay.pp_handle,
@@ -1170,16 +1172,17 @@ int amdgpu_dpm_set_fan_control_mode(struct amdgpu_device *adev,
uint32_t mode)
{
const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
+ int ret = 0;
if (!pp_funcs->set_fan_control_mode)
return -EOPNOTSUPP;
mutex_lock(&adev->pm.mutex);
- pp_funcs->set_fan_control_mode(adev->powerplay.pp_handle,
- mode);
+ ret = pp_funcs->set_fan_control_mode(adev->powerplay.pp_handle,
+ mode);
mutex_unlock(&adev->pm.mutex);
- return 0;
+ return ret;
}
int amdgpu_dpm_get_power_limit(struct amdgpu_device *adev,