From: Kevin Wang <kevin1.w...@amd.com>

when sw-smu is enabled, the driver won't init powerplay structure.

Signed-off-by: Kevin Wang <kevin1.w...@amd.com>
Reviewed-by: Huang Rui <ray.hu...@amd.com>
Reviewed-by: Likun Gao <likun....@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 56 ++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 03eea8b..7b6be5a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -2046,18 +2046,20 @@ static umode_t hwmon_attributes_visible(struct kobject 
*kobj,
             attr == &sensor_dev_attr_fan1_enable.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 
*/
-           (!adev->powerplay.pp_funcs->get_fan_control_mode &&
-            attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* can't 
query state */
-               effective_mode &= ~S_IRUGO;
-
-       if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&
-            attr == &sensor_dev_attr_pwm1.dev_attr.attr) || /* can't manage 
fan */
-           (!adev->powerplay.pp_funcs->set_fan_control_mode &&
-            attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* can't 
manage state */
-               effective_mode &= ~S_IWUSR;
+       if (!is_support_sw_smu(adev)) {
+               /* 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 */
+                   (!adev->powerplay.pp_funcs->get_fan_control_mode &&
+                    attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* 
can't query state */
+                       effective_mode &= ~S_IRUGO;
+
+               if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&
+                    attr == &sensor_dev_attr_pwm1.dev_attr.attr) || /* can't 
manage fan */
+                   (!adev->powerplay.pp_funcs->set_fan_control_mode &&
+                    attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* 
can't manage state */
+                       effective_mode &= ~S_IWUSR;
+       }
 
        if ((adev->flags & AMD_IS_APU) &&
            (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr ||
@@ -2065,20 +2067,22 @@ static umode_t hwmon_attributes_visible(struct kobject 
*kobj,
             attr == &sensor_dev_attr_power1_cap.dev_attr.attr))
                return 0;
 
-       /* hide max/min values if we can't both query and manage the fan */
-       if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&
-            !adev->powerplay.pp_funcs->get_fan_speed_percent) &&
-            (!adev->powerplay.pp_funcs->set_fan_speed_rpm &&
-            !adev->powerplay.pp_funcs->get_fan_speed_rpm) &&
-           (attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
-            attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
-               return 0;
-
-       if ((!adev->powerplay.pp_funcs->set_fan_speed_rpm &&
-            !adev->powerplay.pp_funcs->get_fan_speed_rpm) &&
-           (attr == &sensor_dev_attr_fan1_max.dev_attr.attr ||
-            attr == &sensor_dev_attr_fan1_min.dev_attr.attr))
-               return 0;
+       if (!is_support_sw_smu(adev)) {
+               /* hide max/min values if we can't both query and manage the 
fan */
+               if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&
+                    !adev->powerplay.pp_funcs->get_fan_speed_percent) &&
+                    (!adev->powerplay.pp_funcs->set_fan_speed_rpm &&
+                    !adev->powerplay.pp_funcs->get_fan_speed_rpm) &&
+                   (attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
+                    attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
+                       return 0;
+
+               if ((!adev->powerplay.pp_funcs->set_fan_speed_rpm &&
+                    !adev->powerplay.pp_funcs->get_fan_speed_rpm) &&
+                   (attr == &sensor_dev_attr_fan1_max.dev_attr.attr ||
+                    attr == &sensor_dev_attr_fan1_min.dev_attr.attr))
+                       return 0;
+       }
 
        /* only APUs have vddnb */
        if (!(adev->flags & AMD_IS_APU) &&
-- 
2.7.4

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

Reply via email to