diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-09-28 04:01:48 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-10-09 18:05:05 -0400 |
commit | b8a9c003679ea3619cef4092b10390224f09fbaa (patch) | |
tree | 1548dbfa08af8c78347806fff54eb912778cef32 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |
parent | c2870527f700e919fbb543baef36032be5d626e0 (diff) |
drm/amdgpu: Disable sysfs pwm1 if not in manual fan control
Following lm-sensors 3.0.0,
Only enable pwm1 sysfs when fan control mode(pwm1_enable)
in manual
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-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 | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index a9f68753ec7f..68548fbdee09 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |||
@@ -1120,12 +1120,19 @@ static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev, | |||
1120 | struct amdgpu_device *adev = dev_get_drvdata(dev); | 1120 | struct amdgpu_device *adev = dev_get_drvdata(dev); |
1121 | int err; | 1121 | int err; |
1122 | u32 value; | 1122 | u32 value; |
1123 | u32 pwm_mode; | ||
1123 | 1124 | ||
1124 | /* Can't adjust fan when the card is off */ | 1125 | /* Can't adjust fan when the card is off */ |
1125 | if ((adev->flags & AMD_IS_PX) && | 1126 | if ((adev->flags & AMD_IS_PX) && |
1126 | (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | 1127 | (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) |
1127 | return -EINVAL; | 1128 | return -EINVAL; |
1128 | 1129 | ||
1130 | pwm_mode = amdgpu_dpm_get_fan_control_mode(adev); | ||
1131 | if (pwm_mode != AMD_FAN_CTRL_MANUAL) { | ||
1132 | pr_info("manual fan speed control should be enabled first\n"); | ||
1133 | return -EINVAL; | ||
1134 | } | ||
1135 | |||
1129 | err = kstrtou32(buf, 10, &value); | 1136 | err = kstrtou32(buf, 10, &value); |
1130 | if (err) | 1137 | if (err) |
1131 | return err; | 1138 | return err; |