Commit 239873fc authored by Kevin Wang's avatar Kevin Wang Committed by Alex Deucher

drm/amd/powerplay: hwmon don't check powerplay when sw smu is enabled

when sw-smu is enabled, the driver won't init powerplay structure.
Signed-off-by: default avatarKevin Wang <kevin1.wang@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarLikun Gao <Likun.Gao@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f14a323d
...@@ -2045,18 +2045,20 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, ...@@ -2045,18 +2045,20 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
attr == &sensor_dev_attr_fan1_enable.dev_attr.attr)) attr == &sensor_dev_attr_fan1_enable.dev_attr.attr))
return 0; return 0;
/* mask fan attributes if we have no bindings for this asic to expose */ if (!is_support_sw_smu(adev)) {
if ((!adev->powerplay.pp_funcs->get_fan_speed_percent && /* mask fan attributes if we have no bindings for this asic to expose */
attr == &sensor_dev_attr_pwm1.dev_attr.attr) || /* can't query fan */ if ((!adev->powerplay.pp_funcs->get_fan_speed_percent &&
(!adev->powerplay.pp_funcs->get_fan_control_mode && attr == &sensor_dev_attr_pwm1.dev_attr.attr) || /* can't query fan */
attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* can't query state */ (!adev->powerplay.pp_funcs->get_fan_control_mode &&
effective_mode &= ~S_IRUGO; 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 */ if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&
(!adev->powerplay.pp_funcs->set_fan_control_mode && attr == &sensor_dev_attr_pwm1.dev_attr.attr) || /* can't manage fan */
attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* can't manage state */ (!adev->powerplay.pp_funcs->set_fan_control_mode &&
effective_mode &= ~S_IWUSR; attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* can't manage state */
effective_mode &= ~S_IWUSR;
}
if ((adev->flags & AMD_IS_APU) && if ((adev->flags & AMD_IS_APU) &&
(attr == &sensor_dev_attr_power1_average.dev_attr.attr || (attr == &sensor_dev_attr_power1_average.dev_attr.attr ||
...@@ -2065,20 +2067,22 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, ...@@ -2065,20 +2067,22 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
attr == &sensor_dev_attr_power1_cap.dev_attr.attr)) attr == &sensor_dev_attr_power1_cap.dev_attr.attr))
return 0; return 0;
/* hide max/min values if we can't both query and manage the fan */ if (!is_support_sw_smu(adev)) {
if ((!adev->powerplay.pp_funcs->set_fan_speed_percent && /* hide max/min values if we can't both query and manage the fan */
!adev->powerplay.pp_funcs->get_fan_speed_percent) && if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&
(!adev->powerplay.pp_funcs->set_fan_speed_rpm && !adev->powerplay.pp_funcs->get_fan_speed_percent) &&
!adev->powerplay.pp_funcs->get_fan_speed_rpm) && (!adev->powerplay.pp_funcs->set_fan_speed_rpm &&
(attr == &sensor_dev_attr_pwm1_max.dev_attr.attr || !adev->powerplay.pp_funcs->get_fan_speed_rpm) &&
attr == &sensor_dev_attr_pwm1_min.dev_attr.attr)) (attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
return 0; 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) && if ((!adev->powerplay.pp_funcs->set_fan_speed_rpm &&
(attr == &sensor_dev_attr_fan1_max.dev_attr.attr || !adev->powerplay.pp_funcs->get_fan_speed_rpm) &&
attr == &sensor_dev_attr_fan1_min.dev_attr.attr)) (attr == &sensor_dev_attr_fan1_max.dev_attr.attr ||
return 0; attr == &sensor_dev_attr_fan1_min.dev_attr.attr))
return 0;
}
/* only APUs have vddnb */ /* only APUs have vddnb */
if (!(adev->flags & AMD_IS_APU) && if (!(adev->flags & AMD_IS_APU) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment