diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2018-01-24 16:41:50 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-02-19 14:18:49 -0500 |
commit | 5ec36e2d7030c17bd00c9766f9b97b421eae8cdf (patch) | |
tree | 1ab279ad59d5be75668d6465d7bd83876ae00974 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |
parent | 6f05c4e9d1a1a743eca76ddbad788386d7bb534e (diff) |
drm/amdgpu/pm: handle fan properly when card is powered down
Return an error if the user tried to check or set the fan
parameters while the card is powered down (e.g., on a PX/HG
system for example). This makes the fan consistent with the
temperature stuff.
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index fda858ec3cad..18873c2286f9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |||
@@ -991,6 +991,11 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev, | |||
991 | int err; | 991 | int err; |
992 | int value; | 992 | int value; |
993 | 993 | ||
994 | /* Can't adjust fan when the card is off */ | ||
995 | if ((adev->flags & AMD_IS_PX) && | ||
996 | (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
997 | return -EINVAL; | ||
998 | |||
994 | if (!adev->powerplay.pp_funcs->set_fan_control_mode) | 999 | if (!adev->powerplay.pp_funcs->set_fan_control_mode) |
995 | return -EINVAL; | 1000 | return -EINVAL; |
996 | 1001 | ||
@@ -1025,6 +1030,11 @@ static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev, | |||
1025 | int err; | 1030 | int err; |
1026 | u32 value; | 1031 | u32 value; |
1027 | 1032 | ||
1033 | /* Can't adjust fan when the card is off */ | ||
1034 | if ((adev->flags & AMD_IS_PX) && | ||
1035 | (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1036 | return -EINVAL; | ||
1037 | |||
1028 | err = kstrtou32(buf, 10, &value); | 1038 | err = kstrtou32(buf, 10, &value); |
1029 | if (err) | 1039 | if (err) |
1030 | return err; | 1040 | return err; |
@@ -1048,6 +1058,11 @@ static ssize_t amdgpu_hwmon_get_pwm1(struct device *dev, | |||
1048 | int err; | 1058 | int err; |
1049 | u32 speed = 0; | 1059 | u32 speed = 0; |
1050 | 1060 | ||
1061 | /* Can't adjust fan when the card is off */ | ||
1062 | if ((adev->flags & AMD_IS_PX) && | ||
1063 | (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1064 | return -EINVAL; | ||
1065 | |||
1051 | if (adev->powerplay.pp_funcs->get_fan_speed_percent) { | 1066 | if (adev->powerplay.pp_funcs->get_fan_speed_percent) { |
1052 | err = amdgpu_dpm_get_fan_speed_percent(adev, &speed); | 1067 | err = amdgpu_dpm_get_fan_speed_percent(adev, &speed); |
1053 | if (err) | 1068 | if (err) |
@@ -1067,6 +1082,11 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev, | |||
1067 | int err; | 1082 | int err; |
1068 | u32 speed = 0; | 1083 | u32 speed = 0; |
1069 | 1084 | ||
1085 | /* Can't adjust fan when the card is off */ | ||
1086 | if ((adev->flags & AMD_IS_PX) && | ||
1087 | (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1088 | return -EINVAL; | ||
1089 | |||
1070 | if (adev->powerplay.pp_funcs->get_fan_speed_rpm) { | 1090 | if (adev->powerplay.pp_funcs->get_fan_speed_rpm) { |
1071 | err = amdgpu_dpm_get_fan_speed_rpm(adev, &speed); | 1091 | err = amdgpu_dpm_get_fan_speed_rpm(adev, &speed); |
1072 | if (err) | 1092 | if (err) |