Skip to content

Commit 0dafaf6

Browse files
Ma Junalexdeucher
authored andcommitted
drm/amdgpu/pm: Fix the error of pwm1_enable setting
Fix the pwm_mode value error which used for pwm1_enable setting Signed-off-by: Ma Jun <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent 937844d commit 0dafaf6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/gpu/drm/amd/pm/amdgpu_pm.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2558,6 +2558,7 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
25582558
{
25592559
struct amdgpu_device *adev = dev_get_drvdata(dev);
25602560
int err, ret;
2561+
u32 pwm_mode;
25612562
int value;
25622563

25632564
if (amdgpu_in_reset(adev))
@@ -2569,13 +2570,22 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
25692570
if (err)
25702571
return err;
25712572

2573+
if (value == 0)
2574+
pwm_mode = AMD_FAN_CTRL_NONE;
2575+
else if (value == 1)
2576+
pwm_mode = AMD_FAN_CTRL_MANUAL;
2577+
else if (value == 2)
2578+
pwm_mode = AMD_FAN_CTRL_AUTO;
2579+
else
2580+
return -EINVAL;
2581+
25722582
ret = pm_runtime_get_sync(adev_to_drm(adev)->dev);
25732583
if (ret < 0) {
25742584
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
25752585
return ret;
25762586
}
25772587

2578-
ret = amdgpu_dpm_set_fan_control_mode(adev, value);
2588+
ret = amdgpu_dpm_set_fan_control_mode(adev, pwm_mode);
25792589

25802590
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
25812591
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);

0 commit comments

Comments
 (0)