]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: correct hwmon power label name
authorYang Wang <KevinYang.Wang@amd.com>
Tue, 8 Feb 2022 07:36:50 +0000 (15:36 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 9 Feb 2022 21:57:52 +0000 (16:57 -0500)
only vangogh has 2 types of hwmon power node: "fastPPT" and "slowPPT",
the other asic only has 1 type of hwmon power node: "PPT".

Signed-off-by: Yang Wang <KevinYang.Wang@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/amdgpu_pm.c

index 426e00112c9106509719fc9b9fc8fca4d4f74769..ad5da252228b8ea936d34cb7262295a6a22e7087 100644 (file)
@@ -2842,10 +2842,14 @@ static ssize_t amdgpu_hwmon_show_power_label(struct device *dev,
                                         struct device_attribute *attr,
                                         char *buf)
 {
-       int limit_type = to_sensor_dev_attr(attr)->index;
+       struct amdgpu_device *adev = dev_get_drvdata(dev);
 
-       return sysfs_emit(buf, "%s\n",
-               limit_type == PP_PWR_TYPE_FAST ? "fastPPT" : "slowPPT");
+       if (adev->asic_type == CHIP_VANGOGH)
+               return sysfs_emit(buf, "%s\n",
+                                 to_sensor_dev_attr(attr)->index == PP_PWR_TYPE_FAST ?
+                                 "fastPPT" : "slowPPT");
+       else
+               return sysfs_emit(buf, "PPT\n");
 }
 
 static ssize_t amdgpu_hwmon_set_power_cap(struct device *dev,