Skip to contentSkip to conversation

drm/amdgpu/powerplay: implement interface pp_power_profile_mode

PATCH In review Liang, Prike 2 participants 2 messages Oct 16, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/powerplay: implement interface pp_power_profile_mode

implement get_power_profile_mode for getting power profile mode status.

---
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +34 -0
index fa314c2..953e347 100644
@@ -640,6 +640,39 @@ static int renoir_set_watermarks_table(
 	return ret;
 }
 
+static int renoir_get_power_profile_mode(struct smu_context *smu,
+					   char *buf)
+{
+	static const char *profile_name[] = {
+					"BOOTUP_DEFAULT",
+					"3D_FULL_SCREEN",
+					"POWER_SAVING",
+					"VIDEO",
+					"VR",
+					"COMPUTE",
+					"CUSTOM"};
+	uint32_t i, size = 0;
+	int16_t workload_type = 0;
+
+	if (!smu->pm_enabled || !buf)
+		return -EINVAL;
+
+	for (i = 0; i <= PP_SMC_POWER_PROFILE_CUSTOM; i++) {
+		/*
+		 * Conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT
+		 * Not all profile modes are supported on arcturus.
+		 */
+		workload_type = smu_workload_get_type(smu, i);
+		if (workload_type < 0)
+			continue;
+
+		size += sprintf(buf + size, "%2d %14s%s\n",
+			i, profile_name[i], (i == smu->power_profile_mode) ? "*" : " ");
+	}
+
+	return size;
+}
+
 static const struct pptable_funcs renoir_ppt_funcs = {
 	.get_smu_msg_index = renoir_get_smu_msg_index,
 	.get_smu_table_index = renoir_get_smu_table_index,
@@ -658,6 +691,7 @@ static const struct pptable_funcs renoir_ppt_funcs = {
 	.set_performance_level = renoir_set_performance_level,
 	.get_dpm_clock_table = renoir_get_dpm_clock_table,
 	.set_watermarks_table = renoir_set_watermarks_table,
+	.get_power_profile_mode = renoir_get_power_profile_mode,
 };
 
 void renoir_set_ppt_funcs(struct smu_context *smu)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1571214251-410-1-git-send-email-Prike.Liang-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#2 lore raw
Quoted 73 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: 2019年10月16日 16:24
To: [email protected]
Cc: Quan, Evan <[email protected]>; Huang, Ray <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH] drm/amdgpu/powerplay: implement interface pp_power_profile_mode

implement get_power_profile_mode for getting power profile mode status.

---
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 34
++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +20 -0
index fa314c2..953e347 100644
@@ -640,6 +640,39 @@ static int renoir_set_watermarks_table(
 	return ret;
 }
 
+static int renoir_get_power_profile_mode(struct smu_context *smu,
+					   char *buf)
+{
+	static const char *profile_name[] = {
+					"BOOTUP_DEFAULT",
+					"3D_FULL_SCREEN",
+					"POWER_SAVING",
+					"VIDEO",
+					"VR",
+					"COMPUTE",
+					"CUSTOM"};
+	uint32_t i, size = 0;
+	int16_t workload_type = 0;
+
+	if (!smu->pm_enabled || !buf)
+		return -EINVAL;
+
+	for (i = 0; i <= PP_SMC_POWER_PROFILE_CUSTOM; i++) {
+		/*
+		 * Conv PP_SMC_POWER_PROFILE* to

WORKLOAD_PPLIB_*_BIT

drivers/gpu/drm/amd/powerplay/renoir_ppt.c +8 -0
+		 * Not all profile modes are supported on arcturus.
+		 */
+		workload_type = smu_workload_get_type(smu, i);
+		if (workload_type < 0)
+			continue;
+
+		size += sprintf(buf + size, "%2d %14s%s\n",
+			i, profile_name[i], (i == smu->power_profile_mode) ?

"*" : " ");

drivers/gpu/drm/amd/powerplay/renoir_ppt.c +7 -1
+	}
+
+	return size;
+}
+
 static const struct pptable_funcs renoir_ppt_funcs = {
 	.get_smu_msg_index = renoir_get_smu_msg_index,
 	.get_smu_table_index = renoir_get_smu_table_index, @@ -658,6
+691,7 @@ static const struct pptable_funcs renoir_ppt_funcs = {
 	.set_performance_level = renoir_set_performance_level,
 	.get_dpm_clock_table = renoir_get_dpm_clock_table,
 	.set_watermarks_table = renoir_set_watermarks_table,
+	.get_power_profile_mode = renoir_get_power_profile_mode,
 };
 
 void renoir_set_ppt_funcs(struct smu_context *smu)
--
Quoted 1 line

2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx