Commit da5f18e8 authored by Chengming Gui's avatar Chengming Gui Committed by Alex Deucher

drm/amd/powerplay: implement fan1_enable hwmon interface for SMU11 (v2)

set the fan1_enable hwmon interface to call
smu_get_fan_control_mode and smu_set_fan_control_mode.

v2: fix print value.
Signed-off-by: default avatarChengming Gui <Jack.Gui@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a76ff5af
...@@ -1635,11 +1635,14 @@ static ssize_t amdgpu_hwmon_get_fan1_enable(struct device *dev, ...@@ -1635,11 +1635,14 @@ static ssize_t amdgpu_hwmon_get_fan1_enable(struct device *dev,
struct amdgpu_device *adev = dev_get_drvdata(dev); struct amdgpu_device *adev = dev_get_drvdata(dev);
u32 pwm_mode = 0; u32 pwm_mode = 0;
if (is_support_sw_smu(adev)) {
pwm_mode = smu_get_fan_control_mode(&adev->smu);
} else {
if (!adev->powerplay.pp_funcs->get_fan_control_mode) if (!adev->powerplay.pp_funcs->get_fan_control_mode)
return -EINVAL; return -EINVAL;
pwm_mode = amdgpu_dpm_get_fan_control_mode(adev); pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
}
return sprintf(buf, "%i\n", pwm_mode == AMD_FAN_CTRL_AUTO ? 0 : 1); return sprintf(buf, "%i\n", pwm_mode == AMD_FAN_CTRL_AUTO ? 0 : 1);
} }
...@@ -1658,8 +1661,6 @@ static ssize_t amdgpu_hwmon_set_fan1_enable(struct device *dev, ...@@ -1658,8 +1661,6 @@ static ssize_t amdgpu_hwmon_set_fan1_enable(struct device *dev,
(adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON))
return -EINVAL; return -EINVAL;
if (!adev->powerplay.pp_funcs->set_fan_control_mode)
return -EINVAL;
err = kstrtoint(buf, 10, &value); err = kstrtoint(buf, 10, &value);
if (err) if (err)
...@@ -1672,7 +1673,13 @@ static ssize_t amdgpu_hwmon_set_fan1_enable(struct device *dev, ...@@ -1672,7 +1673,13 @@ static ssize_t amdgpu_hwmon_set_fan1_enable(struct device *dev,
else else
return -EINVAL; return -EINVAL;
if (is_support_sw_smu(adev)) {
smu_set_fan_control_mode(&adev->smu, pwm_mode);
} else {
if (!adev->powerplay.pp_funcs->set_fan_control_mode)
return -EINVAL;
amdgpu_dpm_set_fan_control_mode(adev, pwm_mode); amdgpu_dpm_set_fan_control_mode(adev, pwm_mode);
}
return count; return count;
} }
......
...@@ -1857,7 +1857,7 @@ smu_v11_0_set_fan_control_mode(struct smu_context *smu, ...@@ -1857,7 +1857,7 @@ smu_v11_0_set_fan_control_mode(struct smu_context *smu,
} }
if (ret) { if (ret) {
pr_err("[%s]Set fan control mode failed!"); pr_err("[%s]Set fan control mode failed!", __func__);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment