drm/amdgpu/pm: Fix the error of pwm1_enable setting
commit 0dafaf659cc463f2db0af92003313a8bc46781cd upstream. Fix the pwm_mode value error which used for pwm1_enable setting Signed-off-by: Ma Jun <Jun.Ma2@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3a70b1c932
commit
7f122486a0
@ -2344,6 +2344,7 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
|
|||||||
{
|
{
|
||||||
struct amdgpu_device *adev = dev_get_drvdata(dev);
|
struct amdgpu_device *adev = dev_get_drvdata(dev);
|
||||||
int err, ret;
|
int err, ret;
|
||||||
|
u32 pwm_mode;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (amdgpu_in_reset(adev))
|
if (amdgpu_in_reset(adev))
|
||||||
@ -2355,13 +2356,22 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
if (value == 0)
|
||||||
|
pwm_mode = AMD_FAN_CTRL_NONE;
|
||||||
|
else if (value == 1)
|
||||||
|
pwm_mode = AMD_FAN_CTRL_MANUAL;
|
||||||
|
else if (value == 2)
|
||||||
|
pwm_mode = AMD_FAN_CTRL_AUTO;
|
||||||
|
else
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
ret = pm_runtime_get_sync(adev_to_drm(adev)->dev);
|
ret = pm_runtime_get_sync(adev_to_drm(adev)->dev);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = amdgpu_dpm_set_fan_control_mode(adev, value);
|
ret = amdgpu_dpm_set_fan_control_mode(adev, pwm_mode);
|
||||||
|
|
||||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user