aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3280-drm-amdgpu-pm-handle-fan-properly-when-card-is-power.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3280-drm-amdgpu-pm-handle-fan-properly-when-card-is-power.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3280-drm-amdgpu-pm-handle-fan-properly-when-card-is-power.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3280-drm-amdgpu-pm-handle-fan-properly-when-card-is-power.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3280-drm-amdgpu-pm-handle-fan-properly-when-card-is-power.patch
new file mode 100644
index 00000000..91092806
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3280-drm-amdgpu-pm-handle-fan-properly-when-card-is-power.patch
@@ -0,0 +1,72 @@
+From a48aa27433183a461240fe0466f3e2c2aa359ad2 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Wed, 24 Jan 2018 16:41:50 -0500
+Subject: [PATCH 3280/4131] drm/amdgpu/pm: handle fan properly when card is
+ powered down
+
+Return an error if the user tried to check or set the fan
+parameters while the card is powered down (e.g., on a PX/HG
+system for example). This makes the fan consistent with the
+temperature stuff.
+
+Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+index 06f6317..773a915 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+@@ -989,6 +989,11 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
+ int err;
+ int value;
+
++ /* 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;
++
+ if (!adev->powerplay.pp_funcs->set_fan_control_mode)
+ return -EINVAL;
+
+@@ -1023,6 +1028,11 @@ static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev,
+ int err;
+ u32 value;
+
++ /* 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;
++
+ err = kstrtou32(buf, 10, &value);
+ if (err)
+ return err;
+@@ -1046,6 +1056,11 @@ static ssize_t amdgpu_hwmon_get_pwm1(struct device *dev,
+ int err;
+ u32 speed = 0;
+
++ /* 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;
++
+ if (adev->powerplay.pp_funcs->get_fan_speed_percent) {
+ err = amdgpu_dpm_get_fan_speed_percent(adev, &speed);
+ if (err)
+@@ -1065,6 +1080,11 @@ static ssize_t amdgpu_hwmon_get_fan1_input(struct device *dev,
+ int err;
+ u32 speed = 0;
+
++ /* 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;
++
+ if (adev->powerplay.pp_funcs->get_fan_speed_rpm) {
+ err = amdgpu_dpm_get_fan_speed_rpm(adev, &speed);
+ if (err)
+--
+2.7.4
+