All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 5/5] drm/amdgpu: Disable sysfs pwm1 if not in manual fan control
Date: Sun, 30 Sep 2018 14:17:59 +0800	[thread overview]
Message-ID: <1538288279-11428-5-git-send-email-Rex.Zhu@amd.com> (raw)
In-Reply-To: <1538288279-11428-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>

Following lm-sensors 3.0.0,
Only enable pwm1 sysfs when fan control mode(pwm1_enable)
in manual

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 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, &value);
 	if (err)
 		return err;
-- 
1.9.1

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

  parent reply	other threads:[~2018-09-30  6:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-30  6:17 [PATCH 1/5] drm/amdgpu: Refine uvd_v6/7_0_enc_get_destroy_msg Rex Zhu
     [not found] ` <1538288279-11428-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-09-30  6:17   ` [PATCH 2/5] drm/amdgpu: Add new AMDGPU_PP_SENSOR_MIN/MAX_FAN_RPM sensor Rex Zhu
2018-09-30  6:17   ` [PATCH 3/5] drm/amd/pp: Implement AMDGPU_PP_SENSOR_MIN/MAX_FAN_RPM Rex Zhu
2018-09-30  6:17   ` [PATCH 4/5] drm/amdgpu: Add fan RPM setting via sysfs Rex Zhu
     [not found]     ` <1538288279-11428-4-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-10-01 13:15       ` Deucher, Alexander
     [not found]         ` <BN6PR12MB1809F36EC670D3FF22C6F931F7EF0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-01 13:34           ` Zhu, Rex
     [not found]             ` <BYAPR12MB27758F29CA1D3B4FB83CEC97FBEF0-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-05 14:39               ` Russell, Kent
     [not found]                 ` <BN6PR12MB1618C067E569FE45BF56E9A185EB0-/b2+HYfkarRqaFUXYJa4HgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-05 15:53                   ` Zhu, Rex
     [not found]                     ` <BYAPR12MB27750751386DB80F341E6F68FBEB0-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-05 15:55                       ` Russell, Kent
     [not found]                         ` <BN6PR12MB1618D1DAC6C54801483FD6F985EB0-/b2+HYfkarRqaFUXYJa4HgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-05 16:06                           ` Zhu, Rex
2018-10-05 18:08                   ` Deucher, Alexander
2018-09-30  6:17   ` Rex Zhu [this message]
     [not found]     ` <1538288279-11428-5-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-09-30 11:00       ` [PATCH 5/5] drm/amdgpu: Disable sysfs pwm1 if not in manual fan control Quan, Evan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1538288279-11428-5-git-send-email-Rex.Zhu@amd.com \
    --to=rex.zhu-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.