RE: [PATCH 5/5] drm/amdgpu: Disable sysfs pwm1 if not in manual fan control

2018-09-30 Thread Quan, Evan
Series is Reviewed-by: Evan Quan 

> -Original Message-
> From: amd-gfx  On Behalf Of Rex
> Zhu
> Sent: 2018年9月30日 14:18
> To: amd-gfx@lists.freedesktop.org
> Cc: Zhu, Rex 
> Subject: [PATCH 5/5] drm/amdgpu: Disable sysfs pwm1 if not in manual fan
> control
> 
> Following lm-sensors 3.0.0,
> Only enable pwm1 sysfs when fan control mode(pwm1_enable) in manual
> 
> Signed-off-by: Rex Zhu 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index 1d85706..d6bd5ab 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -1120,12 +1120,19 @@ static ssize_t amdgpu_hwmon_set_pwm1(struct
> device *dev,
>   struct amdgpu_device *adev = dev_get_drvdata(dev);
>   int err;
>   u32 value;
> + u32 pwm_mode;
> 
>   /* Can't adjust fan when the card is off */
>   if  ((adev->flags & AMD_IS_PX) &&
>(adev->ddev->switch_power_state !=
> DRM_SWITCH_POWER_ON))
>   return -EINVAL;
> 
> + pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
> + if (pwm_mode != AMD_FAN_CTRL_MANUAL) {
> + pr_info("manual fan speed control should be enabled
> first\n");
> + return -EINVAL;
> + }
> +
>   err = kstrtou32(buf, 10, );
>   if (err)
>   return err;
> --
> 1.9.1
> 
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 5/5] drm/amdgpu: Disable sysfs pwm1 if not in manual fan control

2018-09-30 Thread Rex Zhu
Following lm-sensors 3.0.0,
Only enable pwm1 sysfs when fan control mode(pwm1_enable)
in manual

Signed-off-by: Rex Zhu 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 1d85706..d6bd5ab 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1120,12 +1120,19 @@ static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev,
struct amdgpu_device *adev = dev_get_drvdata(dev);
int err;
u32 value;
+   u32 pwm_mode;
 
/* Can't adjust fan when the card is off */
if  ((adev->flags & AMD_IS_PX) &&
 (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON))
return -EINVAL;
 
+   pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
+   if (pwm_mode != AMD_FAN_CTRL_MANUAL) {
+   pr_info("manual fan speed control should be enabled first\n");
+   return -EINVAL;
+   }
+
err = kstrtou32(buf, 10, );
if (err)
return err;
-- 
1.9.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx