drm/amd/pm: Add GC v9.4.3 thermal limits to hwmon
authorLijo Lazar <lijo.lazar@amd.com>
Wed, 20 Sep 2023 10:19:30 +0000 (15:49 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 4 Oct 2023 22:43:06 +0000 (18:43 -0400)
Publish max operating temperature of SOC and memory as temp*_emergency
nodes in hwmon. temp*_crit will show the throttle temperature limits.

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

index da4d5919c8b46729c253b4b6d93109eeeefdfaad..4c65a2fac028b51487b80c21179b94064ec4219c 100644 (file)
@@ -3423,15 +3423,20 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
                return 0;
 
        /* hotspot temperature for gc 9,4,3*/
-       if ((gc_ver == IP_VERSION(9, 4, 3)) &&
-           (attr == &sensor_dev_attr_temp1_input.dev_attr.attr ||
-            attr == &sensor_dev_attr_temp1_label.dev_attr.attr))
-               return 0;
+       if (gc_ver == IP_VERSION(9, 4, 3)) {
+               if (attr == &sensor_dev_attr_temp1_input.dev_attr.attr ||
+                   attr == &sensor_dev_attr_temp1_emergency.dev_attr.attr ||
+                   attr == &sensor_dev_attr_temp1_label.dev_attr.attr)
+                       return 0;
+
+               if (attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr ||
+                   attr == &sensor_dev_attr_temp3_emergency.dev_attr.attr)
+                       return attr->mode;
+       }
 
        /* only SOC15 dGPUs support hotspot and mem temperatures */
-       if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0) ||
-           (gc_ver == IP_VERSION(9, 4, 3))) &&
-            (attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr ||
+       if (((adev->flags & AMD_IS_APU) || gc_ver < IP_VERSION(9, 0, 0)) &&
+           (attr == &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr ||
             attr == &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr ||
             attr == &sensor_dev_attr_temp1_emergency.dev_attr.attr ||
             attr == &sensor_dev_attr_temp2_emergency.dev_attr.attr ||