Skip to content

Commit 1541981

Browse files
superm1alexdeucher
authored andcommitted
drm/amd: Hide unsupported power attributes
Some ASICS only offer one type of power attribute, so in the visible callback check whether the attributes are supported and hide if not supported. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 9366c2e commit 1541981

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/gpu/drm/amd/pm/amdgpu_pm.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,6 +3179,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
31793179
struct amdgpu_device *adev = dev_get_drvdata(dev);
31803180
umode_t effective_mode = attr->mode;
31813181
uint32_t gc_ver = adev->ip_versions[GC_HWIP][0];
3182+
uint32_t tmp;
31823183

31833184
/* under multi-vf mode, the hwmon attributes are all not supported */
31843185
if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
@@ -3264,6 +3265,14 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
32643265
(attr == &sensor_dev_attr_power1_average.dev_attr.attr))
32653266
return 0;
32663267

3268+
/* not all products support both average and instantaneous */
3269+
if (attr == &sensor_dev_attr_power1_average.dev_attr.attr &&
3270+
amdgpu_hwmon_get_sensor_generic(adev, AMDGPU_PP_SENSOR_GPU_AVG_POWER, (void *)&tmp) == -EOPNOTSUPP)
3271+
return 0;
3272+
if (attr == &sensor_dev_attr_power1_input.dev_attr.attr &&
3273+
amdgpu_hwmon_get_sensor_generic(adev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER, (void *)&tmp) == -EOPNOTSUPP)
3274+
return 0;
3275+
32673276
/* hide max/min values if we can't both query and manage the fan */
32683277
if (((amdgpu_dpm_set_fan_speed_pwm(adev, U32_MAX) == -EOPNOTSUPP) &&
32693278
(amdgpu_dpm_get_fan_speed_pwm(adev, NULL) == -EOPNOTSUPP) &&

0 commit comments

Comments
 (0)