Skip to contentSkip to conversation

drm/amd/pm: correct hwmon power lable name

PATCH In review Yang Wang 2 participants 2 messages Feb 8, 2022

Subsystems (3)
lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH 1/1 drm/amd/pm: correct hwmon power lable name

only vangogh has 2 types of hwmon power node: "fastPPT" and "slowPPT", the other asic only has 1 type of hwmon power node: "PPT".

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +7 -3
index 426e00112c91..ad5da252228b 100644
@@ -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,
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

[Public]

A typo in subject, s/lable/label.

With that addressed, the patch is:

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yang Wang
Sent: Tuesday, February 8, 2022 3:44 PM
To: [email protected]
Cc: Hou, Xiaomeng (Matthew) <[email protected]>; Lazar, Lijo <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: [PATCH] drm/amd/pm: correct hwmon power lable name

only vangogh has 2 types of hwmon power node: "fastPPT" and "slowPPT", the other asic only has 1 type of hwmon power node: "PPT".

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +7 -3
index 426e00112c91..ad5da252228b 100644
@@ -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,

--
2.25.1