* [PATCH] drm/amdgpu/powerplay: implement interface pp_power_profile_mode
@ 2019-10-16 8:24 Liang, Prike
[not found] ` <1571214251-410-1-git-send-email-Prike.Liang-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Liang, Prike @ 2019-10-16 8:24 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Liang, Prike, Quan, Evan, Huang, Ray
implement get_power_profile_mode for getting power profile mode status.
Signed-off-by: Prike Liang <Prike.Liang@amd.com>
---
drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 34 ++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
index fa314c2..953e347 100644
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
@@ -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)
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] drm/amdgpu/powerplay: implement interface pp_power_profile_mode
[not found] ` <1571214251-410-1-git-send-email-Prike.Liang-5C7GfCeVMHo@public.gmane.org>
@ 2019-10-16 9:38 ` Quan, Evan
0 siblings, 0 replies; 2+ messages in thread
From: Quan, Evan @ 2019-10-16 9:38 UTC (permalink / raw)
To: Liang, Prike, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Huang, Ray
Reviewed-by: Evan Quan <evan.quan@amd.com>
> -----Original Message-----
> From: Liang, Prike <Prike.Liang@amd.com>
> Sent: 2019年10月16日 16:24
> To: amd-gfx@lists.freedesktop.org
> Cc: Quan, Evan <Evan.Quan@amd.com>; Huang, Ray
> <Ray.Huang@amd.com>; Liang, Prike <Prike.Liang@amd.com>
> Subject: [PATCH] drm/amdgpu/powerplay: implement interface
> pp_power_profile_mode
>
> implement get_power_profile_mode for getting power profile mode status.
>
> Signed-off-by: Prike Liang <Prike.Liang@amd.com>
> ---
> drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 34
> ++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
> b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
> index fa314c2..953e347 100644
> --- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
> @@ -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)
> --
> 2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-16 9:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 8:24 [PATCH] drm/amdgpu/powerplay: implement interface pp_power_profile_mode Liang, Prike
[not found] ` <1571214251-410-1-git-send-email-Prike.Liang-5C7GfCeVMHo@public.gmane.org>
2019-10-16 9:38 ` Quan, Evan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.