]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: Expose ppt1 limit for gc_v9_5_0
authorAsad Kamal <asad.kamal@amd.com>
Sun, 19 Oct 2025 19:26:01 +0000 (03:26 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 12 Nov 2025 02:54:16 +0000 (21:54 -0500)
Expose power2_cap hwmon node for retrieving and configuring ppt1
limit on supported boards for gc_v9_5_0

v2: Remove version check (Lijo)

v3: Remove power2_average (Lijo)

v4: Put back power2_average, will be removed separately (Lijo)

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/amdgpu_pm.c
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

index 40ffaced74fd27c79d617d9721d68e605f5b856c..c0e497e6b2f6ec276be5dfdb17ec1a0e6a586913 100644 (file)
@@ -3372,7 +3372,9 @@ static ssize_t amdgpu_hwmon_show_power_label(struct device *dev,
                                  to_sensor_dev_attr(attr)->index == PP_PWR_TYPE_FAST ?
                                  "fastPPT" : "slowPPT");
        else
-               return sysfs_emit(buf, "PPT\n");
+               return sysfs_emit(buf, "%s\n",
+                                 to_sensor_dev_attr(attr)->index == PP_PWR_TYPE_FAST ?
+                                 "PPT1" : "PPT");
 }
 
 static ssize_t amdgpu_hwmon_set_power_cap(struct device *dev,
@@ -3825,13 +3827,15 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
                return 0;
 
        /* only Vangogh has fast PPT limit and power labels */
-       if (!(gc_ver == IP_VERSION(10, 3, 1)) &&
-           (attr == &sensor_dev_attr_power2_average.dev_attr.attr ||
+       if ((attr == &sensor_dev_attr_power2_average.dev_attr.attr ||
             attr == &sensor_dev_attr_power2_cap_max.dev_attr.attr ||
             attr == &sensor_dev_attr_power2_cap_min.dev_attr.attr ||
             attr == &sensor_dev_attr_power2_cap.dev_attr.attr ||
             attr == &sensor_dev_attr_power2_cap_default.dev_attr.attr ||
-            attr == &sensor_dev_attr_power2_label.dev_attr.attr))
+            attr == &sensor_dev_attr_power2_label.dev_attr.attr) &&
+            (amdgpu_dpm_get_power_limit(adev, &tmp,
+                                        PP_PWR_LIMIT_MAX,
+                                        PP_PWR_TYPE_FAST) == -EOPNOTSUPP))
                return 0;
 
        return effective_mode;
index 14351ec707016d93f83083e017fa93e05b03665d..4a2c3ad0c38a01725d416e8befe41de4b9bf7c0f 100644 (file)
@@ -2941,6 +2941,8 @@ int smu_get_power_limit(void *handle,
        if (limit_type != SMU_DEFAULT_PPT_LIMIT) {
                if (smu->ppt_funcs->get_ppt_limit)
                        ret = smu->ppt_funcs->get_ppt_limit(smu, limit, limit_type, limit_level);
+               else
+                       return -EOPNOTSUPP;
        } else {
                switch (limit_level) {
                case SMU_PPT_LIMIT_CURRENT: