[PATCH 4/5] drm/amdgpu: refine pwm1_enable's callback function.

Rex Zhu Rex.Zhu at amd.com
Thu May 4 12:02:59 UTC 2017


Change-Id: I8879f7c13015f4d7019f2a2d600826321ec82d17
Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 2714201..b060c66 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -861,14 +861,16 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev,
 {
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	u32 pwm_mode = 0;
+	u32 size = 0;
 
 	if (!adev->pp_enabled && !adev->pm.funcs->get_fan_control_mode)
 		return -EINVAL;
 
 	pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
 
-	/* never 0 (full-speed), fuse or smc-controlled always */
-	return sprintf(buf, "%i\n", pwm_mode == FDO_PWM_MODE_STATIC ? 1 : 2);
+	return sprintf(buf + size, " 0: manual %s \n 1: static %s \n",
+					(pwm_mode == 0) ? "*" : "",
+					(pwm_mode == 1) ? "*" : ""
 }
 
 static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
@@ -888,10 +890,10 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
 		return err;
 
 	switch (value) {
-	case 1: /* manual, percent-based */
+	case 1:
 		amdgpu_dpm_set_fan_control_mode(adev, FDO_PWM_MODE_STATIC);
 		break;
-	default: /* disable */
+	case 0: /* disable */
 		amdgpu_dpm_set_fan_control_mode(adev, 0);
 		break;
 	}
-- 
1.9.1



More information about the amd-gfx mailing list