[PATCH 6/6] drm/amdgpu/pm: rework the hwmon visibility settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Series is Reviewed-by:  Rex Zhu <Rex.Zhu at amd.com>


Best Regards

Rex


________________________________
From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of Alex Deucher <alexdeucher at gmail.com>
Sent: Thursday, January 25, 2018 7:55 AM
To: amd-gfx at lists.freedesktop.org
Cc: Deucher, Alexander
Subject: [PATCH 6/6] drm/amdgpu/pm: rework the hwmon visibility settings

Previously we just always exposed everything for asics
supported by powerplay.  Make it a bit more fine grained.
In practice this shouldn't change anything.

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 6c53c6bc03eb..f12b9e777703 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1246,9 +1246,19 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
         struct amdgpu_device *adev = dev_get_drvdata(dev);
         umode_t effective_mode = attr->mode;

-       /* no skipping for powerplay */
-       if (adev->powerplay.cgs_device)
-               return effective_mode;
+       /* handle non-powerplay limitations */
+       if (!adev->powerplay.cgs_device) {
+               /* Skip fan attributes if fan is not present */
+               if (adev->pm.no_fan &&
+                   (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
+                    attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
+                    attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
+                    attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
+                       return 0;
+               /* requires powerplay */
+               if (attr == &sensor_dev_attr_fan1_input.dev_attr.attr)
+                       return 0;
+       }

         /* Skip limit attributes if DPM is not enabled */
         if (!adev->pm.dpm_enabled &&
@@ -1260,14 +1270,6 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
              attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
                 return 0;

-       /* Skip fan attributes if fan is not present */
-       if (adev->pm.no_fan &&
-           (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
-            attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
-            attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
-            attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
-               return 0;
-
         /* mask fan attributes if we have no bindings for this asic to expose */
         if ((!adev->powerplay.pp_funcs->get_fan_speed_percent &&
              attr == &sensor_dev_attr_pwm1.dev_attr.attr) || /* can't query fan */
@@ -1288,8 +1290,10 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
              attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
                 return 0;

-       /* requires powerplay */
-       if (attr == &sensor_dev_attr_fan1_input.dev_attr.attr)
+       /* only APUs have vddnb */
+       if (!(adev->flags & AMD_IS_APU) &&
+           (attr == &sensor_dev_attr_in1_input.dev_attr.attr ||
+            attr == &sensor_dev_attr_in1_label.dev_attr.attr))
                 return 0;

         return effective_mode;
--
2.13.6

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all freedesktop.org lists is subject to our Code of ...



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180125/5cdca2bc/attachment.html>


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux