All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/pm: Remove artificial freq level on Navi1x
@ 2021-11-15  7:42 Lijo Lazar
  2021-11-15 14:37 ` Deucher, Alexander
  2021-11-16  1:38 ` Quan, Evan
  0 siblings, 2 replies; 3+ messages in thread
From: Lijo Lazar @ 2021-11-15  7:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander.Deucher, Evan.Quan, kevinyang.wang, Hawking.Zhang

Print Navi1x fine grained clocks in a consistent manner with other SOCs.
Don't show aritificial DPM level when the current clock equals min or max.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index 71161f6b78fe..60a557068ea4 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -1265,7 +1265,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,
 			enum smu_clk_type clk_type, char *buf)
 {
 	uint16_t *curve_settings;
-	int i, size = 0, ret = 0;
+	int i, levels, size = 0, ret = 0;
 	uint32_t cur_value = 0, value = 0, count = 0;
 	uint32_t freq_values[3] = {0};
 	uint32_t mark_index = 0;
@@ -1319,14 +1319,17 @@ static int navi10_print_clk_levels(struct smu_context *smu,
 			freq_values[1] = cur_value;
 			mark_index = cur_value == freq_values[0] ? 0 :
 				     cur_value == freq_values[2] ? 2 : 1;
-			if (mark_index != 1)
-				freq_values[1] = (freq_values[0] + freq_values[2]) / 2;
 
-			for (i = 0; i < 3; i++) {
+			levels = 3;
+			if (mark_index != 1) {
+				levels = 2;
+				freq_values[1] = freq_values[2];
+			}
+
+			for (i = 0; i < levels; i++) {
 				size += sysfs_emit_at(buf, size, "%d: %uMhz %s\n", i, freq_values[i],
 						i == mark_index ? "*" : "");
 			}
-
 		}
 		break;
 	case SMU_PCIE:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amd/pm: Remove artificial freq level on Navi1x
  2021-11-15  7:42 [PATCH] drm/amd/pm: Remove artificial freq level on Navi1x Lijo Lazar
@ 2021-11-15 14:37 ` Deucher, Alexander
  2021-11-16  1:38 ` Quan, Evan
  1 sibling, 0 replies; 3+ messages in thread
From: Deucher, Alexander @ 2021-11-15 14:37 UTC (permalink / raw)
  To: Lazar, Lijo, amd-gfx; +Cc: Quan, Evan, Wang, Yang(Kevin), Zhang, Hawking

[-- Attachment #1: Type: text/plain, Size: 2543 bytes --]

[AMD Official Use Only]

Acked-by: Alex Deucher <alexander.deucher@amd.com>
________________________________
From: Lazar, Lijo <Lijo.Lazar@amd.com>
Sent: Monday, November 15, 2021 2:42 AM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Wang, Yang(Kevin) <KevinYang.Wang@amd.com>; Quan, Evan <Evan.Quan@amd.com>
Subject: [PATCH] drm/amd/pm: Remove artificial freq level on Navi1x

Print Navi1x fine grained clocks in a consistent manner with other SOCs.
Don't show aritificial DPM level when the current clock equals min or max.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index 71161f6b78fe..60a557068ea4 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -1265,7 +1265,7 @@ static int navi10_print_clk_levels(struct smu_context *smu,
                         enum smu_clk_type clk_type, char *buf)
 {
         uint16_t *curve_settings;
-       int i, size = 0, ret = 0;
+       int i, levels, size = 0, ret = 0;
         uint32_t cur_value = 0, value = 0, count = 0;
         uint32_t freq_values[3] = {0};
         uint32_t mark_index = 0;
@@ -1319,14 +1319,17 @@ static int navi10_print_clk_levels(struct smu_context *smu,
                         freq_values[1] = cur_value;
                         mark_index = cur_value == freq_values[0] ? 0 :
                                      cur_value == freq_values[2] ? 2 : 1;
-                       if (mark_index != 1)
-                               freq_values[1] = (freq_values[0] + freq_values[2]) / 2;

-                       for (i = 0; i < 3; i++) {
+                       levels = 3;
+                       if (mark_index != 1) {
+                               levels = 2;
+                               freq_values[1] = freq_values[2];
+                       }
+
+                       for (i = 0; i < levels; i++) {
                                 size += sysfs_emit_at(buf, size, "%d: %uMhz %s\n", i, freq_values[i],
                                                 i == mark_index ? "*" : "");
                         }
-
                 }
                 break;
         case SMU_PCIE:
--
2.17.1


[-- Attachment #2: Type: text/html, Size: 6253 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amd/pm: Remove artificial freq level on Navi1x
  2021-11-15  7:42 [PATCH] drm/amd/pm: Remove artificial freq level on Navi1x Lijo Lazar
  2021-11-15 14:37 ` Deucher, Alexander
@ 2021-11-16  1:38 ` Quan, Evan
  1 sibling, 0 replies; 3+ messages in thread
From: Quan, Evan @ 2021-11-16  1:38 UTC (permalink / raw)
  To: Lazar, Lijo, amd-gfx
  Cc: Deucher, Alexander, Wang, Yang(Kevin), Zhang, Hawking

[AMD Official Use Only]

Reviewed-by: Evan Quan <evan.quan@amd.com>

> -----Original Message-----
> From: Lazar, Lijo <Lijo.Lazar@amd.com>
> Sent: Monday, November 15, 2021 3:42 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking
> <Hawking.Zhang@amd.com>; Wang, Yang(Kevin)
> <KevinYang.Wang@amd.com>; Quan, Evan <Evan.Quan@amd.com>
> Subject: [PATCH] drm/amd/pm: Remove artificial freq level on Navi1x
> 
> Print Navi1x fine grained clocks in a consistent manner with other SOCs.
> Don't show aritificial DPM level when the current clock equals min or max.
> 
> Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
> ---
>  drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> index 71161f6b78fe..60a557068ea4 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
> @@ -1265,7 +1265,7 @@ static int navi10_print_clk_levels(struct
> smu_context *smu,
>  			enum smu_clk_type clk_type, char *buf)  {
>  	uint16_t *curve_settings;
> -	int i, size = 0, ret = 0;
> +	int i, levels, size = 0, ret = 0;
>  	uint32_t cur_value = 0, value = 0, count = 0;
>  	uint32_t freq_values[3] = {0};
>  	uint32_t mark_index = 0;
> @@ -1319,14 +1319,17 @@ static int navi10_print_clk_levels(struct
> smu_context *smu,
>  			freq_values[1] = cur_value;
>  			mark_index = cur_value == freq_values[0] ? 0 :
>  				     cur_value == freq_values[2] ? 2 : 1;
> -			if (mark_index != 1)
> -				freq_values[1] = (freq_values[0] +
> freq_values[2]) / 2;
> 
> -			for (i = 0; i < 3; i++) {
> +			levels = 3;
> +			if (mark_index != 1) {
> +				levels = 2;
> +				freq_values[1] = freq_values[2];
> +			}
> +
> +			for (i = 0; i < levels; i++) {
>  				size += sysfs_emit_at(buf, size,
> "%d: %uMhz %s\n", i, freq_values[i],
>  						i == mark_index ? "*" : "");
>  			}
> -
>  		}
>  		break;
>  	case SMU_PCIE:
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-16  1:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  7:42 [PATCH] drm/amd/pm: Remove artificial freq level on Navi1x Lijo Lazar
2021-11-15 14:37 ` Deucher, Alexander
2021-11-16  1: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.