Skip to content

Commit f317c5e

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]>
1 parent b8f67b9 commit f317c5e

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
@@ -2581,6 +2581,7 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
25812581
{
25822582
struct amdgpu_device *adev = dev_get_drvdata(dev);
25832583
int err, ret;
2584+
u32 pwm_mode;
25842585
int value;
25852586

25862587
if (amdgpu_in_reset(adev))
@@ -2592,13 +2593,22 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
25922593
if (err)
25932594
return err;
25942595

2596+
if (value == 0)
2597+
pwm_mode = AMD_FAN_CTRL_NONE;
2598+
else if (value == 1)
2599+
pwm_mode = AMD_FAN_CTRL_MANUAL;
2600+
else if (value == 2)
2601+
pwm_mode = AMD_FAN_CTRL_AUTO;
2602+
else
2603+
return -EINVAL;
2604+
25952605
ret = pm_runtime_get_sync(adev_to_drm(adev)->dev);
25962606
if (ret < 0) {
25972607
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
25982608
return ret;
25992609
}
26002610

2601-
ret = amdgpu_dpm_set_fan_control_mode(adev, value);
2611+
ret = amdgpu_dpm_set_fan_control_mode(adev, pwm_mode);
26022612

26032613
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
26042614
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);

0 commit comments

Comments
 (0)